From 3792abb1900aead4e0978258adebf9b25bad6a69 Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 24 Aug 2008 20:37:45 +0200 Subject: [PATCH] Initial Comit: First commit. --- sauerbraten_unix | 59 + src/CVS/Entries | 13 + src/CVS/Entries.Log | 4 + src/CVS/Repository | 1 + src/CVS/Root | 1 + src/Makefile | 92 + src/Makefile-original | 87 + src/OCTA_TODO.txt | 90 + src/build | 2 + src/enet/.deps/callbacks.Po | 114 + src/enet/.deps/host.Po | 121 + src/enet/.deps/list.Po | 53 + src/enet/.deps/packet.Po | 121 + src/enet/.deps/peer.Po | 121 + src/enet/.deps/protocol.Po | 146 + src/enet/.deps/unix.Po | 185 + src/enet/.deps/win32.Po | 1 + src/enet/CVS/Entries | 27 + src/enet/CVS/Repository | 1 + src/enet/CVS/Root | 1 + src/enet/Doxyfile | 993 +++ src/enet/LICENSE | 7 + src/enet/Makefile | 656 ++ src/enet/Makefile.am | 5 + src/enet/Makefile.in | 656 ++ src/enet/README | 14 + src/enet/aclocal.m4 | 850 +++ src/enet/autom4te.cache/output.0 | 5691 +++++++++++++++++ src/enet/autom4te.cache/requests | 64 + src/enet/autom4te.cache/traces.0 | 347 ++ src/enet/callbacks.c | 53 + src/enet/config.guess | 1441 +++++ src/enet/config.log | 373 ++ src/enet/config.status | 939 +++ src/enet/config.sub | 1552 +++++ src/enet/configure | 5691 +++++++++++++++++ src/enet/configure.in | 36 + src/enet/depcomp | 522 ++ src/enet/design.txt | 117 + src/enet/docs/CVS/Entries | 7 + src/enet/docs/CVS/Repository | 1 + src/enet/docs/CVS/Root | 1 + src/enet/docs/FAQ.dox | 24 + src/enet/docs/design.dox | 126 + src/enet/docs/install.dox | 37 + src/enet/docs/license.dox | 26 + src/enet/docs/mainpage.dox | 67 + src/enet/docs/tutorial.dox | 349 ++ src/enet/enet.dsp | 164 + src/enet/host.c | 398 ++ src/enet/include/CVS/Entries | 3 + src/enet/include/CVS/Repository | 1 + src/enet/include/CVS/Root | 1 + src/enet/include/Makefile | 435 ++ src/enet/include/Makefile.am | 1 + src/enet/include/Makefile.in | 435 ++ src/enet/include/enet/CVS/Entries | 12 + src/enet/include/enet/CVS/Repository | 1 + src/enet/include/enet/CVS/Root | 1 + src/enet/include/enet/Makefile | 367 ++ src/enet/include/enet/Makefile.am | 12 + src/enet/include/enet/Makefile.in | 367 ++ src/enet/include/enet/callbacks.h | 28 + src/enet/include/enet/enet.h | 488 ++ src/enet/include/enet/list.h | 42 + src/enet/include/enet/protocol.h | 174 + src/enet/include/enet/time.h | 18 + src/enet/include/enet/types.h | 13 + src/enet/include/enet/unix.h | 36 + src/enet/include/enet/utility.h | 12 + src/enet/include/enet/win32.h | 51 + src/enet/install-sh | 251 + src/enet/list.c | 57 + src/enet/missing | 353 ++ src/enet/mkinstalldirs | 40 + src/enet/packet.c | 140 + src/enet/peer.c | 699 +++ src/enet/protocol.c | 1574 +++++ src/enet/tutorial.txt | 325 + src/enet/unix.c | 419 ++ src/enet/win32.c | 336 + src/engine/3dgui.cpp | 1034 +++ src/engine/CVS/Entries | 55 + src/engine/CVS/Repository | 1 + src/engine/CVS/Root | 1 + src/engine/animmodel.h | 1367 ++++ src/engine/bih.cpp | 300 + src/engine/bih.h | 43 + src/engine/client.cpp | 238 + src/engine/command.cpp | 843 +++ src/engine/console.cpp | 736 +++ src/engine/cubeloader.cpp | 364 ++ src/engine/decal.cpp | 541 ++ src/engine/dynlight.cpp | 207 + src/engine/engine.h | 501 ++ src/engine/explosion.h | 768 +++ src/engine/glare.cpp | 72 + src/engine/grass.cpp | 439 ++ src/engine/lensflare.h | 188 + src/engine/lightmap.cpp | 1669 +++++ src/engine/lightmap.h | 124 + src/engine/lightning.h | 103 + src/engine/main.cpp | 942 +++ src/engine/material.cpp | 875 +++ src/engine/md2.h | 319 + src/engine/md3.h | 412 ++ src/engine/md5.h | 751 +++ src/engine/menus.cpp | 457 ++ src/engine/model.h | 81 + src/engine/normal.cpp | 320 + src/engine/obj.h | 369 ++ src/engine/octa.cpp | 1388 +++++ src/engine/octa.h | 301 + src/engine/octaedit.cpp | 1773 ++++++ src/engine/octarender.cpp | 1560 +++++ src/engine/physics.cpp | 1658 +++++ src/engine/pvs.cpp | 1313 ++++ src/engine/rendergl.cpp | 1559 +++++ src/engine/rendermodel.cpp | 1000 +++ src/engine/renderparticles.cpp | 1124 ++++ src/engine/rendersky.cpp | 321 + src/engine/rendertarget.h | 505 ++ src/engine/rendertext.cpp | 271 + src/engine/renderva.cpp | 2260 +++++++ src/engine/server.cpp | 719 +++ src/engine/serverbrowser.cpp | 503 ++ src/engine/shader.cpp | 1706 +++++ src/engine/shadowmap.cpp | 379 ++ src/engine/skelmodel.h | 1660 +++++ src/engine/sound.cpp | 453 ++ src/engine/textedit.h | 725 +++ src/engine/texture.cpp | 1259 ++++ src/engine/texture.h | 311 + src/engine/vertmodel.h | 657 ++ src/engine/water.cpp | 1273 ++++ src/engine/world.cpp | 1238 ++++ src/engine/world.h | 88 + src/engine/worldio.cpp | 626 ++ src/fpsgame/CVS/Entries | 15 + src/fpsgame/CVS/Repository | 1 + src/fpsgame/CVS/Root | 1 + src/fpsgame/assassin.h | 218 + src/fpsgame/capture.h | 851 +++ src/fpsgame/client.h | 1295 ++++ src/fpsgame/ctf.h | 563 ++ src/fpsgame/entities.h | 366 ++ src/fpsgame/extinfo.h | 180 + src/fpsgame/fps.cpp | 1096 ++++ src/fpsgame/fpsrender.h | 151 + src/fpsgame/fpsserver.h | 2099 +++++++ src/fpsgame/game.h | 419 ++ src/fpsgame/monster.h | 378 ++ src/fpsgame/movable.h | 168 + src/fpsgame/scoreboard.h | 385 ++ src/fpsgame/weapon.h | 779 +++ src/include/CVS/Entries | 41 + src/include/CVS/Repository | 1 + src/include/CVS/Root | 1 + src/include/GL/CVS/Entries | 2 + src/include/GL/CVS/Repository | 1 + src/include/GL/CVS/Root | 1 + src/include/GL/glext.h | 6495 +++++++++++++++++++ src/include/SDL.h | 94 + src/include/SDL_active.h | 58 + src/include/SDL_audio.h | 253 + src/include/SDL_byteorder.h | 24 + src/include/SDL_cdrom.h | 171 + src/include/SDL_config.h | 45 + src/include/SDL_config_macosx.h | 135 + src/include/SDL_config_win32.h | 180 + src/include/SDL_copying.h | 22 + src/include/SDL_cpuinfo.h | 75 + src/include/SDL_endian.h | 194 + src/include/SDL_error.h | 61 + src/include/SDL_events.h | 337 + src/include/SDL_getenv.h | 24 + src/include/SDL_image.h | 116 + src/include/SDL_joystick.h | 167 + src/include/SDL_keyboard.h | 121 + src/include/SDL_keysym.h | 311 + src/include/SDL_loadso.h | 74 + src/include/SDL_main.h | 98 + src/include/SDL_mixer.h | 583 ++ src/include/SDL_mouse.h | 136 + src/include/SDL_mutex.h | 162 + src/include/SDL_name.h | 11 + src/include/SDL_opengl.h | 6550 ++++++++++++++++++++ src/include/SDL_platform.h | 100 + src/include/SDL_quit.h | 50 + src/include/SDL_rwops.h | 144 + src/include/SDL_stdinc.h | 594 ++ src/include/SDL_syswm.h | 214 + src/include/SDL_thread.h | 119 + src/include/SDL_timer.h | 115 + src/include/SDL_types.h | 24 + src/include/SDL_version.h | 85 + src/include/SDL_video.h | 891 +++ src/include/begin_code.h | 156 + src/include/close_code.h | 41 + src/include/wincompat.h | 81 + src/include/zconf.h | 332 + src/include/zlib.h | 1357 ++++ src/lib/CVS/Entries | 6 + src/lib/CVS/Repository | 1 + src/lib/CVS/Root | 1 + src/lib/SDL.lib | Bin 0 -> 42702 bytes src/lib/SDL_image.lib | Bin 0 -> 7160 bytes src/lib/SDL_mixer.lib | Bin 0 -> 14838 bytes src/lib/SDLmain.lib | Bin 0 -> 5144 bytes src/lib/zdll.lib | Bin 0 -> 10590 bytes src/mingw/CVS/Entries | 4 + src/mingw/CVS/Repository | 1 + src/mingw/CVS/Root | 1 + src/mingw/Makefile.mingw | 63 + src/mingw/lib/CVS/Entries | 7 + src/mingw/lib/CVS/Repository | 1 + src/mingw/lib/CVS/Root | 1 + src/mingw/lib/libSDL.dll.a | Bin 0 -> 116756 bytes src/mingw/lib/libSDL_image.dll.a | Bin 0 -> 17148 bytes src/mingw/lib/libSDL_mixer.dll.a | Bin 0 -> 42456 bytes src/mingw/lib/libSDLmain.a | Bin 0 -> 391482 bytes src/mingw/lib/libenet.a | Bin 0 -> 29974 bytes src/mingw/lib/libz.a | Bin 0 -> 72376 bytes src/mingw/make.mingw.bat | 3 + src/mingw/sauerbraten.cbp | 825 +++ src/mingw/sauerbraten.layout | 58 + src/newgame/gclient.cpp | 76 + src/newgame/gclient.h | 60 + src/newgame/gcommunicator.cpp | 41 + src/newgame/gcommunicator.h | 18 + src/newgame/gentities.cpp | 415 ++ src/newgame/gentities.h | 44 + src/newgame/gserver.cpp | 32 + src/newgame/gserver.h | 29 + src/readme_source.txt | 83 + src/rpggame/CVS/Entries | 9 + src/rpggame/CVS/Repository | 1 + src/rpggame/CVS/Root | 1 + src/rpggame/entities.h | 68 + src/rpggame/rpg.cpp | 194 + src/rpggame/rpg_plan.txt | 39 + src/rpggame/rpgent.h | 274 + src/rpggame/rpgobj.h | 394 ++ src/rpggame/rpgobjset.h | 169 + src/rpggame/stats.h | 131 + src/rpggame/stubs.h | 38 + src/shared/CVS/Entries | 14 + src/shared/CVS/Repository | 1 + src/shared/CVS/Root | 1 + src/shared/command.h | 160 + src/shared/cube.h | 5 + src/shared/ents.h | 194 + src/shared/geom.cpp | 51 + src/shared/geom.h | 659 ++ src/shared/iengine.h | 346 ++ src/shared/igame.h | 121 + src/shared/pch.cpp | 1 + src/shared/pch.h | 58 + src/shared/sbtrace.d | 21 + src/shared/sbtrace.h | 79 + src/shared/tools.cpp | 328 + src/shared/tools.h | 648 ++ src/vcpp/CVS/Entries | 8 + src/vcpp/CVS/Repository | 1 + src/vcpp/CVS/Root | 1 + src/vcpp/cube.vcproj | 1730 ++++++ src/vcpp/cube.vcproj.SMU.21490304.user | 93 + src/vcpp/icon1.ico | Bin 0 -> 2998 bytes src/vcpp/sauerbraten.nsi | 64 + src/vcpp/sauerbraten.rc | 4 + src/vcpp/sauerbraten.sln | 23 + src/vcpp/sauerbraten.suo | Bin 0 -> 225792 bytes src/xcode/CVS/Entries | 19 + src/xcode/CVS/Repository | 1 + src/xcode/CVS/Root | 1 + src/xcode/ConsoleView.h | 25 + src/xcode/ConsoleView.m | 120 + src/xcode/English.lproj/CVS/Entries | 3 + src/xcode/English.lproj/CVS/Repository | 1 + src/xcode/English.lproj/CVS/Root | 1 + src/xcode/English.lproj/InfoPlist.strings | Bin 0 -> 600 bytes src/xcode/English.lproj/Localizable.strings | 27 + src/xcode/English.lproj/MainMenu.nib/CVS/Entries | 5 + .../English.lproj/MainMenu.nib/CVS/Repository | 1 + src/xcode/English.lproj/MainMenu.nib/CVS/Root | 1 + src/xcode/English.lproj/MainMenu.nib/classes.nib | 86 + src/xcode/English.lproj/MainMenu.nib/info.nib | 21 + .../English.lproj/MainMenu.nib/keyedobjects.nib | Bin 0 -> 47188 bytes src/xcode/English.lproj/MainMenu.nib/objects.nib | Bin 0 -> 20994 bytes src/xcode/Help.tiff | Bin 0 -> 1716 bytes src/xcode/Keys.gif | Bin 0 -> 2545 bytes src/xcode/Launcher.h | 42 + src/xcode/Launcher.m | 742 +++ src/xcode/Maps.gif | Bin 0 -> 2048 bytes src/xcode/Nomap.png | Bin 0 -> 3182 bytes src/xcode/SDLMain.h | 11 + src/xcode/SDLMain.m | 401 ++ src/xcode/Server.gif | Bin 0 -> 2344 bytes src/xcode/launcher-Info.plist | 72 + src/xcode/macutils.mm | 28 + src/xcode/main.m | 6 + src/xcode/map.icns | Bin 0 -> 36882 bytes src/xcode/sauerbraten-Info.plist | 22 + src/xcode/sauerbraten.icns | Bin 0 -> 33393 bytes src/xcode/sauerbraten.xcodeproj/CVS/Entries | 2 + src/xcode/sauerbraten.xcodeproj/CVS/Repository | 1 + src/xcode/sauerbraten.xcodeproj/CVS/Root | 1 + src/xcode/sauerbraten.xcodeproj/project.pbxproj | 995 +++ 308 files changed, 110035 insertions(+) create mode 100755 sauerbraten_unix create mode 100644 src/CVS/Entries create mode 100644 src/CVS/Entries.Log create mode 100644 src/CVS/Repository create mode 100644 src/CVS/Root create mode 100644 src/Makefile create mode 100644 src/Makefile-original create mode 100644 src/OCTA_TODO.txt create mode 100755 src/build create mode 100644 src/enet/.deps/callbacks.Po create mode 100644 src/enet/.deps/host.Po create mode 100644 src/enet/.deps/list.Po create mode 100644 src/enet/.deps/packet.Po create mode 100644 src/enet/.deps/peer.Po create mode 100644 src/enet/.deps/protocol.Po create mode 100644 src/enet/.deps/unix.Po create mode 100644 src/enet/.deps/win32.Po create mode 100644 src/enet/CVS/Entries create mode 100644 src/enet/CVS/Repository create mode 100644 src/enet/CVS/Root create mode 100755 src/enet/Doxyfile create mode 100644 src/enet/LICENSE create mode 100644 src/enet/Makefile create mode 100644 src/enet/Makefile.am create mode 100644 src/enet/Makefile.in create mode 100644 src/enet/README create mode 100644 src/enet/aclocal.m4 create mode 100644 src/enet/autom4te.cache/output.0 create mode 100644 src/enet/autom4te.cache/requests create mode 100644 src/enet/autom4te.cache/traces.0 create mode 100644 src/enet/callbacks.c create mode 100755 src/enet/config.guess create mode 100644 src/enet/config.log create mode 100755 src/enet/config.status create mode 100755 src/enet/config.sub create mode 100755 src/enet/configure create mode 100644 src/enet/configure.in create mode 100755 src/enet/depcomp create mode 100644 src/enet/design.txt create mode 100644 src/enet/docs/CVS/Entries create mode 100644 src/enet/docs/CVS/Repository create mode 100644 src/enet/docs/CVS/Root create mode 100755 src/enet/docs/FAQ.dox create mode 100755 src/enet/docs/design.dox create mode 100755 src/enet/docs/install.dox create mode 100755 src/enet/docs/license.dox create mode 100755 src/enet/docs/mainpage.dox create mode 100755 src/enet/docs/tutorial.dox create mode 100755 src/enet/enet.dsp create mode 100644 src/enet/host.c create mode 100644 src/enet/include/CVS/Entries create mode 100644 src/enet/include/CVS/Repository create mode 100644 src/enet/include/CVS/Root create mode 100644 src/enet/include/Makefile create mode 100644 src/enet/include/Makefile.am create mode 100644 src/enet/include/Makefile.in create mode 100644 src/enet/include/enet/CVS/Entries create mode 100644 src/enet/include/enet/CVS/Repository create mode 100644 src/enet/include/enet/CVS/Root create mode 100644 src/enet/include/enet/Makefile create mode 100644 src/enet/include/enet/Makefile.am create mode 100644 src/enet/include/enet/Makefile.in create mode 100644 src/enet/include/enet/callbacks.h create mode 100644 src/enet/include/enet/enet.h create mode 100644 src/enet/include/enet/list.h create mode 100644 src/enet/include/enet/protocol.h create mode 100644 src/enet/include/enet/time.h create mode 100644 src/enet/include/enet/types.h create mode 100644 src/enet/include/enet/unix.h create mode 100644 src/enet/include/enet/utility.h create mode 100644 src/enet/include/enet/win32.h create mode 100755 src/enet/install-sh create mode 100644 src/enet/list.c create mode 100755 src/enet/missing create mode 100755 src/enet/mkinstalldirs create mode 100644 src/enet/packet.c create mode 100644 src/enet/peer.c create mode 100644 src/enet/protocol.c create mode 100644 src/enet/tutorial.txt create mode 100644 src/enet/unix.c create mode 100644 src/enet/win32.c create mode 100644 src/engine/3dgui.cpp create mode 100644 src/engine/CVS/Entries create mode 100644 src/engine/CVS/Repository create mode 100644 src/engine/CVS/Root create mode 100644 src/engine/animmodel.h create mode 100644 src/engine/bih.cpp create mode 100644 src/engine/bih.h create mode 100644 src/engine/client.cpp create mode 100644 src/engine/command.cpp create mode 100644 src/engine/console.cpp create mode 100644 src/engine/cubeloader.cpp create mode 100644 src/engine/decal.cpp create mode 100644 src/engine/dynlight.cpp create mode 100644 src/engine/engine.h create mode 100644 src/engine/explosion.h create mode 100644 src/engine/glare.cpp create mode 100644 src/engine/grass.cpp create mode 100644 src/engine/lensflare.h create mode 100644 src/engine/lightmap.cpp create mode 100644 src/engine/lightmap.h create mode 100644 src/engine/lightning.h create mode 100644 src/engine/main.cpp create mode 100644 src/engine/material.cpp create mode 100644 src/engine/md2.h create mode 100644 src/engine/md3.h create mode 100644 src/engine/md5.h create mode 100644 src/engine/menus.cpp create mode 100644 src/engine/model.h create mode 100644 src/engine/normal.cpp create mode 100644 src/engine/obj.h create mode 100644 src/engine/octa.cpp create mode 100644 src/engine/octa.h create mode 100644 src/engine/octaedit.cpp create mode 100644 src/engine/octarender.cpp create mode 100644 src/engine/physics.cpp create mode 100644 src/engine/pvs.cpp create mode 100644 src/engine/rendergl.cpp create mode 100644 src/engine/rendermodel.cpp create mode 100644 src/engine/renderparticles.cpp create mode 100644 src/engine/rendersky.cpp create mode 100644 src/engine/rendertarget.h create mode 100644 src/engine/rendertext.cpp create mode 100644 src/engine/renderva.cpp create mode 100644 src/engine/server.cpp create mode 100644 src/engine/serverbrowser.cpp create mode 100644 src/engine/shader.cpp create mode 100644 src/engine/shadowmap.cpp create mode 100644 src/engine/skelmodel.h create mode 100644 src/engine/sound.cpp create mode 100644 src/engine/textedit.h create mode 100644 src/engine/texture.cpp create mode 100644 src/engine/texture.h create mode 100644 src/engine/vertmodel.h create mode 100644 src/engine/water.cpp create mode 100644 src/engine/world.cpp create mode 100644 src/engine/world.h create mode 100644 src/engine/worldio.cpp create mode 100644 src/fpsgame/CVS/Entries create mode 100644 src/fpsgame/CVS/Repository create mode 100644 src/fpsgame/CVS/Root create mode 100644 src/fpsgame/assassin.h create mode 100644 src/fpsgame/capture.h create mode 100644 src/fpsgame/client.h create mode 100644 src/fpsgame/ctf.h create mode 100644 src/fpsgame/entities.h create mode 100644 src/fpsgame/extinfo.h create mode 100644 src/fpsgame/fps.cpp create mode 100644 src/fpsgame/fpsrender.h create mode 100644 src/fpsgame/fpsserver.h create mode 100644 src/fpsgame/game.h create mode 100644 src/fpsgame/monster.h create mode 100644 src/fpsgame/movable.h create mode 100644 src/fpsgame/scoreboard.h create mode 100644 src/fpsgame/weapon.h create mode 100644 src/include/CVS/Entries create mode 100644 src/include/CVS/Repository create mode 100644 src/include/CVS/Root create mode 100644 src/include/GL/CVS/Entries create mode 100644 src/include/GL/CVS/Repository create mode 100644 src/include/GL/CVS/Root create mode 100644 src/include/GL/glext.h create mode 100644 src/include/SDL.h create mode 100644 src/include/SDL_active.h create mode 100644 src/include/SDL_audio.h create mode 100644 src/include/SDL_byteorder.h create mode 100644 src/include/SDL_cdrom.h create mode 100644 src/include/SDL_config.h create mode 100644 src/include/SDL_config_macosx.h create mode 100644 src/include/SDL_config_win32.h create mode 100644 src/include/SDL_copying.h create mode 100644 src/include/SDL_cpuinfo.h create mode 100644 src/include/SDL_endian.h create mode 100644 src/include/SDL_error.h create mode 100644 src/include/SDL_events.h create mode 100644 src/include/SDL_getenv.h create mode 100644 src/include/SDL_image.h create mode 100644 src/include/SDL_joystick.h create mode 100644 src/include/SDL_keyboard.h create mode 100644 src/include/SDL_keysym.h create mode 100644 src/include/SDL_loadso.h create mode 100644 src/include/SDL_main.h create mode 100644 src/include/SDL_mixer.h create mode 100644 src/include/SDL_mouse.h create mode 100644 src/include/SDL_mutex.h create mode 100644 src/include/SDL_name.h create mode 100644 src/include/SDL_opengl.h create mode 100644 src/include/SDL_platform.h create mode 100644 src/include/SDL_quit.h create mode 100644 src/include/SDL_rwops.h create mode 100644 src/include/SDL_stdinc.h create mode 100644 src/include/SDL_syswm.h create mode 100644 src/include/SDL_thread.h create mode 100644 src/include/SDL_timer.h create mode 100644 src/include/SDL_types.h create mode 100644 src/include/SDL_version.h create mode 100644 src/include/SDL_video.h create mode 100644 src/include/begin_code.h create mode 100644 src/include/close_code.h create mode 100644 src/include/wincompat.h create mode 100644 src/include/zconf.h create mode 100644 src/include/zlib.h create mode 100644 src/lib/CVS/Entries create mode 100644 src/lib/CVS/Repository create mode 100644 src/lib/CVS/Root create mode 100644 src/lib/SDL.lib create mode 100644 src/lib/SDL_image.lib create mode 100644 src/lib/SDL_mixer.lib create mode 100644 src/lib/SDLmain.lib create mode 100644 src/lib/zdll.lib create mode 100644 src/mingw/CVS/Entries create mode 100644 src/mingw/CVS/Repository create mode 100644 src/mingw/CVS/Root create mode 100644 src/mingw/Makefile.mingw create mode 100644 src/mingw/lib/CVS/Entries create mode 100644 src/mingw/lib/CVS/Repository create mode 100644 src/mingw/lib/CVS/Root create mode 100644 src/mingw/lib/libSDL.dll.a create mode 100644 src/mingw/lib/libSDL_image.dll.a create mode 100644 src/mingw/lib/libSDL_mixer.dll.a create mode 100644 src/mingw/lib/libSDLmain.a create mode 100644 src/mingw/lib/libenet.a create mode 100644 src/mingw/lib/libz.a create mode 100644 src/mingw/make.mingw.bat create mode 100644 src/mingw/sauerbraten.cbp create mode 100644 src/mingw/sauerbraten.layout create mode 100644 src/newgame/gclient.cpp create mode 100644 src/newgame/gclient.h create mode 100644 src/newgame/gcommunicator.cpp create mode 100644 src/newgame/gcommunicator.h create mode 100644 src/newgame/gentities.cpp create mode 100644 src/newgame/gentities.h create mode 100644 src/newgame/gserver.cpp create mode 100644 src/newgame/gserver.h create mode 100644 src/readme_source.txt create mode 100644 src/rpggame/CVS/Entries create mode 100644 src/rpggame/CVS/Repository create mode 100644 src/rpggame/CVS/Root create mode 100644 src/rpggame/entities.h create mode 100644 src/rpggame/rpg.cpp create mode 100644 src/rpggame/rpg_plan.txt create mode 100644 src/rpggame/rpgent.h create mode 100644 src/rpggame/rpgobj.h create mode 100644 src/rpggame/rpgobjset.h create mode 100644 src/rpggame/stats.h create mode 100644 src/rpggame/stubs.h create mode 100644 src/shared/CVS/Entries create mode 100644 src/shared/CVS/Repository create mode 100644 src/shared/CVS/Root create mode 100644 src/shared/command.h create mode 100644 src/shared/cube.h create mode 100644 src/shared/ents.h create mode 100644 src/shared/geom.cpp create mode 100644 src/shared/geom.h create mode 100644 src/shared/iengine.h create mode 100644 src/shared/igame.h create mode 100644 src/shared/pch.cpp create mode 100644 src/shared/pch.h create mode 100644 src/shared/sbtrace.d create mode 100644 src/shared/sbtrace.h create mode 100644 src/shared/tools.cpp create mode 100644 src/shared/tools.h create mode 100644 src/vcpp/CVS/Entries create mode 100644 src/vcpp/CVS/Repository create mode 100644 src/vcpp/CVS/Root create mode 100644 src/vcpp/cube.vcproj create mode 100644 src/vcpp/cube.vcproj.SMU.21490304.user create mode 100644 src/vcpp/icon1.ico create mode 100644 src/vcpp/sauerbraten.nsi create mode 100644 src/vcpp/sauerbraten.rc create mode 100644 src/vcpp/sauerbraten.sln create mode 100644 src/vcpp/sauerbraten.suo create mode 100644 src/xcode/CVS/Entries create mode 100644 src/xcode/CVS/Repository create mode 100644 src/xcode/CVS/Root create mode 100755 src/xcode/ConsoleView.h create mode 100755 src/xcode/ConsoleView.m create mode 100644 src/xcode/English.lproj/CVS/Entries create mode 100644 src/xcode/English.lproj/CVS/Repository create mode 100644 src/xcode/English.lproj/CVS/Root create mode 100644 src/xcode/English.lproj/InfoPlist.strings create mode 100644 src/xcode/English.lproj/Localizable.strings create mode 100644 src/xcode/English.lproj/MainMenu.nib/CVS/Entries create mode 100644 src/xcode/English.lproj/MainMenu.nib/CVS/Repository create mode 100644 src/xcode/English.lproj/MainMenu.nib/CVS/Root create mode 100644 src/xcode/English.lproj/MainMenu.nib/classes.nib create mode 100644 src/xcode/English.lproj/MainMenu.nib/info.nib create mode 100644 src/xcode/English.lproj/MainMenu.nib/keyedobjects.nib create mode 100644 src/xcode/English.lproj/MainMenu.nib/objects.nib create mode 100644 src/xcode/Help.tiff create mode 100644 src/xcode/Keys.gif create mode 100644 src/xcode/Launcher.h create mode 100644 src/xcode/Launcher.m create mode 100644 src/xcode/Maps.gif create mode 100644 src/xcode/Nomap.png create mode 100644 src/xcode/SDLMain.h create mode 100644 src/xcode/SDLMain.m create mode 100644 src/xcode/Server.gif create mode 100644 src/xcode/launcher-Info.plist create mode 100644 src/xcode/macutils.mm create mode 100644 src/xcode/main.m create mode 100644 src/xcode/map.icns create mode 100644 src/xcode/sauerbraten-Info.plist create mode 100644 src/xcode/sauerbraten.icns create mode 100644 src/xcode/sauerbraten.xcodeproj/CVS/Entries create mode 100644 src/xcode/sauerbraten.xcodeproj/CVS/Repository create mode 100644 src/xcode/sauerbraten.xcodeproj/CVS/Root create mode 100644 src/xcode/sauerbraten.xcodeproj/project.pbxproj diff --git a/sauerbraten_unix b/sauerbraten_unix new file mode 100755 index 0000000..0b06c06 --- /dev/null +++ b/sauerbraten_unix @@ -0,0 +1,59 @@ +#!/bin/sh +# SAUER_DIR should refer to the directory in which Sauerbraten is placed. +#SAUER_DIR=~/sauerbraten +#SAUER_DIR=/usr/local/sauerbraten +SAUER_DIR=. + +# SAUER_OPTIONS contains any command line options you would like to start Sauerbraten with. +#SAUER_OPTIONS="-f" +SAUER_OPTIONS="-q${HOME}/.sauerbraten -r" + +# SYSTEM_NAME should be set to the name of your operating system. +#SYSTEM_NAME=Linux +SYSTEM_NAME=`uname -s` + +# MACHINE_NAME should be set to the name of your processor. +#MACHINE_NAME=i686 +MACHINE_NAME=`uname -m` + +case ${SYSTEM_NAME} in +Linux) + SYSTEM_NAME=linux_ + ;; +*) + SYSTEM_NAME=native_ + ;; +esac + +case ${MACHINE_NAME} in +i486|i586|i686) + MACHINE_NAME= + ;; +*) + if [ ${SYSTEM_NAME} != native_ ] + then + SYSTEM_NAME=native_ + fi + MACHINE_NAME= + ;; +esac + +if [ -x ${SAUER_DIR}/bin_unix/native_client ] +then + SYSTEM_NAME=native_ + MACHINE_NAME= +fi + +if [ -x ${SAUER_DIR}/bin_unix/${MACHINE_NAME}${SYSTEM_NAME}client ] +then + cd ${SAUER_DIR} + exec ${SAUER_DIR}/bin_unix/${MACHINE_NAME}${SYSTEM_NAME}client ${SAUER_OPTIONS} $@ +else + echo "Your platform does not have a pre-compiled Sauerbraten client." + echo "Please follow the following steps to build a native client:" + echo "1) Ensure you have the SDL, SDL-image, SDL-mixer, and OpenGL libraries installed." + echo "2) Change directory to src/ and type \"make install\"." + echo "3) If the build succeeds, return to this directory and run this script again." + exit 1 +fi + diff --git a/src/CVS/Entries b/src/CVS/Entries new file mode 100644 index 0000000..05b578a --- /dev/null +++ b/src/CVS/Entries @@ -0,0 +1,13 @@ +/Makefile/1.70/Sat May 3 16:17:49 2008// +/OCTA_TODO.txt/1.202/Sun Aug 19 15:02:42 2007// +/readme_source.txt/1.2/Sun Oct 29 21:05:32 2006// +D/enet//// +D/engine//// +D/fpsgame//// +D/include//// +D/lib//// +D/mingw//// +D/rpggame//// +D/shared//// +D/vcpp//// +D/xcode//// diff --git a/src/CVS/Entries.Log b/src/CVS/Entries.Log new file mode 100644 index 0000000..739324c --- /dev/null +++ b/src/CVS/Entries.Log @@ -0,0 +1,4 @@ +A D/devcpp//// +A D/lib.mingw//// +R D/lib.mingw//// +R D/devcpp//// diff --git a/src/CVS/Repository b/src/CVS/Repository new file mode 100644 index 0000000..66e5bc3 --- /dev/null +++ b/src/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src diff --git a/src/CVS/Root b/src/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..42fa421 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,92 @@ +CXXOPTFLAGS= -O3 -fomit-frame-pointer +INCLUDES= -Ishared -Iengine -Ifpsgame -Irpggame -Inewgame -Ienet/include -I/usr/X11R6/include `sdl-config --cflags` +CXXFLAGS= -Wall -fsigned-char $(CXXOPTFLAGS) $(INCLUDES) +CXX=g++-4.2 + +PLATFORM_PREFIX=native + +CLIENT_LIBS= -Lenet -lenet -L/usr/X11R6/lib `sdl-config --libs` -lSDL_image -lSDL_mixer -lz -lGL -lGLU +ifeq ($(shell uname -s),Linux) +CLIENT_LIBS+= -lrt +endif +CLIENT_OBJS= \ + shared/tools.o \ + shared/geom.o \ + engine/3dgui.o \ + engine/bih.o \ + engine/client.o \ + engine/command.o \ + engine/console.o \ + engine/cubeloader.o \ + engine/decal.o \ + engine/dynlight.o \ + engine/glare.o \ + engine/grass.o \ + engine/lightmap.o \ + engine/main.o \ + engine/material.o \ + engine/menus.o \ + engine/normal.o \ + engine/octa.o \ + engine/octaedit.o \ + engine/octarender.o \ + engine/physics.o \ + engine/pvs.o \ + engine/rendergl.o \ + engine/rendermodel.o \ + engine/renderparticles.o \ + engine/rendersky.o \ + engine/rendertext.o \ + engine/renderva.o \ + engine/server.o \ + engine/serverbrowser.o \ + engine/shader.o \ + engine/shadowmap.o \ + engine/sound.o \ + engine/texture.o \ + engine/water.o \ + engine/world.o \ + engine/worldio.o \ + fpsgame/fps.o \ + rpggame/rpg.o \ + newgame/gclient.o \ + newgame/gcommunicator.o \ + newgame/gserver.o + +SERVER_LIBS= -Lenet -lenet -lz +SERVER_OBJS= \ + shared/tools-standalone.o \ + engine/server-standalone.o \ + fpsgame/fps-standalone.o \ + newgame/gclient-standalone.o \ + newgame/gserver.o + +default: all + +all: client server + +enet/Makefile: + cd enet; ./configure + +libenet: enet/Makefile + $(MAKE) -C enet/ all + +clean: enet/Makefile + -$(RM) $(SERVER_OBJS) $(CLIENT_OBJS) sauer_server sauer_client + $(MAKE) -C enet/ clean + +%-standalone.o: + $(CXX) $(CXXFLAGS) -DSTANDALONE -c -o $@ $(subst -standalone.o,.cpp,$@) + +client: libenet $(CLIENT_OBJS) + $(CXX) $(CXXFLAGS) -o sauer_client $(CLIENT_OBJS) $(CLIENT_LIBS) + +server: libenet $(SERVER_OBJS) + $(CXX) $(CXXFLAGS) -o sauer_server $(SERVER_OBJS) $(SERVER_LIBS) + +install: all + cp sauer_client ../bin_unix/$(PLATFORM_PREFIX)_client + cp sauer_server ../bin_unix/$(PLATFORM_PREFIX)_server + strip ../bin_unix/$(PLATFORM_PREFIX)_client + strip ../bin_unix/$(PLATFORM_PREFIX)_server + diff --git a/src/Makefile-original b/src/Makefile-original new file mode 100644 index 0000000..b1175dc --- /dev/null +++ b/src/Makefile-original @@ -0,0 +1,87 @@ +CXXOPTFLAGS= -O3 -fomit-frame-pointer +INCLUDES= -Ishared -Iengine -Ifpsgame -Irpggame -Ienet/include -I/usr/X11R6/include `sdl-config --cflags` +CXXFLAGS= -Wall -fsigned-char $(CXXOPTFLAGS) $(INCLUDES) +CXX=g++-4.2 + +PLATFORM_PREFIX=native + +CLIENT_LIBS= -Lenet -lenet -L/usr/X11R6/lib `sdl-config --libs` -lSDL_image -lSDL_mixer -lz -lGL -lGLU +ifeq ($(shell uname -s),Linux) +CLIENT_LIBS+= -lrt +endif +CLIENT_OBJS= \ + shared/tools.o \ + shared/geom.o \ + engine/3dgui.o \ + engine/bih.o \ + engine/client.o \ + engine/command.o \ + engine/console.o \ + engine/cubeloader.o \ + engine/decal.o \ + engine/dynlight.o \ + engine/glare.o \ + engine/grass.o \ + engine/lightmap.o \ + engine/main.o \ + engine/material.o \ + engine/menus.o \ + engine/normal.o \ + engine/octa.o \ + engine/octaedit.o \ + engine/octarender.o \ + engine/physics.o \ + engine/pvs.o \ + engine/rendergl.o \ + engine/rendermodel.o \ + engine/renderparticles.o \ + engine/rendersky.o \ + engine/rendertext.o \ + engine/renderva.o \ + engine/server.o \ + engine/serverbrowser.o \ + engine/shader.o \ + engine/shadowmap.o \ + engine/sound.o \ + engine/texture.o \ + engine/water.o \ + engine/world.o \ + engine/worldio.o \ + fpsgame/fps.o \ + rpggame/rpg.o + +SERVER_LIBS= -Lenet -lenet -lz +SERVER_OBJS= \ + shared/tools-standalone.o \ + engine/server-standalone.o \ + fpsgame/fps-standalone.o \ + +default: all + +all: client server + +enet/Makefile: + cd enet; ./configure + +libenet: enet/Makefile + $(MAKE) -C enet/ all + +clean: enet/Makefile + -$(RM) $(SERVER_OBJS) $(CLIENT_OBJS) sauer_server sauer_client + $(MAKE) -C enet/ clean + +%-standalone.o: + $(CXX) $(CXXFLAGS) -DSTANDALONE -c -o $@ $(subst -standalone.o,.cpp,$@) + +client: libenet $(CLIENT_OBJS) + $(CXX) $(CXXFLAGS) -o sauer_client $(CLIENT_OBJS) $(CLIENT_LIBS) + +server: libenet $(SERVER_OBJS) + $(CXX) $(CXXFLAGS) -o sauer_server $(SERVER_OBJS) $(SERVER_LIBS) + +install: all + cp sauer_client ../bin_unix/$(PLATFORM_PREFIX)_client + cp sauer_server ../bin_unix/$(PLATFORM_PREFIX)_server + strip ../bin_unix/$(PLATFORM_PREFIX)_client + strip ../bin_unix/$(PLATFORM_PREFIX)_server + diff --git a/src/OCTA_TODO.txt b/src/OCTA_TODO.txt new file mode 100644 index 0000000..6d8ee50 --- /dev/null +++ b/src/OCTA_TODO.txt @@ -0,0 +1,90 @@ +- check if ATI fixed fglrx/OQ bug in next version + +- make people that do teamkills/damage wait longer? + +- fog entities (R, G, B, radius, fog dist), + If player inside of radius, changes global fog color and distance to the entity's, interpolated + with the outside map fog color depending on distance from center. Use some sort of weighted average + if inside multiple fog entities. + +- sound entities | http://freesound.iua.upf.edu/ + +- make sure all bumpmaps are parallax -> finetune each one individually + +- audio effect for chat messages | audio for gui events + +- social cheating solution + +- before a release: update static wiki + +- improve smoothness of going up steps ? +- remove delay before doors start opening ? +- make nearby closed doors render early so that they can contribute to OC? +- water physics close to surface +- add entity looping command? + +- LOD: improved lod-remip? +- "editing not in view" sometimes obstructs editing +- simultaneous heightmap orientations (all six sides at same time for easier rock/cliff/caves/destructable geom?) +- multiple cube selections for heightmaps? maybe instead of selections+mode, use textures+Q? +- heightmap outlines (like sky) instead of selection box +- context sensitive editing menu: short cuts to ents, lighting, map ops etc. bind to tab. (current menu being more detailed and reference) +- combine mingw and linux makefiles? +- need to make selecting cubes/ents while inside a cube easier.... maybe modify raycube/rayent to treat cubes as 'hollow'? +- entundo more efficeint + +- maybe add a way to purge infrequent / not recently used textures? esp now with mapshots. + +- reduce maps +- memory leaks? +- Mix_LoadMUS() crashes after being called many times? + +- death needs to be more obvious (better sound/centerprint) +- sparklies very bad on ATI, particularly deathtek / diff skybox +- crashes when people join? +- 2 levels of lightlod for huge maps +- shallow water splashing sound? + +- use setbb also for monsters +- experiment with averaging lightvector based on intensity^N, such that dominant light becomes more dominant without losing smooth transitions | store intensity multiplier in alpha? + +- the eyecandy priority list: better bloom, motion blur, volumetric fog (see fog entities idea above), character bumpmaps (likely need skeletal animation to make this memory efficient)... +- bots (level design placed waypoints?) +- destructable geom + +- better doc on the scripting language | beginners guide | wiki? +- fake rigid-body sphere only? +- $ vs @? var stacks? [] for trees/arrays? other improvements? | do "." for concatword so you could do easy (associative) arrays and tree structures? +- start moving some stuff in their own headers +- new BAS sounds? | player spawn | sp respawn | menu clicks | specific door sound? | end of level | push button/trigger +- improve bloom? optimize it. +- report to ATI: float vs short issue +- more cube map ports? +- integrate fmodex (to get both panning and stereo ogg on windows?) +- 3d sprites? +- monster spawner ammo - add egg model +- iconic stats +- profile for memory usage (devpartner?) | if md2 buffers are a lot, can remove it +- glowmaps in the texture browser -> messy + +- make start of flares etc spawn out further from the player +- improve on cma render then add to sauer +- new sounds: impact (diff materials + flesh) | flyby, both instant & projectile + +- all cfg stuff in menu +- draw not-spawned items in wireframe? + +- make wether you are hitting other player clearer - blip sounds like q3? +- LOD: visibleface(lodcube==true) must not go across VA boundaries... otherwise minor HOM bewteen LOD/non-LOD rendering boundaries +- LOD: materials & sky currently always rendered at lod0 only, is that ever a problem visually/performance? +- LOD: make loddistance fov dependent (for models too) +- a multiplayer player still shows SG rays go thru target | hard to fix, is it really a problem? +- sound samples for N kills in a row +- sword? +- think about doing other permanent powerups besides +10h +- slowmo as gameplay feature? +- calclight while playing? +- use of glBufferData() makes ATI driver crash on SDL_Exit() +- fix variance in framerate? +- render entities at distance as sprites +- blend screen when inside a cube diff --git a/src/build b/src/build new file mode 100755 index 0000000..f0b739f --- /dev/null +++ b/src/build @@ -0,0 +1,2 @@ +make +make install diff --git a/src/enet/.deps/callbacks.Po b/src/enet/.deps/callbacks.Po new file mode 100644 index 0000000..6a1d04e --- /dev/null +++ b/src/enet/.deps/callbacks.Po @@ -0,0 +1,114 @@ +callbacks.o callbacks.o: callbacks.c include/enet/enet.h \ + /usr/include/stdlib.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + include/enet/unix.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/bits/wchar.h /usr/include/sys/socket.h \ + /usr/include/sys/uio.h /usr/include/bits/uio.h \ + /usr/include/bits/socket.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + include/enet/types.h include/enet/protocol.h include/enet/list.h \ + include/enet/callbacks.h + +include/enet/enet.h: + +/usr/include/stdlib.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h: + +/usr/include/sys/types.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/time.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +include/enet/unix.h: + +/usr/include/netinet/in.h: + +/usr/include/stdint.h: + +/usr/include/bits/wchar.h: + +/usr/include/sys/socket.h: + +/usr/include/sys/uio.h: + +/usr/include/bits/uio.h: + +/usr/include/bits/socket.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/sockaddr.h: + +/usr/include/asm/socket.h: + +/usr/include/asm/sockios.h: + +/usr/include/bits/in.h: + +/usr/include/bits/byteswap.h: + +include/enet/types.h: + +include/enet/protocol.h: + +include/enet/list.h: + +include/enet/callbacks.h: diff --git a/src/enet/.deps/host.Po b/src/enet/.deps/host.Po new file mode 100644 index 0000000..f0c33e7 --- /dev/null +++ b/src/enet/.deps/host.Po @@ -0,0 +1,121 @@ +host.o host.o: host.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h \ + /usr/include/bits/string.h /usr/include/bits/string2.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/stdlib.h include/enet/enet.h /usr/include/sys/types.h \ + /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + include/enet/unix.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/bits/wchar.h /usr/include/sys/socket.h \ + /usr/include/sys/uio.h /usr/include/bits/uio.h \ + /usr/include/bits/socket.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + include/enet/types.h include/enet/protocol.h include/enet/list.h \ + include/enet/callbacks.h + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h: + +/usr/include/bits/string.h: + +/usr/include/bits/string2.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/stdlib.h: + +include/enet/enet.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +include/enet/unix.h: + +/usr/include/netinet/in.h: + +/usr/include/stdint.h: + +/usr/include/bits/wchar.h: + +/usr/include/sys/socket.h: + +/usr/include/sys/uio.h: + +/usr/include/bits/uio.h: + +/usr/include/bits/socket.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/sockaddr.h: + +/usr/include/asm/socket.h: + +/usr/include/asm/sockios.h: + +/usr/include/bits/in.h: + +/usr/include/bits/byteswap.h: + +include/enet/types.h: + +include/enet/protocol.h: + +include/enet/list.h: + +include/enet/callbacks.h: diff --git a/src/enet/.deps/list.Po b/src/enet/.deps/list.Po new file mode 100644 index 0000000..c57063a --- /dev/null +++ b/src/enet/.deps/list.Po @@ -0,0 +1,53 @@ +list.o list.o: list.c include/enet/list.h /usr/include/stdlib.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h \ + /usr/include/sys/types.h /usr/include/bits/types.h \ + /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h + +include/enet/list.h: + +/usr/include/stdlib.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h: + +/usr/include/sys/types.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/time.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: diff --git a/src/enet/.deps/packet.Po b/src/enet/.deps/packet.Po new file mode 100644 index 0000000..20df2a7 --- /dev/null +++ b/src/enet/.deps/packet.Po @@ -0,0 +1,121 @@ +packet.o packet.o: packet.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h \ + /usr/include/bits/string.h /usr/include/bits/string2.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/stdlib.h include/enet/enet.h /usr/include/sys/types.h \ + /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + include/enet/unix.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/bits/wchar.h /usr/include/sys/socket.h \ + /usr/include/sys/uio.h /usr/include/bits/uio.h \ + /usr/include/bits/socket.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + include/enet/types.h include/enet/protocol.h include/enet/list.h \ + include/enet/callbacks.h + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h: + +/usr/include/bits/string.h: + +/usr/include/bits/string2.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/stdlib.h: + +include/enet/enet.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +include/enet/unix.h: + +/usr/include/netinet/in.h: + +/usr/include/stdint.h: + +/usr/include/bits/wchar.h: + +/usr/include/sys/socket.h: + +/usr/include/sys/uio.h: + +/usr/include/bits/uio.h: + +/usr/include/bits/socket.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/sockaddr.h: + +/usr/include/asm/socket.h: + +/usr/include/asm/sockios.h: + +/usr/include/bits/in.h: + +/usr/include/bits/byteswap.h: + +include/enet/types.h: + +include/enet/protocol.h: + +include/enet/list.h: + +include/enet/callbacks.h: diff --git a/src/enet/.deps/peer.Po b/src/enet/.deps/peer.Po new file mode 100644 index 0000000..37ff567 --- /dev/null +++ b/src/enet/.deps/peer.Po @@ -0,0 +1,121 @@ +peer.o peer.o: peer.c /usr/include/string.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h \ + /usr/include/bits/string.h /usr/include/bits/string2.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/stdlib.h include/enet/enet.h /usr/include/sys/types.h \ + /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + include/enet/unix.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/bits/wchar.h /usr/include/sys/socket.h \ + /usr/include/sys/uio.h /usr/include/bits/uio.h \ + /usr/include/bits/socket.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + include/enet/types.h include/enet/protocol.h include/enet/list.h \ + include/enet/callbacks.h + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h: + +/usr/include/bits/string.h: + +/usr/include/bits/string2.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/stdlib.h: + +include/enet/enet.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +include/enet/unix.h: + +/usr/include/netinet/in.h: + +/usr/include/stdint.h: + +/usr/include/bits/wchar.h: + +/usr/include/sys/socket.h: + +/usr/include/sys/uio.h: + +/usr/include/bits/uio.h: + +/usr/include/bits/socket.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/sockaddr.h: + +/usr/include/asm/socket.h: + +/usr/include/asm/sockios.h: + +/usr/include/bits/in.h: + +/usr/include/bits/byteswap.h: + +include/enet/types.h: + +include/enet/protocol.h: + +include/enet/list.h: + +include/enet/callbacks.h: diff --git a/src/enet/.deps/protocol.Po b/src/enet/.deps/protocol.Po new file mode 100644 index 0000000..0d1beb9 --- /dev/null +++ b/src/enet/.deps/protocol.Po @@ -0,0 +1,146 @@ +protocol.o protocol.o: protocol.c /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-32.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/string.h \ + /usr/include/bits/string.h /usr/include/bits/string2.h \ + /usr/include/endian.h /usr/include/bits/endian.h /usr/include/stdlib.h \ + include/enet/utility.h include/enet/time.h include/enet/enet.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + include/enet/unix.h /usr/include/netinet/in.h /usr/include/stdint.h \ + /usr/include/bits/wchar.h /usr/include/sys/socket.h \ + /usr/include/sys/uio.h /usr/include/bits/uio.h \ + /usr/include/bits/socket.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/bits/in.h /usr/include/bits/byteswap.h \ + include/enet/types.h include/enet/protocol.h include/enet/list.h \ + include/enet/callbacks.h + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/string.h: + +/usr/include/bits/string.h: + +/usr/include/bits/string2.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/stdlib.h: + +include/enet/utility.h: + +include/enet/time.h: + +include/enet/enet.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +include/enet/unix.h: + +/usr/include/netinet/in.h: + +/usr/include/stdint.h: + +/usr/include/bits/wchar.h: + +/usr/include/sys/socket.h: + +/usr/include/sys/uio.h: + +/usr/include/bits/uio.h: + +/usr/include/bits/socket.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/sockaddr.h: + +/usr/include/asm/socket.h: + +/usr/include/asm/sockios.h: + +/usr/include/bits/in.h: + +/usr/include/bits/byteswap.h: + +include/enet/types.h: + +include/enet/protocol.h: + +include/enet/list.h: + +include/enet/callbacks.h: diff --git a/src/enet/.deps/unix.Po b/src/enet/.deps/unix.Po new file mode 100644 index 0000000..7bbe8ee --- /dev/null +++ b/src/enet/.deps/unix.Po @@ -0,0 +1,185 @@ +unix.o unix.o: unix.c /usr/include/sys/types.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/time.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h \ + /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/bits/sigset.h /usr/include/bits/time.h \ + /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ + /usr/include/sys/socket.h /usr/include/sys/uio.h \ + /usr/include/bits/uio.h /usr/include/bits/socket.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h \ + /usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/sockaddr.h \ + /usr/include/asm/socket.h /usr/include/asm/sockios.h \ + /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h \ + /usr/include/asm/ioctls.h /usr/include/asm/ioctl.h \ + /usr/include/asm-generic/ioctl.h /usr/include/bits/ioctl-types.h \ + /usr/include/sys/ttydefaults.h /usr/include/sys/time.h \ + /usr/include/arpa/inet.h /usr/include/netinet/in.h \ + /usr/include/stdint.h /usr/include/bits/wchar.h /usr/include/bits/in.h \ + /usr/include/bits/byteswap.h /usr/include/netdb.h \ + /usr/include/rpc/netdb.h /usr/include/bits/netdb.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/string.h /usr/include/bits/string.h \ + /usr/include/bits/string2.h /usr/include/stdlib.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-generic/errno.h \ + /usr/include/asm-generic/errno-base.h include/enet/enet.h \ + /usr/include/alloca.h include/enet/unix.h include/enet/types.h \ + include/enet/protocol.h include/enet/list.h include/enet/callbacks.h \ + /usr/include/fcntl.h /usr/include/bits/fcntl.h /usr/include/sys/poll.h \ + /usr/include/bits/poll.h + +/usr/include/sys/types.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-32.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/time.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/stddef.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/sys/socket.h: + +/usr/include/sys/uio.h: + +/usr/include/bits/uio.h: + +/usr/include/bits/socket.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/limits.h: + +/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/sockaddr.h: + +/usr/include/asm/socket.h: + +/usr/include/asm/sockios.h: + +/usr/include/sys/ioctl.h: + +/usr/include/bits/ioctls.h: + +/usr/include/asm/ioctls.h: + +/usr/include/asm/ioctl.h: + +/usr/include/asm-generic/ioctl.h: + +/usr/include/bits/ioctl-types.h: + +/usr/include/sys/ttydefaults.h: + +/usr/include/sys/time.h: + +/usr/include/arpa/inet.h: + +/usr/include/netinet/in.h: + +/usr/include/stdint.h: + +/usr/include/bits/wchar.h: + +/usr/include/bits/in.h: + +/usr/include/bits/byteswap.h: + +/usr/include/netdb.h: + +/usr/include/rpc/netdb.h: + +/usr/include/bits/netdb.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/string.h: + +/usr/include/bits/string.h: + +/usr/include/bits/string2.h: + +/usr/include/stdlib.h: + +/usr/include/errno.h: + +/usr/include/bits/errno.h: + +/usr/include/linux/errno.h: + +/usr/include/asm/errno.h: + +/usr/include/asm-generic/errno.h: + +/usr/include/asm-generic/errno-base.h: + +include/enet/enet.h: + +/usr/include/alloca.h: + +include/enet/unix.h: + +include/enet/types.h: + +include/enet/protocol.h: + +include/enet/list.h: + +include/enet/callbacks.h: + +/usr/include/fcntl.h: + +/usr/include/bits/fcntl.h: + +/usr/include/sys/poll.h: + +/usr/include/bits/poll.h: diff --git a/src/enet/.deps/win32.Po b/src/enet/.deps/win32.Po new file mode 100644 index 0000000..09b4e09 --- /dev/null +++ b/src/enet/.deps/win32.Po @@ -0,0 +1 @@ +win32.o win32.o: win32.c diff --git a/src/enet/CVS/Entries b/src/enet/CVS/Entries new file mode 100644 index 0000000..73e4876 --- /dev/null +++ b/src/enet/CVS/Entries @@ -0,0 +1,27 @@ +/Doxyfile/1.1/Tue Mar 7 05:56:13 2006// +/LICENSE/1.3/Thu May 31 09:11:46 2007// +/Makefile.am/1.1/Tue Mar 7 05:56:13 2006// +/Makefile.in/1.4/Mon Sep 18 19:32:50 2006// +/README/1.2/Wed Mar 15 00:18:12 2006// +/aclocal.m4/1.2/Mon Sep 18 19:32:50 2006// +/callbacks.c/1.3/Thu May 31 08:07:27 2007// +/config.guess/1.1/Tue Mar 7 05:56:13 2006// +/config.sub/1.1/Tue Mar 7 05:56:13 2006// +/configure/1.16/Fri Oct 12 22:29:46 2007// +/configure.in/1.15/Fri Oct 12 17:56:28 2007// +/depcomp/1.1/Tue Mar 7 05:56:13 2006// +/design.txt/1.1/Tue Mar 7 05:56:13 2006// +/enet.dsp/1.2/Wed Oct 10 18:10:48 2007/-kb/ +/host.c/1.9/Fri Oct 12 05:46:11 2007// +/install-sh/1.1/Tue Mar 7 05:56:13 2006// +/list.c/1.1/Tue Mar 7 05:56:13 2006// +/missing/1.2/Fri Mar 24 21:14:07 2006// +/mkinstalldirs/1.1/Tue Mar 7 05:56:13 2006// +/packet.c/1.7/Tue Mar 27 06:31:56 2007// +/peer.c/1.21/Sun Oct 21 19:15:32 2007// +/protocol.c/1.33/Wed Jan 9 14:04:18 2008// +/tutorial.txt/1.1/Tue Mar 7 05:56:13 2006// +/unix.c/1.8/Sun Feb 24 14:08:53 2008// +/win32.c/1.6/Sun Feb 24 14:08:54 2008// +D/docs//// +D/include//// diff --git a/src/enet/CVS/Repository b/src/enet/CVS/Repository new file mode 100644 index 0000000..15b41f9 --- /dev/null +++ b/src/enet/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/enet diff --git a/src/enet/CVS/Root b/src/enet/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/enet/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/enet/Doxyfile b/src/enet/Doxyfile new file mode 100755 index 0000000..9636a04 --- /dev/null +++ b/src/enet/Doxyfile @@ -0,0 +1,993 @@ +# Doxyfile 1.2.18 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = enet + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = docs + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, +# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en +# (Japanese with english messages), Korean, Norwegian, Polish, Portuguese, +# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = NO + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited +# members of a class in the documentation of that class as if those members were +# ordinary class members. Constructors, destructors and assignment operators of +# the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. + +STRIP_FROM_PATH = + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower case letters. If set to YES upper case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are adviced to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explict @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. + +INHERIT_DOCS = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consist of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. +# For instance some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources +# only. Doxygen will then generate output that is more tailored for Java. +# For instance namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = . include/enet docs + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp +# *.h++ *.idl *.odl + +FILE_PATTERNS = *.c *.h *.dox + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = Tests + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories +# that are symbolic links (a Unix filesystem feature) are excluded from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output dir. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non empty doxygen will try to run +# the html help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the Html help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+, +# or Internet explorer 4.0+). Note that for large projects the tree generation +# can take a very long time. In such cases it is better to disable this feature. +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_XML = NO + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = FORCE_DOXYGEN + +# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse the +# parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tagfiles. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. Note that this +# option is superceded by the HAVE_DOT option below. This is only a fallback. It is +# recommended to install and use dot, since it yield more powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermedate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO + +# The CGI_NAME tag should be the name of the CGI script that +# starts the search engine (doxysearch) with the correct parameters. +# A script with this name will be generated by doxygen. + +CGI_NAME = search.cgi + +# The CGI_URL tag should be the absolute URL to the directory where the +# cgi binaries are located. See the documentation of your http daemon for +# details. + +CGI_URL = + +# The DOC_URL tag should be the absolute URL to the directory where the +# documentation is located. If left blank the absolute path to the +# documentation, with file:// prepended to it, will be used. + +DOC_URL = + +# The DOC_ABSPATH tag should be the absolute path to the directory where the +# documentation is located. If left blank the directory on the local machine +# will be used. + +DOC_ABSPATH = + +# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +# is installed. + +BIN_ABSPATH = /usr/local/bin/ + +# The EXT_DOC_PATHS tag can be used to specify one or more paths to +# documentation generated for other projects. This allows doxysearch to search +# the documentation for these projects as well. + +EXT_DOC_PATHS = diff --git a/src/enet/LICENSE b/src/enet/LICENSE new file mode 100644 index 0000000..9c4fe6b --- /dev/null +++ b/src/enet/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2002-2007 Lee Salzman + +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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/enet/Makefile b/src/enet/Makefile new file mode 100644 index 0000000..f5a31c5 --- /dev/null +++ b/src/enet/Makefile @@ -0,0 +1,656 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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. + + + +srcdir = . +top_srcdir = . + +pkgdatadir = $(datadir)/libenet.a +pkglibdir = $(libdir)/libenet.a +pkgincludedir = $(includedir)/libenet.a +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +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 = : +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/configure config.guess \ + config.sub depcomp install-sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +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 = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLIBRARIES_INSTALL = $(INSTALL_DATA) +LIBRARIES = $(lib_LIBRARIES) +AR = ar +ARFLAGS = cru +libenet_a_AR = $(AR) $(ARFLAGS) +libenet_a_LIBADD = +am_libenet_a_OBJECTS = host.$(OBJEXT) list.$(OBJEXT) \ + callbacks.$(OBJEXT) packet.$(OBJEXT) peer.$(OBJEXT) \ + protocol.$(OBJEXT) unix.$(OBJEXT) win32.$(OBJEXT) +libenet_a_OBJECTS = $(am_libenet_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libenet_a_SOURCES) +DIST_SOURCES = $(libenet_a_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run tar +AUTOCONF = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run autoconf +AUTOHEADER = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run autoheader +AUTOMAKE = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run automake-1.9 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = +CYGPATH_W = echo +DEFS = -DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"10-12-2007\" -DPACKAGE_STRING=\"libenet\ 10-12-2007\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"10-12-2007\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1 +DEPDIR = .deps +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +GREP = /bin/grep +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBS = +LTLIBOBJS = +MAKEINFO = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run makeinfo +OBJEXT = o +PACKAGE = libenet.a +PACKAGE_BUGREPORT = +PACKAGE_NAME = libenet +PACKAGE_STRING = libenet 10-12-2007 +PACKAGE_TARNAME = libenet +PACKAGE_VERSION = 10-12-2007 +PATH_SEPARATOR = : +RANLIB = ranlib +SET_MAKE = +SHELL = /bin/bash +STRIP = +VERSION = 10-12-2007 +ac_ct_CC = gcc +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build_alias = +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host_alias = +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = /home/mike/Games/sauerbraten/src/enet/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = mkdir -p -- +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target_alias = +lib_LIBRARIES = libenet.a +libenet_a_SOURCES = host.c list.c callbacks.c packet.c peer.c protocol.c unix.c win32.c +INCLUDES = -Iinclude/ +SUBDIRS = include +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: 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__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +install-libLIBRARIES: $(lib_LIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + @$(POST_INSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + p=$(am__strip_dir) \ + echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ + $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ + else :; fi; \ + done + +uninstall-libLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLIBRARIES: + -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) +libenet.a: $(libenet_a_OBJECTS) $(libenet_a_DEPENDENCIES) + -rm -f libenet.a + $(libenet_a_AR) libenet.a $(libenet_a_OBJECTS) $(libenet_a_LIBADD) + $(RANLIB) libenet.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/callbacks.Po +include ./$(DEPDIR)/host.Po +include ./$(DEPDIR)/list.Po +include ./$(DEPDIR)/packet.Po +include ./$(DEPDIR)/peer.Po +include ./$(DEPDIR)/protocol.Po +include ./$(DEPDIR)/unix.Po +include ./$(DEPDIR)/win32.Po + +.c.o: + if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c $< + +.c.obj: + if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +# 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. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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; \ + (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" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + 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 || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$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 \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -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 $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__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*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(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 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { 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 $(LIBRARIES) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)"; 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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-libLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: install-libLIBRARIES + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLIBRARIES + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-libLIBRARIES \ + clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-recursive \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-libLIBRARIES install-man \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-libLIBRARIES + +# 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: diff --git a/src/enet/Makefile.am b/src/enet/Makefile.am new file mode 100644 index 0000000..5b9caf3 --- /dev/null +++ b/src/enet/Makefile.am @@ -0,0 +1,5 @@ +lib_LIBRARIES = libenet.a +libenet_a_SOURCES = host.c list.c callbacks.c packet.c peer.c protocol.c unix.c win32.c +INCLUDES = -Iinclude/ + +SUBDIRS = include diff --git a/src/enet/Makefile.in b/src/enet/Makefile.in new file mode 100644 index 0000000..0ba2d8f --- /dev/null +++ b/src/enet/Makefile.in @@ -0,0 +1,656 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +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 = : +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/configure config.guess \ + config.sub depcomp install-sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +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 = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLIBRARIES_INSTALL = $(INSTALL_DATA) +LIBRARIES = $(lib_LIBRARIES) +AR = ar +ARFLAGS = cru +libenet_a_AR = $(AR) $(ARFLAGS) +libenet_a_LIBADD = +am_libenet_a_OBJECTS = host.$(OBJEXT) list.$(OBJEXT) \ + callbacks.$(OBJEXT) packet.$(OBJEXT) peer.$(OBJEXT) \ + protocol.$(OBJEXT) unix.$(OBJEXT) win32.$(OBJEXT) +libenet_a_OBJECTS = $(am_libenet_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libenet_a_SOURCES) +DIST_SOURCES = $(libenet_a_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +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_alias = @build_alias@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +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@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +lib_LIBRARIES = libenet.a +libenet_a_SOURCES = host.c list.c callbacks.c packet.c peer.c protocol.c unix.c win32.c +INCLUDES = -Iinclude/ +SUBDIRS = include +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: 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__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +install-libLIBRARIES: $(lib_LIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + @$(POST_INSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + p=$(am__strip_dir) \ + echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ + $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ + else :; fi; \ + done + +uninstall-libLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLIBRARIES: + -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) +libenet.a: $(libenet_a_OBJECTS) $(libenet_a_DEPENDENCIES) + -rm -f libenet.a + $(libenet_a_AR) libenet.a $(libenet_a_OBJECTS) $(libenet_a_LIBADD) + $(RANLIB) libenet.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callbacks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/host.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/peer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win32.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +# 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. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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; \ + (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" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + 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 || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$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 \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -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 $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__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*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(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 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { 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 $(LIBRARIES) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)"; 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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-libLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: install-libLIBRARIES + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLIBRARIES + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-libLIBRARIES \ + clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-recursive \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-libLIBRARIES install-man \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-libLIBRARIES + +# 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: diff --git a/src/enet/README b/src/enet/README new file mode 100644 index 0000000..f56cfde --- /dev/null +++ b/src/enet/README @@ -0,0 +1,14 @@ +Please visit the ENet homepage at http://enet.bespin.org for installation +and usage instructions. + +If you obtained this package from CVS, the quick description on how to build +is: + +# Generate the build system. + +aclocal && automake -a -c --foreign && autoconf + +# Compile and install the library. + +./configure && make && make install + diff --git a/src/enet/aclocal.m4 b/src/enet/aclocal.m4 new file mode 100644 index 0000000..aef181a --- /dev/null +++ b/src/enet/aclocal.m4 @@ -0,0 +1,850 @@ +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 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. + +# Copyright (C) 2002, 2003, 2005 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. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.6])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 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], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# 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. + +# serial 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +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, 2000, 2001, 2002, 2003, 2004, 2005 +# 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. + +# serial 8 + +# 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", "GCJ", or "OBJC". +# 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 + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$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'. + 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 + 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 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + 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 + ;; + none) break ;; + esac + # 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. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} 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, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# 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. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _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. FIXME. This creates each `.P' file that we will +# 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" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# 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. + +# serial 12 + +# 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. + +# 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.58])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 +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +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], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])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) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. 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)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# 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_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 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 +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 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. + +# serial 2 + +# 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])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 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. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# 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. + +# serial 4 + +# 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 supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005 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_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 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. + +# serial 3 + +# _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], +[AC_FOREACH([_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])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# 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. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# 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 ( + 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 + rm -f conftest.file + 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 + + 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)]) + +# Copyright (C) 2001, 2003, 2005 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="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 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. + +# serial 2 + +# _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. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +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 + diff --git a/src/enet/autom4te.cache/output.0 b/src/enet/autom4te.cache/output.0 new file mode 100644 index 0000000..30d9820 --- /dev/null +++ b/src/enet/autom4te.cache/output.0 @@ -0,0 +1,5691 @@ +@%:@! /bin/sh +@%:@ Guess values for system-dependent variables and create Makefiles. +@%:@ Generated by GNU Autoconf 2.61 for libenet 10-12-2007. +@%:@ +@%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +@%:@ 2002, 2003, 2004, 2005, 2006 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=: + # 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 + + + + +# PATH needs CR +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +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 + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +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 + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +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 + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 +fi +echo >conf$$.file +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, 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=. +LIB@&t@OBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='libenet' +PACKAGE_TARNAME='libenet' +PACKAGE_VERSION='10-12-2007' +PACKAGE_STRING='libenet 10-12-2007' +PACKAGE_BUGREPORT='' + +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +CYGPATH_W +PACKAGE +VERSION +ACLOCAL +AUTOCONF +AUTOMAKE +AUTOHEADER +MAKEINFO +install_sh +STRIP +INSTALL_STRIP_PROGRAM +mkdir_p +AWK +SET_MAKE +am__leading_dot +AMTAR +am__tar +am__untar +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +DEPDIR +am__include +am__quote +AMDEP_TRUE +AMDEP_FALSE +AMDEPBACKSLASH +CCDEPMODE +am__fastdepCC_TRUE +am__fastdepCC_FALSE +RANLIB +CPP +GREP +EGREP +LIB@&t@OBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# 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' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +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=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_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=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_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$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 ;; + + -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=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 ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + 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'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +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 +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +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 + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + 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 .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# 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 -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + 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 .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + 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 libenet 10-12-2007 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] + --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/libenet@:>@ + --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 +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libenet 10-12-2007:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-crc32 enable CRC32 packet verification + +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 C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_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" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`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 + 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 +libenet configure 10-12-2007 +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 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 +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 libenet $as_me 10-12-2007, which was +generated by GNU Autoconf 2.61. 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=. + 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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$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 + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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 + + cat <<\_ASBOX +@%:@@%:@ ---------------- @%:@@%:@ +@%:@@%:@ Cache variables. @%:@@%:@ +@%:@@%:@ ---------------- @%:@@%:@ +_ASBOX + 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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_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 + + cat <<\_ASBOX +@%:@@%:@ ----------------- @%:@@%:@ +@%:@@%:@ Output variables. @%:@@%:@ +@%:@@%:@ ----------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +@%:@@%:@ ------------------- @%:@@%:@ +@%:@@%:@ File substitutions. @%:@@%:@ +@%:@@%:@ ------------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +@%:@@%:@ ----------- @%:@@%:@ +@%:@@%:@ confdefs.h. @%:@@%:@ +@%:@@%:@ ----------- @%:@@%:@ +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + 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'; { (exit 1); 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 + +# 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 + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + 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. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +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,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +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 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`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. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +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 + + +am__api_version="1.9" +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 + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +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. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +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 +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$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' + +{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# 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 ( + 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 + rm -f conftest.file + 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". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +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 $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm -f conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&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 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + SET_MAKE= +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +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=libenet.a + VERSION=10-12-2007 + + +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"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# 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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out 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. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 | *.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 + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +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 +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$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 +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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" + 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +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) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +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 +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6; } +rm -f confinc confmf + +# 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='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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'. + 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 + 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 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + 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 + ;; + none) break ;; + esac + # 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. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} 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 +{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$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 + + +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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + +{ echo "$as_me:$LINENO: checking for gethostbyaddr_r" >&5 +echo $ECHO_N "checking for gethostbyaddr_r... $ECHO_C" >&6; } +if test "${ac_cv_func_gethostbyaddr_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define gethostbyaddr_r to an innocuous variant, in case declares gethostbyaddr_r. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyaddr_r innocuous_gethostbyaddr_r + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyaddr_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyaddr_r + +/* 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 gethostbyaddr_r (); +/* 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_gethostbyaddr_r || defined __stub___gethostbyaddr_r +choke me +#endif + +int +main () +{ +return gethostbyaddr_r (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_gethostbyaddr_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_gethostbyaddr_r=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyaddr_r" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyaddr_r" >&6; } +if test $ac_cv_func_gethostbyaddr_r = yes; then + cat >>confdefs.h <<\_ACEOF +@%:@define HAS_GETHOSTBYADDR_R 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 +echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6; } +if test "${ac_cv_func_gethostbyname_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define gethostbyname_r to an innocuous variant, in case declares gethostbyname_r. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname_r innocuous_gethostbyname_r + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyname_r + +/* 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 gethostbyname_r (); +/* 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_gethostbyname_r || defined __stub___gethostbyname_r +choke me +#endif + +int +main () +{ +return gethostbyname_r (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_gethostbyname_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_gethostbyname_r=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname_r" >&6; } +if test $ac_cv_func_gethostbyname_r = yes; then + cat >>confdefs.h <<\_ACEOF +@%:@define HAS_GETHOSTBYNAME_R 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for poll" >&5 +echo $ECHO_N "checking for poll... $ECHO_C" >&6; } +if test "${ac_cv_func_poll+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define poll to an innocuous variant, in case declares poll. + For example, HP-UX 11i declares gettimeofday. */ +#define poll innocuous_poll + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char poll (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef poll + +/* 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 poll (); +/* 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_poll || defined __stub___poll +choke me +#endif + +int +main () +{ +return poll (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_poll=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_poll=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_poll" >&5 +echo "${ECHO_T}$ac_cv_func_poll" >&6; } +if test $ac_cv_func_poll = yes; then + cat >>confdefs.h <<\_ACEOF +@%:@define HAS_POLL 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for fcntl" >&5 +echo $ECHO_N "checking for fcntl... $ECHO_C" >&6; } +if test "${ac_cv_func_fcntl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define fcntl to an innocuous variant, in case declares fcntl. + For example, HP-UX 11i declares gettimeofday. */ +#define fcntl innocuous_fcntl + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char fcntl (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef fcntl + +/* 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 fcntl (); +/* 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_fcntl || defined __stub___fcntl +choke me +#endif + +int +main () +{ +return fcntl (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_fcntl=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_fcntl=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_fcntl" >&5 +echo "${ECHO_T}$ac_cv_func_fcntl" >&6; } +if test $ac_cv_func_fcntl = yes; then + cat >>confdefs.h <<\_ACEOF +@%:@define HAS_FCNTL 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for inet_pton" >&5 +echo $ECHO_N "checking for inet_pton... $ECHO_C" >&6; } +if test "${ac_cv_func_inet_pton+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define inet_pton to an innocuous variant, in case declares inet_pton. + For example, HP-UX 11i declares gettimeofday. */ +#define inet_pton innocuous_inet_pton + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char inet_pton (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef inet_pton + +/* 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 inet_pton (); +/* 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_inet_pton || defined __stub___inet_pton +choke me +#endif + +int +main () +{ +return inet_pton (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_inet_pton=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_inet_pton=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_inet_pton" >&5 +echo "${ECHO_T}$ac_cv_func_inet_pton" >&6; } +if test $ac_cv_func_inet_pton = yes; then + cat >>confdefs.h <<\_ACEOF +@%:@define HAS_INET_PTON 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for inet_ntop" >&5 +echo $ECHO_N "checking for inet_ntop... $ECHO_C" >&6; } +if test "${ac_cv_func_inet_ntop+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define inet_ntop to an innocuous variant, in case declares inet_ntop. + For example, HP-UX 11i declares gettimeofday. */ +#define inet_ntop innocuous_inet_ntop + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char inet_ntop (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef inet_ntop + +/* 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 inet_ntop (); +/* 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_inet_ntop || defined __stub___inet_ntop +choke me +#endif + +int +main () +{ +return inet_ntop (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_inet_ntop=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_inet_ntop=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_inet_ntop" >&5 +echo "${ECHO_T}$ac_cv_func_inet_ntop" >&6; } +if test $ac_cv_func_inet_ntop = yes; then + cat >>confdefs.h <<\_ACEOF +@%:@define HAS_INET_NTOP 1 +_ACEOF + +fi + + +{ echo "$as_me:$LINENO: checking for struct msghdr.msg_flags" >&5 +echo $ECHO_N "checking for struct msghdr.msg_flags... $ECHO_C" >&6; } +if test "${ac_cv_member_struct_msghdr_msg_flags+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +static struct msghdr ac_aggr; +if (ac_aggr.msg_flags) +return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_member_struct_msghdr_msg_flags=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +static struct msghdr ac_aggr; +if (sizeof ac_aggr.msg_flags) +return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_member_struct_msghdr_msg_flags=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_member_struct_msghdr_msg_flags=no +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 +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_msghdr_msg_flags" >&5 +echo "${ECHO_T}$ac_cv_member_struct_msghdr_msg_flags" >&6; } +if test $ac_cv_member_struct_msghdr_msg_flags = yes; then + cat >>confdefs.h <<\_ACEOF +@%:@define HAS_MSGHDR_FLAGS 1 +_ACEOF + +fi + + +{ echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; } +if test "${ac_cv_type_socklen_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #include + + +typedef socklen_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_socklen_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_socklen_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 +echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; } +if test $ac_cv_type_socklen_t = yes; then + cat >>confdefs.h <<\_ACEOF +@%:@define HAS_SOCKLEN_T 1 +_ACEOF + +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 +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include +@%:@else +@%:@ include +@%:@endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f 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 +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include +@%:@else +@%:@ include +@%:@endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +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 + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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" + { test -f "$ac_path_GREP" && $as_test_x "$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 + echo $ECHO_N "0123456789$ECHO_C" >"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" + "$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 + ac_count=`expr $ac_count + 1` + 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 + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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" + { test -f "$ac_path_EGREP" && $as_test_x "$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 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + 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 + ac_count=`expr $ac_count + 1` + 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 + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "MSG_MAXIOVLEN" >/dev/null 2>&1; then + cat >>confdefs.h <<\_ACEOF +@%:@define ENET_BUFFER_MAXIMUM MSG_MAXIOVLEN +_ACEOF + +fi +rm -f conftest* + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "MSG_MAXIOVLEN" >/dev/null 2>&1; then + cat >>confdefs.h <<\_ACEOF +@%:@define ENET_BUFFER_MAXIMUM MSG_MAXIOVLEN +_ACEOF + +fi +rm -f conftest* + + +{ echo "$as_me:$LINENO: checking whether to use CRC32" >&5 +echo $ECHO_N "checking whether to use CRC32... $ECHO_C" >&6; } +# Check whether --enable-crc32 was given. +if test "${enable_crc32+set}" = set; then + enableval=$enable_crc32; if test "$enableval" = yes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + cat >>confdefs.h <<\_ACEOF +@%:@define USE_CRC32 1 +_ACEOF + + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + fi +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +ac_config_files="$ac_config_files Makefile include/Makefile include/enet/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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_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 + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +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}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIB@&t@OBJS; 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=`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. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIB@&t@OBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $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} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## 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=: + # 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 + + + + +# PATH needs CR +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +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 + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 +fi +echo >conf$$.file +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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 + +# 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 libenet $as_me 10-12-2007, which was +generated by GNU Autoconf 2.61. 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 + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet 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 + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +libenet config.status 10-12-2007 +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 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' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +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=$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 ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + 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. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$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 +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX +@%:@@%:@ Running $as_me. @%:@@%:@ +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/enet/Makefile") CONFIG_FILES="$CONFIG_FILES include/enet/Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + 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_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= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +CYGPATH_W!$CYGPATH_W$ac_delim +PACKAGE!$PACKAGE$ac_delim +VERSION!$VERSION$ac_delim +ACLOCAL!$ACLOCAL$ac_delim +AUTOCONF!$AUTOCONF$ac_delim +AUTOMAKE!$AUTOMAKE$ac_delim +AUTOHEADER!$AUTOHEADER$ac_delim +MAKEINFO!$MAKEINFO$ac_delim +install_sh!$install_sh$ac_delim +STRIP!$STRIP$ac_delim +INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim +mkdir_p!$mkdir_p$ac_delim +AWK!$AWK$ac_delim +SET_MAKE!$SET_MAKE$ac_delim +am__leading_dot!$am__leading_dot$ac_delim +AMTAR!$AMTAR$ac_delim +am__tar!$am__tar$ac_delim +am__untar!$am__untar$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +DEPDIR!$DEPDIR$ac_delim +am__include!$am__include$ac_delim +am__quote!$am__quote$ac_delim +AMDEP_TRUE!$AMDEP_TRUE$ac_delim +AMDEP_FALSE!$AMDEP_FALSE$ac_delim +AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim +CCDEPMODE!$CCDEPMODE$ac_delim +am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim +am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim +RANLIB!$RANLIB$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +LIB@&t@OBJS!$LIB@&t@OBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ 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[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[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="$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 || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$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 "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + 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 || +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" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`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 || +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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`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 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# 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= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + 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 + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;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 +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +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 "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 +echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`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 || +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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# 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 || { (exit 1); exit 1; } +fi + + diff --git a/src/enet/autom4te.cache/requests b/src/enet/autom4te.cache/requests new file mode 100644 index 0000000..a08a5a7 --- /dev/null +++ b/src/enet/autom4te.cache/requests @@ -0,0 +1,64 @@ +# This file was generated by Autom4te Sat Apr 28 03:44:04 GMT 2007. +# It contains the lists of macros which have been traced. +# It can be safely removed. + +@request = ( + bless( [ + '0', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + 'aclocal.m4', + 'configure.in' + ], + { + '_LT_AC_TAGCONFIG' => 1, + 'AM_PROG_F77_C_O' => 1, + 'AC_INIT' => 1, + 'm4_pattern_forbid' => 1, + 'AC_CANONICAL_TARGET' => 1, + 'AC_SUBST' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'AC_FC_SRCEXT' => 1, + 'AC_CANONICAL_HOST' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_CONFIG_SUBDIRS' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, + 'AC_REQUIRE_AUX_FILE' => 1, + 'AC_CONFIG_LINKS' => 1, + 'm4_sinclude' => 1, + 'LT_SUPPORTED_TAG' => 1, + 'AM_MAINTAINER_MODE' => 1, + 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, + '_m4_warn' => 1, + 'AM_PROG_CXX_C_O' => 1, + 'AM_ENABLE_MULTILIB' => 1, + 'AC_CONFIG_FILES' => 1, + 'include' => 1, + 'LT_INIT' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AC_LIBSOURCE' => 1, + 'AM_PROG_FC_C_O' => 1, + 'AC_CANONICAL_BUILD' => 1, + 'AC_FC_FREEFORM' => 1, + 'AH_OUTPUT' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + 'sinclude' => 1, + 'm4_pattern_allow' => 1, + 'AM_PROG_CC_C_O' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AM_CONDITIONAL' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'm4_include' => 1, + 'AC_SUBST_TRACE' => 1 + } + ], 'Autom4te::Request' ) + ); + diff --git a/src/enet/autom4te.cache/traces.0 b/src/enet/autom4te.cache/traces.0 new file mode 100644 index 0000000..0b1828f --- /dev/null +++ b/src/enet/autom4te.cache/traces.0 @@ -0,0 +1,347 @@ +m4trace:configure.in:1: -1- AC_INIT([libenet], [10-12-2007]) +m4trace:configure.in:1: -1- m4_pattern_forbid([^_?A[CHUM]_]) +m4trace:configure.in:1: -1- m4_pattern_forbid([_AC_]) +m4trace:configure.in:1: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) +m4trace:configure.in:1: -1- m4_pattern_allow([^AS_FLAGS$]) +m4trace:configure.in:1: -1- m4_pattern_forbid([^_?m4_]) +m4trace:configure.in:1: -1- m4_pattern_forbid([^dnl$]) +m4trace:configure.in:1: -1- m4_pattern_forbid([^_?AS_]) +m4trace:configure.in:1: -1- AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([SHELL]) +m4trace:configure.in:1: -1- m4_pattern_allow([^SHELL$]) +m4trace:configure.in:1: -1- AC_SUBST([PATH_SEPARATOR]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PATH_SEPARATOR]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PATH_SEPARATOR$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_NAME]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_TARNAME]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_VERSION]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_STRING]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.in:1: -1- AC_SUBST([exec_prefix], [NONE]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([exec_prefix]) +m4trace:configure.in:1: -1- m4_pattern_allow([^exec_prefix$]) +m4trace:configure.in:1: -1- AC_SUBST([prefix], [NONE]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([prefix]) +m4trace:configure.in:1: -1- m4_pattern_allow([^prefix$]) +m4trace:configure.in:1: -1- AC_SUBST([program_transform_name], [s,x,x,]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([program_transform_name]) +m4trace:configure.in:1: -1- m4_pattern_allow([^program_transform_name$]) +m4trace:configure.in:1: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([bindir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^bindir$]) +m4trace:configure.in:1: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([sbindir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^sbindir$]) +m4trace:configure.in:1: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([libexecdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^libexecdir$]) +m4trace:configure.in:1: -1- AC_SUBST([datarootdir], ['${prefix}/share']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([datarootdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^datarootdir$]) +m4trace:configure.in:1: -1- AC_SUBST([datadir], ['${datarootdir}']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([datadir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^datadir$]) +m4trace:configure.in:1: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([sysconfdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^sysconfdir$]) +m4trace:configure.in:1: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([sharedstatedir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^sharedstatedir$]) +m4trace:configure.in:1: -1- AC_SUBST([localstatedir], ['${prefix}/var']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([localstatedir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^localstatedir$]) +m4trace:configure.in:1: -1- AC_SUBST([includedir], ['${prefix}/include']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([includedir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^includedir$]) +m4trace:configure.in:1: -1- AC_SUBST([oldincludedir], ['/usr/include']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([oldincludedir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^oldincludedir$]) +m4trace:configure.in:1: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], + ['${datarootdir}/doc/${PACKAGE_TARNAME}'], + ['${datarootdir}/doc/${PACKAGE}'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([docdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^docdir$]) +m4trace:configure.in:1: -1- AC_SUBST([infodir], ['${datarootdir}/info']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([infodir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^infodir$]) +m4trace:configure.in:1: -1- AC_SUBST([htmldir], ['${docdir}']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([htmldir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^htmldir$]) +m4trace:configure.in:1: -1- AC_SUBST([dvidir], ['${docdir}']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([dvidir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^dvidir$]) +m4trace:configure.in:1: -1- AC_SUBST([pdfdir], ['${docdir}']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([pdfdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^pdfdir$]) +m4trace:configure.in:1: -1- AC_SUBST([psdir], ['${docdir}']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([psdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^psdir$]) +m4trace:configure.in:1: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([libdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^libdir$]) +m4trace:configure.in:1: -1- AC_SUBST([localedir], ['${datarootdir}/locale']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([localedir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^localedir$]) +m4trace:configure.in:1: -1- AC_SUBST([mandir], ['${datarootdir}/man']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([mandir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^mandir$]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ +#undef PACKAGE_NAME]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ +#undef PACKAGE_VERSION]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT]) +m4trace:configure.in:1: -1- AC_SUBST([DEFS]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([DEFS]) +m4trace:configure.in:1: -1- m4_pattern_allow([^DEFS$]) +m4trace:configure.in:1: -1- AC_SUBST([ECHO_C]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([ECHO_C]) +m4trace:configure.in:1: -1- m4_pattern_allow([^ECHO_C$]) +m4trace:configure.in:1: -1- AC_SUBST([ECHO_N]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([ECHO_N]) +m4trace:configure.in:1: -1- m4_pattern_allow([^ECHO_N$]) +m4trace:configure.in:1: -1- AC_SUBST([ECHO_T]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([ECHO_T]) +m4trace:configure.in:1: -1- m4_pattern_allow([^ECHO_T$]) +m4trace:configure.in:1: -1- AC_SUBST([LIBS]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:1: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.in:1: -1- AC_SUBST([build_alias]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([build_alias]) +m4trace:configure.in:1: -1- m4_pattern_allow([^build_alias$]) +m4trace:configure.in:1: -1- AC_SUBST([host_alias]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([host_alias]) +m4trace:configure.in:1: -1- m4_pattern_allow([^host_alias$]) +m4trace:configure.in:1: -1- AC_SUBST([target_alias]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([target_alias]) +m4trace:configure.in:1: -1- m4_pattern_allow([^target_alias$]) +m4trace:configure.in:2: -1- AM_INIT_AUTOMAKE([libenet.a], [10-12-2007]) +m4trace:configure.in:2: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) +m4trace:configure.in:2: -1- AM_AUTOMAKE_VERSION([1.9.6]) +m4trace:configure.in:2: -1- AC_REQUIRE_AUX_FILE([install-sh]) +m4trace:configure.in:2: -1- AC_SUBST([INSTALL_PROGRAM]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([INSTALL_PROGRAM]) +m4trace:configure.in:2: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) +m4trace:configure.in:2: -1- AC_SUBST([INSTALL_SCRIPT]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([INSTALL_SCRIPT]) +m4trace:configure.in:2: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) +m4trace:configure.in:2: -1- AC_SUBST([INSTALL_DATA]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([INSTALL_DATA]) +m4trace:configure.in:2: -1- m4_pattern_allow([^INSTALL_DATA$]) +m4trace:configure.in:2: -1- AC_SUBST([CYGPATH_W]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([CYGPATH_W]) +m4trace:configure.in:2: -1- m4_pattern_allow([^CYGPATH_W$]) +m4trace:configure.in:2: -1- AC_SUBST([PACKAGE], [libenet.a]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE$]) +m4trace:configure.in:2: -1- AC_SUBST([VERSION], [10-12-2007]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([VERSION]) +m4trace:configure.in:2: -1- m4_pattern_allow([^VERSION$]) +m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE$]) +m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE], [/* Name of package */ +#undef PACKAGE]) +m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([VERSION]) +m4trace:configure.in:2: -1- m4_pattern_allow([^VERSION$]) +m4trace:configure.in:2: -1- AH_OUTPUT([VERSION], [/* Version number of package */ +#undef VERSION]) +m4trace:configure.in:2: -1- AC_SUBST([ACLOCAL]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([ACLOCAL]) +m4trace:configure.in:2: -1- m4_pattern_allow([^ACLOCAL$]) +m4trace:configure.in:2: -1- AC_SUBST([AUTOCONF]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([AUTOCONF]) +m4trace:configure.in:2: -1- m4_pattern_allow([^AUTOCONF$]) +m4trace:configure.in:2: -1- AC_SUBST([AUTOMAKE]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([AUTOMAKE]) +m4trace:configure.in:2: -1- m4_pattern_allow([^AUTOMAKE$]) +m4trace:configure.in:2: -1- AC_SUBST([AUTOHEADER]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([AUTOHEADER]) +m4trace:configure.in:2: -1- m4_pattern_allow([^AUTOHEADER$]) +m4trace:configure.in:2: -1- AC_SUBST([MAKEINFO]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([MAKEINFO]) +m4trace:configure.in:2: -1- m4_pattern_allow([^MAKEINFO$]) +m4trace:configure.in:2: -1- AC_SUBST([install_sh]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([install_sh]) +m4trace:configure.in:2: -1- m4_pattern_allow([^install_sh$]) +m4trace:configure.in:2: -1- AC_SUBST([STRIP]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([STRIP]) +m4trace:configure.in:2: -1- m4_pattern_allow([^STRIP$]) +m4trace:configure.in:2: -1- AC_SUBST([INSTALL_STRIP_PROGRAM]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([INSTALL_STRIP_PROGRAM]) +m4trace:configure.in:2: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$]) +m4trace:configure.in:2: -1- AC_SUBST([mkdir_p]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([mkdir_p]) +m4trace:configure.in:2: -1- m4_pattern_allow([^mkdir_p$]) +m4trace:configure.in:2: -1- AC_SUBST([AWK]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([AWK]) +m4trace:configure.in:2: -1- m4_pattern_allow([^AWK$]) +m4trace:configure.in:2: -1- AC_SUBST([SET_MAKE]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([SET_MAKE]) +m4trace:configure.in:2: -1- m4_pattern_allow([^SET_MAKE$]) +m4trace:configure.in:2: -1- AC_SUBST([am__leading_dot]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([am__leading_dot]) +m4trace:configure.in:2: -1- m4_pattern_allow([^am__leading_dot$]) +m4trace:configure.in:2: -1- AC_SUBST([AMTAR]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([AMTAR]) +m4trace:configure.in:2: -1- m4_pattern_allow([^AMTAR$]) +m4trace:configure.in:2: -1- AC_SUBST([am__tar]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([am__tar]) +m4trace:configure.in:2: -1- m4_pattern_allow([^am__tar$]) +m4trace:configure.in:2: -1- AC_SUBST([am__untar]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([am__untar]) +m4trace:configure.in:2: -1- m4_pattern_allow([^am__untar$]) +m4trace:configure.in:4: -1- AC_SUBST([CC]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:4: -1- AC_SUBST([CFLAGS]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([CFLAGS]) +m4trace:configure.in:4: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.in:4: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.in:4: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.in:4: -1- AC_SUBST([LIBS]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:4: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.in:4: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:4: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:4: -1- AC_SUBST([CC]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:4: -1- AC_SUBST([CC]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:4: -1- AC_SUBST([CC]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:4: -1- AC_SUBST([CC]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:4: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:4: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([ac_ct_CC]) +m4trace:configure.in:4: -1- m4_pattern_allow([^ac_ct_CC$]) +m4trace:configure.in:4: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([EXEEXT]) +m4trace:configure.in:4: -1- m4_pattern_allow([^EXEEXT$]) +m4trace:configure.in:4: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([OBJEXT]) +m4trace:configure.in:4: -1- m4_pattern_allow([^OBJEXT$]) +m4trace:configure.in:4: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([DEPDIR]) +m4trace:configure.in:4: -1- m4_pattern_allow([^DEPDIR$]) +m4trace:configure.in:4: -1- AC_SUBST([am__include]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([am__include]) +m4trace:configure.in:4: -1- m4_pattern_allow([^am__include$]) +m4trace:configure.in:4: -1- AC_SUBST([am__quote]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([am__quote]) +m4trace:configure.in:4: -1- m4_pattern_allow([^am__quote$]) +m4trace:configure.in:4: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +m4trace:configure.in:4: -1- AC_SUBST([AMDEP_TRUE]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([AMDEP_TRUE]) +m4trace:configure.in:4: -1- m4_pattern_allow([^AMDEP_TRUE$]) +m4trace:configure.in:4: -1- AC_SUBST([AMDEP_FALSE]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([AMDEP_FALSE]) +m4trace:configure.in:4: -1- m4_pattern_allow([^AMDEP_FALSE$]) +m4trace:configure.in:4: -1- AC_SUBST([AMDEPBACKSLASH]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([AMDEPBACKSLASH]) +m4trace:configure.in:4: -1- m4_pattern_allow([^AMDEPBACKSLASH$]) +m4trace:configure.in:4: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([CCDEPMODE]) +m4trace:configure.in:4: -1- m4_pattern_allow([^CCDEPMODE$]) +m4trace:configure.in:4: -1- AM_CONDITIONAL([am__fastdepCC], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3]) +m4trace:configure.in:4: -1- AC_SUBST([am__fastdepCC_TRUE]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([am__fastdepCC_TRUE]) +m4trace:configure.in:4: -1- m4_pattern_allow([^am__fastdepCC_TRUE$]) +m4trace:configure.in:4: -1- AC_SUBST([am__fastdepCC_FALSE]) +m4trace:configure.in:4: -1- AC_SUBST_TRACE([am__fastdepCC_FALSE]) +m4trace:configure.in:4: -1- m4_pattern_allow([^am__fastdepCC_FALSE$]) +m4trace:configure.in:5: -1- AC_SUBST([RANLIB]) +m4trace:configure.in:5: -1- AC_SUBST_TRACE([RANLIB]) +m4trace:configure.in:5: -1- m4_pattern_allow([^RANLIB$]) +m4trace:configure.in:7: -1- AC_DEFINE_TRACE_LITERAL([HAS_GETHOSTBYADDR_R]) +m4trace:configure.in:7: -1- m4_pattern_allow([^HAS_GETHOSTBYADDR_R$]) +m4trace:configure.in:8: -1- AC_DEFINE_TRACE_LITERAL([HAS_GETHOSTBYNAME_R]) +m4trace:configure.in:8: -1- m4_pattern_allow([^HAS_GETHOSTBYNAME_R$]) +m4trace:configure.in:9: -1- AC_DEFINE_TRACE_LITERAL([HAS_POLL]) +m4trace:configure.in:9: -1- m4_pattern_allow([^HAS_POLL$]) +m4trace:configure.in:10: -1- AC_DEFINE_TRACE_LITERAL([HAS_FCNTL]) +m4trace:configure.in:10: -1- m4_pattern_allow([^HAS_FCNTL$]) +m4trace:configure.in:11: -1- AC_DEFINE_TRACE_LITERAL([HAS_INET_PTON]) +m4trace:configure.in:11: -1- m4_pattern_allow([^HAS_INET_PTON$]) +m4trace:configure.in:12: -1- AC_DEFINE_TRACE_LITERAL([HAS_INET_NTOP]) +m4trace:configure.in:12: -1- m4_pattern_allow([^HAS_INET_NTOP$]) +m4trace:configure.in:14: -1- AC_DEFINE_TRACE_LITERAL([HAS_MSGHDR_FLAGS]) +m4trace:configure.in:14: -1- m4_pattern_allow([^HAS_MSGHDR_FLAGS$]) +m4trace:configure.in:16: -1- AC_DEFINE_TRACE_LITERAL([HAS_SOCKLEN_T]) +m4trace:configure.in:16: -1- m4_pattern_allow([^HAS_SOCKLEN_T$]) +m4trace:configure.in:21: -2- AC_DEFINE_TRACE_LITERAL([ENET_BUFFER_MAXIMUM]) +m4trace:configure.in:21: -2- m4_pattern_allow([^ENET_BUFFER_MAXIMUM$]) +m4trace:configure.in:21: -1- AC_SUBST([CPP]) +m4trace:configure.in:21: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.in:21: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.in:21: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:21: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:21: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:21: -1- AC_SUBST([CPP]) +m4trace:configure.in:21: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.in:21: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.in:21: -1- AC_SUBST([GREP]) +m4trace:configure.in:21: -1- AC_SUBST_TRACE([GREP]) +m4trace:configure.in:21: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.in:21: -1- AC_SUBST([GREP]) +m4trace:configure.in:21: -1- AC_SUBST_TRACE([GREP]) +m4trace:configure.in:21: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.in:21: -1- AC_SUBST([EGREP]) +m4trace:configure.in:21: -1- AC_SUBST_TRACE([EGREP]) +m4trace:configure.in:21: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.in:21: -1- AC_SUBST([EGREP]) +m4trace:configure.in:21: -1- AC_SUBST_TRACE([EGREP]) +m4trace:configure.in:21: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.in:22: -2- AC_DEFINE_TRACE_LITERAL([ENET_BUFFER_MAXIMUM]) +m4trace:configure.in:22: -2- m4_pattern_allow([^ENET_BUFFER_MAXIMUM$]) +m4trace:configure.in:25: -1- AC_DEFINE_TRACE_LITERAL([USE_CRC32]) +m4trace:configure.in:25: -1- m4_pattern_allow([^USE_CRC32$]) +m4trace:configure.in:35: -1- AC_CONFIG_FILES([Makefile include/Makefile include/enet/Makefile]) +m4trace:configure.in:35: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments. +You should run autoupdate.], []) +m4trace:configure.in:35: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) +m4trace:configure.in:35: -1- m4_pattern_allow([^LIB@&t@OBJS$]) +m4trace:configure.in:35: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([LTLIBOBJS]) +m4trace:configure.in:35: -1- m4_pattern_allow([^LTLIBOBJS$]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([top_builddir]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([srcdir]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([abs_srcdir]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([top_srcdir]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([abs_top_srcdir]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([builddir]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([abs_builddir]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([abs_top_builddir]) +m4trace:configure.in:35: -1- AC_SUBST_TRACE([INSTALL]) diff --git a/src/enet/callbacks.c b/src/enet/callbacks.c new file mode 100644 index 0000000..7f960af --- /dev/null +++ b/src/enet/callbacks.c @@ -0,0 +1,53 @@ +/** + @file callbacks.c + @brief ENet callback functions +*/ +#define ENET_BUILDING_LIB 1 +#include "enet/enet.h" + +static ENetCallbacks callbacks = { malloc, free, rand }; + +int +enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits) +{ + if (version != ENET_VERSION) + return -1; + + if (inits -> malloc != NULL || inits -> free != NULL) + { + if (inits -> malloc == NULL || inits -> free == NULL) + return -1; + + callbacks.malloc = inits -> malloc; + callbacks.free = inits -> free; + } + + if (inits -> rand != NULL) + callbacks.rand = inits -> rand; + + return enet_initialize (); +} + +void * +enet_malloc (size_t size) +{ + void * memory = callbacks.malloc (size); + + if (memory == NULL) + abort (); + + return memory; +} + +void +enet_free (void * memory) +{ + callbacks.free (memory); +} + +int +enet_rand (void) +{ + return callbacks.rand (); +} + diff --git a/src/enet/config.guess b/src/enet/config.guess new file mode 100755 index 0000000..77c7cba --- /dev/null +++ b/src/enet/config.guess @@ -0,0 +1,1441 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +timestamp='2004-08-13' + +# 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 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. +# +# 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 Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +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 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # 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 -q "$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 ;' + +# 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 + +# 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 tupples: *-*-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=`(/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 ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + 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 + # 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/[-_].*/\./'` + ;; + 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}" + exit 0 ;; + amd64:OpenBSD:*:*) + echo x86_64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + cats:OpenBSD:*:*) + echo arm-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + luna88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit 0 ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + 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'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + 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 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + 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 0 ;; + 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 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + 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 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # 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 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + 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 \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + 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 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????: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 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + 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 0 ;; + *: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 + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo rs6000-ibm-aix3.2.5 + 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 0 ;; + *:AIX:*:[45]) + 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/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 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 + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 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 && $dummy && exit 0 + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + 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 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + 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 0 ;; + 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 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #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-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #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-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + 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 ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + 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-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + 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 0 ;; + 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 0 ;; + 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 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V: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 0 ;; + i*86:*:5:[78]*) + 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 0 ;; + 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 0 ;; + 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 i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + 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 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 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 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *: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 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + 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 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + *86) UNAME_PROCESSOR=i686 ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *: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 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *: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 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms && exit 0 ;; + I*) echo ia64-dec-vms && exit 0 ;; + V*) echo vax-dec-vms && exit 0 ;; + esac +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +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` +/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-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/enet/config.log b/src/enet/config.log new file mode 100644 index 0000000..2c2ecb4 --- /dev/null +++ b/src/enet/config.log @@ -0,0 +1,373 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libenet configure 10-12-2007, which was +generated by GNU Autoconf 2.61. Invocation command line was + + $ ./configure --no-create --no-recursion + +## --------- ## +## Platform. ## +## --------- ## + +hostname = segfault +uname -m = i686 +uname -r = 2.6.24-19-generic +uname -s = Linux +uname -v = #1 SMP Fri Jul 11 23:41:49 UTC 2008 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = unknown +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +/usr/bin/hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /home/mike/Programming/dsss/bin/ +PATH: /usr/local/sbin +PATH: /usr/local/bin +PATH: /usr/sbin +PATH: /usr/bin +PATH: /sbin +PATH: /bin +PATH: /usr/games + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:1733: checking for a BSD-compatible install +configure:1789: result: /usr/bin/install -c +configure:1800: checking whether build environment is sane +configure:1843: result: yes +configure:1908: checking for gawk +configure:1938: result: no +configure:1908: checking for mawk +configure:1924: found /usr/bin/mawk +configure:1935: result: mawk +configure:1946: checking whether make sets $(MAKE) +configure:1967: result: yes +configure:2200: checking for gcc +configure:2216: found /usr/local/bin/gcc +configure:2227: result: gcc +configure:2465: checking for C compiler version +configure:2472: gcc --version >&5 +gcc (GCC) 4.1.2 20070214 ( gdc 0.24, using dmd 1.030) +Copyright (C) 2006 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. + +configure:2475: $? = 0 +configure:2482: gcc -v >&5 +Using built-in specs. +Target: i686-pc-linux-gnu +Configured with: ./../gcc-4.1.2/configure --enable-languages=c,c++,d --prefix=/usr/local +Thread model: posix +gcc version 4.1.2 20070214 ( gdc 0.24, using dmd 1.030) +configure:2485: $? = 0 +configure:2492: gcc -V >&5 +gcc: '-V' option must have argument +configure:2495: $? = 1 +configure:2518: checking for C compiler default output file name +configure:2545: gcc conftest.c >&5 +configure:2548: $? = 0 +configure:2586: result: a.out +configure:2603: checking whether the C compiler works +configure:2613: ./a.out +configure:2616: $? = 0 +configure:2633: result: yes +configure:2640: checking whether we are cross compiling +configure:2642: result: no +configure:2645: checking for suffix of executables +configure:2652: gcc -o conftest conftest.c >&5 +configure:2655: $? = 0 +configure:2679: result: +configure:2685: checking for suffix of object files +configure:2711: gcc -c conftest.c >&5 +configure:2714: $? = 0 +configure:2737: result: o +configure:2741: checking whether we are using the GNU C compiler +configure:2770: gcc -c conftest.c >&5 +configure:2776: $? = 0 +configure:2793: result: yes +configure:2798: checking whether gcc accepts -g +configure:2828: gcc -c -g conftest.c >&5 +configure:2834: $? = 0 +configure:2933: result: yes +configure:2950: checking for gcc option to accept ISO C89 +configure:3024: gcc -c -g -O2 conftest.c >&5 +configure:3030: $? = 0 +configure:3053: result: none needed +configure:3082: checking for style of include used by make +configure:3110: result: GNU +configure:3138: checking dependency style of gcc +configure:3228: result: gcc3 +configure:3288: checking for ranlib +configure:3304: found /usr/bin/ranlib +configure:3315: result: ranlib +configure:3343: checking for gethostbyaddr_r +configure:3399: gcc -o conftest -g -O2 conftest.c >&5 +configure:3405: $? = 0 +configure:3422: result: yes +configure:3431: checking for gethostbyname_r +configure:3487: gcc -o conftest -g -O2 conftest.c >&5 +configure:3493: $? = 0 +configure:3510: result: yes +configure:3519: checking for poll +configure:3575: gcc -o conftest -g -O2 conftest.c >&5 +configure:3581: $? = 0 +configure:3598: result: yes +configure:3607: checking for fcntl +configure:3663: gcc -o conftest -g -O2 conftest.c >&5 +configure:3669: $? = 0 +configure:3686: result: yes +configure:3695: checking for inet_pton +configure:3751: gcc -o conftest -g -O2 conftest.c >&5 +configure:3757: $? = 0 +configure:3774: result: yes +configure:3783: checking for inet_ntop +configure:3839: gcc -o conftest -g -O2 conftest.c >&5 +configure:3845: $? = 0 +configure:3862: result: yes +configure:3872: checking for struct msghdr.msg_flags +configure:3901: gcc -c -g -O2 conftest.c >&5 +configure:3907: $? = 0 +configure:3965: result: yes +configure:3975: checking for socklen_t +configure:4008: gcc -c -g -O2 conftest.c >&5 +configure:4014: $? = 0 +configure:4029: result: yes +configure:4044: checking how to run the C preprocessor +configure:4084: gcc -E conftest.c +configure:4090: $? = 0 +configure:4121: gcc -E conftest.c +conftest.c:18:28: error: ac_nonexistent.h: No such file or directory +configure:4127: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| #define PACKAGE_NAME "libenet" +| #define PACKAGE_TARNAME "libenet" +| #define PACKAGE_VERSION "10-12-2007" +| #define PACKAGE_STRING "libenet 10-12-2007" +| #define PACKAGE_BUGREPORT "" +| #define PACKAGE "libenet.a" +| #define VERSION "10-12-2007" +| #define HAS_GETHOSTBYADDR_R 1 +| #define HAS_GETHOSTBYNAME_R 1 +| #define HAS_POLL 1 +| #define HAS_FCNTL 1 +| #define HAS_INET_PTON 1 +| #define HAS_INET_NTOP 1 +| #define HAS_MSGHDR_FLAGS 1 +| #define HAS_SOCKLEN_T 1 +| /* end confdefs.h. */ +| #include +configure:4160: result: gcc -E +configure:4189: gcc -E conftest.c +configure:4195: $? = 0 +configure:4226: gcc -E conftest.c +conftest.c:18:28: error: ac_nonexistent.h: No such file or directory +configure:4232: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| #define PACKAGE_NAME "libenet" +| #define PACKAGE_TARNAME "libenet" +| #define PACKAGE_VERSION "10-12-2007" +| #define PACKAGE_STRING "libenet 10-12-2007" +| #define PACKAGE_BUGREPORT "" +| #define PACKAGE "libenet.a" +| #define VERSION "10-12-2007" +| #define HAS_GETHOSTBYADDR_R 1 +| #define HAS_GETHOSTBYNAME_R 1 +| #define HAS_POLL 1 +| #define HAS_FCNTL 1 +| #define HAS_INET_PTON 1 +| #define HAS_INET_NTOP 1 +| #define HAS_MSGHDR_FLAGS 1 +| #define HAS_SOCKLEN_T 1 +| /* end confdefs.h. */ +| #include +configure:4270: checking for grep that handles long lines and -e +configure:4344: result: /bin/grep +configure:4349: checking for egrep +configure:4427: result: /bin/grep -E +conftest.c:18:20: error: socket.h: No such file or directory +configure:4469: checking whether to use CRC32 +configure:4485: result: no +configure:4636: creating ./config.status + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_c_compiler_gnu=yes +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_LIBS_set= +ac_cv_env_LIBS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_func_fcntl=yes +ac_cv_func_gethostbyaddr_r=yes +ac_cv_func_gethostbyname_r=yes +ac_cv_func_inet_ntop=yes +ac_cv_func_inet_pton=yes +ac_cv_func_poll=yes +ac_cv_member_struct_msghdr_msg_flags=yes +ac_cv_objext=o +ac_cv_path_EGREP='/bin/grep -E' +ac_cv_path_GREP=/bin/grep +ac_cv_path_install='/usr/bin/install -c' +ac_cv_prog_AWK=mawk +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_ac_ct_RANLIB=ranlib +ac_cv_prog_cc_c89= +ac_cv_prog_cc_g=yes +ac_cv_prog_make_make_set=yes +ac_cv_type_socklen_t=yes +am_cv_CC_dependencies_compiler_type=gcc3 + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +ACLOCAL='${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run aclocal-1.9' +AMDEPBACKSLASH='\' +AMDEP_FALSE='#' +AMDEP_TRUE='' +AMTAR='${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run tar' +AUTOCONF='${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run autoconf' +AUTOHEADER='${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run autoheader' +AUTOMAKE='${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run automake-1.9' +AWK='mawk' +CC='gcc' +CCDEPMODE='depmode=gcc3' +CFLAGS='-g -O2' +CPP='gcc -E' +CPPFLAGS='' +CYGPATH_W='echo' +DEFS='-DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"10-12-2007\" -DPACKAGE_STRING=\"libenet\ 10-12-2007\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"10-12-2007\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1' +DEPDIR='.deps' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='/bin/grep -E' +EXEEXT='' +GREP='/bin/grep' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' +LDFLAGS='' +LIBOBJS='' +LIBS='' +LTLIBOBJS='' +MAKEINFO='${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run makeinfo' +OBJEXT='o' +PACKAGE='libenet.a' +PACKAGE_BUGREPORT='' +PACKAGE_NAME='libenet' +PACKAGE_STRING='libenet 10-12-2007' +PACKAGE_TARNAME='libenet' +PACKAGE_VERSION='10-12-2007' +PATH_SEPARATOR=':' +RANLIB='ranlib' +SET_MAKE='' +SHELL='/bin/bash' +STRIP='' +VERSION='10-12-2007' +ac_ct_CC='gcc' +am__fastdepCC_FALSE='#' +am__fastdepCC_TRUE='' +am__include='include' +am__leading_dot='.' +am__quote='' +am__tar='${AMTAR} chof - "$$tardir"' +am__untar='${AMTAR} xf -' +bindir='${exec_prefix}/bin' +build_alias='' +datadir='${datarootdir}' +datarootdir='${prefix}/share' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +dvidir='${docdir}' +exec_prefix='${prefix}' +host_alias='' +htmldir='${docdir}' +includedir='${prefix}/include' +infodir='${datarootdir}/info' +install_sh='/home/mike/Games/sauerbraten/src/enet/install-sh' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localedir='${datarootdir}/locale' +localstatedir='${prefix}/var' +mandir='${datarootdir}/man' +mkdir_p='mkdir -p --' +oldincludedir='/usr/include' +pdfdir='${docdir}' +prefix='/usr/local' +program_transform_name='s,x,x,' +psdir='${docdir}' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +#define PACKAGE_NAME "libenet" +#define PACKAGE_TARNAME "libenet" +#define PACKAGE_VERSION "10-12-2007" +#define PACKAGE_STRING "libenet 10-12-2007" +#define PACKAGE_BUGREPORT "" +#define PACKAGE "libenet.a" +#define VERSION "10-12-2007" +#define HAS_GETHOSTBYADDR_R 1 +#define HAS_GETHOSTBYNAME_R 1 +#define HAS_POLL 1 +#define HAS_FCNTL 1 +#define HAS_INET_PTON 1 +#define HAS_INET_NTOP 1 +#define HAS_MSGHDR_FLAGS 1 +#define HAS_SOCKLEN_T 1 + +configure: exit 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by libenet config.status 10-12-2007, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on segfault + +config.status:619: creating Makefile +config.status:619: creating include/Makefile +config.status:619: creating include/enet/Makefile +config.status:804: executing depfiles commands diff --git a/src/enet/config.status b/src/enet/config.status new file mode 100755 index 0000000..d818522 --- /dev/null +++ b/src/enet/config.status @@ -0,0 +1,939 @@ +#! /bin/bash +# Generated by configure. +# 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-/bin/bash} +## --------------------- ## +## 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=: + # 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 + + + + +# PATH needs CR +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +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 + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 +fi +echo >conf$$.file +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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 + +# 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 libenet $as_me 10-12-2007, which was +generated by GNU Autoconf 2.61. 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` +" + +# Files that config.status was made for. +config_files=" Makefile include/Makefile include/enet/Makefile" +config_commands=" depfiles" + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet 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 + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to ." + +ac_cs_version="\ +libenet config.status 10-12-2007 +configured by ./configure, generated by GNU Autoconf 2.61, + with options \"\" + +Copyright (C) 2006 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='/home/mike/Games/sauerbraten/src/enet' +srcdir='.' +INSTALL='/usr/bin/install -c' +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +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=$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 ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + 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. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$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 + +if $ac_cs_recheck; then + echo "running CONFIG_SHELL=/bin/bash /bin/bash ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=/bin/bash + export CONFIG_SHELL + exec /bin/bash "./configure" $ac_configure_extra_args --no-create --no-recursion +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +# +# INIT-COMMANDS +# +AMDEP_TRUE="" ac_aux_dir="." + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/enet/Makefile") CONFIG_FILES="$CONFIG_FILES include/enet/Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + 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_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= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +cat >"$tmp/subs-1.sed" <<\CEOF +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +s,@SHELL@,|#_!!_#|/bin/bash,g +s,@PATH_SEPARATOR@,|#_!!_#|:,g +s,@PACKAGE_NAME@,|#_!!_#|libenet,g +s,@PACKAGE_TARNAME@,|#_!!_#|libenet,g +s,@PACKAGE_VERSION@,|#_!!_#|10-12-2007,g +s,@PACKAGE_STRING@,|#_!!_#|libenet 10-12-2007,g +s,@PACKAGE_BUGREPORT@,|#_!!_#|,g +s,@exec_prefix@,|#_!!_#|${prefix},g +s,@prefix@,|#_!!_#|/usr/local,g +s,@program_transform_name@,|#_!!_#|s\,x\,x\,,g +s,@bindir@,|#_!!_#|${exec_prefix}/bin,g +s,@sbindir@,|#_!!_#|${exec_prefix}/sbin,g +s,@libexecdir@,|#_!!_#|${exec_prefix}/libexec,g +s,@datarootdir@,|#_!!_#|${prefix}/share,g +s,@datadir@,|#_!!_#|${datarootdir},g +s,@sysconfdir@,|#_!!_#|${prefix}/etc,g +s,@sharedstatedir@,|#_!!_#|${prefix}/com,g +s,@localstatedir@,|#_!!_#|${prefix}/var,g +s,@includedir@,|#_!!_#|${prefix}/include,g +s,@oldincludedir@,|#_!!_#|/usr/include,g +s,@docdir@,|#_!!_#|${datarootdir}/doc/${PACKAGE_TARNAME},g +s,@infodir@,|#_!!_#|${datarootdir}/info,g +s,@htmldir@,|#_!!_#|${docdir},g +s,@dvidir@,|#_!!_#|${docdir},g +s,@pdfdir@,|#_!!_#|${docdir},g +s,@psdir@,|#_!!_#|${docdir},g +s,@libdir@,|#_!!_#|${exec_prefix}/lib,g +s,@localedir@,|#_!!_#|${datarootdir}/locale,g +s,@mandir@,|#_!!_#|${datarootdir}/man,g +s,@DEFS@,|#_!!_#|-DPACKAGE_NAME=\\"libenet\\" -DPACKAGE_TARNAME=\\"libenet\\" -DPACKAGE_VERSION=\\"10-12-2007\\" -DPACKAGE_STRING=\\"libenet\\ 10-12-2007\\" -DPACKAGE_BUGREPORT=\\"\\" -DPACKAGE=\\"libenet.a\\" -DVERSION=\\"10-12-2007\\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1,g +s,@ECHO_C@,|#_!!_#|,g +s,@ECHO_N@,|#_!!_#|-n,g +s,@ECHO_T@,|#_!!_#|,g +s,@LIBS@,|#_!!_#|,g +s,@build_alias@,|#_!!_#|,g +s,@host_alias@,|#_!!_#|,g +s,@target_alias@,|#_!!_#|,g +s,@INSTALL_PROGRAM@,|#_!!_#|${INSTALL},g +s,@INSTALL_SCRIPT@,|#_!!_#|${INSTALL},g +s,@INSTALL_DATA@,|#_!!_#|${INSTALL} -m 644,g +s,@CYGPATH_W@,|#_!!_#|echo,g +s,@PACKAGE@,|#_!!_#|libenet.a,g +s,@VERSION@,|#_!!_#|10-12-2007,g +s,@ACLOCAL@,|#_!!_#|${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run aclocal-1.9,g +s,@AUTOCONF@,|#_!!_#|${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run autoconf,g +s,@AUTOMAKE@,|#_!!_#|${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run automake-1.9,g +s,@AUTOHEADER@,|#_!!_#|${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run autoheader,g +s,@MAKEINFO@,|#_!!_#|${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run makeinfo,g +s,@install_sh@,|#_!!_#|/home/mike/Games/sauerbraten/src/enet/install-sh,g +s,@STRIP@,|#_!!_#|,g +s,@INSTALL_STRIP_PROGRAM@,|#_!!_#|${SHELL} $(install_sh) -c -s,g +s,@mkdir_p@,|#_!!_#|mkdir -p --,g +s,@AWK@,|#_!!_#|mawk,g +s,@SET_MAKE@,|#_!!_#|,g +s,@am__leading_dot@,|#_!!_#|.,g +s,@AMTAR@,|#_!!_#|${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run tar,g +s,@am__tar@,|#_!!_#|${AMTAR} chof - "$$tardir",g +s,@am__untar@,|#_!!_#|${AMTAR} xf -,g +s,@CC@,|#_!!_#|gcc,g +s,@CFLAGS@,|#_!!_#|-g -O2,g +s,@LDFLAGS@,|#_!!_#|,g +s,@CPPFLAGS@,|#_!!_#|,g +s,@ac_ct_CC@,|#_!!_#|gcc,g +s,@EXEEXT@,|#_!!_#|,g +s,@OBJEXT@,|#_!!_#|o,g +s,@DEPDIR@,|#_!!_#|.deps,g +s,@am__include@,|#_!!_#|include,g +s,@am__quote@,|#_!!_#|,g +s,@AMDEP_TRUE@,|#_!!_#|,g +s,@AMDEP_FALSE@,|#_!!_#|#,g +s,@AMDEPBACKSLASH@,|#_!!_#|\\,g +s,@CCDEPMODE@,|#_!!_#|depmode=gcc3,g +s,@am__fastdepCC_TRUE@,|#_!!_#|,g +s,@am__fastdepCC_FALSE@,|#_!!_#|#,g +s,@RANLIB@,|#_!!_#|ranlib,g +s,@CPP@,|#_!!_#|gcc -E,g +s,@GREP@,|#_!!_#|/bin/grep,g +s,@EGREP@,|#_!!_#|/bin/grep -E,g +s,@LIBOBJS@,|#_!!_#|,g +s,@LTLIBOBJS@,|#_!!_#|,g +:end +s/|#_!!_#|//g +CEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[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="$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 || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$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 "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + 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 || +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" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`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 || +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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`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 +# 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= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac + sed "/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;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 +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +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 "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 +echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`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 || +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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } diff --git a/src/enet/config.sub b/src/enet/config.sub new file mode 100755 index 0000000..ac6de98 --- /dev/null +++ b/src/enet/config.sub @@ -0,0 +1,1552 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +timestamp='2004-06-24' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# 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 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. + +# 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. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# 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. + +# 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 + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -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 (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +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 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # 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 0;; + + * ) + 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-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + 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) + os= + basic_machine=$1 + ;; + -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 + ;; + -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/'` + ;; + -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*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -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 \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # 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-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | msp430-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # 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-unknown + 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 + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + 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 + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + 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 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + 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 + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + 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 + ;; + i386-vsta | 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 + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + 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 + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + 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 + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + 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 + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + 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) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + 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 | ppc64-le | powerpc64-little) + 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 + ;; + 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 + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | 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 + ;; + 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 + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + 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 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + 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 + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + 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. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First 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* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -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* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) + # 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 | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -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 + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -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 + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -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 + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + 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 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + 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 + ;; + *-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 + ;; + *-next) + os=-nextstep3 + ;; + *-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 + ;; + -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 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/enet/configure b/src/enet/configure new file mode 100755 index 0000000..908b6ad --- /dev/null +++ b/src/enet/configure @@ -0,0 +1,5691 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.61 for libenet 10-12-2007. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 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=: + # 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 + + + + +# PATH needs CR +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +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 + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +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 + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +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 + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 +fi +echo >conf$$.file +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, 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= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='libenet' +PACKAGE_TARNAME='libenet' +PACKAGE_VERSION='10-12-2007' +PACKAGE_STRING='libenet 10-12-2007' +PACKAGE_BUGREPORT='' + +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +CYGPATH_W +PACKAGE +VERSION +ACLOCAL +AUTOCONF +AUTOMAKE +AUTOHEADER +MAKEINFO +install_sh +STRIP +INSTALL_STRIP_PROGRAM +mkdir_p +AWK +SET_MAKE +am__leading_dot +AMTAR +am__tar +am__untar +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +DEPDIR +am__include +am__quote +AMDEP_TRUE +AMDEP_FALSE +AMDEPBACKSLASH +CCDEPMODE +am__fastdepCC_TRUE +am__fastdepCC_FALSE +RANLIB +CPP +GREP +EGREP +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# 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' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +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=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_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=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_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$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 ;; + + -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=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 ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + 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'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +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 +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +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 + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + 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 .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# 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 -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + 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 .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + 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 libenet 10-12-2007 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] + --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/libenet] + --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 +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libenet 10-12-2007:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-crc32 enable CRC32 packet verification + +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 C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_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" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`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 + 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 +libenet configure 10-12-2007 +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 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 +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 libenet $as_me 10-12-2007, which was +generated by GNU Autoconf 2.61. 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=. + 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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$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 + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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 + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + 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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_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 + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + 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'; { (exit 1); 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 + +# 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 + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + 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. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +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,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +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 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`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. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +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 + + +am__api_version="1.9" +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 + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +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. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +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 +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$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' + +{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# 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 ( + 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 + rm -f conftest.file + 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". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +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 $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm -f conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&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 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + SET_MAKE= +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +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=libenet.a + VERSION=10-12-2007 + + +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"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# 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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out 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. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 | *.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 + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +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 +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$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 +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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" + 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +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) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +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 +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6; } +rm -f confinc confmf + +# 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='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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'. + 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 + 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 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + 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 + ;; + none) break ;; + esac + # 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. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} 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 +{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$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 + + +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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + +{ echo "$as_me:$LINENO: checking for gethostbyaddr_r" >&5 +echo $ECHO_N "checking for gethostbyaddr_r... $ECHO_C" >&6; } +if test "${ac_cv_func_gethostbyaddr_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define gethostbyaddr_r to an innocuous variant, in case declares gethostbyaddr_r. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyaddr_r innocuous_gethostbyaddr_r + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyaddr_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyaddr_r + +/* 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 gethostbyaddr_r (); +/* 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_gethostbyaddr_r || defined __stub___gethostbyaddr_r +choke me +#endif + +int +main () +{ +return gethostbyaddr_r (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_gethostbyaddr_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_gethostbyaddr_r=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyaddr_r" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyaddr_r" >&6; } +if test $ac_cv_func_gethostbyaddr_r = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAS_GETHOSTBYADDR_R 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 +echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6; } +if test "${ac_cv_func_gethostbyname_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define gethostbyname_r to an innocuous variant, in case declares gethostbyname_r. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname_r innocuous_gethostbyname_r + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyname_r + +/* 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 gethostbyname_r (); +/* 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_gethostbyname_r || defined __stub___gethostbyname_r +choke me +#endif + +int +main () +{ +return gethostbyname_r (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_gethostbyname_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_gethostbyname_r=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname_r" >&6; } +if test $ac_cv_func_gethostbyname_r = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAS_GETHOSTBYNAME_R 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for poll" >&5 +echo $ECHO_N "checking for poll... $ECHO_C" >&6; } +if test "${ac_cv_func_poll+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define poll to an innocuous variant, in case declares poll. + For example, HP-UX 11i declares gettimeofday. */ +#define poll innocuous_poll + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char poll (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef poll + +/* 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 poll (); +/* 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_poll || defined __stub___poll +choke me +#endif + +int +main () +{ +return poll (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_poll=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_poll=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_poll" >&5 +echo "${ECHO_T}$ac_cv_func_poll" >&6; } +if test $ac_cv_func_poll = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAS_POLL 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for fcntl" >&5 +echo $ECHO_N "checking for fcntl... $ECHO_C" >&6; } +if test "${ac_cv_func_fcntl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define fcntl to an innocuous variant, in case declares fcntl. + For example, HP-UX 11i declares gettimeofday. */ +#define fcntl innocuous_fcntl + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char fcntl (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef fcntl + +/* 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 fcntl (); +/* 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_fcntl || defined __stub___fcntl +choke me +#endif + +int +main () +{ +return fcntl (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_fcntl=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_fcntl=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_fcntl" >&5 +echo "${ECHO_T}$ac_cv_func_fcntl" >&6; } +if test $ac_cv_func_fcntl = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAS_FCNTL 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for inet_pton" >&5 +echo $ECHO_N "checking for inet_pton... $ECHO_C" >&6; } +if test "${ac_cv_func_inet_pton+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define inet_pton to an innocuous variant, in case declares inet_pton. + For example, HP-UX 11i declares gettimeofday. */ +#define inet_pton innocuous_inet_pton + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char inet_pton (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef inet_pton + +/* 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 inet_pton (); +/* 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_inet_pton || defined __stub___inet_pton +choke me +#endif + +int +main () +{ +return inet_pton (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_inet_pton=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_inet_pton=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_inet_pton" >&5 +echo "${ECHO_T}$ac_cv_func_inet_pton" >&6; } +if test $ac_cv_func_inet_pton = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAS_INET_PTON 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for inet_ntop" >&5 +echo $ECHO_N "checking for inet_ntop... $ECHO_C" >&6; } +if test "${ac_cv_func_inet_ntop+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define inet_ntop to an innocuous variant, in case declares inet_ntop. + For example, HP-UX 11i declares gettimeofday. */ +#define inet_ntop innocuous_inet_ntop + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char inet_ntop (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef inet_ntop + +/* 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 inet_ntop (); +/* 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_inet_ntop || defined __stub___inet_ntop +choke me +#endif + +int +main () +{ +return inet_ntop (); + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_inet_ntop=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_inet_ntop=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_inet_ntop" >&5 +echo "${ECHO_T}$ac_cv_func_inet_ntop" >&6; } +if test $ac_cv_func_inet_ntop = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAS_INET_NTOP 1 +_ACEOF + +fi + + +{ echo "$as_me:$LINENO: checking for struct msghdr.msg_flags" >&5 +echo $ECHO_N "checking for struct msghdr.msg_flags... $ECHO_C" >&6; } +if test "${ac_cv_member_struct_msghdr_msg_flags+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +static struct msghdr ac_aggr; +if (ac_aggr.msg_flags) +return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_member_struct_msghdr_msg_flags=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +static struct msghdr ac_aggr; +if (sizeof ac_aggr.msg_flags) +return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_member_struct_msghdr_msg_flags=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_member_struct_msghdr_msg_flags=no +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 +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_msghdr_msg_flags" >&5 +echo "${ECHO_T}$ac_cv_member_struct_msghdr_msg_flags" >&6; } +if test $ac_cv_member_struct_msghdr_msg_flags = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAS_MSGHDR_FLAGS 1 +_ACEOF + +fi + + +{ echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; } +if test "${ac_cv_type_socklen_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + #include + + +typedef socklen_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_socklen_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_socklen_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 +echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; } +if test $ac_cv_type_socklen_t = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAS_SOCKLEN_T 1 +_ACEOF + +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 +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f 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 +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +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 + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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" + { test -f "$ac_path_GREP" && $as_test_x "$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 + echo $ECHO_N "0123456789$ECHO_C" >"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" + "$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 + ac_count=`expr $ac_count + 1` + 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 + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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" + { test -f "$ac_path_EGREP" && $as_test_x "$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 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + 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 + ac_count=`expr $ac_count + 1` + 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 + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "MSG_MAXIOVLEN" >/dev/null 2>&1; then + cat >>confdefs.h <<\_ACEOF +#define ENET_BUFFER_MAXIMUM MSG_MAXIOVLEN +_ACEOF + +fi +rm -f conftest* + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "MSG_MAXIOVLEN" >/dev/null 2>&1; then + cat >>confdefs.h <<\_ACEOF +#define ENET_BUFFER_MAXIMUM MSG_MAXIOVLEN +_ACEOF + +fi +rm -f conftest* + + +{ echo "$as_me:$LINENO: checking whether to use CRC32" >&5 +echo $ECHO_N "checking whether to use CRC32... $ECHO_C" >&6; } +# Check whether --enable-crc32 was given. +if test "${enable_crc32+set}" = set; then + enableval=$enable_crc32; if test "$enableval" = yes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + cat >>confdefs.h <<\_ACEOF +#define USE_CRC32 1 +_ACEOF + + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + fi +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +ac_config_files="$ac_config_files Makefile include/Makefile include/enet/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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_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 + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +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}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.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=`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. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $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} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## 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=: + # 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 + + + + +# PATH needs CR +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +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 + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 +fi +echo >conf$$.file +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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 + +# 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 libenet $as_me 10-12-2007, which was +generated by GNU Autoconf 2.61. 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 + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet 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 + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +libenet config.status 10-12-2007 +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 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' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +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=$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 ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + 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. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$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 +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/enet/Makefile") CONFIG_FILES="$CONFIG_FILES include/enet/Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + 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_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= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +CYGPATH_W!$CYGPATH_W$ac_delim +PACKAGE!$PACKAGE$ac_delim +VERSION!$VERSION$ac_delim +ACLOCAL!$ACLOCAL$ac_delim +AUTOCONF!$AUTOCONF$ac_delim +AUTOMAKE!$AUTOMAKE$ac_delim +AUTOHEADER!$AUTOHEADER$ac_delim +MAKEINFO!$MAKEINFO$ac_delim +install_sh!$install_sh$ac_delim +STRIP!$STRIP$ac_delim +INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim +mkdir_p!$mkdir_p$ac_delim +AWK!$AWK$ac_delim +SET_MAKE!$SET_MAKE$ac_delim +am__leading_dot!$am__leading_dot$ac_delim +AMTAR!$AMTAR$ac_delim +am__tar!$am__tar$ac_delim +am__untar!$am__untar$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +DEPDIR!$DEPDIR$ac_delim +am__include!$am__include$ac_delim +am__quote!$am__quote$ac_delim +AMDEP_TRUE!$AMDEP_TRUE$ac_delim +AMDEP_FALSE!$AMDEP_FALSE$ac_delim +AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim +CCDEPMODE!$CCDEPMODE$ac_delim +am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim +am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim +RANLIB!$RANLIB$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ 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[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[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="$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 || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$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 "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + 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 || +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" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`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 || +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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`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 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# 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= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + 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 + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;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 +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +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 "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 +echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`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 || +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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# 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 || { (exit 1); exit 1; } +fi + + diff --git a/src/enet/configure.in b/src/enet/configure.in new file mode 100644 index 0000000..178a623 --- /dev/null +++ b/src/enet/configure.in @@ -0,0 +1,36 @@ +AC_INIT(libenet, 10-12-2007) +AM_INIT_AUTOMAKE(libenet.a, 10-12-2007) + +AC_PROG_CC +AC_PROG_RANLIB + +AC_CHECK_FUNC(gethostbyaddr_r, [AC_DEFINE(HAS_GETHOSTBYADDR_R)]) +AC_CHECK_FUNC(gethostbyname_r, [AC_DEFINE(HAS_GETHOSTBYNAME_R)]) +AC_CHECK_FUNC(poll, [AC_DEFINE(HAS_POLL)]) +AC_CHECK_FUNC(fcntl, [AC_DEFINE(HAS_FCNTL)]) +AC_CHECK_FUNC(inet_pton, [AC_DEFINE(HAS_INET_PTON)]) +AC_CHECK_FUNC(inet_ntop, [AC_DEFINE(HAS_INET_NTOP)]) + +AC_CHECK_MEMBER(struct msghdr.msg_flags, [AC_DEFINE(HAS_MSGHDR_FLAGS)], , [#include ]) + +AC_CHECK_TYPE(socklen_t, [AC_DEFINE(HAS_SOCKLEN_T)], , + #include + #include +) + +AC_EGREP_HEADER(MSG_MAXIOVLEN, /usr/include/sys/socket.h, AC_DEFINE(ENET_BUFFER_MAXIMUM, [MSG_MAXIOVLEN])) +AC_EGREP_HEADER(MSG_MAXIOVLEN, socket.h, AC_DEFINE(ENET_BUFFER_MAXIMUM, [MSG_MAXIOVLEN])) + +AC_MSG_CHECKING(whether to use CRC32) +AC_ARG_ENABLE(crc32, + [ --enable-crc32 enable CRC32 packet verification ], + [if test "$enableval" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(USE_CRC32) + else + AC_MSG_RESULT(no) + fi], + [AC_MSG_RESULT(no)]) + +AC_OUTPUT([Makefile include/Makefile include/enet/Makefile]) + diff --git a/src/enet/depcomp b/src/enet/depcomp new file mode 100755 index 0000000..11e2d3b --- /dev/null +++ b/src/enet/depcomp @@ -0,0 +1,522 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2004-05-31.23 + +# Copyright (C) 1999, 2000, 2003, 2004 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# 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 outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit 0 + ;; +esac + +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" + +# 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 + +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. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## 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). +## - 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 -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## 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. + tr ' ' ' +' < "$tmpdepfile" | +## 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. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -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 -eq 0; then : + else + 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 ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +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. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + 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" + ;; + +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. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # Dependencies are output in .lo.d with libtool 1.4. + # With libtool 1.5 they are output both in $dir.libs/$base.o.d + # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the + # latter, because the former will be cleaned when $dir.libs is + # erased. + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir$base.o.d" + tmpdepfile3="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + tmpdepfile3="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + elif test -f "$tmpdepfile2"; then + tmpdepfile="$tmpdepfile2" + else + tmpdepfile="$tmpdepfile3" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#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 $1 != '--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:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + 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 $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + 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. + -*|$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" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + 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 $1 != '--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 '/^# [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, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/src/enet/design.txt b/src/enet/design.txt new file mode 100644 index 0000000..9a88dba --- /dev/null +++ b/src/enet/design.txt @@ -0,0 +1,117 @@ +* Why ENet? + + ENet evolved specifically as a UDP networking layer for the multiplayer +first person shooter Cube. Cube necessitated low latency communcation with +data sent out very frequently, so TCP was an unsuitable choice due to its +high latency and stream orientation. UDP, however, lacks many sometimes +necessary features from TCP such as reliability, sequencing, unrestricted +packet sizes, and connection management. So UDP by itself was not suitable +as a network protocol either. No suitable freely available networking +libraries existed at the time of ENet's creation to fill this niche. + + UDP and TCP could have been used together in Cube to benefit somewhat +from both of their features, however, the resulting combinations of protocols +still leaves much to be desired. TCP lacks multiple streams of communication +without resorting to opening many sockets and complicates delineation of +packets due to its buffering behavior. UDP lacks sequencing, connection +management, management of bandwidth resources, and imposes limitations on +the size of packets. A significant investment is required to integrate these +two protocols, and the end result is worse off in features and performance +than the uniform protocol presented by ENet. + + ENet thus attempts to address these issues and provide a single, uniform +protocol layered over UDP to the developer with the best features of UDP and +TCP as well as some useful features neither provide, with a much cleaner +integration than any resulting from a mixture of UDP and TCP. + +* Connection management + + ENet provides a simple connection interface over which to communicate +with a foreign host. The liveness of the connection is actively monitored +by pinging the foreign host at frequent intervals, and also monitors the +network conditions from the local host to the foreign host such as the +mean round trip time and packet loss in this fashion. + +* Sequencing + + Rather than a single byte stream that complicates the delineation +of packets, ENet presents connections as multiple, properly sequenced packet +streams that simplify the transfer of various types of data. + + ENet provides sequencing for all packets by assigning to each sent +packet a sequence number that is incremented as packets are sent. ENet +guarentees that no packet with a higher sequence number will be delivered +before a packet with a lower sequence number, thus ensuring packets are +delivered exactly in the order they are sent. + + For unreliable packets, ENet will simply discard the lower sequence +number packet if a packet with a higher sequence number has already been +delivered. This allows the packets to be dispatched immediately as they +arrive, and reduce latency of unreliable packets to an absolute minimum. +For reliable packets, if a higher sequence number packet arrives, but the +preceding packets in the sequence have not yet arrived, ENet will stall +delivery of the higher sequence number packets until its predecessors +have arrived. + +* Channels + + Since ENet will stall delivery of reliable packets to ensure proper +sequencing, and consequently any packets of higher sequence number whether +reliable or unreliable, in the event the reliable packet's predecessors +have not yet arrived, this can introduce latency into the delivery of other +packets which may not need to be as strictly ordered with respect to the +packet that stalled their delivery. + + To combat this latency and reduce the ordering restrictions on packets, +ENet provides multiple channels of communication over a given connection. +Each channel is independently sequenced, and so the delivery status of +a packet in one channel will not stall the delivery of other packets +in another channel. + +* Reliability + + ENet provides optional reliability of packet delivery by ensuring the +foreign host acknowledges receipt of all reliable packets. ENet will attempt +to resend the packet up to a reasonable amount of times, if no acknowledgement +of the packet's receipt happens within a specified timeout. Retry timeouts +are progressive and become more lenient with every failed attempt to allow +for temporary turbulence in network conditions. + +* Fragmentation and reassembly + + ENet will send and deliver packets regardless of size. Large packets are +fragmented into many smaller packets of suitable size, and reassembled on +the foreign host to recover the original packet for delivery. The process +is entirely transparent to the developer. + +* Aggregation + + ENet aggregates all protocol commands, including acknowledgements and +packet transfer, into larger protocol packets to ensure the proper utilization +of the connection and to limit the opportunities for packet loss that might +otherwise result in further delivery latency. + +* Adaptability + + ENet provides an in-flight data window for reliable packets to ensure +connections are not overwhelmed by volumes of packets. It also provides a +static bandwidth allocation mechanism to ensure the total volume of packets +sent and received to a host don't exceed the host's capabilities. Further, +ENet also provides a dynamic throttle that responds to deviations from normal +network connections to rectify various types of network congestion by further +limiting the volume of packets sent. + +* Portability + + ENet works on Windows and any other Unix or Unix-like platform providing +a BSD sockets interface. The library has a small and stable code base that +can easily be extended to support other platforms and integrates easily. + +* Freedom + + ENet demands no royalties and doesn't carry a viral license that would +restrict you in how you might use it in your programs. ENet is licensed under +a short-and-sweet MIT-style license, which gives you the freedom to do anything +you want with it (well, almost anything). + + diff --git a/src/enet/docs/CVS/Entries b/src/enet/docs/CVS/Entries new file mode 100644 index 0000000..3753c9d --- /dev/null +++ b/src/enet/docs/CVS/Entries @@ -0,0 +1,7 @@ +/FAQ.dox/1.1/Tue Mar 7 05:56:13 2006// +/design.dox/1.1/Tue Mar 7 05:56:13 2006// +/install.dox/1.1/Tue Mar 7 05:56:13 2006// +/license.dox/1.1/Tue Mar 7 05:56:13 2006// +/mainpage.dox/1.2/Wed Mar 15 00:16:43 2006// +/tutorial.dox/1.1/Tue Mar 7 05:56:13 2006// +D diff --git a/src/enet/docs/CVS/Repository b/src/enet/docs/CVS/Repository new file mode 100644 index 0000000..81f3acd --- /dev/null +++ b/src/enet/docs/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/enet/docs diff --git a/src/enet/docs/CVS/Root b/src/enet/docs/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/enet/docs/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/enet/docs/FAQ.dox b/src/enet/docs/FAQ.dox new file mode 100755 index 0000000..484b818 --- /dev/null +++ b/src/enet/docs/FAQ.dox @@ -0,0 +1,24 @@ +/** + @page FAQ Frequently Answered Questions + +@section Q1 Is ENet thread safe? + +ENet does not use any significant global variables, the vast majority +of state is encapsulated in the ENetHost structure. As such, as long +as the application guards access to this structure, then ENet should +operate fine in a multithreaded environment. + +@section Q2 Isn't ENet just re-inventing TCP?! What's the point? + +In a perfect world, that would be true. But as many have found, using +TCP either in lieu of or in conjunction with UDP can lead to all kinds +of nightmares. TCP is a good, solid protocol, however it simply isn't +up to the task of real-time games. Too much of TCP's implementation +dictates a policy that isn't practical for games. If you want to use +TCP, then do so -- this library is for people that either don't want +to use TCP or have tried and ended up being discouraged with the +performance. + +*/ + + diff --git a/src/enet/docs/design.dox b/src/enet/docs/design.dox new file mode 100755 index 0000000..daed221 --- /dev/null +++ b/src/enet/docs/design.dox @@ -0,0 +1,126 @@ +/** +@page Features Features and Architecture + +ENet evolved specifically as a UDP networking layer for the +multiplayer first person shooter Cube. Cube necessitated low latency +communcation with data sent out very frequently, so TCP was an +unsuitable choice due to its high latency and stream orientation. UDP, +however, lacks many sometimes necessary features from TCP such as +reliability, sequencing, unrestricted packet sizes, and connection +management. So UDP by itself was not suitable as a network protocol +either. No suitable freely available networking libraries existed at +the time of ENet's creation to fill this niche. + +UDP and TCP could have been used together in Cube to benefit somewhat +from both of their features, however, the resulting combinations of +protocols still leaves much to be desired. TCP lacks multiple streams +of communication without resorting to opening many sockets and +complicates delineation of packets due to its buffering behavior. UDP +lacks sequencing, connection management, management of bandwidth +resources, and imposes limitations on the size of packets. A +significant investment is required to integrate these two protocols, +and the end result is worse off in features and performance than the +uniform protocol presented by ENet. + +ENet thus attempts to address these issues and provide a single, +uniform protocol layered over UDP to the developer with the best +features of UDP and TCP as well as some useful features neither +provide, with a much cleaner integration than any resulting from a +mixture of UDP and TCP. + +@section CM Connection Management + +ENet provides a simple connection interface over which to communicate +with a foreign host. The liveness of the connection is actively +monitored by pinging the foreign host at frequent intervals, and also +monitors the network conditions from the local host to the foreign +host such as the mean round trip time and packet loss in this fashion. + +@section Sequencing Sequencing + +Rather than a single byte stream that complicates the delineation of +packets, ENet presents connections as multiple, properly sequenced +packet streams that simplify the transfer of various types of data. + +ENet provides sequencing for all packets by assigning to each sent +packet a sequence number that is incremented as packets are sent. ENet +guarentees that no packet with a higher sequence number will be +delivered before a packet with a lower sequence number, thus ensuring +packets are delivered exactly in the order they are sent. + +For unreliable packets, ENet will simply discard the lower sequence +number packet if a packet with a higher sequence number has already +been delivered. This allows the packets to be dispatched immediately +as they arrive, and reduce latency of unreliable packets to an +absolute minimum. For reliable packets, if a higher sequence number +packet arrives, but the preceding packets in the sequence have not yet +arrived, ENet will stall delivery of the higher sequence number +packets until its predecessors have arrived. + +@section Channels Channels + +Since ENet will stall delivery of reliable packets to ensure proper +sequencing, and consequently any packets of higher sequence number +whether reliable or unreliable, in the event the reliable packet's +predecessors have not yet arrived, this can introduce latency into the +delivery of other packets which may not need to be as strictly ordered +with respect to the packet that stalled their delivery. + +To combat this latency and reduce the ordering restrictions on +packets, ENet provides multiple channels of communication over a given +connection. Each channel is independently sequenced, and so the +delivery status of a packet in one channel will not stall the delivery +of other packets in another channel. + +@section Reliability Reliability + +ENet provides optional reliability of packet delivery by ensuring the +foreign host acknowledges receipt of all reliable packets. ENet will +attempt to resend the packet up to a reasonable amount of times, if no +acknowledgement of the packet's receipt happens within a specified +timeout. Retry timeouts are progressive and become more lenient with +every failed attempt to allow for temporary turbulence in network +conditions. + +@section FaR Fragmentation and Reassembly + +ENet will send and deliver packets regardless of size. Large packets +are fragmented into many smaller packets of suitable size, and +reassembled on the foreign host to recover the original packet for +delivery. The process is entirely transparent to the developer. + +@section Aggregation Aggregation + +ENet aggregates all protocol commands, including acknowledgements and +packet transfer, into larger protocol packets to ensure the proper +utilization of the connection and to limit the opportunities for +packet loss that might otherwise result in further delivery latency. + +@section Adaptability Adaptability + +ENet provides an in-flight data window for reliable packets to ensure +connections are not overwhelmed by volumes of packets. It also +provides a static bandwidth allocation mechanism to ensure the total +volume of packets sent and received to a host don't exceed the host's +capabilities. Further, ENet also provides a dynamic throttle that +responds to deviations from normal network connections to rectify +various types of network congestion by further limiting the volume of +packets sent. + +@section Portability Portability + +ENet works on Windows and any other Unix or Unix-like platform +providing a BSD sockets interface. The library has a small and stable +code base that can easily be extended to support other platforms and +integrates easily. ENet makes no assumptions about the underlying +platform's endianess or word size. + +@section Freedom Freedom + +ENet demands no royalties and doesn't carry a viral license that would +restrict you in how you might use it in your programs. ENet is +licensed under a short-and-sweet MIT-style license, which gives you +the freedom to do anything you want with it (well, almost anything). + +*/ + diff --git a/src/enet/docs/install.dox b/src/enet/docs/install.dox new file mode 100755 index 0000000..2f0ae1b --- /dev/null +++ b/src/enet/docs/install.dox @@ -0,0 +1,37 @@ +/** +@page Installation Installation + +ENet should be trivially simple to integrate with most applications. +First, make sure you download the latest source distribution here @ref +SourceDistro. + +@section Unix Unix-like Operating Systems + +[to be completed] + +@subsection SolarisBSD Solaris and BSD + +When building ENet under Solaris, you must specify the -lsocket and +-lnsl parameters to your compiler to ensure that the sockets library +is linked in. + +@section Windows Microsoft Windows + +Using MSVC 6 under Windows simply drag all the ENet source files into +your main project or, better yet, create a new static library project +and make your executable dependent (Project|Dependencies) on ENet. +There is also an enet.dsp provided. + +You will have to link to the Winsock2 libraries, so make sure to add +ws2_32.lib to your library list (Project Settings | Link | +Object/library modules). + +@subsection DLL DLL + +If you wish to build ENet as a DLL you must first define ENET_DLL +within the project (Project Settings | C/C++ | Preprocessor | +Preprocessor definitions) or, more invasively, simply define ENET_DLL +at the top of enet.h. + +*/ + diff --git a/src/enet/docs/license.dox b/src/enet/docs/license.dox new file mode 100755 index 0000000..a72c6ea --- /dev/null +++ b/src/enet/docs/license.dox @@ -0,0 +1,26 @@ +/** + @page License License + +Copyright (c) 2002 Lee Salzman + +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 AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + diff --git a/src/enet/docs/mainpage.dox b/src/enet/docs/mainpage.dox new file mode 100755 index 0000000..813b657 --- /dev/null +++ b/src/enet/docs/mainpage.dox @@ -0,0 +1,67 @@ +/** @mainpage enet +
http://enet.bespin.org
+
+ +ENet's purpose is to provide a relatively thin, simple and robust +network communication layer on top of UDP (User Datagram Protocol). +The primary feature it provides is optional reliable, in-order +delivery of packets. + +ENet is NOT intended to be a general purpose high level networking +library that handles authentication, lobbying, server discovery, +compression, encryption and other high level, often application level +or dependent tasks. + +@ref Features + +@ref SourceDistro + +@ref Installation + +@ref Tutorial + +@ref MailingList + +@ref FAQ + +@ref License + + */ + +/** +@page SourceDistro Source Distribution + +You can retrieve the source to ENet by downloading it in either .tar.gz form +or accessing the cvs distribution directly. + +The most recent stable release (1.0) can be downloaded here. + +To access ENet via anonymous CVS, you must use the CVSROOT +:pserver:anonymous\@bespin.org:/var/lib/cvs/enet with an empty +password. + +@code + $ cvs -z3 -d :pserver:anonymous@bespin.org:/var/lib/cvs/enet login +@endcode + Hit the return key when prompted for a password. +@code + $ cvs -z3 -d :pserver:anonymous@bespin.org:/var/lib/cvs/enet co -l . + $ cvs -z3 co enet +@endcode + +This will create a CVS directory in the current directory, and with +the second command will proceed to check the enet module out of CVS. +Any problems with CVS access or request for write access should be +sent via email to @ref MailingList. + +*/ + +/** +@page MailingList ENet Mailing List + +The +enet-discuss list is for discussion of ENet, including bug reports +or feature requests. + +*/ diff --git a/src/enet/docs/tutorial.dox b/src/enet/docs/tutorial.dox new file mode 100755 index 0000000..7829d6c --- /dev/null +++ b/src/enet/docs/tutorial.dox @@ -0,0 +1,349 @@ +/** +@page Tutorial Tutorial + +@ref Initialization + +@ref CreateServer + +@ref CreateClient + +@ref ManageHost + +@ref SendingPacket + +@ref Disconnecting + +@ref Connecting + +@section Initialization Initialization + +Before using ENet, you must call enet_initialize() to initialize the +library. Upon program exit, you should call enet_deinitialize() so +that the library may clean up any used resources. + +@code +int +main (int argc, char ** argv) +{ + if (enet_initialize () != 0) + { + fprintf (stderr, "An error occurred while initializing ENet.\n"); + return EXIT_FAILURE; + } + atexit (enet_deinitialize); + ... + ... + ... +} +@endcode + +@section CreateServer Creating an ENet server + +Servers in ENet are constructed with enet_host_create(). You must +specify an address on which to receive data and new connections, as +well as the maximum allowable numbers of connected peers. You may +optionally specify the incoming and outgoing bandwidth of the server +in bytes per second so that ENet may try to statically manage +bandwidth resources among connected peers in addition to its dynamic +throttling algorithm; specifying 0 for these two options will cause +ENet to rely entirely upon its dynamic throttling algorithm to manage +bandwidth. + +When done with a host, the host may be destroyed with +enet_host_destroy(). All connected peers to the host will be reset, +and the resources used by the host will be freed. + +@code + ENetAddress address; + ENetHost * server; + + /* Bind the server to the default localhost. */ + /* A specific host address can be specified by */ + /* enet_address_set_host (& address, "x.x.x.x"); */ + + address.host = ENET_HOST_ANY; + /* Bind the server to port 1234. */ + address.port = 1234; + + server = enet_host_create (& address /* the address to bind the server host to */, + 32 /* allow up to 32 clients and/or outgoing connections */, + 0 /* assume any amount of incoming bandwidth */, + 0 /* assume any amount of outgoing bandwidth */); + if (server == NULL) + { + fprintf (stderr, + "An error occurred while trying to create an ENet server host.\n"); + exit (EXIT_FAILURE); + } + ... + ... + ... + enet_host_destroy(server); +@endcode + +@section CreateClient Creating an ENet client + +Clients in ENet are similarly constructed with enet_host_create() when +no address is specified to bind the host to. Bandwidth may be +specified for the client host as in the above example. The peer count +controls the maximum number of connections to other server hosts that +may be simultaneously open. + +@code + ENetHost * client; + + client = enet_host_create (NULL /* create a client host */, + 1 /* only allow 1 outgoing connection */, + 57600 / 8 /* 56K modem with 56 Kbps downstream bandwidth */, + 14400 / 8 /* 56K modem with 14 Kbps upstream bandwidth */); + + if (client == NULL) + { + fprintf (stderr, + "An error occurred while trying to create an ENet client host.\n"); + exit (EXIT_FAILURE); + } + ... + ... + ... + enet_host_destroy(client); +@endcode + +@section ManageHost Managing an ENet host + +ENet uses a polled event model to notify the programmer of significant +events. ENet hosts are polled for events with enet_host_service(), +where an optional timeout value in milliseconds may be specified to +control how long ENet will poll; if a timeout of 0 is specified, +enet_host_service() will return immediately if there are no events to +dispatch. enet_host_service() will return 1 if an event was dispatched +within the specified timeout. + +Currently there are only four types of significant events in ENet: + +An event of type ENET_EVENT_TYPE_NONE is returned if no event occurred +within the specified time limit. enet_host_service() will return 0 +with this event. + +An event of type ENET_EVENT_TYPE_CONNECT is returned when either a new client +host has connected to the server host or when an attempt to establish a +connection with a foreign host has succeeded. Only the "peer" field of the +event structure is valid for this event and contains the newly connected peer. + +An event of type ENET_EVENT_TYPE_RECEIVE is returned when a packet is received +from a connected peer. The "peer" field contains the peer the packet was +received from, "channelID" is the channel on which the packet was sent, and +"packet" is the packet that was sent. The packet contained in the "packet" +field must be destroyed with enet_packet_destroy() when you are done +inspecting its contents. + +An event of type ENET_EVENT_TYPE_DISCONNECT is returned when a connected peer +has either explicitly disconnected or timed out. Only the "peer" field of the +event structure is valid for this event and contains the peer that +disconnected. Only the "data" field of the peer is still valid on a +disconnect event and must be explicitly reset. + +@code + ENetEvent event; + + /* Wait up to 1000 milliseconds for an event. */ + while (enet_host_service (client, & event, 1000) > 0) + { + switch (event.type) + { + case ENET_EVENT_TYPE_CONNECT: + printf ("A new client connected from %x:%u.\n", + event.peer -> address.host, + event.peer -> address.port); + + /* Store any relevant client information here. */ + event.peer -> data = "Client information"; + + break; + + case ENET_EVENT_TYPE_RECEIVE: + printf ("A packet of length %u containing %s was received from %s on channel %u.\n", + event.packet -> dataLength, + event.packet -> data, + event.peer -> data, + event.channelID); + + /* Clean up the packet now that we're done using it. */ + enet_packet_destroy (event.packet); + + break; + + case ENET_EVENT_TYPE_DISCONNECT: + printf ("%s disconected.\n", event.peer -> data); + + /* Reset the peer's client information. */ + + event.peer -> data = NULL; + } + } + ... + ... + ... +@endcode + +@section SendingPacket Sending a packet to an ENet peer + +Packets in ENet are created with enet_packet_create(), where the size +of the packet must be specified. Optionally, initial data may be +specified to copy into the packet. + +Certain flags may also be supplied to enet_packet_create() to control +various packet features: + +ENET_PACKET_FLAG_RELIABLE specifies that the packet must use reliable +delivery. A reliable packet is guarenteed to be delivered, and a +number of retry attempts will be made until an acknowledgement is +received from the foreign host the packet is sent to. If a certain +number of retry attempts is reached without any acknowledgement, ENet +will assume the peer has disconnected and forcefully reset the +connection. If this flag is not specified, the packet is assumed an +unreliable packet, and no retry attempts will be made nor +acknowledgements generated. + +A packet may be resized (extended or truncated) with +enet_packet_resize(). + +A packet is sent to a foreign host with +enet_peer_send(). enet_peer_send() accepts a channel id over which to +send the packet to a given peer. Once the packet is handed over to +ENet with enet_peer_send(), ENet will handle its deallocation and +enet_packet_destroy() should not be used upon it. + +One may also use enet_host_broadcast() to send a packet to all +connected peers on a given host over a specified channel id, as with +enet_peer_send(). + +Queued packets will be sent on a call to enet_host_service(). +Alternatively, enet_host_flush() will send out queued packets without +dispatching any events. + +@code + /* Create a reliable packet of size 7 containing "packet\0" */ + ENetPacket * packet = enet_packet_create ("packet", + strlen ("packet") + 1, + ENET_PACKET_FLAG_RELIABLE); + + /* Extend the packet so and append the string "foo", so it now */ + /* contains "packetfoo\0" */ + enet_packet_resize (packet, strlen ("packetfoo") + 1); + strcpy (& packet -> data [strlen ("packet")], "foo"); + + /* Send the packet to the peer over channel id 0. */ + /* One could also broadcast the packet by */ + /* enet_host_broadcast (host, 0, packet); */ + enet_peer_send (peer, 0, packet); + ... + ... + ... + /* One could just use enet_host_service() instead. */ + enet_host_flush (host); +@endcode + +@section Disconnecting Disconnecting an ENet peer + +Peers may be gently disconnected with enet_peer_disconnect(). A +disconnect request will be sent to the foreign host, and ENet will +wait for an acknowledgement from the foreign host before finally +disconnecting. An event of type ENET_EVENT_TYPE_DISCONNECT will be +generated once the disconnection succeeds. Normally timeouts apply to +the disconnect acknowledgement, and so if no acknowledgement is +received after a length of time the peer will be forcefully +disconnected. + +enet_peer_reset() will forcefully disconnect a peer. The foreign host +will get no notification of a disconnect and will time out on the +foreign host. No event is generated. + +@code + ENetEvent event; + + enet_peer_disconnect (peer, 0); + + /* Allow up to 3 seconds for the disconnect to succeed + * and drop any packets received packets. + */ + while (enet_host_service (client, & event, 3000) > 0) + { + switch (event.type) + { + case ENET_EVENT_TYPE_RECEIVE: + enet_packet_destroy (event.packet); + break; + + case ENET_EVENT_TYPE_DISCONNECT: + puts ("Disconnection succeeded."); + return; + ... + ... + ... + } + } + + /* We've arrived here, so the disconnect attempt didn't */ + /* succeed yet. Force the connection down. */ + enet_peer_reset (peer); + ... + ... + ... +@endcode + +@section Connecting Connecting to an ENet host + +A connection to a foreign host is initiated with enet_host_connect(). +It accepts the address of a foreign host to connect to, and the number +of channels that should be allocated for communication. If N channels +are allocated for use, their channel ids will be numbered 0 through +N-1. A peer representing the connection attempt is returned, or NULL +if there were no available peers over which to initiate the +connection. When the connection attempt succeeds, an event of type +ENET_EVENT_TYPE_CONNECT will be generated. If the connection attempt +times out or otherwise fails, an event of type +ENET_EVENT_TYPE_DISCONNECT will be generated. + +@code + ENetAddress address; + ENetEvent event; + ENetPeer *peer; + + /* Connect to some.server.net:1234. */ + enet_address_set_host (& address, "some.server.net"); + address.port = 1234; + + /* Initiate the connection, allocating the two channels 0 and 1. */ + peer = enet_host_connect (client, & address, 2); + + if (peer == NULL) + { + fprintf (stderr, + "No available peers for initiating an ENet connection.\n"); + exit (EXIT_FAILURE); + } + + /* Wait up to 5 seconds for the connection attempt to succeed. */ + if (enet_host_service (client, & event, 5000) > 0 && + event.type == ENET_EVENT_TYPE_CONNECT) + { + puts ("Connection to some.server.net:1234 succeeded."); + ... + ... + ... + } + else + { + /* Either the 5 seconds are up or a disconnect event was */ + /* received. Reset the peer in the event the 5 seconds */ + /* had run out without any significant event. */ + enet_peer_reset (peer); + + puts ("Connection to some.server.net:1234 failed."); + } + ... + ... + ... +@endcode +*/ diff --git a/src/enet/enet.dsp b/src/enet/enet.dsp new file mode 100755 index 0000000..10a6d6c --- /dev/null +++ b/src/enet/enet.dsp @@ -0,0 +1,164 @@ +# Microsoft Developer Studio Project File - Name="enet" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=enet - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "enet.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "enet.mak" CFG="enet - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "enet - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "enet - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "enet - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +MTL=midl.exe +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /W3 /O2 /I "include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "enet - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +MTL=midl.exe +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "enet - Win32 Release" +# Name "enet - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\host.c +# End Source File +# Begin Source File + +SOURCE=.\list.c +# End Source File +# Begin Source File + +SOURCE=.\callbacks.c +# End Source File +# Begin Source File + +SOURCE=.\packet.c +# End Source File +# Begin Source File + +SOURCE=.\peer.c +# End Source File +# Begin Source File + +SOURCE=.\protocol.c +# End Source File +# Begin Source File + +SOURCE=.\unix.c +# End Source File +# Begin Source File + +SOURCE=.\win32.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\include\enet\enet.h +# End Source File +# Begin Source File + +SOURCE=.\include\enet\list.h +# End Source File +# Begin Source File + +SOURCE=.\include\enet\callbacks.h +# End Source File +# Begin Source File + +SOURCE=.\include\enet\protocol.h +# End Source File +# Begin Source File + +SOURCE=.\include\enet\time.h +# End Source File +# Begin Source File + +SOURCE=.\include\enet\types.h +# End Source File +# Begin Source File + +SOURCE=.\include\enet\unix.h +# End Source File +# Begin Source File + +SOURCE=.\include\enet\utility.h +# End Source File +# Begin Source File + +SOURCE=.\include\enet\win32.h +# End Source File +# End Group +# End Target +# End Project diff --git a/src/enet/host.c b/src/enet/host.c new file mode 100644 index 0000000..9bab1a8 --- /dev/null +++ b/src/enet/host.c @@ -0,0 +1,398 @@ +/** + @file host.c + @brief ENet host management functions +*/ +#define ENET_BUILDING_LIB 1 +#include +#include "enet/enet.h" + +/** @defgroup host ENet host functions + @{ +*/ + +/** Creates a host for communicating to peers. + + @param address the address at which other peers may connect to this host. If NULL, then no peers may connect to the host. + @param peerCount the maximum number of peers that should be allocated for the host. + @param incomingBandwidth downstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth. + @param outgoingBandwidth upstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth. + + @returns the host on success and NULL on failure + + @remarks ENet will strategically drop packets on specific sides of a connection between hosts + to ensure the host's bandwidth is not overwhelmed. The bandwidth parameters also determine + the window size of a connection which limits the amount of reliable packets that may be in transit + at any given time. +*/ +ENetHost * +enet_host_create (const ENetAddress * address, size_t peerCount, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth) +{ + ENetHost * host = (ENetHost *) enet_malloc (sizeof (ENetHost)); + ENetPeer * currentPeer; + + if (peerCount > ENET_PROTOCOL_MAXIMUM_PEER_ID) + return NULL; + + host -> peers = (ENetPeer *) enet_malloc (peerCount * sizeof (ENetPeer)); + memset (host -> peers, 0, peerCount * sizeof (ENetPeer)); + + host -> socket = enet_socket_create (ENET_SOCKET_TYPE_DATAGRAM, address); + if (host -> socket == ENET_SOCKET_NULL) + { + enet_free (host -> peers); + enet_free (host); + + return NULL; + } + + enet_socket_set_option (host -> socket, ENET_SOCKOPT_NONBLOCK, 1); + enet_socket_set_option (host -> socket, ENET_SOCKOPT_BROADCAST, 1); + enet_socket_set_option (host -> socket, ENET_SOCKOPT_RCVBUF, ENET_HOST_RECEIVE_BUFFER_SIZE); + enet_socket_set_option (host -> socket, ENET_SOCKOPT_SNDBUF, ENET_HOST_SEND_BUFFER_SIZE); + + if (address != NULL) + host -> address = * address; + + host -> incomingBandwidth = incomingBandwidth; + host -> outgoingBandwidth = outgoingBandwidth; + host -> bandwidthThrottleEpoch = 0; + host -> recalculateBandwidthLimits = 0; + host -> mtu = ENET_HOST_DEFAULT_MTU; + host -> peerCount = peerCount; + host -> lastServicedPeer = host -> peers; + host -> commandCount = 0; + host -> bufferCount = 0; + host -> receivedAddress.host = ENET_HOST_ANY; + host -> receivedAddress.port = 0; + host -> receivedDataLength = 0; + + for (currentPeer = host -> peers; + currentPeer < & host -> peers [host -> peerCount]; + ++ currentPeer) + { + currentPeer -> host = host; + currentPeer -> incomingPeerID = currentPeer - host -> peers; + currentPeer -> data = NULL; + + enet_list_clear (& currentPeer -> acknowledgements); + enet_list_clear (& currentPeer -> sentReliableCommands); + enet_list_clear (& currentPeer -> sentUnreliableCommands); + enet_list_clear (& currentPeer -> outgoingReliableCommands); + enet_list_clear (& currentPeer -> outgoingUnreliableCommands); + + enet_peer_reset (currentPeer); + } + + return host; +} + +/** Destroys the host and all resources associated with it. + @param host pointer to the host to destroy +*/ +void +enet_host_destroy (ENetHost * host) +{ + ENetPeer * currentPeer; + + enet_socket_destroy (host -> socket); + + for (currentPeer = host -> peers; + currentPeer < & host -> peers [host -> peerCount]; + ++ currentPeer) + { + enet_peer_reset (currentPeer); + } + + enet_free (host -> peers); + enet_free (host); +} + +/** Initiates a connection to a foreign host. + @param host host seeking the connection + @param address destination for the connection + @param channelCount number of channels to allocate + @returns a peer representing the foreign host on success, NULL on failure + @remarks The peer returned will have not completed the connection until enet_host_service() + notifies of an ENET_EVENT_TYPE_CONNECT event for the peer. +*/ +ENetPeer * +enet_host_connect (ENetHost * host, const ENetAddress * address, size_t channelCount) +{ + ENetPeer * currentPeer; + ENetChannel * channel; + ENetProtocol command; + + if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT) + channelCount = ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT; + else + if (channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT) + channelCount = ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT; + + for (currentPeer = host -> peers; + currentPeer < & host -> peers [host -> peerCount]; + ++ currentPeer) + { + if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED) + break; + } + + if (currentPeer >= & host -> peers [host -> peerCount]) + return NULL; + + currentPeer -> state = ENET_PEER_STATE_CONNECTING; + currentPeer -> address = * address; + currentPeer -> channels = (ENetChannel *) enet_malloc (channelCount * sizeof (ENetChannel)); + currentPeer -> channelCount = channelCount; + currentPeer -> sessionID = (enet_uint32) enet_rand (); + + if (host -> outgoingBandwidth == 0) + currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + else + currentPeer -> windowSize = (host -> outgoingBandwidth / + ENET_PEER_WINDOW_SIZE_SCALE) * + ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + + if (currentPeer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) + currentPeer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + else + if (currentPeer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) + currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + + for (channel = currentPeer -> channels; + channel < & currentPeer -> channels [channelCount]; + ++ channel) + { + channel -> outgoingReliableSequenceNumber = 0; + channel -> outgoingUnreliableSequenceNumber = 0; + channel -> incomingReliableSequenceNumber = 0; + + enet_list_clear (& channel -> incomingReliableCommands); + enet_list_clear (& channel -> incomingUnreliableCommands); + + channel -> usedReliableWindows = 0; + memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows)); + } + + command.header.command = ENET_PROTOCOL_COMMAND_CONNECT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; + command.header.channelID = 0xFF; + command.connect.outgoingPeerID = ENET_HOST_TO_NET_16 (currentPeer -> incomingPeerID); + command.connect.mtu = ENET_HOST_TO_NET_16 (currentPeer -> mtu); + command.connect.windowSize = ENET_HOST_TO_NET_32 (currentPeer -> windowSize); + command.connect.channelCount = ENET_HOST_TO_NET_32 (channelCount); + command.connect.incomingBandwidth = ENET_HOST_TO_NET_32 (host -> incomingBandwidth); + command.connect.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth); + command.connect.packetThrottleInterval = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleInterval); + command.connect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleAcceleration); + command.connect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleDeceleration); + command.connect.sessionID = currentPeer -> sessionID; + + enet_peer_queue_outgoing_command (currentPeer, & command, NULL, 0, 0); + + return currentPeer; +} + +/** Queues a packet to be sent to all peers associated with the host. + @param host host on which to broadcast the packet + @param channelID channel on which to broadcast + @param packet packet to broadcast +*/ +void +enet_host_broadcast (ENetHost * host, enet_uint8 channelID, ENetPacket * packet) +{ + ENetPeer * currentPeer; + + for (currentPeer = host -> peers; + currentPeer < & host -> peers [host -> peerCount]; + ++ currentPeer) + { + if (currentPeer -> state != ENET_PEER_STATE_CONNECTED) + continue; + + enet_peer_send (currentPeer, channelID, packet); + } + + if (packet -> referenceCount == 0) + enet_packet_destroy (packet); +} + +/** Adjusts the bandwidth limits of a host. + @param host host to adjust + @param incomingBandwidth new incoming bandwidth + @param outgoingBandwidth new outgoing bandwidth + @remarks the incoming and outgoing bandwidth parameters are identical in function to those + specified in enet_host_create(). +*/ +void +enet_host_bandwidth_limit (ENetHost * host, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth) +{ + host -> incomingBandwidth = incomingBandwidth; + host -> outgoingBandwidth = outgoingBandwidth; + host -> recalculateBandwidthLimits = 1; +} + +void +enet_host_bandwidth_throttle (ENetHost * host) +{ + enet_uint32 timeCurrent = enet_time_get (), + elapsedTime = timeCurrent - host -> bandwidthThrottleEpoch, + peersTotal = 0, + dataTotal = 0, + peersRemaining, + bandwidth, + throttle = 0, + bandwidthLimit = 0; + int needsAdjustment; + ENetPeer * peer; + ENetProtocol command; + + if (elapsedTime < ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL) + return; + + for (peer = host -> peers; + peer < & host -> peers [host -> peerCount]; + ++ peer) + { + if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) + continue; + + ++ peersTotal; + dataTotal += peer -> outgoingDataTotal; + } + + if (peersTotal == 0) + return; + + peersRemaining = peersTotal; + needsAdjustment = 1; + + if (host -> outgoingBandwidth == 0) + bandwidth = ~0; + else + bandwidth = (host -> outgoingBandwidth * elapsedTime) / 1000; + + while (peersRemaining > 0 && needsAdjustment != 0) + { + needsAdjustment = 0; + + if (dataTotal < bandwidth) + throttle = ENET_PEER_PACKET_THROTTLE_SCALE; + else + throttle = (bandwidth * ENET_PEER_PACKET_THROTTLE_SCALE) / dataTotal; + + for (peer = host -> peers; + peer < & host -> peers [host -> peerCount]; + ++ peer) + { + enet_uint32 peerBandwidth; + + if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) || + peer -> incomingBandwidth == 0 || + peer -> outgoingBandwidthThrottleEpoch == timeCurrent) + continue; + + peerBandwidth = (peer -> incomingBandwidth * elapsedTime) / 1000; + if ((throttle * peer -> outgoingDataTotal) / ENET_PEER_PACKET_THROTTLE_SCALE <= peerBandwidth) + continue; + + peer -> packetThrottleLimit = (peerBandwidth * + ENET_PEER_PACKET_THROTTLE_SCALE) / peer -> outgoingDataTotal; + + if (peer -> packetThrottleLimit == 0) + peer -> packetThrottleLimit = 1; + + if (peer -> packetThrottle > peer -> packetThrottleLimit) + peer -> packetThrottle = peer -> packetThrottleLimit; + + peer -> outgoingBandwidthThrottleEpoch = timeCurrent; + + + needsAdjustment = 1; + -- peersRemaining; + bandwidth -= peerBandwidth; + dataTotal -= peerBandwidth; + } + } + + if (peersRemaining > 0) + for (peer = host -> peers; + peer < & host -> peers [host -> peerCount]; + ++ peer) + { + if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) || + peer -> outgoingBandwidthThrottleEpoch == timeCurrent) + continue; + + peer -> packetThrottleLimit = throttle; + + if (peer -> packetThrottle > peer -> packetThrottleLimit) + peer -> packetThrottle = peer -> packetThrottleLimit; + } + + if (host -> recalculateBandwidthLimits) + { + host -> recalculateBandwidthLimits = 0; + + peersRemaining = peersTotal; + bandwidth = host -> incomingBandwidth; + needsAdjustment = 1; + + if (bandwidth == 0) + bandwidthLimit = 0; + else + while (peersRemaining > 0 && needsAdjustment != 0) + { + needsAdjustment = 0; + bandwidthLimit = bandwidth / peersRemaining; + + for (peer = host -> peers; + peer < & host -> peers [host -> peerCount]; + ++ peer) + { + if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) || + peer -> incomingBandwidthThrottleEpoch == timeCurrent) + continue; + + if (peer -> outgoingBandwidth > 0 && + peer -> outgoingBandwidth >= bandwidthLimit) + continue; + + peer -> incomingBandwidthThrottleEpoch = timeCurrent; + + needsAdjustment = 1; + -- peersRemaining; + bandwidth -= peer -> outgoingBandwidth; + } + } + + for (peer = host -> peers; + peer < & host -> peers [host -> peerCount]; + ++ peer) + { + if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) + continue; + + command.header.command = ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; + command.header.channelID = 0xFF; + command.bandwidthLimit.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth); + + if (peer -> incomingBandwidthThrottleEpoch == timeCurrent) + command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (peer -> outgoingBandwidth); + else + command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (bandwidthLimit); + + enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); + } + } + + host -> bandwidthThrottleEpoch = timeCurrent; + + for (peer = host -> peers; + peer < & host -> peers [host -> peerCount]; + ++ peer) + { + peer -> incomingDataTotal = 0; + peer -> outgoingDataTotal = 0; + } +} + +/** @} */ diff --git a/src/enet/include/CVS/Entries b/src/enet/include/CVS/Entries new file mode 100644 index 0000000..82e8dc1 --- /dev/null +++ b/src/enet/include/CVS/Entries @@ -0,0 +1,3 @@ +/Makefile.am/1.1/Tue Mar 7 05:56:13 2006// +/Makefile.in/1.2/Mon Sep 18 19:32:58 2006// +D/enet//// diff --git a/src/enet/include/CVS/Repository b/src/enet/include/CVS/Repository new file mode 100644 index 0000000..5583e4b --- /dev/null +++ b/src/enet/include/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/enet/include diff --git a/src/enet/include/CVS/Root b/src/enet/include/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/enet/include/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/enet/include/Makefile b/src/enet/include/Makefile new file mode 100644 index 0000000..732bc1a --- /dev/null +++ b/src/enet/include/Makefile @@ -0,0 +1,435 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# include/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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. + + +srcdir = . +top_srcdir = .. + +pkgdatadir = $(datadir)/libenet.a +pkglibdir = $(libdir)/libenet.a +pkgincludedir = $(includedir)/libenet.a +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +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 = : +subdir = include +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run tar +AUTOCONF = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run autoconf +AUTOHEADER = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run autoheader +AUTOMAKE = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run automake-1.9 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = +CYGPATH_W = echo +DEFS = -DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"10-12-2007\" -DPACKAGE_STRING=\"libenet\ 10-12-2007\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"10-12-2007\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1 +DEPDIR = .deps +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +GREP = /bin/grep +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBS = +LTLIBOBJS = +MAKEINFO = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run makeinfo +OBJEXT = o +PACKAGE = libenet.a +PACKAGE_BUGREPORT = +PACKAGE_NAME = libenet +PACKAGE_STRING = libenet 10-12-2007 +PACKAGE_TARNAME = libenet +PACKAGE_VERSION = 10-12-2007 +PATH_SEPARATOR = : +RANLIB = ranlib +SET_MAKE = +SHELL = /bin/bash +STRIP = +VERSION = 10-12-2007 +ac_ct_CC = gcc +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build_alias = +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host_alias = +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = /home/mike/Games/sauerbraten/src/enet/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = mkdir -p -- +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target_alias = +SUBDIRS = enet +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/Makefile +.PRECIOUS: 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__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +uninstall-info-am: + +# 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. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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; \ + (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" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + 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 || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$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 \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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 mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-recursive ctags ctags-recursive \ + distclean distclean-generic distclean-recursive distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# 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: diff --git a/src/enet/include/Makefile.am b/src/enet/include/Makefile.am new file mode 100644 index 0000000..182de41 --- /dev/null +++ b/src/enet/include/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = enet diff --git a/src/enet/include/Makefile.in b/src/enet/include/Makefile.in new file mode 100644 index 0000000..3e26043 --- /dev/null +++ b/src/enet/include/Makefile.in @@ -0,0 +1,435 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +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 = : +subdir = include +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +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_alias = @build_alias@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +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@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = enet +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/Makefile +.PRECIOUS: 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__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +uninstall-info-am: + +# 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. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; 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; \ + (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" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + 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 || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$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 \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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 mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-recursive ctags ctags-recursive \ + distclean distclean-generic distclean-recursive distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# 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: diff --git a/src/enet/include/enet/CVS/Entries b/src/enet/include/enet/CVS/Entries new file mode 100644 index 0000000..7663a61 --- /dev/null +++ b/src/enet/include/enet/CVS/Entries @@ -0,0 +1,12 @@ +/Makefile.am/1.1/Tue Mar 7 05:56:14 2006// +/Makefile.in/1.2/Mon Sep 18 19:32:58 2006// +/callbacks.h/1.1/Tue Mar 7 05:56:14 2006// +/enet.h/1.25/Fri Oct 12 23:23:14 2007// +/list.h/1.1/Tue Mar 7 05:56:14 2006// +/protocol.h/1.5/Mon Oct 30 06:30:36 2006// +/time.h/1.1/Tue Mar 7 05:56:14 2006// +/types.h/1.1/Tue Mar 7 05:56:14 2006// +/unix.h/1.1/Tue Mar 7 05:56:14 2006// +/utility.h/1.1/Tue Mar 7 05:56:14 2006// +/win32.h/1.3/Mon Mar 13 09:07:56 2006// +D diff --git a/src/enet/include/enet/CVS/Repository b/src/enet/include/enet/CVS/Repository new file mode 100644 index 0000000..adb38d3 --- /dev/null +++ b/src/enet/include/enet/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/enet/include/enet diff --git a/src/enet/include/enet/CVS/Root b/src/enet/include/enet/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/enet/include/enet/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/enet/include/enet/Makefile b/src/enet/include/enet/Makefile new file mode 100644 index 0000000..ea01068 --- /dev/null +++ b/src/enet/include/enet/Makefile @@ -0,0 +1,367 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# include/enet/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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. + + + +srcdir = . +top_srcdir = ../.. + +pkgdatadir = $(datadir)/libenet.a +pkglibdir = $(libdir)/libenet.a +pkgincludedir = $(includedir)/libenet.a +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +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 = : +subdir = include/enet +DIST_COMMON = $(libenetinclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +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 = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libenetincludedir)" +libenetincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(libenetinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run tar +AUTOCONF = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run autoconf +AUTOHEADER = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run autoheader +AUTOMAKE = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run automake-1.9 +AWK = mawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = +CYGPATH_W = echo +DEFS = -DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"10-12-2007\" -DPACKAGE_STRING=\"libenet\ 10-12-2007\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"10-12-2007\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1 +DEPDIR = .deps +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +GREP = /bin/grep +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBS = +LTLIBOBJS = +MAKEINFO = ${SHELL} /home/mike/Games/sauerbraten/src/enet/missing --run makeinfo +OBJEXT = o +PACKAGE = libenet.a +PACKAGE_BUGREPORT = +PACKAGE_NAME = libenet +PACKAGE_STRING = libenet 10-12-2007 +PACKAGE_TARNAME = libenet +PACKAGE_VERSION = 10-12-2007 +PATH_SEPARATOR = : +RANLIB = ranlib +SET_MAKE = +SHELL = /bin/bash +STRIP = +VERSION = 10-12-2007 +ac_ct_CC = gcc +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build_alias = +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host_alias = +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = /home/mike/Games/sauerbraten/src/enet/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = mkdir -p -- +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target_alias = +libenetincludedir = $(includedir)/enet +libenetinclude_HEADERS = \ + types.h \ + list.h \ + utility.h \ + time.h \ + callbacks.h \ + unix.h \ + win32.h \ + protocol.h \ + enet.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/enet/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/enet/Makefile +.PRECIOUS: 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__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +uninstall-info-am: +install-libenetincludeHEADERS: $(libenetinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(libenetincludedir)" || $(mkdir_p) "$(DESTDIR)$(libenetincludedir)" + @list='$(libenetinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(libenetincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libenetincludedir)/$$f'"; \ + $(libenetincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libenetincludedir)/$$f"; \ + done + +uninstall-libenetincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(libenetinclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(libenetincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(libenetincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$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 $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libenetincludedir)"; 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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 mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-libenetincludeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +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 + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libenetincludeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + ctags distclean distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-libenetincludeHEADERS \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + uninstall uninstall-am uninstall-info-am \ + uninstall-libenetincludeHEADERS + +# 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: diff --git a/src/enet/include/enet/Makefile.am b/src/enet/include/enet/Makefile.am new file mode 100644 index 0000000..acefcd1 --- /dev/null +++ b/src/enet/include/enet/Makefile.am @@ -0,0 +1,12 @@ +libenetincludedir = $(includedir)/enet +libenetinclude_HEADERS = \ + types.h \ + list.h \ + utility.h \ + time.h \ + callbacks.h \ + unix.h \ + win32.h \ + protocol.h \ + enet.h + diff --git a/src/enet/include/enet/Makefile.in b/src/enet/include/enet/Makefile.in new file mode 100644 index 0000000..bbec556 --- /dev/null +++ b/src/enet/include/enet/Makefile.in @@ -0,0 +1,367 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +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 = : +subdir = include/enet +DIST_COMMON = $(libenetinclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +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 = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libenetincludedir)" +libenetincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(libenetinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +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_alias = @build_alias@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +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@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +libenetincludedir = $(includedir)/enet +libenetinclude_HEADERS = \ + types.h \ + list.h \ + utility.h \ + time.h \ + callbacks.h \ + unix.h \ + win32.h \ + protocol.h \ + enet.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/enet/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/enet/Makefile +.PRECIOUS: 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__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +uninstall-info-am: +install-libenetincludeHEADERS: $(libenetinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(libenetincludedir)" || $(mkdir_p) "$(DESTDIR)$(libenetincludedir)" + @list='$(libenetinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(libenetincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libenetincludedir)/$$f'"; \ + $(libenetincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libenetincludedir)/$$f"; \ + done + +uninstall-libenetincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(libenetinclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(libenetincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(libenetincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$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 $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libenetincludedir)"; 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: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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 mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-libenetincludeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +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 + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libenetincludeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + ctags distclean distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-libenetincludeHEADERS \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + uninstall uninstall-am uninstall-info-am \ + uninstall-libenetincludeHEADERS + +# 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: diff --git a/src/enet/include/enet/callbacks.h b/src/enet/include/enet/callbacks.h new file mode 100644 index 0000000..be29ae0 --- /dev/null +++ b/src/enet/include/enet/callbacks.h @@ -0,0 +1,28 @@ +/** + @file callbacks.h + @brief ENet callbacks +*/ +#ifndef __ENET_CALLBACKS_H__ +#define __ENET_CALLBACKS_H__ + +#include + +typedef struct +{ + void * (ENET_CALLBACK * malloc) (size_t size); + void (ENET_CALLBACK * free) (void * memory); + int (ENET_CALLBACK * rand) (void); +} ENetCallbacks; + +/** @defgroup callbacks ENet internal callbacks + @{ + @ingroup private +*/ +extern void * enet_malloc (size_t); +extern void enet_free (void *); +extern int enet_rand (void); + +/** @} */ + +#endif /* __ENET_CALLBACKS_H__ */ + diff --git a/src/enet/include/enet/enet.h b/src/enet/include/enet/enet.h new file mode 100644 index 0000000..14106aa --- /dev/null +++ b/src/enet/include/enet/enet.h @@ -0,0 +1,488 @@ +/** + @file enet.h + @brief ENet public header file +*/ +#ifndef __ENET_ENET_H__ +#define __ENET_ENET_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include + +#ifdef WIN32 +#include "enet/win32.h" +#else +#include "enet/unix.h" +#endif + +#include "enet/types.h" +#include "enet/protocol.h" +#include "enet/list.h" +#include "enet/callbacks.h" + +typedef enum +{ + ENET_VERSION = 1 +} ENetVersion; + +typedef enum +{ + ENET_SOCKET_TYPE_STREAM = 1, + ENET_SOCKET_TYPE_DATAGRAM = 2 +} ENetSocketType; + +typedef enum +{ + ENET_SOCKET_WAIT_NONE = 0, + ENET_SOCKET_WAIT_SEND = (1 << 0), + ENET_SOCKET_WAIT_RECEIVE = (1 << 1) +} ENetSocketWait; + +typedef enum +{ + ENET_SOCKOPT_NONBLOCK = 1, + ENET_SOCKOPT_BROADCAST = 2, + ENET_SOCKOPT_RCVBUF = 3, + ENET_SOCKOPT_SNDBUF = 4 +} ENetSocketOption; + +enum +{ + ENET_HOST_ANY = 0, /**< specifies the default server host */ + ENET_HOST_BROADCAST = 0xFFFFFFFF, /**< specifies a subnet-wide broadcast */ + + ENET_PORT_ANY = 0 /**< specifies that a port should be automatically chosen */ +}; + +/** + * Portable internet address structure. + * + * The host must be specified in network byte-order, and the port must be in host + * byte-order. The constant ENET_HOST_ANY may be used to specify the default + * server host. The constant ENET_HOST_BROADCAST may be used to specify the + * broadcast address (255.255.255.255). This makes sense for enet_host_connect, + * but not for enet_host_create. Once a server responds to a broadcast, the + * address is updated from ENET_HOST_BROADCAST to the server's actual IP address. + */ +typedef struct _ENetAddress +{ + enet_uint32 host; + enet_uint16 port; +} ENetAddress; + +/** + * Packet flag bit constants. + * + * The host must be specified in network byte-order, and the port must be in + * host byte-order. The constant ENET_HOST_ANY may be used to specify the + * default server host. + + @sa ENetPacket +*/ +typedef enum +{ + /** packet must be received by the target peer and resend attempts should be + * made until the packet is delivered */ + ENET_PACKET_FLAG_RELIABLE = (1 << 0), + /** packet will not be sequenced with other packets + * not supported for reliable packets + */ + ENET_PACKET_FLAG_UNSEQUENCED = (1 << 1), + /** packet will not allocate data, and user must supply it instead */ + ENET_PACKET_FLAG_NO_ALLOCATE = (1 << 2) +} ENetPacketFlag; + +struct _ENetPacket; +typedef void (ENET_CALLBACK * ENetPacketFreeCallback) (struct _ENetPacket *); + +/** + * ENet packet structure. + * + * An ENet data packet that may be sent to or received from a peer. The shown + * fields should only be read and never modified. The data field contains the + * allocated data for the packet. The dataLength fields specifies the length + * of the allocated data. The flags field is either 0 (specifying no flags), + * or a bitwise-or of any combination of the following flags: + * + * ENET_PACKET_FLAG_RELIABLE - packet must be received by the target peer + * and resend attempts should be made until the packet is delivered + * + * ENET_PACKET_FLAG_UNSEQUENCED - packet will not be sequenced with other packets + * (not supported for reliable packets) + * + * ENET_PACKET_FLAG_NO_ALLOCATE - packet will not allocate data, and user must supply it instead + + @sa ENetPacketFlag + */ +typedef struct _ENetPacket +{ + size_t referenceCount; /**< internal use only */ + enet_uint32 flags; /**< bitwise-or of ENetPacketFlag constants */ + enet_uint8 * data; /**< allocated data for packet */ + size_t dataLength; /**< length of data */ + ENetPacketFreeCallback freeCallback; /**< function to be called when the packet is no longer in use */ +} ENetPacket; + +typedef struct _ENetAcknowledgement +{ + ENetListNode acknowledgementList; + enet_uint32 sentTime; + ENetProtocol command; +} ENetAcknowledgement; + +typedef struct _ENetOutgoingCommand +{ + ENetListNode outgoingCommandList; + enet_uint16 reliableSequenceNumber; + enet_uint16 unreliableSequenceNumber; + enet_uint32 sentTime; + enet_uint32 roundTripTimeout; + enet_uint32 roundTripTimeoutLimit; + enet_uint32 fragmentOffset; + enet_uint16 fragmentLength; + enet_uint16 sendAttempts; + ENetProtocol command; + ENetPacket * packet; +} ENetOutgoingCommand; + +typedef struct _ENetIncomingCommand +{ + ENetListNode incomingCommandList; + enet_uint16 reliableSequenceNumber; + enet_uint16 unreliableSequenceNumber; + ENetProtocol command; + enet_uint32 fragmentCount; + enet_uint32 fragmentsRemaining; + enet_uint32 * fragments; + ENetPacket * packet; +} ENetIncomingCommand; + +typedef enum +{ + ENET_PEER_STATE_DISCONNECTED = 0, + ENET_PEER_STATE_CONNECTING = 1, + ENET_PEER_STATE_ACKNOWLEDGING_CONNECT = 2, + ENET_PEER_STATE_CONNECTION_PENDING = 3, + ENET_PEER_STATE_CONNECTION_SUCCEEDED = 4, + ENET_PEER_STATE_CONNECTED = 5, + ENET_PEER_STATE_DISCONNECT_LATER = 6, + ENET_PEER_STATE_DISCONNECTING = 7, + ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 8, + ENET_PEER_STATE_ZOMBIE = 9 +} ENetPeerState; + +#ifndef ENET_BUFFER_MAXIMUM +#define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS) +#endif + +enum +{ + ENET_HOST_RECEIVE_BUFFER_SIZE = 256 * 1024, + ENET_HOST_SEND_BUFFER_SIZE = 256 * 1024, + ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL = 1000, + ENET_HOST_DEFAULT_MTU = 1400, + + ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 500, + ENET_PEER_DEFAULT_PACKET_THROTTLE = 32, + ENET_PEER_PACKET_THROTTLE_SCALE = 32, + ENET_PEER_PACKET_THROTTLE_COUNTER = 7, + ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2, + ENET_PEER_PACKET_THROTTLE_DECELERATION = 2, + ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000, + ENET_PEER_PACKET_LOSS_SCALE = (1 << 16), + ENET_PEER_PACKET_LOSS_INTERVAL = 10000, + ENET_PEER_WINDOW_SIZE_SCALE = 64 * 1024, + ENET_PEER_TIMEOUT_LIMIT = 32, + ENET_PEER_TIMEOUT_MINIMUM = 5000, + ENET_PEER_TIMEOUT_MAXIMUM = 30000, + ENET_PEER_PING_INTERVAL = 500, + ENET_PEER_UNSEQUENCED_WINDOWS = 64, + ENET_PEER_UNSEQUENCED_WINDOW_SIZE = 1024, + ENET_PEER_FREE_UNSEQUENCED_WINDOWS = 32, + ENET_PEER_RELIABLE_WINDOWS = 16, + ENET_PEER_RELIABLE_WINDOW_SIZE = 0x1000, + ENET_PEER_FREE_RELIABLE_WINDOWS = 8 +}; + +typedef struct _ENetChannel +{ + enet_uint16 outgoingReliableSequenceNumber; + enet_uint16 outgoingUnreliableSequenceNumber; + enet_uint16 usedReliableWindows; + enet_uint16 reliableWindows [ENET_PEER_RELIABLE_WINDOWS]; + enet_uint16 incomingReliableSequenceNumber; + ENetList incomingReliableCommands; + ENetList incomingUnreliableCommands; +} ENetChannel; + +/** + * An ENet peer which data packets may be sent or received from. + * + * No fields should be modified unless otherwise specified. + */ +typedef struct _ENetPeer +{ + struct _ENetHost * host; + enet_uint16 outgoingPeerID; + enet_uint16 incomingPeerID; + enet_uint32 sessionID; + ENetAddress address; /**< Internet address of the peer */ + void * data; /**< Application private data, may be freely modified */ + ENetPeerState state; + ENetChannel * channels; + size_t channelCount; /**< Number of channels allocated for communication with peer */ + enet_uint32 incomingBandwidth; /**< Downstream bandwidth of the client in bytes/second */ + enet_uint32 outgoingBandwidth; /**< Upstream bandwidth of the client in bytes/second */ + enet_uint32 incomingBandwidthThrottleEpoch; + enet_uint32 outgoingBandwidthThrottleEpoch; + enet_uint32 incomingDataTotal; + enet_uint32 outgoingDataTotal; + enet_uint32 lastSendTime; + enet_uint32 lastReceiveTime; + enet_uint32 nextTimeout; + enet_uint32 earliestTimeout; + enet_uint32 packetLossEpoch; + enet_uint32 packetsSent; + enet_uint32 packetsLost; + enet_uint32 packetLoss; /**< mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SCALE */ + enet_uint32 packetLossVariance; + enet_uint32 packetThrottle; + enet_uint32 packetThrottleLimit; + enet_uint32 packetThrottleCounter; + enet_uint32 packetThrottleEpoch; + enet_uint32 packetThrottleAcceleration; + enet_uint32 packetThrottleDeceleration; + enet_uint32 packetThrottleInterval; + enet_uint32 lastRoundTripTime; + enet_uint32 lowestRoundTripTime; + enet_uint32 lastRoundTripTimeVariance; + enet_uint32 highestRoundTripTimeVariance; + enet_uint32 roundTripTime; /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */ + enet_uint32 roundTripTimeVariance; + enet_uint16 mtu; + enet_uint32 windowSize; + enet_uint32 reliableDataInTransit; + enet_uint16 outgoingReliableSequenceNumber; + ENetList acknowledgements; + ENetList sentReliableCommands; + ENetList sentUnreliableCommands; + ENetList outgoingReliableCommands; + ENetList outgoingUnreliableCommands; + enet_uint16 incomingUnsequencedGroup; + enet_uint16 outgoingUnsequencedGroup; + enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32]; + enet_uint32 disconnectData; +} ENetPeer; + +/** An ENet host for communicating with peers. + * + * No fields should be modified. + + @sa enet_host_create() + @sa enet_host_destroy() + @sa enet_host_connect() + @sa enet_host_service() + @sa enet_host_flush() + @sa enet_host_broadcast() + @sa enet_host_bandwidth_limit() + @sa enet_host_bandwidth_throttle() + */ +typedef struct _ENetHost +{ + ENetSocket socket; + ENetAddress address; /**< Internet address of the host */ + enet_uint32 incomingBandwidth; /**< downstream bandwidth of the host */ + enet_uint32 outgoingBandwidth; /**< upstream bandwidth of the host */ + enet_uint32 bandwidthThrottleEpoch; + enet_uint32 mtu; + int recalculateBandwidthLimits; + ENetPeer * peers; /**< array of peers allocated for this host */ + size_t peerCount; /**< number of peers allocated for this host */ + enet_uint32 serviceTime; + ENetPeer * lastServicedPeer; + int continueSending; + size_t packetSize; + enet_uint16 headerFlags; + ENetProtocol commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS]; + size_t commandCount; + ENetBuffer buffers [ENET_BUFFER_MAXIMUM]; + size_t bufferCount; + ENetAddress receivedAddress; + enet_uint8 receivedData [ENET_PROTOCOL_MAXIMUM_MTU]; + size_t receivedDataLength; +} ENetHost; + +/** + * An ENet event type, as specified in @ref ENetEvent. + */ +typedef enum +{ + /** no event occurred within the specified time limit */ + ENET_EVENT_TYPE_NONE = 0, + + /** a connection request initiated by enet_host_connect has completed. + * The peer field contains the peer which successfully connected. + */ + ENET_EVENT_TYPE_CONNECT = 1, + + /** a peer has disconnected. This event is generated on a successful + * completion of a disconnect initiated by enet_pper_disconnect, if + * a peer has timed out, or if a connection request intialized by + * enet_host_connect has timed out. The peer field contains the peer + * which disconnected. The data field contains user supplied data + * describing the disconnection, or 0, if none is available. + */ + ENET_EVENT_TYPE_DISCONNECT = 2, + + /** a packet has been received from a peer. The peer field specifies the + * peer which sent the packet. The channelID field specifies the channel + * number upon which the packet was received. The packet field contains + * the packet that was received; this packet must be destroyed with + * enet_packet_destroy after use. + */ + ENET_EVENT_TYPE_RECEIVE = 3 +} ENetEventType; + +/** + * An ENet event as returned by enet_host_service(). + + @sa enet_host_service + */ +typedef struct _ENetEvent +{ + ENetEventType type; /**< type of the event */ + ENetPeer * peer; /**< peer that generated a connect, disconnect or receive event */ + enet_uint8 channelID; /**< channel on the peer that generated the event, if appropriate */ + enet_uint32 data; /**< data associated with the event, if appropriate */ + ENetPacket * packet; /**< packet associated with the event, if appropriate */ +} ENetEvent; + +/** @defgroup global ENet global functions + @{ +*/ + +/** + Initializes ENet globally. Must be called prior to using any functions in + ENet. + @returns 0 on success, < 0 on failure +*/ +ENET_API int enet_initialize (void); + +/** + Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. + + @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use + @param inits user-overriden callbacks where any NULL callbacks will use ENet's defaults + @returns 0 on success, < 0 on failure +*/ +ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits); + +/** + Shuts down ENet globally. Should be called when a program that has + initialized ENet exits. +*/ +ENET_API void enet_deinitialize (void); + +/** @} */ + +/** @defgroup private ENet private implementation functions */ + +/** + Returns the wall-time in milliseconds. Its initial value is unspecified + unless otherwise set. + */ +ENET_API enet_uint32 enet_time_get (void); +/** + Sets the current wall-time in milliseconds. + */ +ENET_API void enet_time_set (enet_uint32); + +/** @defgroup socket ENet socket functions + @{ +*/ +ENET_API ENetSocket enet_socket_create (ENetSocketType, const ENetAddress *); +ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *); +ENET_API int enet_socket_connect (ENetSocket, const ENetAddress *); +ENET_API int enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t); +ENET_API int enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t); +ENET_API int enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32); +ENET_API int enet_socket_set_option (ENetSocket, ENetSocketOption, int); +ENET_API void enet_socket_destroy (ENetSocket); + +/** @} */ + +/** @defgroup Address ENet address functions + @{ +*/ +/** Attempts to resolve the host named by the parameter hostName and sets + the host field in the address parameter if successful. + @param address destination to store resolved address + @param hostName host name to lookup + @retval 0 on success + @retval < 0 on failure + @returns the address of the given hostName in address on success +*/ +ENET_API int enet_address_set_host (ENetAddress * address, const char * hostName); + +/** Gives the printable form of the ip address specified in the address parameter. + @param address address printed + @param hostName destination for name, must not be NULL + @param nameLength maximum length of hostName. + @returns the null-terminated name of the host in hostName on success + @retval 0 on success + @retval < 0 on failure +*/ +ENET_API int enet_address_get_host_ip (const ENetAddress * address, char * hostName, size_t nameLength); + +/** Attempts to do a reverse lookup of the host field in the address parameter. + @param address address used for reverse lookup + @param hostName destination for name, must not be NULL + @param nameLength maximum length of hostName. + @returns the null-terminated name of the host in hostName on success + @retval 0 on success + @retval < 0 on failure +*/ +ENET_API int enet_address_get_host (const ENetAddress * address, char * hostName, size_t nameLength); + +/** @} */ + +ENET_API ENetPacket * enet_packet_create (const void *, size_t, enet_uint32); +ENET_API void enet_packet_destroy (ENetPacket *); +ENET_API int enet_packet_resize (ENetPacket *, size_t); +extern enet_uint32 enet_crc32 (const ENetBuffer *, size_t); + +ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, enet_uint32, enet_uint32); +ENET_API void enet_host_destroy (ENetHost *); +ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t); +ENET_API int enet_host_check_events (ENetHost *, ENetEvent *); +ENET_API int enet_host_service (ENetHost *, ENetEvent *, enet_uint32); +ENET_API void enet_host_flush (ENetHost *); +ENET_API void enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *); +ENET_API void enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32); +extern void enet_host_bandwidth_throttle (ENetHost *); + +ENET_API int enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *); +ENET_API ENetPacket * enet_peer_receive (ENetPeer *, enet_uint8); +ENET_API void enet_peer_ping (ENetPeer *); +ENET_API void enet_peer_reset (ENetPeer *); +ENET_API void enet_peer_disconnect (ENetPeer *, enet_uint32); +ENET_API void enet_peer_disconnect_now (ENetPeer *, enet_uint32); +ENET_API void enet_peer_disconnect_later (ENetPeer *, enet_uint32); +ENET_API void enet_peer_throttle_configure (ENetPeer *, enet_uint32, enet_uint32, enet_uint32); +extern int enet_peer_throttle (ENetPeer *, enet_uint32); +extern void enet_peer_reset_queues (ENetPeer *); +extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16); +extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32); +extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint16); + +extern size_t enet_protocol_command_size (enet_uint8); + +#ifdef __cplusplus +} +#endif + +#endif /* __ENET_ENET_H__ */ + diff --git a/src/enet/include/enet/list.h b/src/enet/include/enet/list.h new file mode 100644 index 0000000..99bc4ae --- /dev/null +++ b/src/enet/include/enet/list.h @@ -0,0 +1,42 @@ +/** + @file list.h + @brief ENet list management +*/ +#ifndef __ENET_LIST_H__ +#define __ENET_LIST_H__ + +#include + +typedef struct _ENetListNode +{ + struct _ENetListNode * next; + struct _ENetListNode * previous; +} ENetListNode; + +typedef ENetListNode * ENetListIterator; + +typedef struct _ENetList +{ + ENetListNode sentinel; +} ENetList; + +extern void enet_list_clear (ENetList *); + +extern ENetListIterator enet_list_insert (ENetListIterator, void *); +extern void * enet_list_remove (ENetListIterator); + +extern size_t enet_list_size (ENetList *); + +#define enet_list_begin(list) ((list) -> sentinel.next) +#define enet_list_end(list) (& (list) -> sentinel) + +#define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (list)) + +#define enet_list_next(iterator) ((iterator) -> next) +#define enet_list_previous(iterator) ((iterator) -> previous) + +#define enet_list_front(list) ((void *) (list) -> sentinel.next) +#define enet_list_back(list) ((void *) (list) -> sentinel.previous) + +#endif /* __ENET_LIST_H__ */ + diff --git a/src/enet/include/enet/protocol.h b/src/enet/include/enet/protocol.h new file mode 100644 index 0000000..363857b --- /dev/null +++ b/src/enet/include/enet/protocol.h @@ -0,0 +1,174 @@ +/** + @file protocol.h + @brief ENet protocol +*/ +#ifndef __ENET_PROTOCOL_H__ +#define __ENET_PROTOCOL_H__ + +#include "enet/types.h" + +enum +{ + ENET_PROTOCOL_MINIMUM_MTU = 576, + ENET_PROTOCOL_MAXIMUM_MTU = 4096, + ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32, + ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096, + ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 32768, + ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1, + ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255, + ENET_PROTOCOL_MAXIMUM_PEER_ID = 0x7FFF +}; + +typedef enum +{ + ENET_PROTOCOL_COMMAND_NONE = 0, + ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1, + ENET_PROTOCOL_COMMAND_CONNECT = 2, + ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3, + ENET_PROTOCOL_COMMAND_DISCONNECT = 4, + ENET_PROTOCOL_COMMAND_PING = 5, + ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6, + ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7, + ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8, + ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 9, + ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 10, + ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11, + ENET_PROTOCOL_COMMAND_COUNT = 12, + + ENET_PROTOCOL_COMMAND_MASK = 0x0F +} ENetProtocolCommand; + +typedef enum +{ + ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7), + ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6), + + ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15), + ENET_PROTOCOL_HEADER_FLAG_MASK = 0x8000 +} ENetProtocolFlag; + +typedef struct +{ + enet_uint32 checksum; + enet_uint16 peerID; + enet_uint16 sentTime; +} ENetProtocolHeader; + +typedef struct +{ + enet_uint8 command; + enet_uint8 channelID; + enet_uint16 reliableSequenceNumber; +} ENetProtocolCommandHeader; + +typedef struct +{ + ENetProtocolCommandHeader header; + enet_uint16 receivedReliableSequenceNumber; + enet_uint16 receivedSentTime; +} ENetProtocolAcknowledge; + +typedef struct +{ + ENetProtocolCommandHeader header; + enet_uint16 outgoingPeerID; + enet_uint16 mtu; + enet_uint32 windowSize; + enet_uint32 channelCount; + enet_uint32 incomingBandwidth; + enet_uint32 outgoingBandwidth; + enet_uint32 packetThrottleInterval; + enet_uint32 packetThrottleAcceleration; + enet_uint32 packetThrottleDeceleration; + enet_uint32 sessionID; +} ENetProtocolConnect; + +typedef struct +{ + ENetProtocolCommandHeader header; + enet_uint16 outgoingPeerID; + enet_uint16 mtu; + enet_uint32 windowSize; + enet_uint32 channelCount; + enet_uint32 incomingBandwidth; + enet_uint32 outgoingBandwidth; + enet_uint32 packetThrottleInterval; + enet_uint32 packetThrottleAcceleration; + enet_uint32 packetThrottleDeceleration; +} ENetProtocolVerifyConnect; + +typedef struct +{ + ENetProtocolCommandHeader header; + enet_uint32 incomingBandwidth; + enet_uint32 outgoingBandwidth; +} ENetProtocolBandwidthLimit; + +typedef struct +{ + ENetProtocolCommandHeader header; + enet_uint32 packetThrottleInterval; + enet_uint32 packetThrottleAcceleration; + enet_uint32 packetThrottleDeceleration; +} ENetProtocolThrottleConfigure; + +typedef struct +{ + ENetProtocolCommandHeader header; + enet_uint32 data; +} ENetProtocolDisconnect; + +typedef struct +{ + ENetProtocolCommandHeader header; +} ENetProtocolPing; + +typedef struct +{ + ENetProtocolCommandHeader header; + enet_uint16 dataLength; +} ENetProtocolSendReliable; + +typedef struct +{ + ENetProtocolCommandHeader header; + enet_uint16 unreliableSequenceNumber; + enet_uint16 dataLength; +} ENetProtocolSendUnreliable; + +typedef struct +{ + ENetProtocolCommandHeader header; + enet_uint16 unsequencedGroup; + enet_uint16 dataLength; +} ENetProtocolSendUnsequenced; + +typedef struct +{ + ENetProtocolCommandHeader header; + enet_uint16 startSequenceNumber; + enet_uint16 dataLength; + enet_uint32 fragmentCount; + enet_uint32 fragmentNumber; + enet_uint32 totalLength; + enet_uint32 fragmentOffset; +} ENetProtocolSendFragment; + +typedef union +{ + ENetProtocolCommandHeader header; + ENetProtocolAcknowledge acknowledge; + ENetProtocolConnect connect; + ENetProtocolVerifyConnect verifyConnect; + ENetProtocolDisconnect disconnect; + ENetProtocolPing ping; + ENetProtocolSendReliable sendReliable; + ENetProtocolSendUnreliable sendUnreliable; + ENetProtocolSendUnsequenced sendUnsequenced; + ENetProtocolSendFragment sendFragment; + ENetProtocolBandwidthLimit bandwidthLimit; + ENetProtocolThrottleConfigure throttleConfigure; +} ENetProtocol; + +#endif /* __ENET_PROTOCOL_H__ */ + diff --git a/src/enet/include/enet/time.h b/src/enet/include/enet/time.h new file mode 100644 index 0000000..c82a546 --- /dev/null +++ b/src/enet/include/enet/time.h @@ -0,0 +1,18 @@ +/** + @file time.h + @brief ENet time constants and macros +*/ +#ifndef __ENET_TIME_H__ +#define __ENET_TIME_H__ + +#define ENET_TIME_OVERFLOW 86400000 + +#define ENET_TIME_LESS(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW) +#define ENET_TIME_GREATER(a, b) ((b) - (a) >= ENET_TIME_OVERFLOW) +#define ENET_TIME_LESS_EQUAL(a, b) (! ENET_TIME_GREATER (a, b)) +#define ENET_TIME_GREATER_EQUAL(a, b) (! ENET_TIME_LESS (a, b)) + +#define ENET_TIME_DIFFERENCE(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW ? (b) - (a) : (a) - (b)) + +#endif /* __ENET_TIME_H__ */ + diff --git a/src/enet/include/enet/types.h b/src/enet/include/enet/types.h new file mode 100644 index 0000000..ab010a4 --- /dev/null +++ b/src/enet/include/enet/types.h @@ -0,0 +1,13 @@ +/** + @file types.h + @brief type definitions for ENet +*/ +#ifndef __ENET_TYPES_H__ +#define __ENET_TYPES_H__ + +typedef unsigned char enet_uint8; /**< unsigned 8-bit type */ +typedef unsigned short enet_uint16; /**< unsigned 16-bit type */ +typedef unsigned int enet_uint32; /**< unsigned 32-bit type */ + +#endif /* __ENET_TYPES_H__ */ + diff --git a/src/enet/include/enet/unix.h b/src/enet/include/enet/unix.h new file mode 100644 index 0000000..b20fecd --- /dev/null +++ b/src/enet/include/enet/unix.h @@ -0,0 +1,36 @@ +/** + @file unix.h + @brief ENet Unix header +*/ +#ifndef __ENET_UNIX_H__ +#define __ENET_UNIX_H__ + +#include +#include +#include + +typedef int ENetSocket; + +enum +{ + ENET_SOCKET_NULL = -1 +}; + +#define ENET_HOST_TO_NET_16(value) (htons (value)) /**< macro that converts host to net byte-order of a 16-bit value */ +#define ENET_HOST_TO_NET_32(value) (htonl (value)) /**< macro that converts host to net byte-order of a 32-bit value */ + +#define ENET_NET_TO_HOST_16(value) (ntohs (value)) /**< macro that converts net to host byte-order of a 16-bit value */ +#define ENET_NET_TO_HOST_32(value) (ntohl (value)) /**< macro that converts net to host byte-order of a 32-bit value */ + +typedef struct +{ + void * data; + size_t dataLength; +} ENetBuffer; + +#define ENET_CALLBACK + +#define ENET_API extern + +#endif /* __ENET_UNIX_H__ */ + diff --git a/src/enet/include/enet/utility.h b/src/enet/include/enet/utility.h new file mode 100644 index 0000000..e48a476 --- /dev/null +++ b/src/enet/include/enet/utility.h @@ -0,0 +1,12 @@ +/** + @file utility.h + @brief ENet utility header +*/ +#ifndef __ENET_UTILITY_H__ +#define __ENET_UTILITY_H__ + +#define ENET_MAX(x, y) ((x) > (y) ? (x) : (y)) +#define ENET_MIN(x, y) ((x) < (y) ? (x) : (y)) + +#endif /* __ENET_UTILITY_H__ */ + diff --git a/src/enet/include/enet/win32.h b/src/enet/include/enet/win32.h new file mode 100644 index 0000000..310ecd5 --- /dev/null +++ b/src/enet/include/enet/win32.h @@ -0,0 +1,51 @@ +/** + @file win32.h + @brief ENet Win32 header +*/ +#ifndef __ENET_WIN32_H__ +#define __ENET_WIN32_H__ + +#ifdef ENET_BUILDING_LIB +#pragma warning (disable: 4996) // 'strncpy' was declared deprecated +#pragma warning (disable: 4267) // size_t to int conversion +#pragma warning (disable: 4244) // 64bit to 32bit int +#pragma warning (disable: 4018) // signed/unsigned mismatch +#endif + +#include +#include + +typedef SOCKET ENetSocket; + +enum +{ + ENET_SOCKET_NULL = INVALID_SOCKET +}; + +#define ENET_HOST_TO_NET_16(value) (htons (value)) +#define ENET_HOST_TO_NET_32(value) (htonl (value)) + +#define ENET_NET_TO_HOST_16(value) (ntohs (value)) +#define ENET_NET_TO_HOST_32(value) (ntohl (value)) + +typedef struct +{ + size_t dataLength; + void * data; +} ENetBuffer; + +#define ENET_CALLBACK __cdecl + +#if defined ENET_DLL +#if defined ENET_BUILDING_LIB +#define ENET_API __declspec( dllexport ) +#else +#define ENET_API __declspec( dllimport ) +#endif /* ENET_BUILDING_LIB */ +#else /* !ENET_DLL */ +#define ENET_API extern +#endif /* ENET_DLL */ + +#endif /* __ENET_WIN32_H__ */ + + diff --git a/src/enet/install-sh b/src/enet/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/src/enet/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# 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. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# 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 $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/src/enet/list.c b/src/enet/list.c new file mode 100644 index 0000000..1a4aa3a --- /dev/null +++ b/src/enet/list.c @@ -0,0 +1,57 @@ +/** + @file list.c + @brief ENet linked list functions +*/ +#define ENET_BUILDING_LIB 1 +#include "enet/list.h" + +/** + @defgroup list ENet linked list utility functions + @ingroup private + @{ +*/ +void +enet_list_clear (ENetList * list) +{ + list -> sentinel.next = & list -> sentinel; + list -> sentinel.previous = & list -> sentinel; +} + +ENetListIterator +enet_list_insert (ENetListIterator position, void * data) +{ + ENetListIterator result = (ENetListIterator) data; + + result -> previous = position -> previous; + result -> next = position; + + result -> previous -> next = result; + position -> previous = result; + + return result; +} + +void * +enet_list_remove (ENetListIterator position) +{ + position -> previous -> next = position -> next; + position -> next -> previous = position -> previous; + + return position; +} + +size_t +enet_list_size (ENetList * list) +{ + size_t size = 0; + ENetListIterator position; + + for (position = enet_list_begin (list); + position != enet_list_end (list); + position = enet_list_next (position)) + ++ size; + + return size; +} + +/** @} */ diff --git a/src/enet/missing b/src/enet/missing new file mode 100755 index 0000000..64b5f90 --- /dev/null +++ b/src/enet/missing @@ -0,0 +1,353 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2004-09-07.08 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 +# Free Software Foundation, Inc. +# Originally 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# 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 + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit 0 + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit 0 + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/src/enet/mkinstalldirs b/src/enet/mkinstalldirs new file mode 100755 index 0000000..c492104 --- /dev/null +++ b/src/enet/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1 2006/03/07 05:56:13 eihrul Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/src/enet/packet.c b/src/enet/packet.c new file mode 100644 index 0000000..e1ae9c4 --- /dev/null +++ b/src/enet/packet.c @@ -0,0 +1,140 @@ +/** + @file packet.c + @brief ENet packet management functions +*/ +#include +#define ENET_BUILDING_LIB 1 +#include "enet/enet.h" + +/** @defgroup Packet ENet packet functions + @{ +*/ + +/** Creates a packet that may be sent to a peer. + @param dataContents initial contents of the packet's data; the packet's data will remain uninitialized if dataContents is NULL. + @param dataLength size of the data allocated for this packet + @param flags flags for this packet as described for the ENetPacket structure. + @returns the packet on success, NULL on failure +*/ +ENetPacket * +enet_packet_create (const void * data, size_t dataLength, enet_uint32 flags) +{ + ENetPacket * packet = (ENetPacket *) enet_malloc (sizeof (ENetPacket)); + + if (flags & ENET_PACKET_FLAG_NO_ALLOCATE) + packet -> data = (enet_uint8 *) data; + else + { + packet -> data = (enet_uint8 *) enet_malloc (dataLength); + if (packet -> data == NULL) + { + enet_free (packet); + return NULL; + } + + if (data != NULL) + memcpy (packet -> data, data, dataLength); + } + + packet -> referenceCount = 0; + packet -> flags = flags; + packet -> dataLength = dataLength; + packet -> freeCallback = NULL; + + return packet; +} + +/** Destroys the packet and deallocates its data. + @param packet packet to be destroyed +*/ +void +enet_packet_destroy (ENetPacket * packet) +{ + if (packet -> freeCallback != NULL) + (* packet -> freeCallback) (packet); + if (! (packet -> flags & ENET_PACKET_FLAG_NO_ALLOCATE)) + enet_free (packet -> data); + enet_free (packet); +} + +/** Attempts to resize the data in the packet to length specified in the + dataLength parameter + @param packet packet to resize + @param dataLength new size for the packet data + @returns 0 on success, < 0 on failure +*/ +int +enet_packet_resize (ENetPacket * packet, size_t dataLength) +{ + enet_uint8 * newData; + + if (dataLength <= packet -> dataLength || (packet -> flags & ENET_PACKET_FLAG_NO_ALLOCATE)) + { + packet -> dataLength = dataLength; + + return 0; + } + + newData = (enet_uint8 *) enet_malloc (dataLength); + if (newData == NULL) + return -1; + + memcpy (newData, packet -> data, packet -> dataLength); + enet_free (packet -> data); + + packet -> data = newData; + packet -> dataLength = dataLength; + + return 0; +} + +static int initializedCRC32 = 0; +static enet_uint32 crcTable [256]; + +static void initialize_crc32 () +{ + int byte; + + for (byte = 0; byte < 256; ++ byte) + { + enet_uint32 crc = byte << 24; + int offset; + + for(offset = 0; offset < 8; ++ offset) + { + if (crc & 0x80000000) + crc = (crc << 1) ^ 0x04c11db7; + else + crc <<= 1; + } + + crcTable [byte] = crc; + } + + initializedCRC32 = 1; +} + +enet_uint32 +enet_crc32 (const ENetBuffer * buffers, size_t bufferCount) +{ + enet_uint32 crc = 0xFFFFFFFF; + + if (! initializedCRC32) initialize_crc32 (); + + while (bufferCount -- > 0) + { + const enet_uint8 * data = (const enet_uint8 *) buffers -> data, + * dataEnd = & data [buffers -> dataLength]; + + while (data < dataEnd) + { + crc = ((crc << 8) | * data ++) ^ crcTable [crc >> 24]; + } + + ++ buffers; + } + + return ENET_HOST_TO_NET_32 (~ crc); +} + +/** @} */ diff --git a/src/enet/peer.c b/src/enet/peer.c new file mode 100644 index 0000000..f9d73fc --- /dev/null +++ b/src/enet/peer.c @@ -0,0 +1,699 @@ +/** + @file peer.c + @brief ENet peer management functions +*/ +#include +#define ENET_BUILDING_LIB 1 +#include "enet/enet.h" + +/** @defgroup peer ENet peer functions + @{ +*/ + +/** Configures throttle parameter for a peer. + + Unreliable packets are dropped by ENet in response to the varying conditions + of the Internet connection to the peer. The throttle represents a probability + that an unreliable packet should not be dropped and thus sent by ENet to the peer. + The lowest mean round trip time from the sending of a reliable packet to the + receipt of its acknowledgement is measured over an amount of time specified by + the interval parameter in milliseconds. If a measured round trip time happens to + be significantly less than the mean round trip time measured over the interval, + then the throttle probability is increased to allow more traffic by an amount + specified in the acceleration parameter, which is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE + constant. If a measured round trip time happens to be significantly greater than + the mean round trip time measured over the interval, then the throttle probability + is decreased to limit traffic by an amount specified in the deceleration parameter, which + is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE constant. When the throttle has + a value of ENET_PEER_PACKET_THROTTLE_SCALE, on unreliable packets are dropped by + ENet, and so 100% of all unreliable packets will be sent. When the throttle has a + value of 0, all unreliable packets are dropped by ENet, and so 0% of all unreliable + packets will be sent. Intermediate values for the throttle represent intermediate + probabilities between 0% and 100% of unreliable packets being sent. The bandwidth + limits of the local and foreign hosts are taken into account to determine a + sensible limit for the throttle probability above which it should not raise even in + the best of conditions. + + @param peer peer to configure + @param interval interval, in milliseconds, over which to measure lowest mean RTT; the default value is ENET_PEER_PACKET_THROTTLE_INTERVAL. + @param acceleration rate at which to increase the throttle probability as mean RTT declines + @param deceleration rate at which to decrease the throttle probability as mean RTT increases +*/ +void +enet_peer_throttle_configure (ENetPeer * peer, enet_uint32 interval, enet_uint32 acceleration, enet_uint32 deceleration) +{ + ENetProtocol command; + + peer -> packetThrottleInterval = interval; + peer -> packetThrottleAcceleration = acceleration; + peer -> packetThrottleDeceleration = deceleration; + + command.header.command = ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; + command.header.channelID = 0xFF; + + command.throttleConfigure.packetThrottleInterval = ENET_HOST_TO_NET_32 (interval); + command.throttleConfigure.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (acceleration); + command.throttleConfigure.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (deceleration); + + enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); +} + +int +enet_peer_throttle (ENetPeer * peer, enet_uint32 rtt) +{ + if (peer -> lastRoundTripTime <= peer -> lastRoundTripTimeVariance) + { + peer -> packetThrottle = peer -> packetThrottleLimit; + } + else + if (rtt < peer -> lastRoundTripTime) + { + peer -> packetThrottle += peer -> packetThrottleAcceleration; + + if (peer -> packetThrottle > peer -> packetThrottleLimit) + peer -> packetThrottle = peer -> packetThrottleLimit; + + return 1; + } + else + if (rtt > peer -> lastRoundTripTime + 2 * peer -> lastRoundTripTimeVariance) + { + if (peer -> packetThrottle > peer -> packetThrottleDeceleration) + peer -> packetThrottle -= peer -> packetThrottleDeceleration; + else + peer -> packetThrottle = 0; + + return -1; + } + + return 0; +} + +/** Queues a packet to be sent. + @param peer destination for the packet + @param channelID channel on which to send + @param packet packet to send + @retval 0 on success + @retval < 0 on failure +*/ +int +enet_peer_send (ENetPeer * peer, enet_uint8 channelID, ENetPacket * packet) +{ + ENetChannel * channel = & peer -> channels [channelID]; + ENetProtocol command; + size_t fragmentLength; + + if (peer -> state != ENET_PEER_STATE_CONNECTED || + channelID >= peer -> channelCount) + return -1; + + fragmentLength = peer -> mtu - sizeof (ENetProtocolHeader) - sizeof (ENetProtocolSendFragment); + + if (packet -> dataLength > fragmentLength) + { + enet_uint16 startSequenceNumber = ENET_HOST_TO_NET_16 (channel -> outgoingReliableSequenceNumber + 1); + enet_uint32 fragmentCount = ENET_HOST_TO_NET_32 ((packet -> dataLength + fragmentLength - 1) / fragmentLength), + fragmentNumber, + fragmentOffset; + + packet -> flags |= ENET_PACKET_FLAG_RELIABLE; + packet -> flags &= ~ENET_PACKET_FLAG_UNSEQUENCED; + + for (fragmentNumber = 0, + fragmentOffset = 0; + fragmentOffset < packet -> dataLength; + ++ fragmentNumber, + fragmentOffset += fragmentLength) + { + if (packet -> dataLength - fragmentOffset < fragmentLength) + fragmentLength = packet -> dataLength - fragmentOffset; + + command.header.command = ENET_PROTOCOL_COMMAND_SEND_FRAGMENT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; + command.header.channelID = channelID; + command.sendFragment.startSequenceNumber = startSequenceNumber; + command.sendFragment.dataLength = ENET_HOST_TO_NET_16 (fragmentLength); + command.sendFragment.fragmentCount = fragmentCount; + command.sendFragment.fragmentNumber = ENET_HOST_TO_NET_32 (fragmentNumber); + command.sendFragment.totalLength = ENET_HOST_TO_NET_32 (packet -> dataLength); + command.sendFragment.fragmentOffset = ENET_NET_TO_HOST_32 (fragmentOffset); + + enet_peer_queue_outgoing_command (peer, & command, packet, fragmentOffset, fragmentLength); + } + + return 0; + } + + command.header.channelID = channelID; + + if (! (packet -> flags & (ENET_PACKET_FLAG_RELIABLE | ENET_PACKET_FLAG_UNSEQUENCED)) && channel -> outgoingUnreliableSequenceNumber >= 0xFFFF) + packet -> flags |= ENET_PACKET_FLAG_RELIABLE; + + if (packet -> flags & ENET_PACKET_FLAG_RELIABLE) + { + command.header.command = ENET_PROTOCOL_COMMAND_SEND_RELIABLE | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; + command.sendReliable.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength); + } + else + if (packet -> flags & ENET_PACKET_FLAG_UNSEQUENCED) + { + command.header.command = ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED | ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; + command.sendUnsequenced.unsequencedGroup = ENET_HOST_TO_NET_16 (peer -> outgoingUnsequencedGroup + 1); + command.sendUnsequenced.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength); + } + else + { + command.header.command = ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE; + command.sendUnreliable.unreliableSequenceNumber = ENET_HOST_TO_NET_16 (channel -> outgoingUnreliableSequenceNumber + 1); + command.sendUnreliable.dataLength = ENET_HOST_TO_NET_16 (packet -> dataLength); + } + + enet_peer_queue_outgoing_command (peer, & command, packet, 0, packet -> dataLength); + + return 0; +} + +/** Attempts to dequeue any incoming queued packet. + @param peer peer to dequeue packets from + @param channelID channel on which to receive + @returns a pointer to the packet, or NULL if there are no available incoming queued packets +*/ +ENetPacket * +enet_peer_receive (ENetPeer * peer, enet_uint8 channelID) +{ + ENetChannel * channel = & peer -> channels [channelID]; + ENetIncomingCommand * incomingCommand = NULL; + ENetPacket * packet; + + if (! enet_list_empty (& channel -> incomingUnreliableCommands)) + { + incomingCommand = (ENetIncomingCommand *) enet_list_front (& channel -> incomingUnreliableCommands); + + if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE) + { + if (incomingCommand -> reliableSequenceNumber != channel -> incomingReliableSequenceNumber) + incomingCommand = NULL; + } + } + + if (incomingCommand == NULL && + ! enet_list_empty (& channel -> incomingReliableCommands)) + { + incomingCommand = (ENetIncomingCommand *) enet_list_front (& channel -> incomingReliableCommands); + + if (incomingCommand -> fragmentsRemaining > 0 || + incomingCommand -> reliableSequenceNumber != (enet_uint16) (channel -> incomingReliableSequenceNumber + 1)) + return NULL; + + channel -> incomingReliableSequenceNumber = incomingCommand -> reliableSequenceNumber; + + if (incomingCommand -> fragmentCount > 0) + channel -> incomingReliableSequenceNumber += incomingCommand -> fragmentCount - 1; + } + + if (incomingCommand == NULL) + return NULL; + + enet_list_remove (& incomingCommand -> incomingCommandList); + + packet = incomingCommand -> packet; + + -- packet -> referenceCount; + + if (incomingCommand -> fragments != NULL) + enet_free (incomingCommand -> fragments); + + enet_free (incomingCommand); + + return packet; +} + +static void +enet_peer_reset_outgoing_commands (ENetList * queue) +{ + ENetOutgoingCommand * outgoingCommand; + + while (! enet_list_empty (queue)) + { + outgoingCommand = (ENetOutgoingCommand *) enet_list_remove (enet_list_begin (queue)); + + if (outgoingCommand -> packet != NULL) + { + -- outgoingCommand -> packet -> referenceCount; + + if (outgoingCommand -> packet -> referenceCount == 0) + enet_packet_destroy (outgoingCommand -> packet); + } + + enet_free (outgoingCommand); + } +} + +static void +enet_peer_reset_incoming_commands (ENetList * queue) +{ + ENetIncomingCommand * incomingCommand; + + while (! enet_list_empty (queue)) + { + incomingCommand = (ENetIncomingCommand *) enet_list_remove (enet_list_begin (queue)); + + if (incomingCommand -> packet != NULL) + { + -- incomingCommand -> packet -> referenceCount; + + if (incomingCommand -> packet -> referenceCount == 0) + enet_packet_destroy (incomingCommand -> packet); + } + + if (incomingCommand -> fragments != NULL) + enet_free (incomingCommand -> fragments); + + enet_free (incomingCommand); + } +} + +void +enet_peer_reset_queues (ENetPeer * peer) +{ + ENetChannel * channel; + + while (! enet_list_empty (& peer -> acknowledgements)) + enet_free (enet_list_remove (enet_list_begin (& peer -> acknowledgements))); + + enet_peer_reset_outgoing_commands (& peer -> sentReliableCommands); + enet_peer_reset_outgoing_commands (& peer -> sentUnreliableCommands); + enet_peer_reset_outgoing_commands (& peer -> outgoingReliableCommands); + enet_peer_reset_outgoing_commands (& peer -> outgoingUnreliableCommands); + + if (peer -> channels != NULL && peer -> channelCount > 0) + { + for (channel = peer -> channels; + channel < & peer -> channels [peer -> channelCount]; + ++ channel) + { + enet_peer_reset_incoming_commands (& channel -> incomingReliableCommands); + enet_peer_reset_incoming_commands (& channel -> incomingUnreliableCommands); + } + + enet_free (peer -> channels); + } + + peer -> channels = NULL; + peer -> channelCount = 0; +} + +/** Forcefully disconnects a peer. + @param peer peer to forcefully disconnect + @remarks The foreign host represented by the peer is not notified of the disconnection and will timeout + on its connection to the local host. +*/ +void +enet_peer_reset (ENetPeer * peer) +{ + peer -> outgoingPeerID = ENET_PROTOCOL_MAXIMUM_PEER_ID; + peer -> sessionID = 0; + + peer -> state = ENET_PEER_STATE_DISCONNECTED; + + peer -> incomingBandwidth = 0; + peer -> outgoingBandwidth = 0; + peer -> incomingBandwidthThrottleEpoch = 0; + peer -> outgoingBandwidthThrottleEpoch = 0; + peer -> incomingDataTotal = 0; + peer -> outgoingDataTotal = 0; + peer -> lastSendTime = 0; + peer -> lastReceiveTime = 0; + peer -> nextTimeout = 0; + peer -> earliestTimeout = 0; + peer -> packetLossEpoch = 0; + peer -> packetsSent = 0; + peer -> packetsLost = 0; + peer -> packetLoss = 0; + peer -> packetLossVariance = 0; + peer -> packetThrottle = ENET_PEER_DEFAULT_PACKET_THROTTLE; + peer -> packetThrottleLimit = ENET_PEER_PACKET_THROTTLE_SCALE; + peer -> packetThrottleCounter = 0; + peer -> packetThrottleEpoch = 0; + peer -> packetThrottleAcceleration = ENET_PEER_PACKET_THROTTLE_ACCELERATION; + peer -> packetThrottleDeceleration = ENET_PEER_PACKET_THROTTLE_DECELERATION; + peer -> packetThrottleInterval = ENET_PEER_PACKET_THROTTLE_INTERVAL; + peer -> lastRoundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME; + peer -> lowestRoundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME; + peer -> lastRoundTripTimeVariance = 0; + peer -> highestRoundTripTimeVariance = 0; + peer -> roundTripTime = ENET_PEER_DEFAULT_ROUND_TRIP_TIME; + peer -> roundTripTimeVariance = 0; + peer -> mtu = peer -> host -> mtu; + peer -> reliableDataInTransit = 0; + peer -> outgoingReliableSequenceNumber = 0; + peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + peer -> incomingUnsequencedGroup = 0; + peer -> outgoingUnsequencedGroup = 0; + peer -> disconnectData = 0; + + memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow)); + + enet_peer_reset_queues (peer); +} + +/** Sends a ping request to a peer. + @param peer destination for the ping request + @remarks ping requests factor into the mean round trip time as designated by the + roundTripTime field in the ENetPeer structure. Enet automatically pings all connected + peers at regular intervals, however, this function may be called to ensure more + frequent ping requests. +*/ +void +enet_peer_ping (ENetPeer * peer) +{ + ENetProtocol command; + + if (peer -> state != ENET_PEER_STATE_CONNECTED) + return; + + command.header.command = ENET_PROTOCOL_COMMAND_PING | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; + command.header.channelID = 0xFF; + + enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); +} + +/** Force an immediate disconnection from a peer. + @param peer peer to disconnect + @param data data describing the disconnection + @remarks No ENET_EVENT_DISCONNECT event will be generated. The foreign peer is not + guarenteed to receive the disconnect notification, and is reset immediately upon + return from this function. +*/ +void +enet_peer_disconnect_now (ENetPeer * peer, enet_uint32 data) +{ + ENetProtocol command; + + if (peer -> state == ENET_PEER_STATE_DISCONNECTED) + return; + + if (peer -> state != ENET_PEER_STATE_ZOMBIE && + peer -> state != ENET_PEER_STATE_DISCONNECTING) + { + enet_peer_reset_queues (peer); + + command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT | ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; + command.header.channelID = 0xFF; + command.disconnect.data = ENET_HOST_TO_NET_32 (data); + + enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); + + enet_host_flush (peer -> host); + } + + enet_peer_reset (peer); +} + +/** Request a disconnection from a peer. + @param peer peer to request a disconnection + @param data data describing the disconnection + @remarks An ENET_EVENT_DISCONNECT event will be generated by enet_host_service() + once the disconnection is complete. +*/ +void +enet_peer_disconnect (ENetPeer * peer, enet_uint32 data) +{ + ENetProtocol command; + + if (peer -> state == ENET_PEER_STATE_DISCONNECTING || + peer -> state == ENET_PEER_STATE_DISCONNECTED || + peer -> state == ENET_PEER_STATE_ZOMBIE) + return; + + enet_peer_reset_queues (peer); + + command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT; + command.header.channelID = 0xFF; + command.disconnect.data = ENET_HOST_TO_NET_32 (data); + + if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) + command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; + else + command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; + + enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); + + if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) + peer -> state = ENET_PEER_STATE_DISCONNECTING; + else + { + enet_host_flush (peer -> host); + enet_peer_reset (peer); + } +} + +/** Request a disconnection from a peer, but only after all queued outgoing packets are sent. + @param peer peer to request a disconnection + @param data data describing the disconnection + @remarks An ENET_EVENT_DISCONNECT event will be generated by enet_host_service() + once the disconnection is complete. +*/ +void +enet_peer_disconnect_later (ENetPeer * peer, enet_uint32 data) +{ + if ((peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) && + ! (enet_list_empty (& peer -> outgoingReliableCommands) && + enet_list_empty (& peer -> outgoingUnreliableCommands) && + enet_list_empty (& peer -> sentReliableCommands))) + { + peer -> state = ENET_PEER_STATE_DISCONNECT_LATER; + peer -> disconnectData = data; + } + else + enet_peer_disconnect (peer, data); +} + +ENetAcknowledgement * +enet_peer_queue_acknowledgement (ENetPeer * peer, const ENetProtocol * command, enet_uint16 sentTime) +{ + ENetAcknowledgement * acknowledgement; + + if (command -> header.channelID < peer -> channelCount) + { + ENetChannel * channel = & peer -> channels [command -> header.channelID]; + enet_uint16 reliableWindow = command -> header.reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE, + currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; + + if (command -> header.reliableSequenceNumber < channel -> incomingReliableSequenceNumber) + reliableWindow += ENET_PEER_RELIABLE_WINDOWS; + + if (reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1 && reliableWindow <= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS) + return NULL; + } + + peer -> outgoingDataTotal += sizeof (ENetProtocolAcknowledge); + + acknowledgement = (ENetAcknowledgement *) enet_malloc (sizeof (ENetAcknowledgement)); + + acknowledgement -> sentTime = sentTime; + acknowledgement -> command = * command; + + enet_list_insert (enet_list_end (& peer -> acknowledgements), acknowledgement); + + return acknowledgement; +} + +ENetOutgoingCommand * +enet_peer_queue_outgoing_command (ENetPeer * peer, const ENetProtocol * command, ENetPacket * packet, enet_uint32 offset, enet_uint16 length) +{ + ENetChannel * channel = & peer -> channels [command -> header.channelID]; + ENetOutgoingCommand * outgoingCommand; + + peer -> outgoingDataTotal += enet_protocol_command_size (command -> header.command) + length; + + outgoingCommand = (ENetOutgoingCommand *) enet_malloc (sizeof (ENetOutgoingCommand)); + + if (command -> header.channelID == 0xFF) + { + ++ peer -> outgoingReliableSequenceNumber; + + outgoingCommand -> reliableSequenceNumber = peer -> outgoingReliableSequenceNumber; + outgoingCommand -> unreliableSequenceNumber = 0; + } + else + if (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) + { + ++ channel -> outgoingReliableSequenceNumber; + channel -> outgoingUnreliableSequenceNumber = 0; + + outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber; + outgoingCommand -> unreliableSequenceNumber = 0; + } + else + if (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED) + { + ++ peer -> outgoingUnsequencedGroup; + + outgoingCommand -> reliableSequenceNumber = 0; + outgoingCommand -> unreliableSequenceNumber = 0; + } + else + { + ++ channel -> outgoingUnreliableSequenceNumber; + + outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber; + outgoingCommand -> unreliableSequenceNumber = channel -> outgoingUnreliableSequenceNumber; + } + + outgoingCommand -> sendAttempts = 0; + outgoingCommand -> sentTime = 0; + outgoingCommand -> roundTripTimeout = 0; + outgoingCommand -> roundTripTimeoutLimit = 0; + outgoingCommand -> fragmentOffset = offset; + outgoingCommand -> fragmentLength = length; + outgoingCommand -> packet = packet; + outgoingCommand -> command = * command; + outgoingCommand -> command.header.reliableSequenceNumber = ENET_HOST_TO_NET_16 (outgoingCommand -> reliableSequenceNumber); + + if (packet != NULL) + ++ packet -> referenceCount; + + if (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) + enet_list_insert (enet_list_end (& peer -> outgoingReliableCommands), outgoingCommand); + else + enet_list_insert (enet_list_end (& peer -> outgoingUnreliableCommands), outgoingCommand); + + return outgoingCommand; +} + +ENetIncomingCommand * +enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command, ENetPacket * packet, enet_uint32 fragmentCount) +{ + ENetChannel * channel = & peer -> channels [command -> header.channelID]; + enet_uint32 unreliableSequenceNumber = 0, reliableSequenceNumber; + enet_uint16 reliableWindow, currentWindow; + ENetIncomingCommand * incomingCommand; + ENetListIterator currentCommand; + + if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) + goto freePacket; + + if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED) + { + reliableSequenceNumber = command -> header.reliableSequenceNumber; + reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; + currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; + + if (reliableSequenceNumber < channel -> incomingReliableSequenceNumber) + reliableWindow += ENET_PEER_RELIABLE_WINDOWS; + + if (reliableWindow < currentWindow || reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1) + goto freePacket; + } + + switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK) + { + case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: + case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: + if (reliableSequenceNumber == channel -> incomingReliableSequenceNumber) + goto freePacket; + + for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands)); + currentCommand != enet_list_end (& channel -> incomingReliableCommands); + currentCommand = enet_list_previous (currentCommand)) + { + incomingCommand = (ENetIncomingCommand *) currentCommand; + + if (reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) + { + if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) + continue; + } + else + if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) + break; + + if (incomingCommand -> reliableSequenceNumber <= reliableSequenceNumber) + { + if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber) + break; + + goto freePacket; + } + } + break; + + case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE: + unreliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendUnreliable.unreliableSequenceNumber); + + for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingUnreliableCommands)); + currentCommand != enet_list_end (& channel -> incomingUnreliableCommands); + currentCommand = enet_list_previous (currentCommand)) + { + incomingCommand = (ENetIncomingCommand *) currentCommand; + + if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE) + continue; + + if (reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) + { + if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) + continue; + } + else + if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) + break; + + if (incomingCommand -> reliableSequenceNumber < reliableSequenceNumber) + break; + + if (incomingCommand -> reliableSequenceNumber > reliableSequenceNumber) + continue; + + if (incomingCommand -> unreliableSequenceNumber <= unreliableSequenceNumber) + { + if (incomingCommand -> unreliableSequenceNumber < unreliableSequenceNumber) + break; + + goto freePacket; + } + } + break; + + case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED: + currentCommand = enet_list_end (& channel -> incomingUnreliableCommands); + break; + + default: + goto freePacket; + } + + incomingCommand = (ENetIncomingCommand *) enet_malloc (sizeof (ENetIncomingCommand)); + + incomingCommand -> reliableSequenceNumber = command -> header.reliableSequenceNumber; + incomingCommand -> unreliableSequenceNumber = unreliableSequenceNumber & 0xFFFF; + incomingCommand -> command = * command; + incomingCommand -> fragmentCount = fragmentCount; + incomingCommand -> fragmentsRemaining = fragmentCount; + incomingCommand -> packet = packet; + incomingCommand -> fragments = NULL; + + if (fragmentCount > 0) + { + incomingCommand -> fragments = (enet_uint32 *) enet_malloc ((fragmentCount + 31) / 32 * sizeof (enet_uint32)); + memset (incomingCommand -> fragments, 0, (fragmentCount + 31) / 32 * sizeof (enet_uint32)); + } + + if (packet != NULL) + ++ packet -> referenceCount; + + enet_list_insert (enet_list_next (currentCommand), incomingCommand); + + return incomingCommand; + +freePacket: + if (packet != NULL) + { + if (packet -> referenceCount == 0) + enet_packet_destroy (packet); + } + + return NULL; +} + +/** @} */ diff --git a/src/enet/protocol.c b/src/enet/protocol.c new file mode 100644 index 0000000..af82fd6 --- /dev/null +++ b/src/enet/protocol.c @@ -0,0 +1,1574 @@ +/** + @file protocol.c + @brief ENet protocol functions +*/ +#include +#include +#define ENET_BUILDING_LIB 1 +#include "enet/utility.h" +#include "enet/time.h" +#include "enet/enet.h" + +static size_t commandSizes [ENET_PROTOCOL_COMMAND_COUNT] = +{ + 0, + sizeof (ENetProtocolAcknowledge), + sizeof (ENetProtocolConnect), + sizeof (ENetProtocolVerifyConnect), + sizeof (ENetProtocolDisconnect), + sizeof (ENetProtocolPing), + sizeof (ENetProtocolSendReliable), + sizeof (ENetProtocolSendUnreliable), + sizeof (ENetProtocolSendFragment), + sizeof (ENetProtocolSendUnsequenced), + sizeof (ENetProtocolBandwidthLimit), + sizeof (ENetProtocolThrottleConfigure), +}; + +size_t +enet_protocol_command_size (enet_uint8 commandNumber) +{ + return commandSizes [commandNumber & ENET_PROTOCOL_COMMAND_MASK]; +} + +static int +enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event) +{ + ENetPeer * currentPeer = host -> lastServicedPeer; + ENetChannel * channel; + + do + { + ++ currentPeer; + + if (currentPeer >= & host -> peers [host -> peerCount]) + currentPeer = host -> peers; + + switch (currentPeer -> state) + { + case ENET_PEER_STATE_CONNECTION_PENDING: + case ENET_PEER_STATE_CONNECTION_SUCCEEDED: + currentPeer -> state = ENET_PEER_STATE_CONNECTED; + + event -> type = ENET_EVENT_TYPE_CONNECT; + event -> peer = currentPeer; + + return 1; + + case ENET_PEER_STATE_ZOMBIE: + host -> recalculateBandwidthLimits = 1; + + event -> type = ENET_EVENT_TYPE_DISCONNECT; + event -> peer = currentPeer; + event -> data = currentPeer -> disconnectData; + + enet_peer_reset (currentPeer); + + host -> lastServicedPeer = currentPeer; + + return 1; + } + + if (currentPeer -> state != ENET_PEER_STATE_CONNECTED) + continue; + + for (channel = currentPeer -> channels; + channel < & currentPeer -> channels [currentPeer -> channelCount]; + ++ channel) + { + if (enet_list_empty (& channel -> incomingReliableCommands) && + enet_list_empty (& channel -> incomingUnreliableCommands)) + continue; + + event -> packet = enet_peer_receive (currentPeer, channel - currentPeer -> channels); + if (event -> packet == NULL) + continue; + + event -> type = ENET_EVENT_TYPE_RECEIVE; + event -> peer = currentPeer; + event -> channelID = (enet_uint8) (channel - currentPeer -> channels); + + host -> lastServicedPeer = currentPeer; + + return 1; + } + } while (currentPeer != host -> lastServicedPeer); + + return 0; +} + +static void +enet_protocol_notify_connect (ENetHost * host, ENetPeer * peer, ENetEvent * event) +{ + host -> recalculateBandwidthLimits = 1; + + if (event == NULL) + peer -> state = (peer -> state == ENET_PEER_STATE_CONNECTING ? ENET_PEER_STATE_CONNECTION_SUCCEEDED : ENET_PEER_STATE_CONNECTION_PENDING); + else + { + peer -> state = ENET_PEER_STATE_CONNECTED; + + event -> type = ENET_EVENT_TYPE_CONNECT; + event -> peer = peer; + } +} + +static void +enet_protocol_notify_disconnect (ENetHost * host, ENetPeer * peer, ENetEvent * event) +{ + if (peer -> state >= ENET_PEER_STATE_CONNECTION_PENDING) + host -> recalculateBandwidthLimits = 1; + + if (peer -> state != ENET_PEER_STATE_CONNECTING && peer -> state < ENET_PEER_STATE_CONNECTION_SUCCEEDED) + enet_peer_reset (peer); + else + if (event == NULL) + peer -> state = ENET_PEER_STATE_ZOMBIE; + else + { + event -> type = ENET_EVENT_TYPE_DISCONNECT; + event -> peer = peer; + event -> data = 0; + + enet_peer_reset (peer); + } +} + +static void +enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer) +{ + ENetOutgoingCommand * outgoingCommand; + + while (! enet_list_empty (& peer -> sentUnreliableCommands)) + { + outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentUnreliableCommands); + + enet_list_remove (& outgoingCommand -> outgoingCommandList); + + if (outgoingCommand -> packet != NULL) + { + -- outgoingCommand -> packet -> referenceCount; + + if (outgoingCommand -> packet -> referenceCount == 0) + enet_packet_destroy (outgoingCommand -> packet); + } + + enet_free (outgoingCommand); + } +} + +static ENetProtocolCommand +enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliableSequenceNumber, enet_uint8 channelID) +{ + ENetOutgoingCommand * outgoingCommand; + ENetListIterator currentCommand; + ENetProtocolCommand commandNumber; + + for (currentCommand = enet_list_begin (& peer -> sentReliableCommands); + currentCommand != enet_list_end (& peer -> sentReliableCommands); + currentCommand = enet_list_next (currentCommand)) + { + outgoingCommand = (ENetOutgoingCommand *) currentCommand; + + if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber && + outgoingCommand -> command.header.channelID == channelID) + break; + } + + if (currentCommand == enet_list_end (& peer -> sentReliableCommands)) + { + for (currentCommand = enet_list_begin (& peer -> outgoingReliableCommands); + currentCommand != enet_list_end (& peer -> outgoingReliableCommands); + currentCommand = enet_list_next (currentCommand)) + { + outgoingCommand = (ENetOutgoingCommand *) currentCommand; + + if (outgoingCommand -> sendAttempts < 1) return ENET_PROTOCOL_COMMAND_NONE; + + if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber && + outgoingCommand -> command.header.channelID == channelID) + break; + } + + if (currentCommand == enet_list_end (& peer -> outgoingReliableCommands)) + return ENET_PROTOCOL_COMMAND_NONE; + } + + if (channelID < peer -> channelCount) + { + ENetChannel * channel = & peer -> channels [channelID]; + enet_uint16 reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; + if (channel -> reliableWindows [reliableWindow] > 0) + { + -- channel -> reliableWindows [reliableWindow]; + if (! channel -> reliableWindows [reliableWindow]) + channel -> usedReliableWindows &= ~ (1 << reliableWindow); + } + } + + commandNumber = (ENetProtocolCommand) (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK); + + enet_list_remove (& outgoingCommand -> outgoingCommandList); + + if (outgoingCommand -> packet != NULL) + { + peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; + + -- outgoingCommand -> packet -> referenceCount; + + if (outgoingCommand -> packet -> referenceCount == 0) + enet_packet_destroy (outgoingCommand -> packet); + } + + enet_free (outgoingCommand); + + if (enet_list_empty (& peer -> sentReliableCommands)) + return commandNumber; + + outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentReliableCommands); + + peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout; + + return commandNumber; +} + +static ENetPeer * +enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENetProtocol * command) +{ + enet_uint16 mtu; + enet_uint32 windowSize; + ENetChannel * channel; + size_t channelCount; + ENetPeer * currentPeer; + ENetProtocol verifyCommand; + +#ifdef USE_CRC32 + { + enet_uint32 crc = header -> checksum; + ENetBuffer buffer; + + command -> header.reliableSequenceNumber = ENET_HOST_TO_NET_16 (command -> header.reliableSequenceNumber); + + header -> checksum = command -> connect.sessionID; + + buffer.data = host -> receivedData; + buffer.dataLength = host -> receivedDataLength; + + if (enet_crc32 (& buffer, 1) != crc) + return NULL; + + command -> header.reliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> header.reliableSequenceNumber); + } +#endif + + channelCount = ENET_NET_TO_HOST_32 (command -> connect.channelCount); + + if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT || + channelCount > ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT) + return NULL; + + for (currentPeer = host -> peers; + currentPeer < & host -> peers [host -> peerCount]; + ++ currentPeer) + { + if (currentPeer -> state != ENET_PEER_STATE_DISCONNECTED && + currentPeer -> address.host == host -> receivedAddress.host && + currentPeer -> address.port == host -> receivedAddress.port && + currentPeer -> sessionID == command -> connect.sessionID) + return NULL; + } + + for (currentPeer = host -> peers; + currentPeer < & host -> peers [host -> peerCount]; + ++ currentPeer) + { + if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED) + break; + } + + if (currentPeer >= & host -> peers [host -> peerCount]) + return NULL; + + currentPeer -> state = ENET_PEER_STATE_ACKNOWLEDGING_CONNECT; + currentPeer -> sessionID = command -> connect.sessionID; + currentPeer -> address = host -> receivedAddress; + currentPeer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> connect.outgoingPeerID); + currentPeer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> connect.incomingBandwidth); + currentPeer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> connect.outgoingBandwidth); + currentPeer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleInterval); + currentPeer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleAcceleration); + currentPeer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> connect.packetThrottleDeceleration); + currentPeer -> channels = (ENetChannel *) enet_malloc (channelCount * sizeof (ENetChannel)); + currentPeer -> channelCount = channelCount; + + for (channel = currentPeer -> channels; + channel < & currentPeer -> channels [channelCount]; + ++ channel) + { + channel -> outgoingReliableSequenceNumber = 0; + channel -> outgoingUnreliableSequenceNumber = 0; + channel -> incomingReliableSequenceNumber = 0; + + enet_list_clear (& channel -> incomingReliableCommands); + enet_list_clear (& channel -> incomingUnreliableCommands); + + channel -> usedReliableWindows = 0; + memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows)); + } + + mtu = ENET_NET_TO_HOST_16 (command -> connect.mtu); + + if (mtu < ENET_PROTOCOL_MINIMUM_MTU) + mtu = ENET_PROTOCOL_MINIMUM_MTU; + else + if (mtu > ENET_PROTOCOL_MAXIMUM_MTU) + mtu = ENET_PROTOCOL_MAXIMUM_MTU; + + currentPeer -> mtu = mtu; + + if (host -> outgoingBandwidth == 0 && + currentPeer -> incomingBandwidth == 0) + currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + else + if (host -> outgoingBandwidth == 0 || + currentPeer -> incomingBandwidth == 0) + currentPeer -> windowSize = (ENET_MAX (host -> outgoingBandwidth, currentPeer -> incomingBandwidth) / + ENET_PEER_WINDOW_SIZE_SCALE) * + ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + else + currentPeer -> windowSize = (ENET_MIN (host -> outgoingBandwidth, currentPeer -> incomingBandwidth) / + ENET_PEER_WINDOW_SIZE_SCALE) * + ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + + if (currentPeer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) + currentPeer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + else + if (currentPeer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) + currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + + if (host -> incomingBandwidth == 0) + windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + else + windowSize = (host -> incomingBandwidth / ENET_PEER_WINDOW_SIZE_SCALE) * + ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + + if (windowSize > ENET_NET_TO_HOST_32 (command -> connect.windowSize)) + windowSize = ENET_NET_TO_HOST_32 (command -> connect.windowSize); + + if (windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) + windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + else + if (windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) + windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + + verifyCommand.header.command = ENET_PROTOCOL_COMMAND_VERIFY_CONNECT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; + verifyCommand.header.channelID = 0xFF; + verifyCommand.verifyConnect.outgoingPeerID = ENET_HOST_TO_NET_16 (currentPeer -> incomingPeerID); + verifyCommand.verifyConnect.mtu = ENET_HOST_TO_NET_16 (currentPeer -> mtu); + verifyCommand.verifyConnect.windowSize = ENET_HOST_TO_NET_32 (windowSize); + verifyCommand.verifyConnect.channelCount = ENET_HOST_TO_NET_32 (channelCount); + verifyCommand.verifyConnect.incomingBandwidth = ENET_HOST_TO_NET_32 (host -> incomingBandwidth); + verifyCommand.verifyConnect.outgoingBandwidth = ENET_HOST_TO_NET_32 (host -> outgoingBandwidth); + verifyCommand.verifyConnect.packetThrottleInterval = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleInterval); + verifyCommand.verifyConnect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleAcceleration); + verifyCommand.verifyConnect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleDeceleration); + + enet_peer_queue_outgoing_command (currentPeer, & verifyCommand, NULL, 0, 0); + + return currentPeer; +} + +static int +enet_protocol_handle_send_reliable (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) +{ + ENetPacket * packet; + size_t dataLength; + + if (command -> header.channelID >= peer -> channelCount || + (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) + return -1; + + dataLength = ENET_NET_TO_HOST_16 (command -> sendReliable.dataLength); + * currentData += dataLength; + if (* currentData > & host -> receivedData [host -> receivedDataLength]) + return -1; + + packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendReliable), + dataLength, + ENET_PACKET_FLAG_RELIABLE); + if (packet == NULL) + return -1; + + enet_peer_queue_incoming_command (peer, command, packet, 0); + return 0; +} + +static int +enet_protocol_handle_send_unsequenced (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) +{ + ENetPacket * packet; + enet_uint32 unsequencedGroup, index; + size_t dataLength; + + if (command -> header.channelID >= peer -> channelCount || + (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) + return -1; + + dataLength = ENET_NET_TO_HOST_16 (command -> sendUnsequenced.dataLength); + * currentData += dataLength; + if (* currentData > & host -> receivedData [host -> receivedDataLength]) + return -1; + + unsequencedGroup = ENET_NET_TO_HOST_16 (command -> sendUnsequenced.unsequencedGroup); + index = unsequencedGroup % ENET_PEER_UNSEQUENCED_WINDOW_SIZE; + + if (unsequencedGroup < peer -> incomingUnsequencedGroup) + unsequencedGroup += 0x10000; + + if (unsequencedGroup >= (enet_uint32) peer -> incomingUnsequencedGroup + ENET_PEER_FREE_UNSEQUENCED_WINDOWS * ENET_PEER_UNSEQUENCED_WINDOW_SIZE) + return 0; + + unsequencedGroup &= 0xFFFF; + + if (unsequencedGroup - index != peer -> incomingUnsequencedGroup) + { + peer -> incomingUnsequencedGroup = unsequencedGroup - index; + + memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow)); + } + else + if (peer -> unsequencedWindow [index / 32] & (1 << (index % 32))) + return 0; + + peer -> unsequencedWindow [index / 32] |= 1 << (index % 32); + + + packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendUnsequenced), + dataLength, + ENET_PACKET_FLAG_UNSEQUENCED); + if (packet == NULL) + return -1; + + enet_peer_queue_incoming_command (peer, command, packet, 0); + return 0; +} + +static int +enet_protocol_handle_send_unreliable (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) +{ + ENetPacket * packet; + size_t dataLength; + + if (command -> header.channelID >= peer -> channelCount || + (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) + return -1; + + dataLength = ENET_NET_TO_HOST_16 (command -> sendUnreliable.dataLength); + * currentData += dataLength; + if (* currentData > & host -> receivedData [host -> receivedDataLength]) + return -1; + + packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendUnreliable), + dataLength, + 0); + if (packet == NULL) + return -1; + + enet_peer_queue_incoming_command (peer, command, packet, 0); + return 0; +} + +static int +enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENetProtocol * command, enet_uint8 ** currentData) +{ + enet_uint32 fragmentNumber, + fragmentCount, + fragmentOffset, + fragmentLength, + startSequenceNumber, + totalLength; + ENetChannel * channel; + enet_uint16 startWindow, currentWindow; + ENetListIterator currentCommand; + ENetIncomingCommand * startCommand = NULL; + + if (command -> header.channelID >= peer -> channelCount || + (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER)) + return -1; + + fragmentLength = ENET_NET_TO_HOST_16 (command -> sendFragment.dataLength); + * currentData += fragmentLength; + if (* currentData > & host -> receivedData [host -> receivedDataLength]) + return -1; + + channel = & peer -> channels [command -> header.channelID]; + startSequenceNumber = ENET_NET_TO_HOST_16 (command -> sendFragment.startSequenceNumber); + startWindow = startSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; + currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; + + if (startSequenceNumber < channel -> incomingReliableSequenceNumber) + startWindow += ENET_PEER_RELIABLE_WINDOWS; + + if (startWindow < currentWindow || startWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1) + return 0; + + fragmentNumber = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentNumber); + fragmentCount = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentCount); + fragmentOffset = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentOffset); + totalLength = ENET_NET_TO_HOST_32 (command -> sendFragment.totalLength); + + if (fragmentOffset >= totalLength || + fragmentOffset + fragmentLength > totalLength || + fragmentNumber >= fragmentCount) + return -1; + + for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands)); + currentCommand != enet_list_end (& channel -> incomingReliableCommands); + currentCommand = enet_list_previous (currentCommand)) + { + ENetIncomingCommand * incomingCommand = (ENetIncomingCommand *) currentCommand; + + if (startSequenceNumber >= channel -> incomingReliableSequenceNumber) + { + if (incomingCommand -> reliableSequenceNumber < channel -> incomingReliableSequenceNumber) + continue; + } + else + if (incomingCommand -> reliableSequenceNumber >= channel -> incomingReliableSequenceNumber) + break; + + if (incomingCommand -> reliableSequenceNumber <= startSequenceNumber) + { + if (incomingCommand -> reliableSequenceNumber < startSequenceNumber) + break; + + if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_FRAGMENT || + totalLength != incomingCommand -> packet -> dataLength || + fragmentCount != incomingCommand -> fragmentCount) + return -1; + + startCommand = incomingCommand; + break; + } + } + + if (startCommand == NULL) + { + ENetProtocol hostCommand = * command; + ENetPacket * packet = enet_packet_create (NULL, totalLength, ENET_PACKET_FLAG_RELIABLE); + if (packet == NULL) + return -1; + + hostCommand.header.reliableSequenceNumber = startSequenceNumber; + hostCommand.sendFragment.startSequenceNumber = startSequenceNumber; + hostCommand.sendFragment.dataLength = fragmentLength; + hostCommand.sendFragment.fragmentNumber = fragmentNumber; + hostCommand.sendFragment.fragmentCount = fragmentCount; + hostCommand.sendFragment.fragmentOffset = fragmentOffset; + hostCommand.sendFragment.totalLength = totalLength; + + startCommand = enet_peer_queue_incoming_command (peer, & hostCommand, packet, fragmentCount); + if (startCommand == NULL) + return -1; + } + + if ((startCommand -> fragments [fragmentNumber / 32] & (1 << (fragmentNumber % 32))) == 0) + { + -- startCommand -> fragmentsRemaining; + + startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber % 32)); + + if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength) + fragmentLength = startCommand -> packet -> dataLength - fragmentOffset; + + memcpy (startCommand -> packet -> data + fragmentOffset, + (enet_uint8 *) command + sizeof (ENetProtocolSendFragment), + fragmentLength); + } + + return 0; +} + +static int +enet_protocol_handle_ping (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) +{ + return 0; +} + +static int +enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) +{ + peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.incomingBandwidth); + peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.outgoingBandwidth); + + if (peer -> incomingBandwidth == 0 && host -> outgoingBandwidth == 0) + peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + else + peer -> windowSize = (ENET_MIN (peer -> incomingBandwidth, host -> outgoingBandwidth) / + ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + + if (peer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) + peer -> windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + else + if (peer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) + peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + + return 0; +} + +static int +enet_protocol_handle_throttle_configure (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) +{ + peer -> packetThrottleInterval = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleInterval); + peer -> packetThrottleAcceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleAcceleration); + peer -> packetThrottleDeceleration = ENET_NET_TO_HOST_32 (command -> throttleConfigure.packetThrottleDeceleration); + + return 0; +} + +static int +enet_protocol_handle_disconnect (ENetHost * host, ENetPeer * peer, const ENetProtocol * command) +{ + enet_peer_reset_queues (peer); + + if (peer -> state == ENET_PEER_STATE_CONNECTION_SUCCEEDED) + peer -> state = ENET_PEER_STATE_ZOMBIE; + else + if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) + { + if (peer -> state == ENET_PEER_STATE_CONNECTION_PENDING) host -> recalculateBandwidthLimits = 1; + + enet_peer_reset (peer); + } + else + if (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) + peer -> state = ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT; + else + peer -> state = ENET_PEER_STATE_ZOMBIE; + + peer -> disconnectData = ENET_NET_TO_HOST_32 (command -> disconnect.data); + return 0; +} + +static int +enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer * peer, const ENetProtocol * command) +{ + enet_uint32 roundTripTime, + receivedSentTime, + receivedReliableSequenceNumber; + ENetProtocolCommand commandNumber; + + receivedSentTime = ENET_NET_TO_HOST_16 (command -> acknowledge.receivedSentTime); + receivedSentTime |= host -> serviceTime & 0xFFFF0000; + if ((receivedSentTime & 0x8000) > (host -> serviceTime & 0x8000)) + receivedSentTime -= 0x10000; + + if (ENET_TIME_LESS (host -> serviceTime, receivedSentTime)) + return 0; + + peer -> lastReceiveTime = host -> serviceTime; + peer -> earliestTimeout = 0; + + roundTripTime = ENET_TIME_DIFFERENCE (host -> serviceTime, receivedSentTime); + + enet_peer_throttle (peer, roundTripTime); + + peer -> roundTripTimeVariance -= peer -> roundTripTimeVariance / 4; + + if (roundTripTime >= peer -> roundTripTime) + { + peer -> roundTripTime += (roundTripTime - peer -> roundTripTime) / 8; + peer -> roundTripTimeVariance += (roundTripTime - peer -> roundTripTime) / 4; + } + else + { + peer -> roundTripTime -= (peer -> roundTripTime - roundTripTime) / 8; + peer -> roundTripTimeVariance += (peer -> roundTripTime - roundTripTime) / 4; + } + + if (peer -> roundTripTime < peer -> lowestRoundTripTime) + peer -> lowestRoundTripTime = peer -> roundTripTime; + + if (peer -> roundTripTimeVariance > peer -> highestRoundTripTimeVariance) + peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance; + + if (peer -> packetThrottleEpoch == 0 || + ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> packetThrottleEpoch) >= peer -> packetThrottleInterval) + { + peer -> lastRoundTripTime = peer -> lowestRoundTripTime; + peer -> lastRoundTripTimeVariance = peer -> highestRoundTripTimeVariance; + peer -> lowestRoundTripTime = peer -> roundTripTime; + peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance; + peer -> packetThrottleEpoch = host -> serviceTime; + } + + receivedReliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> acknowledge.receivedReliableSequenceNumber); + + commandNumber = enet_protocol_remove_sent_reliable_command (peer, receivedReliableSequenceNumber, command -> header.channelID); + + switch (peer -> state) + { + case ENET_PEER_STATE_ACKNOWLEDGING_CONNECT: + if (commandNumber != ENET_PROTOCOL_COMMAND_VERIFY_CONNECT) + return -1; + + enet_protocol_notify_connect (host, peer, event); + break; + + case ENET_PEER_STATE_DISCONNECTING: + if (commandNumber != ENET_PROTOCOL_COMMAND_DISCONNECT) + return -1; + + enet_protocol_notify_disconnect (host, peer, event); + break; + + case ENET_PEER_STATE_DISCONNECT_LATER: + if (enet_list_empty (& peer -> outgoingReliableCommands) && + enet_list_empty (& peer -> outgoingUnreliableCommands) && + enet_list_empty (& peer -> sentReliableCommands)) + enet_peer_disconnect (peer, peer -> disconnectData); + break; + } + + return 0; +} + +static int +enet_protocol_handle_verify_connect (ENetHost * host, ENetEvent * event, ENetPeer * peer, const ENetProtocol * command) +{ + enet_uint16 mtu; + enet_uint32 windowSize; + + if (peer -> state != ENET_PEER_STATE_CONNECTING) + return 0; + + if (ENET_NET_TO_HOST_32 (command -> verifyConnect.channelCount) != peer -> channelCount || + ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleInterval) != peer -> packetThrottleInterval || + ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleAcceleration) != peer -> packetThrottleAcceleration || + ENET_NET_TO_HOST_32 (command -> verifyConnect.packetThrottleDeceleration) != peer -> packetThrottleDeceleration) + { + peer -> state = ENET_PEER_STATE_ZOMBIE; + + return -1; + } + + enet_protocol_remove_sent_reliable_command (peer, 1, 0xFF); + + peer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> verifyConnect.outgoingPeerID); + + mtu = ENET_NET_TO_HOST_16 (command -> verifyConnect.mtu); + + if (mtu < ENET_PROTOCOL_MINIMUM_MTU) + mtu = ENET_PROTOCOL_MINIMUM_MTU; + else + if (mtu > ENET_PROTOCOL_MAXIMUM_MTU) + mtu = ENET_PROTOCOL_MAXIMUM_MTU; + + if (mtu < peer -> mtu) + peer -> mtu = mtu; + + windowSize = ENET_NET_TO_HOST_32 (command -> verifyConnect.windowSize); + + if (windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) + windowSize = ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + + if (windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) + windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; + + if (windowSize < peer -> windowSize) + peer -> windowSize = windowSize; + + peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> verifyConnect.incomingBandwidth); + peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> verifyConnect.outgoingBandwidth); + + enet_protocol_notify_connect (host, peer, event); + return 0; +} + +static int +enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) +{ + ENetProtocolHeader * header; + ENetProtocol * command; + ENetPeer * peer; + enet_uint8 * currentData; + size_t headerSize; + enet_uint16 peerID, flags; + + if (host -> receivedDataLength < sizeof (ENetProtocolHeader)) + return 0; + + header = (ENetProtocolHeader *) host -> receivedData; + + peerID = ENET_NET_TO_HOST_16 (header -> peerID); + flags = peerID & ENET_PROTOCOL_HEADER_FLAG_MASK; + peerID &= ~ ENET_PROTOCOL_HEADER_FLAG_MASK; + + if (peerID == ENET_PROTOCOL_MAXIMUM_PEER_ID) + peer = NULL; + else + if (peerID >= host -> peerCount) + return 0; + else + { + peer = & host -> peers [peerID]; + + if (peer -> state == ENET_PEER_STATE_DISCONNECTED || + peer -> state == ENET_PEER_STATE_ZOMBIE || + (host -> receivedAddress.host != peer -> address.host && + peer -> address.host != ENET_HOST_BROADCAST)) + return 0; + +#ifdef USE_CRC32 + { + enet_uint32 crc = header -> checksum; + ENetBuffer buffer; + + header -> checksum = peer -> sessionID; + + buffer.data = host -> receivedData; + buffer.dataLength = host -> receivedDataLength; + + if (enet_crc32 (& buffer, 1) != crc) + return 0; + } +#else + if (header -> checksum != peer -> sessionID) + return 0; +#endif + + peer -> address.host = host -> receivedAddress.host; + peer -> address.port = host -> receivedAddress.port; + peer -> incomingDataTotal += host -> receivedDataLength; + } + + headerSize = (flags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME ? sizeof (ENetProtocolHeader) : (size_t) & ((ENetProtocolHeader *) 0) -> sentTime); + currentData = host -> receivedData + headerSize; + + while (currentData < & host -> receivedData [host -> receivedDataLength]) + { + enet_uint8 commandNumber; + size_t commandSize; + + command = (ENetProtocol *) currentData; + + if (currentData + sizeof (ENetProtocolCommandHeader) > & host -> receivedData [host -> receivedDataLength]) + break; + + commandNumber = command -> header.command & ENET_PROTOCOL_COMMAND_MASK; + if (commandNumber >= ENET_PROTOCOL_COMMAND_COUNT) + break; + + commandSize = commandSizes [commandNumber]; + if (commandSize == 0 || currentData + commandSize > & host -> receivedData [host -> receivedDataLength]) + break; + + currentData += commandSize; + + if (peer == NULL && commandNumber != ENET_PROTOCOL_COMMAND_CONNECT) + break; + + command -> header.reliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> header.reliableSequenceNumber); + + switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK) + { + case ENET_PROTOCOL_COMMAND_ACKNOWLEDGE: + if (enet_protocol_handle_acknowledge (host, event, peer, command)) + goto commandError; + break; + + case ENET_PROTOCOL_COMMAND_CONNECT: + peer = enet_protocol_handle_connect (host, header, command); + if (peer == NULL) + goto commandError; + break; + + case ENET_PROTOCOL_COMMAND_VERIFY_CONNECT: + if (enet_protocol_handle_verify_connect (host, event, peer, command)) + goto commandError; + break; + + case ENET_PROTOCOL_COMMAND_DISCONNECT: + if (enet_protocol_handle_disconnect (host, peer, command)) + goto commandError; + break; + + case ENET_PROTOCOL_COMMAND_PING: + if (enet_protocol_handle_ping (host, peer, command)) + goto commandError; + break; + + case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: + if (enet_protocol_handle_send_reliable (host, peer, command, & currentData)) + goto commandError; + break; + + case ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE: + if (enet_protocol_handle_send_unreliable (host, peer, command, & currentData)) + goto commandError; + break; + + case ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED: + if (enet_protocol_handle_send_unsequenced (host, peer, command, & currentData)) + goto commandError; + break; + + case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: + if (enet_protocol_handle_send_fragment (host, peer, command, & currentData)) + goto commandError; + break; + + case ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT: + if (enet_protocol_handle_bandwidth_limit (host, peer, command)) + goto commandError; + break; + + case ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE: + if (enet_protocol_handle_throttle_configure (host, peer, command)) + goto commandError; + break; + + default: + goto commandError; + } + + if (peer != NULL && + (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) != 0) + { + enet_uint16 sentTime; + + if (! (flags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME)) + break; + + sentTime = ENET_NET_TO_HOST_16 (header -> sentTime); + + switch (peer -> state) + { + case ENET_PEER_STATE_DISCONNECTING: + case ENET_PEER_STATE_ACKNOWLEDGING_CONNECT: + break; + + case ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT: + if ((command -> header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_DISCONNECT) + enet_peer_queue_acknowledgement (peer, command, sentTime); + break; + + default: + enet_peer_queue_acknowledgement (peer, command, sentTime); + break; + } + } + } + +commandError: + if (event != NULL && event -> type != ENET_EVENT_TYPE_NONE) + return 1; + + return 0; +} + +static int +enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event) +{ + for (;;) + { + int receivedLength; + ENetBuffer buffer; + + buffer.data = host -> receivedData; + buffer.dataLength = sizeof (host -> receivedData); + + receivedLength = enet_socket_receive (host -> socket, + & host -> receivedAddress, + & buffer, + 1); + + if (receivedLength < 0) + return -1; + + if (receivedLength == 0) + return 0; + + host -> receivedDataLength = receivedLength; + + switch (enet_protocol_handle_incoming_commands (host, event)) + { + case 1: + return 1; + + case -1: + return -1; + + default: + break; + } + } + + return -1; +} + +static void +enet_protocol_send_acknowledgements (ENetHost * host, ENetPeer * peer) +{ + ENetProtocol * command = & host -> commands [host -> commandCount]; + ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; + ENetAcknowledgement * acknowledgement; + ENetListIterator currentAcknowledgement; + + currentAcknowledgement = enet_list_begin (& peer -> acknowledgements); + + while (currentAcknowledgement != enet_list_end (& peer -> acknowledgements)) + { + if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || + buffer >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] || + peer -> mtu - host -> packetSize < sizeof (ENetProtocolAcknowledge)) + { + host -> continueSending = 1; + + break; + } + + acknowledgement = (ENetAcknowledgement *) currentAcknowledgement; + + currentAcknowledgement = enet_list_next (currentAcknowledgement); + + buffer -> data = command; + buffer -> dataLength = sizeof (ENetProtocolAcknowledge); + + host -> packetSize += buffer -> dataLength; + + command -> header.command = ENET_PROTOCOL_COMMAND_ACKNOWLEDGE; + command -> header.channelID = acknowledgement -> command.header.channelID; + command -> acknowledge.receivedReliableSequenceNumber = ENET_HOST_TO_NET_16 (acknowledgement -> command.header.reliableSequenceNumber); + command -> acknowledge.receivedSentTime = ENET_HOST_TO_NET_16 (acknowledgement -> sentTime); + + if ((acknowledgement -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_DISCONNECT) + peer -> state = ENET_PEER_STATE_ZOMBIE; + + enet_list_remove (& acknowledgement -> acknowledgementList); + enet_free (acknowledgement); + + ++ command; + ++ buffer; + } + + host -> commandCount = command - host -> commands; + host -> bufferCount = buffer - host -> buffers; +} + +static void +enet_protocol_send_unreliable_outgoing_commands (ENetHost * host, ENetPeer * peer) +{ + ENetProtocol * command = & host -> commands [host -> commandCount]; + ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; + ENetOutgoingCommand * outgoingCommand; + ENetListIterator currentCommand; + + currentCommand = enet_list_begin (& peer -> outgoingUnreliableCommands); + + while (currentCommand != enet_list_end (& peer -> outgoingUnreliableCommands)) + { + size_t commandSize; + + outgoingCommand = (ENetOutgoingCommand *) currentCommand; + commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK]; + + if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || + buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] || + peer -> mtu - host -> packetSize < commandSize || + (outgoingCommand -> packet != NULL && + peer -> mtu - host -> packetSize < commandSize + outgoingCommand -> packet -> dataLength)) + { + host -> continueSending = 1; + + break; + } + + currentCommand = enet_list_next (currentCommand); + + if (outgoingCommand -> packet != NULL) + { + peer -> packetThrottleCounter += ENET_PEER_PACKET_THROTTLE_COUNTER; + peer -> packetThrottleCounter %= ENET_PEER_PACKET_THROTTLE_SCALE; + + if (peer -> packetThrottleCounter > peer -> packetThrottle) + { + -- outgoingCommand -> packet -> referenceCount; + + if (outgoingCommand -> packet -> referenceCount == 0) + enet_packet_destroy (outgoingCommand -> packet); + + enet_list_remove (& outgoingCommand -> outgoingCommandList); + enet_free (outgoingCommand); + + continue; + } + } + + buffer -> data = command; + buffer -> dataLength = commandSize; + + host -> packetSize += buffer -> dataLength; + + * command = outgoingCommand -> command; + + enet_list_remove (& outgoingCommand -> outgoingCommandList); + + if (outgoingCommand -> packet != NULL) + { + ++ buffer; + + buffer -> data = outgoingCommand -> packet -> data; + buffer -> dataLength = outgoingCommand -> packet -> dataLength; + + host -> packetSize += buffer -> dataLength; + + enet_list_insert (enet_list_end (& peer -> sentUnreliableCommands), outgoingCommand); + } + else + enet_free (outgoingCommand); + + ++ command; + ++ buffer; + } + + host -> commandCount = command - host -> commands; + host -> bufferCount = buffer - host -> buffers; + + if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER && + enet_list_empty (& peer -> outgoingReliableCommands) && + enet_list_empty (& peer -> outgoingUnreliableCommands) && + enet_list_empty (& peer -> sentReliableCommands)) + enet_peer_disconnect (peer, peer -> disconnectData); +} + +static int +enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * event) +{ + ENetOutgoingCommand * outgoingCommand; + ENetListIterator currentCommand, insertPosition; + + currentCommand = enet_list_begin (& peer -> sentReliableCommands); + insertPosition = enet_list_begin (& peer -> outgoingReliableCommands); + + while (currentCommand != enet_list_end (& peer -> sentReliableCommands)) + { + outgoingCommand = (ENetOutgoingCommand *) currentCommand; + + currentCommand = enet_list_next (currentCommand); + + if (ENET_TIME_DIFFERENCE (host -> serviceTime, outgoingCommand -> sentTime) < outgoingCommand -> roundTripTimeout) + continue; + + if (peer -> earliestTimeout == 0 || + ENET_TIME_LESS (outgoingCommand -> sentTime, peer -> earliestTimeout)) + peer -> earliestTimeout = outgoingCommand -> sentTime; + + if (peer -> earliestTimeout != 0 && + (ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> earliestTimeout) >= ENET_PEER_TIMEOUT_MAXIMUM || + (outgoingCommand -> roundTripTimeout >= outgoingCommand -> roundTripTimeoutLimit && + ENET_TIME_DIFFERENCE (host -> serviceTime, peer -> earliestTimeout) >= ENET_PEER_TIMEOUT_MINIMUM))) + { + enet_protocol_notify_disconnect (host, peer, event); + + return 1; + } + + if (outgoingCommand -> packet != NULL) + peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; + + ++ peer -> packetsLost; + + outgoingCommand -> roundTripTimeout *= 2; + + enet_list_insert (insertPosition, enet_list_remove (& outgoingCommand -> outgoingCommandList)); + + if (currentCommand == enet_list_begin (& peer -> sentReliableCommands) && + ! enet_list_empty (& peer -> sentReliableCommands)) + { + outgoingCommand = (ENetOutgoingCommand *) currentCommand; + + peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout; + } + } + + return 0; +} + +static void +enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) +{ + ENetProtocol * command = & host -> commands [host -> commandCount]; + ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; + ENetOutgoingCommand * outgoingCommand; + ENetListIterator currentCommand; + ENetChannel *channel; + enet_uint16 reliableWindow; + size_t commandSize; + + currentCommand = enet_list_begin (& peer -> outgoingReliableCommands); + + while (currentCommand != enet_list_end (& peer -> outgoingReliableCommands)) + { + outgoingCommand = (ENetOutgoingCommand *) currentCommand; + + channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL; + reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; + if (channel != NULL && + outgoingCommand -> sendAttempts < 1 && + ! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) && + (channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE || + channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) | + (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow))))) + break; + + commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK]; + if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || + buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] || + peer -> mtu - host -> packetSize < commandSize) + { + host -> continueSending = 1; + + break; + } + + if (outgoingCommand -> packet != NULL) + { + if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > peer -> windowSize) + break; + + if ((enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength)) + { + host -> continueSending = 1; + + break; + } + } + + currentCommand = enet_list_next (currentCommand); + + if (channel != NULL && outgoingCommand -> sendAttempts < 1) + { + channel -> usedReliableWindows |= 1 << reliableWindow; + ++ channel -> reliableWindows [reliableWindow]; + } + + ++ outgoingCommand -> sendAttempts; + + if (outgoingCommand -> roundTripTimeout == 0) + { + outgoingCommand -> roundTripTimeout = peer -> roundTripTime + 4 * peer -> roundTripTimeVariance; + outgoingCommand -> roundTripTimeoutLimit = ENET_PEER_TIMEOUT_LIMIT * outgoingCommand -> roundTripTimeout; + } + + if (enet_list_empty (& peer -> sentReliableCommands)) + peer -> nextTimeout = host -> serviceTime + outgoingCommand -> roundTripTimeout; + + enet_list_insert (enet_list_end (& peer -> sentReliableCommands), + enet_list_remove (& outgoingCommand -> outgoingCommandList)); + + outgoingCommand -> sentTime = host -> serviceTime; + + buffer -> data = command; + buffer -> dataLength = commandSize; + + host -> packetSize += buffer -> dataLength; + host -> headerFlags |= ENET_PROTOCOL_HEADER_FLAG_SENT_TIME; + + * command = outgoingCommand -> command; + + if (outgoingCommand -> packet != NULL) + { + ++ buffer; + + buffer -> data = outgoingCommand -> packet -> data + outgoingCommand -> fragmentOffset; + buffer -> dataLength = outgoingCommand -> fragmentLength; + + host -> packetSize += outgoingCommand -> fragmentLength; + + peer -> reliableDataInTransit += outgoingCommand -> fragmentLength; + } + + ++ peer -> packetsSent; + + ++ command; + ++ buffer; + } + + host -> commandCount = command - host -> commands; + host -> bufferCount = buffer - host -> buffers; +} + +static int +enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int checkForTimeouts) +{ + ENetProtocolHeader header; + ENetPeer * currentPeer; + int sentLength; + + host -> continueSending = 1; + + while (host -> continueSending) + for (host -> continueSending = 0, + currentPeer = host -> peers; + currentPeer < & host -> peers [host -> peerCount]; + ++ currentPeer) + { + if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED || + currentPeer -> state == ENET_PEER_STATE_ZOMBIE) + continue; + + host -> headerFlags = 0; + host -> commandCount = 0; + host -> bufferCount = 1; + host -> packetSize = sizeof (ENetProtocolHeader); + + if (! enet_list_empty (& currentPeer -> acknowledgements)) + enet_protocol_send_acknowledgements (host, currentPeer); + + if (checkForTimeouts != 0 && + ! enet_list_empty (& currentPeer -> sentReliableCommands) && + ENET_TIME_GREATER_EQUAL (host -> serviceTime, currentPeer -> nextTimeout) && + enet_protocol_check_timeouts (host, currentPeer, event) == 1) + return 1; + + if (! enet_list_empty (& currentPeer -> outgoingReliableCommands)) + enet_protocol_send_reliable_outgoing_commands (host, currentPeer); + else + if (enet_list_empty (& currentPeer -> sentReliableCommands) && + ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL && + currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing)) + { + enet_peer_ping (currentPeer); + enet_protocol_send_reliable_outgoing_commands (host, currentPeer); + } + + if (! enet_list_empty (& currentPeer -> outgoingUnreliableCommands)) + enet_protocol_send_unreliable_outgoing_commands (host, currentPeer); + + if (host -> commandCount == 0) + continue; + + if (currentPeer -> packetLossEpoch == 0) + currentPeer -> packetLossEpoch = host -> serviceTime; + else + if (ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> packetLossEpoch) >= ENET_PEER_PACKET_LOSS_INTERVAL && + currentPeer -> packetsSent > 0) + { + enet_uint32 packetLoss = currentPeer -> packetsLost * ENET_PEER_PACKET_LOSS_SCALE / currentPeer -> packetsSent; + +#ifdef ENET_DEBUG +#ifdef WIN32 + printf ( +#else + fprintf (stderr, +#endif + "peer %u: %f%%+-%f%% packet loss, %u+-%u ms round trip time, %f%% throttle, %u/%u outgoing, %u/%u incoming\n", currentPeer -> incomingPeerID, currentPeer -> packetLoss / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> packetLossVariance / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> roundTripTime, currentPeer -> roundTripTimeVariance, currentPeer -> packetThrottle / (float) ENET_PEER_PACKET_THROTTLE_SCALE, enet_list_size (& currentPeer -> outgoingReliableCommands), enet_list_size (& currentPeer -> outgoingUnreliableCommands), currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingReliableCommands) : 0, currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingUnreliableCommands) : 0); +#endif + + currentPeer -> packetLossVariance -= currentPeer -> packetLossVariance / 4; + + if (packetLoss >= currentPeer -> packetLoss) + { + currentPeer -> packetLoss += (packetLoss - currentPeer -> packetLoss) / 8; + currentPeer -> packetLossVariance += (packetLoss - currentPeer -> packetLoss) / 4; + } + else + { + currentPeer -> packetLoss -= (currentPeer -> packetLoss - packetLoss) / 8; + currentPeer -> packetLossVariance += (currentPeer -> packetLoss - packetLoss) / 4; + } + + currentPeer -> packetLossEpoch = host -> serviceTime; + currentPeer -> packetsSent = 0; + currentPeer -> packetsLost = 0; + } + + header.checksum = currentPeer -> sessionID; + header.peerID = ENET_HOST_TO_NET_16 (currentPeer -> outgoingPeerID | host -> headerFlags); + + host -> buffers -> data = & header; + if (host -> headerFlags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME) + { + header.sentTime = ENET_HOST_TO_NET_16 (host -> serviceTime & 0xFFFF); + + host -> buffers -> dataLength = sizeof (ENetProtocolHeader); + } + else + host -> buffers -> dataLength = (size_t) & ((ENetProtocolHeader *) 0) -> sentTime; + +#ifdef USE_CRC32 + header.checksum = enet_crc32 (host -> buffers, host -> bufferCount); +#endif + + currentPeer -> lastSendTime = host -> serviceTime; + + sentLength = enet_socket_send (host -> socket, & currentPeer -> address, host -> buffers, host -> bufferCount); + + enet_protocol_remove_sent_unreliable_commands (currentPeer); + + if (sentLength < 0) + return -1; + } + + return 0; +} + +/** Sends any queued packets on the host specified to its designated peers. + + @param host host to flush + @remarks this function need only be used in circumstances where one wishes to send queued packets earlier than in a call to enet_host_service(). + @ingroup host +*/ +void +enet_host_flush (ENetHost * host) +{ + host -> serviceTime = enet_time_get (); + + enet_protocol_send_outgoing_commands (host, NULL, 0); +} + +/** Checks for any queued events on the host and dispatches one if available. + + @param host host to check for events + @param event an event structure where event details will be placed if available + @retval > 0 if an event was dispatched + @retval 0 if no events are available + @retval < 0 on failure + @ingroup host +*/ +int +enet_host_check_events (ENetHost * host, ENetEvent * event) +{ + if (event == NULL) return -1; + + event -> type = ENET_EVENT_TYPE_NONE; + event -> peer = NULL; + event -> packet = NULL; + + return enet_protocol_dispatch_incoming_commands (host, event); +} + +/** Waits for events on the host specified and shuttles packets between + the host and its peers. + + @param host host to service + @param event an event structure where event details will be placed if one occurs + if event == NULL then no events will be delivered + @param timeout number of milliseconds that ENet should wait for events + @retval > 0 if an event occurred within the specified time limit + @retval 0 if no event occurred + @retval < 0 on failure + @remarks enet_host_service should be called fairly regularly for adequate performance + @ingroup host +*/ +int +enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout) +{ + enet_uint32 waitCondition; + + if (event != NULL) + { + event -> type = ENET_EVENT_TYPE_NONE; + event -> peer = NULL; + event -> packet = NULL; + + switch (enet_protocol_dispatch_incoming_commands (host, event)) + { + case 1: + return 1; + + case -1: + perror ("Error dispatching incoming packets"); + + return -1; + + default: + break; + } + } + + host -> serviceTime = enet_time_get (); + + timeout += host -> serviceTime; + + do + { + if (ENET_TIME_DIFFERENCE (host -> serviceTime, host -> bandwidthThrottleEpoch) >= ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL) + enet_host_bandwidth_throttle (host); + + switch (enet_protocol_send_outgoing_commands (host, event, 1)) + { + case 1: + return 1; + + case -1: + perror ("Error sending outgoing packets"); + + return -1; + + default: + break; + } + + switch (enet_protocol_receive_incoming_commands (host, event)) + { + case 1: + return 1; + + case -1: + perror ("Error receiving incoming packets"); + + return -1; + + default: + break; + } + + switch (enet_protocol_send_outgoing_commands (host, event, 1)) + { + case 1: + return 1; + + case -1: + perror ("Error sending outgoing packets"); + + return -1; + + default: + break; + } + + if (event != NULL) + { + switch (enet_protocol_dispatch_incoming_commands (host, event)) + { + case 1: + return 1; + + case -1: + perror ("Error dispatching incoming packets"); + + return -1; + + default: + break; + } + } + + host -> serviceTime = enet_time_get (); + + if (ENET_TIME_GREATER_EQUAL (host -> serviceTime, timeout)) + return 0; + + waitCondition = ENET_SOCKET_WAIT_RECEIVE; + + if (enet_socket_wait (host -> socket, & waitCondition, ENET_TIME_DIFFERENCE (timeout, host -> serviceTime)) != 0) + return -1; + + host -> serviceTime = enet_time_get (); + } while (waitCondition == ENET_SOCKET_WAIT_RECEIVE); + + return 0; +} + diff --git a/src/enet/tutorial.txt b/src/enet/tutorial.txt new file mode 100644 index 0000000..f187e2d --- /dev/null +++ b/src/enet/tutorial.txt @@ -0,0 +1,325 @@ +* Using ENet + + Before using ENet, you must call enet_initialize() to initialize the +library. Upon program exit, you should call enet_deinitialize() so that +the library may clean up any used resources. + +i.e. + +int +main (int argc, char ** argv) +{ + if (enet_initialize () != 0) + { + fprintf (stderror, "An error occurred while initializing ENet.\n"); + return EXIT_FAILURE; + } + atexit (enet_deinitialize); + ... + ... + ... +} + +* Creating an ENet server + + Servers in ENet are constructed with enet_host_create(). You must specify +an address on which to receive data and new connections, as well as the maximum +allowable numbers of connected peers. You may optionally specify the incoming +and outgoing bandwidth of the server in bytes per second so that ENet may try +to statically manage bandwidth resources among connected peers in addition to +its dynamic throttling algorithm; specifying 0 for these two options will cause +ENet to rely entirely upon its dynamic throttling algorithm to manage +bandwidth. + + When done with a host, the host may be destroyed with enet_host_destroy(). +All connected peers to the host will be reset, and the resources used by +the host will be freed. + +i.e. + + ENetAddress address; + ENetHost * server; + + /* Bind the server to the default localhost. + * A specific host address can be specified by + * enet_address_set_host (& address, "x.x.x.x"); + */ + address.host = ENET_HOST_ANY; + /* Bind the server to port 1234. */ + address.port = 1234; + + server = enet_host_create (& address /* the address to bind the server host to */, + 32 /* allow up to 32 clients and/or outgoing connections */, + 0 /* assume any amount of incoming bandwidth */, + 0 /* assume any amount of outgoing bandwidth */); + if (server == NULL) + { + fprintf (stderr, + "An error occurred while trying to create an ENet server host.\n"); + exit (EXIT_FAILURE); + } + ... + ... + ... + enet_host_destroy(server); + +* Creating an ENet client + + Clients in ENet are similarly constructed with enet_host_create() when no +address is specified to bind the host to. Bandwidth may be specified for the +client host as in the above example. The peer count controls the maximum number +of connections to other server hosts that may be simultaneously open. + +i.e. + + ENetHost * client; + + clienet = enet_host_create (NULL /* create a client host */, + 1 /* only allow 1 outgoing connection */, + 57600 / 8 /* 56K modem with 56 Kbps downstream bandwidth */, + 14400 / 8 /* 56K modem with 14 Kbps upstream bandwidth */); + + if (client == NULL) + { + fprintf (stderr, + "An error occurred while trying to create an ENet client host.\n"); + exit (EXIT_FAILURE); + } + ... + ... + ... + enet_host_destroy(client); + +* Managing an ENet host + + ENet uses a polled event model to notify the programmer of significant +events. ENet hosts are polled for events with enet_host_service(), where an +optional timeout value in milliseconds may be specified to control how long +ENet will poll; if a timeout of 0 is specified, enet_host_service() will +return immediately if there are no events to dispatch. enet_host_service() +will return 1 if an event was dispatched within the specified timeout. + + Currently there are only four types of significant events in ENet: + +An event of type ENET_EVENT_TYPE_NONE is returned if no event occurred +within the specified time limit. enet_host_service() will return 0 +with this event. + +An event of type ENET_EVENT_TYPE_CONNECT is returned when either a new client +host has connected to the server host or when an attempt to establish a +connection with a foreign host has succeeded. Only the "peer" field of the +event structure is valid for this event and contains the newly connected peer. + +An event of type ENET_EVENT_TYPE_RECEIVE is returned when a packet is received +from a connected peer. The "peer" field contains the peer the packet was +received from, "channelID" is the channel on which the packet was sent, and +"packet" is the packet that was sent. The packet contained in the "packet" +field must be destroyed with enet_packet_destroy() when you are done +inspecting its contents. + +An event of type ENET_EVENT_TYPE_DISCONNECT is returned when a connected peer +has either explicitly disconnected or timed out. Only the "peer" field of the +event structure is valid for this event and contains the peer that +disconnected. Only the "data" field of the peer is still valid on a +disconnect event and must be explicitly reset. + +i.e. + + ENetEvent event; + + /* Wait up to 1000 milliseconds for an event. */ + while (enet_host_service (client, & event, 1000) > 0) + { + switch (event.type) + { + case ENET_EVENT_TYPE_CONNECT: + printf ("A new client connected from %x:%u.\n", + event.peer -> address.host, + event.peer -> address.port); + + /* Store any relevant client information here. */ + event.peer -> data = "Client information"; + + break; + + case ENET_EVENT_TYPE_RECEIVE: + printf ("A packet of length %u containing %s was received from %s on channel %u.\n", + event.packet -> dataLength, + event.packet -> data, + event.peer -> data, + event.channelID); + + /* Clean up the packet now that we're done using it. */ + enet_packet_destroy (event.packet); + + break; + + case ENET_EVENT_TYPE_DISCONNECT: + printf ("%s disconected.\n", event.peer -> data); + + /* Reset the peer's client information. */ + + event.peer -> data = NULL; + } + } + ... + ... + ... + +* Sending a packet to an ENet peer + + Packets in ENet are created with enet_packet_create(), where the size of +the packet must be specified. Optionally, initial data may be specified to +copy into the packet. + + Certain flags may also be supplied to enet_packet_create() to control +various packet features: + +ENET_PACKET_FLAG_RELIABLE specifies that the packet must use reliable delivery. +A reliable packet is guarenteed to be delivered, and a number of retry attempts +will be made until an acknowledgement is received from the foreign host the +packet is sent to. If a certain number of retry attempts is reached without +any acknowledgement, ENet will assume the peer has disconnected and forcefully +reset the connection. If this flag is not specified, the packet is assumed +an unreliable packet, and no retry attempts will be made nor acknowledgements +generated. + + A packet may be resized (extended or truncated) with enet_packet_resize(). + + A packet is sent to a foreign host with enet_peer_send(). enet_peer_send() +accepts a channel id over which to send the packet to a given peer. Once the +packet is handed over to ENet with enet_peer_send(), ENet will handle its +deallocation and enet_packet_destroy() should not be used upon it. + + One may also use enet_host_broadcast() to send a packet to all connected +peers on a given host over a specified channel id, as with enet_peer_send(). + + Queued packets will be sent on a call to enet_host_service(). +Alternatively, enet_host_flush() will send out queued packets without +dispatching any events. + +i.e. + + /* Create a reliable packet of size 7 containing "packet\0" */ + ENetPacket * packet = enet_packet_create ("packet", + strlen ("packet") + 1, + ENET_PACKET_FLAG_RELIABLE); + + /* Extend the packet so and append the string "foo", so it now + * contains "packetfoo\0" + * + enet_packet_resize (packet, strlen ("packetfoo") + 1); + strcpy (& packet -> data [strlen ("packet")], "foo"); + + /* Send the packet to the peer over channel id 3. + * One could also broadcast the packet by + * enet_host_broadcast (host, 3, packet); + */ + enet_peer_send (peer, 3, packet); + ... + ... + ... + /* One could just use enet_host_service() instead. */ + enet_host_flush (host); + +* Disconnecting an ENet peer + + Peers may be gently disconnected with enet_peer_disconnect(). A disconnect +request will be sent to the foreign host, and ENet will wait for an +acknowledgement from the foreign host before finally disconnecting. An +event of type ENET_EVENT_TYPE_DISCONNECT will be generated once the +disconnection succeeds. Normally timeouts apply to the disconnect +acknowledgement, and so if no acknowledgement is received after a length +of time the peer will be forcefully disconnected. + + enet_peer_reset() will forcefully disconnect a peer. The foreign host +will get no notification of a disconnect and will time out on the foreign +host. No event is generated. + +i.e. + ENetEvent event; + + enet_peer_disconnect (& client -> peers [0]); + + /* Allow up to 3 seconds for the disconnect to succeed + * and drop any packets received packets. + */ + while (enet_host_service (client, & event, 3000) > 0) + { + switch (event.type) + { + case ENET_EVENT_TYPE_RECEIVE: + enet_packet_destroy (event.packet); + break; + + case ENET_EVENT_TYPE_DISCONNECT: + puts ("Disconnection succeeded."); + return; + ... + ... + ... + } + } + + /* We've arrived here, so the disconnect attempt didn't succeed yet. + * Force the connection down. + */ + enet_peer_reset (& client -> peers [0]); + ... + ... + ... + +* Connecting to an ENet host + + A connection to a foregin host is initiated with enet_host_connect(). +It accepts the address of a foreign host to connect to, and the number of +channels that should be allocated for communication. If N channels are +allocated for use, their channel ids will be numbered 0 through N-1. +A peer representing the connection attempt is returned, or NULL if there +were no available peers over which to initiate the connection. When the +connection attempt succeeds, an event of type ENET_EVENT_TYPE_CONNECT will +be generated. If the connection attempt times out or otherwise fails, an +event of type ENET_EVENT_TYPE_DISCONNECT will be generated. + +i.e. + ENetAddress address; + ENetEvent event; + ENetPeer *peer; + + /* Connect to some.server.net:1234. */ + enet_address_set_host (& address, "some.server.net"); + address.port = 1234; + + /* Initiate the connection, allocating the two channels 0 and 1. */ + peer = enet_host_connect (client, & address, 2); + + if (peer == NULL) + { + fprintf (stderr, + "No available peers for initiating an ENet connection.\n"); + exit (EXIT_FAILURE); + } + + /* Wait up to 5 seconds for the connection attempt to succeed. + if (enet_host_service (client, & event, 5000) > 0 && + event.type == ENET_EVENT_TYPE_CONNECT) + { + puts ("Connection to some.server.net:1234 succeeded."); + ... + ... + ... + } + else + { + /* Either the 5 seconds are up or a disconnect event was + * received. Reset the peer in the event the 5 seconds + * had run out without any significant event. + */ + enet_peer_reset (peer); + + puts ("Connection to some.server.net:1234 failed."); + } + ... + ... + ... + diff --git a/src/enet/unix.c b/src/enet/unix.c new file mode 100644 index 0000000..132ca1a --- /dev/null +++ b/src/enet/unix.c @@ -0,0 +1,419 @@ +/** + @file unix.c + @brief ENet Unix system specific functions +*/ +#ifndef WIN32 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ENET_BUILDING_LIB 1 +#include "enet/enet.h" + +#ifdef HAS_FCNTL +#include +#endif + +#ifdef __APPLE__ +#undef HAS_POLL +#endif + +#ifdef HAS_POLL +#include +#endif + +#ifndef HAS_SOCKLEN_T +typedef int socklen_t; +#endif + +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + +static enet_uint32 timeBase = 0; + +int +enet_initialize (void) +{ + return 0; +} + +void +enet_deinitialize (void) +{ +} + +enet_uint32 +enet_time_get (void) +{ + struct timeval timeVal; + + gettimeofday (& timeVal, NULL); + + return timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - timeBase; +} + +void +enet_time_set (enet_uint32 newTimeBase) +{ + struct timeval timeVal; + + gettimeofday (& timeVal, NULL); + + timeBase = timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - newTimeBase; +} + +int +enet_address_set_host (ENetAddress * address, const char * name) +{ + struct hostent * hostEntry = NULL; +#ifdef HAS_GETHOSTBYNAME_R + struct hostent hostData; + char buffer [2048]; + int errnum; + +#if defined(linux) || defined(__FreeBSD__) + gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum); +#else + hostEntry = gethostbyname_r (name, & hostData, buffer, sizeof (buffer), & errnum); +#endif +#else + hostEntry = gethostbyname (name); +#endif + + if (hostEntry == NULL || + hostEntry -> h_addrtype != AF_INET) + { +#ifdef HAS_INET_PTON + if (! inet_pton (AF_INET, name, & address -> host)) +#else + if (! inet_aton (name, (struct in_addr *) & address -> host)) +#endif + return -1; + return 0; + } + + address -> host = * (enet_uint32 *) hostEntry -> h_addr_list [0]; + + return 0; +} + +int +enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength) +{ +#ifdef HAS_INET_NTOP + if (inet_ntop (AF_INET, & address -> host, name, nameLength) == NULL) +#else + char * addr = inet_ntoa (* (struct in_addr *) & address -> host); + if (addr != NULL) + strncpy (name, addr, nameLength); + else +#endif + return -1; + return 0; +} + +int +enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength) +{ + struct in_addr in; + struct hostent * hostEntry = NULL; +#ifdef HAS_GETHOSTBYADDR_R + struct hostent hostData; + char buffer [2048]; + int errnum; + + in.s_addr = address -> host; + +#if defined(linux) || defined(__FreeBSD__) + gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & hostEntry, & errnum); +#else + hostEntry = gethostbyaddr_r ((char *) & in, sizeof (struct in_addr), AF_INET, & hostData, buffer, sizeof (buffer), & errnum); +#endif +#else + in.s_addr = address -> host; + + hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET); +#endif + + if (hostEntry == NULL) + return enet_address_get_host_ip (address, name, nameLength); + + strncpy (name, hostEntry -> h_name, nameLength); + + return 0; +} + +ENetSocket +enet_socket_create (ENetSocketType type, const ENetAddress * address) +{ + ENetSocket newSocket = socket (PF_INET, type == ENET_SOCKET_TYPE_DATAGRAM ? SOCK_DGRAM : SOCK_STREAM, 0); + struct sockaddr_in sin; + + if (newSocket == ENET_SOCKET_NULL) + return ENET_SOCKET_NULL; + + if (address == NULL) + return newSocket; + + memset (& sin, 0, sizeof (struct sockaddr_in)); + + sin.sin_family = AF_INET; + sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); + sin.sin_addr.s_addr = address -> host; + + if (bind (newSocket, + (struct sockaddr *) & sin, + sizeof (struct sockaddr_in)) == -1 || + (type == ENET_SOCKET_TYPE_STREAM && + address -> port != ENET_PORT_ANY && + listen (newSocket, SOMAXCONN) == -1)) + { + close (newSocket); + + return ENET_SOCKET_NULL; + } + + return newSocket; +} + +int +enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) +{ + int result = -1; + switch (option) + { + case ENET_SOCKOPT_NONBLOCK: +#ifdef HAS_FCNTL + result = fcntl (socket, F_SETFL, O_NONBLOCK | fcntl (socket, F_GETFL)); +#else + result = ioctl (socket, FIONBIO, & value); +#endif + break; + + case ENET_SOCKOPT_BROADCAST: + result = setsockopt (socket, SOL_SOCKET, SO_BROADCAST, (char *) & value, sizeof (int)); + break; + + case ENET_SOCKOPT_RCVBUF: + result = setsockopt (socket, SOL_SOCKET, SO_RCVBUF, (char *) & value, sizeof (int)); + break; + + case ENET_SOCKOPT_SNDBUF: + result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int)); + break; + + default: + break; + } + return result == -1 ? -1 : 0; +} + +int +enet_socket_connect (ENetSocket socket, const ENetAddress * address) +{ + struct sockaddr_in sin; + + memset (& sin, 0, sizeof (struct sockaddr_in)); + + sin.sin_family = AF_INET; + sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); + sin.sin_addr.s_addr = address -> host; + + return connect (socket, (struct sockaddr *) & sin, sizeof (struct sockaddr_in)); +} + +ENetSocket +enet_socket_accept (ENetSocket socket, ENetAddress * address) +{ + int result; + struct sockaddr_in sin; + socklen_t sinLength = sizeof (struct sockaddr_in); + + result = accept (socket, + address != NULL ? (struct sockaddr *) & sin : NULL, + address != NULL ? & sinLength : NULL); + + if (result == -1) + return ENET_SOCKET_NULL; + + if (address != NULL) + { + address -> host = (enet_uint32) sin.sin_addr.s_addr; + address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); + } + + return result; +} + +void +enet_socket_destroy (ENetSocket socket) +{ + close (socket); +} + +int +enet_socket_send (ENetSocket socket, + const ENetAddress * address, + const ENetBuffer * buffers, + size_t bufferCount) +{ + struct msghdr msgHdr; + struct sockaddr_in sin; + int sentLength; + + memset (& msgHdr, 0, sizeof (struct msghdr)); + + if (address != NULL) + { + memset (& sin, 0, sizeof (struct sockaddr_in)); + + sin.sin_family = AF_INET; + sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); + sin.sin_addr.s_addr = address -> host; + + msgHdr.msg_name = & sin; + msgHdr.msg_namelen = sizeof (struct sockaddr_in); + } + + msgHdr.msg_iov = (struct iovec *) buffers; + msgHdr.msg_iovlen = bufferCount; + + sentLength = sendmsg (socket, & msgHdr, MSG_NOSIGNAL); + + if (sentLength == -1) + { + if (errno == EWOULDBLOCK) + return 0; + + return -1; + } + + return sentLength; +} + +int +enet_socket_receive (ENetSocket socket, + ENetAddress * address, + ENetBuffer * buffers, + size_t bufferCount) +{ + struct msghdr msgHdr; + struct sockaddr_in sin; + int recvLength; + + memset (& msgHdr, 0, sizeof (struct msghdr)); + + if (address != NULL) + { + msgHdr.msg_name = & sin; + msgHdr.msg_namelen = sizeof (struct sockaddr_in); + } + + msgHdr.msg_iov = (struct iovec *) buffers; + msgHdr.msg_iovlen = bufferCount; + + recvLength = recvmsg (socket, & msgHdr, MSG_NOSIGNAL); + + if (recvLength == -1) + { + if (errno == EWOULDBLOCK) + return 0; + + return -1; + } + +#ifdef HAS_MSGHDR_FLAGS + if (msgHdr.msg_flags & MSG_TRUNC) + return -1; +#endif + + if (address != NULL) + { + address -> host = (enet_uint32) sin.sin_addr.s_addr; + address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); + } + + return recvLength; +} + +int +enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeout) +{ +#ifdef HAS_POLL + struct pollfd pollSocket; + int pollCount; + + pollSocket.fd = socket; + pollSocket.events = 0; + + if (* condition & ENET_SOCKET_WAIT_SEND) + pollSocket.events |= POLLOUT; + + if (* condition & ENET_SOCKET_WAIT_RECEIVE) + pollSocket.events |= POLLIN; + + pollCount = poll (& pollSocket, 1, timeout); + + if (pollCount < 0) + return -1; + + * condition = ENET_SOCKET_WAIT_NONE; + + if (pollCount == 0) + return 0; + + if (pollSocket.revents & POLLOUT) + * condition |= ENET_SOCKET_WAIT_SEND; + + if (pollSocket.revents & POLLIN) + * condition |= ENET_SOCKET_WAIT_RECEIVE; + + return 0; +#else + fd_set readSet, writeSet; + struct timeval timeVal; + int selectCount; + + timeVal.tv_sec = timeout / 1000; + timeVal.tv_usec = (timeout % 1000) * 1000; + + FD_ZERO (& readSet); + FD_ZERO (& writeSet); + + if (* condition & ENET_SOCKET_WAIT_SEND) + FD_SET (socket, & writeSet); + + if (* condition & ENET_SOCKET_WAIT_RECEIVE) + FD_SET (socket, & readSet); + + selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal); + + if (selectCount < 0) + return -1; + + * condition = ENET_SOCKET_WAIT_NONE; + + if (selectCount == 0) + return 0; + + if (FD_ISSET (socket, & writeSet)) + * condition |= ENET_SOCKET_WAIT_SEND; + + if (FD_ISSET (socket, & readSet)) + * condition |= ENET_SOCKET_WAIT_RECEIVE; + + return 0; +#endif +} + +#endif + diff --git a/src/enet/win32.c b/src/enet/win32.c new file mode 100644 index 0000000..b8b2aa7 --- /dev/null +++ b/src/enet/win32.c @@ -0,0 +1,336 @@ +/** + @file win32.c + @brief ENet Win32 system specific functions +*/ +#ifdef WIN32 + +#include +#define ENET_BUILDING_LIB 1 +#include "enet/enet.h" + +static enet_uint32 timeBase = 0; + +int +enet_initialize (void) +{ + WORD versionRequested = MAKEWORD (1, 1); + WSADATA wsaData; + + if (WSAStartup (versionRequested, & wsaData)) + return -1; + + if (LOBYTE (wsaData.wVersion) != 1|| + HIBYTE (wsaData.wVersion) != 1) + { + WSACleanup (); + + return -1; + } + + timeBeginPeriod (1); + + return 0; +} + +void +enet_deinitialize (void) +{ + timeEndPeriod (1); + + WSACleanup (); +} + +enet_uint32 +enet_time_get (void) +{ + return (enet_uint32) timeGetTime () - timeBase; +} + +void +enet_time_set (enet_uint32 newTimeBase) +{ + timeBase = (enet_uint32) timeGetTime () - newTimeBase; +} + +int +enet_address_set_host (ENetAddress * address, const char * name) +{ + struct hostent * hostEntry; + + hostEntry = gethostbyname (name); + if (hostEntry == NULL || + hostEntry -> h_addrtype != AF_INET) + { + unsigned long host = inet_addr (name); + if (host == INADDR_NONE) + return -1; + address -> host = host; + return 0; + } + + address -> host = * (enet_uint32 *) hostEntry -> h_addr_list [0]; + + return 0; +} + +int +enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength) +{ + char * addr = inet_ntoa (* (struct in_addr *) & address -> host); + if (addr == NULL) + return -1; + strncpy (name, addr, nameLength); + return 0; +} + +int +enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength) +{ + struct in_addr in; + struct hostent * hostEntry; + + in.s_addr = address -> host; + + hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET); + if (hostEntry == NULL) + return enet_address_get_host_ip (address, name, nameLength); + + strncpy (name, hostEntry -> h_name, nameLength); + + return 0; +} + +ENetSocket +enet_socket_create (ENetSocketType type, const ENetAddress * address) +{ + ENetSocket newSocket = socket (PF_INET, type == ENET_SOCKET_TYPE_DATAGRAM ? SOCK_DGRAM : SOCK_STREAM, 0); + struct sockaddr_in sin; + + if (newSocket == ENET_SOCKET_NULL) + return ENET_SOCKET_NULL; + + memset (& sin, 0, sizeof (struct sockaddr_in)); + + sin.sin_family = AF_INET; + + if (address != NULL) + { + sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); + sin.sin_addr.s_addr = address -> host; + } + else + { + sin.sin_port = 0; + sin.sin_addr.s_addr = INADDR_ANY; + } + + if (bind (newSocket, + (struct sockaddr *) & sin, + sizeof (struct sockaddr_in)) == SOCKET_ERROR || + (type == ENET_SOCKET_TYPE_STREAM && + address != NULL && + address -> port != ENET_PORT_ANY && + listen (newSocket, SOMAXCONN) == SOCKET_ERROR)) + { + closesocket (newSocket); + + return ENET_SOCKET_NULL; + } + + return newSocket; +} + +int +enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) +{ + int result = SOCKET_ERROR; + switch (option) + { + case ENET_SOCKOPT_NONBLOCK: + { + u_long nonBlocking = (u_long) value; + result = ioctlsocket (socket, FIONBIO, & nonBlocking); + break; + } + + case ENET_SOCKOPT_BROADCAST: + result = setsockopt (socket, SOL_SOCKET, SO_BROADCAST, (char *) & value, sizeof (int)); + break; + + case ENET_SOCKOPT_RCVBUF: + result = setsockopt (socket, SOL_SOCKET, SO_RCVBUF, (char *) & value, sizeof (int)); + break; + + case ENET_SOCKOPT_SNDBUF: + result = setsockopt (socket, SOL_SOCKET, SO_SNDBUF, (char *) & value, sizeof (int)); + break; + + default: + break; + } + return result == SOCKET_ERROR ? -1 : 0; +} + +int +enet_socket_connect (ENetSocket socket, const ENetAddress * address) +{ + struct sockaddr_in sin; + + memset (& sin, 0, sizeof (struct sockaddr_in)); + + sin.sin_family = AF_INET; + sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); + sin.sin_addr.s_addr = address -> host; + + return connect (socket, (struct sockaddr *) & sin, sizeof (struct sockaddr_in)); +} + +ENetSocket +enet_socket_accept (ENetSocket socket, ENetAddress * address) +{ + SOCKET result; + struct sockaddr_in sin; + int sinLength = sizeof (struct sockaddr_in); + + result = accept (socket, + address != NULL ? (struct sockaddr *) & sin : NULL, + address != NULL ? & sinLength : NULL); + + if (result == INVALID_SOCKET) + return ENET_SOCKET_NULL; + + if (address != NULL) + { + address -> host = (enet_uint32) sin.sin_addr.s_addr; + address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); + } + + return result; +} + +void +enet_socket_destroy (ENetSocket socket) +{ + closesocket (socket); +} + +int +enet_socket_send (ENetSocket socket, + const ENetAddress * address, + const ENetBuffer * buffers, + size_t bufferCount) +{ + struct sockaddr_in sin; + DWORD sentLength; + + if (address != NULL) + { + memset (& sin, 0, sizeof (struct sockaddr_in)); + + sin.sin_family = AF_INET; + sin.sin_port = ENET_HOST_TO_NET_16 (address -> port); + sin.sin_addr.s_addr = address -> host; + } + + if (WSASendTo (socket, + (LPWSABUF) buffers, + (DWORD) bufferCount, + & sentLength, + 0, + address != NULL ? (struct sockaddr *) & sin : 0, + address != NULL ? sizeof (struct sockaddr_in) : 0, + NULL, + NULL) == SOCKET_ERROR) + { + if (WSAGetLastError () == WSAEWOULDBLOCK) + return 0; + + return -1; + } + + return (int) sentLength; +} + +int +enet_socket_receive (ENetSocket socket, + ENetAddress * address, + ENetBuffer * buffers, + size_t bufferCount) +{ + INT sinLength = sizeof (struct sockaddr_in); + DWORD flags = 0, + recvLength; + struct sockaddr_in sin; + + if (WSARecvFrom (socket, + (LPWSABUF) buffers, + (DWORD) bufferCount, + & recvLength, + & flags, + address != NULL ? (struct sockaddr *) & sin : NULL, + address != NULL ? & sinLength : NULL, + NULL, + NULL) == SOCKET_ERROR) + { + switch (WSAGetLastError ()) + { + case WSAEWOULDBLOCK: + case WSAECONNRESET: + return 0; + } + + return -1; + } + + if (flags & MSG_PARTIAL) + return -1; + + if (address != NULL) + { + address -> host = (enet_uint32) sin.sin_addr.s_addr; + address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); + } + + return (int) recvLength; +} + +int +enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeout) +{ + fd_set readSet, writeSet; + struct timeval timeVal; + int selectCount; + + timeVal.tv_sec = timeout / 1000; + timeVal.tv_usec = (timeout % 1000) * 1000; + + FD_ZERO (& readSet); + FD_ZERO (& writeSet); + + if (* condition & ENET_SOCKET_WAIT_SEND) + FD_SET (socket, & writeSet); + + if (* condition & ENET_SOCKET_WAIT_RECEIVE) + FD_SET (socket, & readSet); + + selectCount = select (socket + 1, & readSet, & writeSet, NULL, & timeVal); + + if (selectCount < 0) + return -1; + + * condition = ENET_SOCKET_WAIT_NONE; + + if (selectCount == 0) + return 0; + + if (FD_ISSET (socket, & writeSet)) + * condition |= ENET_SOCKET_WAIT_SEND; + + if (FD_ISSET (socket, & readSet)) + * condition |= ENET_SOCKET_WAIT_RECEIVE; + + return 0; +} + +#endif + diff --git a/src/engine/3dgui.cpp b/src/engine/3dgui.cpp new file mode 100644 index 0000000..d87f69a --- /dev/null +++ b/src/engine/3dgui.cpp @@ -0,0 +1,1034 @@ +// creates multiple gui windows that float inside the 3d world + +// special feature is that its mostly *modeless*: you can use this menu while playing, without turning menus on or off +// implementationwise, it is *stateless*: it keeps no internal gui structure, hit tests are instant, usage & implementation is greatly simplified + +#include "pch.h" +#include "engine.h" + +#include "textedit.h" + +static bool layoutpass, actionon = false; +static int mousebuttons = 0; +static struct gui *windowhit = NULL; + +static float firstx, firsty; + +static enum {FIELDCOMMIT, FIELDABORT, FIELDEDIT, FIELDSHOW} fieldmode = FIELDSHOW; +static bool fieldsactive = false; + +static bool hascursor; +static float cursorx = 0.5f, cursory = 0.5f; + +#define SHADOW 4 +#define ICON_SIZE (FONTH-SHADOW) +#define SKIN_W 256 +#define SKIN_H 128 +#define SKIN_SCALE 4 +#define INSERT (3*SKIN_SCALE) + +VARP(guiautotab, 6, 16, 40); +VARP(guiclicktab, 0, 0, 1); + +struct gui : g3d_gui +{ + struct list + { + int parent, w, h; + }; + + int nextlist; + + static vector lists; + static float hitx, hity; + static int curdepth, curlist, xsize, ysize, curx, cury; + static bool shouldmergehits, shouldautotab; + + static void reset() + { + lists.setsize(0); + } + + static int ty, tx, tpos, *tcurrent, tcolor; //tracking tab size and position since uses different layout method... + + void allowautotab(bool on) + { + shouldautotab = on; + } + + void autotab() + { + if(tcurrent) + { + if(layoutpass && !tpos) tcurrent = NULL; //disable tabs because you didn't start with one + if(shouldautotab && !curdepth && (layoutpass ? 0 : cury) + ysize > guiautotab*FONTH) tab(NULL, tcolor); + } + } + + bool shouldtab() + { + if(tcurrent && shouldautotab) + { + if(layoutpass) + { + int space = guiautotab*FONTH - ysize; + if(space < 0) return true; + int l = lists[curlist].parent; + while(l >= 0) + { + space -= lists[l].h; + if(space < 0) return true; + l = lists[l].parent; + } + } + else + { + int space = guiautotab*FONTH - cury; + if(ysize > space) return true; + int l = lists[curlist].parent; + while(l >= 0) + { + if(lists[l].h > space) return true; + l = lists[l].parent; + } + } + } + return false; + } + + bool visible() { return (!tcurrent || tpos==*tcurrent) && !layoutpass; } + + //tab is always at top of page + void tab(const char *name, int color) + { + if(curdepth != 0) return; + if(color) tcolor = color; + tpos++; + if(!name) + { + static string title; + s_sprintf(title)("%d", tpos); + name = title; + } + int w = text_width(name) - 2*INSERT; + if(layoutpass) + { + ty = max(ty, ysize); + ysize = 0; + } + else + { + cury = -ysize; + int h = FONTH-2*INSERT, + x1 = curx + tx, + x2 = x1 + w + ((skinx[3]-skinx[2]) + (skinx[5]-skinx[4]))*SKIN_SCALE, + y1 = cury - ((skiny[5]-skiny[1])-(skiny[3]-skiny[2]))*SKIN_SCALE-h, + y2 = cury; + bool hit = tcurrent && windowhit==this && hitx>=x1 && hity>=y1 && hitx=0) + { + lists[curlist].w = xsize; + lists[curlist].h = ysize; + } + list &l = lists.add(); + l.parent = curlist; + curlist = lists.length()-1; + xsize = ysize = 0; + } + else + { + curlist = nextlist++; + xsize = lists[curlist].w; + ysize = lists[curlist].h; + } + curdepth++; + } + + void poplist() + { + list &l = lists[curlist]; + if(layoutpass) + { + l.w = xsize; + l.h = ysize; + } + curlist = l.parent; + curdepth--; + if(curlist>=0) + { + xsize = lists[curlist].w; + ysize = lists[curlist].h; + if(ishorizontal()) cury -= l.h; + else curx -= l.w; + layout(l.w, l.h); + } + } + + int text (const char *text, int color, const char *icon) { autotab(); return button_(text, color, icon, false, false); } + int button(const char *text, int color, const char *icon) { autotab(); return button_(text, color, icon, true, false); } + int title (const char *text, int color, const char *icon) { autotab(); return button_(text, color, icon, false, true); } + + void separator() { autotab(); line_(5); } + void progress(float percent) { autotab(); line_(FONTH*2/5, percent); } + + //use to set min size (useful when you have progress bars) + void strut(int size) { layout(isvertical() ? size*FONTW : 0, isvertical() ? 0 : size*FONTH); } + //add space between list items + void space(int size) { layout(isvertical() ? 0 : size*FONTW, isvertical() ? size*FONTH : 0); } + + int layout(int w, int h) + { + if(layoutpass) + { + if(ishorizontal()) + { + xsize += w; + ysize = max(ysize, h); + } + else + { + xsize = max(xsize, w); + ysize += h; + } + return 0; + } + else + { + bool hit = ishit(w, h); + if(ishorizontal()) curx += w; + else cury += h; + return (hit && visible()) ? mousebuttons|G3D_ROLLOVER : 0; + } + } + + void mergehits(bool on) { shouldmergehits = on; } + + bool ishit(int w, int h, int x = curx, int y = cury) + { + if(shouldmergehits) return windowhit==this && (ishorizontal() ? hitx>=x && hitx=y && hity=x && hity>=y && hitxmode==EDITORFOCUSED && (e!=currentfocus() || fieldmode == FIELDSHOW)) + { + if(strcmp(e->lines[0].text, initval)) e->clear(initval); + } + e->linewrap = (length<0); + e->maxx = (e->linewrap) ? -1 : length; + e->maxy = (height<=0)?1:-1; + e->pixelwidth = abs(length)*FONTW; + if(e->linewrap && e->maxy==1) + { + int temp; + text_bounds(e->lines[0].text, temp, e->pixelheight, e->pixelwidth); //only single line editors can have variable height + } + else + e->pixelheight = FONTH*max(height, 1); + } + int h = e->pixelheight; + int w = e->pixelwidth + FONTW; + + bool wasvertical = isvertical(); + if(wasvertical && e->maxy != 1) pushlist(); + + char *result = NULL; + if(visible() && !layoutpass) + { + bool hit = ishit(w, h); + if(hit) + { + if(mousebuttons&G3D_DOWN) //mouse request focus + { + useeditor(name, initmode, true); + e->mark(false); + fieldmode = FIELDEDIT; + } + } + bool editing = (fieldmode != FIELDSHOW) && (e==currentfocus()); + if(hit && editing && (mousebuttons&G3D_PRESSED)!=0) e->hit(int(floor(hitx-(curx+FONTW/2))), int(floor(hity-cury)), (mousebuttons&G3D_DRAGGED)!=0); //mouse request position + if(editing && ((fieldmode==FIELDCOMMIT) || (fieldmode==FIELDABORT) || !hit)) // commit field if user pressed enter or wandered out of focus + { + if(fieldmode==FIELDCOMMIT || (fieldmode!=FIELDABORT && !hit)) result = e->currentline().text; + e->active = (e->mode!=EDITORFOCUSED); + fieldmode = FIELDSHOW; + } + else fieldsactive = true; + + e->draw(curx+FONTW/2, cury, color, hit && editing); + + notextureshader->set(); + glDisable(GL_TEXTURE_2D); + if(editing) glColor3f(1, 0, 0); + else glColor3ub(color>>16, (color>>8)&0xFF, color&0xFF); + glBegin(GL_LINE_LOOP); + rect_(curx, cury, w, h); + glEnd(); + glEnable(GL_TEXTURE_2D); + defaultshader->set(); + } + layout(w, h); + + if(e->maxy != 1) + { + int slines = e->lines.length()-e->pixelheight/FONTH; + if(slines > 0) + { + int pos = e->scrolly; + slider(e->scrolly, slines, 0, color, NULL); + if(pos != e->scrolly) e->cy = e->scrolly; + } + if(wasvertical) poplist(); + } + + return result; + } + + void rect_(float x, float y, float w, float h, int usetc = -1) + { + static const GLfloat tc[4][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; + if(usetc>=0) glTexCoord2fv(tc[usetc]); + glVertex2f(x, y); + if(usetc>=0) glTexCoord2fv(tc[(usetc+1)%4]); + glVertex2f(x + w, y); + if(usetc>=0) glTexCoord2fv(tc[(usetc+2)%4]); + glVertex2f(x + w, y + h); + if(usetc>=0) glTexCoord2fv(tc[(usetc+3)%4]); + glVertex2f(x, y + h); + xtraverts += 4; + } + + void text_(const char *text, int x, int y, int color, bool shadow) + { + if(shadow) draw_text(text, x+SHADOW, y+SHADOW, 0x00, 0x00, 0x00, 0xC0); + draw_text(text, x, y, color>>16, (color>>8)&0xFF, color&0xFF); + } + + void background(int color, int inheritw, int inherith) + { + if(layoutpass) return; + glDisable(GL_TEXTURE_2D); + notextureshader->set(); + glColor4ub(color>>16, (color>>8)&0xFF, color&0xFF, 0x80); + int w = xsize, h = ysize; + if(inheritw>0) + { + int parentw = curlist; + while(inheritw>0 && lists[parentw].parent>=0) + { + parentw = lists[parentw].parent; + inheritw--; + } + w = lists[parentw].w; + } + if(inherith>0) + { + int parenth = curlist; + while(inherith>0 && lists[parenth].parent>=0) + { + parenth = lists[parenth].parent; + inherith--; + } + h = lists[parenth].h; + } + glBegin(GL_QUADS); + rect_(curx, cury, w, h); + glEnd(); + glEnable(GL_TEXTURE_2D); + defaultshader->set(); + } + + void icon_(Texture *t, bool overlaid, bool tiled, int x, int y, int size, bool hit, int rotate = 0, int xoff = 0, int yoff = 0, Texture *glowtex = NULL, const vec &glowcolor = vec(1, 1, 1)) + { + float xs, ys, xt, yt; + if(tiled) + { + xt = min(1.0f, t->xs/(float)t->ys), + yt = min(1.0f, t->ys/(float)t->xs); + xs = size; + ys = size; + } + else + { + xt = 1.0f; + yt = 1.0f; + float scale = float(size)/max(t->xs, t->ys); //scale and preserve aspect ratio + xs = t->xs*scale; + ys = t->ys*scale; + x += int((size-xs)/2); + y += int((size-ys)/2); + } + if(hit && actionon) + { + glDisable(GL_TEXTURE_2D); + notextureshader->set(); + glColor4f(0, 0, 0, 0.75f); + glBegin(GL_QUADS); + rect_(x+SHADOW, y+SHADOW, xs, ys); + glEnd(); + glEnable(GL_TEXTURE_2D); + defaultshader->set(); + } + if(tiled) + { + static Shader *rgbonlyshader = NULL; + if(!rgbonlyshader) rgbonlyshader = lookupshaderbyname("rgbonly"); + rgbonlyshader->set(); + } + float tc[4][2] = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 } }; + if(rotate) + { + if((rotate&5) == 1) { swap(xoff, yoff); loopk(4) swap(tc[k][0], tc[k][1]); } + if(rotate >= 2 && rotate <= 4) { xoff *= -1; loopk(4) tc[k][0] *= -1; } + if(rotate <= 2 || rotate == 5) { yoff *= -1; loopk(4) tc[k][1] *= -1; } + } + loopk(4) { tc[k][0] = tc[k][0]/xt - float(xoff)/t->xs; tc[k][1] = tc[k][1]/yt - float(yoff)/t->ys; } + vec color = hit ? vec(1, 0.5f, 0.5f) : (overlaid ? vec(1, 1, 1) : light); + glColor3fv(color.v); + glBindTexture(GL_TEXTURE_2D, t->id); + glBegin(GL_QUADS); + glTexCoord2fv(tc[0]); glVertex2f(x, y); + glTexCoord2fv(tc[1]); glVertex2f(x+xs, y); + glTexCoord2fv(tc[2]); glVertex2f(x+xs, y+ys); + glTexCoord2fv(tc[3]); glVertex2f(x, y+ys); + glEnd(); + if(glowtex) + { + if(hit || overlaid) { loopk(3) color[k] *= glowcolor[k]; glColor3fv(color.v); } + else glColor3fv(glowcolor.v); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glBindTexture(GL_TEXTURE_2D, glowtex->id); + glBegin(GL_QUADS); + glTexCoord2fv(tc[0]); glVertex2f(x, y); + glTexCoord2fv(tc[1]); glVertex2f(x+xs, y); + glTexCoord2fv(tc[2]); glVertex2f(x+xs, y+ys); + glTexCoord2fv(tc[3]); glVertex2f(x, y+ys); + glEnd(); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + if(tiled) defaultshader->set(); + if(overlaid) + { + if(!overlaytex) overlaytex = textureload("data/guioverlay.png"); + glColor3fv(light.v); + glBindTexture(GL_TEXTURE_2D, overlaytex->id); + glBegin(GL_QUADS); + rect_(x, y, xs, ys, 0); + glEnd(); + } + } + + void line_(int size, float percent = 1.0f) + { + if(visible()) + { + if(!slidertex) slidertex = textureload("data/guislider.png"); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, slidertex->id); + glBegin(GL_QUADS); + if(percent < 0.99f) + { + glColor4f(light.x, light.y, light.z, 0.375f); + if(ishorizontal()) + rect_(curx + FONTH/2 - size, cury, size*2, ysize, 0); + else + rect_(curx, cury + FONTH/2 - size, xsize, size*2, 1); + } + glColor3fv(light.v); + if(ishorizontal()) + rect_(curx + FONTH/2 - size, cury + ysize*(1-percent), size*2, ysize*percent, 0); + else + rect_(curx, cury + FONTH/2 - size, xsize*percent, size*2, 1); + glEnd(); + } + layout(ishorizontal() ? FONTH : 0, ishorizontal() ? 0 : FONTH); + } + + int button_(const char *text, int color, const char *icon, bool clickable, bool center) + { + const int padding = 10; + int w = 0; + if(icon) w += ICON_SIZE; + if(icon && text) w += padding; + if(text) w += text_width(text); + + if(visible()) + { + bool hit = ishit(w, FONTH); + if(hit && clickable) color = 0xFF0000; + int x = curx; + if(isvertical() && center) x += (xsize-w)/2; + + if(icon) + { + s_sprintfd(tname)("packages/icons/%s.jpg", icon); + icon_(textureload(tname), false, false, x, cury, ICON_SIZE, clickable && hit); + x += ICON_SIZE; + } + if(icon && text) x += padding; + if(text) text_(text, x, cury, color, center || (hit && clickable && actionon)); + } + return layout(w, FONTH); + } + + static Texture *skintex, *overlaytex, *slidertex; + static const int skinx[], skiny[]; + static const struct patch { ushort left, right, top, bottom; uchar flags; } patches[]; + + void skin_(int x, int y, int gapw, int gaph, int start, int n)//int vleft, int vright, int vtop, int vbottom, int start, int n) + { + if(!skintex) skintex = textureload("data/guiskin.png"); + glBindTexture(GL_TEXTURE_2D, skintex->id); + int gapx1 = INT_MAX, gapy1 = INT_MAX, gapx2 = INT_MAX, gapy2 = INT_MAX; + float wscale = 1.0f/(SKIN_W*SKIN_SCALE), hscale = 1.0f/(SKIN_H*SKIN_SCALE); + + loopj(gui2d ? 1 : 2) + { + bool quads = false; + if(!gui2d) glDepthFunc(j ? GL_LEQUAL : GL_GREATER); + glColor4f(j ? light.x : 1.0f, j ? light.y : 1.0f, j ? light.z : 1.0f, gui2d || j ? 0.80f : 0.35f); //ghost when its behind something in depth + loopi(n) + { + const patch &p = patches[start+i]; + int left = skinx[p.left]*SKIN_SCALE, right = skinx[p.right]*SKIN_SCALE, + top = skiny[p.top]*SKIN_SCALE, bottom = skiny[p.bottom]*SKIN_SCALE; + float tleft = left*wscale, tright = right*wscale, + ttop = top*hscale, tbottom = bottom*hscale; + if(p.flags&0x1) + { + gapx1 = left; + gapx2 = right; + } + else if(left >= gapx2) + { + left += gapw - (gapx2-gapx1); + right += gapw - (gapx2-gapx1); + } + if(p.flags&0x10) + { + gapy1 = top; + gapy2 = bottom; + } + else if(top >= gapy2) + { + top += gaph - (gapy2-gapy1); + bottom += gaph - (gapy2-gapy1); + } + + //multiple tiled quads if necessary rather than a single stretched one + int ystep = bottom-top; + int yo = y+top; + while(ystep > 0) + { + if(p.flags&0x10 && yo+ystep-(y+top) > gaph) + { + ystep = gaph+y+top-yo; + tbottom = ttop+ystep*hscale; + } + int xstep = right-left; + int xo = x+left; + float tright2 = tright; + while(xstep > 0) + { + if(p.flags&0x01 && xo+xstep-(x+left) > gapw) + { + xstep = gapw+x+left-xo; + tright = tleft+xstep*wscale; + } + if(!quads) { quads = true; glBegin(GL_QUADS); } + glTexCoord2f(tleft, ttop); glVertex2f(xo, yo); + glTexCoord2f(tright, ttop); glVertex2f(xo+xstep, yo); + glTexCoord2f(tright, tbottom); glVertex2f(xo+xstep, yo+ystep); + glTexCoord2f(tleft, tbottom); glVertex2f(xo, yo+ystep); + xtraverts += 4; + if(!(p.flags&0x01)) break; + xo += xstep; + } + tright = tright2; + if(!(p.flags&0x10)) break; + yo += ystep; + } + } + if(quads) glEnd(); + else break; //if it didn't happen on the first pass, it won't happen on the second.. + } + if(!gui2d) glDepthFunc(GL_ALWAYS); + } + + vec origin, scale, *savedorigin; + float dist; + g3d_callback *cb; + bool gui2d; + + static float basescale, maxscale; + static bool passthrough; + static vec light; + + void adjustscale() + { + int w = xsize + (skinx[2]-skinx[1])*SKIN_SCALE + (skinx[10]-skinx[9])*SKIN_SCALE, h = ysize + (skiny[8]-skiny[6])*SKIN_SCALE; + if(tcurrent) h += ((skiny[5]-skiny[1])-(skiny[3]-skiny[2]))*SKIN_SCALE + FONTH-2*INSERT; + else h += (skiny[5]-skiny[3])*SKIN_SCALE; + + float aspect = float(screen->h)/float(screen->w), fit = 1.0f; + if(w*aspect*basescale>1.0f) fit = 1.0f/(w*aspect*basescale); + if(h*basescale*fit>maxscale) fit *= maxscale/(h*basescale*fit); + origin = vec(0.5f-((w-xsize)/2 - (skinx[2]-skinx[1])*SKIN_SCALE)*aspect*scale.x*fit, 0.5f + (0.5f*h-(skiny[8]-skiny[6])*SKIN_SCALE)*scale.y*fit, 0); + scale = vec(aspect*scale.x*fit, scale.y*fit, 1); + } + + void start(int starttime, float initscale, int *tab, bool allowinput) + { + if(gui2d) + { + initscale *= 0.025f; + if(allowinput) hascursor = true; + } + basescale = initscale; + if(layoutpass) scale.x = scale.y = scale.z = basescale*min((totalmillis-starttime)/300.0f, 1.0f); + passthrough = scale.xo.y, origin.x-camera1->o.x); + glTranslatef(origin.x, origin.y, origin.z); + glRotatef(yaw/RAD-90, 0, 0, 1); + glRotatef(-90, 1, 0, 0); + glScalef(-scale.x, scale.y, scale.z); + + vec dir; + lightreaching(origin, light, dir, 0, 0.5f); + float intensity = vec(yaw, 0.0f).dot(dir); + light.mul(1.0f + max(intensity, 0.0f)); + } + + skin_(curx-skinx[2]*SKIN_SCALE, cury-skiny[5]*SKIN_SCALE, xsize, ysize, 0, 9); + if(!tcurrent) skin_(curx-skinx[5]*SKIN_SCALE, cury-skiny[5]*SKIN_SCALE, xsize, 0, 9, 1); + } + } + + void end() + { + if(layoutpass) + { + xsize = max(tx, xsize); + ysize = max(ty, ysize); + ysize = max(ysize, (skiny[6]-skiny[5])*SKIN_SCALE); + if(tcurrent) *tcurrent = max(1, min(*tcurrent, tpos)); + if(gui2d) adjustscale(); + if(!windowhit && !passthrough) + { + int intersects = INTERSECT_MIDDLE; + if(gui2d) + { + hitx = (cursorx - origin.x)/scale.x; + hity = (cursory - origin.y)/scale.y; + } + else + { + vec planenormal = vec(origin).sub(camera1->o).set(2, 0).normalize(), intersectionpoint; + intersects = intersect_plane_line(camera1->o, worldpos, origin, planenormal, intersectionpoint); + vec intersectionvec = vec(intersectionpoint).sub(origin), xaxis(-planenormal.y, planenormal.x, 0); + hitx = xaxis.dot(intersectionvec)/scale.x; + hity = -intersectionvec.z/scale.y; + } + if((mousebuttons & G3D_PRESSED) && (fabs(hitx-firstx) > 2 || fabs(hity - firsty) > 2)) mousebuttons |= G3D_DRAGGED; + if(intersects>=INTERSECT_MIDDLE && hitx>=-xsize/2 && hitx<=xsize/2 && hity<=0) + { + if(hity>=-ysize || (tcurrent && hity>=-ysize-(FONTH-2*INSERT)-((skiny[5]-skiny[1])-(skiny[3]-skiny[2]))*SKIN_SCALE && hitx<=tx-xsize/2)) + windowhit = this; + } + } + } + else + { + if(tcurrent && tx gui::lists; +float gui::basescale, gui::maxscale = 1, gui::hitx, gui::hity; +bool gui::passthrough, gui::shouldmergehits = false, gui::shouldautotab = true; +vec gui::light; +int gui::curdepth, gui::curlist, gui::xsize, gui::ysize, gui::curx, gui::cury; +int gui::ty, gui::tx, gui::tpos, *gui::tcurrent, gui::tcolor; +static vector guis2d, guis3d; + +VARP(guipushdist, 1, 4, 64); + +bool menukey(int code, bool isdown, int cooked) +{ + if(code==-1 && g3d_windowhit(isdown, true)) return true; + else if(code==-3 && g3d_windowhit(isdown, false)) return true; + + editor *e = currentfocus(); + if((fieldmode == FIELDSHOW) || !e) + { + if(windowhit) switch(code) + { + case -4: // window "management" + if(isdown) + { + if(windowhit->gui2d) + { + vec origin = *guis2d.last().savedorigin; + int i = windowhit - &guis2d[0]; + for(int j = guis2d.length()-1; j > i; j--) *guis2d[j].savedorigin = *guis2d[j-1].savedorigin; + *windowhit->savedorigin = origin; + if(guis2d.length() > 1) + { + if(camera1->o.dist(*windowhit->savedorigin) <= camera1->o.dist(*guis2d.last().savedorigin)) + windowhit->savedorigin->add(camdir); + } + } + else windowhit->savedorigin->add(vec(camdir).mul(guipushdist)); + } + return true; + case -5: + if(isdown) + { + if(windowhit->gui2d) + { + vec origin = *guis2d[0].savedorigin; + loopj(guis2d.length()-1) *guis2d[j].savedorigin = *guis2d[j + 1].savedorigin; + *guis2d.last().savedorigin = origin; + if(guis2d.length() > 1) + { + if(camera1->o.dist(*guis2d.last().savedorigin) >= camera1->o.dist(*guis2d[0].savedorigin)) + guis2d.last().savedorigin->sub(camdir); + } + } + else windowhit->savedorigin->sub(vec(camdir).mul(guipushdist)); + } + return true; + } + + return false; + } + switch(code) + { + case SDLK_ESCAPE: //cancel editing without commit + if(isdown) fieldmode = FIELDABORT; + return true; + case SDLK_RETURN: + case SDLK_TAB: + if(cooked && (e->maxy != 1)) break; + case SDLK_KP_ENTER: + if(isdown) fieldmode = FIELDCOMMIT; //signal field commit (handled when drawing field) + return true; + case SDLK_HOME: + case SDLK_END: + case SDLK_PAGEUP: + case SDLK_PAGEDOWN: + case SDLK_DELETE: + case SDLK_BACKSPACE: + case SDLK_UP: + case SDLK_DOWN: + case SDLK_LEFT: + case SDLK_RIGHT: + case -4: + case -5: + break; + default: + if(!cooked || (code<32)) return false; + } + if(!isdown) return true; + e->key(code, cooked); + return true; +} + +void g3d_cursorpos(float &x, float &y) +{ + if(guis2d.length()) { x = cursorx; y = cursory; } + else x = y = 0.5f; +} + +void g3d_resetcursor() +{ + cursorx = cursory = 0.5f; +} + +bool g3d_movecursor(int dx, int dy) +{ + if(!guis2d.length() || !hascursor) return false; + const float CURSORSCALE = 500.0f; + cursorx = max(0.0f, min(1.0f, cursorx+dx*(screen->h/(screen->w*CURSORSCALE)))); + cursory = max(0.0f, min(1.0f, cursory+dy/CURSORSCALE)); + return true; +} + +VARNP(guifollow, useguifollow, 0, 1, 1); +VARNP(gui2d, usegui2d, 0, 1, 1); + +void g3d_addgui(g3d_callback *cb, vec &origin, int flags) +{ + bool gui2d = flags&GUI_FORCE_2D || (flags&GUI_2D && usegui2d); + if(!gui2d && flags&GUI_FOLLOW && useguifollow) origin.z = player->o.z-(player->eyeheight-1); + gui &g = (gui2d ? guis2d : guis3d).add(); + g.cb = cb; + g.origin = origin; + g.savedorigin = &origin; + g.dist = camera1->o.dist(g.origin); + g.gui2d = gui2d; +} + +void g3d_limitscale(float scale) +{ + gui::maxscale = scale; +} + +int g3d_sort(gui *a, gui *b) { return (int)(a->dist>b->dist)*2-1; } + +bool g3d_windowhit(bool on, bool act) +{ + extern int cleargui(int n); + if(act) + { + if(on) { firstx = gui::hitx; firsty = gui::hity; } + mousebuttons |= (actionon=on) ? G3D_DOWN : G3D_UP; + } else if(!on && windowhit) cleargui(1); + return (guis2d.length() && hascursor) || (windowhit && !windowhit->gui2d); +} + +void g3d_render() +{ + windowhit = NULL; + if(actionon) mousebuttons |= G3D_PRESSED; + + gui::reset(); + guis2d.setsize(0); + guis3d.setsize(0); + + // call all places in the engine that may want to render a gui from here, they call g3d_addgui() + extern void g3d_texturemenu(); + + g3d_texturemenu(); + g3d_mainmenu(); + cl->g3d_gamemenus(); + + guis2d.sort(g3d_sort); + guis3d.sort(g3d_sort); + + readyeditors(); + bool wasfocused = (fieldmode!=FIELDSHOW); + fieldsactive = false; + + hascursor = false; + + layoutpass = true; + loopv(guis2d) guis2d[i].cb->gui(guis2d[i], true); + loopv(guis3d) guis3d[i].cb->gui(guis3d[i], true); + layoutpass = false; + + if(guis2d.length() || guis3d.length()) + { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + if(guis3d.length()) + { + glDepthFunc(GL_ALWAYS); + glDepthMask(GL_FALSE); + + loopvrev(guis3d) guis3d[i].cb->gui(guis3d[i], false); + + glDepthFunc(GL_LESS); + glDepthMask(GL_TRUE); + } + + if(guis2d.length()) + { + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, 1, 1, 0, -1, 1); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glDisable(GL_DEPTH_TEST); + + loopvrev(guis2d) guis2d[i].cb->gui(guis2d[i], false); + + glEnable(GL_DEPTH_TEST); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + } + + if(guis2d.length() || guis3d.length()) + { + glDisable(GL_BLEND); + } + + flusheditors(); + if(!fieldsactive) fieldmode = FIELDSHOW; //didn't draw any fields, so loose focus - mainly for menu closed + if((fieldmode!=FIELDSHOW) != wasfocused) + { + SDL_EnableUNICODE(fieldmode!=FIELDSHOW); + keyrepeat(fieldmode!=FIELDSHOW || editmode); + } + + mousebuttons = 0; +} + diff --git a/src/engine/CVS/Entries b/src/engine/CVS/Entries new file mode 100644 index 0000000..a00e94b --- /dev/null +++ b/src/engine/CVS/Entries @@ -0,0 +1,55 @@ +/animmodel.h/1.33/Tue May 27 17:16:18 2008// +/bih.cpp/1.9/Sun May 18 07:13:41 2008// +/bih.h/1.6/Fri May 16 02:05:40 2008// +/client.cpp/1.40/Wed May 7 08:00:45 2008// +/command.cpp/1.132/Wed Jun 11 02:44:05 2008// +/cubeloader.cpp/1.42/Wed May 7 08:00:45 2008// +/decal.cpp/1.39/Mon Jun 16 23:49:58 2008// +/dynlight.cpp/1.6/Sat May 24 06:25:24 2008// +/engine.h/1.287/Mon Jun 16 23:49:58 2008// +/explosion.h/1.13/Sat Jun 14 21:23:47 2008// +/glare.cpp/1.7/Mon May 26 16:44:56 2008// +/grass.cpp/1.40/Sun May 18 02:17:03 2008// +/lensflare.h/1.2/Sat Jun 14 21:23:47 2008// +/lightmap.cpp/1.188/Wed Jun 11 02:44:05 2008// +/lightmap.h/1.24/Sat May 10 04:29:51 2008// +/lightning.h/1.3/Tue Jun 17 05:25:42 2008// +/md2.h/1.114/Thu May 1 11:32:53 2008// +/md3.h/1.139/Fri May 16 01:12:08 2008// +/md5.h/1.27/Wed May 28 14:52:50 2008// +/menus.cpp/1.102/Wed Jun 11 22:48:00 2008// +/model.h/1.31/Sat May 17 02:25:24 2008// +/normal.cpp/1.35/Sat May 24 15:32:10 2008// +/obj.h/1.2/Sat May 17 01:14:39 2008// +/octa.cpp/1.79/Mon Jun 16 23:49:58 2008// +/octa.h/1.85/Wed Jun 4 03:08:48 2008// +/octaedit.cpp/1.251/Mon Jun 16 23:49:58 2008// +/octarender.cpp/1.342/Mon Jun 16 23:49:58 2008// +/pvs.cpp/1.24/Mon Jun 16 23:49:58 2008// +/rendermodel.cpp/1.277/Sat Jun 14 10:18:19 2008// +/renderparticles.cpp/1.245/Sat Jun 14 21:23:47 2008// +/rendertarget.h/1.14/Thu May 29 21:03:34 2008// +/server.cpp/1.91/Thu May 29 13:52:42 2008// +/serverbrowser.cpp/1.60/Tue May 20 21:33:32 2008// +/shadowmap.cpp/1.58/Wed Jun 11 02:44:06 2008// +/sound.cpp/1.67/Sat May 17 21:23:51 2008// +/textedit.h/1.24/Thu Jun 12 19:26:20 2008// +/texture.cpp/1.122/Mon Jun 16 23:49:58 2008// +/texture.h/1.50/Mon May 26 16:44:56 2008// +/vertmodel.h/1.125/Fri May 16 01:12:08 2008// +/water.cpp/1.243/Wed Jun 11 02:44:06 2008// +/world.cpp/1.167/Mon Jun 9 19:47:44 2008// +/world.h/1.66/Mon Jun 16 23:49:58 2008// +/worldio.cpp/1.124/Mon Jun 16 23:49:58 2008// +/3dgui.cpp/1.148/Sat Jun 21 12:11:22 2008// +/console.cpp/1.87/Sat Jun 21 12:11:22 2008// +/main.cpp/1.234/Sat Jun 21 12:11:23 2008// +/material.cpp/1.47/Sat Jun 21 12:11:23 2008// +/physics.cpp/1.372/Sat Jun 21 12:11:24 2008// +/rendergl.cpp/1.454/Sat Jun 21 12:11:24 2008// +/rendersky.cpp/1.36/Sat Jun 21 12:11:25 2008// +/rendertext.cpp/1.72/Sat Jun 21 12:11:25 2008// +/renderva.cpp/1.171/Sat Jun 21 12:11:25 2008// +/shader.cpp/1.121/Sat Jun 21 12:11:25 2008// +/skelmodel.h/1.41/Sat Jun 21 12:11:26 2008// +D diff --git a/src/engine/CVS/Repository b/src/engine/CVS/Repository new file mode 100644 index 0000000..ed0ccd2 --- /dev/null +++ b/src/engine/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/engine diff --git a/src/engine/CVS/Root b/src/engine/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/engine/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/engine/animmodel.h b/src/engine/animmodel.h new file mode 100644 index 0000000..e0640db --- /dev/null +++ b/src/engine/animmodel.h @@ -0,0 +1,1367 @@ +VARP(lightmodels, 0, 1, 1); +VARP(envmapmodels, 0, 1, 1); +VARP(glowmodels, 0, 1, 1); +VARP(bumpmodels, 0, 1, 1); +VARP(fullbrightmodels, 0, 0, 200); + +struct animmodel : model +{ + struct animspec + { + int frame, range; + float speed; + int priority; + }; + + struct animpos + { + int fr1, fr2; + float t; + + void setframes(const animinfo &info) + { + if(info.range<=1) + { + fr1 = 0; + t = 0; + } + else + { + int time = info.anim&ANIM_SETTIME ? info.basetime : lastmillis-info.basetime; + fr1 = (int)(time/info.speed); // round to full frames + t = (time-fr1*info.speed)/info.speed; // progress of the frame, value from 0.0f to 1.0f + } + if(info.anim&ANIM_LOOP) + { + fr1 = fr1%info.range+info.frame; + fr2 = fr1+1; + if(fr2>=info.frame+info.range) fr2 = info.frame; + } + else + { + fr1 = min(fr1, info.range-1)+info.frame; + fr2 = min(fr1+1, info.frame+info.range-1); + } + if(info.anim&ANIM_REVERSE) + { + fr1 = (info.frame+info.range-1)-(fr1-info.frame); + fr2 = (info.frame+info.range-1)-(fr2-info.frame); + } + } + + bool operator==(const animpos &a) const { return fr1==a.fr1 && fr2==a.fr2 && (fr1==fr2 || t==a.t); } + bool operator!=(const animpos &a) const { return fr1!=a.fr1 || fr2!=a.fr2 || (fr1!=fr2 && t!=a.t); } + }; + + struct part; + + struct animstate + { + part *owner; + int anim; + animpos cur, prev; + float interp; + + bool operator==(const animstate &a) const { return cur==a.cur && (interp<1 ? interp==a.interp && prev==a.prev : a.interp>=1); } + bool operator!=(const animstate &a) const { return cur!=a.cur || (interp<1 ? interp!=a.interp || prev!=a.prev : a.interp<1); } + }; + + struct linkedpart; + struct mesh; + + struct skin + { + part *owner; + Texture *tex, *masks, *envmap, *unlittex, *normalmap; + Shader *shader; + float spec, ambient, glow, specglare, glowglare, fullbright, envmapmin, envmapmax, translucency, scrollu, scrollv, alphatest; + bool alphablend; + + skin() : owner(0), tex(notexture), masks(notexture), envmap(NULL), unlittex(NULL), normalmap(NULL), shader(NULL), spec(1.0f), ambient(0.3f), glow(3.0f), specglare(1), glowglare(1), fullbright(0), envmapmin(0), envmapmax(0), translucency(0.5f), scrollu(0), scrollv(0), alphatest(0.9f), alphablend(true) {} + + bool multitextured() { return enableglow; } + bool envmapped() { return hasCM && envmapmax>0 && envmapmodels && (renderpath!=R_FIXEDFUNCTION || maxtmus >= (fogging ? 4 : 3)); } + bool bumpmapped() { return renderpath!=R_FIXEDFUNCTION && normalmap && bumpmodels; } + bool normals() { return renderpath!=R_FIXEDFUNCTION || (lightmodels && !fullbright) || envmapped() || bumpmapped(); } + bool tangents() { return bumpmapped(); } + + void setuptmus(const animstate *as, bool masked) + { + if(fullbright) + { + if(enablelighting) { glDisable(GL_LIGHTING); enablelighting = false; } + } + else if(lightmodels && !enablelighting) { glEnable(GL_LIGHTING); enablelighting = true; } + int needsfog = -1; + if(fogging) + { + needsfog = masked ? 2 : 1; + if(fogtmu!=needsfog && fogtmu>=0) disablefog(true); + } + if(masked!=enableglow) lasttex = lastmasks = NULL; + float mincolor = as->anim&ANIM_FULLBRIGHT ? fullbrightmodels/100.0f : 0, + r = max(lightcolor.x, mincolor), g = max(lightcolor.y, mincolor), b = max(lightcolor.z, mincolor); + if(masked) + { + if(enableoverbright) disableoverbright(); + if(!enableglow) setuptmu(0, "K , C @ T", as->anim&ANIM_ENVMAP && envmapmax>0 ? "Ca * Ta" : NULL); + int glowscale = glow>2 ? 4 : (glow>1 || mincolor>1 ? 2 : 1); + float envmap = as->anim&ANIM_ENVMAP && envmapmax>0 ? 0.2f*envmapmax + 0.8f*envmapmin : 1; + colortmu(0, glow/glowscale, glow/glowscale, glow/glowscale); + if(fullbright) glColor4f(fullbright/glowscale, fullbright/glowscale, fullbright/glowscale, envmap); + else if(lightmodels) + { + GLfloat material[4] = { 1.0f/glowscale, 1.0f/glowscale, 1.0f/glowscale, envmap }; + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, material); + } + else glColor4f(r/glowscale, g/glowscale, b/glowscale, envmap); + + glActiveTexture_(GL_TEXTURE1_ARB); + if(!enableglow || (!enableenvmap && as->anim&ANIM_ENVMAP && envmapmax>0) || as->anim&ANIM_TRANSLUCENT) + { + if(!enableglow) glEnable(GL_TEXTURE_2D); + if(!(as->anim&ANIM_ENVMAP && envmapmax>0) && as->anim&ANIM_TRANSLUCENT) colortmu(1, 0, 0, 0, translucency); + setuptmu(1, "P * T", as->anim&ANIM_ENVMAP && envmapmax>0 ? "= Pa" : (as->anim&ANIM_TRANSLUCENT ? "Ta * Ka" : "= Ta")); + } + scaletmu(1, glowscale); + + if(as->anim&ANIM_ENVMAP && envmapmax>0 && as->anim&ANIM_TRANSLUCENT) + { + glActiveTexture_(GL_TEXTURE0_ARB+envmaptmu); + colortmu(envmaptmu, 0, 0, 0, translucency); + } + + if(needsfog<0) glActiveTexture_(GL_TEXTURE0_ARB); + + enableglow = true; + } + else + { + if(enableglow) disableglow(); + int colorscale = 1; + if(mincolor>1 && maxtmus>=1) + { + colorscale = 2; + if(!enableoverbright) { setuptmu(0, "C * T x 2"); enableoverbright = true; } + } + else if(enableoverbright) disableoverbright(); + if(fullbright) glColor4f(fullbright/colorscale, fullbright/colorscale, fullbright, as->anim&ANIM_TRANSLUCENT ? translucency : 1); + else if(lightmodels) + { + GLfloat material[4] = { 1.0f/colorscale, 1.0f/colorscale, 1.0f/colorscale, as->anim&ANIM_TRANSLUCENT ? translucency : 1 }; + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, material); + } + else glColor4f(r/colorscale, g/colorscale, b/colorscale, as->anim&ANIM_TRANSLUCENT ? translucency : 1); + } + if(needsfog>=0) + { + if(needsfog!=fogtmu) + { + fogtmu = needsfog; + glActiveTexture_(GL_TEXTURE0_ARB+fogtmu); + glEnable(GL_TEXTURE_1D); + glEnable(GL_TEXTURE_GEN_S); + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + setuptmu(fogtmu, "K , P @ Ta", masked && as->anim&ANIM_ENVMAP && envmapmax>0 ? "Ka , Pa @ Ta" : "= Pa"); + uchar wcol[3]; + getwatercolour(wcol); + colortmu(fogtmu, wcol[0]/255.0f, wcol[1]/255.0f, wcol[2]/255.0f, 0); + if(!fogtex) createfogtex(); + glBindTexture(GL_TEXTURE_1D, fogtex); + } + else glActiveTexture_(GL_TEXTURE0_ARB+fogtmu); + if(!enablefog) { glEnable(GL_TEXTURE_1D); enablefog = true; } + GLfloat s[4] = { -refractfogplane.x/waterfog, -refractfogplane.y/waterfog, -refractfogplane.z/waterfog, -refractfogplane.offset/waterfog }; + glTexGenfv(GL_S, GL_OBJECT_PLANE, s); + glActiveTexture_(GL_TEXTURE0_ARB); + } + if(lightmodels && !fullbright) + { + float ambientk = min(max(ambient, mincolor)*0.75f, 1.0f), + diffusek = 1-ambientk; + GLfloat ambientcol[4] = { r*ambientk, g*ambientk, b*ambientk, 1 }, + diffusecol[4] = { r*diffusek, g*diffusek, b*diffusek, 1 }; + float ambientmax = max(ambientcol[0], max(ambientcol[1], ambientcol[2])), + diffusemax = max(diffusecol[0], max(diffusecol[1], diffusecol[2])); + if(ambientmax>1e-3f) loopk(3) ambientcol[k] *= min(1.5f, 1.0f/min(ambientmax, 1.0f)); + if(diffusemax>1e-3f) loopk(3) diffusecol[k] *= min(1.5f, 1.0f/min(diffusemax, 1.0f)); + glLightfv(GL_LIGHT0, GL_AMBIENT, ambientcol); + glLightfv(GL_LIGHT0, GL_DIFFUSE, diffusecol); + } + } + + void setshaderparams(mesh *m, const animstate *as, bool masked) + { + if(fullbright) + { + glColor4f(fullbright/2, fullbright/2, fullbright/2, as->anim&ANIM_TRANSLUCENT ? translucency : 1); + setenvparamf("ambient", SHPARAM_VERTEX, 3, 2, 2, 2, 1); + setenvparamf("ambient", SHPARAM_PIXEL, 3, 2, 2, 2, 1); + } + else + { + float mincolor = as->anim&ANIM_FULLBRIGHT ? fullbrightmodels/100.0f : 0; + glColor4f(max(lightcolor.x, mincolor), + max(lightcolor.y, mincolor), + max(lightcolor.z, mincolor), + as->anim&ANIM_TRANSLUCENT ? translucency : 1); + setenvparamf("specscale", SHPARAM_PIXEL, 2, spec, spec, spec); + float minshade = max(ambient, mincolor); + setenvparamf("ambient", SHPARAM_VERTEX, 3, minshade, minshade, minshade, 1); + setenvparamf("ambient", SHPARAM_PIXEL, 3, minshade, minshade, minshade, 1); + } + setenvparamf("glowscale", SHPARAM_PIXEL, 4, glow, glow, glow); + setenvparamf("millis", SHPARAM_VERTEX, 5, lastmillis/1000.0f, lastmillis/1000.0f, lastmillis/1000.0f); + if(glaring) setenvparamf("glarescale", SHPARAM_PIXEL, 7, 16*specglare, 4*glowglare); + } + + void setshader(mesh *m, const animstate *as, bool masked) + { + #define SETMODELSHADER(m, name) \ + do \ + { \ + static Shader *name##shader = NULL; \ + if(!name##shader) name##shader = lookupshaderbyname(#name); \ + m->setshader(name##shader); \ + } \ + while(0) + if(shader) m->setshader(shader); + else if(bumpmapped()) + { + if(as->anim&ANIM_ENVMAP && envmapmax>0) + { + if(lightmodels && !fullbright && (masked || spec>=0.01f)) SETMODELSHADER(m, bumpenvmapmodel); + else SETMODELSHADER(m, bumpenvmapnospecmodel); + setlocalparamf("envmapscale", SHPARAM_PIXEL, 6, envmapmin-envmapmax, envmapmax); + } + else if(masked && lightmodels && !fullbright) SETMODELSHADER(m, bumpmasksmodel); + else if(masked && glowmodels) SETMODELSHADER(m, bumpmasksnospecmodel); + else if(spec>=0.01f && lightmodels && !fullbright) SETMODELSHADER(m, bumpmodel); + else SETMODELSHADER(m, bumpnospecmodel); + } + else if(as->anim&ANIM_ENVMAP && envmapmax>0) + { + if(lightmodels && !fullbright && (masked || spec>=0.01f)) SETMODELSHADER(m, envmapmodel); + else SETMODELSHADER(m, envmapnospecmodel); + setlocalparamf("envmapscale", SHPARAM_VERTEX, 6, envmapmin-envmapmax, envmapmax); + } + else if(masked && lightmodels && !fullbright) SETMODELSHADER(m, masksmodel); + else if(masked && glowmodels) SETMODELSHADER(m, masksnospecmodel); + else if(spec>=0.01f && lightmodels && !fullbright) SETMODELSHADER(m, stdmodel); + else SETMODELSHADER(m, nospecmodel); + } + + void bind(mesh *b, const animstate *as) + { + if(as->anim&ANIM_NOSKIN) + { + if(enablealphatest) { glDisable(GL_ALPHA_TEST); enablealphatest = false; } + if(!(as->anim&ANIM_SHADOW) && enablealphablend) { glDisable(GL_BLEND); enablealphablend = false; } + if(enableglow) disableglow(); + if(enableenvmap) disableenvmap(); + if(enablelighting) { glDisable(GL_LIGHTING); enablelighting = false; } + if(enablefog) disablefog(true); + if(shadowmapping) SETMODELSHADER(b, shadowmapcaster); + else /*if(as->anim&ANIM_SHADOW)*/ SETMODELSHADER(b, dynshadow); // this shader also gets used with color mask disabled + return; + } + Texture *s = bumpmapped() && unlittex ? unlittex : tex, + *m = masks->type==Texture::STUB ? notexture : masks, + *n = bumpmapped() ? normalmap : NULL; + if((renderpath==R_FIXEDFUNCTION || !lightmodels) && + (!glowmodels || (renderpath==R_FIXEDFUNCTION && fogging && maxtmus<=2)) && + (!envmapmodels || !(as->anim&ANIM_ENVMAP) || envmapmax<=0)) + m = notexture; + if(renderpath==R_FIXEDFUNCTION) setuptmus(as, m!=notexture); + else + { + setshaderparams(b, as, m!=notexture); + setshader(b, as, m!=notexture); + } + if(s!=lasttex) + { + if(enableglow) glActiveTexture_(GL_TEXTURE1_ARB); + glBindTexture(GL_TEXTURE_2D, s->id); + if(enableglow) glActiveTexture_(GL_TEXTURE0_ARB); + lasttex = s; + } + if(n && n!=lastnormalmap) + { + glActiveTexture_(GL_TEXTURE3_ARB); + glBindTexture(GL_TEXTURE_2D, n->id); + glActiveTexture_(GL_TEXTURE0_ARB); + } + if(s->bpp==32) + { + if(alphablend) + { + if(!enablealphablend && !reflecting && !refracting) + { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + enablealphablend = true; + } + } + else if(enablealphablend) { glDisable(GL_BLEND); enablealphablend = false; } + if(alphatest>0) + { + if(!enablealphatest) { glEnable(GL_ALPHA_TEST); enablealphatest = true; } + if(lastalphatest!=alphatest) + { + glAlphaFunc(GL_GREATER, alphatest); + lastalphatest = alphatest; + } + } + else if(enablealphatest) { glDisable(GL_ALPHA_TEST); enablealphatest = false; } + } + else + { + if(enablealphatest) { glDisable(GL_ALPHA_TEST); enablealphatest = false; } + if(enablealphablend && !(as->anim&ANIM_TRANSLUCENT)) { glDisable(GL_BLEND); enablealphablend = false; } + } + if(m!=lastmasks && m!=notexture) + { + if(!enableglow) glActiveTexture_(GL_TEXTURE1_ARB); + glBindTexture(GL_TEXTURE_2D, m->id); + if(!enableglow) glActiveTexture_(GL_TEXTURE0_ARB); + lastmasks = m; + } + if((renderpath!=R_FIXEDFUNCTION || m!=notexture) && as->anim&ANIM_ENVMAP && envmapmax>0) + { + GLuint emtex = envmap ? envmap->id : closestenvmaptex; + if(!enableenvmap || lastenvmaptex!=emtex) + { + glActiveTexture_(GL_TEXTURE0_ARB+envmaptmu); + if(!enableenvmap) + { + glEnable(GL_TEXTURE_CUBE_MAP_ARB); + if(!lastenvmaptex && renderpath==R_FIXEDFUNCTION) + { + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB); + glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB); + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + glEnable(GL_TEXTURE_GEN_R); + } + enableenvmap = true; + } + if(lastenvmaptex!=emtex) { glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, emtex); lastenvmaptex = emtex; } + glActiveTexture_(GL_TEXTURE0_ARB); + } + } + else if(enableenvmap) disableenvmap(); + } + }; + + struct meshgroup; + + struct mesh + { + meshgroup *group; + char *name; + bool noclip; + + mesh() : group(NULL), name(NULL), noclip(false) + { + } + + virtual ~mesh() + { + DELETEA(name); + } + + virtual mesh *allocate() = 0; + virtual mesh *copy() + { + mesh &m = *allocate(); + if(name) m.name = newstring(name); + m.noclip = noclip; + return &m; + } + + virtual void scaleverts(const vec &transdiff, float scalediff) {} + virtual void calcbb(int frame, vec &bbmin, vec &bbmax, const matrix3x4 &m) {} + virtual void gentris(int frame, Texture *tex, vector *out, const matrix3x4 &m) {} + + virtual void setshader(Shader *s) + { + if(glaring) s->variant(0, 2)->set(); + else s->set(); + } + }; + + struct meshgroup + { + meshgroup *next; + int shared; + char *name; + vector meshes; + float scale; + vec translate; + + meshgroup() : next(NULL), shared(0), name(NULL), scale(1), translate(0, 0, 0) + { + } + + virtual ~meshgroup() + { + DELETEA(name); + meshes.deletecontentsp(); + DELETEP(next); + } + + virtual int findtag(const char *name) { return -1; } + virtual void concattagtransform(int frame, int i, const matrix3x4 &m, matrix3x4 &n) {} + + void calcbb(int frame, vec &bbmin, vec &bbmax, const matrix3x4 &m) + { + loopv(meshes) meshes[i]->calcbb(frame, bbmin, bbmax, m); + } + + void gentris(int frame, vector &skins, vector *tris, const matrix3x4 &m) + { + loopv(meshes) meshes[i]->gentris(frame, skins[i].tex, tris, m); + } + + virtual int totalframes() const { return 1; } + bool hasframe(int i) const { return i>=0 && i=0 && i+n<=totalframes(); } + int clipframes(int i, int n) const { return min(n, totalframes() - i); } + + virtual meshgroup *allocate() = 0; + virtual meshgroup *copy() + { + meshgroup &group = *allocate(); + group.name = newstring(name); + loopv(meshes) group.meshes.add(meshes[i]->copy())->group = &group; + group.scale = scale; + group.translate = translate; + return &group; + } + + virtual void scaletags(const vec &transdiff, float scalediff) {} + + meshgroup *scaleverts(float nscale, const vec &ntranslate) + { + if(nscale==scale && ntranslate==translate) { shared++; return this; } + else if(next || shared) + { + if(!next) next = copy(); + return next->scaleverts(nscale, ntranslate); + } + float scalediff = nscale/scale; + vec transdiff(ntranslate); + transdiff.sub(translate); + transdiff.mul(scale); + loopv(meshes) meshes[i]->scaleverts(transdiff, scalediff); + scaletags(transdiff, scalediff); + scale = nscale; + translate = ntranslate; + shared++; + return this; + } + + virtual void cleanup() {} + virtual void render(const animstate *as, float pitch, const vec &axis, part *p) {} + }; + + virtual meshgroup *loadmeshes(char *name, va_list args) { return NULL; } + + meshgroup *sharemeshes(char *name, ...) + { + static hashtable meshgroups; + if(!meshgroups.access(name)) + { + va_list args; + va_start(args, name); + meshgroup *group = loadmeshes(name, args); + va_end(args); + if(!group) return NULL; + meshgroups[group->name] = group; + } + return meshgroups[name]; + } + + struct linkedpart + { + part *p; + int tag, anim, basetime; + GLfloat matrix[16]; + + linkedpart() : p(NULL), tag(-1), anim(-1), basetime(0) {} + }; + + struct part + { + animmodel *model; + int index; + meshgroup *meshes; + vector links; + vector skins; + vector *anims[MAXANIMPARTS]; + int numanimparts; + float pitchscale, pitchoffset, pitchmin, pitchmax; + + part() : meshes(NULL), numanimparts(1), pitchscale(1), pitchoffset(0), pitchmin(0), pitchmax(0) + { + loopk(MAXANIMPARTS) anims[k] = NULL; + } + virtual ~part() + { + loopk(MAXANIMPARTS) DELETEA(anims[k]); + } + + virtual void cleanup() + { + if(meshes) meshes->cleanup(); + } + + void calcbb(int frame, vec &bbmin, vec &bbmax, const matrix3x4 &m) + { + meshes->calcbb(frame, bbmin, bbmax, m); + loopv(links) + { + matrix3x4 n; + meshes->concattagtransform(frame, links[i].tag, m, n); + links[i].p->calcbb(frame, bbmin, bbmax, n); + } + } + + void gentris(int frame, vector *tris, const matrix3x4 &m) + { + meshes->gentris(frame, skins, tris, m); + loopv(links) + { + matrix3x4 n; + meshes->concattagtransform(frame, links[i].tag, m, n); + links[i].p->gentris(frame, tris, n); + } + } + + bool link(part *p, const char *tag, int anim = -1, int basetime = 0) + { + int i = meshes->findtag(tag); + if(i<0) return false; + linkedpart &l = links.add(); + l.p = p; + l.tag = i; + l.anim = anim; + l.basetime = basetime; + return true; + } + + bool unlink(part *p) + { + loopvrev(links) if(links[i].p==p) { links.remove(i, 1); return true; } + return false; + } + + void initskins(Texture *tex = notexture, Texture *masks = notexture, int limit = 0) + { + if(!limit) + { + if(!meshes) return; + limit = meshes->meshes.length(); + } + while(skins.length() < limit) + { + skin &s = skins.add(); + s.owner = this; + s.tex = tex; + s.masks = masks; + } + } + + virtual void getdefaultanim(animinfo &info, int anim, uint varseed, dynent *d) + { + info.frame = 0; + info.range = 1; + } + + void getanimspeed(animinfo &info, dynent *d) + { + switch(info.anim&ANIM_INDEX) + { + case ANIM_FORWARD: + case ANIM_BACKWARD: + case ANIM_LEFT: + case ANIM_RIGHT: + case ANIM_SWIM: + info.speed = 5500.0f/d->maxspeed; + break; + + default: + info.speed = 100.0f; + break; + } + } + + bool calcanim(int animpart, int anim, float speed, int basetime, dynent *d, int interp, animinfo &info) + { + uint varseed = uint(basetime + (int)(size_t)d); + info.anim = anim; + info.varseed = varseed; + info.speed = speed; + if((anim&ANIM_INDEX)==ANIM_ALL) + { + info.frame = 0; + info.range = meshes->totalframes(); + } + else + { + animspec *spec = NULL; + if(anims[animpart]) + { + vector &primary = anims[animpart][anim&ANIM_INDEX]; + if(primary.length()) spec = &primary[varseed%primary.length()]; + if((anim>>ANIM_SECONDARY)&ANIM_INDEX) + { + vector &secondary = anims[animpart][(anim>>ANIM_SECONDARY)&ANIM_INDEX]; + if(secondary.length()) + { + animspec &spec2 = secondary[varseed%secondary.length()]; + if(!spec || spec2.priority > spec->priority) + { + spec = &spec2; + info.anim >>= ANIM_SECONDARY; + } + } + } + } + if(spec) + { + info.frame = spec->frame; + info.range = spec->range; + if(spec->speed>0) info.speed = 1000.0f/spec->speed; + } + else getdefaultanim(info, anim, varseed, d); + } + if(info.speed<=0) getanimspeed(info, d); + + info.anim &= (1<>ANIM_SECONDARY)&ANIM_INDEX) + { + info.anim &= ~ANIM_SETTIME; + info.basetime = -((int)(size_t)d&0xFFF); + } + if(info.anim&(ANIM_START|ANIM_END)) + { + if(info.anim&ANIM_END) info.frame += info.range-1; + info.range = 1; + } + + if(!meshes->hasframes(info.frame, info.range)) + { + if(!meshes->hasframe(info.frame)) return false; + info.range = meshes->clipframes(info.frame, info.range); + } + + if(d && interp>=0) + { + animinterpinfo &ai = d->animinterp[interp]; + if(ai.lastmodel!=this || ai.lastswitch<0 || lastmillis-d->lastrendered>animationinterpolationtime) + { + ai.prev = ai.cur = info; + ai.lastswitch = lastmillis-animationinterpolationtime*2; + } + else if(ai.cur!=info) + { + if(lastmillis-ai.lastswitch>animationinterpolationtime/2) ai.prev = ai.cur; + ai.cur = info; + ai.lastswitch = lastmillis; + } + else if(info.anim&ANIM_SETTIME) ai.cur.basetime = info.basetime; + ai.lastmodel = this; + } + return true; + } + + void calcnormal(GLfloat *m, vec &dir) + { + vec n(dir); + dir.x = n.x*m[0] + n.y*m[1] + n.z*m[2]; + dir.y = n.x*m[4] + n.y*m[5] + n.z*m[6]; + dir.z = n.x*m[8] + n.y*m[9] + n.z*m[10]; + } + + void calcplane(GLfloat *m, plane &p) + { + p.offset += p.x*m[12] + p.y*m[13] + p.z*m[14]; + calcnormal(m, p); + } + + void calcvertex(GLfloat *m, vec &pos) + { + vec p(pos); + + p.x -= m[12]; + p.y -= m[13]; + p.z -= m[14]; + +#if 0 + // This is probably overkill, since just about any transformations this encounters will be orthogonal matrices + // where their inverse is simply the transpose. + int a = fabs(m[0])>fabs(m[1]) && fabs(m[0])>fabs(m[2]) ? 0 : (fabs(m[1])>fabs(m[2]) ? 1 : 2), b = (a+1)%3, c = (a+2)%3; + float a1 = m[a], a2 = m[a+4], a3 = m[a+8], + b1 = m[b], b2 = m[b+4], b3 = m[b+8], + c1 = m[c], c2 = m[c+4], c3 = m[c+8]; + + pos.z = (p[c] - c1*p[a]/a1 - (c2 - c1*a2/a1)*(p[b] - b1*p[a]/a1)/(b2 - b1*a2/a1)) / (c3 - c1*a3/a1 - (c2 - c1*a2/a1)*(b3 - b1*a3/a1)/(b2 - b1*a2/a1)); + pos.y = (p[b] - b1*p[a]/a1 - (b3 - b1*a3/a1)*pos.z)/(b2 - b1*a2/a1); + pos.x = (p[a] - a2*pos.y - a3*pos.z)/a1; +#else + pos.x = p.x*m[0] + p.y*m[1] + p.z*m[2]; + pos.y = p.x*m[4] + p.y*m[5] + p.z*m[6]; + pos.z = p.x*m[8] + p.y*m[9] + p.z*m[10]; +#endif + } + + float calcpitchaxis(int anim, float pitch, vec &axis, vec &dir, vec &campos, plane &fogplane) + { + float angle = pitchscale*pitch + pitchoffset; + if(pitchmin || pitchmax) angle = max(pitchmin, min(pitchmax, angle)); + if(!angle) return 0; + + float c = cosf(-angle*RAD), s = sinf(-angle*RAD); + vec d(axis); + axis.rotate(c, s, d); + if(!(anim&ANIM_NOSKIN)) + { + dir.rotate(c, s, d); + campos.rotate(c, s, d); + fogplane.rotate(c, s, d); + } + + return angle; + } + + void render(int anim, float speed, int basetime, float pitch, const vec &axis, dynent *d, const vec &dir, const vec &campos, const plane &fogplane) + { + animstate as[MAXANIMPARTS]; + render(anim, speed, basetime, pitch, axis, d, dir, campos, fogplane, as); + } + + void render(int anim, float speed, int basetime, float pitch, const vec &axis, dynent *d, const vec &dir, const vec &campos, const plane &fogplane, animstate *as) + { + if(!(anim&ANIM_REUSE)) loopi(numanimparts) + { + animinfo info; + int interp = d && index+numanimparts<=MAXANIMPARTS ? index+i : -1; + if(!calcanim(i, anim, speed, basetime, d, interp, info)) return; + animstate &p = as[i]; + p.owner = this; + p.anim = info.anim; + p.cur.setframes(info); + p.interp = 1; + if(interp>=0 && d->animinterp[interp].prev.range>0) + { + int diff = lastmillis-d->animinterp[interp].lastswitch; + if(diffaniminterp[interp].prev); + p.interp = diff/float(animationinterpolationtime); + } + } + } + + if(!model->cullface && enablecullface) { glDisable(GL_CULL_FACE); enablecullface = false; } + else if(model->cullface && !enablecullface) { glEnable(GL_CULL_FACE); enablecullface = true; } + + vec raxis(axis), rdir(dir), rcampos(campos); + plane rfogplane(fogplane); + float pitchamount = calcpitchaxis(anim, pitch, raxis, rdir, rcampos, rfogplane); + if(pitchamount) + { + glPushMatrix(); + glRotatef(pitchamount, axis.x, axis.y, axis.z); + if(renderpath!=R_FIXEDFUNCTION && anim&ANIM_ENVMAP) + { + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glRotatef(pitchamount, axis.x, axis.y, axis.z); + glMatrixMode(GL_MODELVIEW); + } + } + + if(!(anim&ANIM_NOSKIN)) + { + if(renderpath!=R_FIXEDFUNCTION) + { + if(fogging) setfogplane(rfogplane); + setenvparamf("direction", SHPARAM_VERTEX, 0, rdir.x, rdir.y, rdir.z); + setenvparamf("camera", SHPARAM_VERTEX, 1, rcampos.x, rcampos.y, rcampos.z, 1); + } + else + { + if(fogging) refractfogplane = rfogplane; + if(lightmodels) + { + loopv(skins) if(!skins[i].fullbright) + { + GLfloat pos[4] = { rdir.x*1000, rdir.y*1000, rdir.z*1000, 0 }; + glLightfv(GL_LIGHT0, GL_POSITION, pos); + break; + } + } + } + } + + meshes->render(as, pitch, axis, this); + + if(!(anim&ANIM_REUSE)) + { + loopv(links) + { + linkedpart &link = links[i]; + + vec naxis(raxis), ndir(rdir), ncampos(rcampos); + plane nfogplane(rfogplane); + calcnormal(link.matrix, naxis); + if(!(anim&ANIM_NOSKIN)) + { + calcnormal(link.matrix, ndir); + calcvertex(link.matrix, ncampos); + calcplane(link.matrix, nfogplane); + } + + glPushMatrix(); + glMultMatrixf(link.matrix); + if(renderpath!=R_FIXEDFUNCTION && anim&ANIM_ENVMAP) + { + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glMultMatrixf(link.matrix); + glMatrixMode(GL_MODELVIEW); + } + int nanim = anim, nbasetime = basetime; + if(link.anim>=0) + { + nanim = link.anim | (anim&ANIM_FLAGS); + nbasetime = link.basetime; + } + link.p->render(nanim, speed, nbasetime, pitch, naxis, d, ndir, ncampos, nfogplane); + if(renderpath!=R_FIXEDFUNCTION && anim&ANIM_ENVMAP) + { + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + } + glPopMatrix(); + } + } + + if(pitchamount) + { + glPopMatrix(); + if(renderpath!=R_FIXEDFUNCTION && anim&ANIM_ENVMAP) + { + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + } + } + } + + void setanim(int animpart, int num, int frame, int range, float speed, int priority = 0) + { + if(animpart<0 || animpart>=MAXANIMPARTS) return; + if(frame<0 || range<=0 || !meshes || !meshes->hasframes(frame, range)) + { + conoutf("invalid frame %d, range %d in model %s", frame, range, model->loadname); + return; + } + if(!anims[animpart]) anims[animpart] = new vector[NUMANIMS]; + animspec &spec = anims[animpart][num].add(); + spec.frame = frame; + spec.range = range; + spec.speed = speed; + spec.priority = priority; + } + }; + + enum + { + LINK_TAG = 0, + LINK_COOP, + LINK_REUSE + }; + + virtual int linktype(animmodel *m) const { return LINK_TAG; } + + void render(int anim, float speed, int basetime, float pitch, const vec &axis, dynent *d, modelattach *a, const vec &dir, const vec &campos, const plane &fogplane) + { + if(!loaded) return; + + if(a) + { + int index = parts.last()->index + parts.last()->numanimparts; + for(int i = 0; a[i].name; i++) + { + animmodel *m = (animmodel *)a[i].m; + if(!m || !m->loaded) continue; + part *p = m->parts[0]; + switch(linktype(m)) + { + case LINK_TAG: + p->index = link(p, a[i].tag, a[i].anim, a[i].basetime) ? index : -1; + break; + + case LINK_COOP: + p->index = index; + break; + + default: + continue; + } + index += p->numanimparts; + } + } + + animstate as[MAXANIMPARTS]; + parts[0]->render(anim, speed, basetime, pitch, axis, d, dir, campos, fogplane, as); + + if(a) for(int i = 0; a[i].name; i++) + { + animmodel *m = (animmodel *)a[i].m; + if(!m || !m->loaded) continue; + part *p = m->parts[0]; + switch(linktype(m)) + { + case LINK_TAG: + if(p->index >= 0) unlink(p); + p->index = 0; + break; + + case LINK_COOP: + p->render(anim, speed, basetime, pitch, axis, d, dir, campos, fogplane); + p->index = 0; + break; + + case LINK_REUSE: + p->render(anim | ANIM_REUSE, speed, basetime, pitch, axis, d, dir, campos, fogplane, as); + break; + } + } + } + + void render(int anim, float speed, int basetime, const vec &o, float yaw, float pitch, dynent *d, modelattach *a, const vec &color, const vec &dir) + { + if(!loaded) return; + + vec rdir, campos; + plane fogplane; + + yaw += offsetyaw + spin*lastmillis/1000.0f; + pitch += offsetpitch; + + if(!(anim&ANIM_NOSKIN)) + { + fogplane = plane(0, 0, 1, o.z-reflectz); + + lightcolor = color; + + rdir = dir; + rdir.rotate_around_z((-yaw-180.0f)*RAD); + + campos = camera1->o; + campos.sub(o); + campos.rotate_around_z((-yaw-180.0f)*RAD); + + if(envmapped()) anim |= ANIM_ENVMAP; + else if(a) for(int i = 0; a[i].name; i++) if(a[i].m && a[i].m->envmapped()) + { + anim |= ANIM_ENVMAP; + break; + } + if(anim&ANIM_ENVMAP) closestenvmaptex = lookupenvmap(closestenvmap(o)); + } + + if(anim&ANIM_ENVMAP) + { + envmaptmu = 2; + if(renderpath==R_FIXEDFUNCTION) + { + if(fogging) envmaptmu = 3; + glActiveTexture_(GL_TEXTURE0_ARB+envmaptmu); + } + glMatrixMode(GL_TEXTURE); + if(renderpath==R_FIXEDFUNCTION) + { + setuptmu(envmaptmu, "T , P @ Pa", anim&ANIM_TRANSLUCENT ? "= Ka" : NULL); + + GLfloat mm[16], mmtrans[16]; + glGetFloatv(GL_MODELVIEW_MATRIX, mm); + loopi(4) // transpose modelview (mmtrans[4*i+j] = mm[4*j+i]) + { + GLfloat x = mm[i], y = mm[4+i], z = mm[8+i], w = mm[12+i]; + mmtrans[4*i] = x; + mmtrans[4*i+1] = y; + mmtrans[4*i+2] = z; + mmtrans[4*i+3] = w; + } + glLoadMatrixf(mmtrans); + } + else + { + glLoadIdentity(); + glTranslatef(o.x, o.y, o.z); + glRotatef(yaw+180, 0, 0, 1); + } + glMatrixMode(GL_MODELVIEW); + if(renderpath==R_FIXEDFUNCTION) glActiveTexture_(GL_TEXTURE0_ARB); + } + + glPushMatrix(); + glTranslatef(o.x, o.y, o.z); + glRotatef(yaw+180, 0, 0, 1); + + if(anim&ANIM_TRANSLUCENT) + { + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + render(anim|ANIM_NOSKIN, speed, basetime, pitch, vec(0, -1, 0), d, a, rdir, campos, fogplane); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, fading ? GL_FALSE : GL_TRUE); + + glDepthFunc(GL_LEQUAL); + } + + if(anim&(ANIM_TRANSLUCENT|ANIM_SHADOW) && !enablealphablend) + { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + enablealphablend = true; + } + + render(anim, speed, basetime, pitch, vec(0, -1, 0), d, a, rdir, campos, fogplane); + + if(anim&ANIM_ENVMAP) + { + if(renderpath==R_FIXEDFUNCTION) glActiveTexture_(GL_TEXTURE0_ARB+envmaptmu); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + if(renderpath==R_FIXEDFUNCTION) glActiveTexture_(GL_TEXTURE0_ARB); + } + + if(anim&ANIM_TRANSLUCENT) glDepthFunc(GL_LESS); + + glPopMatrix(); + + if(d) d->lastrendered = lastmillis; + } + + bool loaded; + char *loadname; + vector parts; + + animmodel(const char *name) : loaded(false) + { + loadname = newstring(name); + } + + virtual ~animmodel() + { + delete[] loadname; + parts.deletecontentsp(); + } + + char *name() { return loadname; } + + void cleanup() + { + loopv(parts) parts[i]->cleanup(); + enablelight0 = false; + } + + void initmatrix(matrix3x4 &m) + { + if(offsetyaw) + { + m.rotate(offsetyaw*RAD, vec(0, 0, 1)); + if(offsetpitch) + { + matrix3x4 n; + n.rotate(offsetpitch*RAD, vec(0, -1, 0)); + m.mul(n); + } + } + else if(offsetpitch) m.rotate(offsetpitch*RAD, vec(0, -1, 0)); + else m.identity(); + } + + void gentris(int frame, vector *tris) + { + if(parts.empty()) return; + matrix3x4 m; + initmatrix(m); + parts[0]->gentris(frame, tris, m); + } + + BIH *setBIH() + { + if(bih) return bih; + vector tris[2]; + gentris(0, tris); + bih = new BIH(tris); + return bih; + } + + bool link(part *p, const char *tag, int anim = -1, int basetime = 0) + { + loopv(parts) if(parts[i]->link(p, tag, anim, basetime)) return true; + return false; + } + + bool unlink(part *p) + { + loopv(parts) if(parts[i]->unlink(p)) return true; + return false; + } + + bool envmapped() + { + loopv(parts) loopvj(parts[i]->skins) if(parts[i]->skins[j].envmapped()) return true; + return false; + } + + virtual bool loaddefaultparts() + { + return true; + } + + void setshader(Shader *shader) + { + if(parts.empty()) loaddefaultparts(); + loopv(parts) loopvj(parts[i]->skins) parts[i]->skins[j].shader = shader; + } + + void setenvmap(float envmapmin, float envmapmax, Texture *envmap) + { + if(parts.empty()) loaddefaultparts(); + loopv(parts) loopvj(parts[i]->skins) + { + skin &s = parts[i]->skins[j]; + if(envmapmax) + { + s.envmapmin = envmapmin; + s.envmapmax = envmapmax; + } + if(envmap) s.envmap = envmap; + } + } + + void setspec(float spec) + { + if(parts.empty()) loaddefaultparts(); + loopv(parts) loopvj(parts[i]->skins) parts[i]->skins[j].spec = spec; + } + + void setambient(float ambient) + { + if(parts.empty()) loaddefaultparts(); + loopv(parts) loopvj(parts[i]->skins) parts[i]->skins[j].ambient = ambient; + } + + void setglow(float glow) + { + if(parts.empty()) loaddefaultparts(); + loopv(parts) loopvj(parts[i]->skins) parts[i]->skins[j].glow = glow; + } + + void setglare(float specglare, float glowglare) + { + if(parts.empty()) loaddefaultparts(); + loopv(parts) loopvj(parts[i]->skins) + { + skin &s = parts[i]->skins[j]; + s.specglare = specglare; + s.glowglare = glowglare; + } + } + + void setalphatest(float alphatest) + { + if(parts.empty()) loaddefaultparts(); + loopv(parts) loopvj(parts[i]->skins) parts[i]->skins[j].alphatest = alphatest; + } + + void setalphablend(bool alphablend) + { + if(parts.empty()) loaddefaultparts(); + loopv(parts) loopvj(parts[i]->skins) parts[i]->skins[j].alphablend = alphablend; + } + + void settranslucency(float translucency) + { + if(parts.empty()) loaddefaultparts(); + loopv(parts) loopvj(parts[i]->skins) parts[i]->skins[j].translucency = translucency; + } + + void setfullbright(float fullbright) + { + if(parts.empty()) loaddefaultparts(); + loopv(parts) loopvj(parts[i]->skins) parts[i]->skins[j].fullbright = fullbright; + } + + void calcbb(int frame, vec ¢er, vec &radius) + { + if(parts.empty()) return; + vec bbmin(1e16f, 1e16f, 1e16f), bbmax(-1e16f, -1e16f, -1e16f); + matrix3x4 m; + initmatrix(m); + parts[0]->calcbb(frame, bbmin, bbmax, m); + radius = bbmax; + radius.sub(bbmin); + radius.mul(0.5f); + center = bbmin; + center.add(radius); + } + + static bool enabletc, enablemtc, enablealphatest, enablealphablend, enableenvmap, enableglow, enableoverbright, enablelighting, enablelight0, enablecullface, enablefog, enabletangents, enablebones; + static vec lightcolor; + static plane refractfogplane; + static float lastalphatest; + static void *lastvbuf, *lasttcbuf, *lastmtcbuf, *lastnbuf, *lastbbuf, *lastsdata, *lastbdata; + static GLuint lastebuf, lastenvmaptex, closestenvmaptex; + static Texture *lasttex, *lastmasks, *lastnormalmap; + static int envmaptmu, fogtmu; + + void startrender() + { + enabletc = enablemtc = enablealphatest = enablealphablend = enableenvmap = enableglow = enableoverbright = enablelighting = enablefog = enabletangents = enablebones = false; + enablecullface = true; + lastalphatest = -1; + lastvbuf = lasttcbuf = lastmtcbuf = lastnbuf = lastbbuf = lastsdata = lastbdata = NULL; + lastebuf = lastenvmaptex = closestenvmaptex = 0; + lasttex = lastmasks = lastnormalmap = NULL; + envmaptmu = fogtmu = -1; + + if(renderpath==R_FIXEDFUNCTION && lightmodels && !enablelight0) + { + glEnable(GL_LIGHT0); + static const GLfloat zero[4] = { 0, 0, 0, 0 }; + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, zero); + glLightfv(GL_LIGHT0, GL_SPECULAR, zero); + glMaterialfv(GL_FRONT, GL_SPECULAR, zero); + glMaterialfv(GL_FRONT, GL_EMISSION, zero); + enablelight0 = true; + } + } + + static void disablebones() + { + glDisableVertexAttribArray_(6); + glDisableVertexAttribArray_(7); + enablebones = false; + } + + static void disabletangents() + { + glDisableVertexAttribArray_(1); + enabletangents = false; + } + + static void disablemtc() + { + glClientActiveTexture_(GL_TEXTURE1_ARB); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glClientActiveTexture_(GL_TEXTURE0_ARB); + enablemtc = false; + } + + static void disabletc() + { + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + if(enablemtc) disablemtc(); + enabletc = false; + } + + static void disablevbo() + { + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + glDisableClientState(GL_VERTEX_ARRAY); + if(enabletc) disabletc(); + if(enabletangents) disabletangents(); + if(enablebones) disablebones(); + lastvbuf = lasttcbuf = lastmtcbuf = lastnbuf = lastbbuf = NULL; + lastebuf = 0; + } + + static void disableoverbright() + { + resettmu(0); + enableoverbright = false; + } + + static void disableglow() + { + resettmu(0); + glActiveTexture_(GL_TEXTURE1_ARB); + resettmu(1); + glDisable(GL_TEXTURE_2D); + glActiveTexture_(GL_TEXTURE0_ARB); + lasttex = lastmasks = NULL; + enableglow = false; + } + + static void disablefog(bool cleanup = false) + { + glActiveTexture_(GL_TEXTURE0_ARB+fogtmu); + if(enablefog) glDisable(GL_TEXTURE_1D); + if(cleanup) + { + resettmu(fogtmu); + glDisable(GL_TEXTURE_GEN_S); + fogtmu = -1; + } + glActiveTexture_(GL_TEXTURE0_ARB); + enablefog = false; + } + + static void disableenvmap(bool cleanup = false) + { + glActiveTexture_(GL_TEXTURE0_ARB+envmaptmu); + if(enableenvmap) glDisable(GL_TEXTURE_CUBE_MAP_ARB); + if(cleanup && renderpath==R_FIXEDFUNCTION) + { + resettmu(envmaptmu); + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + glDisable(GL_TEXTURE_GEN_R); + } + glActiveTexture_(GL_TEXTURE0_ARB); + enableenvmap = false; + } + + void endrender() + { + if(lastvbuf || lastebuf) disablevbo(); + if(enablealphatest) glDisable(GL_ALPHA_TEST); + if(enablealphablend) glDisable(GL_BLEND); + if(enableglow) disableglow(); + if(enableoverbright) disableoverbright(); + if(enablelighting) glDisable(GL_LIGHTING); + if(lastenvmaptex) disableenvmap(true); + if(!enablecullface) glEnable(GL_CULL_FACE); + if(fogtmu>=0) disablefog(true); + } +}; + +bool animmodel::enabletc = false, animmodel::enablemtc = false, animmodel::enablealphatest = false, animmodel::enablealphablend = false, + animmodel::enableenvmap = false, animmodel::enableglow = false, animmodel::enableoverbright = false, animmodel::enablelighting = false, animmodel::enablelight0 = false, animmodel::enablecullface = true, + animmodel::enablefog = false, animmodel::enabletangents = false, animmodel::enablebones = false; +vec animmodel::lightcolor; +plane animmodel::refractfogplane; +float animmodel::lastalphatest = -1; +void *animmodel::lastvbuf = NULL, *animmodel::lasttcbuf = NULL, *animmodel::lastmtcbuf = NULL, *animmodel::lastnbuf = NULL, *animmodel::lastbbuf = NULL, *animmodel::lastsdata = NULL, *animmodel::lastbdata = NULL; +GLuint animmodel::lastebuf = 0, animmodel::lastenvmaptex = 0, animmodel::closestenvmaptex = 0; +Texture *animmodel::lasttex = NULL, *animmodel::lastmasks = NULL, *animmodel::lastnormalmap = NULL; +int animmodel::envmaptmu = -1, animmodel::fogtmu = -1; + diff --git a/src/engine/bih.cpp b/src/engine/bih.cpp new file mode 100644 index 0000000..bb6e258 --- /dev/null +++ b/src/engine/bih.cpp @@ -0,0 +1,300 @@ +#include "pch.h" +#include "engine.h" + +bool BIH::triintersect(tri &t, const vec &o, const vec &ray, float maxdist, float &dist, int mode, tri *noclip) +{ + vec p; + p.cross(ray, t.c); + float det = t.b.dot(p); + if(det == 0) return false; + vec r(o); + r.sub(t.a); + float u = r.dot(p) / det; + if(u < 0 || u > 1) return false; + vec q; + q.cross(r, t.b); + float v = ray.dot(q) / det; + if(v < 0 || u + v > 1) return false; + float f = t.c.dot(q) / det; + if(f < 0 || f > maxdist) return false; + if(!(mode&RAY_SHADOW) && &t >= noclip) return false; + if(t.tex && (mode&RAY_ALPHAPOLY)==RAY_ALPHAPOLY) + { + if(!t.tex->alphamask) + { + loadalphamask(t.tex); + if(!t.tex->alphamask) { dist = f; return true; } + } + int si = clamp(int(t.tex->xs * (t.tc[0] + u*(t.tc[2] - t.tc[0]) + v*(t.tc[4] - t.tc[0]))), 0, t.tex->xs-1), + ti = clamp(int(t.tex->ys * (t.tc[1] + u*(t.tc[3] - t.tc[1]) + v*(t.tc[5] - t.tc[1]))), 0, t.tex->ys-1); + if(!(t.tex->alphamask[ti*((t.tex->xs+7)/8) + si/8] & (1<<(si%8)))) return false; + } + dist = f; + return true; +} + +struct BIHStack +{ + BIHNode *node; + float tmin, tmax; +}; + +bool BIH::traverse(const vec &o, const vec &ray, float maxdist, float &dist, int mode) +{ + if(!numnodes) return false; + + vec invray(ray.x ? 1/ray.x : 1e16f, ray.y ? 1/ray.y : 1e16f, ray.z ? 1/ray.z : 1e16f); + float tmin, tmax; + float t1 = (bbmin.x - o.x)*invray.x, + t2 = (bbmax.x - o.x)*invray.x; + if(invray.x > 0) { tmin = t1; tmax = t2; } else { tmin = t2; tmax = t1; } + t1 = (bbmin.y - o.y)*invray.y; + t2 = (bbmax.y - o.y)*invray.y; + if(invray.y > 0) { tmin = max(tmin, t1); tmax = min(tmax, t2); } else { tmin = max(tmin, t2); tmax = min(tmax, t1); } + t1 = (bbmin.z - o.z)*invray.z; + t2 = (bbmax.z - o.z)*invray.z; + if(invray.z > 0) { tmin = max(tmin, t1); tmax = min(tmax, t2); } else { tmin = max(tmin, t2); tmax = min(tmax, t1); } + if(tmin >= maxdist || tmin>=tmax) return false; + tmax = min(tmax, maxdist); + + static vector stack; + stack.setsizenodelete(0); + + ivec order(ray.x>0 ? 0 : 1, ray.y>0 ? 0 : 1, ray.z>0 ? 0 : 1); + BIHNode *curnode = &nodes[0]; + for(;;) + { + int axis = curnode->axis(); + int nearidx = order[axis], faridx = nearidx^1; + float nearsplit = (curnode->split[nearidx] - o[axis])*invray[axis], + farsplit = (curnode->split[faridx] - o[axis])*invray[axis]; + + if(nearsplit <= tmin) + { + if(farsplit < tmax) + { + if(!curnode->isleaf(faridx)) + { + curnode = &nodes[curnode->childindex(faridx)]; + tmin = max(tmin, farsplit); + continue; + } + else if(triintersect(tris[curnode->childindex(faridx)], o, ray, maxdist, dist, mode, noclip)) return true; + } + } + else if(curnode->isleaf(nearidx)) + { + if(triintersect(tris[curnode->childindex(nearidx)], o, ray, maxdist, dist, mode, noclip)) return true; + if(farsplit < tmax) + { + if(!curnode->isleaf(faridx)) + { + curnode = &nodes[curnode->childindex(faridx)]; + tmin = max(tmin, farsplit); + continue; + } + else if(triintersect(tris[curnode->childindex(faridx)], o, ray, maxdist, dist, mode, noclip)) return true; + } + } + else + { + if(farsplit < tmax) + { + if(!curnode->isleaf(faridx)) + { + BIHStack &save = stack.add(); + save.node = &nodes[curnode->childindex(faridx)]; + save.tmin = max(tmin, farsplit); + save.tmax = tmax; + } + else if(triintersect(tris[curnode->childindex(faridx)], o, ray, maxdist, dist, mode, noclip)) return true; + } + curnode = &nodes[curnode->childindex(nearidx)]; + tmax = min(tmax, nearsplit); + continue; + } + if(stack.empty()) return false; + BIHStack &restore = stack.pop(); + curnode = restore.node; + tmin = restore.tmin; + tmax = restore.tmax; + } +} + +static BIH::tri *sorttris = NULL; +static int sortaxis = 0; + +static int bihsort(const ushort *x, const ushort *y) +{ + BIH::tri &xtri = sorttris[*x], &ytri = sorttris[*y]; + float xmin = min(xtri.a[sortaxis], min(xtri.b[sortaxis], xtri.c[sortaxis])), + ymin = min(ytri.a[sortaxis], min(ytri.b[sortaxis], ytri.c[sortaxis])); + if(xmin < ymin) return -1; + if(xmin > ymin) return 1; + return 0; +} + +void BIH::build(vector &buildnodes, ushort *indices, int numindices, int depth) +{ + maxdepth = max(maxdepth, depth); + + vec vmin(1e16f, 1e16f, 1e16f), vmax(-1e16f, -1e16f, -1e16f); + loopi(numindices) + { + tri &tri = tris[indices[i]]; + loopk(3) + { + float amin = min(tri.a[k], min(tri.b[k], tri.c[k])), + amax = max(tri.a[k], max(tri.b[k], tri.c[k])); + vmin[k] = min(vmin[k], amin); + vmax[k] = max(vmax[k], amax); + } + } + if(depth==1) + { + bbmin = vmin; + bbmax = vmax; + } + + int axis = 2; + loopk(2) if(vmax[k] - vmin[k] > vmax[axis] - vmin[axis]) axis = k; + +/* + sorttris = tris; + sortaxis = axis; + qsort(indices, numindices, sizeof(ushort), (int (__cdecl *)(const void *, const void *))bihsort); + tri &median = tris[numindices/2]; + float split = min(median.a[axis], min(median.b[axis], median.c[axis])); +*/ + + float split = 0.5f*(vmax[axis] + vmin[axis]); + + float splitleft = SHRT_MIN, splitright = SHRT_MAX; + int left, right; + for(left = 0, right = numindices; left < right;) + { + tri &tri = tris[indices[left]]; + float amin = min(tri.a[axis], min(tri.b[axis], tri.c[axis])), + amax = max(tri.a[axis], max(tri.b[axis], tri.c[axis])); + if(max(split - amin, 0.0f) > max(amax - split, 0.0f)) + { + ++left; + splitleft = max(splitleft, amax); + } + else + { + --right; + swap(indices[left], indices[right]); + splitright = min(splitright, amin); + } + } + + if(!left || right==numindices) + { + sorttris = tris; + sortaxis = axis; + qsort(indices, numindices, sizeof(ushort), (int (__cdecl *)(const void *, const void *))bihsort); + + left = right = numindices/2; + splitleft = SHRT_MIN; + splitright = SHRT_MAX; + loopi(numindices) + { + tri &tri = tris[indices[i]]; + if(i < left) splitleft = max(splitleft, max(tri.a[axis], max(tri.b[axis], tri.c[axis]))); + else splitright = min(splitright, min(tri.a[axis], min(tri.b[axis], tri.c[axis]))); + } + } + + int node = buildnodes.length(); + buildnodes.add(); + buildnodes[node].split[0] = short(ceil(splitleft)); + buildnodes[node].split[1] = short(floor(splitright)); + + if(left==1) buildnodes[node].child[0] = (axis<<14) | indices[0]; + else + { + buildnodes[node].child[0] = (axis<<14) | buildnodes.length(); + build(buildnodes, indices, left, depth+1); + } + + if(numindices-right==1) buildnodes[node].child[1] = (1<<15) | (left==1 ? 1<<14 : 0) | indices[right]; + else + { + buildnodes[node].child[1] = (left==1 ? 1<<14 : 0) | buildnodes.length(); + build(buildnodes, &indices[right], numindices-right, depth+1); + } +} + +BIH::BIH(vector *t) +{ + numtris = t[0].length() + t[1].length(); + if(!numtris) + { + tris = NULL; + numnodes = 0; + nodes = NULL; + maxdepth = 0; + return; + } + + tris = new tri[numtris]; + noclip = &tris[t[0].length()]; + memcpy(tris, t[0].getbuf(), t[0].length()*sizeof(tri)); + memcpy(noclip, t[1].getbuf(), t[1].length()*sizeof(tri)); + + vector buildnodes; + ushort *indices = new ushort[numtris]; + loopi(numtris) indices[i] = i; + + maxdepth = 0; + + build(buildnodes, indices, numtris); + + delete[] indices; + + numnodes = buildnodes.length(); + nodes = new BIHNode[numnodes]; + memcpy(nodes, buildnodes.getbuf(), numnodes*sizeof(BIHNode)); + + // convert tri.b/tri.c to edges + loopi(numtris) + { + tri &tri = tris[i]; + tri.b.sub(tri.a); + tri.c.sub(tri.a); + } +} + +static inline void yawray(vec &o, vec &ray, float angle) +{ + angle *= RAD; + float c = cosf(angle), s = sinf(angle), + ox = o.x, oy = o.y, + rx = ox+ray.x, ry = oy+ray.y; + o.x = ox*c - oy*s; + o.y = oy*c + ox*s; + ray.x = rx*c - ry*s - o.x; + ray.y = ry*c + rx*s - o.y; + ray.normalize(); +} + +bool mmintersect(const extentity &e, const vec &o, const vec &ray, float maxdist, int mode, float &dist) +{ + model *m = loadmodel(NULL, e.attr2); + if(!m) return false; + if(mode&RAY_SHADOW) + { + if(!m->shadow || checktriggertype(e.attr3, TRIG_COLLIDE|TRIG_DISAPPEAR)) return false; + } + else if((mode&RAY_ENTS)!=RAY_ENTS && !m->collide) return false; + if(!m->bih && !m->setBIH()) return false; + if(!maxdist) maxdist = 1e16f; + vec yo(o); + yo.sub(e.o); + float yaw = -180.0f-(float)((e.attr1+7)-(e.attr1+7)%15); + vec yray(ray); + if(yaw != 0) yawray(yo, yray, yaw); + return m->bih->traverse(yo, yray, maxdist, dist, mode); +} + diff --git a/src/engine/bih.h b/src/engine/bih.h new file mode 100644 index 0000000..b5eab0b --- /dev/null +++ b/src/engine/bih.h @@ -0,0 +1,43 @@ +struct BIHNode +{ + short split[2]; + ushort child[2]; + + int axis() const { return child[0]>>14; } + int childindex(int which) const { return child[which]&0x3FFF; } + bool isleaf(int which) const { return (child[1]&(1<<(14+which)))!=0; } +}; + +struct BIH +{ + struct tri : triangle + { + float tc[6]; + Texture *tex; + }; + + int maxdepth; + int numnodes; + BIHNode *nodes; + int numtris; + tri *tris, *noclip; + + vec bbmin, bbmax; + + BIH(vector *tris); + + ~BIH() + { + DELETEA(nodes); + DELETEA(tris); + } + + static bool triintersect(tri &t, const vec &o, const vec &ray, float maxdist, float &dist, int mode, tri *noclip); + + void build(vector &buildnodes, ushort *indices, int numindices, int depth = 1); + + bool traverse(const vec &o, const vec &ray, float maxdist, float &dist, int mode); +}; + +extern bool mmintersect(const extentity &e, const vec &o, const vec &ray, float maxdist, int mode, float &dist); + diff --git a/src/engine/client.cpp b/src/engine/client.cpp new file mode 100644 index 0000000..0a1ce8d --- /dev/null +++ b/src/engine/client.cpp @@ -0,0 +1,238 @@ +// client.cpp, mostly network related client game code + +#include "pch.h" +#include "engine.h" + +ENetHost *clienthost = NULL; +ENetPeer *curpeer = NULL, *connpeer = NULL; +int connmillis = 0, connattempts = 0, discmillis = 0; + +bool multiplayer(bool msg) +{ + // check not correct on listen server? + if(curpeer && msg) conoutf(CON_ERROR, "operation not available in multiplayer"); + return curpeer!=NULL; +} + +void setrate(int rate) +{ + if(!curpeer) return; + enet_host_bandwidth_limit(clienthost, rate, rate); +} + +VARF(rate, 0, 0, 25000, setrate(rate)); + +void throttle(); + +VARF(throttle_interval, 0, 5, 30, throttle()); +VARF(throttle_accel, 0, 2, 32, throttle()); +VARF(throttle_decel, 0, 2, 32, throttle()); + +void throttle() +{ + if(!curpeer) return; + ASSERT(ENET_PEER_PACKET_THROTTLE_SCALE==32); + enet_peer_throttle_configure(curpeer, throttle_interval*1000, throttle_accel, throttle_decel); +} + +void abortconnect() +{ + if(!connpeer) return; + if(connpeer->state!=ENET_PEER_STATE_DISCONNECTED) enet_peer_reset(connpeer); + connpeer = NULL; + if(curpeer) return; + enet_host_destroy(clienthost); + clienthost = NULL; +} + +void connects(char *servername) +{ + if(connpeer) + { + conoutf("aborting connection attempt"); + abortconnect(); + } + + ENetAddress address; + address.port = sv->serverport(); + + if(servername) + { + addserver(servername); + conoutf("attempting to connect to %s", servername); + if(!resolverwait(servername, &address)) + { + conoutf("\f3could not resolve server %s", servername); + return; + } + } + else + { + conoutf("attempting to connect over LAN"); + address.host = ENET_HOST_BROADCAST; + } + + if(!clienthost) clienthost = enet_host_create(NULL, 2, rate, rate); + + if(clienthost) + { + connpeer = enet_host_connect(clienthost, &address, cc->numchannels()); + enet_host_flush(clienthost); + connmillis = totalmillis; + connattempts = 0; + } + else conoutf("\f3could not connect to server"); +} + +void lanconnect() +{ + connects(0); +} + +void disconnect(int onlyclean, int async) +{ + bool cleanup = onlyclean!=0; + if(curpeer) + { + if(!discmillis) + { + enet_peer_disconnect(curpeer, DISC_NONE); + enet_host_flush(clienthost); + discmillis = totalmillis; + } + if(curpeer->state!=ENET_PEER_STATE_DISCONNECTED) + { + if(async) return; + enet_peer_reset(curpeer); + } + curpeer = NULL; + discmillis = 0; + conoutf("disconnected"); + cleanup = true; + } + if(cleanup) + { + cc->gamedisconnect(); + localdisconnect(); + } + if(!connpeer && clienthost) + { + enet_host_destroy(clienthost); + clienthost = NULL; + } + if(!onlyclean) { localconnect(); cc->gameconnect(false); } +} + +void trydisconnect() +{ + if(connpeer) + { + conoutf("aborting connection attempt"); + abortconnect(); + return; + } + if(!curpeer) + { + conoutf("not connected"); + return; + } + conoutf("attempting to disconnect..."); + disconnect(0, !discmillis); +} + +COMMANDN(connect, connects, "s"); +COMMAND(lanconnect, ""); +COMMANDN(disconnect, trydisconnect, ""); + +int lastupdate = -1000; + +void sendpackettoserv(ENetPacket *packet, int chan) +{ + if(curpeer) enet_peer_send(curpeer, chan, packet); + else localclienttoserver(chan, packet); +} + +void c2sinfo(dynent *d, int rate) // send update to the server +{ + if(totalmillis-lastupdatedata, packet->dataLength); + bool reliable = false; + int chan = cc->sendpacketclient(p, reliable, d); + if(!p.length()) { enet_packet_destroy(packet); return; } + if(reliable) packet->flags = ENET_PACKET_FLAG_RELIABLE; + enet_packet_resize(packet, p.length()); + sendpackettoserv(packet, chan); + if(clienthost) enet_host_flush(clienthost); +} + +void neterr(const char *s) +{ + conoutf(CON_ERROR, "\f3illegal network message (%s)", s); + disconnect(); +} + +void localservertoclient(int chan, uchar *buf, int len) // processes any updates from the server +{ + ucharbuf p(buf, len); + cc->parsepacketclient(chan, p); +} + +void clientkeepalive() { if(clienthost) enet_host_service(clienthost, NULL, 0); } + +void gets2c() // get updates from the server +{ + ENetEvent event; + if(!clienthost) return; + if(connpeer && totalmillis/3000 > connmillis/3000) + { + conoutf("attempting to connect..."); + connmillis = totalmillis; + ++connattempts; + if(connattempts > 3) + { + conoutf("\f3could not connect to server"); + abortconnect(); + return; + } + } + while(clienthost && enet_host_service(clienthost, &event, 0)>0) + switch(event.type) + { + case ENET_EVENT_TYPE_CONNECT: + disconnect(1); + curpeer = connpeer; + connpeer = NULL; + conoutf("connected to server"); + throttle(); + if(rate) setrate(rate); + cc->gameconnect(true); + break; + + case ENET_EVENT_TYPE_RECEIVE: + if(discmillis) conoutf("attempting to disconnect..."); + else localservertoclient(event.channelID, event.packet->data, (int)event.packet->dataLength); + enet_packet_destroy(event.packet); + break; + + case ENET_EVENT_TYPE_DISCONNECT: + extern const char *disc_reasons[]; + if(event.data>=DISC_NUM) event.data = DISC_NONE; + if(event.peer==connpeer) + { + conoutf("\f3could not connect to server"); + abortconnect(); + } + else + { + if(!discmillis || event.data) conoutf("\f3server network error, disconnecting (%s) ...", disc_reasons[event.data]); + disconnect(); + } + return; + + default: + break; + } +} + diff --git a/src/engine/command.cpp b/src/engine/command.cpp new file mode 100644 index 0000000..4ab0b01 --- /dev/null +++ b/src/engine/command.cpp @@ -0,0 +1,843 @@ +// command.cpp: implements the parsing and execution of a tiny script language which +// is largely backwards compatible with the quake console language. + +#include "pch.h" +#include "engine.h" + +char *exchangestr(char *o, const char *n) { delete[] o; return newstring(n); } + +typedef hashtable identtable; + +identtable *idents = NULL; // contains ALL vars/commands/aliases + +bool overrideidents = false, persistidents = true; + +void clearstack(ident &id) +{ + identstack *stack = id.stack; + while(stack) + { + delete[] stack->action; + identstack *tmp = stack; + stack = stack->next; + delete tmp; + } + id.stack = NULL; +} + +void clear_command() +{ + enumerate(*idents, ident, i, if(i.type==ID_ALIAS) { DELETEA(i.name); DELETEA(i.action); if(i.stack) clearstack(i); }); + if(idents) idents->clear(); +} + +void clearoverrides() +{ + enumerate(*idents, ident, i, + if(i.override!=NO_OVERRIDE) + { + switch(i.type) + { + case ID_ALIAS: + if(i.action[0]) i.action = exchangestr(i.action, ""); + break; + case ID_VAR: + *i.storage.i = i.overrideval.i; + i.changed(); + break; + case ID_FVAR: + *i.storage.f = i.overrideval.f; + i.changed(); + break; + case ID_SVAR: + delete[] *i.storage.s; + *i.storage.s = i.overrideval.s; + i.changed(); + break; + } + i.override = NO_OVERRIDE; + }); +} + +void pushident(ident &id, char *val) +{ + if(id.type != ID_ALIAS) return; + identstack *stack = new identstack; + stack->action = id.isexecuting==id.action ? newstring(id.action) : id.action; + stack->next = id.stack; + id.stack = stack; + id.action = val; +} + +void popident(ident &id) +{ + if(id.type != ID_ALIAS || !id.stack) return; + if(id.action != id.isexecuting) delete[] id.action; + identstack *stack = id.stack; + id.action = stack->action; + id.stack = stack->next; + delete stack; +} + +ident *newident(const char *name) +{ + ident *id = idents->access(name); + if(!id) + { + ident init(ID_ALIAS, newstring(name), newstring(""), persistidents ? IDF_PERSIST : 0); + id = idents->access(init.name, &init); + } + return id; +} + +void pusha(const char *name, char *action) +{ + pushident(*newident(name), action); +} + +void push(char *name, char *action) +{ + pusha(name, newstring(action)); +} + +void pop(char *name) +{ + ident *id = idents->access(name); + if(id) popident(*id); +} + +COMMAND(push, "ss"); +COMMAND(pop, "s"); + +void aliasa(const char *name, char *action) +{ + ident *b = idents->access(name); + if(!b) + { + ident b(ID_ALIAS, newstring(name), action, persistidents ? IDF_PERSIST : 0); + if(overrideidents) b.override = OVERRIDDEN; + idents->access(b.name, &b); + } + else if(b->type != ID_ALIAS) + { + conoutf(CON_ERROR, "cannot redefine builtin %s with an alias", name); + delete[] action; + } + else + { + if(b->action != b->isexecuting) delete[] b->action; + b->action = action; + if(overrideidents) b->override = OVERRIDDEN; + else + { + if(b->override != NO_OVERRIDE) b->override = NO_OVERRIDE; + if(persistidents) + { + if(!(b->flags & IDF_PERSIST)) b->flags |= IDF_PERSIST; + } + else if(b->flags & IDF_PERSIST) b->flags &= ~IDF_PERSIST; + } + } +} + +void alias(const char *name, const char *action) { aliasa(name, newstring(action)); } + +COMMAND(alias, "ss"); + +// variable's and commands are registered through globals, see cube.h + +int variable(const char *name, int min, int cur, int max, int *storage, void (*fun)(), int flags) +{ + if(!idents) idents = new identtable; + ident v(ID_VAR, name, min, cur, max, storage, (void *)fun, flags); + idents->access(name, &v); + return cur; +} + +float fvariable(const char *name, float cur, float *storage, void (*fun)(), int flags) +{ + if(!idents) idents = new identtable; + ident v(ID_FVAR, name, cur, storage, (void *)fun, flags); + idents->access(name, &v); + return cur; +} + +char *svariable(const char *name, const char *cur, char **storage, void (*fun)(), int flags) +{ + if(!idents) idents = new identtable; + ident v(ID_SVAR, name, newstring(cur), storage, (void *)fun, flags); + idents->access(name, &v); + return v.val.s; +} + +#define _GETVAR(id, vartype, name, retval) \ + ident *id = idents->access(name); \ + if(!id || id->type!=vartype) return retval; +#define GETVAR(id, name, retval) _GETVAR(id, ID_VAR, name, retval) +void setvar(const char *name, int i, bool dofunc) +{ + GETVAR(id, name, ); + *id->storage.i = clamp(i, id->minval, id->maxval); + if(dofunc) id->changed(); +} +void setfvar(const char *name, float f, bool dofunc) +{ + _GETVAR(id, ID_FVAR, name, ); + *id->storage.f = f; + if(dofunc) id->changed(); +} +void setsvar(const char *name, const char *str, bool dofunc) +{ + _GETVAR(id, ID_SVAR, name, ); + *id->storage.s = exchangestr(*id->storage.s, str); + if(dofunc) id->changed(); +} +int getvar(const char *name) +{ + GETVAR(id, name, 0); + return *id->storage.i; +} +int getvarmin(const char *name) +{ + GETVAR(id, name, 0); + return id->minval; +} +int getvarmax(const char *name) +{ + GETVAR(id, name, 0); + return id->maxval; +} +bool identexists(const char *name) { return idents->access(name)!=NULL; } +ident *getident(const char *name) { return idents->access(name); } + +void touchvar(const char *name) +{ + ident *id = idents->access(name); + if(id) switch(id->type) + { + case ID_VAR: + case ID_FVAR: + case ID_SVAR: + id->changed(); + break; + } +} + +const char *getalias(const char *name) +{ + ident *i = idents->access(name); + return i && i->type==ID_ALIAS ? i->action : ""; +} + +bool addcommand(const char *name, void (*fun)(), const char *narg) +{ + if(!idents) idents = new identtable; + ident c(ID_COMMAND, name, narg, (void *)fun); + idents->access(name, &c); + return false; +} + +void addident(const char *name, ident *id) +{ + if(!idents) idents = new identtable; + idents->access(name, id); +} + +static vector *> wordbufs; +static int bufnest = 0; + +char *parseexp(const char *&p, int right); + +void parsemacro(const char *&p, int level, vector &wordbuf) +{ + int escape = 1; + while(*p=='@') p++, escape++; + if(level > escape) + { + while(escape--) wordbuf.add('@'); + return; + } + if(*p=='(') + { + char *ret = parseexp(p, ')'); + if(ret) + { + for(char *sub = ret; *sub; ) wordbuf.add(*sub++); + delete[] ret; + } + return; + } + static vector ident; + ident.setsizenodelete(0); + while(isalnum(*p) || *p=='_') ident.add(*p++); + ident.add(0); + const char *alias = getalias(ident.getbuf()); + while(*alias) wordbuf.add(*alias++); +} + +char *parseexp(const char *&p, int right) // parse any nested set of () or [] +{ + if(bufnest++>=wordbufs.length()) wordbufs.add(new vector); + vector &wordbuf = *wordbufs[bufnest-1]; + int left = *p++; + for(int brak = 1; brak; ) + { + int c = *p++; + if(c=='\r') continue; // hack + if(left=='[' && c=='@') + { + parsemacro(p, brak, wordbuf); + continue; + } + if(c=='\"') + { + wordbuf.add(c); + const char *end = p+strcspn(p, "\"\r\n\0"); + while(p < end) wordbuf.add(*p++); + if(*p=='\"') wordbuf.add(*p++); + continue; + } + if(c=='/' && *p=='/') + { + p += strcspn(p, "\n\0"); + continue; + } + + if(c==left) brak++; + else if(c==right) brak--; + else if(!c) + { + p--; + conoutf(CON_ERROR, "missing \"%c\"", right); + wordbuf.setsize(0); + bufnest--; + return NULL; + } + wordbuf.add(c); + } + wordbuf.pop(); + char *s; + if(left=='(') + { + wordbuf.add(0); + char *ret = executeret(wordbuf.getbuf()); // evaluate () exps directly, and substitute result + wordbuf.pop(); + s = ret ? ret : newstring(""); + } + else + { + s = newstring(wordbuf.getbuf(), wordbuf.length()); + } + wordbuf.setsize(0); + bufnest--; + return s; +} + +char *lookup(char *n) // find value of ident referenced with $ in exp +{ + ident *id = idents->access(n+1); + if(id) switch(id->type) + { + case ID_VAR: { s_sprintfd(t)("%d", *id->storage.i); return exchangestr(n, t); } + case ID_FVAR: { s_sprintfd(t)("%f", *id->storage.f); return exchangestr(n, t); } + case ID_SVAR: return exchangestr(n, *id->storage.s); + case ID_ALIAS: return exchangestr(n, id->action); + } + conoutf(CON_ERROR, "unknown alias lookup: %s", n+1); + return n; +} + +char *parseword(const char *&p) // parse single argument, including expressions +{ + for(;;) + { + p += strspn(p, " \t\r"); + if(p[0]!='/' || p[1]!='/') break; + p += strcspn(p, "\n\0"); + } + if(*p=='\"') + { + p++; + const char *word = p; + p += strcspn(p, "\"\r\n\0"); + char *s = newstring(word, p-word); + if(*p=='\"') p++; + return s; + } + if(*p=='(') return parseexp(p, ')'); + if(*p=='[') return parseexp(p, ']'); + const char *word = p; + for(;;) + { + p += strcspn(p, "/; \t\r\n\0"); + if(p[0]!='/' || p[1]=='/') break; + else if(p[1]=='\0') { p++; break; } + p += 2; + } + if(p-word==0) return NULL; + char *s = newstring(word, p-word); + if(*s=='$') return lookup(s); // substitute variables + return s; +} + +char *conc(char **w, int n, bool space) +{ + int len = space ? max(n-1, 0) : 0; + loopj(n) len += (int)strlen(w[j]); + char *r = newstring("", len); + loopi(n) + { + strcat(r, w[i]); // make string-list out of all arguments + if(i==n-1) break; + if(space) strcat(r, " "); + } + return r; +} + +VARN(numargs, _numargs, 0, 0, 25); + +#define parseint(s) strtol((s), NULL, 0) + +char *commandret = NULL; + +extern const char *addreleaseaction(const char *s); + +char *executeret(const char *p) // all evaluation happens here, recursively +{ + const int MAXWORDS = 25; // limit, remove + char *w[MAXWORDS]; + char *retval = NULL; + #define setretval(v) { char *rv = v; if(rv) retval = rv; } + for(bool cont = true; cont;) // for each ; seperated statement + { + int numargs = MAXWORDS; + loopi(MAXWORDS) // collect all argument values + { + w[i] = (char *)""; + if(i>numargs) continue; + char *s = parseword(p); // parse and evaluate exps + if(s) w[i] = s; + else numargs = i; + } + + p += strcspn(p, ";\n\0"); + cont = *p++!=0; // more statements if this isn't the end of the string + char *c = w[0]; + if(!*c) continue; // empty statement + + DELETEA(retval); + + if(w[1][0]=='=' && !w[1][1]) + { + aliasa(c, numargs>2 ? w[2] : newstring("")); + w[2] = NULL; + } + else + { + ident *id = idents->access(c); + if(!id) + { + if(!isdigit(*c) && ((*c!='+' && *c!='-' && *c!='.') || !isdigit(c[1]))) + conoutf(CON_ERROR, "unknown command: %s", c); + setretval(newstring(c)); + } + else switch(id->type) + { + case ID_CCOMMAND: + case ID_COMMAND: // game defined commands + { + void *v[MAXWORDS]; + union + { + int i; + float f; + } nstor[MAXWORDS]; + int n = 0, wn = 0; + char *cargs = NULL; + if(id->type==ID_CCOMMAND) v[n++] = id->self; + for(const char *a = id->narg; *a; a++) switch(*a) + { + case 's': v[n] = w[++wn]; n++; break; + case 'i': nstor[n].i = parseint(w[++wn]); v[n] = &nstor[n].i; n++; break; + case 'f': nstor[n].f = atof(w[++wn]); v[n] = &nstor[n].f; n++; break; + case 'D': nstor[n].i = addreleaseaction(id->name) ? 1 : 0; v[n] = &nstor[n].i; n++; break; + case 'V': v[n++] = w+1; nstor[n].i = numargs-1; v[n] = &nstor[n].i; n++; break; + case 'C': if(!cargs) cargs = conc(w+1, numargs-1, true); v[n++] = cargs; break; + default: fatal("builtin declared with illegal type"); + } + switch(n) + { + case 0: ((void (__cdecl *)() )id->fun)(); break; + case 1: ((void (__cdecl *)(void *) )id->fun)(v[0]); break; + case 2: ((void (__cdecl *)(void *, void *) )id->fun)(v[0], v[1]); break; + case 3: ((void (__cdecl *)(void *, void *, void *) )id->fun)(v[0], v[1], v[2]); break; + case 4: ((void (__cdecl *)(void *, void *, void *, void *) )id->fun)(v[0], v[1], v[2], v[3]); break; + case 5: ((void (__cdecl *)(void *, void *, void *, void *, void *))id->fun)(v[0], v[1], v[2], v[3], v[4]); break; + case 6: ((void (__cdecl *)(void *, void *, void *, void *, void *, void *))id->fun)(v[0], v[1], v[2], v[3], v[4], v[5]); break; + case 7: ((void (__cdecl *)(void *, void *, void *, void *, void *, void *, void *))id->fun)(v[0], v[1], v[2], v[3], v[4], v[5], v[6]); break; + case 8: ((void (__cdecl *)(void *, void *, void *, void *, void *, void *, void *, void *))id->fun)(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]); break; + default: fatal("builtin declared with too many args (use V?)"); + } + if(cargs) delete[] cargs; + setretval(commandret); + commandret = NULL; + break; + } + + case ID_VAR: // game defined variables + if(numargs <= 1) conoutf("%s = %d", c, *id->storage.i); // var with no value just prints its current value + else if(id->minval>id->maxval) conoutf(CON_ERROR, "variable %s is read-only", id->name); + else + { + #define OVERRIDEVAR(saveval, resetval) \ + if(overrideidents || id->flags&IDF_OVERRIDE) \ + { \ + if(id->flags&IDF_PERSIST) \ + { \ + conoutf(CON_ERROR, "cannot override persistent variable %s", id->name); \ + break; \ + } \ + if(id->override==NO_OVERRIDE) { saveval; id->override = OVERRIDDEN; } \ + } \ + else if(id->override!=NO_OVERRIDE) { resetval; id->override = NO_OVERRIDE; } + OVERRIDEVAR(id->overrideval.i = *id->storage.i, ) + int i1 = parseint(w[1]); + if(i1minval || i1>id->maxval) + { + i1 = i1minval ? id->minval : id->maxval; // clamp to valid range + conoutf(CON_ERROR, "valid range for %s is %d..%d", id->name, id->minval, id->maxval); + } + *id->storage.i = i1; + id->changed(); // call trigger function if available + } + break; + + case ID_FVAR: + if(numargs <= 1) conoutf("%s = %f", c, *id->storage.f); + else + { + OVERRIDEVAR(id->overrideval.f = *id->storage.f, ); + *id->storage.f = atof(w[1]); + id->changed(); + } + break; + + case ID_SVAR: + if(numargs <= 1) conoutf(strchr(*id->storage.s, '"') ? "%s = [%s]" : "%s = \"%s\"", c, *id->storage.s); + else + { + OVERRIDEVAR(id->overrideval.s = *id->storage.s, delete[] id->overrideval.s); + *id->storage.s = newstring(w[1]); + id->changed(); + } + break; + + case ID_ALIAS: // alias, also used as functions and (global) variables + { + static vector argids; + for(int i = 1; i argids.length()) + { + s_sprintfd(argname)("arg%d", i); + argids.add(newident(argname)); + } + pushident(*argids[i-1], w[i]); // set any arguments as (global) arg values so functions can access them + } + _numargs = numargs-1; + bool wasoverriding = overrideidents; + if(id->override!=NO_OVERRIDE) overrideidents = true; + char *wasexecuting = id->isexecuting; + id->isexecuting = id->action; + setretval(executeret(id->action)); + if(id->isexecuting != id->action && id->isexecuting != wasexecuting) delete[] id->isexecuting; + id->isexecuting = wasexecuting; + overrideidents = wasoverriding; + for(int i = 1; isavedconfig(), true), "w"); + if(!f) return; + fprintf(f, "// automatically written on exit, DO NOT MODIFY\n// delete this file to have %s overwrite these settings\n// modify settings in game, or put settings in %s to override anything\n\n", cl->defaultconfig(), cl->autoexec()); + cc->writeclientinfo(f); + fprintf(f, "\n"); + writecrosshairs(f); + enumerate(*idents, ident, id, + if(id.flags&IDF_PERSIST) switch(id.type) + { + case ID_VAR: fprintf(f, "%s %d\n", id.name, *id.storage.i); break; + case ID_FVAR: fprintf(f, "%s %f\n", id.name, *id.storage.f); break; + case ID_SVAR: fprintf(f, "%s [%s]\n", id.name, *id.storage.s); break; + } + ); + fprintf(f, "\n"); + writebinds(f); + fprintf(f, "\n"); + enumerate(*idents, ident, id, + if(id.type==ID_ALIAS && id.flags&IDF_PERSIST && id.override==NO_OVERRIDE && !strstr(id.name, "nextmap_") && id.action[0]) + { + fprintf(f, "\"%s\" = [%s]\n", id.name, id.action); + } + ); + fprintf(f, "\n"); + writecompletions(f); + fclose(f); +} + +COMMAND(writecfg, ""); + +// below the commands that implement a small imperative language. thanks to the semantics of +// () and [] expressions, any control construct can be defined trivially. + +void intret(int v) { s_sprintfd(b)("%d", v); commandret = newstring(b); } + +ICOMMAND(if, "sss", (char *cond, char *t, char *f), commandret = executeret(cond[0]!='0' ? t : f)); +ICOMMAND(loop, "sis", (char *var, int *n, char *body), +{ + if(*n<=0) return; + ident *id = newident(var); + if(id->type!=ID_ALIAS) return; + loopi(*n) + { + if(i) sprintf(id->action, "%d", i); + else pushident(*id, newstring("0", 16)); + execute(body); + } + popident(*id); +}); +ICOMMAND(while, "ss", (char *cond, char *body), while(execute(cond)) execute(body)); // can't get any simpler than this :) + +void concat(const char *s) { commandret = newstring(s); } +void result(const char *s) { commandret = newstring(s); } + +void concatword(char **args, int *numargs) +{ + commandret = conc(args, *numargs, false); +} + +void format(char **args, int *numargs) +{ + vector s; + char *f = args[0]; + while(*f) + { + int c = *f++; + if(c == '%') + { + int i = *f++; + if(i >= '1' && i <= '9') + { + i -= '0'; + const char *sub = i < *numargs ? args[i] : ""; + while(*sub) s.add(*sub++); + } + else s.add(i); + } + else s.add(c); + } + s.add('\0'); + result(s.getbuf()); +} + +#define whitespaceskip s += strspn(s, "\n\t ") +#define elementskip *s=='"' ? (++s, s += strcspn(s, "\"\n\0"), s += *s=='"') : s += strcspn(s, "\n\t \0") + +void explodelist(const char *s, vector &elems) +{ + whitespaceskip; + while(*s) + { + const char *elem = s; + elementskip; + elems.add(*elem=='"' ? newstring(elem+1, s-elem-(s[-1]=='"' ? 2 : 1)) : newstring(elem, s-elem)); + whitespaceskip; + } +} + +char *indexlist(const char *s, int pos) +{ + whitespaceskip; + loopi(pos) elementskip, whitespaceskip; + const char *e = s; + elementskip; + if(*e=='"') + { + e++; + if(s[-1]=='"') --s; + } + return newstring(e, s-e); +} + +void listlen(char *s) +{ + int n = 0; + whitespaceskip; + for(; *s; n++) elementskip, whitespaceskip; + intret(n); +} + +void at(char *s, int *pos) +{ + commandret = indexlist(s, *pos); +} + +void substr(char *s, int *start, int *count) +{ + int len = strlen(s), offset = clamp(*start, 0, len); + commandret = newstring(&s[offset], *count <= 0 ? len - offset : min(*count, len - offset)); +} + +void getalias_(char *s) +{ + result(getalias(s)); +} + +COMMAND(exec, "s"); +COMMAND(concat, "C"); +COMMAND(result, "s"); +COMMAND(concatword, "V"); +COMMAND(format, "V"); +COMMAND(at, "si"); +COMMAND(substr, "sii"); +COMMAND(listlen, "s"); +COMMANDN(getalias, getalias_, "s"); + +void add (int *a, int *b) { intret(*a + *b); } COMMANDN(+, add, "ii"); +void mul (int *a, int *b) { intret(*a * *b); } COMMANDN(*, mul, "ii"); +void sub (int *a, int *b) { intret(*a - *b); } COMMANDN(-, sub, "ii"); +void divi (int *a, int *b) { intret(*b ? *a / *b : 0); } COMMANDN(div, divi, "ii"); +void mod (int *a, int *b) { intret(*b ? *a % *b : 0); } COMMAND(mod, "ii"); +void equal(int *a, int *b) { intret((int)(*a == *b)); } COMMANDN(=, equal, "ii"); +void nequal(int *a, int *b) { intret((int)(*a != *b)); } COMMANDN(!=, nequal, "ii"); +void lt (int *a, int *b) { intret((int)(*a < *b)); } COMMANDN(<, lt, "ii"); +void gt (int *a, int *b) { intret((int)(*a > *b)); } COMMANDN(>, gt, "ii"); +void lte (int *a, int *b) { intret((int)(*a <= *b)); } COMMANDN(<=, lte, "ii"); +void gte (int *a, int *b) { intret((int)(*a >= *b)); } COMMANDN(>=, gte, "ii"); +void xora (int *a, int *b) { intret(*a ^ *b); } COMMANDN(^, xora, "ii"); +void nota (int *a) { intret(*a == 0); } COMMANDN(!, nota, "i"); +void mina (int *a, int *b) { intret(min(*a, *b)); } COMMANDN(min, mina, "ii"); +void maxa (int *a, int *b) { intret(max(*a, *b)); } COMMANDN(max, maxa, "ii"); + +void anda (char *a, char *b) { intret(execute(a)!=0 && execute(b)!=0); } +void ora (char *a, char *b) { intret(execute(a)!=0 || execute(b)!=0); } + +COMMANDN(&&, anda, "ss"); +COMMANDN(||, ora, "ss"); + +void rndn(int *a) { intret(*a>0 ? rnd(*a) : 0); } COMMANDN(rnd, rndn, "i"); + +void strcmpa(char *a, char *b) { intret(strcmp(a,b)==0); } COMMANDN(strcmp, strcmpa, "ss"); + +ICOMMAND(echo, "C", (char *s), conoutf(CON_ECHO, "\f1%s", s)); + +void strstra(char *a, char *b) { char *s = strstr(a, b); intret(s ? s-a : -1); } COMMANDN(strstr, strstra, "ss"); + +char *strreplace(const char *s, const char *oldval, const char *newval) +{ + vector buf; + + int oldlen = strlen(oldval); + for(;;) + { + const char *found = strstr(s, oldval); + if(found) + { + while(s < found) buf.add(*s++); + for(const char *n = newval; *n; n++) buf.add(*n); + s = found + oldlen; + } + else + { + while(*s) buf.add(*s++); + buf.add('\0'); + return newstring(buf.getbuf(), buf.length()); + } + } +} + +void strreplacea(char *s, char *o, char *n) { commandret = strreplace(s, o, n); } COMMANDN(strreplace, strreplacea, "sss"); + +struct sleepcmd +{ + int millis; + char *command; + bool override; +}; +vector sleepcmds; + +void addsleep(int *msec, char *cmd) +{ + sleepcmd &s = sleepcmds.add(); + s.millis = *msec+lastmillis; + s.command = newstring(cmd); + s.override = overrideidents; +} + +COMMANDN(sleep, addsleep, "is"); + +void checksleep(int millis) +{ + loopv(sleepcmds) + { + sleepcmd &s = sleepcmds[i]; + if(s.millis && millis>s.millis) + { + char *cmd = s.command; // execute might create more sleep commands + execute(cmd); + delete[] cmd; + sleepcmds.remove(i--); + } + } +} + +void clearsleep(bool clearoverrides) +{ + int len = 0; + loopv(sleepcmds) + { + if(clearoverrides && !sleepcmds[i].override) sleepcmds[len++] = sleepcmds[i]; + else delete[] sleepcmds[i].command; + } + sleepcmds.setsize(len); +} + +void clearsleep_(int *clearoverrides) +{ + clearsleep(*clearoverrides!=0 || overrideidents); +} + +COMMANDN(clearsleep, clearsleep_, "i"); + diff --git a/src/engine/console.cpp b/src/engine/console.cpp new file mode 100644 index 0000000..d5b76bb --- /dev/null +++ b/src/engine/console.cpp @@ -0,0 +1,736 @@ +// console.cpp: the console buffer, its display, and command line control + +#include "pch.h" +#include "engine.h" + +struct cline { char *line; int type, outtime; }; +vector conlines; + +bool saycommandon = false; +string commandbuf; +char *commandaction = NULL, *commandprompt = NULL; +int commandpos = -1; + +VARFP(maxcon, 10, 200, 1000, { while(conlines.length() > maxcon) delete[] conlines.pop().line; }); + +void conline(int type, const char *sf) // add a line to the console buffer +{ + cline cl; + cl.line = conlines.length()>maxcon ? conlines.pop().line : newstringbuf(""); // constrain the buffer size + cl.type = type; + cl.outtime = totalmillis; // for how long to keep line on screen + conlines.insert(0, cl); + s_strcpy(cl.line, sf); +} + +#define CONSPAD (FONTH/3) + +void conoutfv(int type, const char *fmt, va_list args) +{ + string sf, sp; + formatstring(sf, fmt, args); + filtertext(sp, sf); + puts(sp); + conline(type, sf); +} + +void conoutf(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + conoutfv(CON_INFO, fmt, args); + va_end(args); +} + +void conoutf(int type, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + conoutfv(type, fmt, args); + va_end(args); +} + +bool fullconsole = false; +void toggleconsole() { fullconsole = !fullconsole; } +COMMAND(toggleconsole, ""); + +int rendercommand(int x, int y, int w) +{ + if(!saycommandon) return 0; + + s_sprintfd(s)("%s %s", commandprompt ? commandprompt : ">", commandbuf); + int width, height; + text_bounds(s, width, height, w); + y-= height-FONTH; + draw_text(s, x, y, 0xFF, 0xFF, 0xFF, 0xFF, (commandpos>=0) ? (commandpos+1+(commandprompt?strlen(commandprompt):1)) : strlen(s), w); + return height; +} + +void blendbox(int x1, int y1, int x2, int y2, bool border) +{ + notextureshader->set(); + + glDepthMask(GL_FALSE); + glDisable(GL_TEXTURE_2D); + glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); + glBegin(GL_QUADS); + if(border) glColor3d(0.5, 0.3, 0.4); + else glColor3d(1.0, 1.0, 1.0); + glVertex2f(x1, y1); + glVertex2f(x2, y1); + glVertex2f(x2, y2); + glVertex2f(x1, y2); + glEnd(); + glDisable(GL_BLEND); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + glBegin(GL_QUADS); + glColor3d(0.2, 0.7, 0.4); + glVertex2f(x1, y1); + glVertex2f(x2, y1); + glVertex2f(x2, y2); + glVertex2f(x1, y2); + glEnd(); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + xtraverts += 8; + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glDepthMask(GL_TRUE); + + defaultshader->set(); +} + +VARP(consize, 0, 5, 100); +VARP(confade, 0, 30, 60); +VARP(fullconsize, 0, 75, 100); +VARP(confilter, 0, 0xFFFFFF, 0xFFFFFF); +VARP(fullconfilter, 0, 0xFFFFFF, 0xFFFFFF); + +int conskip = 0; + +void setconskip(int *n) +{ + int filter = fullconsole ? fullconfilter : confilter, + skipped = abs(*n), + dir = *n < 0 ? -1 : 1; + conskip = clamp(conskip, 0, conlines.length()-1); + while(skipped) + { + conskip += dir; + if(!conlines.inrange(conskip)) + { + conskip = clamp(conskip, 0, conlines.length()-1); + return; + } + if(conlines[conskip].type&filter) --skipped; + } +} + +COMMANDN(conskip, setconskip, "i"); + +int renderconsole(int w, int h) // render buffer taking into account time & scrolling +{ + int conheight = min(fullconsole ? ((h*3*fullconsize/100)/FONTH)*FONTH : (FONTH*consize), h*3 - 2*CONSPAD - 2*FONTH/3), + conwidth = w*3 - 2*CONSPAD - 2*FONTH/3, + filter = fullconsole ? fullconfilter : confilter; + + if(fullconsole) blendbox(CONSPAD, CONSPAD, conwidth+CONSPAD+2*FONTH/3, conheight+CONSPAD+2*FONTH/3, true); + + int numl = conlines.length(), offset = min(conskip, numl); + + if(!fullconsole && confade) + { + if(!conskip) + { + numl = 0; + loopvrev(conlines) if(totalmillis-conlines[i].outtime < confade*1000) { numl = i+1; break; } + } + else offset--; + } + + int y = 0; + loopi(numl) //determine visible height + { + // shuffle backwards to fill if necessary + int idx = offset+i < numl ? offset+i : --offset; + if(!(conlines[idx].type&filter)) continue; + char *line = conlines[idx].line; + int width, height; + text_bounds(line, width, height, conwidth); + y += height; + if(y > conheight) { numl = i; if(offset == idx) ++offset; break; } + } + y = CONSPAD+FONTH/3; + loopi(numl) + { + int idx = offset + numl-i-1; + if(!(conlines[idx].type&filter)) continue; + char *line = conlines[idx].line; + draw_text(line, CONSPAD+FONTH/3, y, 0xFF, 0xFF, 0xFF, 0xFF, -1, conwidth); + int width, height; + text_bounds(line, width, height, conwidth); + y += height; + } + return fullconsole ? (2*CONSPAD+conheight+2*FONTH/3) : (y+CONSPAD+FONTH/3); +} + +// keymap is defined externally in keymap.cfg + +struct keym +{ + enum + { + ACTION_DEFAULT = 0, + ACTION_SPECTATOR, + ACTION_EDITING, + NUMACTIONS + }; + + int code; + char *name; + char *actions[NUMACTIONS]; + bool pressed; + + keym() : code(-1), name(NULL), pressed(false) { memset(actions, 0, sizeof(actions)); } + ~keym() { DELETEA(name); loopi(NUMACTIONS) DELETEA(actions[i]); } +}; + +vector keyms; + +void keymap(char *code, char *key) +{ + if(overrideidents) { conoutf(CON_ERROR, "cannot override keymap %s", code); return; } + keym &km = keyms.add(); + km.code = atoi(code); + km.name = newstring(key); + loopi(keym::NUMACTIONS) km.actions[i] = newstring(""); +} + +COMMAND(keymap, "ss"); + +keym *keypressed = NULL; +char *keyaction = NULL; + +keym *findbind(char *key) +{ + loopv(keyms) if(!strcasecmp(keyms[i].name, key)) return &keyms[i]; + return NULL; +} + +void getbind(char *key) +{ + keym *km = findbind(key); + result(km ? km->actions[keym::ACTION_DEFAULT] : ""); +} + +void getspecbind(char *key) +{ + keym *km = findbind(key); + result(km ? km->actions[keym::ACTION_SPECTATOR] : ""); +} + +void geteditbind(char *key) +{ + keym *km = findbind(key); + result(km ? km->actions[keym::ACTION_EDITING] : ""); +} + +void bindkey(char *key, char *action, int state, const char *cmd) +{ + if(overrideidents) { conoutf(CON_ERROR, "cannot override %s \"%s\"", cmd, key); return; } + keym *km = findbind(key); + if(!km) { conoutf(CON_ERROR, "unknown key \"%s\"", key); return; } + char *&binding = km->actions[state]; + if(!keypressed || keyaction!=binding) delete[] binding; + binding = newstring(action); +} + +void bindnorm(char *key, char *action) { bindkey(key, action, keym::ACTION_DEFAULT, "bind"); } +void bindspec(char *key, char *action) { bindkey(key, action, keym::ACTION_SPECTATOR, "specbind"); } +void bindedit(char *key, char *action) { bindkey(key, action, keym::ACTION_EDITING, "editbind"); } + +COMMANDN(bind, bindnorm, "ss"); +COMMANDN(specbind, bindspec, "ss"); +COMMANDN(editbind, bindedit, "ss"); +COMMAND(getbind, "s"); +COMMAND(getspecbind, "s"); +COMMAND(geteditbind, "s"); + +void saycommand(char *init) // turns input to the command line on or off +{ + SDL_EnableUNICODE(saycommandon = (init!=NULL)); + if(!editmode) keyrepeat(saycommandon); + s_strcpy(commandbuf, init ? init : ""); + DELETEA(commandaction); + DELETEA(commandprompt); + commandpos = -1; +} + +void inputcommand(char *init, char *action, char *prompt) +{ + saycommand(init); + if(action[0]) commandaction = newstring(action); + if(prompt[0]) commandprompt = newstring(prompt); +} + +void mapmsg(char *s) { s_strncpy(hdr.maptitle, s, 128); } + +COMMAND(saycommand, "C"); +COMMAND(inputcommand, "sss"); +COMMAND(mapmsg, "s"); + +#if !defined(WIN32) && !defined(__APPLE__) +#include +#include +#endif + +void pasteconsole() +{ + #ifdef WIN32 + if(!IsClipboardFormatAvailable(CF_TEXT)) return; + if(!OpenClipboard(NULL)) return; + char *cb = (char *)GlobalLock(GetClipboardData(CF_TEXT)); + s_strcat(commandbuf, cb); + GlobalUnlock(cb); + CloseClipboard(); + #elif defined(__APPLE__) + extern void mac_pasteconsole(char *commandbuf); + + mac_pasteconsole(commandbuf); + #else + SDL_SysWMinfo wminfo; + SDL_VERSION(&wminfo.version); + wminfo.subsystem = SDL_SYSWM_X11; + if(!SDL_GetWMInfo(&wminfo)) return; + int cbsize; + char *cb = XFetchBytes(wminfo.info.x11.display, &cbsize); + if(!cb || !cbsize) return; + size_t commandlen = strlen(commandbuf); + for(char *cbline = cb, *cbend; commandlen + 1 < sizeof(commandbuf) && cbline < &cb[cbsize]; cbline = cbend + 1) + { + cbend = (char *)memchr(cbline, '\0', &cb[cbsize] - cbline); + if(!cbend) cbend = &cb[cbsize]; + if(size_t(commandlen + cbend - cbline + 1) > sizeof(commandbuf)) cbend = cbline + sizeof(commandbuf) - commandlen - 1; + memcpy(&commandbuf[commandlen], cbline, cbend - cbline); + commandlen += cbend - cbline; + commandbuf[commandlen] = '\n'; + if(commandlen + 1 < sizeof(commandbuf) && cbend < &cb[cbsize]) ++commandlen; + commandbuf[commandlen] = '\0'; + } + XFree(cb); + #endif +} + +struct hline +{ + char *buf, *action, *prompt; + + hline() : buf(NULL), action(NULL), prompt(NULL) {} + ~hline() + { + DELETEA(buf); + DELETEA(action); + DELETEA(prompt); + } + + void restore() + { + s_strcpy(commandbuf, buf); + if(commandpos >= (int)strlen(commandbuf)) commandpos = -1; + DELETEA(commandaction); + DELETEA(commandprompt); + if(action) commandaction = newstring(action); + if(prompt) commandprompt = newstring(prompt); + } + + bool shouldsave() + { + return strcmp(commandbuf, buf) || + (commandaction ? !action || strcmp(commandaction, action) : action!=NULL) || + (commandprompt ? !prompt || strcmp(commandprompt, prompt) : prompt!=NULL); + } + + void save() + { + buf = newstring(commandbuf); + if(commandaction) action = newstring(commandaction); + if(commandprompt) prompt = newstring(commandprompt); + } + + void run() + { + if(action) + { + alias("commandbuf", buf); + execute(action); + } + else if(buf[0]=='/') execute(buf+1); + else cc->toserver(buf); + } +}; +vector history; +int histpos = 0; + +void history_(int *n) +{ + static bool inhistory = true; + if(!inhistory && history.inrange(*n)) + { + inhistory = true; + history[history.length()-*n-1]->run(); + inhistory = false; + } +} + +COMMANDN(history, history_, "i"); + +struct releaseaction +{ + keym *key; + char *action; +}; +vector releaseactions; + +const char *addreleaseaction(const char *s) +{ + if(!keypressed) return NULL; + releaseaction &ra = releaseactions.add(); + ra.key = keypressed; + ra.action = newstring(s); + return keypressed->name; +} + +void onrelease(char *s) +{ + addreleaseaction(s); +} + +COMMAND(onrelease, "s"); + +void execbind(keym &k, bool isdown) +{ + loopv(releaseactions) + { + releaseaction &ra = releaseactions[i]; + if(ra.key==&k) + { + if(!isdown) execute(ra.action); + delete[] ra.action; + releaseactions.remove(i--); + } + } + if(isdown) + { + int state = editmode ? keym::ACTION_EDITING : (player->state==CS_SPECTATOR ? keym::ACTION_SPECTATOR : keym::ACTION_DEFAULT); + char *&action = k.actions[state][0] ? k.actions[state] : k.actions[keym::ACTION_DEFAULT]; + keyaction = action; + keypressed = &k; + execute(keyaction); + keypressed = NULL; + if(keyaction!=action) delete[] keyaction; + } + k.pressed = isdown; +} + +void consolekey(int code, bool isdown, int cooked) +{ + #ifdef __APPLE__ + #define MOD_KEYS (KMOD_LMETA|KMOD_RMETA) + #else + #define MOD_KEYS (KMOD_LCTRL|KMOD_RCTRL) + #endif + + if(isdown) + { + switch(code) + { + case SDLK_RETURN: + case SDLK_KP_ENTER: + break; + + case SDLK_HOME: + if(strlen(commandbuf)) commandpos = 0; + break; + + case SDLK_END: + commandpos = -1; + break; + + case SDLK_DELETE: + { + int len = (int)strlen(commandbuf); + if(commandpos<0) break; + memmove(&commandbuf[commandpos], &commandbuf[commandpos+1], len - commandpos); + resetcomplete(); + if(commandpos>=len-1) commandpos = -1; + break; + } + + case SDLK_BACKSPACE: + { + int len = (int)strlen(commandbuf), i = commandpos>=0 ? commandpos : len; + if(i<1) break; + memmove(&commandbuf[i-1], &commandbuf[i], len - i + 1); + resetcomplete(); + if(commandpos>0) commandpos--; + else if(!commandpos && len<=1) commandpos = -1; + break; + } + + case SDLK_LEFT: + if(commandpos>0) commandpos--; + else if(commandpos<0) commandpos = (int)strlen(commandbuf)-1; + break; + + case SDLK_RIGHT: + if(commandpos>=0 && ++commandpos>=(int)strlen(commandbuf)) commandpos = -1; + break; + + case SDLK_UP: + if(histpos>0) history[--histpos]->restore(); + break; + + case SDLK_DOWN: + if(histpos+1restore(); + break; + + case SDLK_TAB: + if(!commandaction) + { + complete(commandbuf); + if(commandpos>=0 && commandpos>=(int)strlen(commandbuf)) commandpos = -1; + } + break; + + case SDLK_v: + if(SDL_GetModState()&MOD_KEYS) { pasteconsole(); return; } + // fall through + + default: + resetcomplete(); + if(cooked) + { + size_t len = (int)strlen(commandbuf); + if(len+1shouldsave()) + history.add(h = new hline)->save(); // cap this? + else h = history.last(); + } + histpos = history.length(); + saycommand(NULL); + if(h) h->run(); + } + else if(code==SDLK_ESCAPE) + { + histpos = history.length(); + saycommand(NULL); + } + } +} + +extern bool menukey(int code, bool isdown, int cooked); + +void keypress(int code, bool isdown, int cooked) +{ + keym *haskey = NULL; + loopv(keyms) if(keyms[i].code==code) { haskey = &keyms[i]; break; } + if(haskey && haskey->pressed) execbind(*haskey, isdown); // allow pressed keys to release + else if(!menukey(code, isdown, cooked)) // 3D GUI mouse button intercept + { + if(saycommandon) consolekey(code, isdown, cooked); + else if(haskey) execbind(*haskey, isdown); + } +} + +void clear_console() +{ + keyms.setsize(0); +} + +void writebinds(FILE *f) +{ + loopv(keyms) loopj(3) + { + static const char *cmds[3] = { "bind", "specbind", "editbind" }; + if(*keyms[i].actions[j]) fprintf(f, "%s \"%s\" [%s]\n", cmds[j], keyms[i].name, keyms[i].actions[j]); + } +} + +// tab-completion of all idents and base maps + +enum { FILES_DIR = 0, FILES_LIST }; + +struct fileskey +{ + int type; + const char *dir, *ext; + + fileskey() {} + fileskey(int type, const char *dir, const char *ext) : type(type), dir(dir), ext(ext) {} +}; + +struct filesval +{ + int type; + char *dir, *ext; + vector files; + + filesval(int type, const char *dir, const char *ext) : type(type), dir(newstring(dir)), ext(ext && ext[0] ? newstring(ext) : NULL) {} + ~filesval() { DELETEA(dir); DELETEA(ext); loopv(files) DELETEA(files[i]); files.setsize(0); } +}; + +static inline bool htcmp(const fileskey &x, const fileskey &y) +{ + return x.type==y.type && !strcmp(x.dir, y.dir) && (x.ext == y.ext || (x.ext && y.ext && !strcmp(x.ext, y.ext))); +} + +static inline uint hthash(const fileskey &k) +{ + return hthash(k.dir); +} + +static hashtable completefiles; +static hashtable completions; + +int completesize = 0; +string lastcomplete; + +void resetcomplete() { completesize = 0; } + +void addcomplete(char *command, int type, char *dir, char *ext) +{ + if(overrideidents) + { + conoutf(CON_ERROR, "cannot override complete %s", command); + return; + } + if(!dir[0]) + { + filesval **hasfiles = completions.access(command); + if(hasfiles) *hasfiles = NULL; + return; + } + if(type==FILES_DIR) + { + int dirlen = (int)strlen(dir); + while(dirlen > 0 && (dir[dirlen-1] == '/' || dir[dirlen-1] == '\\')) + dir[--dirlen] = '\0'; + if(ext) + { + if(strchr(ext, '*')) ext[0] = '\0'; + if(!ext[0]) ext = NULL; + } + } + fileskey key(type, dir, ext); + filesval **val = completefiles.access(key); + if(!val) + { + filesval *f = new filesval(type, dir, ext); + if(type==FILES_LIST) explodelist(dir, f->files); + val = &completefiles[fileskey(type, f->dir, f->ext)]; + *val = f; + } + filesval **hasfiles = completions.access(command); + if(hasfiles) *hasfiles = *val; + else completions[newstring(command)] = *val; +} + +void addfilecomplete(char *command, char *dir, char *ext) +{ + addcomplete(command, FILES_DIR, dir, ext); +} + +void addlistcomplete(char *command, char *list) +{ + addcomplete(command, FILES_LIST, list, NULL); +} + +COMMANDN(complete, addfilecomplete, "sss"); +COMMANDN(listcomplete, addlistcomplete, "ss"); + +void complete(char *s) +{ + if(*s!='/') + { + string t; + s_strcpy(t, s); + s_strcpy(s, "/"); + s_strcat(s, t); + } + if(!s[1]) return; + if(!completesize) { completesize = (int)strlen(s)-1; lastcomplete[0] = '\0'; } + + filesval *f = NULL; + if(completesize) + { + char *end = strchr(s, ' '); + if(end) + { + string command; + s_strncpy(command, s+1, min(size_t(end-s), sizeof(command))); + filesval **hasfiles = completions.access(command); + if(hasfiles) f = *hasfiles; + } + } + + const char *nextcomplete = NULL; + string prefix; + s_strcpy(prefix, "/"); + if(f) // complete using filenames + { + int commandsize = strchr(s, ' ')+1-s; + s_strncpy(prefix, s, min(size_t(commandsize+1), sizeof(prefix))); + if(f->type==FILES_DIR && f->files.empty()) listfiles(f->dir, f->ext, f->files); + loopi(f->files.length()) + { + if(strncmp(f->files[i], s+commandsize, completesize+1-commandsize)==0 && + strcmp(f->files[i], lastcomplete) > 0 && (!nextcomplete || strcmp(f->files[i], nextcomplete) < 0)) + nextcomplete = f->files[i]; + } + } + else // complete using command names + { + extern hashtable *idents; + enumerate(*idents, ident, id, + if(strncmp(id.name, s+1, completesize)==0 && + strcmp(id.name, lastcomplete) > 0 && (!nextcomplete || strcmp(id.name, nextcomplete) < 0)) + nextcomplete = id.name; + ); + } + if(nextcomplete) + { + s_strcpy(s, prefix); + s_strcat(s, nextcomplete); + s_strcpy(lastcomplete, nextcomplete); + } + else lastcomplete[0] = '\0'; +} + +void writecompletions(FILE *f) +{ + enumeratekt(completions, char *, k, filesval *, v, + if(!v) continue; + if(v->type==FILES_LIST) fprintf(f, "listcomplete \"%s\" [%s]\n", k, v->dir); + else fprintf(f, "complete \"%s\" \"%s\" \"%s\"\n", k, v->dir, v->ext ? v->ext : "*"); + ); +} + diff --git a/src/engine/cubeloader.cpp b/src/engine/cubeloader.cpp new file mode 100644 index 0000000..4480724 --- /dev/null +++ b/src/engine/cubeloader.cpp @@ -0,0 +1,364 @@ +#include "pch.h" +#include "engine.h" + +VAR(importcuberemip, 0, 1024, 2048); + +struct cubeloader +{ + enum // block types, order matters! + { + C_SOLID = 0, // entirely solid cube [only specifies wtex] + C_CORNER, // half full corner of a wall + C_FHF, // floor heightfield using neighbour vdelta values + C_CHF, // idem ceiling + C_SPACE, // entirely empty cube + C_SEMISOLID, // generated by mipmapping + C_MAXTYPE + }; + + struct c_sqr + { + uchar type; // one of the above + char floor, ceil; // height, in cubes + uchar wtex, ftex, ctex; // wall/floor/ceil texture ids + uchar vdelta; // vertex delta, used for heightfield cubes + uchar utex; // upper wall tex id + }; + + struct c_persistent_entity // map entity + { + short x, y, z; // cube aligned position + short attr1; + uchar type; // type is one of the above + uchar attr2, attr3, attr4; + }; + + struct c_header // map file format header + { + char head[4]; // "CUBE" + int version; // any >8bit quantity is little endian + int headersize; // sizeof(header) + int sfactor; // in bits + int numents; + char maptitle[128]; + uchar texlists[3][256]; + int waterlevel; + int reserved[15]; + }; + + c_sqr *world; + int ssize; + int x0, x1, y0, y1, z0, z1; + c_sqr *o[4]; + int lastremip; + int progress; + + void create_ent(c_persistent_entity &ce) + { + if(ce.type>=7) ce.type++; // grenade ammo + if(ce.type>=8) ce.type++; // pistol ammo + if(ce.type==16) ce.type = ET_MAPMODEL; + else if(ce.type>=ET_MAPMODEL && ce.type<16) ce.type++; + if(ce.type>=ET_ENVMAP) ce.type++; + if(ce.type>=ET_PARTICLES) ce.type++; + if(ce.type>=ET_SOUND) ce.type++; + if(ce.type>=ET_SPOTLIGHT) ce.type++; + extentity &e = *et->newentity(); + et->getents().add(&e); + e.type = ce.type; + e.spawned = false; + e.inoctanode = false; + e.o = vec(ce.x*4+hdr.worldsize/4, ce.y*4+hdr.worldsize/4, (ce.z+ce.attr3)*4+hdr.worldsize/2); + e.light.color = vec(1, 1, 1); + e.light.dir = vec(0, 0, 1); + e.attr1 = ce.attr1; + e.attr2 = ce.attr2; + if(e.type == ET_MAPMODEL) e.attr3 = e.attr4 = 0; + else + { + e.attr3 = ce.attr3; + e.attr4 = ce.attr4; + } + e.attr5 = 0; + } + + cube &getcube(int x, int y, int z) + { + return lookupcube(x*4+hdr.worldsize/4, y*4+hdr.worldsize/4, z*4+hdr.worldsize/2, 4); + } + + int neighbours(c_sqr &t) + { + o[0] = &t; + o[1] = &t+1; + o[2] = &t+ssize; + o[3] = &t+ssize+1; + int best = 0xFFFF; + loopi(4) if(o[i]->vdeltavdelta; + return best; + } + + void preprocess_cubes() // pull up heighfields to where they don't cross cube boundaries + { + for(;;) + { + bool changed = false; + loop(x, ssize) + { + loop(y, ssize) + { + c_sqr &t = world[x+y*ssize]; + if(t.type==C_FHF || t.type==C_CHF) + { + int bottom = (neighbours(t)&(~3))+4; + loopj(4) if(o[j]->vdelta>bottom) { o[j]->vdelta = bottom; changed = true; } + } + } + } + if(!changed) break; + } + } + + int getfloorceil(c_sqr &s, int &floor, int &ceil) + { + floor = s.floor; + ceil = s.ceil; + int cap = 0; + switch(s.type) + { + case C_SOLID: floor = ceil; break; + case C_FHF: floor -= (cap = neighbours(s)&(~3))/4; break; + case C_CHF: ceil += (cap = neighbours(s)&(~3))/4; break; + } + return cap; + } + + void boundingbox() + { + x0 = y0 = ssize; + x1 = y1 = 0; + z0 = 128; + z1 = -128; + loop(x, ssize) loop(y, ssize) + { + c_sqr &t = world[x+y*ssize]; + if(t.type!=C_SOLID) + { + if(xx1) x1 = x; + if(y>y1) y1 = y; + int floor, ceil; + getfloorceil(t, floor, ceil); + if(floorz1) z1 = ceil; + } + } + } + + void hf(int x, int y, int z, int side, int dir, int cap) + { + cube &c = getcube(x, y, z); + loopi(2) loopj(2) edgeset(cubeedge(c, 2, i, j), side, dir*(o[(j<<1)+i]->vdelta-cap)*2+side*8); + } + + bool cornersolid(int z, c_sqr *s) { return s->type==C_SOLID || zfloor || z>=s->ceil; } + + void createcorner(cube &c, int lstart, int lend, int rstart, int rend) + { + int ledge = edgemake(lstart, lend); + int redge = edgemake(rstart, rend); + cubeedge(c, 1, 0, 0) = ledge; + cubeedge(c, 1, 1, 0) = ledge; + cubeedge(c, 1, 0, 1) = redge; + cubeedge(c, 1, 1, 1) = redge; + } + + void create_cubes() + { + preprocess_cubes(); + boundingbox(); + lastremip = allocnodes; + progress = 0; + for(int x = x0-1; x<=x1+1; x++) for(int y = y0-1; y<=y1+1; y++) + { + c_sqr &s = world[x+y*ssize]; + int floor, ceil, cap = getfloorceil(s, floor, ceil); + for(int z = z0-1; z<=z1+1; z++) + { + cube &c = getcube(x, y, z); + c.texture[O_LEFT] = c.texture[O_RIGHT] = c.texture[O_BACK] = c.texture[O_FRONT] = s.type!=C_SOLID && z=floor && zfloor-1==z && bs->floor-1!=z) { c.texture[O_TOP] = ts->ftex; } + else if (ts->floor-1!=z && bs->floor-1==z) { c.texture[O_TOP] = bs->ftex; } + if (ts->ceil==z && bs->ceil!=z) { c.texture[O_BOTTOM] = ts->ctex; } + else if (ts->ceil!=z && bs->ceil==z) { c.texture[O_BOTTOM] = bs->ctex; } + } + } + } + switch(s.type) + { + case C_FHF: hf(x, y, floor-1, 1, -1, cap); break; + case C_CHF: hf(x, y, ceil, 0, 1, cap); break; + } + if(importcuberemip && (allocnodes - lastremip) * 8 > importcuberemip * 1024) + { + mpremip(true); + lastremip = allocnodes; + } + if((progress++&0x7F)==0) + { + float bar2 = float((y1-y0+2)*(x-x0+1) + y-y0+1) / float((y1-y0+2)*(x1-x0+2)); + s_sprintfd(text2)("%d%%", int(bar2*100)); + show_out_of_renderloop_progress(0, "creating cubes...", bar2, text2); + } + } + } + + void load_cube_world(char *mname) + { + int loadingstart = SDL_GetTicks(); + string pakname, cgzname; + s_sprintf(pakname)("cube/%s", mname); + s_sprintf(cgzname)("packages/%s.cgz", pakname); + gzFile f = opengzfile(path(cgzname), "rb9"); + if(!f) { conoutf(CON_ERROR, "could not read cube map %s", cgzname); return; } + c_header hdr; + gzread(f, &hdr, sizeof(c_header)-sizeof(int)*16); + endianswap(&hdr.version, sizeof(int), 4); + bool mod = false; + if(strncmp(hdr.head, "CUBE", 4)) + { + if(!strncmp(hdr.head, "ACMP", 4)) mod = true; + else + { + conoutf(CON_ERROR, "map %s has malformatted header", cgzname); + gzclose(f); + return; + } + } + else if(hdr.version>5) mod = true; + if(hdr.version>5 && !mod) { conoutf(CON_ERROR, "map %s requires a newer version of the cube 1 importer", cgzname); gzclose(f); return; } + emptymap(12, true); + freeocta(worldroot); + worldroot = newcubes(F_SOLID); + s_sprintfd(cs)("importing %s", cgzname); + computescreen(cs); + if(hdr.version>=4) + { + gzread(f, &hdr.waterlevel, sizeof(int)*16); + endianswap(&hdr.waterlevel, sizeof(int), 16); + } + else + { + hdr.waterlevel = -100000; + } + if(mod) gzseek(f, hdr.numents*sizeof(c_persistent_entity), SEEK_CUR); + else loopi(hdr.numents) + { + c_persistent_entity e; + gzread(f, &e, sizeof(c_persistent_entity)); + endianswap(&e, sizeof(short), 4); + create_ent(e); + } + ssize = 1<type = C_SOLID; + s->wtex = gzgetc(f); + s->vdelta = gzgetc(f); + if(hdr.version<=2) { gzgetc(f); gzgetc(f); } + s->ftex = DEFAULT_FLOOR; + s->ctex = DEFAULT_CEIL; + s->utex = s->wtex; + s->floor = 0; + s->ceil = 16; + break; + } + default: + { + if(type<0 || type>=C_MAXTYPE) + { + s_sprintfd(t)("%d @ %d", type, k); + fatal("while reading map: type out of range: ", t); + } + s->type = type; + s->floor = gzgetc(f); + s->ceil = gzgetc(f); + if(s->floor>=s->ceil) s->floor = s->ceil-1; // for pre 12_13 + s->wtex = gzgetc(f); + s->ftex = gzgetc(f); + s->ctex = gzgetc(f); + if(hdr.version<=2) { gzgetc(f); gzgetc(f); } + s->vdelta = gzgetc(f); + s->utex = (hdr.version>=2) ? gzgetc(f) : s->wtex; + if(hdr.version>=5) gzgetc(f); + s->type = type; + } + } + t = s; + } + gzclose(f); + + string cfgname; + s_sprintf(cfgname)("packages/cube/%s.cfg", mname); + exec("packages/cube/package.cfg"); + exec(path(cfgname)); + create_cubes(); + mpremip(true); + clearlights(); + allchanged(); + loopv(et->getents()) if(et->getents()[i]->type!=ET_LIGHT) dropenttofloor(et->getents()[i]); + entitiesinoctanodes(); + conoutf("read cube map %s (%.1f seconds)", cgzname, (SDL_GetTicks()-loadingstart)/1000.0f); + startmap(pakname); + } +}; + +void importcube(char *name) +{ + if(multiplayer()) return; + cubeloader().load_cube_world(name); +} + +COMMAND(importcube, "s"); diff --git a/src/engine/decal.cpp b/src/engine/decal.cpp new file mode 100644 index 0000000..a6275a6 --- /dev/null +++ b/src/engine/decal.cpp @@ -0,0 +1,541 @@ +#include "pch.h" +#include "engine.h" + +struct decalvert +{ + vec pos; + float u, v; + bvec color; + uchar alpha; +}; + +struct decalinfo +{ + int millis; + bvec color; + ushort startvert, endvert; +}; + +enum +{ + DF_RND4 = 1<<0, + DF_ROTATE = 1<<1, + DF_INVMOD = 1<<2, + DF_OVERBRIGHT = 1<<3, + DF_ADD = 1<<4 +}; + +VARFP(maxdecaltris, 1, 1024, 16384, initdecals()); +VARP(decalfade, 1000, 10000, 60000); +VAR(dbgdec, 0, 0, 1); + +struct decalrenderer +{ + const char *texname; + int flags, fadeintime, fadeouttime, timetolive; + Texture *tex; + decalinfo *decals; + int maxdecals, startdecal, enddecal; + decalvert *verts; + int maxverts, startvert, endvert, availverts; + + decalrenderer(const char *texname, int flags = 0, int fadeintime = 0, int fadeouttime = 1000, int timetolive = -1) + : texname(texname), flags(flags), + fadeintime(fadeintime), fadeouttime(fadeouttime), timetolive(timetolive), + tex(NULL), + decals(NULL), maxdecals(0), startdecal(0), enddecal(0), + verts(NULL), maxverts(0), startvert(0), endvert(0), availverts(0), + decalu(0), decalv(0) + { + } + + void init(int tris) + { + if(decals) + { + DELETEA(decals); + maxdecals = startdecal = enddecal = 0; + } + if(verts) + { + DELETEA(verts); + maxverts = startvert = endvert = availverts = 0; + } + decals = new decalinfo[tris]; + maxdecals = tris; + tex = textureload(texname); + maxverts = tris*3 + 3; + availverts = maxverts - 3; + verts = new decalvert[maxverts]; + } + + int hasdecals() + { + return enddecal < startdecal ? maxdecals - (startdecal - enddecal) : enddecal - startdecal; + } + + void cleardecals() + { + startdecal = enddecal = 0; + startvert = endvert = 0; + availverts = maxverts - 3; + } + + int freedecal() + { + if(startdecal==enddecal) return 0; + + decalinfo &d = decals[startdecal]; + startdecal++; + if(startdecal >= maxdecals) startdecal = 0; + + int removed = d.endvert < d.startvert ? maxverts - (d.startvert - d.endvert) : d.endvert - d.startvert; + startvert = d.endvert; + if(startvert==endvert) startvert = endvert = 0; + availverts += removed; + + return removed; + } + + void fadedecal(decalinfo &d, uchar alpha) + { + bvec color; + if(flags&DF_OVERBRIGHT) + { + if(renderpath!=R_FIXEDFUNCTION || hasTE) color = bvec(128, 128, 128); + else color = bvec(alpha, alpha, alpha); + } + else + { + color = d.color; + if(flags&(DF_ADD|DF_INVMOD)) loopk(3) color[k] = uchar((int(color[k])*int(alpha))>>8); + } + + decalvert *vert = &verts[d.startvert], + *end = &verts[d.endvert < d.startvert ? maxverts : d.endvert]; + while(vert < end) + { + vert->color = color; + vert->alpha = alpha; + vert++; + } + if(d.endvert < d.startvert) + { + vert = verts; + end = &verts[d.endvert]; + while(vert < end) + { + vert->color = color; + vert->alpha = alpha; + vert++; + } + } + } + + void clearfadeddecals() + { + int threshold = lastmillis - (timetolive>=0 ? timetolive : decalfade) - fadeouttime; + decalinfo *d = &decals[startdecal], + *end = &decals[enddecal < startdecal ? maxdecals : enddecal]; + while(d < end && d->millis <= threshold) d++; + if(d >= end && enddecal < startdecal) + { + d = decals; + end = &decals[enddecal]; + while(d < end && d->millis <= threshold) d++; + } + startdecal = d - decals; + if(startdecal!=enddecal) startvert = decals[startdecal].startvert; + else startvert = endvert = 0; + availverts = endvert < startvert ? startvert - endvert - 3 : maxverts - 3 - (endvert - startvert); + } + + void fadeindecals() + { + if(!fadeintime) return; + decalinfo *d = &decals[enddecal], + *end = &decals[enddecal < startdecal ? 0 : startdecal]; + while(d > end) + { + d--; + int fade = lastmillis - d->millis; + if(fade >= fadeintime) return; + fadedecal(*d, (fade<<8)/fadeintime); + } + if(enddecal < startdecal) + { + d = &decals[maxdecals]; + end = &decals[startdecal]; + while(d > end) + { + d--; + int fade = lastmillis - d->millis; + if(fade >= fadeintime) return; + fadedecal(*d, (fade<<8)/fadeintime); + } + } + } + + void fadeoutdecals() + { + decalinfo *d = &decals[startdecal], + *end = &decals[enddecal < startdecal ? maxdecals : enddecal]; + int offset = (timetolive>=0 ? timetolive : decalfade) + fadeouttime - lastmillis; + while(d < end) + { + int fade = d->millis + offset; + if(fade >= fadeouttime) return; + fadedecal(*d, (fade<<8)/fadeouttime); + d++; + } + if(enddecal < startdecal) + { + d = decals; + end = &decals[enddecal]; + while(d < end) + { + int fade = d->millis + offset; + if(fade >= fadeouttime) return; + fadedecal(*d, (fade<<8)/fadeouttime); + d++; + } + } + } + + static void setuprenderstate() + { + enablepolygonoffset(GL_POLYGON_OFFSET_FILL); + + glDepthMask(GL_FALSE); + glEnable(GL_BLEND); + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + } + + static void cleanuprenderstate() + { + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + glDepthMask(GL_TRUE); + glDisable(GL_BLEND); + + disablepolygonoffset(GL_POLYGON_OFFSET_FILL); + } + + void render() + { + if(startvert==endvert) return; + + float oldfogc[4]; + if(flags&(DF_ADD|DF_INVMOD|DF_OVERBRIGHT)) + { + glGetFloatv(GL_FOG_COLOR, oldfogc); + static float zerofog[4] = { 0, 0, 0, 1 }, grayfog[4] = { 0.5f, 0.5f, 0.5f, 1 }; + glFogfv(GL_FOG_COLOR, flags&DF_OVERBRIGHT && (renderpath!=R_FIXEDFUNCTION || hasTE) ? grayfog : zerofog); + } + + if(flags&DF_OVERBRIGHT) + { + if(renderpath!=R_FIXEDFUNCTION) + { + glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); + static Shader *overbrightdecalshader = NULL; + if(!overbrightdecalshader) overbrightdecalshader = lookupshaderbyname("overbrightdecal"); + overbrightdecalshader->set(); + } + else if(hasTE) + { + glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); + setuptmu(0, "T , C @ Ca"); + } + else glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA); + } + else + { + if(flags&DF_INVMOD) glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); + else if(flags&DF_ADD) glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); + else glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + foggedshader->set(); + } + + glBindTexture(GL_TEXTURE_2D, tex->id); + + glVertexPointer(3, GL_FLOAT, sizeof(decalvert), &verts->pos); + glTexCoordPointer(2, GL_FLOAT, sizeof(decalvert), &verts->u); + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(decalvert), &verts->color); + + int count = endvert < startvert ? maxverts - startvert : endvert - startvert; + glDrawArrays(GL_TRIANGLES, startvert, count); + if(endvert < startvert) + { + count += endvert; + glDrawArrays(GL_TRIANGLES, 0, endvert); + } + xtravertsva += count; + + if(flags&(DF_ADD|DF_INVMOD|DF_OVERBRIGHT)) glFogfv(GL_FOG_COLOR, oldfogc); + if(flags&DF_OVERBRIGHT && hasTE) resettmu(0); + } + + decalinfo &newdecal() + { + decalinfo &d = decals[enddecal]; + int next = enddecal + 1; + if(next>=maxdecals) next = 0; + if(next==startdecal) freedecal(); + enddecal = next; + return d; + } + + static int decalclip(const vec *in, int numin, const plane &c, vec *out) + { + int numout = 0; + const vec *n = in; + float idist = c.dist(*n), ndist = idist; + loopi(numin-1) + { + const vec &p = *n; + float pdist = ndist; + ndist = c.dist(*++n); + if(pdist>=0) out[numout++] = p; + if((pdist>0 && ndist<0) || (pdist<0 && ndist>0)) + (out[numout++] = *n).sub(p).mul(pdist / (pdist - ndist)).add(p); + } + if(ndist>=0) out[numout++] = *n; + if((ndist>0 && idist<0) || (ndist<0 && idist>0)) + (out[numout++] = *in).sub(*n).mul(ndist / (ndist - idist)).add(*n); + return numout; + } + + ivec bborigin, bbsize; + vec decalcenter, decalnormal, decaltangent, decalbitangent; + float decalradius, decalu, decalv; + bvec decalcolor; + + void adddecal(const vec ¢er, const vec &dir, float radius, const bvec &color, int info) + { + int isz = int(ceil(radius)); + bborigin = ivec(center).sub(isz); + bbsize = ivec(isz*2, isz*2, isz*2); + + decalcolor = color; + decalcenter = center; + decalradius = radius; + decalnormal = dir; +#if 0 + decaltangent.orthogonal(dir); +#else + decaltangent = vec(dir.z, -dir.x, dir.y); + decaltangent.sub(vec(dir).mul(decaltangent.dot(dir))); +#endif + if(flags&DF_ROTATE) decaltangent.rotate(rnd(360)*RAD, dir); + decaltangent.normalize(); + decalbitangent.cross(decaltangent, dir); + if(flags&DF_RND4) + { + decalu = 0.5f*(info&1); + decalv = 0.5f*((info>>1)&1); + } + + ushort dstart = endvert; + gendecaltris(worldroot, ivec(0, 0, 0), hdr.worldsize>>1); + if(dbgdec) + { + int nverts = endvert < dstart ? endvert + maxverts - dstart : endvert - dstart; + conoutf(CON_DEBUG, "tris = %d, verts = %d, total tris = %d", nverts/3, nverts, (maxverts - 3 - availverts)/3); + } + if(endvert==dstart) return; + + decalinfo &d = newdecal(); + d.color = color; + d.millis = lastmillis; + d.startvert = dstart; + d.endvert = endvert; + } + + void gendecaltris(cube &cu, int orient, vec *v, bool solid) + { + int f[4], faces = 0; + loopk(4) f[k] = solid ? fv[orient][k] : faceverts(cu, orient, k); + vec p(v[f[0]]), surfaces[2]; + if(solid) + { + surfaces[0] = vec(0, 0, 0); + surfaces[0][dimension(orient)] = 2*dimcoord(orient) - 1; + faces = 1 | 4; + } + else + { + vec e(v[f[2]]); + e.sub(p); + surfaces[0].cross(vec(v[f[1]]).sub(p), e); + float mag1 = surfaces[0].squaredlen(); + if(mag1) { surfaces[0].div(sqrtf(mag1)); faces |= 1; } + surfaces[1].cross(e, vec(v[f[3]]).sub(p)); + float mag2 = surfaces[1].squaredlen(); + if(mag2) + { + surfaces[1].div(sqrtf(mag2)); + faces |= (!faces || faceconvexity(cu, orient) ? 2 : 4); + } + } + p.sub(decalcenter); + loopl(2) if(faces&(1< decalradius) continue; + vec pcenter = vec(decalnormal).mul(dist).add(decalcenter); +#else + // travel back along plane normal from the decal center + float dist = n.dot(p); + if(fabs(dist) > decalradius) continue; + vec pcenter = vec(n).mul(dist).add(decalcenter); +#endif + vec ft, fb; + ft.orthogonal(n); + ft.normalize(); + fb.cross(ft, n); + vec pt = vec(ft).mul(ft.dot(decaltangent)).add(vec(fb).mul(fb.dot(decaltangent))).normalize(), + pb = vec(ft).mul(ft.dot(decalbitangent)).add(vec(fb).mul(fb.dot(decalbitangent))).normalize(); + // orthonormalize projected bitangent to prevent streaking + pb.sub(vec(pt).mul(pt.dot(pb))).normalize(); + vec v1[8] = { v[f[0]], v[f[l+1]], v[f[l+2]] }, v2[8]; + int numv = 3; + if(faces&4) { v1[3] = v[f[3]]; numv = 4; } + float ptc = pt.dot(pcenter), pbc = pb.dot(pcenter); + numv = decalclip(v1, numv, plane(pt, decalradius - ptc), v2); + if(numv<3) continue; + numv = decalclip(v2, numv, plane(vec(pt).neg(), decalradius + ptc), v1); + if(numv<3) continue; + numv = decalclip(v1, numv, plane(pb, decalradius - pbc), v2); + if(numv<3) continue; + numv = decalclip(v2, numv, plane(vec(pb).neg(), decalradius + pbc), v1); + if(numv<3) continue; + float tsz = flags&DF_RND4 ? 0.5f : 1.0f, scale = tsz*0.5f/decalradius, + tu = decalu + tsz*0.5f - ptc*scale, tv = decalv + tsz*0.5f - pbc*scale; + pt.mul(scale); pb.mul(scale); + decalvert dv1 = { v1[0], pt.dot(v1[0]) + tu, pb.dot(v1[0]) + tv, decalcolor, 255 }, + dv2 = { v1[1], pt.dot(v1[1]) + tu, pb.dot(v1[1]) + tv, decalcolor, 255 }; + int totalverts = 3*(numv-2); + if(totalverts > maxverts-3) return; + while(availverts < totalverts) + { + if(!freedecal()) return; + } + availverts -= totalverts; + loopk(numv-2) + { + verts[endvert++] = dv1; + verts[endvert++] = dv2; + dv2.pos = v1[k+2]; + dv2.u = pt.dot(v1[k+2]) + tu; + dv2.v = pb.dot(v1[k+2]) + tv; + verts[endvert++] = dv2; + if(endvert>=maxverts) endvert = 0; + } + } + } + + void gendecaltris(cube *cu, const ivec &o, int size, uchar *vismasks = NULL, uchar avoid = 0) + { + loopoctabox(o, size, bborigin, bbsize) + { + ivec co(i, o.x, o.y, o.z, size); + if(cu[i].children) + { + uchar visclip = cu[i].vismask & cu[i].clipmask & ~avoid; + if(visclip) + { + uchar vertused = fvmasks[visclip]; + vec v[8]; + loopj(8) if(vertused&(1<>1, cu[i].vismasks, avoid | visclip); + } + else if(vismasks) + { + uchar vismask = vismasks[i] & ~avoid; + if(!vismask) continue; + uchar vertused = fvmasks[vismask]; + bool solid = cu[i].ext && isclipped(cu[i].ext->material&MATF_VOLUME); + vec v[8]; + loopj(8) if(vertused&(1<material&MATF_VOLUME); + uchar vismask = 0; + loopj(6) if(!(avoid&(1<packages/particles/bullet.png", DF_OVERBRIGHT) +}; + +void initdecals() +{ + loopi(sizeof(decals)/sizeof(decals[0])) decals[i].init(maxdecaltris); +} + +void cleardecals() +{ + loopi(sizeof(decals)/sizeof(decals[0])) decals[i].cleardecals(); +} + +VARNP(decals, showdecals, 0, 1, 1); + +void renderdecals(int time) +{ + bool rendered = false; + loopi(sizeof(decals)/sizeof(decals[0])) + { + decalrenderer &d = decals[i]; + if(time) + { + d.clearfadeddecals(); + d.fadeindecals(); + d.fadeoutdecals(); + } + if(!showdecals || !d.hasdecals()) continue; + if(!rendered) + { + rendered = true; + decalrenderer::setuprenderstate(); + } + d.render(); + } + if(!rendered) return; + decalrenderer::cleanuprenderstate(); +} + +VARP(maxdecaldistance, 1, 512, 10000); + +void adddecal(int type, const vec ¢er, const vec &surface, float radius, const bvec &color, int info) +{ + if(!showdecals || type<0 || (size_t)type>=sizeof(decals)/sizeof(decals[0]) || center.dist(camera1->o) - radius > maxdecaldistance) return; + decalrenderer &d = decals[type]; + d.adddecal(center, surface, radius, color, info); +} + diff --git a/src/engine/dynlight.cpp b/src/engine/dynlight.cpp new file mode 100644 index 0000000..17e0e52 --- /dev/null +++ b/src/engine/dynlight.cpp @@ -0,0 +1,207 @@ +#include "pch.h" +#include "engine.h" + +VARP(maxdynlights, 0, min(3, MAXDYNLIGHTS), MAXDYNLIGHTS); +VARP(dynlightdist, 0, 1024, 10000); + +struct dynlight +{ + vec o; + float radius, initradius, curradius, dist; + vec color, initcolor, curcolor; + int fade, peak, expire, flags; + + void calcradius() + { + if(fade + peak) + { + int remaining = expire - lastmillis; + if(flags&DL_EXPAND) + curradius = initradius + (radius - initradius) * (1.0f - remaining/float(fade + peak)); + else if(remaining > fade) + curradius = initradius + (radius - initradius) * (1.0f - float(remaining - fade)/peak); + else if(flags&DL_SHRINK) + curradius = (radius*remaining)/fade; + else curradius = radius; + } + else curradius = radius; + } + + void calccolor() + { + if(flags&DL_FLASH || !peak) curcolor = color; + else + { + int peaking = expire - lastmillis - fade; + if(peaking <= 0) curcolor = color; + else curcolor.lerp(initcolor, color, 1.0f - float(peaking)/peak); + } + + float intensity = 1.0f; + if(!(flags&DL_FLASH) && fade) + { + int fading = expire - lastmillis; + if(fading < fade) intensity = float(fading)/fade; + } + curcolor.mul(intensity); + // KLUGE: this prevents nvidia drivers from trying to recompile dynlight fragment programs + loopk(3) if(fmod(curcolor[k], 1.0f/256) < 0.001f) curcolor[k] += 0.001f; + } +}; + +vector dynlights; +vector closedynlights; + +void adddynlight(const vec &o, float radius, const vec &color, int fade, int peak, int flags, float initradius, const vec &initcolor) +{ + if(renderpath==R_FIXEDFUNCTION || o.dist(camera1->o) > dynlightdist) return; + + int insert = 0, expire = fade + peak + lastmillis; + loopvrev(dynlights) if(expire>=dynlights[i].expire) { insert = i+1; break; } + dynlight d; + d.o = o; + d.radius = radius; + d.initradius = initradius; + d.color = color; + d.initcolor = initcolor; + d.fade = fade; + d.peak = peak; + d.expire = expire; + d.flags = flags; + dynlights.insert(insert, d); +} + +void cleardynlights() +{ + int faded = -1; + loopv(dynlights) if(lastmillis0) dynlights.remove(0, faded); +} + +void updatedynlights() +{ + cleardynlights(); + cl->adddynlights(); + + loopv(dynlights) + { + dynlight &d = dynlights[i]; + d.calcradius(); + d.calccolor(); + } +} + +int finddynlights() +{ + closedynlights.setsizenodelete(0); + if(!maxdynlights) return 0; + physent e; + e.type = ENT_CAMERA; + loopvj(dynlights) + { + dynlight &d = dynlights[j]; + if(d.curradius <= 0) continue; + d.dist = camera1->o.dist(d.o) - d.curradius; + if(d.dist > dynlightdist || isvisiblesphere(d.curradius, d.o) >= VFC_FOGGED || pvsoccluded(d.o, 2*int(d.curradius+1))) + continue; + + e.o = d.o; + e.radius = e.eyeheight = e.aboveeye = d.curradius; + if(collide(&e, vec(0, 0, 0), 0, false)) continue; + + int insert = 0; + loopvrev(closedynlights) if(d.dist >= closedynlights[i]->dist) { insert = i+1; break; } + closedynlights.insert(insert, &d); + if(closedynlights.length() >= DYNLIGHTMASK) break; + } + return closedynlights.length(); +} + +void dynlightreaching(const vec &target, vec &color, vec &dir) +{ + vec dyncolor(0, 0, 0);//, dyndir(0, 0, 0); + loopv(dynlights) + { + dynlight &d = dynlights[i]; + if(d.curradius<=0) continue; + + vec ray(d.o); + ray.sub(target); + float mag = ray.magnitude(); + if(mag >= d.curradius) continue; + + vec color = d.curcolor; + color.mul(1 - mag/d.curradius); + dyncolor.add(color); + //dyndir.add(ray.mul(intensity/mag)); + } +#if 0 + if(!dyndir.iszero()) + { + dyndir.normalize(); + float x = dyncolor.magnitude(), y = color.magnitude(); + if(x+y>0) + { + dir.mul(x); + dyndir.mul(y); + dir.add(dyndir).div(x+y); + if(dir.iszero()) dir = vec(0, 0, 1); + else dir.normalize(); + } + } +#endif + color.add(dyncolor); +} + +void calcdynlightmask(vtxarray *va) +{ + uint mask = 0; + int offset = 0; + loopv(closedynlights) + { + dynlight &d = *closedynlights[i]; + if(d.o.dist_to_bb(va->geommin, va->geommax) >= d.curradius) continue; + + mask |= (i+1)<= maxdynlights*DYNLIGHTBITS) break; + } + va->dynlightmask = mask; +} + +int setdynlights(vtxarray *va, const ivec &vaorigin) +{ + if(closedynlights.empty() || !va->dynlightmask) return 0; + + static string vertexparams[MAXDYNLIGHTS] = { "" }, pixelparams[MAXDYNLIGHTS] = { "" }; + if(!*vertexparams[0]) loopi(MAXDYNLIGHTS) + { + s_sprintf(vertexparams[i])("dynlight%dpos", i); + s_sprintf(pixelparams[i])("dynlight%dcolor", i); + } + + int index = 0; + float scale0 = 1; + vec origin0(0, 0, 0); + for(uint mask = va->dynlightmask; mask; mask >>= DYNLIGHTBITS, index++) + { + dynlight &d = *closedynlights[(mask&DYNLIGHTMASK)-1]; + + float scale = 1.0f/d.curradius; + vec origin = vaorigin.tovec().sub(d.o).mul(scale); + setenvparamf(vertexparams[index], SHPARAM_VERTEX, 10+index, origin.x, origin.y, origin.z, scale/(1< texmru; +extern int xtraverts, xtravertsva; +extern int curtexnum; +extern const ivec cubecoords[8]; +extern const ushort fv[6][4]; +extern const uchar fvmasks[64]; +extern const uchar faceedgesidx[6][4]; +extern bool inbetweenframes; + +extern int curtime; // current frame time +extern int lastmillis; // last time +extern int totalmillis; // total elapsed time +extern SDL_Surface *screen; +extern int zpass, glowpass; + +extern vector entgroup; + +// rendertext +struct font +{ + struct charinfo + { + short x, y, w, h; + }; + + char *name; + Texture *tex; + vector chars; + short defaultw, defaulth; + short offsetx, offsety, offsetw, offseth; +}; + +#define FONTH (curfont->defaulth) +#define FONTW (curfont->defaultw) +#define MINRESW 640 +#define MINRESH 480 + +extern font *curfont; + +// texture +extern int hwtexsize, hwcubetexsize, hwmaxaniso; + +extern Texture *textureload(const char *name, int clamp = 0, bool mipit = true, bool msg = true); +extern void loadalphamask(Texture *t); +extern GLuint cubemapfromsky(int size); +extern Texture *cubemapload(const char *name, bool mipit = true, bool msg = true); +extern void drawcubemap(int size, const vec &o, float yaw, float pitch, const cubemapside &side); +extern Slot &lookuptexture(int tex, bool load = true); +extern void loadshaders(); +extern Shader *lookupshader(int slot); +extern void createtexture(int tnum, int w, int h, void *pixels, int clamp, bool mipit, GLenum component = GL_RGB, GLenum target = GL_TEXTURE_2D, bool compress = false, bool filter = true); +extern void renderfullscreenshader(int w, int h); +extern void initenvmaps(); +extern void genenvmaps(); +extern ushort closestenvmap(const vec &o); +extern ushort closestenvmap(int orient, int x, int y, int z, int size); +extern GLuint lookupenvmap(ushort emid); +extern GLuint lookupenvmap(Slot &slot); +extern bool reloadtexture(Texture &tex); +extern bool reloadtexture(const char *name); + +// shadowmap + +extern int shadowmap; +extern bool shadowmapping; + +extern bool isshadowmapcaster(const vec &o, float rad); +extern bool addshadowmapcaster(const vec &o, float xyrad, float zrad); +extern bool isshadowmapreceiver(vtxarray *va); +extern void rendershadowmap(); +extern void pushshadowmap(); +extern void popshadowmap(); +extern void adjustshadowmatrix(const ivec &o, float scale); +extern void rendershadowmapreceivers(); +extern void guessshadowdir(); + +// pvs +extern void clearpvs(); +extern bool pvsoccluded(const ivec &bborigin, const ivec &bbsize); +extern bool waterpvsoccluded(int height); +extern void setviewcell(const vec &p); +extern void savepvs(gzFile f); +extern void loadpvs(gzFile f); +extern int getnumviewcells(); + +static inline bool pvsoccluded(const ivec &bborigin, int size) +{ + return pvsoccluded(bborigin, ivec(size, size, size)); +} + +// rendergl +extern bool hasVBO, hasDRE, hasOQ, hasTR, hasFBO, hasDS, hasTF, hasBE, hasCM, hasNP2, hasTC, hasTE, hasMT, hasD3, hasstencil, hasAF, hasVP2, hasVP3, hasPP, hasMDA, hasTE3, hasTE4, hasVP, hasFP, hasGLSL, hasGM, hasNVFB; + +extern bool envmapping, renderedgame; +extern GLfloat mvmatrix[16], projmatrix[16], mvpmatrix[16], invmvmatrix[16]; + +extern void gl_checkextensions(); +extern void gl_init(int w, int h, int bpp, int depth, int fsaa); +extern void cleangl(); +extern void rendergame(); +extern void invalidatepostfx(); +extern void gl_drawframe(int w, int h); +extern void enablepolygonoffset(GLenum type); +extern void disablepolygonoffset(GLenum type); +extern void setfogplane(const plane &p, bool flush = false); +extern void setfogplane(float scale = 0, float z = 0, bool flush = false, float fadescale = 0, float fadeoffset = 0); +extern void findorientation(); +extern void writecrosshairs(FILE *f); + +// renderextras +extern void render3dbox(vec &o, float tofloor, float toceil, float xradius, float yradius = 0); + +// octa +extern cube *newcubes(uint face = F_EMPTY); +extern cubeext *newcubeext(cube &c); +extern void getcubevector(cube &c, int d, int x, int y, int z, ivec &p); +extern void setcubevector(cube &c, int d, int x, int y, int z, ivec &p); +extern int familysize(cube &c); +extern void freeocta(cube *c); +extern void discardchildren(cube &c); +extern void optiface(uchar *p, cube &c); +extern void validatec(cube *c, int size); +extern bool isvalidcube(cube &c); +extern cube &lookupcube(int tx, int ty, int tz, int tsize = 0); +extern cube &neighbourcube(int x, int y, int z, int size, int rsize, int orient); +extern int lookupmaterial(const vec &o); +extern void newclipplanes(cube &c); +extern void freeclipplanes(cube &c); +extern void forcemip(cube &c); +extern bool subdividecube(cube &c, bool fullcheck=true, bool brighten=true); +extern void converttovectorworld(); +extern int faceverts(cube &c, int orient, int vert); +extern int faceconvexity(cube &c, int orient); +extern void calcvert(cube &c, int x, int y, int z, int size, vvec &vert, int i, bool solid = false); +extern void calcvert(cube &c, int x, int y, int z, int size, vec &vert, int i, bool solid = false); +extern int calcverts(cube &c, int x, int y, int z, int size, vvec *verts, bool *usefaces); +extern uint faceedges(cube &c, int orient); +extern bool collapsedface(uint cfe); +extern bool touchingface(cube &c, int orient); +extern bool flataxisface(cube &c, int orient); +extern int genclipplane(cube &c, int i, vec *v, plane *clip); +extern void genclipplanes(cube &c, int x, int y, int z, int size, clipplanes &p); +extern bool visibleface(cube &c, int orient, int x, int y, int z, int size, uchar mat = MAT_AIR, uchar nmat = MAT_AIR, uchar matmask = MATF_VOLUME); +extern int visibleorient(cube &c, int orient); +extern bool threeplaneintersect(plane &pl1, plane &pl2, plane &pl3, vec &dest); +extern void freemergeinfo(cube &c); +extern void genmergedverts(cube &cu, int orient, const ivec &co, int size, const mergeinfo &m, vvec *vv, plane *p = NULL); +extern int calcmergedsize(int orient, const ivec &co, int size, const mergeinfo &m, const vvec *vv); +extern void invalidatemerges(cube &c); +extern void calcmerges(); + +struct cubeface : mergeinfo +{ + cube *c; +}; + +extern int mergefaces(int orient, cubeface *m, int sz); +extern void mincubeface(cube &cu, int orient, const ivec &o, int size, const mergeinfo &orig, mergeinfo &cf); + +static inline uchar octantrectangleoverlap(const ivec &c, int size, const ivec &o, const ivec &s) +{ + uchar p = 0xFF; // bitmask of possible collisions with octants. 0 bit = 0 octant, etc + ivec v(c); + v.add(size); + if(v.z <= o.z) p &= 0xF0; // not in a -ve Z octant + if(v.z >= o.z+s.z) p &= 0x0F; // not in a +ve Z octant + if(v.y <= o.y) p &= 0xCC; // not in a -ve Y octant + if(v.y >= o.y+s.y) p &= 0x33; // etc.. + if(v.x <= o.x) p &= 0xAA; + if(v.x >= o.x+s.x) p &= 0x55; + return p; +} + +static inline bool insideworld(const vec &o) +{ + return o.x>=0 && o.x=0 && o.y=0 && o.zo, int scale = 0, const ivec &origin = ivec(0, 0, 0)); + +#define startquery(query) { glBeginQuery_(GL_SAMPLES_PASSED_ARB, ((occludequery *)(query))->id); } +#define endquery(query) \ + { \ + glEndQuery_(GL_SAMPLES_PASSED_ARB); \ + extern int ati_oq_bug; \ + if(ati_oq_bug) glFlush(); \ + } + +// dynlight + +extern void updatedynlights(); +extern int finddynlights(); +extern void calcdynlightmask(vtxarray *va); +extern int setdynlights(vtxarray *va, const ivec &vaorigin); + +// material + +extern int showmat; + +extern int findmaterial(const char *name); +extern void genmatsurfs(cube &c, int cx, int cy, int cz, int size, vector &matsurfs, uchar &vismask, uchar &clipmask); +extern void rendermatsurfs(materialsurface *matbuf, int matsurfs); +extern void rendermatgrid(materialsurface *matbuf, int matsurfs); +extern int optimizematsurfs(materialsurface *matbuf, int matsurfs); +extern void setupmaterials(int start = 0, int len = 0); +extern void rendermaterials(); +extern void drawmaterial(int orient, int x, int y, int z, int csize, int rsize, float offset); +extern int visiblematerial(cube &c, int orient, int x, int y, int z, int size, uchar matmask = MATF_VOLUME); + +// water +extern int refracting; +extern bool reflecting, fading, fogging; +extern float reflectz; +extern int reflectdist, vertwater, refractfog, waterrefract, waterreflect, waterfade, caustics, waterfallrefract, waterfog, lavafog; + +extern void cleanreflections(); +extern void queryreflections(); +extern void drawreflections(); +extern void renderwater(); +extern void renderlava(materialsurface &m, Texture *tex, float scale); +extern void getwatercolour(uchar *wcol); +extern void getwaterfallcolour(uchar *fcol); +extern void getlavacolour(uchar *lcol); + +// glare +extern bool glaring; + +extern void drawglaretex(); +extern void addglare(); + +// depthfx +extern bool depthfxing; + +extern void drawdepthfxtex(); + +// server +extern vector gameargs; + +extern void initserver(bool dedicated); +extern void cleanupserver(); +extern void serverslice(uint timeout); + +extern uchar *retrieveservers(uchar *buf, int buflen); +extern void localclienttoserver(int chan, ENetPacket *); +extern void localconnect(); +extern bool serveroption(char *opt); + +// serverbrowser +extern bool resolverwait(const char *name, ENetAddress *address); +extern int connectwithtimeout(ENetSocket sock, const char *hostname, ENetAddress &address); +extern void addserver(char *servername); +extern char *getservername(int n); +extern void writeservercfg(); + +// client +extern void localdisconnect(); +extern void localservertoclient(int chan, uchar *buf, int len); +extern void connects(char *servername); +extern void abortconnect(); +extern void clientkeepalive(); + +// command +extern bool overrideidents, persistidents; + +extern void explodelist(const char *s, vector &elems); + +extern void clearoverrides(); +extern void writecfg(); + +extern void checksleep(int millis); +extern void clearsleep(bool clearoverrides = true); + +// console +extern void writebinds(FILE *f); +extern void writecompletions(FILE *f); + +// main +enum +{ + NOT_INITING = 0, + INIT_LOAD, + INIT_RESET +}; +enum +{ + CHANGE_GFX = 1<<0, + CHANGE_SOUND = 1<<1 +}; +extern bool initwarning(const char *desc, int level = INIT_RESET, int type = CHANGE_GFX); + +extern void pushevent(const SDL_Event &e); +extern bool interceptkey(int sym); +extern void computescreen(const char *text = NULL, Texture *t = NULL, const char *overlaytext = NULL); +extern void show_out_of_renderloop_progress(float bar1, const char *text1, float bar2 = 0, const char *text2 = NULL, GLuint tex = 0); + +// menu +extern void menuprocess(); +extern void addchange(const char *desc, int type); +extern void clearchanges(int type); + +// physics +extern void mousemove(int dx, int dy); +extern bool pointincube(const clipplanes &p, const vec &v); +extern bool overlapsdynent(const vec &o, float radius); +extern void rotatebb(vec ¢er, vec &radius, int yaw); +extern float shadowray(const vec &o, const vec &ray, float radius, int mode, extentity *t = NULL); + +// world +enum +{ + TRIG_COLLIDE = 1<<0, + TRIG_TOGGLE = 1<<1, + TRIG_ONCE = 0<<2, + TRIG_MANY = 1<<2, + TRIG_DISAPPEAR = 1<<3, + TRIG_AUTO_RESET = 1<<4, + TRIG_RUMBLE = 1<<5, + TRIG_LOCKED = 1<<6, +}; + +#define NUMTRIGGERTYPES 16 + +extern int triggertypes[NUMTRIGGERTYPES]; + +#define checktriggertype(type, flag) (triggertypes[(type) & (NUMTRIGGERTYPES-1)] & (flag)) + +extern void entitiesinoctanodes(); +extern void attachentities(); +extern void freeoctaentities(cube &c); +extern bool pointinsel(selinfo &sel, vec &o); + +extern void resetmap(); +extern void startmap(const char *name); + +// rendermodel +struct mapmodelinfo { string name; model *m; }; + +extern void findanims(const char *pattern, vector &anims); +extern void loadskin(const char *dir, const char *altdir, Texture *&skin, Texture *&masks); +extern mapmodelinfo &getmminfo(int i); +extern void startmodelquery(occludequery *query); +extern void endmodelquery(); + +// renderparticles +extern void particleinit(); +extern void clearparticles(); +extern void entity_particles(); + +// decal +extern void initdecals(); +extern void cleardecals(); +extern void renderdecals(int time); + +// rendersky +extern int explicitsky; +extern double skyarea; + +extern void drawskybox(int farplane, bool limited); +extern bool limitsky(); + +// 3dgui +extern void g3d_render(); +extern bool g3d_windowhit(bool on, bool act); +extern void g3d_mainmenu(); + +// sound +extern void checkmapsounds(); +extern void clearmapsounds(); +extern void updatevol(); + +extern void initmumble(); +extern void closemumble(); +extern void updatemumble(); + +// grass +extern void rendergrass(); + diff --git a/src/engine/explosion.h b/src/engine/explosion.h new file mode 100644 index 0000000..883d4e4 --- /dev/null +++ b/src/engine/explosion.h @@ -0,0 +1,768 @@ +// eye space depth texture for soft particles, done at low res then blurred to prevent ugly jaggies +VARP(depthfxfpscale, 1, 1<<12, 1<<16); +VARP(depthfxscale, 1, 1<<6, 1<<8); +VARP(depthfxblend, 1, 16, 64); +VAR(depthfxmargin, 0, 16, 64); +VAR(depthfxbias, 0, 1, 64); + +extern void cleanupdepthfx(); +VARFP(fpdepthfx, 0, 0, 1, cleanupdepthfx()); +VARFP(depthfxprecision, 0, 0, 1, cleanupdepthfx()); +VARP(depthfxemuprecision, 0, 1, 1); +VARFP(depthfxsize, 6, 7, 12, cleanupdepthfx()); +VARP(depthfx, 0, 1, 1); +VARFP(depthfxrect, 0, 0, 1, cleanupdepthfx()); +VARFP(depthfxfilter, 0, 1, 1, cleanupdepthfx()); +VARP(blurdepthfx, 0, 1, 7); +VARP(blurdepthfxsigma, 1, 50, 200); +VAR(depthfxscissor, 0, 2, 2); +VAR(debugdepthfx, 0, 0, 1); + +#define MAXDFXRANGES 4 + +void *depthfxowners[MAXDFXRANGES]; +float depthfxranges[MAXDFXRANGES]; +int numdepthfxranges = 0; +vec depthfxmin(1e16f, 1e16f, 1e16f), depthfxmax(1e16f, 1e16f, 1e16f); + +static struct depthfxtexture : rendertarget +{ + const GLenum *colorformats() const + { + static const GLenum colorfmts[] = { GL_FLOAT_RG16_NV, GL_RGB16F_ARB, GL_RGB16, GL_RGBA, GL_RGBA8, GL_RGB, GL_RGB8, GL_FALSE }; + return &colorfmts[hasTF && hasFBO ? (fpdepthfx ? (hasNVFB && texrect() && !filter() ? 0 : 1) : (depthfxprecision ? 2 : 3)) : 3]; + } + + float eyedepth(const vec &p) const + { + return max(-(p.x*mvmatrix[2] + p.y*mvmatrix[6] + p.z*mvmatrix[10] + mvmatrix[14]), 0.0f); + } + + void addscissorvert(const vec &v, float &sx1, float &sy1, float &sx2, float &sy2) + { + float w = v.x*mvpmatrix[3] + v.y*mvpmatrix[7] + v.z*mvpmatrix[11] + mvpmatrix[15], + x = (v.x*mvpmatrix[0] + v.y*mvpmatrix[4] + v.z*mvpmatrix[8] + mvpmatrix[12]) / w, + y = (v.x*mvpmatrix[1] + v.y*mvpmatrix[5] + v.z*mvpmatrix[9] + mvpmatrix[13]) / w; + sx1 = min(sx1, x); + sy1 = min(sy1, y); + sx2 = max(sx2, x); + sy2 = max(sy2, y); + } + + bool addscissorbox(const vec ¢er, float size) + { + extern float fovy, aspect; + vec e(center.x*mvmatrix[0] + center.y*mvmatrix[4] + center.z*mvmatrix[8] + mvmatrix[12], + center.x*mvmatrix[1] + center.y*mvmatrix[5] + center.z*mvmatrix[9] + mvmatrix[13], + center.x*mvmatrix[2] + center.y*mvmatrix[6] + center.z*mvmatrix[10] + mvmatrix[14]); + float zz = e.z*e.z, xx = e.x*e.x, yy = e.y*e.y, rr = size*size, + dx = zz*(xx + zz) - rr*zz, dy = zz*(yy + zz) - rr*zz, + focaldist = 1.0f/tan(fovy*0.5f*RAD), + left = -1, right = 1, bottom = -1, top = 1; + #define CHECKPLANE(c, dir, focaldist, low, high) \ + do { \ + float nc = (size*e.c dir drt)/(c##c + zz), \ + nz = (size - nc*e.c)/e.z, \ + pz = (c##c + zz - rr)/(e.z - nz/nc*e.c); \ + if(pz < 0) \ + { \ + float c = nz*(focaldist)/nc, \ + pc = -pz*nz/nc; \ + if(pc < e.c) low = c; \ + else if(pc > e.c) high = c; \ + } \ + } while(0) + if(dx > 0) + { + float drt = sqrt(dx); + CHECKPLANE(x, -, focaldist/aspect, left, right); + CHECKPLANE(x, +, focaldist/aspect, left, right); + } + if(dy > 0) + { + float drt = sqrt(dy); + CHECKPLANE(y, -, focaldist, bottom, top); + CHECKPLANE(y, +, focaldist, bottom, top); + } + return addblurtiles(left, bottom, right, top); + } + + bool addscissorbox(const vec &bbmin, const vec &bbmax) + { + float sx1 = 1, sy1 = 1, sx2 = -1, sy2 = -1; + loopi(8) + { + vec v(i&1 ? bbmax.x : bbmin.x, i&2 ? bbmax.y : bbmin.y, i&4 ? bbmax.z : bbmin.z); + addscissorvert(v, sx1, sy1, sx2, sy2); + } + return addblurtiles(sx1, sy1, sx2, sy2); + } + + bool screenview() const { return depthfxrect!=0; } + bool texrect() const { return depthfxrect && hasTR; } + bool filter() const { return depthfxfilter!=0; } + bool highprecision() const { return colorfmt==GL_FLOAT_RG16_NV || colorfmt==GL_RGB16F_ARB || colorfmt==GL_RGB16; } + bool emulatehighprecision() const { return depthfxemuprecision && !depthfxfilter; } + + bool shouldrender() + { + extern void finddepthfxranges(); + finddepthfxranges(); + return (numdepthfxranges && scissorx1 < scissorx2 && scissory1 < scissory2) || debugdepthfx; + } + + bool dorender() + { + glClearColor(1, 1, 1, 1); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + depthfxing = true; + refracting = -1; + + extern void renderdepthobstacles(const vec &bbmin, const vec &bbmax, float scale, float *ranges, int numranges); + float scale = depthfxscale; + float *ranges = depthfxranges; + int numranges = numdepthfxranges; + if(highprecision()) + { + scale = depthfxfpscale; + ranges = NULL; + numranges = 0; + } + else if(emulatehighprecision()) + { + scale = depthfxfpscale; + ranges = NULL; + numranges = -3; + } + renderdepthobstacles(depthfxmin, depthfxmax, scale, ranges, numranges); + + refracting = 0; + depthfxing = false; + + return numdepthfxranges > 0; + } + + void dodebug(int w, int h) + { + if(numdepthfxranges > 0) + { + glColor3f(0, 1, 0); + debugscissor(w, h, true); + glColor3f(0, 0, 1); + debugblurtiles(w, h, true); + glColor3f(1, 1, 1); + } + } +} depthfxtex; + +void cleanupdepthfx() +{ + depthfxtex.cleanup(true); +} + +void viewdepthfxtex() +{ + if(!depthfx) return; + depthfxtex.debug(); +} + +bool depthfxing = false; + +void drawdepthfxtex() +{ + if(!depthfx || renderpath==R_FIXEDFUNCTION) return; + + // Apple/ATI bug - fixed-function fog state can force software fallback even when fragment program is enabled + glDisable(GL_FOG); + depthfxtex.render(1<=2) + { + if(!expmodtex[0]) expmodtex[0] = createexpmodtex(64, 0); + if(!expmodtex[1]) expmodtex[1] = createexpmodtex(64, 0.25f); + lastexpmodtex = 0; + } + + if(renderpath!=R_FIXEDFUNCTION) + { + if(glaring) + { + if(explosion2d) SETSHADER(explosion2dglare); else SETSHADER(explosion3dglare); + } + else if(!reflecting && !refracting && depthfx && depthfxtex.rendertex && numdepthfxranges>0) + { + if(depthfxtex.target==GL_TEXTURE_RECTANGLE_ARB) + { + if(!depthfxtex.highprecision()) + { + if(explosion2d) SETSHADER(explosion2dsoft8rect); else SETSHADER(explosion3dsoft8rect); + } + else if(explosion2d) SETSHADER(explosion2dsoftrect); else SETSHADER(explosion3dsoftrect); + + setlocalparamf("depthfxview", SHPARAM_VERTEX, 6, 0.5f*depthfxtex.vieww, 0.5f*depthfxtex.viewh); + } + else + { + if(!depthfxtex.highprecision()) + { + if(explosion2d) SETSHADER(explosion2dsoft8); else SETSHADER(explosion3dsoft8); + } + else if(explosion2d) SETSHADER(explosion2dsoft); else SETSHADER(explosion3dsoft); + + setlocalparamf("depthfxview", SHPARAM_VERTEX, 6, 0.5f*float(depthfxtex.vieww)/depthfxtex.texw, 0.5f*float(depthfxtex.viewh)/depthfxtex.texh); + } + + glActiveTexture_(GL_TEXTURE2_ARB); + glBindTexture(depthfxtex.target, depthfxtex.rendertex); + glActiveTexture_(GL_TEXTURE0_ARB); + } + else if(explosion2d) SETSHADER(explosion2d); else SETSHADER(explosion3d); + } + + if(renderpath==R_FIXEDFUNCTION || explosion2d) + { + if(!hemiverts && !hemivbuf) inithemisphere(5, 2); + if(renderpath==R_FIXEDFUNCTION) animateexplosion(); + if(hasVBO) + { + if(renderpath!=R_FIXEDFUNCTION) glBindBuffer_(GL_ARRAY_BUFFER_ARB, hemivbuf); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, hemiebuf); + } + + expvert *verts = renderpath==R_FIXEDFUNCTION ? (hasVBO ? 0 : expverts) : (expvert *)hemiverts; + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, renderpath==R_FIXEDFUNCTION ? sizeof(expvert) : sizeof(vec), verts); + + if(renderpath==R_FIXEDFUNCTION) + { + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glTexCoordPointer(2, GL_FLOAT, sizeof(expvert), &verts->u); + + if(maxtmus>=2) + { + setuptmu(0, "C * T", "= Ca"); + + glActiveTexture_(GL_TEXTURE1_ARB); + glClientActiveTexture_(GL_TEXTURE1_ARB); + + glEnable(GL_TEXTURE_2D); + setuptmu(1, "P * Ta x 4", "Pa * Ta x 4"); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glTexCoordPointer(2, GL_FLOAT, sizeof(expvert), &verts->s); + + glActiveTexture_(GL_TEXTURE0_ARB); + glClientActiveTexture_(GL_TEXTURE0_ARB); + } + } + } + else + { + if(!sphereverts && !spherevbuf) initsphere(12, 6); + + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, spherevbuf); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, sphereebuf); + } + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glVertexPointer(3, GL_FLOAT, sizeof(spherevert), &sphereverts->pos); + glTexCoordPointer(2, GL_FLOAT, sizeof(spherevert), &sphereverts->s); + } +} + +static void drawexpverts(int numverts, int numindices, GLushort *indices) +{ + if(hasDRE) glDrawRangeElements_(GL_TRIANGLES, 0, numverts-1, numindices, GL_UNSIGNED_SHORT, indices); + else glDrawElements(GL_TRIANGLES, numindices, GL_UNSIGNED_SHORT, indices); + xtraverts += numindices; + glde++; +} + +static void drawexplosion(bool inside, uchar r, uchar g, uchar b, uchar a) +{ + if((renderpath!=R_FIXEDFUNCTION || maxtmus>=2) && lastexpmodtex != expmodtex[inside ? 1 : 0]) + { + glActiveTexture_(GL_TEXTURE1_ARB); + lastexpmodtex = expmodtex[inside ? 1 :0]; + glBindTexture(GL_TEXTURE_2D, lastexpmodtex); + glActiveTexture_(GL_TEXTURE0_ARB); + } + int passes = !reflecting && !refracting && inside ? 2 : 1; + if(renderpath!=R_FIXEDFUNCTION && !explosion2d) + { + if(inside) glScalef(1, 1, -1); + loopi(passes) + { + glColor4ub(r, g, b, i ? a/2 : a); + if(i) glDepthFunc(GL_GEQUAL); + drawexpverts(spherenumverts, spherenumindices, sphereindices); + if(i) glDepthFunc(GL_LESS); + } + return; + } + loopi(passes) + { + glColor4ub(r, g, b, i ? a/2 : a); + if(i) + { + glScalef(1, 1, -1); + glDepthFunc(GL_GEQUAL); + } + if(inside) + { + if(passes >= 2) + { + glCullFace(GL_BACK); + drawexpverts(heminumverts, heminumindices, hemiindices); + glCullFace(GL_FRONT); + } + glScalef(1, 1, -1); + } + drawexpverts(heminumverts, heminumindices, hemiindices); + if(i) glDepthFunc(GL_LESS); + } +} + +static void cleanupexplosion() +{ + glDisableClientState(GL_VERTEX_ARRAY); + if(renderpath==R_FIXEDFUNCTION) + { + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + if(maxtmus>=2) + { + resettmu(0); + + glActiveTexture_(GL_TEXTURE1_ARB); + glClientActiveTexture_(GL_TEXTURE1_ARB); + + glDisable(GL_TEXTURE_2D); + resettmu(1); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + glActiveTexture_(GL_TEXTURE0_ARB); + glClientActiveTexture_(GL_TEXTURE0_ARB); + } + } + else + { + if(explosion2d) glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + if(fogging) setfogplane(1, reflectz); + } + + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } +} + +static void deleteexplosions() +{ + loopi(2) if(expmodtex[i]) { glDeleteTextures(1, &expmodtex[i]); expmodtex[i] = 0; } + if(hemivbuf) { glDeleteBuffers_(1, &hemivbuf); hemivbuf = 0; } + if(hemiebuf) { glDeleteBuffers_(1, &hemiebuf); hemiebuf = 0; } + DELETEA(hemiverts); + DELETEA(hemiindices); + if(expvbuf) { glDeleteBuffers_(1, &expvbuf); expvbuf = 0; } + DELETEA(expverts); + if(spherevbuf) { glDeleteBuffers_(1, &spherevbuf); spherevbuf = 0; } + if(sphereebuf) { glDeleteBuffers_(1, &sphereebuf); sphereebuf = 0; } + DELETEA(sphereverts); + DELETEA(sphereindices); +} + +static const float WOBBLE = 1.25f; + +struct fireballrenderer : listrenderer +{ + fireballrenderer(int type) + : listrenderer("packages/particles/explosion.jpg", type, 0, 0) + {} + + void startrender() + { + setupexplosion(); + } + + void endrender() + { + cleanupexplosion(); + particleshader->set(); + } + + void cleanup() + { + deleteexplosions(); + } + + int finddepthfxranges(void **owners, float *ranges, int maxranges, vec &bbmin, vec &bbmax) + { + physent e; + e.type = ENT_CAMERA; + + int numranges = 0; + for(listparticle *p = list; p; p = p->next) + { + int ts = p->fade <= 5 ? 1 : lastmillis-p->millis; + float pmax = p->val, + size = p->fade ? float(ts)/p->fade : 1, + psize = (p->size + pmax * size)*WOBBLE; + if(2*(p->size + pmax)*WOBBLE < depthfxblend || + (!depthfxtex.highprecision() && !depthfxtex.emulatehighprecision() && psize > depthfxscale - depthfxbias) || + isvisiblesphere(psize, p->o) >= VFC_FOGGED) continue; + + e.o = p->o; + e.radius = e.eyeheight = e.aboveeye = psize; + if(::collide(&e, vec(0, 0, 0), 0, false)) continue; + + if(depthfxscissor==2 && !depthfxtex.addscissorbox(p->o, psize)) continue; + + vec dir = camera1->o; + dir.sub(p->o); + float dist = dir.magnitude(); + dir.mul(psize/dist).add(p->o); + float depth = depthfxtex.eyedepth(dir); + + loopk(3) + { + bbmin[k] = min(bbmin[k], p->o[k] - psize); + bbmax[k] = max(bbmax[k], p->o[k] + psize); + } + + int pos = numranges; + loopi(numranges) if(depth < ranges[i]) { pos = i; break; } + if(pos >= maxranges) continue; + + if(numranges > pos) + { + int moved = min(numranges-pos, maxranges-(pos+1)); + memmove(&ranges[pos+1], &ranges[pos], moved*sizeof(float)); + memmove(&owners[pos+1], &owners[pos], moved*sizeof(void *)); + } + if(numranges < maxranges) numranges++; + + ranges[pos] = depth; + owners[pos] = p; + } + + return numranges; + } + + void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color) + { + float pmax = p->val, + size = p->fade ? float(ts)/p->fade : 1, + psize = p->size + pmax * size; + + if(isvisiblesphere(psize*WOBBLE, p->o) >= VFC_FOGGED) return; + + glPushMatrix(); + glTranslatef(o.x, o.y, o.z); + if(fogging) + { + if(renderpath!=R_FIXEDFUNCTION) setfogplane(0, reflectz - o.z, true); + else blend = (uchar)(blend * max(0.0f, min(1.0f, 1.0f - (reflectz - o.z)/waterfog))); + } + + bool inside = o.dist(camera1->o) <= psize*WOBBLE; + vec oc(o); + oc.sub(camera1->o); + if(reflecting) oc.z = o.z - reflectz; + + float yaw = inside ? camera1->yaw - 180 : atan2(oc.y, oc.x)/RAD - 90, + pitch = (inside ? camera1->pitch : asin(oc.z/oc.magnitude())/RAD) - 90; + vec rotdir; + if(renderpath==R_FIXEDFUNCTION || explosion2d) + { + glRotatef(yaw, 0, 0, 1); + glRotatef(pitch, 1, 0, 0); + rotdir = vec(0, 0, 1); + } + else + { + vec s(1, 0, 0), t(0, 1, 0); + s.rotate(pitch*RAD, vec(-1, 0, 0)); + s.rotate(yaw*RAD, vec(0, 0, -1)); + t.rotate(pitch*RAD, vec(-1, 0, 0)); + t.rotate(yaw*RAD, vec(0, 0, -1)); + + rotdir = vec(-1, 1, -1).normalize(); + s.rotate(-lastmillis/7.0f*RAD, rotdir); + t.rotate(-lastmillis/7.0f*RAD, rotdir); + + setlocalparamf("texgenS", SHPARAM_VERTEX, 2, 0.5f*s.x, 0.5f*s.y, 0.5f*s.z, 0.5f); + setlocalparamf("texgenT", SHPARAM_VERTEX, 3, 0.5f*t.x, 0.5f*t.y, 0.5f*t.z, 0.5f); + } + + if(renderpath!=R_FIXEDFUNCTION) + { + setlocalparamf("center", SHPARAM_VERTEX, 0, o.x, o.y, o.z); + setlocalparamf("animstate", SHPARAM_VERTEX, 1, size, psize, pmax, float(lastmillis)); + if(!glaring && !reflecting && !refracting && depthfx && depthfxtex.rendertex && numdepthfxranges>0) + { + float scale = 0, offset = -1, texscale = 0; + if(!depthfxtex.highprecision()) + { + float select[4] = { 0, 0, 0, 0 }; + if(!depthfxtex.emulatehighprecision()) + { + loopi(numdepthfxranges) if(depthfxowners[i]==p) + { + select[i] = float(depthfxscale)/depthfxblend; + scale = 1.0f/depthfxblend; + offset = -float(depthfxranges[i] - depthfxbias)/depthfxblend; + break; + } + } + else if(2*(p->size + pmax)*WOBBLE >= depthfxblend) + { + select[0] = float(depthfxfpscale)/depthfxblend; + select[1] = select[0]/256; + select[2] = select[1]/256; + scale = 1.0f/depthfxblend; + offset = 0; + } + setlocalparamfv("depthfxselect", SHPARAM_PIXEL, 6, select); + } + else if(2*(p->size + pmax)*WOBBLE >= depthfxblend) + { + scale = 1.0f/depthfxblend; + offset = 0; + texscale = float(depthfxfpscale)/depthfxblend; + } + setlocalparamf("depthfxparams", SHPARAM_VERTEX, 5, scale, offset, texscale, inside ? blend/(2*255.0f) : 0); + setlocalparamf("depthfxparams", SHPARAM_PIXEL, 5, scale, offset, texscale, inside ? blend/(2*255.0f) : 0); + } + } + + glRotatef(lastmillis/7.0f, -rotdir.x, rotdir.y, -rotdir.z); + glScalef(-psize, psize, -psize); + drawexplosion(inside, color[0], color[1], color[2], blend); + + glPopMatrix(); + } +}; +static fireballrenderer fireballs(PT_FIREBALL|PT_GLARE), noglarefireballs(PT_FIREBALL); + +void finddepthfxranges() +{ + depthfxmin = vec(1e16f, 1e16f, 1e16f); + depthfxmax = vec(0, 0, 0); + numdepthfxranges = fireballs.finddepthfxranges(depthfxowners, depthfxranges, MAXDFXRANGES, depthfxmin, depthfxmax); + loopk(3) + { + depthfxmin[k] -= depthfxmargin; + depthfxmax[k] += depthfxmargin; + } + + if(depthfxscissor<2 && numdepthfxranges>0) depthfxtex.addscissorbox(depthfxmin, depthfxmax); +} + diff --git a/src/engine/glare.cpp b/src/engine/glare.cpp new file mode 100644 index 0000000..d691269 --- /dev/null +++ b/src/engine/glare.cpp @@ -0,0 +1,72 @@ +#include "pch.h" +#include "engine.h" +#include "rendertarget.h" + +static struct glaretexture : rendertarget +{ + bool dorender() + { + extern void drawglare(); + drawglare(); + return true; + } +} glaretex; + +void cleanupglare() +{ + glaretex.cleanup(true); +} + +VARFP(glaresize, 6, 8, 10, cleanupglare()); +VARP(glare, 0, 0, 1); +VARP(blurglare, 0, 4, 7); +VARP(blurglaresigma, 1, 50, 200); + +VAR(debugglare, 0, 0, 1); + +void viewglaretex() +{ + if(!glare) return; + glaretex.debug(); +} + +bool glaring = false; + +void drawglaretex() +{ + if(!glare || renderpath==R_FIXEDFUNCTION) return; + + glaretex.render(1<set(); + + glBindTexture(GL_TEXTURE_2D, glaretex.rendertex); + + setlocalparamf("glarescale", SHPARAM_PIXEL, 0, glarescale, glarescale, glarescale); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex3f(-1, -1, 0); + glTexCoord2f(1, 0); glVertex3f( 1, -1, 0); + glTexCoord2f(1, 1); glVertex3f( 1, 1, 0); + glTexCoord2f(0, 1); glVertex3f(-1, 1, 0); + glEnd(); + + glDisable(GL_BLEND); + + glEnable(GL_DEPTH_TEST); +} + diff --git a/src/engine/grass.cpp b/src/engine/grass.cpp new file mode 100644 index 0000000..ba0292c --- /dev/null +++ b/src/engine/grass.cpp @@ -0,0 +1,439 @@ +#include "pch.h" +#include "engine.h" + +VARP(grassanimdist, 0, 500, 10000); +VARP(grassdist, 0, 500, 10000); +VARP(grassfalloff, 0, 100, 1000); + +VAR(grasswidth, 1, 6, 64); +VAR(grassheight, 1, 8, 64); + +void resetgrasssamples() +{ + extern vector valist; + loopv(valist) + { + vtxarray *va = valist[i]; + DELETEP(va->grasssamples); + } +} + +VARF(grassgrid, 1, 6, 32, resetgrasssamples()); + +void gengrasssample(vtxarray *va, const vec &o, float tu, float tv, LightMap *lm) +{ + grasssample &g = va->grasssamples->add(); + + g.x = ushort(o.x-va->o.x) | GRASS_SAMPLE; + g.y = ushort(o.y-va->o.y); + g.z = ushort(4*(o.z-va->o.z)); + + if(lm) + { + tu = min(tu, LM_PACKW-0.01f); + tv = min(tv, LM_PACKH-0.01f); + memcpy(g.color, &lm->data[3*(int(tv)*LM_PACKW + int(tu))], 3); + } + else loopk(3) g.color[k] = hdr.ambient; +} + +bool gengrassheader(vtxarray *va, const vec *v) +{ + vec center = v[0]; + center.add(v[1]); + center.add(v[2]); + center.div(3); + + float r1 = center.dist(v[0]), + r2 = center.dist(v[1]), + r3 = center.dist(v[2]), + radius = min(r1, min(r2, r3)); + if(radius < grassgrid*2) return false; + + grassbounds &g = *(grassbounds *)&va->grasssamples->add(); + g.x = ushort(center.x-va->o.x) | GRASS_BOUNDS; + g.y = ushort(center.y-va->o.y); + g.z = ushort(4*(center.z-va->o.z)); + g.radius = ushort(radius + grasswidth); + g.numsamples = 0; + return true; +} + +void gengrasssamples(vtxarray *va, const vec *v, float *tc, LightMap *lm) +{ + int u, l, r; + if(v[1].y < v[0].y) u = v[1].y < v[2].y ? 1 : 2; + else u = v[0].y < v[2].y ? 0 : 2; + l = (u+2)%3; + r = (u+1)%3; + if(v[l].x > v[r].x) swap(l, r); + if(v[u].y == v[l].y) + { + if(v[l].x <= v[u].x) swap(u, l); + swap(l, r); + } + vec o1 = v[u], dl = v[l]; + dl.sub(o1); + if(dl.x==0 && dl.y==0) return; + float endl = v[l].y, + ls = tc[2*u], lt = tc[2*u+1], + lds = tc[2*l] - ls, ldt = tc[2*l+1] - lt; + + vec o2, dr; + float endr, rs, rt, rds, rdt; + if(v[u].y==v[r].y) + { + if(v[u].x==v[r].x) return; + o2 = v[r]; + dr = v[l]; + dr.sub(o2); + endr = v[l].y; + + rs = tc[2*r]; + rt = tc[2*r+1]; + rds = tc[2*l] - rs; + rdt = tc[2*l+1] - rt; + } + else + { + o2 = v[u]; + dr = v[r]; + dr.sub(o2); + endr = v[r].y; + rs = ls; + rt = lt; + rds = tc[2*r] - rs; + rdt = tc[2*r+1] - rt; + } + if(dr.y==0 && (dr.x==0 || dl.y==0)) return; + if(dr.x==0 && dl.x==0) return; + + bool header = false; + int numsamples = 0; + float dy = grassgrid - fmodf(o1.y, grassgrid); + for(;;) + { + if(endl > o1.y) dy = min(dy, endl - o1.y); + if(endr > o2.y) dy = min(dy, endr - o2.y); + + o1.y += dy; + o1.x += dl.x * dy/dl.y; + o1.z += dl.z * dy/dl.y; + ls += lds * dy/dl.y; + lt += ldt * dy/dl.y; + + o2.y += dy; + o2.x += dr.x * dy/dr.y; + o2.z += dr.z * dy/dr.y; + rs += rds * dy/dr.y; + rt += rdt * dy/dr.y; + + if(o1.y <= endl && o2.y <= endr && fmod(o1.y, grassgrid) < 0.01f) + { + vec p = o1, dp = o2; + dp.sub(o1); + float s = ls, t = lt, + ds = rs - ls, dt = rt - lt; + float dx = grassgrid - fmodf(o1.x, grassgrid); + if(o1.x==o2.x && dx==grassgrid) + { + if(!numsamples++) header = gengrassheader(va, v); + gengrasssample(va, p, s, t, lm); + } + else while(!header || numsamples o2.x) break; + + if(!numsamples++) header = gengrassheader(va, v); + gengrasssample(va, p, s, t, lm); + + dx = grassgrid; + } + if(header && numsamples>=USHRT_MAX) break; + } + + if(o1.y >= endl) + { + if(v[r].y <= endl) break; + dl = v[r]; + dl.sub(v[l]); + endl = v[r].y; + lds = tc[2*r] - tc[2*l]; + ldt = tc[2*r+1] - tc[2*l+1]; + + dy = grassgrid - fmod(o1.y, grassgrid); + continue; + } + + if(o2.y >= endr) + { + if(v[l].y <= endr) break; + dr = v[l]; + dr.sub(v[r]); + endr = v[l].y; + rds = tc[2*l] - tc[2*r]; + rdt = tc[2*l+1] - tc[2*r+1]; + + dy = grassgrid - fmod(o1.y, grassgrid); + continue; + } + + dy = grassgrid; + } + if(header) + { + grassbounds &g = *(grassbounds *)&(*va->grasssamples)[va->grasssamples->length() - numsamples - 1]; + g.numsamples = numsamples; + } +} + +void gengrasssamples(vtxarray *va) +{ + if(va->grasssamples) return; + va->grasssamples = new vector; + int lasttex = -1; + loopv(*va->grasstris) + { + grasstri &g = (*va->grasstris)[i]; + if(g.texture != lasttex) + { + grasstexture &t = *(grasstexture *)&va->grasssamples->add(); + t.x = GRASS_TEXTURE; + t.texture = g.texture; + lasttex = g.texture; + } + vec v[4]; + float tc[8]; + static int remap[4] = { 1, 2, 0, 3 }; + loopk(4) + { + int j = remap[k]; + v[k] = g.v[j].tovec(va->o); + if(g.surface) + { + tc[2*k] = float(g.surface->x + (g.surface->texcoords[j*2] / 255.0f) * (g.surface->w - 1) + 0.5f); + tc[2*k+1] = float(g.surface->y + (g.surface->texcoords[j*2 + 1] / 255.0f) * (g.surface->h - 1) + 0.5f); + } + } + LightMap *lm = g.surface && g.surface->lmid >= LMID_RESERVED ? &lightmaps[g.surface->lmid-LMID_RESERVED] : NULL; + gengrasssamples(va, v, tc, lm); + gengrasssamples(va, &v[1], &tc[2], lm); + } +} + +VAR(grasstest, 0, 0, 3); + +static Texture *grasstex = NULL; + +VARP(grasslod, 0, 25, 1000); + +VARP(grasslodz, 0, 150, 10000); + +float loddist(const vec &o) +{ + float dx = o.x - camera1->o.x, dy = o.y - camera1->o.y, dz = camera1->o.z - o.z; + float dist = sqrt(dx*dx + dy*dy); + dist -= grasslodz/100.0f * max(dz, 0.0f); + return max(dist, 0.0f); +} + +VAR(grassrand, 0, 30, 90); + +VARP(grasssamples, 0, 50, 10000); + +VARP(grassbillboard, 0, 1, 100); +VARP(grassbbcorrect, 0, 1, 1); +VARP(grasstaper, 0, 200, 10000); + +void rendergrasssample(const grasssample &g, const vec &o, float dist, int seed, float height, int numsamples) +{ + if(grasstest>2) return; + + if(seed >= 2*numsamples) return; + + vec up(0, 0, 1), right(seed%2, (seed+1)%2, 0); + float width = grasswidth; + if(numsamples<=grassbillboard) + { + if(seed%2) return; + right = camright; + if(grassrand) right.rotate_around_z((detrnd((size_t)&g * (seed + 1), 2*grassrand)-grassrand)*RAD); + if(grassbbcorrect) + { + if(fabs(right.x) > fabs(right.y)) width *= sqrt(right.y*right.y/(right.x*right.x) + 1); + else width *= sqrt(right.x*right.x/(right.y*right.y) + 1); + } + } + else if(grassrand) right.rotate_around_z((detrnd((size_t)&g * (seed + 1), 2*grassrand)-grassrand)*RAD); + + vec b1 = right; + b1.mul(-0.5f*width); + b1.add(o); + b1[seed%2] += (seed/2 * grassgrid) / float(numsamples) - grassgrid/2.0f; + + vec b2 = right; + b2.mul(width); + b2.add(b1); + + vec t1 = b1, t2 = b2; + t1.z += grassheight * height; + t2.z += grassheight * height; + + float w1 = 0, w2 = 0; + if(grasstest>0) t1 = t2 = b1; + else if(dist < grassanimdist) + { + w1 = detrnd((size_t)&g * (seed + 1)*7, 360)*RAD + t1.x*0.4f + t1.y*0.5f; + w1 += lastmillis*0.0015f; + w1 = sinf(w1); + vec d1(1.0f, 1.0f, 0.5f); + d1.mul(grassheight/4.0f * w1); + t1.add(d1); + + w2 = detrnd((size_t)&g * (seed + 1)*11, 360)*RAD + t2.x*0.55f + t2.y*0.45f; + w2 += lastmillis*0.0015f; + w2 = sinf(w2); + vec d2(0.4f, 0.4f, 0.2f); + d2.mul(grassheight/4.0f * w2); + t2.add(d2); + } + + if(grasstest>1) return; + + extern int fullbright; + if(nolights || (fullbright && editmode)) glColor3ub(128, 128, 128); + else glColor3ubv(g.color); + float offset = detrnd((size_t)&g * (seed + 1)*13, grasstex->xs)/float(grasstex->xs); + glTexCoord2f(offset, 1); glVertex3fv(b1.v); + glTexCoord2f(offset, 0); glVertex3fv(t1.v); + glTexCoord2f(offset + float(grasswidth)*64.0f/grasstex->xs, 0); glVertex3fv(t2.v); + glTexCoord2f(offset + float(grasswidth)*64.0f/grasstex->xs, 1); glVertex3fv(b2.v); + xtraverts += 4; +} + +void rendergrasssamples(vtxarray *va, const vec &dir) +{ + if(!va->grasssamples) return; + loopv(*va->grasssamples) + { + grasssample &g = (*va->grasssamples)[i]; + + vec o((g.x&~GRASS_TYPE)+va->o.x, g.y+va->o.y, g.z/4.0f+va->o.z), tograss; + switch(g.x&GRASS_TYPE) + { + case GRASS_BOUNDS: + { + grassbounds &b = *(grassbounds *)&g; + if(reflecting || refracting>0 ? o.z+b.radius=reflectz) + { + i += b.numsamples; + continue; + } + float dist = o.dist(camera1->o, tograss); + if(dist > grassdist + b.radius || (dir.dot(tograss)<0 && dist > b.radius + 2*(grassgrid + player->eyeheight))) + i += b.numsamples; + break; + } + + case GRASS_TEXTURE: + { + grasstexture &t = *(grasstexture *)&g; + Slot &s = lookuptexture(t.texture, false); + if(!s.grasstex || s.grasstex!=grasstex) + { + glEnd(); + if(!s.grasstex) s.grasstex = textureload(s.autograss, 2); + glBindTexture(GL_TEXTURE_2D, s.grasstex->id); + glBegin(GL_QUADS); + grasstex = s.grasstex; + } + break; + } + + case GRASS_SAMPLE: + { + if(reflecting || refracting>0 ? o.z+grassheight<=reflectz : o.z>=reflectz) continue; + float dist = o.dist(camera1->o, tograss); + if(dist > grassdist || (dir.dot(tograss)<0 && dist > grasswidth/2 + 2*(grassgrid + player->eyeheight))) continue; + + float ld = loddist(o); + int numsamples = int(grasssamples/100.0f*max(grassgrid - ld/grasslod, 100.0f/grasssamples)); + float height = 1 - (dist + grasstaper - grassdist) / (grasstaper ? grasstaper : 1); + height = min(height, 1.0f); + loopj(2*numsamples) + { + rendergrasssample(g, o, dist, j, height, numsamples); + } + break; + } + } + } +} + +VAR(grassblend, 0, 0, 100); + +void setupgrass() +{ + glDisable(GL_CULL_FACE); + glEnable(GL_ALPHA_TEST); + glAlphaFunc(GL_GREATER, grassblend ? grassblend/100.0f : 0.6f); + if(grassblend) + { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + static Shader *grassshader = NULL; + if(!grassshader) grassshader = lookupshaderbyname("grass"); + grassshader->set(); + + grasstex = NULL; + + setuptmu(0, "C * T x 2"); + + glBegin(GL_QUADS); +} + +void cleanupgrass() +{ + glEnd(); + + resettmu(0); + + defaultshader->set(); + + if(grassblend) glDisable(GL_BLEND); + glDisable(GL_ALPHA_TEST); + glEnable(GL_CULL_FACE); +} + +VARP(grass, 0, 0, 1); + +void rendergrass() +{ + if(!grass || !grasssamples || !grassdist) return; + + vec dir; + vecfromyawpitch(camera1->yaw, 0, 1, 0, dir); + + int rendered = 0; + extern vtxarray *visibleva; + for(vtxarray *va = visibleva; va; va = va->next) + { + if(!va->grasstris || va->occluded >= OCCLUDE_GEOM) continue; + if(va->distance > grassdist) continue; + if(reflecting || refracting>0 ? va->o.z+va->sizeo.z>=reflectz) continue; + if(!va->grasssamples) gengrasssamples(va); + if(!rendered++) setupgrass(); + rendergrasssamples(va, dir); + } + + if(rendered) cleanupgrass(); +} + diff --git a/src/engine/lensflare.h b/src/engine/lensflare.h new file mode 100644 index 0000000..711da66 --- /dev/null +++ b/src/engine/lensflare.h @@ -0,0 +1,188 @@ +static struct flaretype +{ + int type; /* flaretex index, 0..5, -1 for 6+random shine */ + float loc; /* postion on axis */ + float scale; /* texture scaling */ + uchar alpha; /* color alpha */ +} flaretypes[] = +{ + {2, 1.30f, 0.04f, 153}, //flares + {3, 1.00f, 0.10f, 102}, + {1, 0.50f, 0.20f, 77}, + {3, 0.20f, 0.05f, 77}, + {0, 0.00f, 0.04f, 77}, + {5, -0.25f, 0.07f, 127}, + {5, -0.40f, 0.02f, 153}, + {5, -0.60f, 0.04f, 102}, + {5, -1.00f, 0.03f, 51}, + {-1, 1.00f, 0.30f, 255}, //shine - red, green, blue + {-2, 1.00f, 0.20f, 255}, + {-3, 1.00f, 0.25f, 255} +}; + +struct flare +{ + vec o, center; + float size; + uchar color[3]; + bool sparkle; +}; + +VAR(flarelights, 0, 0, 1); +VARP(flarecutoff, 0, 1000, 10000); +VARP(flaresize, 20, 100, 500); + +struct flarerenderer : partrenderer +{ + int maxflares, numflares; + unsigned int shinetime; + flare *flares; + + flarerenderer(const char *texname, int maxflares) + : partrenderer(texname, PT_FLARE, 0, 0), maxflares(maxflares), shinetime(0) + { + flares = new flare[maxflares]; + } + void reset() + { + numflares = 0; + } + + void newflare(vec &o, const vec ¢er, uchar r, uchar g, uchar b, float mod, float size, bool sun, bool sparkle) + { + if(numflares >= maxflares) return; + vec target; //occlusion check (neccessary as depth testing is turned off) + if(!raycubelos(o, camera1->o, target)) return; + flare &f = flares[numflares++]; + f.o = o; + f.center = center; + f.size = size; + f.color[0] = uchar(r*mod); + f.color[1] = uchar(g*mod); + f.color[2] = uchar(b*mod); + f.sparkle = sparkle; + } + + void addflare(vec &o, uchar r, uchar g, uchar b, bool sun, bool sparkle) + { + //frustrum + fog check + if(isvisiblesphere(0.0f, o) > (sun?VFC_FOGGED:VFC_FULL_VISIBLE)) return; + //find closest point between camera line of sight and flare pos + vec viewdir; + vecfromyawpitch(camera1->yaw, camera1->pitch, 1, 0, viewdir); + vec flaredir = vec(o).sub(camera1->o); + vec center = viewdir.mul(flaredir.dot(viewdir)).add(camera1->o); + float mod, size; + if(sun) //fixed size + { + mod = 1.0; + size = flaredir.magnitude() * flaresize / 100.0f; + } + else + { + mod = (flarecutoff-vec(o).sub(center).squaredlen())/flarecutoff; + if(mod < 0.0f) return; + size = flaresize / 5.0f; + } + newflare(o, center, r, g, b, mod, size, sun, sparkle); + } + + void makelightflares() + { + numflares = 0; //regenerate flarelist each frame + shinetime = lastmillis/10; + + if(editmode || !flarelights) return; + + const vector &ents = et->getents(); + vec viewdir; + vecfromyawpitch(camera1->yaw, camera1->pitch, 1, 0, viewdir); + extern const vector &checklightcache(int x, int y); + const vector &lights = checklightcache(int(camera1->o.x), int(camera1->o.y)); + loopv(lights) + { + entity &e = *ents[lights[i]]; + if(e.type != ET_LIGHT) continue; + bool sun = (e.attr1==0); + float radius = float(e.attr1); + vec flaredir = vec(e.o).sub(camera1->o); + float len = flaredir.magnitude(); + if(!sun && (len > radius)) continue; + if(isvisiblesphere(0.0f, e.o) > (sun?VFC_FOGGED:VFC_FULL_VISIBLE)) continue; + vec center = vec(viewdir).mul(flaredir.dot(viewdir)).add(camera1->o); + float mod, size; + if(sun) //fixed size + { + mod = 1.0; + size = len * flaresize / 100.0f; + } + else + { + mod = (radius-len)/radius; + size = flaresize / 5.0f; + } + newflare(e.o, center, e.attr2, e.attr3, e.attr4, mod, size, sun, sun); + } + } + + int count() + { + return numflares; + } + + bool haswork() + { + return (numflares != 0) && !glaring && !reflecting && !refracting; + } + + void render() + { + bool fog = glIsEnabled(GL_FOG)==GL_TRUE; + if(fog) glDisable(GL_FOG); + defaultshader->set(); + glDisable(GL_DEPTH_TEST); + if(!tex) tex = textureload(texname); + glBindTexture(GL_TEXTURE_2D, tex->id); + glBegin(GL_QUADS); + loopi(numflares) + { + flare *f = flares+i; + vec center = f->center; + vec axis = vec(f->o).sub(center); + uchar color[4] = {f->color[0], f->color[1], f->color[2], 255}; + loopj(f->sparkle?12:9) + { + const flaretype &ft = flaretypes[j]; + vec o = vec(axis).mul(ft.loc).add(center); + float sz = ft.scale * f->size; + int tex = ft.type; + if(ft.type < 0) //sparkles - always done last + { + shinetime = (shinetime + 1) % 10; + tex = 6+shinetime; + color[0] = 0; + color[1] = 0; + color[2] = 0; + color[-ft.type-1] = f->color[-ft.type-1]; //only want a single channel + } + color[3] = ft.alpha; + glColor4ubv(color); + const float tsz = 0.25; //flares are aranged in 4x4 grid + float tx = tsz*(tex&0x03); + float ty = tsz*((tex>>2)&0x03); + glTexCoord2f(tx, ty+tsz); glVertex3f(o.x+(-camright.x+camup.x)*sz, o.y+(-camright.y+camup.y)*sz, o.z+(-camright.z+camup.z)*sz); + glTexCoord2f(tx+tsz, ty+tsz); glVertex3f(o.x+( camright.x+camup.x)*sz, o.y+( camright.y+camup.y)*sz, o.z+( camright.z+camup.z)*sz); + glTexCoord2f(tx+tsz, ty); glVertex3f(o.x+( camright.x-camup.x)*sz, o.y+( camright.y-camup.y)*sz, o.z+( camright.z-camup.z)*sz); + glTexCoord2f(tx, ty); glVertex3f(o.x+(-camright.x-camup.x)*sz, o.y+(-camright.y-camup.y)*sz, o.z+(-camright.z-camup.z)*sz); + } + } + glEnd(); + glEnable(GL_DEPTH_TEST); + if(fog) glEnable(GL_FOG); + } + + //square per round hole - use addflare(..) instead + particle *addpart(const vec &o, const vec &d, int fade, int color, float size) { return NULL; } +}; +static flarerenderer flares("packages/particles/lensflares.png", 64); + diff --git a/src/engine/lightmap.cpp b/src/engine/lightmap.cpp new file mode 100644 index 0000000..d8b7765 --- /dev/null +++ b/src/engine/lightmap.cpp @@ -0,0 +1,1669 @@ +#include "pch.h" +#include "engine.h" + +vector lightmaps; + +VARF(lightprecision, 1, 32, 1024, hdr.mapprec = lightprecision); +VARF(lighterror, 1, 8, 16, hdr.maple = lighterror); +VARF(bumperror, 1, 3, 16, hdr.mapbe = bumperror); +VARF(lightlod, 0, 0, 10, hdr.mapllod = lightlod); +VARF(worldlod, 0, 0, 1, hdr.mapwlod = worldlod); +VARF(ambient, 1, 25, 64, hdr.ambient = ambient); + +void skylight(char *r, char *g, char *b) +{ + if(!r[0]) + { + s_sprintfd(s)("%d %d %d", hdr.skylight[0], hdr.skylight[1], hdr.skylight[2]); + result(s); + } + else + { + hdr.skylight[0] = strtol(r, NULL, 0); + hdr.skylight[1] = g[0] ? strtol(g, NULL, 0) : hdr.skylight[0]; + hdr.skylight[2] = b[0] ? strtol(b, NULL, 0) : hdr.skylight[1]; + } +} + +COMMAND(skylight, "sss"); + +// quality parameters, set by the calclight arg +int shadows = 1; +int mmshadows = 0; +int aalights = 3; + +static int lmtype, lmorient, lmrotate; +static uchar lm[3*LM_MAXW*LM_MAXH]; +static vec lm_ray[LM_MAXW*LM_MAXH]; +static int lm_w, lm_h; +static vector lights1, lights2; +static uint progress = 0; +static GLuint progresstex = 0; +static int progresstexticks = 0; + +bool calclight_canceled = false; +volatile bool check_calclight_progress = false; + +void check_calclight_canceled() +{ + if(interceptkey(SDLK_ESCAPE)) calclight_canceled = true; + if(!calclight_canceled) check_calclight_progress = false; +} + +static int curlumels = 0; + +void show_calclight_progress() +{ + int lumels = curlumels; + loopv(lightmaps) lumels += lightmaps[i].lumels; + float bar1 = float(progress) / float(allocnodes), + bar2 = lightmaps.length() ? float(lumels) / float(lightmaps.length() * LM_PACKW * LM_PACKH) : 0; + + s_sprintfd(text1)("%d%%", int(bar1 * 100)); + s_sprintfd(text2)("%d textures %d%% utilized", lightmaps.length(), int(bar2 * 100)); + + if(LM_PACKW <= hwtexsize && !progresstex) + { + glGenTextures(1, &progresstex); + createtexture(progresstex, LM_PACKW, LM_PACKH, NULL, 3, false, GL_RGB); + } + // only update once a sec (4 * 250 ms ticks) to not kill performance + if(progresstex && !calclight_canceled) + { + loopvrev(lightmaps) if(lightmaps[i].type==LM_DIFFUSE || lightmaps[i].type==LM_BUMPMAP0) + { + if(progresstexticks++ % 4) break; + glBindTexture(GL_TEXTURE_2D, progresstex); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, LM_PACKW, LM_PACKH, GL_RGB, GL_UNSIGNED_BYTE, lightmaps[i].data); + break; + } + } + show_out_of_renderloop_progress(bar1, text1, bar2, text2, progresstexticks ? progresstex : 0); +} + +#define CHECK_PROGRESS(exit) CHECK_CALCLIGHT_PROGRESS(exit, show_calclight_progress) + +bool PackNode::insert(ushort &tx, ushort &ty, ushort tw, ushort th) +{ + if((available < tw && available < th) || w < tw || h < th) + return false; + if(child1) + { + bool inserted = child1->insert(tx, ty, tw, th) || + child2->insert(tx, ty, tw, th); + available = max(child1->available, child2->available); + if(!available) clear(); + return inserted; + } + if(w == tw && h == th) + { + available = 0; + tx = x; + ty = y; + return true; + } + + if(w - tw > h - th) + { + child1 = new PackNode(x, y, tw, h); + child2 = new PackNode(x + tw, y, w - tw, h); + } + else + { + child1 = new PackNode(x, y, w, th); + child2 = new PackNode(x, y + th, w, h - th); + } + + bool inserted = child1->insert(tx, ty, tw, th); + available = max(child1->available, child2->available); + return inserted; +} + +bool LightMap::insert(ushort &tx, ushort &ty, uchar *src, ushort tw, ushort th) +{ + if(type != LM_BUMPMAP1 && !packroot.insert(tx, ty, tw, th)) + return false; + + uchar *dst = data + 3 * tx + ty * 3 * LM_PACKW; + loopi(th) + { + memcpy(dst, src, 3 * tw); + dst += 3 * LM_PACKW; + src += 3 * tw; + } + ++lightmaps; + lumels += tw * th; + return true; +} + +void insert_unlit(int i) +{ + LightMap &l = lightmaps[i]; + if(l.type != LM_DIFFUSE && l.type != LM_BUMPMAP0) + { + l.unlitx = l.unlity = -1; + return; + } + ushort x, y; + uchar unlit[3] = { hdr.ambient, hdr.ambient, hdr.ambient }; + if(l.insert(x, y, unlit, 1, 1)) + { + if(l.type == LM_BUMPMAP0) + { + bvec front(128, 128, 255); + ASSERT(lightmaps[i+1].insert(x, y, front.v, 1, 1)); + } + l.unlitx = x; + l.unlity = y; + } +} + +void insert_lightmap(int type, ushort &x, ushort &y, ushort &lmid) +{ + loopv(lightmaps) + { + if(lightmaps[i].type == type && lightmaps[i].insert(x, y, lm, lm_w, lm_h)) + { + lmid = i + LMID_RESERVED; + if(type == LM_BUMPMAP0) ASSERT(lightmaps[i+1].insert(x, y, (uchar *)lm_ray, lm_w, lm_h)); + return; + } + } + + lmid = lightmaps.length() + LMID_RESERVED; + LightMap &l = lightmaps.add(); + l.type = type; + ASSERT(l.insert(x, y, lm, lm_w, lm_h)); + if(type == LM_BUMPMAP0) + { + LightMap &r = lightmaps.add(); + r.type = LM_BUMPMAP1; + ASSERT(r.insert(x, y, (uchar *)lm_ray, lm_w, lm_h)); + } +} + +struct compresskey +{ + ushort x, y, lmid; + uchar w, h; + + compresskey() {} + compresskey(const surfaceinfo &s) : x(s.x), y(s.y), lmid(s.lmid), w(s.w), h(s.h) {} +}; + +struct compressval +{ + ushort x, y, lmid; + + compressval() {} + compressval(const surfaceinfo &s) : x(s.x), y(s.y), lmid(s.lmid) {} +}; + +static inline bool htcmp(const compresskey &x, const compresskey &y) +{ + if(lm_w != y.w || lm_h != y.h) return false; + LightMap &ylm = lightmaps[y.lmid - LMID_RESERVED]; + if(lmtype != ylm.type) return false; + const uchar *xcolor = lm, *ycolor = ylm.data + 3*(y.x + y.y*LM_PACKW); + loopi(lm_h) + { + loopj(lm_w) + { + loopk(3) if(*xcolor++ != *ycolor++) return false; + } + ycolor += 3*(LM_PACKW - y.w); + } + if(lmtype != LM_BUMPMAP0) return true; + const bvec *xdir = (bvec *)lm_ray, *ydir = (bvec *)lightmaps[y.lmid+1 - LMID_RESERVED].data; + loopi(lm_h) + { + loopj(lm_w) if(*xdir++ != *ydir++) return false; + ydir += LM_PACKW - y.w; + } + return true; +} + +static inline uint hthash(const compresskey &k) +{ + uint hash = lm_w + (lm_h<<8); + const uchar *color = lm; + loopi(lm_w*lm_h) + { + hash ^= (color[0] + (color[1] << 8) + (color[2] << 16)); + color += 3; + } + return hash; +} + +static hashtable compressed; + +VAR(lightcompress, 0, 3, 6); + +void pack_lightmap(int type, surfaceinfo &surface) +{ + if((int)lm_w <= lightcompress && (int)lm_h <= lightcompress) + { + compressval *val = compressed.access(compresskey()); + if(!val) + { + insert_lightmap(type, surface.x, surface.y, surface.lmid); + compressed[surface] = surface; + } + else + { + surface.x = val->x; + surface.y = val->y; + surface.lmid = val->lmid; + } + } + else insert_lightmap(type, surface.x, surface.y, surface.lmid); +} + +void generate_lumel(const float tolerance, const vector &lights, const vec &target, const vec &normal, vec &sample, int x, int y) +{ + vec avgray(0, 0, 0); + float r = 0, g = 0, b = 0; + loopv(lights) + { + const extentity &light = *lights[i]; + vec ray = target; + ray.sub(light.o); + float mag = ray.magnitude(); + if(!mag) continue; + float attenuation = 1; + if(light.attr1) + { + attenuation -= mag / float(light.attr1); + if(attenuation <= 0) continue; + } + ray.mul(1.0f / mag); + float angle = -ray.dot(normal); + if(angle <= 0) continue; + if(light.attached && light.attached->type==ET_SPOTLIGHT) + { + vec spot(vec(light.attached->o).sub(light.o).normalize()); + float maxatten = 1-cosf(max(1, min(90, int(light.attached->attr1)))*RAD); + float spotatten = 1-(1-ray.dot(spot))/maxatten; + if(spotatten <= 0) continue; + attenuation *= spotatten; + } + if(shadows && mag) + { + float dist = shadowray(light.o, ray, mag - tolerance, RAY_SHADOW | (mmshadows > 1 ? RAY_ALPHAPOLY : (mmshadows ? RAY_POLY : 0))); + if(dist < mag - tolerance) continue; + } + float intensity; + switch(lmtype) + { + case LM_BUMPMAP0: + intensity = attenuation; + avgray.add(ray.mul(-attenuation)); + break; + default: + intensity = angle * attenuation; + break; + } + r += intensity * float(light.attr2); + g += intensity * float(light.attr3); + b += intensity * float(light.attr4); + } + switch(lmtype) + { + case LM_BUMPMAP0: + if(avgray.iszero()) break; + // transform to tangent space + extern float orientation_tangent[6][3][4]; + extern float orientation_binormal[6][3][4]; + vec S(orientation_tangent[lmrotate][dimension(lmorient)]), + T(orientation_binormal[lmrotate][dimension(lmorient)]); + normal.orthonormalize(S, T); + avgray.normalize(); + lm_ray[y*lm_w+x].add(vec(S.dot(avgray), T.dot(avgray), normal.dot(avgray))); + break; + } + sample.x = min(255.0f, max(r, float(ambient))); + sample.y = min(255.0f, max(g, float(ambient))); + sample.z = min(255.0f, max(b, float(ambient))); +} + +bool lumel_sample(const vec &sample, int aasample, int stride) +{ + if(sample.x >= ambient+1 || sample.y >= ambient+1 || sample.z >= ambient+1) return true; +#define NCHECK(n) \ + if((n).x >= ambient+1 || (n).y >= ambient+1 || (n).z >= ambient+1) \ + return true; + const vec *n = &sample - stride - aasample; + NCHECK(n[0]); NCHECK(n[aasample]); NCHECK(n[2*aasample]); + n += stride; + NCHECK(n[0]); NCHECK(n[2*aasample]); + n += stride; + NCHECK(n[0]); NCHECK(n[aasample]); NCHECK(n[2*aasample]); + return false; +} + +VAR(mmskylight, 0, 1, 1); + +void calcskylight(const vec &o, const vec &normal, float tolerance, uchar *skylight, int mmshadows = 1, extentity *t = NULL) +{ + static const vec rays[17] = + { + vec(cosf(21*RAD)*cosf(50*RAD), sinf(21*RAD)*cosf(50*RAD), sinf(50*RAD)), + vec(cosf(111*RAD)*cosf(50*RAD), sinf(111*RAD)*cosf(50*RAD), sinf(50*RAD)), + vec(cosf(201*RAD)*cosf(50*RAD), sinf(201*RAD)*cosf(50*RAD), sinf(50*RAD)), + vec(cosf(291*RAD)*cosf(50*RAD), sinf(291*RAD)*cosf(50*RAD), sinf(50*RAD)), + + vec(cosf(66*RAD)*cosf(70*RAD), sinf(66*RAD)*cosf(70*RAD), sinf(70*RAD)), + vec(cosf(156*RAD)*cosf(70*RAD), sinf(156*RAD)*cosf(70*RAD), sinf(70*RAD)), + vec(cosf(246*RAD)*cosf(70*RAD), sinf(246*RAD)*cosf(70*RAD), sinf(70*RAD)), + vec(cosf(336*RAD)*cosf(70*RAD), sinf(336*RAD)*cosf(70*RAD), sinf(70*RAD)), + + vec(0, 0, 1), + + vec(cosf(43*RAD)*cosf(60*RAD), sinf(43*RAD)*cosf(60*RAD), sinf(60*RAD)), + vec(cosf(133*RAD)*cosf(60*RAD), sinf(133*RAD)*cosf(60*RAD), sinf(60*RAD)), + vec(cosf(223*RAD)*cosf(60*RAD), sinf(223*RAD)*cosf(60*RAD), sinf(60*RAD)), + vec(cosf(313*RAD)*cosf(60*RAD), sinf(313*RAD)*cosf(60*RAD), sinf(60*RAD)), + + vec(cosf(88*RAD)*cosf(80*RAD), sinf(88*RAD)*cosf(80*RAD), sinf(80*RAD)), + vec(cosf(178*RAD)*cosf(80*RAD), sinf(178*RAD)*cosf(80*RAD), sinf(80*RAD)), + vec(cosf(268*RAD)*cosf(80*RAD), sinf(268*RAD)*cosf(80*RAD), sinf(80*RAD)), + vec(cosf(358*RAD)*cosf(80*RAD), sinf(358*RAD)*cosf(80*RAD), sinf(80*RAD)), + + }; + int hit = 0; + loopi(17) if(normal.dot(rays[i])>=0) + { + if(shadowray(vec(rays[i]).mul(tolerance).add(o), rays[i], 1e16f, RAY_SHADOW | (!mmskylight || !mmshadows ? 0 : (mmshadows > 1 ? RAY_ALPHAPOLY : RAY_POLY)), t)>1e15f) hit++; + } + + loopk(3) skylight[k] = uchar(ambient + (max(int(hdr.skylight[k]), ambient) - ambient)*hit/17.0f); +} + +VARR(blurlms, 0, 0, 2); +VARR(blurskylight, 0, 0, 2); + +void blurlightmap(int n) +{ + static uchar blur[3*LM_MAXW*LM_MAXH]; + static const int matrix3x3[9] = + { + 1, 2, 1, + 2, 4, 2, + 1, 2, 1 + }; + static const int matrix3x3sum = 16; + static const int matrix5x5[25] = + { + 1, 1, 2, 1, 1, + 1, 2, 4, 2, 1, + 2, 4, 8, 4, 2, + 1, 2, 4, 2, 1, + 1, 1, 2, 1, 1 + }; + static const int matrix5x5sum = 52; + uchar *src = lm, *dst = blur; + int stride = 3*lm_w; + + loop(y, lm_h) loop(x, lm_w) loopk(3) + { + int c = *src, val = 0; + const int *m = n>1 ? matrix5x5 : matrix3x3; + for(int t = -n; t<=n; t++) for(int s = -n; s<=n; s++, m++) + { + val += *m * (x+s>=0 && x+s=0 && y+t1 ? matrix5x5sum : matrix3x3sum); + src++; + } + memcpy(lm, blur, 3*lm_w*lm_h); +} + +VAR(edgetolerance, 1, 4, 8); +VAR(adaptivesample, 0, 1, 1); + +bool generate_lightmap(float lpu, int y1, int y2, const vec &origin, const lerpvert *lv, int numv, const vec &ustep, const vec &vstep) +{ + static uchar mincolor[3], maxcolor[3]; + static float aacoords[8][2] = + { + {0.0f, 0.0f}, + {-0.5f, -0.5f}, + {0.0f, -0.5f}, + {-0.5f, 0.0f}, + + {0.3f, -0.6f}, + {0.6f, 0.3f}, + {-0.3f, 0.6f}, + {-0.6f, -0.3f}, + }; + float tolerance = 0.5 / lpu; + vector &lights = (y1 == 0 ? lights1 : lights2); + vec v = origin; + vec offsets[8]; + loopi(8) loopj(3) offsets[i][j] = aacoords[i][0]*ustep[j] + aacoords[i][1]*vstep[j]; + + if(y1 == 0) + { + memset(mincolor, 255, 3); + memset(maxcolor, 0, 3); + if(lmtype == LM_BUMPMAP0) memset(lm_ray, 0, sizeof(lm_ray)); + } + + static vec samples [4*(LM_MAXW+1)*(LM_MAXH+1)]; + + int aasample = min(1 << aalights, 4); + int stride = aasample*(lm_w+1); + vec *sample = &samples[stride*y1]; + uchar *skylight = &lm[3*lm_w*y1]; + lerpbounds start, end; + initlerpbounds(lv, numv, start, end); + for(int y = y1; y < y2; ++y, v.add(vstep)) + { + vec normal, nstep; + lerpnormal(y, lv, numv, start, end, normal, nstep); + + vec u(v); + for(int x = 0; x < lm_w; ++x, u.add(ustep), normal.add(nstep), skylight += 3) + { + CHECK_PROGRESS(return false); + generate_lumel(tolerance, lights, u, vec(normal).normalize(), *sample, x, y); + if(hdr.skylight[0]>ambient || hdr.skylight[1]>ambient || hdr.skylight[2]>ambient) + { + if(lmtype==LM_BUMPMAP0 || !adaptivesample || sample->xyz 0 && x+1 < lm_w && y > y1 && y+1 < y2 && !lumel_sample(center, aasample, stride)) + loopi(aasample-1) *sample++ = center; + else + { +#define EDGE_TOLERANCE(i) \ + ((!x && aacoords[i][0] < 0) \ + || (x+1==lm_w && aacoords[i][0] > 0) \ + || (!y && aacoords[i][1] < 0) \ + || (y+1==lm_h && aacoords[i][1] > 0) \ + ? edgetolerance : 1) + vec n(normal); + n.normalize(); + loopi(aasample-1) + generate_lumel(EDGE_TOLERANCE(i+1) * tolerance, lights, vec(u).add(offsets[i+1]), n, *sample++, x, y); + if(aalights == 3) + { + loopi(4) + { + vec s; + generate_lumel(EDGE_TOLERANCE(i+4) * tolerance, lights, vec(u).add(offsets[i+4]), n, s, x, y); + center.add(s); + } + center.div(5); + } + } + } + if(aasample > 1) + { + normal.normalize(); + generate_lumel(tolerance, lights, vec(u).add(offsets[1]), normal, sample[1], lm_w-1, y); + if(aasample > 2) + generate_lumel(edgetolerance * tolerance, lights, vec(u).add(offsets[3]), normal, sample[3], lm_w-1, y); + } + sample += aasample; + } + + if(y2 == lm_h) + { + if(aasample > 1) + { + vec normal, nstep; + lerpnormal(lm_h, lv, numv, start, end, normal, nstep); + + for(int x = 0; x <= lm_w; ++x, v.add(ustep), normal.add(nstep)) + { + CHECK_PROGRESS(return false); + vec n(normal); + n.normalize(); + generate_lumel(edgetolerance * tolerance, lights, vec(v).add(offsets[1]), n, sample[1], min(x, lm_w-1), lm_h-1); + if(aasample > 2) + generate_lumel(edgetolerance * tolerance, lights, vec(v).add(offsets[2]), n, sample[2], min(x, lm_w-1), lm_h-1); + sample += aasample; + } + } + + if(hdr.skylight[0]>ambient || hdr.skylight[1]>ambient || hdr.skylight[2]>ambient) + { + if(blurskylight && (lm_w>1 || lm_h>1)) blurlightmap(blurskylight); + } + sample = samples; + float weight = 1.0f / (1.0f + 4.0f*aalights), + cweight = weight * (aalights == 3 ? 5.0f : 1.0f); + uchar *lumel = lm; + vec *ray = lm_ray; + bvec minray(255, 255, 255), maxray(0, 0, 0); + loop(y, lm_h) + { + loop(x, lm_w) + { + vec l(0, 0, 0); + const vec ¢er = *sample++; + loopi(aasample-1) l.add(*sample++); + if(aasample > 1) + { + l.add(sample[1]); + if(aasample > 2) l.add(sample[3]); + } + vec *next = sample + stride - aasample; + if(aasample > 1) + { + l.add(next[1]); + if(aasample > 2) l.add(next[2]); + l.add(next[aasample+1]); + } + + int r = int(center.x*cweight + l.x*weight), + g = int(center.y*cweight + l.y*weight), + b = int(center.z*cweight + l.z*weight), + ar = lumel[0], ag = lumel[1], ab = lumel[2]; + lumel[0] = max(ar, r); + lumel[1] = max(ag, g); + lumel[2] = max(ab, b); + loopk(3) + { + mincolor[k] = min(mincolor[k], lumel[k]); + maxcolor[k] = max(maxcolor[k], lumel[k]); + } + + if(lmtype == LM_BUMPMAP0) + { + bvec &n = ((bvec *)lm_ray)[ray-lm_ray]; + if(ray->iszero()) n = bvec(128, 128, 255); + else + { + ray->normalize(); + // bias the normals towards the amount of ambient/skylight in the lumel + // this is necessary to prevent the light values in shaders from dropping too far below the skylight (to the ambient) if N.L is small + int l = max(r, max(g, b)), a = max(ar, max(ag, ab)); + ray->mul(max(l-a, 0)); + ray->z += a; + n = bvec(ray->normalize()); + } + loopk(3) + { + minray[k] = min(minray[k], n[k]); + maxray[k] = max(maxray[k], n[k]); + } + } + lumel += 3; + ray++; + } + sample += aasample; + } + if(int(maxcolor[0]) - int(mincolor[0]) <= lighterror && + int(maxcolor[1]) - int(mincolor[1]) <= lighterror && + int(maxcolor[2]) - int(mincolor[2]) <= lighterror) + { + uchar color[3]; + loopk(3) color[k] = (int(maxcolor[k]) + int(mincolor[k])) / 2; + if(color[0] <= ambient + lighterror && + color[1] <= ambient + lighterror && + color[2] <= ambient + lighterror) + return false; + if(lmtype != LM_BUMPMAP0 || + (int(maxray.x) - int(minray.x) <= bumperror && + int(maxray.y) - int(minray.z) <= bumperror && + int(maxray.z) - int(minray.z) <= bumperror)) + { + memcpy(lm, color, 3); + if(lmtype == LM_BUMPMAP0) loopk(3) ((bvec *)lm_ray)[0][k] = uchar((int(maxray[k])+int(minray[k]))/2); + lm_w = 1; + lm_h = 1; + } + } + if(blurlms && (lm_w>1 || lm_h>1)) blurlightmap(blurlms); + } + return true; +} + +void clear_lmids(cube *c) +{ + loopi(8) + { + if(c[i].ext) + { + if(c[i].ext->surfaces) freesurfaces(c[i]); + if(c[i].ext->normals) freenormals(c[i]); + } + if(c[i].children) clear_lmids(c[i].children); + } +} + +#define LIGHTCACHESIZE 1024 + +static struct lightcacheentry +{ + int x, y; + vector lights; +} lightcache[1024]; + +#define LIGHTCACHEHASH(x, y) (((((x)^(y))<<5) + (((x)^(y))>>5)) & (LIGHTCACHESIZE - 1)) + +VARF(lightcachesize, 4, 6, 12, clearlightcache()); + +void clearlightcache(int e) +{ + if(e < 0 || !et->getents()[e]->attr1) + { + for(lightcacheentry *lce = lightcache; lce < &lightcache[LIGHTCACHESIZE]; lce++) + { + lce->x = -1; + lce->lights.setsize(0); + } + } + else + { + const extentity &light = *et->getents()[e]; + int radius = light.attr1; + for(int x = int(max(light.o.x-radius, 0.0f))>>lightcachesize, ex = int(min(light.o.x+radius, hdr.worldsize-1.0f))>>lightcachesize; x <= ex; x++) + for(int y = int(max(light.o.y-radius, 0.0f))>>lightcachesize, ey = int(min(light.o.y+radius, hdr.worldsize-1.0f))>>lightcachesize; y <= ey; y++) + { + lightcacheentry &lce = lightcache[LIGHTCACHEHASH(x, y)]; + if(lce.x != x || lce.y != y) continue; + lce.x = -1; + lce.lights.setsize(0); + } + } +} + +const vector &checklightcache(int x, int y) +{ + x >>= lightcachesize; + y >>= lightcachesize; + lightcacheentry &lce = lightcache[LIGHTCACHEHASH(x, y)]; + if(lce.x == x && lce.y == y) return lce.lights; + + lce.lights.setsize(0); + int csize = 1< &ents = et->getents(); + loopv(ents) + { + const extentity &light = *ents[i]; + if(light.type != ET_LIGHT) continue; + + int radius = light.attr1; + if(radius > 0) + { + if(light.o.x + radius < cx || light.o.x - radius > cx + csize || + light.o.y + radius < cy || light.o.y - radius > cy + csize) + continue; + } + lce.lights.add(i); + } + + lce.x = x; + lce.y = y; + return lce.lights; +} + +static inline void addlight(const extentity &light, int cx, int cy, int cz, int size, const vec *v, const vec *n, const vec *n2) +{ + int radius = light.attr1; + if(radius > 0) + { + if(light.o.x + radius < cx || light.o.x - radius > cx + size || + light.o.y + radius < cy || light.o.y - radius > cy + size || + light.o.z + radius < cz || light.o.z - radius > cz + size) + return; + } + + if(!n2) + { + loopi(4) + { + vec p(light.o); + p.sub(v[i]); + float dist = p.dot(n[i]); + if(dist >= 0 && (!radius || dist < radius)) + { + lights1.add(&light); + return; + } + } + return; + } + + bool plane1 = false, plane2 = false; + loopi(4) + { + vec p(light.o); + p.sub(v[i]); + if(i != 3) + { + float dist = p.dot(n[i]); + if(dist >= 0 && (!radius || dist < radius)) + { + plane1 = true; + if(plane2) break; + } + } + if(i != 1) + { + float dist = p.dot(n2[i > 0 ? i-1 : 0]); + if(dist >= 0 && (!radius || dist < radius)) + { + plane2 = true; + if(plane1) break; + } + } + } + + if(plane1) lights1.add(&light); + if(plane2) lights2.add(&light); +} + +bool find_lights(int cx, int cy, int cz, int size, const vec *v, const vec *n, const vec *n2) +{ + lights1.setsize(0); + lights2.setsize(0); + const vector &ents = et->getents(); + if(size <= 1< &lights = checklightcache(cx, cy); + loopv(lights) + { + const extentity &light = *ents[lights[i]]; + addlight(light, cx, cy, cz, size, v, n, n2); + } + } + else loopv(ents) + { + const extentity &light = *ents[i]; + if(light.type != ET_LIGHT) continue; + addlight(light, cx, cy, cz, size, v, n, n2); + } + return lights1.length() || lights2.length() || hdr.skylight[0]>ambient || hdr.skylight[1]>ambient || hdr.skylight[2]>ambient; +} + +bool setup_surface(plane planes[2], const vec *p, const vec *n, const vec *n2, uchar texcoords[8]) +{ + vec u, v, s, t; + float umin(0.0f), umax(0.0f), + vmin(0.0f), vmax(0.0f), + tmin(0.0f), tmax(0.0f); + + #define COORDMINMAX(u, v, orig, vert) \ + { \ + vec tovert = p[vert]; \ + tovert.sub(p[orig]); \ + float u ## coord = u.dot(tovert), \ + v ## coord = v.dot(tovert); \ + u ## min = min(u ## coord, u ## min); \ + u ## max = max(u ## coord, u ## max); \ + v ## min = min(v ## coord, v ## min); \ + v ## max = max(v ## coord, v ## max); \ + } + + if(!n2) + { + u = (p[0] == p[1] ? p[2] : p[1]); + u.sub(p[0]); + u.normalize(); + v.cross(planes[0], u); + + COORDMINMAX(u, v, 0, 1); + COORDMINMAX(u, v, 0, 2); + COORDMINMAX(u, v, 0, 3); + } + else + { + u = p[2]; + u.sub(p[0]); + u.normalize(); + v.cross(u, planes[0]); + t.cross(planes[1], u); + + COORDMINMAX(u, v, 0, 1); + COORDMINMAX(u, v, 0, 2); + COORDMINMAX(u, t, 0, 2); + COORDMINMAX(u, t, 0, 3); + } + + int scale = int(min(umax - umin, vmax - vmin)); + if(n2) scale = min(scale, int(tmax)); + float lpu = 16.0f / float(scale < (1 << lightlod) ? lightprecision / 2 : lightprecision); + int ul((int)ceil((umax - umin + 1) * lpu)), + vl((int)ceil((vmax - vmin + 1) * lpu)), + tl(0); + vl = max(LM_MINW, vl); + if(n2) + { + tl = (uint)ceil((tmax + 1) * lpu); + tl = max(LM_MINW, tl); + } + lm_w = max(LM_MINW, min(LM_MAXW, ul)); + lm_h = min(LM_MAXH, vl + tl); + + vec origin1(p[0]), origin2, uo(u), vo(v); + uo.mul(umin); + if(!n2) + { + vo.mul(vmin); + } + else + { + vo.mul(vmax); + v.mul(-1); + } + origin1.add(uo); + origin1.add(vo); + + vec ustep(u), vstep(v); + ustep.mul((umax - umin) / (lm_w - 1)); + uint split = vl * lm_h / (vl + tl); + vstep.mul((vmax - vmin) / (split - 1)); + if(!n2) + { + lerpvert lv[4]; + int numv = 4; + calclerpverts(origin1, p, n, ustep, vstep, lv, numv); + + if(!generate_lightmap(lpu, 0, lm_h, origin1, lv, numv, ustep, vstep)) + return false; + } + else + { + origin2 = p[0]; + origin2.add(uo); + vec tstep(t); + tstep.mul(tmax / (lm_h - split - 1)); + + vec p1[3] = {p[0], p[1], p[2]}, + p2[3] = {p[0], p[2], p[3]}; + lerpvert lv1[3], lv2[3]; + int numv1 = 3, numv2 = 3; + calclerpverts(origin1, p1, n, ustep, vstep, lv1, numv1); + calclerpverts(origin2, p2, n2, ustep, tstep, lv2, numv2); + + if(!generate_lightmap(lpu, 0, split, origin1, lv1, numv1, ustep, vstep) || + !generate_lightmap(lpu, split, lm_h, origin2, lv2, numv2, ustep, tstep)) + return false; + } + + #define CALCVERT(origin, u, v, offset, vert) \ + { \ + vec tovert = p[vert]; \ + tovert.sub(origin); \ + float u ## coord = u.dot(tovert), \ + v ## coord = v.dot(tovert); \ + texcoords[vert*2] = uchar(u ## coord * u ## scale); \ + texcoords[vert*2+1] = offset + uchar(v ## coord * v ## scale); \ + } + + float uscale = 255.0f / float(umax - umin), + vscale = 255.0f / float(vmax - vmin) * float(split) / float(lm_h); + CALCVERT(origin1, u, v, 0, 0) + CALCVERT(origin1, u, v, 0, 1) + CALCVERT(origin1, u, v, 0, 2) + if(!n2) + { + CALCVERT(origin1, u, v, 0, 3) + } + else + { + uchar toffset = uchar(255.0 * float(split) / float(lm_h)); + float tscale = 255.0f / float(tmax - tmin) * float(lm_h - split) / float(lm_h); + CALCVERT(origin2, u, t, toffset, 3) + } + return true; +} + +void setup_surfaces(cube &c, int cx, int cy, int cz, int size) +{ + if(c.ext && c.ext->surfaces) + { + loopi(6) if(c.ext->surfaces[i].lmid >= LMID_RESERVED) + { + return; + } + freesurfaces(c); + freenormals(c); + } + vvec vvecs[8]; + bool usefaces[6]; + int vertused = calcverts(c, cx, cy, cz, size, vvecs, usefaces); + vec verts[8]; + loopi(8) if(vertused&(1<merged&(1<mergeorigin&(1<merges[mergeindex++]; + vvec mv[4]; + ivec mo(cx, cy, cz); + genmergedverts(c, i, mo, size, m, mv, planes); + + numplanes = 1; + int msz = calcmergedsize(i, mo, size, m, mv); + mo.mask(~((1<type&(SHADER_NORMALSLMS | SHADER_ENVMAP))) continue; + } + } + else + { + numplanes = genclipplane(c, i, verts, planes); + if(!numplanes) continue; + + vec avg; + if(numplanes >= 2) + { + avg = planes[0]; + avg.add(planes[1]); + avg.normalize(); + } + + loopj(4) + { + int index = faceverts(c, i, j); + const vvec &vv = vvecs[index]; + v[j] = verts[index]; + if(numplanes < 2 || j == 1) findnormal(ivec(cx, cy, cz), vv, planes[0], n[j]); + else if(j==3) findnormal(ivec(cx, cy, cz), vv, planes[1], n2[2]); + else + { + findnormal(ivec(cx, cy, cz), vv, avg, n[j]); + if(j) n2[j-1] = n[j]; + else n2[0] = n[0]; + } + } + + if(!find_lights(cx, cy, cz, size, v, n, numplanes > 1 ? n2 : NULL)) + { + if(!(shader->type&(SHADER_NORMALSLMS | SHADER_ENVMAP))) continue; + } + } + lmtype = LM_DIFFUSE; + lmorient = i; + lmrotate = slot.rotation; + if(shader->type&(SHADER_NORMALSLMS | SHADER_ENVMAP)) + { + if(shader->type&SHADER_NORMALSLMS) lmtype = LM_BUMPMAP0; + newnormals(c); + surfacenormals *cn = c.ext->normals; + cn[i].normals[0] = bvec(n[0]); + cn[i].normals[1] = bvec(n[1]); + cn[i].normals[2] = bvec(n[2]); + cn[i].normals[3] = bvec(numplanes < 2 ? n[3] : n2[2]); + } + if(lights1.empty() && lights2.empty() && hdr.skylight[0]<=ambient && hdr.skylight[1]<=ambient && hdr.skylight[2]<=ambient) continue; + uchar texcoords[8]; + if(!setup_surface(planes, v, n, numplanes >= 2 ? n2 : NULL, texcoords)) + continue; + + CHECK_PROGRESS(return); + newsurfaces(c); + surfaceinfo &surface = c.ext->surfaces[i]; + surface.w = lm_w; + surface.h = lm_h; + memcpy(surface.texcoords, texcoords, 8); + pack_lightmap(lmtype, surface); + } +} + +void generate_lightmaps(cube *c, int cx, int cy, int cz, int size) +{ + CHECK_PROGRESS(return); + + progress++; + + loopi(8) + { + ivec o(i, cx, cy, cz, size); + if(c[i].children) + generate_lightmaps(c[i].children, o.x, o.y, o.z, size >> 1); + if(!c[i].children && !isempty(c[i])) + setup_surfaces(c[i], o.x, o.y, o.z, size); + } +} + +void cleanuplightmaps() +{ + loopv(lightmaps) + { + LightMap &lm = lightmaps[i]; + lm.tex = lm.offsetx = lm.offsety = -1; + } + loopv(lightmaptexs) glDeleteTextures(1, &lightmaptexs[i].id); + lightmaptexs.setsize(0); + if(progresstex) { glDeleteTextures(1, &progresstex); progresstex = 0; } +} + +void resetlightmaps() +{ + cleanuplightmaps(); + lightmaps.setsize(0); + compressed.clear(); +} + +static Uint32 calclight_timer(Uint32 interval, void *param) +{ + check_calclight_progress = true; + return interval; +} + +bool setlightmapquality(int quality) +{ + switch(quality) + { + case 3: shadows = 1; aalights = 3; mmshadows = 2; break; + case 2: shadows = 1; aalights = 3; mmshadows = 1; break; + case 1: shadows = 1; aalights = 3; mmshadows = 0; break; + case 0: shadows = 1; aalights = 2; mmshadows = 0; break; + case -1: shadows = 1; aalights = 1; mmshadows = 0; break; + case -2: shadows = 0; aalights = 0; mmshadows = 0; break; + default: return false; + } + return true; +} + +void calclight(int *quality) +{ + if(!setlightmapquality(*quality)) + { + conoutf(CON_ERROR, "valid range for calclight quality is -2..3"); + return; + } + computescreen("computing lightmaps... (esc to abort)"); + mpremip(true); + resetlightmaps(); + clear_lmids(worldroot); + curlumels = 0; + progress = 0; + progresstexticks = 0; + calclight_canceled = false; + check_calclight_progress = false; + SDL_TimerID timer = SDL_AddTimer(250, calclight_timer, NULL); + Uint32 start = SDL_GetTicks(); + calcnormals(); + show_calclight_progress(); + generate_lightmaps(worldroot, 0, 0, 0, hdr.worldsize >> 1); + clearnormals(); + Uint32 end = SDL_GetTicks(); + if(timer) SDL_RemoveTimer(timer); + uint total = 0, lumels = 0; + loopv(lightmaps) + { + insert_unlit(i); + if(!editmode) lightmaps[i].finalize(); + total += lightmaps[i].lightmaps; + lumels += lightmaps[i].lumels; + } + if(!editmode) compressed.clear(); + initlights(); + computescreen("lighting done..."); + allchanged(); + if(calclight_canceled) + conoutf("calclight aborted"); + else + conoutf("generated %d lightmaps using %d%% of %d textures (%.1f seconds)", + total, + lightmaps.length() ? lumels * 100 / (lightmaps.length() * LM_PACKW * LM_PACKH) : 0, + lightmaps.length(), + (end - start) / 1000.0f); +} + +COMMAND(calclight, "i"); + +VAR(patchnormals, 0, 0, 1); + +void patchlight(int *quality) +{ + if(noedit(true)) return; + if(!setlightmapquality(*quality)) + { + conoutf(CON_ERROR, "valid range for patchlight quality is -2..3"); + return; + } + computescreen("patching lightmaps... (esc to abort)"); + cleanuplightmaps(); + progress = 0; + progresstexticks = 0; + int total = 0, lumels = 0; + loopv(lightmaps) + { + total -= lightmaps[i].lightmaps; + lumels -= lightmaps[i].lumels; + } + curlumels = lumels; + calclight_canceled = false; + check_calclight_progress = false; + SDL_TimerID timer = SDL_AddTimer(250, calclight_timer, NULL); + if(patchnormals) show_out_of_renderloop_progress(0, "computing normals..."); + Uint32 start = SDL_GetTicks(); + if(patchnormals) calcnormals(); + show_calclight_progress(); + generate_lightmaps(worldroot, 0, 0, 0, hdr.worldsize >> 1); + if(patchnormals) clearnormals(); + Uint32 end = SDL_GetTicks(); + if(timer) SDL_RemoveTimer(timer); + loopv(lightmaps) + { + total += lightmaps[i].lightmaps; + lumels += lightmaps[i].lumels; + } + initlights(); + computescreen("lighting done..."); + allchanged(); + if(calclight_canceled) + conoutf("patchlight aborted"); + else + conoutf("patched %d lightmaps using %d%% of %d textures (%.1f seconds)", + total, + lightmaps.length() ? lumels * 100 / (lightmaps.length() * LM_PACKW * LM_PACKH) : 0, + lightmaps.length(), + (end - start) / 1000.0f); +} + +COMMAND(patchlight, "i"); + +void setfullbrightlevel(int fullbrightlevel) +{ + if(lightmaptexs.length() > LMID_BRIGHT) + { + uchar bright[3] = { fullbrightlevel, fullbrightlevel, fullbrightlevel }; + createtexture(lightmaptexs[LMID_BRIGHT].id, 1, 1, bright, 0, false); + } + initlights(); +} + +VARF(fullbright, 0, 0, 1, if(lightmaptexs.length()) initlights()); +VARF(fullbrightlevel, 0, 128, 255, setfullbrightlevel(fullbrightlevel)); + +vector lightmaptexs; + +static void rotatenormals(LightMap &lmlv, int x, int y, int w, int h, int rotate) +{ + bool flipx = rotate>=2 && rotate<=4, + flipy = (rotate>=1 && rotate<=2) || rotate==5, + swapxy = (rotate&5)==1; + uchar *lv = lmlv.data + 3*(y*LM_PACKW + x); + int stride = 3*(LM_PACKW-w); + loopi(h) + { + loopj(w) + { + if(flipx) lv[0] = 255 - lv[0]; + if(flipy) lv[1] = 255 - lv[1]; + if(swapxy) swap(lv[0], lv[1]); + lv += 3; + } + lv += stride; + } +} + +static void rotatenormals(cube *c) +{ + loopi(8) + { + cube &ch = c[i]; + if(ch.children) + { + rotatenormals(ch.children); + continue; + } + else if(!ch.ext || !ch.ext->surfaces) continue; + loopj(6) if(lightmaps.inrange(ch.ext->surfaces[j].lmid+1-LMID_RESERVED)) + { + Slot &slot = lookuptexture(ch.texture[j], false); + if(!slot.rotation || !slot.shader || !(slot.shader->type&SHADER_NORMALSLMS)) + continue; + surfaceinfo &surface = ch.ext->surfaces[j]; + LightMap &lmlv = lightmaps[surface.lmid+1-LMID_RESERVED]; + rotatenormals(lmlv, surface.x, surface.y, surface.w, surface.h, slot.rotation < 4 ? 4-slot.rotation : slot.rotation); + } + } +} + +void fixlightmapnormals() +{ + rotatenormals(worldroot); +} + +static void convertlightmap(LightMap &lmc, LightMap &lmlv, uchar *dst, size_t stride) +{ + const uchar *c = lmc.data; + const bvec *lv = (const bvec *)lmlv.data; + loopi(LM_PACKH) + { + uchar *dstrow = dst; + loopj(LM_PACKW) + { + int z = int(lv->z)*2 - 255, + r = (int(c[0]) * z) / 255, + g = (int(c[1]) * z) / 255, + b = (int(c[2]) * z) / 255; + dstrow[0] = max(r, ambient); + dstrow[1] = max(g, ambient); + dstrow[2] = max(b, ambient); + c += 3; + lv++; + dstrow += 3; + } + dst += stride; + } +} + +static void copylightmap(LightMap &lm, uchar *dst, size_t stride) +{ + const uchar *c = lm.data; + loopi(LM_PACKH) + { + memcpy(dst, c, 3*LM_PACKW); + c += 3*LM_PACKW; + dst += stride; + } +} + +VARF(convertlms, 0, 1, 1, { cleanuplightmaps(); initlights(); allchanged(); }); + +void genreservedlightmaptexs() +{ + while(lightmaptexs.length() < LMID_RESERVED) + { + LightMapTexture &tex = lightmaptexs.add(); + tex.type = renderpath != R_FIXEDFUNCTION && lightmaptexs.length()&1 ? LM_DIFFUSE : LM_BUMPMAP1; + glGenTextures(1, &tex.id); + } + uchar unlit[3] = { ambient, ambient, ambient }; + createtexture(lightmaptexs[LMID_AMBIENT].id, 1, 1, unlit, 0, false); + bvec front(128, 128, 255); + createtexture(lightmaptexs[LMID_AMBIENT1].id, 1, 1, &front, 0, false); + uchar bright[3] = { 128, 128, 128 }; + createtexture(lightmaptexs[LMID_BRIGHT].id, 1, 1, bright, 0, false); + createtexture(lightmaptexs[LMID_BRIGHT1].id, 1, 1, &front, 0, false); + uchar dark[3] = { 0, 0, 0 }; + createtexture(lightmaptexs[LMID_DARK].id, 1, 1, dark, 0, false); + createtexture(lightmaptexs[LMID_DARK1].id, 1, 1, &front, 0, false); +} + +static void findunlit(int i) +{ + LightMap &lm = lightmaps[i]; + if(lm.unlitx>=0) return; + else if(lm.type==LM_BUMPMAP0) + { + if(i+1>=lightmaps.length() || lightmaps[i+1].type!=LM_BUMPMAP1) return; + } + else if(lm.type!=LM_DIFFUSE) return; + uchar *data = lm.data; + loop(y, 2) loop(x, LM_PACKW) + { + if(!data[0] && !data[1] && !data[2]) + { + data[0] = data[1] = data[2] = hdr.ambient; + if(lm.type==LM_BUMPMAP0) ((bvec *)lightmaps[i+1].data)[y*LM_PACKW + x] = bvec(128, 128, 255); + lm.unlitx = x; + lm.unlity = y; + return; + } + if(data[0]==hdr.ambient && data[1]==hdr.ambient && data[2]==hdr.ambient) + { + if(lm.type!=LM_BUMPMAP0 || ((bvec *)lightmaps[i+1].data)[y*LM_PACKW + x] == bvec(128, 128, 255)) + { + lm.unlitx = x; + lm.unlity = y; + return; + } + } + data += 3; + } +} + +VARF(roundlightmaptex, 0, 4, 16, { cleanuplightmaps(); initlights(); allchanged(); }); +VARF(batchlightmaps, 0, 4, 256, { cleanuplightmaps(); initlights(); allchanged(); }); + +void genlightmaptexs() +{ + if(lightmaptexs.length() < LMID_RESERVED) genreservedlightmaptexs(); + + int remaining[3] = { 0, 0, 0 }; + loopv(lightmaps) + { + LightMap &lm = lightmaps[i]; + if(lm.tex >= 0) continue; + remaining[lm.type]++; + if(lm.unlitx < 0) findunlit(i); + } + + if(renderpath==R_FIXEDFUNCTION) + { + remaining[LM_DIFFUSE] += remaining[LM_BUMPMAP0]; + remaining[LM_BUMPMAP0] = remaining[LM_BUMPMAP1] = 0; + } + + extern int maxtexsize; + int sizelimit = (maxtexsize ? min(maxtexsize, hwtexsize) : hwtexsize)/max(LM_PACKW, LM_PACKH); + sizelimit = min(batchlightmaps, sizelimit*sizelimit); + while(remaining[LM_DIFFUSE] || remaining[LM_BUMPMAP0] || remaining[LM_BUMPMAP1]) + { + int type = LM_DIFFUSE; + LightMap *firstlm = NULL; + loopv(lightmaps) + { + LightMap &lm = lightmaps[i]; + if(lm.tex >= 0) continue; + if(renderpath != R_FIXEDFUNCTION) type = lm.type; + else if(lm.type != LM_DIFFUSE && lm.type != LM_BUMPMAP0) continue; + firstlm = &lm; + break; + } + if(!firstlm) break; + int used = 0, uselimit = min(remaining[type], sizelimit); + do used++; while((1<type == LM_BUMPMAP0 && convertlms) ? + new uchar[3*tex.w*tex.h] : + NULL; + int offsetx = 0, offsety = 0; + loopv(lightmaps) + { + LightMap &lm = lightmaps[i]; + if(lm.tex >= 0 || + (renderpath == R_FIXEDFUNCTION ? + lm.type != LM_DIFFUSE && lm.type != LM_BUMPMAP0 : + lm.type != type)) + continue; + + lm.tex = lightmaptexs.length()-1; + lm.offsetx = offsetx; + lm.offsety = offsety; + if(tex.unlitx < 0 && lm.unlitx >= 0) + { + tex.unlitx = offsetx + lm.unlitx; + tex.unlity = offsety + lm.unlity; + } + + if(data) + { + if(renderpath == R_FIXEDFUNCTION && lm.type == LM_BUMPMAP0 && convertlms) + convertlightmap(lm, lightmaps[i+1], &data[3*(offsety*tex.w + offsetx)], 3*tex.w); + else copylightmap(lm, &data[3*(offsety*tex.w + offsetx)], 3*tex.w); + } + + offsetx += LM_PACKW; + if(offsetx >= tex.w) { offsetx = 0; offsety += LM_PACKH; } + if(offsety >= tex.h) break; + } + + glGenTextures(1, &tex.id); + createtexture(tex.id, tex.w, tex.h, data ? data : firstlm->data, 3, false); + if(data) delete[] data; + } +} + +bool brightengeom = false; + +void clearlights() +{ + clearlightcache(); + const vector &ents = et->getents(); + loopv(ents) + { + extentity &e = *ents[i]; + e.light.color = vec(1, 1, 1); + e.light.dir = vec(0, 0, 1); + } + if(nolights) return; + + genlightmaptexs(); + brightengeom = true; +} + +void lightent(extentity &e, float height) +{ + if(e.type==ET_LIGHT) return; + float ambient = hdr.ambient/255.0f; + if(e.type==ET_MAPMODEL) + { + model *m = loadmodel(NULL, e.attr2); + if(m) height = m->above()*0.75f; + } + else if(e.type>=ET_GAMESPECIFIC) ambient = 0.4f; + vec target(e.o.x, e.o.y, e.o.z + height); + lightreaching(target, e.light.color, e.light.dir, &e, ambient); +} + +void updateentlighting() +{ + const vector &ents = et->getents(); + loopv(ents) lightent(*ents[i]); +} + +void initlights() +{ + if(nolights || (fullbright && editmode) || lightmaps.empty()) + { + clearlights(); + return; + } + + clearlightcache(); + updateentlighting(); + genlightmaptexs(); + brightengeom = false; +} + +void lightreaching(const vec &target, vec &color, vec &dir, extentity *t, float ambient) +{ + if(nolights || (fullbright && editmode) || lightmaps.empty()) + { + color = vec(1, 1, 1); + dir = vec(0, 0, 1); + return; + } + + color = dir = vec(0, 0, 0); + const vector &ents = et->getents(); + const vector &lights = checklightcache(int(target.x), int(target.y)); + loopv(lights) + { + extentity &e = *ents[lights[i]]; + if(e.type != ET_LIGHT) + continue; + + vec ray(target); + ray.sub(e.o); + float mag = ray.magnitude(); + if(e.attr1 && mag >= float(e.attr1)) + continue; + + ray.div(mag); + if(shadowray(e.o, ray, mag, RAY_SHADOW | RAY_POLY, t) < mag) + continue; + float intensity = 1; + if(e.attr1) + intensity -= mag / float(e.attr1); + if(e.attached && e.attached->type==ET_SPOTLIGHT) + { + vec spot(vec(e.attached->o).sub(e.o).normalize()); + float maxatten = 1-cosf(max(1, min(90, int(e.attached->attr1)))*RAD); + float spotatten = 1-(1-ray.dot(spot))/maxatten; + if(spotatten<=0) continue; + intensity *= spotatten; + } + + //if(target==player->o) + //{ + // conoutf(CON_DEBUG, "%d - %f %f", i, intensity, mag); + //} + + color.add(vec(e.attr2, e.attr3, e.attr4).div(255).mul(intensity)); + + intensity *= e.attr2*e.attr3*e.attr4; + + if(fabs(mag)<1e-3) dir.add(vec(0, 0, 1)); + else dir.add(vec(e.o).sub(target).mul(intensity/mag)); + } + + if(t && (hdr.skylight[0]>ambient || hdr.skylight[1]>ambient || hdr.skylight[2]>ambient)) + { + uchar skylight[3]; + calcskylight(target, vec(0, 0, 0), 0.5f, skylight, 1, t); + loopk(3) color[k] = min(1.5f, max(max(skylight[k]/255.0f, ambient), color[k])); + } + else loopk(3) + { + float skylight = 0.75f*max(hdr.skylight[k]/255.0f, ambient) + 0.25f*ambient; + color[k] = min(1.5f, max(skylight, color[k])); + } + if(dir.iszero()) dir = vec(0, 0, 1); + else dir.normalize(); +} + +entity *brightestlight(const vec &target, const vec &dir) +{ + const vector &ents = et->getents(); + const vector &lights = checklightcache(int(target.x), int(target.y)); + extentity *brightest = NULL; + float bintensity = 0; + loopv(lights) + { + extentity &e = *ents[lights[i]]; + if(e.type != ET_LIGHT || vec(e.o).sub(target).dot(dir)<0) + continue; + + vec ray(target); + ray.sub(e.o); + float mag = ray.magnitude(); + if(e.attr1 && mag >= float(e.attr1)) + continue; + + ray.div(mag); + if(shadowray(e.o, ray, mag, RAY_SHADOW | RAY_POLY) < mag) + continue; + float intensity = 1; + if(e.attr1) + intensity -= mag / float(e.attr1); + if(e.attached && e.attached->type==ET_SPOTLIGHT) + { + vec spot(vec(e.attached->o).sub(e.o).normalize()); + float maxatten = 1-cosf(max(1, min(90, int(e.attached->attr1)))*RAD); + float spotatten = 1-(1-ray.dot(spot))/maxatten; + if(spotatten<=0) continue; + intensity *= spotatten; + } + + if(!brightest || intensity > bintensity) + { + brightest = &e; + bintensity = intensity; + } + } + return brightest; +} + +static surfaceinfo brightsurfaces[6] = +{ + {{0}, 0, 0, 0, 0, LMID_BRIGHT}, + {{0}, 0, 0, 0, 0, LMID_BRIGHT}, + {{0}, 0, 0, 0, 0, LMID_BRIGHT}, + {{0}, 0, 0, 0, 0, LMID_BRIGHT}, + {{0}, 0, 0, 0, 0, LMID_BRIGHT}, + {{0}, 0, 0, 0, 0, LMID_BRIGHT}, +}; + +void brightencube(cube &c) +{ + if(c.ext && c.ext->surfaces) + { + if(c.ext->surfaces==brightsurfaces) return; + freesurfaces(c); + } + ext(c).surfaces = brightsurfaces; +} + +void newsurfaces(cube &c) +{ + if(!c.ext) newcubeext(c); + if(!c.ext->surfaces || c.ext->surfaces==brightsurfaces) + { + c.ext->surfaces = new surfaceinfo[6]; + memset(c.ext->surfaces, 0, 6*sizeof(surfaceinfo)); + } +} + +void freesurfaces(cube &c) +{ + if(c.ext) + { + if(c.ext->surfaces==brightsurfaces) c.ext->surfaces = NULL; + else DELETEA(c.ext->surfaces); + } +} + +void dumplms() +{ + SDL_Surface *temp; + if((temp = SDL_CreateRGBSurface(SDL_SWSURFACE, LM_PACKW, LM_PACKH, 24, 0x0000FF, 0x00FF00, 0xFF0000, 0))) + { + loopv(lightmaps) + { + for(int idx = 0; idxpixels+temp->pitch*idx; + memcpy(dest, lightmaps[i].data+3*LM_PACKW*(LM_PACKH-1-idx), 3*LM_PACKW); + } + char *map = cl->getclientmap(), *name = strrchr(map, '/'); + s_sprintfd(buf)("lightmap_%s_%d.bmp", name ? name+1 : map, i); + SDL_SaveBMP(temp, buf); + } + SDL_FreeSurface(temp); + } +} + +COMMAND(dumplms, ""); + + diff --git a/src/engine/lightmap.h b/src/engine/lightmap.h new file mode 100644 index 0000000..06382d2 --- /dev/null +++ b/src/engine/lightmap.h @@ -0,0 +1,124 @@ +#define LM_MINW 2 +#define LM_MINH 2 +#define LM_MAXW 128 +#define LM_MAXH 128 +#define LM_PACKW 512 +#define LM_PACKH 512 + +struct PackNode +{ + PackNode *child1, *child2; + ushort x, y, w, h; + int available; + + PackNode() : child1(0), child2(0), x(0), y(0), w(LM_PACKW), h(LM_PACKH), available(min(LM_PACKW, LM_PACKH)) {} + PackNode(ushort x, ushort y, ushort w, ushort h) : child1(0), child2(0), x(x), y(y), w(w), h(h), available(min(w, h)) {} + + void clear() + { + DELETEP(child1); + DELETEP(child2); + } + + ~PackNode() + { + clear(); + } + + bool insert(ushort &tx, ushort &ty, ushort tw, ushort th); +}; + +enum { LM_DIFFUSE = 0, LM_BUMPMAP0, LM_BUMPMAP1 }; + +struct LightMap +{ + int type, tex, offsetx, offsety; + PackNode packroot; + uint lightmaps, lumels; + int unlitx, unlity; + uchar data[3 * LM_PACKW * LM_PACKH]; + + LightMap() + : type(LM_DIFFUSE), tex(-1), offsetx(-1), offsety(-1), + lightmaps(0), lumels(0), unlitx(-1), unlity(-1) + { + memset(data, 0, sizeof(data)); + } + + void finalize() + { + packroot.clear(); + packroot.available = 0; + } + + bool insert(ushort &tx, ushort &ty, uchar *src, ushort tw, ushort th); +}; + +extern vector lightmaps; + +struct LightMapTexture +{ + int w, h, type; + GLuint id; + int unlitx, unlity; + + LightMapTexture() + : w(0), h(0), type(LM_DIFFUSE), id(0), unlitx(-1), unlity(-1) + {} +}; + +extern vector lightmaptexs; + +enum { LMID_AMBIENT = 0, LMID_AMBIENT1, LMID_BRIGHT, LMID_BRIGHT1, LMID_DARK, LMID_DARK1, LMID_RESERVED }; + +extern void clearlights(); +extern void initlights(); +extern void clearlightcache(int e = -1); +extern void resetlightmaps(); +extern void newsurfaces(cube &c); +extern void freesurfaces(cube &c); +extern void brightencube(cube &c); + +struct lerpvert +{ + vec normal; + float u, v; + + bool operator==(const lerpvert &l) const { return u == l.u && v == l.v; } + bool operator!=(const lerpvert &l) const { return u != l.u || v != l.v; } +}; + +struct lerpbounds +{ + const lerpvert *min; + const lerpvert *max; + float u, ustep; + vec normal, nstep; +}; + +extern void calcnormals(); +extern void clearnormals(); +extern void findnormal(const ivec &origin, const vvec &offset, const vec &surface, vec &v); +extern void calclerpverts(const vec &origin, const vec *p, const vec *n, const vec &ustep, const vec &vstep, lerpvert *lv, int &numv); +extern void initlerpbounds(const lerpvert *lv, int numv, lerpbounds &start, lerpbounds &end); +extern void lerpnormal(float v, const lerpvert *lv, int numv, lerpbounds &start, lerpbounds &end, vec &normal, vec &nstep); + +extern void newnormals(cube &c); +extern void freenormals(cube &c); + +#define CHECK_CALCLIGHT_PROGRESS(exit, show_calclight_progress) \ + if(check_calclight_progress) \ + { \ + if(!calclight_canceled) \ + { \ + show_calclight_progress(); \ + check_calclight_canceled(); \ + } \ + if(calclight_canceled) exit; \ + } + +extern bool calclight_canceled; +extern volatile bool check_calclight_progress; + +extern void check_calclight_canceled(); + diff --git a/src/engine/lightning.h b/src/engine/lightning.h new file mode 100644 index 0000000..98b133a --- /dev/null +++ b/src/engine/lightning.h @@ -0,0 +1,103 @@ +#define MAXLIGHTNINGSTEPS 64 +#define LIGHTNINGSTEP 8 +int lnjitterx[MAXLIGHTNINGSTEPS], lnjittery[MAXLIGHTNINGSTEPS]; +int lastlnjitter = 0; + +VAR(lnjittermillis, 0, 100, 1000); +VAR(lnjitterradius, 0, 2, 100); + +static void setuplightning() +{ + if(lastmillis-lastlnjitter > lnjittermillis) + { + lastlnjitter = lastmillis - (lastmillis%lnjittermillis); + loopi(MAXLIGHTNINGSTEPS) + { + lnjitterx[i] = -lnjitterradius + rnd(2*lnjitterradius + 1); + lnjittery[i] = -lnjitterradius + rnd(2*lnjitterradius + 1); + } + } +} + +static void renderlightning(const vec &o, const vec &d, float sz, float tx, float ty, float tsz) +{ + vec step(d); + step.sub(o); + float len = step.magnitude(); + int numsteps = clamp(int(ceil(len/LIGHTNINGSTEP)), 2, MAXLIGHTNINGSTEPS); + step.div(numsteps+1); + int jitteroffset = detrnd(int(o.x+o.y+o.z), MAXLIGHTNINGSTEPS); + vec cur(o), up, right; + up.orthogonal(step); + up.normalize(); + right.cross(up, step); + right.normalize(); + glBegin(GL_QUAD_STRIP); + loopj(numsteps) + { + vec next(cur); + next.add(step); + if(j+1==numsteps) next = d; + else + { + next.add(vec(right).mul(sz*lnjitterx[(j+jitteroffset)%MAXLIGHTNINGSTEPS])); + next.add(vec(up).mul(sz*lnjittery[(j+jitteroffset)%MAXLIGHTNINGSTEPS])); + } + vec dir1 = next, dir2 = next, across; + dir1.sub(cur); + dir2.sub(camera1->o); + across.cross(dir2, dir1).normalize().mul(sz); + float tx1 = j&1 ? tx : tx+tsz, tx2 = j&1 ? tx+tsz : tx; + glTexCoord2f(tx2, ty+tsz); glVertex3f(cur.x-across.x, cur.y-across.y, cur.z-across.z); + glTexCoord2f(tx2, ty); glVertex3f(cur.x+across.x, cur.y+across.y, cur.z+across.z); + if(j+1==numsteps) + { + glTexCoord2f(tx1, ty+tsz); glVertex3f(next.x-across.x, next.y-across.y, next.z-across.z); + glTexCoord2f(tx1, ty); glVertex3f(next.x+across.x, next.y+across.y, next.z+across.z); + } + cur = next; + } + glEnd(); +} + +struct lightningrenderer : listrenderer +{ + lightningrenderer() + : listrenderer("packages/particles/lightning.jpg", PT_LIGHTNING|PT_TRACK|PT_GLARE, 0, 0) + {} + + void startrender() + { + glDisable(GL_CULL_FACE); + } + + void endrender() + { + glEnable(GL_CULL_FACE); + } + + void update() + { + setuplightning(); + } + + void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color) + { + blend = min(blend<<2, 255); + if(type&PT_MOD) //multiply alpha into color + glColor3ub((color[0]*blend)>>8, (color[1]*blend)>>8, (color[2]*blend)>>8); + else + glColor4ub(color[0], color[1], color[2], blend); + float tx = 0, ty = 0, tsz = 1; + if(type&PT_RND4) + { + int i = detrnd((size_t)p, 4); + tx = 0.5f*(i&1); + ty = 0.5f*((i>>1)&1); + tsz = 0.5f; + } + renderlightning(o, d, p->size, tx, ty, tsz); + } +}; +static lightningrenderer lightnings; + diff --git a/src/engine/main.cpp b/src/engine/main.cpp new file mode 100644 index 0000000..9475e1a --- /dev/null +++ b/src/engine/main.cpp @@ -0,0 +1,942 @@ +// main.cpp: initialisation & main loop + +#include "pch.h" +#include "engine.h" + +void cleanup() +{ + cleanupserver(); + SDL_ShowCursor(1); + freeocta(worldroot); + extern void clear_command(); clear_command(); + extern void clear_console(); clear_console(); + extern void clear_mdls(); clear_mdls(); + extern void clear_sound(); clear_sound(); + SDL_Quit(); +} + +void quit() // normal exit +{ + extern void writeinitcfg(); + writeinitcfg(); + writeservercfg(); + abortconnect(); + disconnect(1); + writecfg(); + cleanup(); + exit(EXIT_SUCCESS); +} + +void fatal(const char *s, ...) // failure exit +{ + static int errors = 0; + errors++; + + if(errors <= 2) // print up to one extra recursive error + { + s_sprintfdlv(msg,s,s); + puts(msg); + + if(errors <= 1) // avoid recursion + { + SDL_ShowCursor(1); + #ifdef WIN32 + MessageBox(NULL, msg, "sauerbraten fatal error", MB_OK|MB_SYSTEMMODAL); + #endif + SDL_Quit(); + } + } + + exit(EXIT_FAILURE); +} + +SDL_Surface *screen = NULL; + +int curtime; +int totalmillis = 0, lastmillis = 0; + +dynent *player = NULL; + +static int initing = NOT_INITING; +static bool restoredinits = false; + +bool initwarning(const char *desc, int level, int type) +{ + if(initing < level) + { + addchange(desc, type); + return true; + } + return false; +} + +VARF(scr_w, 320, 1024, 10000, initwarning("screen resolution")); +VARF(scr_h, 200, 768, 10000, initwarning("screen resolution")); +VARF(colorbits, 0, 0, 32, initwarning("color depth")); +VARF(depthbits, 0, 0, 32, initwarning("depth-buffer precision")); +VARF(stencilbits, 0, 1, 32, initwarning("stencil-buffer precision")); +VARF(fsaa, -1, -1, 16, initwarning("anti-aliasing")); +VARF(vsync, -1, -1, 1, initwarning("vertical sync")); + +void writeinitcfg() +{ + if(!restoredinits) return; + FILE *f = openfile("init.cfg", "w"); + if(!f) return; + fprintf(f, "// automatically written on exit, DO NOT MODIFY\n// modify settings in game\n"); + extern int fullscreen; + fprintf(f, "fullscreen %d\n", fullscreen); + fprintf(f, "scr_w %d\n", scr_w); + fprintf(f, "scr_h %d\n", scr_h); + fprintf(f, "colorbits %d\n", colorbits); + fprintf(f, "depthbits %d\n", depthbits); + fprintf(f, "stencilbits %d\n", stencilbits); + fprintf(f, "fsaa %d\n", fsaa); + fprintf(f, "vsync %d\n", vsync); + extern int useshaders, shaderprecision; + fprintf(f, "shaders %d\n", useshaders); + fprintf(f, "shaderprecision %d\n", shaderprecision); + extern int soundchans, soundfreq, soundbufferlen; + fprintf(f, "soundchans %d\n", soundchans); + fprintf(f, "soundfreq %d\n", soundfreq); + fprintf(f, "soundbufferlen %d\n", soundbufferlen); + fclose(f); +} + +void screenshot(char *filename) +{ + SDL_Surface *image = SDL_CreateRGBSurface(SDL_SWSURFACE, screen->w, screen->h, 24, 0x0000FF, 0x00FF00, 0xFF0000, 0); + if(!image) return; + uchar *tmp = new uchar[screen->w*screen->h*3]; + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glReadPixels(0, 0, screen->w, screen->h, GL_RGB, GL_UNSIGNED_BYTE, tmp); + uchar *dst = (uchar *)image->pixels; + loopi(screen->h) + { + memcpy(dst, &tmp[3*screen->w*(screen->h-i-1)], 3*screen->w); + endianswap(dst, 3, screen->w); + dst += image->pitch; + } + delete[] tmp; + if(!filename[0]) + { + static string buf; + s_sprintf(buf)("screenshot_%d.bmp", lastmillis); + filename = buf; + } + else path(filename); + SDL_SaveBMP(image, findfile(filename, "wb")); + SDL_FreeSurface(image); +} + +COMMAND(screenshot, "s"); +COMMAND(quit, ""); + +static void getcomputescreenres(int &w, int &h) +{ + float wk = 1, hk = 1; + if(w < 1024) wk = 1024.0f/w; + if(h < 768) hk = 768.0f/h; + wk = hk = max(wk, hk); + w = int(ceil(w*wk)); + h = int(ceil(h*hk)); +} + +void computescreen(const char *text, Texture *t, const char *overlaytext) +{ + int w = screen->w, h = screen->h; + getcomputescreenres(w, h); + gettextres(w, h); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + glClearColor(0.15f, 0.15f, 0.15f, 1); + glColor3f(1, 1, 1); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, w, h, 0, -1, 1); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + defaultshader->set(); + loopi(2) + { + glClear(GL_COLOR_BUFFER_BIT); + if(text) + { + glPushMatrix(); + glScalef(1/3.0f, 1/3.0f, 1); + draw_text(text, 70, 2*FONTH + FONTH/2); + glPopMatrix(); + } + if(t) + { + glDisable(GL_BLEND); + glBindTexture(GL_TEXTURE_2D, t->id); +#if 0 + int x = (w-640)/2, y = (h-320)/2; + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(0.5f, 0.5f); glVertex2f(x+640/2.0f, y+320/2.0f); + loopj(64+1) + { + float c = 0.5f+0.5f*cosf(2*M_PI*j/64.0f), s = 0.5f+0.5f*sinf(2*M_PI*j/64.0f); + glTexCoord2f(c, 320.0f/640.0f*(s-0.5f)+0.5f); + glVertex2f(x+640*c, y+320*s); + } +#else + int sz = 256, x = (w-sz)/2, y = min(384, h-256); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(x, y); + glTexCoord2f(1, 0); glVertex2f(x+sz, y); + glTexCoord2f(1, 1); glVertex2f(x+sz, y+sz); + glTexCoord2f(0, 1); glVertex2f(x, y+sz); +#endif + glEnd(); + glEnable(GL_BLEND); + } + if(overlaytext) + { + int sz = 256, x = (w-sz)/2, y = min(384, h-256), tw = text_width(overlaytext); + int tx = t && tw < sz*2 - FONTH/3 ? + 2*(x + sz) - tw - FONTH/3 : + 2*(x + sz/2) - tw/2, + ty = t ? + 2*(y + sz) - FONTH*4/3 : + 2*(y + sz/2) - FONTH/2; + glPushMatrix(); + glScalef(1/2.0f, 1/2.0f, 1); + draw_text(overlaytext, tx, ty); + glPopMatrix(); + } + int x = (w-512)/2, y = 128; + settexture("data/sauer_logo_512_256a.png"); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(x, y); + glTexCoord2f(1, 0); glVertex2f(x+512, y); + glTexCoord2f(1, 1); glVertex2f(x+512, y+256); + glTexCoord2f(0, 1); glVertex2f(x, y+256); + glEnd(); + SDL_GL_SwapBuffers(); + } + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); +} + +static void bar(float bar, int w, int o, float r, float g, float b) +{ + int side = 2*FONTH; + float x1 = side, x2 = min(bar, 1.0f)*(w*3-2*side)+side; + float y1 = o*FONTH; + glColor3f(r, g, b); + glBegin(GL_TRIANGLE_STRIP); + loopk(10) + { + float c = cosf(M_PI/2 + k/9.0f*M_PI), s = 1 + sinf(M_PI/2 + k/9.0f*M_PI); + glVertex2f(x2 - c*FONTH, y1 + s*FONTH); + glVertex2f(x1 + c*FONTH, y1 + s*FONTH); + } + glEnd(); + +#if 0 + glColor3f(0.3f, 0.3f, 0.3f); + glBegin(GL_LINE_LOOP); + loopk(10) + { + float c = cosf(M_PI/2 + k/9.0f*M_PI), s = 1 + sinf(M_PI/2 + k/9.0f*M_PI); + glVertex2f(x1 + c*FONTH, y1 + s*FONTH); + } + loopk(10) + { + float c = cosf(M_PI/2 + k/9.0f*M_PI), s = 1 - sinf(M_PI/2 + k/9.0f*M_PI); + glVertex2f(x2 - c*FONTH, y1 + s*FONTH); + } + glEnd(); +#endif +} + +void show_out_of_renderloop_progress(float bar1, const char *text1, float bar2, const char *text2, GLuint tex) // also used during loading +{ + if(!inbetweenframes) return; + + clientkeepalive(); // make sure our connection doesn't time out while loading maps etc. + + #ifdef __APPLE__ + interceptkey(SDLK_UNKNOWN); // keep the event queue awake to avoid 'beachball' cursor + #endif + + int w = screen->w, h = screen->h; + getcomputescreenres(w, h); + gettextres(w, h); + + glDisable(GL_DEPTH_TEST); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, w*3, h*3, 0, -1, 1); + notextureshader->set(); + + glLineWidth(3); + + if(text1) + { + bar(1, w, 4, 0, 0, 0.8f); + if(bar1>0) bar(bar1, w, 4, 0, 0.5f, 1); + } + + if(bar2>0) + { + bar(1, w, 6, 0.5f, 0, 0); + bar(bar2, w, 6, 0.75f, 0, 0); + } + + glLineWidth(1); + + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + defaultshader->set(); + + if(text1) draw_text(text1, 2*FONTH, 4*FONTH + FONTH/2); + if(bar2>0) draw_text(text2, 2*FONTH, 6*FONTH + FONTH/2); + + glDisable(GL_BLEND); + + if(tex) + { + glBindTexture(GL_TEXTURE_2D, tex); + int sz = 256, x = (w-sz)/2, y = min(384, h-256); + sz *= 3; + x *= 3; + y *= 3; + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(x, y); + glTexCoord2f(1, 0); glVertex2f(x+sz, y); + glTexCoord2f(1, 1); glVertex2f(x+sz, y+sz); + glTexCoord2f(0, 1); glVertex2f(x, y+sz); + glEnd(); + } + + glDisable(GL_TEXTURE_2D); + + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glEnable(GL_DEPTH_TEST); + SDL_GL_SwapBuffers(); +} + +void setfullscreen(bool enable) +{ + if(!screen) return; +#if defined(WIN32) || defined(__APPLE__) + initwarning(enable ? "fullscreen" : "windowed"); +#else + if(enable == !(screen->flags&SDL_FULLSCREEN)) + { + SDL_WM_ToggleFullScreen(screen); + SDL_WM_GrabInput((screen->flags&SDL_FULLSCREEN) ? SDL_GRAB_ON : SDL_GRAB_OFF); + } +#endif +} + +#ifdef _DEBUG +VARF(fullscreen, 0, 0, 1, setfullscreen(fullscreen!=0)); +#else +VARF(fullscreen, 0, 1, 1, setfullscreen(fullscreen!=0)); +#endif + +void screenres(int *w, int *h) +{ +#if !defined(WIN32) && !defined(__APPLE__) + if(initing >= INIT_RESET) + { +#endif + scr_w = *w; + scr_h = *h; +#if defined(WIN32) || defined(__APPLE__) + initwarning("screen resolution"); +#else + return; + } + SDL_Surface *surf = SDL_SetVideoMode(*w, *h, 0, SDL_OPENGL|SDL_RESIZABLE|(screen->flags&SDL_FULLSCREEN)); + if(!surf) return; + screen = surf; + scr_w = screen->w; + scr_h = screen->h; + glViewport(0, 0, scr_w, scr_h); +#endif +} + +COMMAND(screenres, "ii"); + +VARFP(gamma, 30, 100, 300, +{ + float f = gamma/100.0f; + if(SDL_SetGamma(f,f,f)==-1) + { + conoutf(CON_ERROR, "Could not set gamma (card/driver doesn't support it?)"); + conoutf(CON_ERROR, "sdl: %s", SDL_GetError()); + } +}); + +void resetgamma() +{ + float f = gamma/100.0f; + if(f==1) return; + SDL_SetGamma(1, 1, 1); + SDL_SetGamma(f, f, f); +} + +void setupscreen(int &usedcolorbits, int &useddepthbits, int &usedfsaa) +{ + int flags = SDL_RESIZABLE; + #if defined(WIN32) || defined(__APPLE__) + flags = 0; + #endif + if(fullscreen) flags |= SDL_FULLSCREEN; + SDL_Rect **modes = SDL_ListModes(NULL, SDL_OPENGL|flags); + if(modes && modes!=(SDL_Rect **)-1) + { + bool hasmode = false; + for(int i = 0; modes[i]; i++) + { + if(scr_w <= modes[i]->w && scr_h <= modes[i]->h) { hasmode = true; break; } + } + if(!hasmode) { scr_w = modes[0]->w; scr_h = modes[0]->h; } + } + bool hasbpp = true; + if(colorbits && modes) + hasbpp = SDL_VideoModeOK(modes!=(SDL_Rect **)-1 ? modes[0]->w : scr_w, modes!=(SDL_Rect **)-1 ? modes[0]->h : scr_h, colorbits, SDL_OPENGL|flags)==colorbits; + + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); +#if SDL_VERSION_ATLEAST(1, 2, 11) + if(vsync>=0) SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, vsync); +#endif + static int configs[] = + { + 0x7, /* try everything */ + 0x6, 0x5, 0x3, /* try disabling one at a time */ + 0x4, 0x2, 0x1, /* try disabling two at a time */ + 0 /* try disabling everything */ + }; + int config = 0; + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0); + if(!depthbits) SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + if(!fsaa) + { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); + } + loopi(sizeof(configs)/sizeof(configs[0])) + { + config = configs[i]; + if(!depthbits && config&1) continue; + if(!stencilbits && config&2) continue; + if(fsaa<=0 && config&4) continue; + if(depthbits) SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, config&1 ? depthbits : 16); + if(stencilbits) + { + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, config&2 ? 1 : 0); + hasstencil = (config&2)!=0; + } + if(fsaa>0) + { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, config&4 ? 1 : 0); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, config&4 ? fsaa : 0); + } + screen = SDL_SetVideoMode(scr_w, scr_h, hasbpp ? colorbits : 0, SDL_OPENGL|flags); + if(screen) break; + } + if(!screen) fatal("Unable to create OpenGL screen: %s", SDL_GetError()); + else + { + if(!hasbpp) conoutf(CON_WARN, "%d bit color buffer not supported - disabling", colorbits); + if(depthbits && (config&1)==0) conoutf(CON_WARN, "%d bit z-buffer not supported - disabling", depthbits); + if(stencilbits && (config&2)==0) conoutf(CON_WARN, "Stencil buffer not supported - disabling"); + if(fsaa>0 && (config&4)==0) conoutf(CON_WARN, "%dx anti-aliasing not supported - disabling", fsaa); + } + + scr_w = screen->w; + scr_h = screen->h; + + #ifdef WIN32 + SDL_WM_GrabInput(SDL_GRAB_ON); + #else + SDL_WM_GrabInput(fullscreen ? SDL_GRAB_ON : SDL_GRAB_OFF); + #endif + + usedcolorbits = hasbpp ? colorbits : 0; + useddepthbits = config&1 ? depthbits : 0; + usedfsaa = config&4 ? fsaa : 0; +} + +void resetgl() +{ + clearchanges(CHANGE_GFX); + + computescreen("resetting OpenGL"); + + extern void cleanupva(); + extern void cleanupparticles(); + extern void cleanupmodels(); + extern void cleanuptextures(); + extern void cleanuplightmaps(); + extern void cleanshadowmap(); + extern void cleanreflections(); + extern void cleanupglare(); + extern void cleanupdepthfx(); + extern void cleanupshaders(); + extern void cleanupgl(); + cleanupva(); + cleanupparticles(); + cleanupmodels(); + cleanuptextures(); + cleanuplightmaps(); + cleanshadowmap(); + cleanreflections(); + cleanupglare(); + cleanupdepthfx(); + cleanupshaders(); + cleanupgl(); + + SDL_SetVideoMode(0, 0, 0, 0); + + int usedcolorbits = 0, useddepthbits = 0, usedfsaa = 0; + setupscreen(usedcolorbits, useddepthbits, usedfsaa); + gl_init(scr_w, scr_h, usedcolorbits, useddepthbits, usedfsaa); + + extern void reloadfonts(); + extern void reloadtextures(); + extern void reloadshaders(); + inbetweenframes = false; + if(!reloadtexture(*notexture) || + !reloadtexture("data/sauer_logo_512_256a.png")) + fatal("failed to reload core texture"); + reloadfonts(); + inbetweenframes = true; + computescreen("initializing..."); + resetgamma(); + reloadshaders(); + reloadtextures(); + initlights(); + allchanged(true); +} + +COMMAND(resetgl, ""); + +void keyrepeat(bool on) +{ + SDL_EnableKeyRepeat(on ? SDL_DEFAULT_REPEAT_DELAY : 0, + SDL_DEFAULT_REPEAT_INTERVAL); +} + +static int ignoremouse = 5, grabmouse = 0; + +vector events; + +void pushevent(const SDL_Event &e) +{ + events.add(e); +} + +bool interceptkey(int sym) +{ + SDL_Event event; + while(SDL_PollEvent(&event)) + { + switch(event.type) + { + case SDL_KEYDOWN: + if(event.key.keysym.sym == sym) + return true; + + default: + pushevent(event); + break; + } + } + return false; +} + +void checkinput() +{ + SDL_Event event; + int lasttype = 0, lastbut = 0; + while(events.length() || SDL_PollEvent(&event)) + { + if(events.length()) event = events.remove(0); + + switch(event.type) + { + case SDL_QUIT: + quit(); + break; + + #if !defined(WIN32) && !defined(__APPLE__) + case SDL_VIDEORESIZE: + screenres(&event.resize.w, &event.resize.h); + break; + #endif + + case SDL_KEYDOWN: + case SDL_KEYUP: + keypress(event.key.keysym.sym, event.key.state==SDL_PRESSED, event.key.keysym.unicode); + break; + + case SDL_ACTIVEEVENT: + if(event.active.state & SDL_APPINPUTFOCUS) + grabmouse = event.active.gain; + else + if(event.active.gain) + grabmouse = 1; + break; + + case SDL_MOUSEMOTION: + if(ignoremouse) { ignoremouse--; break; } + #ifndef WIN32 + if(!(screen->flags&SDL_FULLSCREEN) && grabmouse) + { + #ifdef __APPLE__ + if(event.motion.y == 0) break; //let mac users drag windows via the title bar + #endif + if(event.motion.x == screen->w / 2 && event.motion.y == screen->h / 2) break; + SDL_WarpMouse(screen->w / 2, screen->h / 2); + } + if((screen->flags&SDL_FULLSCREEN) || grabmouse) + #endif + if(!g3d_movecursor(event.motion.xrel, event.motion.yrel)) + mousemove(event.motion.xrel, event.motion.yrel); + break; + + case SDL_MOUSEBUTTONDOWN: + case SDL_MOUSEBUTTONUP: + if(lasttype==event.type && lastbut==event.button.button) break; // why?? get event twice without it + keypress(-event.button.button, event.button.state!=0, 0); + lasttype = event.type; + lastbut = event.button.button; + break; + } + } +} + +VARF(gamespeed, 10, 100, 1000, if(multiplayer()) gamespeed = 100); + +VARF(paused, 0, 0, 1, if(multiplayer()) paused = 0); + +VARP(maxfps, 0, 200, 1000); + +void limitfps(int &millis, int curmillis) +{ + if(!maxfps) return; + static int fpserror = 0; + int delay = 1000/maxfps - (millis-curmillis); + if(delay < 0) fpserror = 0; + else + { + fpserror += 1000%maxfps; + if(fpserror >= maxfps) + { + ++delay; + fpserror -= maxfps; + } + if(delay > 0) + { + SDL_Delay(delay); + millis += delay; + } + } +} + +#if defined(WIN32) && !defined(_DEBUG) && !defined(__GNUC__) +void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep) +{ + if(!ep) fatal("unknown type"); + EXCEPTION_RECORD *er = ep->ExceptionRecord; + CONTEXT *context = ep->ContextRecord; + string out, t; + s_sprintf(out)("Sauerbraten Win32 Exception: 0x%x [0x%x]\n\n", er->ExceptionCode, er->ExceptionCode==EXCEPTION_ACCESS_VIOLATION ? er->ExceptionInformation[1] : -1); + STACKFRAME sf = {{context->Eip, 0, AddrModeFlat}, {}, {context->Ebp, 0, AddrModeFlat}, {context->Esp, 0, AddrModeFlat}, 0}; + SymInitialize(GetCurrentProcess(), NULL, TRUE); + + while(::StackWalk(IMAGE_FILE_MACHINE_I386, GetCurrentProcess(), GetCurrentThread(), &sf, context, NULL, ::SymFunctionTableAccess, ::SymGetModuleBase, NULL)) + { + struct { IMAGEHLP_SYMBOL sym; string n; } si = { { sizeof( IMAGEHLP_SYMBOL ), 0, 0, 0, sizeof(string) } }; + IMAGEHLP_LINE li = { sizeof( IMAGEHLP_LINE ) }; + DWORD off; + if(SymGetSymFromAddr(GetCurrentProcess(), (DWORD)sf.AddrPC.Offset, &off, &si.sym) && SymGetLineFromAddr(GetCurrentProcess(), (DWORD)sf.AddrPC.Offset, &off, &li)) + { + char *del = strrchr(li.FileName, '\\'); + s_sprintf(t)("%s - %s [%d]\n", si.sym.Name, del ? del + 1 : li.FileName, li.LineNumber); + s_strcat(out, t); + } + } + fatal(out); +} +#endif + +#define MAXFPSHISTORY 60 + +int fpspos = 0, fpshistory[MAXFPSHISTORY]; + +void resetfpshistory() +{ + loopi(MAXFPSHISTORY) fpshistory[i] = 1; + fpspos = 0; +} + +void updatefpshistory(int millis) +{ + fpshistory[fpspos++] = max(1, min(1000, millis)); + if(fpspos>=MAXFPSHISTORY) fpspos = 0; +} + +void getfps(int &fps, int &bestdiff, int &worstdiff) +{ + int total = fpshistory[MAXFPSHISTORY-1], best = total, worst = total; + loopi(MAXFPSHISTORY-1) + { + int millis = fpshistory[i]; + total += millis; + if(millis < best) best = millis; + if(millis > worst) worst = millis; + } + + fps = (1000*MAXFPSHISTORY)/total; + bestdiff = 1000/best-fps; + worstdiff = fps-1000/worst; +} + +void getfps_(int *raw) +{ + int fps, bestdiff, worstdiff; + if(*raw) fps = 1000/fpshistory[(fpspos+MAXFPSHISTORY-1)%MAXFPSHISTORY]; + else getfps(fps, bestdiff, worstdiff); + intret(fps); +} + +COMMANDN(getfps, getfps_, "i"); + +bool inbetweenframes = false; + +static bool findarg(int argc, char **argv, const char *str) +{ + for(int i = 1; iiterdynents(0); + emptymap(0, true); + + log("sound"); + initsound(); + + log("cfg"); + exec("data/keymap.cfg"); + exec("data/stdedit.cfg"); + exec("data/menus.cfg"); + exec("data/sounds.cfg"); + exec("data/brush.cfg"); + execfile("mybrushes.cfg"); + if(cl->savedservers()) execfile(cl->savedservers()); + + persistidents = true; + + initing = INIT_LOAD; + if(!execfile(cl->savedconfig())) exec(cl->defaultconfig()); + execfile(cl->autoexec()); + initing = NOT_INITING; + + persistidents = false; + + string gamecfgname; + s_strcpy(gamecfgname, "data/game_"); + s_strcat(gamecfgname, cl->gameident()); + s_strcat(gamecfgname, ".cfg"); + exec(gamecfgname); + + persistidents = true; + + log("localconnect"); + localconnect(); + cc->gameconnect(false); + //cc->changemap(load ? load : cl->defaultmap()); + + if(initscript) execute(initscript); + + log("mainloop"); + + initmumble(); + resetfpshistory(); + + for(;;) + { + static int frames = 0; + int millis = SDL_GetTicks() - clockrealbase; + if(clockfix) millis = int(millis*(double(clockerror)/1000000)); + millis += clockvirtbase; + if(millis200) curtime = 200; + if(paused) curtime = 0; + } + + checkinput(); + + if(lastmillis) cl->updateworld(worldpos, curtime, lastmillis); + + menuprocess(); + + lastmillis += curtime; + totalmillis = millis; + + checksleep(lastmillis); + + serverslice(0); + + if(frames) updatefpshistory(elapsed); + frames++; + + // miscellaneous general game effects + findorientation(); + entity_particles(); + updatevol(); + checkmapsounds(); + + inbetweenframes = false; + if(frames>2) gl_drawframe(screen->w, screen->h); + SDL_GL_SwapBuffers(); + inbetweenframes = true; + } + + ASSERT(0); + return EXIT_FAILURE; + + #if defined(WIN32) && !defined(_DEBUG) && !defined(__GNUC__) + } __except(stackdumper(0, GetExceptionInformation()), EXCEPTION_CONTINUE_SEARCH) { return 0; } + #endif +} diff --git a/src/engine/material.cpp b/src/engine/material.cpp new file mode 100644 index 0000000..610c18f --- /dev/null +++ b/src/engine/material.cpp @@ -0,0 +1,875 @@ +#include "pch.h" +#include "engine.h" + +struct QuadNode +{ + int x, y, size; + uint filled; + QuadNode *child[4]; + + QuadNode(int x, int y, int size) : x(x), y(y), size(size), filled(0) { loopi(4) child[i] = 0; } + + void clear() + { + loopi(4) DELETEP(child[i]); + } + + ~QuadNode() + { + clear(); + } + + void insert(int mx, int my, int msize) + { + if(size == msize) + { + filled = 0xF; + return; + } + int csize = size>>1, i = 0; + if(mx >= x+csize) i |= 1; + if(my >= y+csize) i |= 2; + if(csize == msize) + { + filled |= (1 << i); + return; + } + if(!child[i]) child[i] = new QuadNode(i&1 ? x+csize : x, i&2 ? y+csize : y, csize); + child[i]->insert(mx, my, msize); + loopj(4) if(child[j]) + { + if(child[j]->filled == 0xF) + { + DELETEP(child[j]); + filled |= (1 << j); + } + } + } + + void genmatsurf(uchar mat, uchar orient, int x, int y, int z, int size, materialsurface *&matbuf) + { + materialsurface &m = *matbuf++; + m.material = mat; + m.orient = orient; + m.csize = size; + m.rsize = size; + int dim = dimension(orient); + m.o[C[dim]] = x; + m.o[R[dim]] = y; + m.o[dim] = z; + } + + void genmatsurfs(uchar mat, uchar orient, int z, materialsurface *&matbuf) + { + if(filled == 0xF) genmatsurf(mat, orient, x, y, z, size, matbuf); + else if(filled) + { + int csize = size>>1; + loopi(4) if(filled & (1 << i)) + genmatsurf(mat, orient, i&1 ? x+csize : x, i&2 ? y+csize : y, z, csize, matbuf); + } + loopi(4) if(child[i]) child[i]->genmatsurfs(mat, orient, z, matbuf); + } +}; + +void renderwaterfall(materialsurface &m, Texture *tex, float scale, float offset, uchar mat) +{ + float xf = 8.0f/(tex->xs*scale); + float yf = 8.0f/(tex->ys*scale); + float d = 16.0f*lastmillis; + int dim = dimension(m.orient), + csize = C[dim]==2 ? m.rsize : m.csize, + rsize = R[dim]==2 ? m.rsize : m.csize; + float t = lastmillis; + switch(mat) + { + case MAT_WATER: + t /= renderpath!=R_FIXEDFUNCTION ? 600.0f : 300.0f; + d /= 1000.0f; + break; + case MAT_LAVA: + t /= 2000.0f; + d /= 3000.0f; + break; + } + float wave = m.ends&2 ? (vertwater ? WATER_AMPLITUDE*sinf(t)-WATER_OFFSET : -WATER_OFFSET) : 0; + loopi(4) + { + vec v(m.o.tovec()); + v[dim] += dimcoord(m.orient) ? -offset : offset; + if(i==1 || i==2) v[dim^1] += csize; + if(i<=1) v.z += rsize; + if(m.ends&(i<=1 ? 2 : 1)) v.z += i<=1 ? wave : -WATER_OFFSET-WATER_AMPLITUDE; + glTexCoord2f(xf*v[dim^1], yf*(v.z+d)); + glVertex3fv(v.v); + } + + xtraverts += 4; +} + +void drawmaterial(int orient, int x, int y, int z, int csize, int rsize, float offset) +{ + int dim = dimension(orient), c = C[dim], r = R[dim]; + loopi(4) + { + int coord = fv[orient][i]; + vec v(x, y, z); + v[c] += cubecoords[coord][c]/8*csize; + v[r] += cubecoords[coord][r]/8*rsize; + v[dim] += dimcoord(orient) ? -offset : offset; + glVertex3fv(v.v); + } + xtraverts += 4; +} + +struct material +{ + const char *name; + uchar id; +} materials[] = +{ + {"air", MAT_AIR}, + {"water", MAT_WATER}, + {"clip", MAT_CLIP}, + {"glass", MAT_GLASS}, + {"noclip", MAT_NOCLIP}, + {"lava", MAT_LAVA}, + {"aiclip", MAT_AICLIP}, + {"death", MAT_DEATH} +}; + +int findmaterial(const char *name) +{ + loopi(sizeof(materials)/sizeof(material)) + { + if(!strcmp(materials[i].name, name)) return materials[i].id; + } + return -1; +} + +int visiblematerial(cube &c, int orient, int x, int y, int z, int size, uchar matmask) +{ + if(!c.ext) return MATSURF_NOT_VISIBLE; + uchar mat = c.ext->material&matmask; + switch(mat) + { + case MAT_AIR: + break; + + case MAT_LAVA: + case MAT_WATER: + if(visibleface(c, orient, x, y, z, size, mat, MAT_AIR, matmask)) + return (orient != O_BOTTOM ? MATSURF_VISIBLE : MATSURF_EDIT_ONLY); + break; + + case MAT_GLASS: + if(visibleface(c, orient, x, y, z, size, MAT_GLASS, MAT_AIR, matmask)) + return MATSURF_VISIBLE; + break; + + default: + if(visibleface(c, orient, x, y, z, size, mat, MAT_AIR, matmask)) + return MATSURF_EDIT_ONLY; + break; + } + return MATSURF_NOT_VISIBLE; +} + +void genmatsurfs(cube &c, int cx, int cy, int cz, int size, vector &matsurfs, uchar &vismask, uchar &clipmask) +{ + loopi(6) + { + static uchar matmasks[3] = { MATF_VOLUME, MATF_CLIP, MAT_DEATH }; + int matmask = 0, vis = MATSURF_NOT_VISIBLE; + loopj(sizeof(matmasks)/sizeof(matmasks[0])) + { + matmask = matmasks[j]; + vis = visiblematerial(c, i, cx, cy, cz, size, matmask); + if(vis != MATSURF_NOT_VISIBLE) + { + materialsurface m; + m.material = (vis == MATSURF_EDIT_ONLY ? MAT_EDIT : 0) | (c.ext->material&matmask); + m.orient = i; + m.o = ivec(cx, cy, cz); + m.csize = m.rsize = size; + if(dimcoord(i)) m.o[dimension(i)] += size; + matsurfs.add(m); + if(isclipped(c.ext->material&matmask)) + { + clipmask |= 1<orient), c = C[dim], r = R[dim]; + if(x->o[r] + x->rsize < y->o[r] + y->rsize) return -1; + if(x->o[r] + x->rsize > y->o[r] + y->rsize) return 1; + if(x->o[c] < y->o[c]) return -1; + if(x->o[c] > y->o[c]) return 1; + return 0; +} + +static int mergematr(materialsurface *m, int sz, materialsurface &n) +{ + int dim = dimension(n.orient), c = C[dim], r = R[dim]; + for(int i = sz-1; i >= 0; --i) + { + if(m[i].o[r] + m[i].rsize < n.o[r]) break; + if(m[i].o[r] + m[i].rsize == n.o[r] && m[i].o[c] == n.o[c] && m[i].csize == n.csize) + { + n.o[r] = m[i].o[r]; + n.rsize += m[i].rsize; + memmove(&m[i], &m[i+1], (sz - (i+1)) * sizeof(materialsurface)); + return 1; + } + } + return 0; +} + +static int mergematc(materialsurface &m, materialsurface &n) +{ + int dim = dimension(n.orient), c = C[dim], r = R[dim]; + if(m.o[r] == n.o[r] && m.rsize == n.rsize && m.o[c] + m.csize == n.o[c]) + { + n.o[c] = m.o[c]; + n.csize += m.csize; + return 1; + } + return 0; +} + +static int mergemat(materialsurface *m, int sz, materialsurface &n) +{ + for(bool merged = false; sz; merged = true) + { + int rmerged = mergematr(m, sz, n); + sz -= rmerged; + if(!rmerged && merged) break; + if(!sz) break; + int cmerged = mergematc(m[sz-1], n); + sz -= cmerged; + if(!cmerged) break; + } + m[sz++] = n; + return sz; +} + +static int mergemats(materialsurface *m, int sz) +{ + qsort(m, sz, sizeof(materialsurface), (int (__cdecl *)(const void *, const void *))mergematcmp); + + int nsz = 0; + loopi(sz) nsz = mergemat(m, nsz, m[i]); + return nsz; +} + +static int optmatcmp(const materialsurface *x, const materialsurface *y) +{ + if(x->material < y->material) return -1; + if(x->material > y->material) return 1; + if(x->orient > y->orient) return -1; + if(x->orient < y->orient) return 1; + int dim = dimension(x->orient), xc = x->o[dim], yc = y->o[dim]; + if(xc < yc) return -1; + if(xc > yc) return 1; + return 0; +} + +VARF(optmats, 0, 1, 1, allchanged()); + +int optimizematsurfs(materialsurface *matbuf, int matsurfs) +{ + qsort(matbuf, matsurfs, sizeof(materialsurface), (int (__cdecl *)(const void*, const void*))optmatcmp); + if(!optmats) return matsurfs; + materialsurface *cur = matbuf, *end = matbuf+matsurfs; + while(cur < end) + { + materialsurface *start = cur++; + int dim = dimension(start->orient); + while(cur < end && + cur->material == start->material && + cur->orient == start->orient && + cur->o[dim] == start->o[dim]) + ++cur; + if(!isliquid(start->material) || start->orient != O_TOP || !vertwater) + { + if(start!=matbuf) memmove(matbuf, start, (cur-start)*sizeof(materialsurface)); + matbuf += mergemats(matbuf, cur-start); + } + else if(cur-start>=4) + { + QuadNode vmats(0, 0, hdr.worldsize); + loopi(cur-start) vmats.insert(start[i].o[C[dim]], start[i].o[R[dim]], start[i].csize); + vmats.genmatsurfs(start->material, start->orient, start->o[dim], matbuf); + } + else + { + if(start!=matbuf) memmove(matbuf, start, (cur-start)*sizeof(materialsurface)); + matbuf += cur-start; + } + } + return matsurfs - (end-matbuf); +} + +extern vector valist; + +struct waterinfo +{ + materialsurface *m; + double depth, area; +}; + +void setupmaterials(int start, int len) +{ + int hasmat = 0; + vector water; + unionfind uf; + if(!len) len = valist.length(); + for(int i = start; i < len; i++) + { + vtxarray *va = valist[i]; + loopj(va->matsurfs) + { + materialsurface &m = va->matbuf[j]; + if(m.material==MAT_WATER && m.orient==O_TOP) + { + m.index = water.length(); + loopvk(water) + { + materialsurface &n = *water[k].m; + if(m.o.z!=n.o.z) continue; + if(n.o.x+n.rsize==m.o.x || m.o.x+m.rsize==n.o.x) + { + if(n.o.y+n.csize>m.o.y && n.o.ym.o.x && n.o.xmaterial&MATF_VOLUME)) { m.ends |= 1; break; } + o[dim^1] += lusize; + } + o[dim^1] = minc; + o.z += R[dim]==2 ? m.rsize : m.csize; + o[dim] -= coord ? 2 : -2; + while(o[dim^1] < maxc) + { + cube &c = lookupcube(o.x, o.y, o.z); + if(visiblematerial(c, O_TOP, lu.x, lu.y, lu.z, lusize)) { m.ends |= 2; break; } + o[dim^1] += lusize; + } + } + else if(m.material==MAT_GLASS) + { + if(!hasCM) m.envmap = EMID_NONE; + else + { + int dim = dimension(m.orient); + vec center(m.o.tovec()); + center[R[dim]] += m.rsize/2; + center[C[dim]] += m.csize/2; + m.envmap = closestenvmap(center); + } + } + if(m.material&MATF_VOLUME) hasmat |= 1<attr1 || !n.light || (n.light->attr1 && m.light->attr1 > n.light->attr1))) n.light = m.light; + water[root].depth += water[i].depth; + water[root].area += water[i].area; + } + loopv(water) + { + int root = uf.find(i); + water[i].m->light = water[root].m->light; + water[i].m->depth = (short)(water[root].depth/water[root].area); + } + if(hasmat&(1< ymin && ymax > xmin) continue; + int c = sortorigin[dim]; + if(c > xmin && c < xmax) return 1; + if(c > ymin && c < ymax) return -1; + xmin = abs(xmin - c); + xmax = abs(xmax - c); + ymin = abs(ymin - c); + ymax = abs(ymax - c); + if(max(xmin, xmax) <= min(ymin, ymax)) return 1; + else if(max(ymin, ymax) <= min(xmin, xmax)) return -1; + } + if(x.material < y.material) return 1; + if(x.material > y.material) return -1; + return 0; +} + +extern vtxarray *visibleva, *reflectedva; + +void sortmaterials(vector &vismats) +{ + sortorigin = ivec(camera1->o); + if(reflecting) sortorigin.z = int(reflectz - (camera1->o.z - reflectz)); + vec dir; + vecfromyawpitch(camera1->yaw, reflecting ? -camera1->pitch : camera1->pitch, 1, 0, dir); + loopi(3) { dir[i] = fabs(dir[i]); sortdim[i] = i; } + if(dir[sortdim[2]] > dir[sortdim[1]]) swap(sortdim[2], sortdim[1]); + if(dir[sortdim[1]] > dir[sortdim[0]]) swap(sortdim[1], sortdim[0]); + if(dir[sortdim[2]] > dir[sortdim[1]]) swap(sortdim[2], sortdim[1]); + + for(vtxarray *va = reflecting ? reflectedva : visibleva; va; va = reflecting ? va->rnext : va->next) + { + if(!va->matsurfs || va->occluded >= OCCLUDE_BB) continue; + if(reflecting || refracting>0 ? va->o.z+va->size <= reflectz : va->o.z >= reflectz) continue; + loopi(va->matsurfs) + { + materialsurface &m = va->matbuf[i]; + if(!editmode || !showmat) + { + if(m.material==MAT_WATER && (m.orient==O_TOP || (refracting<0 && reflectz>hdr.worldsize))) continue; + if(m.material&MAT_EDIT) continue; + if(glaring && m.material!=MAT_LAVA) continue; + } + else if(glaring) continue; + vismats.add(&m); + } + } + vismats.sort(vismatcmp); +} + +void rendermatgrid(vector &vismats) +{ + enablepolygonoffset(GL_POLYGON_OFFSET_LINE); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + int lastmat = -1; + glBegin(GL_QUADS); + loopv(vismats) + { + materialsurface &m = *vismats[i]; + int curmat = m.material&~MAT_EDIT; + if(curmat != lastmat) + { + lastmat = curmat; + switch(curmat) + { + case MAT_WATER: glColor3ub( 0, 0, 85); break; // blue + case MAT_CLIP: glColor3ub(85, 0, 0); break; // red + case MAT_GLASS: glColor3ub( 0, 85, 85); break; // cyan + case MAT_NOCLIP: glColor3ub( 0, 85, 0); break; // green + case MAT_LAVA: glColor3ub(85, 40, 0); break; // orange + case MAT_AICLIP: glColor3ub(85, 85, 0); break; // yellow + case MAT_DEATH: glColor3ub(40, 40, 40); break; // black + } + } + drawmaterial(m.orient, m.o.x, m.o.y, m.o.z, m.csize, m.rsize, -0.1f); + } + glEnd(); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + disablepolygonoffset(GL_POLYGON_OFFSET_LINE); +} + +VARP(glassenv, 0, 1, 1); + +void drawglass(int orient, int x, int y, int z, int csize, int rsize, float offset) +{ + int dim = dimension(orient), c = C[dim], r = R[dim]; + loopi(4) + { + int coord = fv[orient][i]; + vec v(x, y, z); + v[c] += cubecoords[coord][c]/8*csize; + v[r] += cubecoords[coord][r]/8*rsize; + v[dim] += dimcoord(orient) ? -offset : offset; + + vec reflect(v); + reflect.sub(camera1->o); + reflect[dim] = -reflect[dim]; + + glTexCoord3f(reflect.x, reflect.y, reflect.z); + glVertex3fv(v.v); + } + xtraverts += 4; +} + +VARP(waterfallenv, 0, 1, 1); + +void rendermaterials() +{ + vector vismats; + sortmaterials(vismats); + if(vismats.empty()) return; + + glDisable(GL_CULL_FACE); + + Slot &wslot = lookuptexture(-MAT_WATER), &lslot = lookuptexture(-MAT_LAVA); + uchar wcol[4], wfcol[4]; + getwatercolour(wcol); + getwaterfallcolour(wfcol); + wcol[3] = wfcol[3] = 192; + int lastorient = -1, lastmat = -1; + GLenum textured = GL_TEXTURE_2D; + bool begin = false, depth = true, blended = false, overbright = false, usedcamera = false, usedwaterfall = false; + ushort envmapped = EMID_NONE; + static const vec normals[6] = + { + vec(-1, 0, 0), + vec( 1, 0, 0), + vec(0, -1, 0), + vec(0, 1, 0), + vec(0, 0, -1), + vec(0, 0, 1) + }; + + static float zerofog[4] = { 0, 0, 0, 1 }; + float oldfogc[4]; + glGetFloatv(GL_FOG_COLOR, oldfogc); + int lastfogtype = 1; + loopv(vismats) + { + materialsurface &m = *vismats[editmode && showmat ? vismats.length()-1-i : i]; + int curmat = !editmode || !showmat || m.material&MAT_EDIT ? m.material : m.material|MAT_EDIT; + if(lastmat!=curmat || lastorient!=m.orient || (curmat==MAT_GLASS && envmapped && m.envmap != envmapped)) + { + int fogtype = lastfogtype; + switch(curmat) + { + case MAT_WATER: + if(lastmat==MAT_WATER && lastorient!=O_TOP && m.orient!=O_TOP) break; + if(begin) { glEnd(); begin = false; } + if(lastmat!=MAT_WATER || (lastorient==O_TOP)!=(m.orient==O_TOP)) + { + if(overbright) { resettmu(0); overbright = false; } + if(m.orient==O_TOP) + { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4ubv(wcol); + foggedshader->set(); + fogtype = 1; + if(!blended) { glEnable(GL_BLEND); blended = true; } + if(depth) { glDepthMask(GL_FALSE); depth = false; } + } + else if(renderpath==R_FIXEDFUNCTION || ((!waterfallrefract || reflecting || refracting) && (!hasCM || !waterfallenv))) + { + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); + glColor3ubv(wfcol); + foggedshader->set(); + fogtype = 0; + if(!blended) { glEnable(GL_BLEND); blended = true; } + if(depth) { glDepthMask(GL_FALSE); depth = false; } + } + else + { + glColor3ubv(wfcol); + fogtype = 1; + + if(!usedcamera) + { + setenvparamf("camera", SHPARAM_VERTEX, 0, camera1->o.x, camera1->o.y, camera1->o.z); + usedcamera = true; + } + + #define SETWATERFALLSHADER(name) \ + do { \ + static Shader *name##shader = NULL; \ + if(!name##shader) name##shader = lookupshaderbyname(#name); \ + name##shader->set(); \ + } while(0) + + if(waterfallrefract && !reflecting && !refracting) + { + if(hasCM && waterfallenv) SETWATERFALLSHADER(waterfallenvrefract); + else SETWATERFALLSHADER(waterfallrefract); + if(blended) { glDisable(GL_BLEND); blended = false; } + if(!depth) { glDepthMask(GL_TRUE); depth = true; } + } + else + { + SETWATERFALLSHADER(waterfallenv); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + if(!blended) { glEnable(GL_BLEND); blended = true; } + if(depth) { glDepthMask(GL_FALSE); depth = false; } + } + + if(!usedwaterfall) + { + Texture *dudv = wslot.sts.inrange(5) ? wslot.sts[5].t : notexture; + float scale = 8.0f/(dudv->ys*wslot.scale); + setlocalparamf("dudvoffset", SHPARAM_PIXEL, 1, 0, scale*16*lastmillis/1000.0f); + + glActiveTexture_(GL_TEXTURE1_ARB); + glBindTexture(GL_TEXTURE_2D, wslot.sts.inrange(4) ? wslot.sts[4].t->id : notexture->id); + glActiveTexture_(GL_TEXTURE2_ARB); + glBindTexture(GL_TEXTURE_2D, wslot.sts.inrange(5) ? wslot.sts[5].t->id : notexture->id); + if(hasCM && waterfallenv) + { + glActiveTexture_(GL_TEXTURE3_ARB); + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, lookupenvmap(wslot)); + } + if(waterfallrefract && (!reflecting || !refracting)) + { + extern void setupwaterfallrefract(GLenum tmu1, GLenum tmu2); + setupwaterfallrefract(GL_TEXTURE4_ARB, GL_TEXTURE0_ARB); + } + else glActiveTexture_(GL_TEXTURE0_ARB); + + usedwaterfall = true; + } + } + } + if(textured!=GL_TEXTURE_2D) + { + if(textured) glDisable(textured); + glEnable(GL_TEXTURE_2D); + textured = GL_TEXTURE_2D; + } + { + int subslot = m.orient==O_TOP ? 0 : 1; + glBindTexture(GL_TEXTURE_2D, wslot.sts.inrange(subslot) ? wslot.sts[subslot].t->id : notexture->id); + } + break; + + case MAT_LAVA: + if(lastmat==MAT_LAVA && lastorient!=O_TOP && m.orient!=O_TOP) break; + if(begin) { glEnd(); begin = false; } + if(lastmat!=MAT_LAVA) + { + if(!depth) { glDepthMask(GL_TRUE); depth = true; } + if(blended) { glDisable(GL_BLEND); blended = false; } + if(renderpath==R_FIXEDFUNCTION && !overbright) { setuptmu(0, "C * T x 2"); overbright = true; } + float t = lastmillis/2000.0f; + t -= floor(t); + t = 1.0f - 2*fabs(t-0.5f); + extern int glare; + if(renderpath!=R_FIXEDFUNCTION && glare) t = 0.625f + 0.075f*t; + else t = 0.5f + 0.5f*t; + glColor3f(t, t, t); + static Shader *lavashader = NULL, *lavaglareshader = NULL; + if(!lavashader) lavashader = lookupshaderbyname("lava"); + if(!lavaglareshader) lavaglareshader = lookupshaderbyname("lavaglare"); + (glaring ? lavaglareshader : lavashader)->set(); + fogtype = 1; + } + if(textured!=GL_TEXTURE_2D) + { + if(textured) glDisable(textured); + glEnable(GL_TEXTURE_2D); + textured = GL_TEXTURE_2D; + } + { + int subslot = m.orient==O_TOP ? 0 : 1; + glBindTexture(GL_TEXTURE_2D, lslot.sts.inrange(subslot) ? lslot.sts[subslot].t->id : notexture->id); + } + break; + + case MAT_GLASS: + if((m.envmap==EMID_NONE || !glassenv || (envmapped==m.envmap && textured==GL_TEXTURE_CUBE_MAP_ARB)) && lastmat==MAT_GLASS) break; + if(begin) { glEnd(); begin = false; } + if(m.envmap!=EMID_NONE && glassenv) + { + if(textured!=GL_TEXTURE_CUBE_MAP_ARB) + { + if(textured) glDisable(textured); + glEnable(GL_TEXTURE_CUBE_MAP_ARB); + textured = GL_TEXTURE_CUBE_MAP_ARB; + } + if(envmapped!=m.envmap) + { + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, lookupenvmap(m.envmap)); + if(renderpath!=R_FIXEDFUNCTION && !usedcamera) + { + setenvparamf("camera", SHPARAM_VERTEX, 0, camera1->o.x, camera1->o.y, camera1->o.z); + usedcamera = true; + } + envmapped = m.envmap; + } + } + if(lastmat!=MAT_GLASS) + { + if(!blended) { glEnable(GL_BLEND); blended = true; } + if(overbright) { resettmu(0); overbright = false; } + if(depth) { glDepthMask(GL_FALSE); depth = false; } + if(m.envmap!=EMID_NONE && glassenv) + { + if(renderpath==R_FIXEDFUNCTION) + { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(0.8f, 0.9f, 1.0f, 0.25f); + fogtype = 1; + } + else + { + glBlendFunc(GL_ONE, GL_SRC_ALPHA); + glColor3f(0, 0.5f, 1.0f); + } + static Shader *glassshader = NULL; + if(!glassshader) glassshader = lookupshaderbyname("glass"); + glassshader->set(); + } + else + { + if(textured) + { + glDisable(textured); + textured = 0; + } + glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); + glColor3f(0.3f, 0.15f, 0.0f); + foggednotextureshader->set(); + fogtype = 0; + } + } + break; + + default: + { + if(lastmat==curmat) break; + if(lastmat < MAT_EDIT) + { + if(begin) { glEnd(); begin = false; } + if(!depth) { glDepthMask(GL_TRUE); depth = true; } + if(!blended) { glEnable(GL_BLEND); blended = true; } + if(overbright) { resettmu(0); overbright = false; } + glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); + if(textured) { glDisable(GL_TEXTURE_2D); textured = 0; } + foggednotextureshader->set(); + fogtype = 0; + } + switch(curmat&~MAT_EDIT) + { + case MAT_WATER: glColor3ub(255, 128, 0); break; // blue + case MAT_CLIP: glColor3ub( 0, 255, 255); break; // red + case MAT_GLASS: glColor3ub(255, 0, 0); break; // cyan + case MAT_NOCLIP: glColor3ub(255, 0, 255); break; // green + case MAT_LAVA: glColor3ub( 0, 128, 255); break; // orange + case MAT_AICLIP: glColor3ub( 0, 0, 255); break; // yellow + case MAT_DEATH: glColor3ub(192, 192, 192); break; // black + } + break; + } + } + lastmat = curmat; + lastorient = m.orient; + if(fogtype!=lastfogtype) + { + glFogfv(GL_FOG_COLOR, fogtype ? oldfogc : zerofog); + lastfogtype = fogtype; + } + } + switch(curmat) + { + case MAT_WATER: + if(m.orient!=O_TOP) + { + if(!begin) { glBegin(GL_QUADS); begin = true; } + if(renderpath!=R_FIXEDFUNCTION && hasCM && waterfallenv) glNormal3fv(normals[m.orient].v); + if(wslot.sts.inrange(1)) + renderwaterfall(m, wslot.sts[1].t, wslot.scale, 0.1f, MAT_WATER); + } + break; + + case MAT_LAVA: + if(m.orient==O_TOP) + { + if(!vertwater && !begin) { glBegin(GL_QUADS); begin = true; } + if(lslot.sts.inrange(0)) + renderlava(m, lslot.sts[0].t, lslot.scale); + } + else + { + if(!begin) { glBegin(GL_QUADS); begin = true; } + if(lslot.sts.inrange(1)) + renderwaterfall(m, lslot.sts[1].t, lslot.scale, 0.1f, MAT_LAVA); + } + break; + + case MAT_GLASS: + if(!begin) { glBegin(GL_QUADS); begin = true; } + if(m.envmap!=EMID_NONE && glassenv) + { + if(renderpath!=R_FIXEDFUNCTION) glNormal3fv(normals[m.orient].v); + drawglass(m.orient, m.o.x, m.o.y, m.o.z, m.csize, m.rsize, 0.1f); + } + else drawmaterial(m.orient, m.o.x, m.o.y, m.o.z, m.csize, m.rsize, 0.1f); + break; + + default: + if(!begin) { glBegin(GL_QUADS); begin = true; } + drawmaterial(m.orient, m.o.x, m.o.y, m.o.z, m.csize, m.rsize, -0.1f); + break; + } + } + + if(begin) glEnd(); + if(!depth) glDepthMask(GL_TRUE); + if(blended) glDisable(GL_BLEND); + if(overbright) resettmu(0); + if(!lastfogtype) glFogfv(GL_FOG_COLOR, oldfogc); + if(editmode && showmat) + { + foggednotextureshader->set(); + rendermatgrid(vismats); + } + + glEnable(GL_CULL_FACE); + if(textured!=GL_TEXTURE_2D) + { + if(textured) glDisable(textured); + glEnable(GL_TEXTURE_2D); + } +} + diff --git a/src/engine/md2.h b/src/engine/md2.h new file mode 100644 index 0000000..579fde8 --- /dev/null +++ b/src/engine/md2.h @@ -0,0 +1,319 @@ +struct md2; + +md2 *loadingmd2 = 0; + +float md2normaltable[256][3] = +{ + { -0.525731f, 0.000000f, 0.850651f }, { -0.442863f, 0.238856f, 0.864188f }, { -0.295242f, 0.000000f, 0.955423f }, { -0.309017f, 0.500000f, 0.809017f }, + { -0.162460f, 0.262866f, 0.951056f }, { 0.000000f, 0.000000f, 1.000000f }, { 0.000000f, 0.850651f, 0.525731f }, { -0.147621f, 0.716567f, 0.681718f }, + { 0.147621f, 0.716567f, 0.681718f }, { 0.000000f, 0.525731f, 0.850651f }, { 0.309017f, 0.500000f, 0.809017f }, { 0.525731f, 0.000000f, 0.850651f }, + { 0.295242f, 0.000000f, 0.955423f }, { 0.442863f, 0.238856f, 0.864188f }, { 0.162460f, 0.262866f, 0.951056f }, { -0.681718f, 0.147621f, 0.716567f }, + { -0.809017f, 0.309017f, 0.500000f }, { -0.587785f, 0.425325f, 0.688191f }, { -0.850651f, 0.525731f, 0.000000f }, { -0.864188f, 0.442863f, 0.238856f }, + { -0.716567f, 0.681718f, 0.147621f }, { -0.688191f, 0.587785f, 0.425325f }, { -0.500000f, 0.809017f, 0.309017f }, { -0.238856f, 0.864188f, 0.442863f }, + { -0.425325f, 0.688191f, 0.587785f }, { -0.716567f, 0.681718f, -0.147621f }, { -0.500000f, 0.809017f, -0.309017f }, { -0.525731f, 0.850651f, 0.000000f }, + { 0.000000f, 0.850651f, -0.525731f }, { -0.238856f, 0.864188f, -0.442863f }, { 0.000000f, 0.955423f, -0.295242f }, { -0.262866f, 0.951056f, -0.162460f }, + { 0.000000f, 1.000000f, 0.000000f }, { 0.000000f, 0.955423f, 0.295242f }, { -0.262866f, 0.951056f, 0.162460f }, { 0.238856f, 0.864188f, 0.442863f }, + { 0.262866f, 0.951056f, 0.162460f }, { 0.500000f, 0.809017f, 0.309017f }, { 0.238856f, 0.864188f, -0.442863f }, { 0.262866f, 0.951056f, -0.162460f }, + { 0.500000f, 0.809017f, -0.309017f }, { 0.850651f, 0.525731f, 0.000000f }, { 0.716567f, 0.681718f, 0.147621f }, { 0.716567f, 0.681718f, -0.147621f }, + { 0.525731f, 0.850651f, 0.000000f }, { 0.425325f, 0.688191f, 0.587785f }, { 0.864188f, 0.442863f, 0.238856f }, { 0.688191f, 0.587785f, 0.425325f }, + { 0.809017f, 0.309017f, 0.500000f }, { 0.681718f, 0.147621f, 0.716567f }, { 0.587785f, 0.425325f, 0.688191f }, { 0.955423f, 0.295242f, 0.000000f }, + { 1.000000f, 0.000000f, 0.000000f }, { 0.951056f, 0.162460f, 0.262866f }, { 0.850651f, -0.525731f, 0.000000f }, { 0.955423f, -0.295242f, 0.000000f }, + { 0.864188f, -0.442863f, 0.238856f }, { 0.951056f, -0.162460f, 0.262866f }, { 0.809017f, -0.309017f, 0.500000f }, { 0.681718f, -0.147621f, 0.716567f }, + { 0.850651f, 0.000000f, 0.525731f }, { 0.864188f, 0.442863f, -0.238856f }, { 0.809017f, 0.309017f, -0.500000f }, { 0.951056f, 0.162460f, -0.262866f }, + { 0.525731f, 0.000000f, -0.850651f }, { 0.681718f, 0.147621f, -0.716567f }, { 0.681718f, -0.147621f, -0.716567f }, { 0.850651f, 0.000000f, -0.525731f }, + { 0.809017f, -0.309017f, -0.500000f }, { 0.864188f, -0.442863f, -0.238856f }, { 0.951056f, -0.162460f, -0.262866f }, { 0.147621f, 0.716567f, -0.681718f }, + { 0.309017f, 0.500000f, -0.809017f }, { 0.425325f, 0.688191f, -0.587785f }, { 0.442863f, 0.238856f, -0.864188f }, { 0.587785f, 0.425325f, -0.688191f }, + { 0.688191f, 0.587785f, -0.425325f }, { -0.147621f, 0.716567f, -0.681718f }, { -0.309017f, 0.500000f, -0.809017f }, { 0.000000f, 0.525731f, -0.850651f }, + { -0.525731f, 0.000000f, -0.850651f }, { -0.442863f, 0.238856f, -0.864188f }, { -0.295242f, 0.000000f, -0.955423f }, { -0.162460f, 0.262866f, -0.951056f }, + { 0.000000f, 0.000000f, -1.000000f }, { 0.295242f, 0.000000f, -0.955423f }, { 0.162460f, 0.262866f, -0.951056f }, { -0.442863f, -0.238856f, -0.864188f }, + { -0.309017f, -0.500000f, -0.809017f }, { -0.162460f, -0.262866f, -0.951056f }, { 0.000000f, -0.850651f, -0.525731f }, { -0.147621f, -0.716567f, -0.681718f }, + { 0.147621f, -0.716567f, -0.681718f }, { 0.000000f, -0.525731f, -0.850651f }, { 0.309017f, -0.500000f, -0.809017f }, { 0.442863f, -0.238856f, -0.864188f }, + { 0.162460f, -0.262866f, -0.951056f }, { 0.238856f, -0.864188f, -0.442863f }, { 0.500000f, -0.809017f, -0.309017f }, { 0.425325f, -0.688191f, -0.587785f }, + { 0.716567f, -0.681718f, -0.147621f }, { 0.688191f, -0.587785f, -0.425325f }, { 0.587785f, -0.425325f, -0.688191f }, { 0.000000f, -0.955423f, -0.295242f }, + { 0.000000f, -1.000000f, 0.000000f }, { 0.262866f, -0.951056f, -0.162460f }, { 0.000000f, -0.850651f, 0.525731f }, { 0.000000f, -0.955423f, 0.295242f }, + { 0.238856f, -0.864188f, 0.442863f }, { 0.262866f, -0.951056f, 0.162460f }, { 0.500000f, -0.809017f, 0.309017f }, { 0.716567f, -0.681718f, 0.147621f }, + { 0.525731f, -0.850651f, 0.000000f }, { -0.238856f, -0.864188f, -0.442863f }, { -0.500000f, -0.809017f, -0.309017f }, { -0.262866f, -0.951056f, -0.162460f }, + { -0.850651f, -0.525731f, 0.000000f }, { -0.716567f, -0.681718f, -0.147621f }, { -0.716567f, -0.681718f, 0.147621f }, { -0.525731f, -0.850651f, 0.000000f }, + { -0.500000f, -0.809017f, 0.309017f }, { -0.238856f, -0.864188f, 0.442863f }, { -0.262866f, -0.951056f, 0.162460f }, { -0.864188f, -0.442863f, 0.238856f }, + { -0.809017f, -0.309017f, 0.500000f }, { -0.688191f, -0.587785f, 0.425325f }, { -0.681718f, -0.147621f, 0.716567f }, { -0.442863f, -0.238856f, 0.864188f }, + { -0.587785f, -0.425325f, 0.688191f }, { -0.309017f, -0.500000f, 0.809017f }, { -0.147621f, -0.716567f, 0.681718f }, { -0.425325f, -0.688191f, 0.587785f }, + { -0.162460f, -0.262866f, 0.951056f }, { 0.442863f, -0.238856f, 0.864188f }, { 0.162460f, -0.262866f, 0.951056f }, { 0.309017f, -0.500000f, 0.809017f }, + { 0.147621f, -0.716567f, 0.681718f }, { 0.000000f, -0.525731f, 0.850651f }, { 0.425325f, -0.688191f, 0.587785f }, { 0.587785f, -0.425325f, 0.688191f }, + { 0.688191f, -0.587785f, 0.425325f }, { -0.955423f, 0.295242f, 0.000000f }, { -0.951056f, 0.162460f, 0.262866f }, { -1.000000f, 0.000000f, 0.000000f }, + { -0.850651f, 0.000000f, 0.525731f }, { -0.955423f, -0.295242f, 0.000000f }, { -0.951056f, -0.162460f, 0.262866f }, { -0.864188f, 0.442863f, -0.238856f }, + { -0.951056f, 0.162460f, -0.262866f }, { -0.809017f, 0.309017f, -0.500000f }, { -0.864188f, -0.442863f, -0.238856f }, { -0.951056f, -0.162460f, -0.262866f }, + { -0.809017f, -0.309017f, -0.500000f }, { -0.681718f, 0.147621f, -0.716567f }, { -0.681718f, -0.147621f, -0.716567f }, { -0.850651f, 0.000000f, -0.525731f }, + { -0.688191f, 0.587785f, -0.425325f }, { -0.587785f, 0.425325f, -0.688191f }, { -0.425325f, 0.688191f, -0.587785f }, { -0.425325f, -0.688191f, -0.587785f }, + { -0.587785f, -0.425325f, -0.688191f }, { -0.688191f, -0.587785f, -0.425325f } +}; + +struct md2 : vertmodel +{ + struct md2_header + { + int magic; + int version; + int skinwidth, skinheight; + int framesize; + int numskins, numvertices, numtexcoords; + int numtriangles, numglcommands, numframes; + int offsetskins, offsettexcoords, offsettriangles; + int offsetframes, offsetglcommands, offsetend; + }; + + struct md2_vertex + { + uchar vertex[3], normalindex; + }; + + struct md2_frame + { + float scale[3]; + float translate[3]; + char name[16]; + }; + + md2(const char *name) : vertmodel(name) {} + + int type() const { return MDL_MD2; } + + int linktype(animmodel *m) const { return LINK_COOP; } + + struct md2meshgroup : vertmeshgroup + { + void genverts(int *glcommands, vector &tcverts, vector &vindexes, vector &tris) + { + hashtable tchash; + vector idxs; + for(int *command = glcommands; (*command)!=0;) + { + int numvertex = *command++; + bool isfan = numvertex<0; + if(isfan) numvertex = -numvertex; + idxs.setsizenodelete(0); + loopi(numvertex) + { + union { int i; float f; } u, v; + u.i = *command++; + v.i = *command++; + int vindex = *command++; + ivec tckey(u.i, v.i, vindex); + int *idx = tchash.access(tckey); + if(!idx) + { + idx = &tchash[tckey]; + *idx = tcverts.length(); + tcvert &tc = tcverts.add(); + tc.u = u.f; + tc.v = v.f; + vindexes.add((ushort)vindex); + } + idxs.add(*idx); + } + loopi(numvertex-2) + { + tri &t = tris.add(); + if(isfan) + { + t.vert[0] = idxs[0]; + t.vert[1] = idxs[i+1]; + t.vert[2] = idxs[i+2]; + } + else loopk(3) t.vert[k] = idxs[i&1 && k ? i+(1-(k-1))+1 : i+k]; + } + } + } + + bool load(char *filename) + { + FILE *file = openfile(filename, "rb"); + if(!file) return false; + + md2_header header; + fread(&header, sizeof(md2_header), 1, file); + endianswap(&header, sizeof(int), sizeof(md2_header)/sizeof(int)); + + if(header.magic!=844121161 || header.version!=8) + { + fclose(file); + return false; + } + + name = newstring(filename); + + numframes = header.numframes; + + vertmesh &m = *new vertmesh; + m.group = this; + meshes.add(&m); + + int *glcommands = new int[header.numglcommands]; + fseek(file, header.offsetglcommands, SEEK_SET); + int numglcommands = fread(glcommands, sizeof(int), header.numglcommands, file); + endianswap(glcommands, sizeof(int), numglcommands); + if(numglcommands < header.numglcommands) memset(&glcommands[numglcommands], 0, (header.numglcommands-numglcommands)*sizeof(int)); + + vector tcgen; + vector vgen; + vector trigen; + genverts(glcommands, tcgen, vgen,trigen); + delete[] glcommands; + + m.numverts = tcgen.length(); + + m.tcverts = new tcvert[m.numverts]; + memcpy(m.tcverts, tcgen.getbuf(), m.numverts*sizeof(tcvert)); + m.numtris = trigen.length(); + m.tris = new tri[m.numtris]; + memcpy(m.tris, trigen.getbuf(), m.numtris*sizeof(tri)); + + m.verts = new vert[m.numverts*numframes]; + + md2_vertex *tmpverts = new md2_vertex[header.numvertices]; + int frame_offset = header.offsetframes; + vert *curvert = m.verts; + loopi(header.numframes) + { + md2_frame frame; + fseek(file, frame_offset, SEEK_SET); + fread(&frame, sizeof(md2_frame), 1, file); + endianswap(&frame, sizeof(float), 6); + + fread(tmpverts, sizeof(md2_vertex), header.numvertices, file); + loopj(m.numverts) + { + const md2_vertex &v = tmpverts[vgen[j]]; + curvert->pos = vec(v.vertex[0]*frame.scale[0]+frame.translate[0], + -(v.vertex[1]*frame.scale[1]+frame.translate[1]), + v.vertex[2]*frame.scale[2]+frame.translate[2]); + const float *norm = md2normaltable[v.normalindex]; + curvert->norm = vec(norm[0], -norm[1], norm[2]); + curvert++; + } + frame_offset += header.framesize; + } + delete[] tmpverts; + + fclose(file); + + return true; + } + }; + + struct md2part : part + { + void getdefaultanim(animinfo &info, int anim, uint varseed, dynent *d) + { + // 0 3 6 7 8 9 10 11 12 13 14 15 16 17 + // D D D D D D A P I R, E J T W FO SA GS GI + static int _frame[] = { 178, 184, 190, 183, 189, 197, 46, 54, 0, 40, 162, 67, 95, 112, 72, 84, 7, 6 }; + static int _range[] = { 6, 6, 8, 1, 1, 1, 8, 4, 40, 6, 1, 1, 17, 11, 12, 11, 18, 1 }; + // DE DY I F B L R PU SH PA J SI SW ED LA T WI LO GS GI + static int animfr[] = { 5, 2, 8, 9, 9, 9, 9, 6, 6, 7, 11, 8, 9, 10, 14, 12, 13, 15, 16, 17 }; + + anim &= ANIM_INDEX; + if((size_t)anim >= sizeof(animfr)/sizeof(animfr[0])) + { + info.frame = 0; + info.range = 1; + return; + } + int n = animfr[anim]; + if(anim==ANIM_DYING || anim==ANIM_DEAD) n -= varseed%3; + info.frame = _frame[n]; + info.range = _range[n]; + } + }; + + void extendbb(int frame, vec ¢er, vec &radius, modelattach &a) + { + vec acenter, aradius; + a.m->boundbox(frame, acenter, aradius); + vec bbmin, bbmax; + loopi(3) + { + bbmin[i] = min(acenter[i]-aradius[i], center[i]-radius[i]); + bbmax[i] = max(acenter[i]+aradius[i], center[i]+radius[i]); + } + radius = bbmax; + radius.sub(bbmin).mul(0.5f); + center = bbmin; + center.add(radius); + } + + meshgroup *loadmeshes(char *name, va_list args) + { + md2meshgroup *group = new md2meshgroup; + if(!group->load(name)) { delete group; return NULL; } + return group; + } + + bool load() + { + if(loaded) return true; + part &mdl = *new md2part; + parts.add(&mdl); + mdl.model = this; + mdl.index = 0; + const char *pname = parentdir(loadname); + s_sprintfd(name1)("packages/models/%s/tris.md2", loadname); + mdl.meshes = sharemeshes(path(name1)); + if(!mdl.meshes) + { + s_sprintfd(name2)("packages/models/%s/tris.md2", pname); // try md2 in parent folder (vert sharing) + mdl.meshes = sharemeshes(path(name2)); + if(!mdl.meshes) return false; + } + Texture *tex, *masks; + loadskin(loadname, pname, tex, masks); + mdl.initskins(tex, masks); + if(tex==notexture) conoutf("could not load model skin for %s", name1); + loadingmd2 = this; + persistidents = false; + s_sprintfd(name3)("packages/models/%s/md2.cfg", loadname); + if(!execfile(name3)) + { + s_sprintf(name3)("packages/models/%s/md2.cfg", pname); + execfile(name3); + } + persistidents = true; + loadingmd2 = 0; + loopv(parts) parts[i]->meshes = parts[i]->meshes->scaleverts(scale/4.0f, i ? vec(0, 0, 0) : vec(translate.x, -translate.y, translate.z)); + return loaded = true; + } +}; + +void md2pitch(float *pitchscale, float *pitchoffset, float *pitchmin, float *pitchmax) +{ + if(!loadingmd2 || loadingmd2->parts.empty()) { conoutf("not loading an md2"); return; } + md2::part &mdl = *loadingmd2->parts.last(); + + mdl.pitchscale = *pitchscale; + mdl.pitchoffset = *pitchoffset; + if(*pitchmin || *pitchmax) + { + mdl.pitchmin = *pitchmin; + mdl.pitchmax = *pitchmax; + } + else + { + mdl.pitchmin = -360*mdl.pitchscale; + mdl.pitchmax = 360*mdl.pitchscale; + } +} + +void md2anim(char *anim, int *frame, int *range, float *speed, int *priority) +{ + if(!loadingmd2 || loadingmd2->parts.empty()) { conoutf("not loading an md2"); return; } + vector anims; + findanims(anim, anims); + if(anims.empty()) conoutf("could not find animation %s", anim); + else loopv(anims) + { + loadingmd2->parts.last()->setanim(0, anims[i], *frame, *range, *speed, *priority); + } +} + +COMMAND(md2pitch, "ffff"); +COMMAND(md2anim, "siifi"); + diff --git a/src/engine/md3.h b/src/engine/md3.h new file mode 100644 index 0000000..4a092ca --- /dev/null +++ b/src/engine/md3.h @@ -0,0 +1,412 @@ +struct md3; + +md3 *loadingmd3 = NULL; + +string md3dir; + +struct md3frame +{ + vec bbmin, bbmax, origin; + float radius; + uchar name[16]; +}; + +struct md3tag +{ + char name[64]; + vec pos; + float rotation[3][3]; +}; + +struct md3vertex +{ + short vertex[3]; + short normal; +}; + +struct md3triangle +{ + int vertexindices[3]; +}; + +struct md3header +{ + char id[4]; + int version; + char name[64]; + int flags; + int numframes, numtags, nummeshes, numskins; + int ofs_frames, ofs_tags, ofs_meshes, ofs_eof; // offsets +}; + +struct md3meshheader +{ + char id[4]; + char name[64]; + int flags; + int numframes, numshaders, numvertices, numtriangles; + int ofs_triangles, ofs_shaders, ofs_uv, ofs_vertices, meshsize; // offsets +}; + +struct md3 : vertmodel +{ + md3(const char *name) : vertmodel(name) {} + + int type() const { return MDL_MD3; } + + struct md3meshgroup : vertmeshgroup + { + bool load(char *path) + { + FILE *f = openfile(path, "rb"); + if(!f) return false; + md3header header; + fread(&header, sizeof(md3header), 1, f); + endianswap(&header.version, sizeof(int), 1); + endianswap(&header.flags, sizeof(int), 9); + if(strncmp(header.id, "IDP3", 4) != 0 || header.version != 15) // header check + { + fclose(f); + conoutf("md3: corrupted header"); + return false; + } + + name = newstring(path); + + numframes = header.numframes; + numtags = header.numtags; + if(numtags) + { + tags = new tag[numframes*numtags]; + fseek(f, header.ofs_tags, SEEK_SET); + md3tag tag; + + loopi(header.numframes*header.numtags) + { + fread(&tag, sizeof(md3tag), 1, f); + endianswap(&tag.pos, sizeof(float), 12); + if(tag.name[0] && i>8)&0xFF)*PI2/255.0f; + m.verts[j].norm.x = cosf(lat)*sinf(lng); + m.verts[j].norm.y = -sinf(lat)*sinf(lng); + m.verts[j].norm.z = cosf(lng); + } + + mesh_offset += mheader.meshsize; + } + + fclose(f); + return true; + } + }; + + void extendbb(int frame, vec ¢er, vec &radius, modelattach &a) + { + vec acenter, aradius; + a.m->boundbox(frame, acenter, aradius); + float margin = 2*max(aradius.x, max(aradius.y, aradius.z)); + radius.x += margin; + radius.y += margin; + } + + meshgroup *loadmeshes(char *name, va_list args) + { + md3meshgroup *group = new md3meshgroup; + if(!group->load(name)) { delete group; return NULL; } + return group; + } + + bool loaddefaultparts() + { + const char *pname = parentdir(loadname); + part &mdl = *new part; + parts.add(&mdl); + mdl.model = this; + mdl.index = 0; + s_sprintfd(name1)("packages/models/%s/tris.md3", loadname); + mdl.meshes = sharemeshes(path(name1)); + if(!mdl.meshes) + { + s_sprintfd(name2)("packages/models/%s/tris.md3", pname); // try md3 in parent folder (vert sharing) + mdl.meshes = sharemeshes(path(name2)); + if(!mdl.meshes) return false; + } + Texture *tex, *masks; + loadskin(loadname, pname, tex, masks); + mdl.initskins(tex, masks); + if(tex==notexture) conoutf("could not load model skin for %s", name1); + return true; + } + + bool load() + { + if(loaded) return true; + s_sprintf(md3dir)("packages/models/%s", loadname); + s_sprintfd(cfgname)("packages/models/%s/md3.cfg", loadname); + + loadingmd3 = this; + persistidents = false; + if(execfile(cfgname) && parts.length()) // configured md3, will call the md3* commands below + { + persistidents = true; + loadingmd3 = NULL; + loopv(parts) if(!parts[i]->meshes) return false; + } + else // md3 without configuration, try default tris and skin + { + persistidents = true; + loadingmd3 = NULL; + if(!loaddefaultparts()) return false; + } + loopv(parts) parts[i]->meshes = parts[i]->meshes->scaleverts(scale/4.0f, i ? vec(0, 0, 0) : vec(translate.x, -translate.y, translate.z)); + return loaded = true; + } +}; + +void md3load(char *model) +{ + if(!loadingmd3) { conoutf("not loading an md3"); return; } + s_sprintfd(filename)("%s/%s", md3dir, model); + md3::part &mdl = *new md3::part; + loadingmd3->parts.add(&mdl); + mdl.model = loadingmd3; + mdl.index = loadingmd3->parts.length()-1; + if(mdl.index) mdl.pitchscale = mdl.pitchoffset = mdl.pitchmin = mdl.pitchmax = 0; + mdl.meshes = loadingmd3->sharemeshes(path(filename)); + if(!mdl.meshes) conoutf("could not load %s", filename); // ignore failure + else mdl.initskins(); +} + +void md3pitch(float *pitchscale, float *pitchoffset, float *pitchmin, float *pitchmax) +{ + if(!loadingmd3 || loadingmd3->parts.empty()) { conoutf("not loading an md3"); return; } + md3::part &mdl = *loadingmd3->parts.last(); + + mdl.pitchscale = *pitchscale; + mdl.pitchoffset = *pitchoffset; + if(*pitchmin || *pitchmax) + { + mdl.pitchmin = *pitchmin; + mdl.pitchmax = *pitchmax; + } + else + { + mdl.pitchmin = -360*mdl.pitchscale; + mdl.pitchmax = 360*mdl.pitchscale; + } +} + +#define loopmd3meshes(meshname, m, body) \ + if(!loadingmd3 || loadingmd3->parts.empty()) { conoutf("not loading an md3"); return; } \ + md3::part &mdl = *loadingmd3->parts.last(); \ + if(!mdl.meshes) return; \ + loopv(mdl.meshes->meshes) \ + { \ + md3::vertmesh &m = *(md3::vertmesh *)mdl.meshes->meshes[i]; \ + if(!strcmp(meshname, "*") || !strcmp(m.name, meshname)) \ + { \ + body; \ + } \ + } + +#define loopmd3skins(meshname, s, body) loopmd3meshes(meshname, m, { md3::skin &s = mdl.skins[i]; body; }) + +void md3skin(char *meshname, char *tex, char *masks, float *envmapmax, float *envmapmin) +{ + loopmd3skins(meshname, s, + s.tex = textureload(makerelpath(md3dir, tex), 0, true, false); + if(*masks) + { + s.masks = textureload(makerelpath(md3dir, masks, ""), 0, true, false); + s.envmapmax = *envmapmax; + s.envmapmin = *envmapmin; + } + ); +} + +void md3spec(char *meshname, int *percent) +{ + float spec = 1.0f; + if(*percent>0) spec = *percent/100.0f; + else if(*percent<0) spec = 0.0f; + loopmd3skins(meshname, s, s.spec = spec); +} + +void md3ambient(char *meshname, int *percent) +{ + float ambient = 0.3f; + if(*percent>0) ambient = *percent/100.0f; + else if(*percent<0) ambient = 0.0f; + loopmd3skins(meshname, s, s.ambient = ambient); +} + +void md3glow(char *meshname, int *percent) +{ + float glow = 3.0f; + if(*percent>0) glow = *percent/100.0f; + else if(*percent<0) glow = 0.0f; + loopmd3skins(meshname, s, s.glow = glow); +} + +void md3glare(char *meshname, float *specglare, float *glowglare) +{ + loopmd3skins(meshname, s, { s.specglare = *specglare; s.glowglare = *glowglare; }); +} + +void md3alphatest(char *meshname, float *cutoff) +{ + loopmd3skins(meshname, s, s.alphatest = max(0.0f, min(1.0f, *cutoff))); +} + +void md3alphablend(char *meshname, int *blend) +{ + loopmd3skins(meshname, s, s.alphablend = *blend!=0); +} + +void md3envmap(char *meshname, char *envmap) +{ + Texture *tex = cubemapload(envmap); + loopmd3skins(meshname, s, s.envmap = tex); +} + +void md3bumpmap(char *meshname, char *normalmap, char *skin) +{ + Texture *normalmaptex = NULL, *skintex = NULL; + normalmaptex = textureload(makerelpath(md3dir, normalmap, ""), 0, true, false); + if(skin[0]) skintex = textureload(makerelpath(md3dir, skin, ""), 0, true, false); + loopmd3skins(meshname, s, { s.unlittex = skintex; s.normalmap = normalmaptex; m.calctangents(); }); +} + +void md3translucent(char *meshname, float *translucency) +{ + loopmd3skins(meshname, s, s.translucency = *translucency); +} + +void md3fullbright(char *meshname, float *fullbright) +{ + loopmd3skins(meshname, s, s.fullbright = *fullbright); +} + +void md3shader(char *meshname, char *shader) +{ + loopmd3skins(meshname, s, s.shader = lookupshaderbyname(shader)); +} + +void md3scroll(char *meshname, float *scrollu, float *scrollv) +{ + loopmd3skins(meshname, s, { s.scrollu = *scrollu; s.scrollv = *scrollv; }); +} + +void md3anim(char *anim, int *frame, int *range, float *speed, int *priority) +{ + if(!loadingmd3 || loadingmd3->parts.empty()) { conoutf("not loading an md3"); return; } + vector anims; + findanims(anim, anims); + if(anims.empty()) conoutf("could not find animation %s", anim); + else loopv(anims) + { + loadingmd3->parts.last()->setanim(0, anims[i], *frame, *range, *speed, *priority); + } +} + +void md3link(int *parent, int *child, char *tagname) +{ + if(!loadingmd3) { conoutf("not loading an md3"); return; } + if(!loadingmd3->parts.inrange(*parent) || !loadingmd3->parts.inrange(*child)) { conoutf("no models loaded to link"); return; } + if(!loadingmd3->parts[*parent]->link(loadingmd3->parts[*child], tagname)) conoutf("could not link model %s", loadingmd3->loadname); +} + +void md3noclip(char *meshname, int *noclip) +{ + loopmd3meshes(meshname, m, m.noclip = *noclip!=0); +} + +COMMAND(md3load, "s"); +COMMAND(md3pitch, "ffff"); +COMMAND(md3skin, "sssff"); +COMMAND(md3spec, "si"); +COMMAND(md3ambient, "si"); +COMMAND(md3glow, "si"); +COMMAND(md3glare, "sff"); +COMMAND(md3alphatest, "sf"); +COMMAND(md3alphablend, "si"); +COMMAND(md3envmap, "ss"); +COMMAND(md3bumpmap, "sss"); +COMMAND(md3translucent, "sf"); +COMMAND(md3fullbright, "sf"); +COMMAND(md3shader, "ss"); +COMMAND(md3scroll, "sff"); +COMMAND(md3anim, "siifi"); +COMMAND(md3link, "iis"); +COMMAND(md3noclip, "si"); + diff --git a/src/engine/md5.h b/src/engine/md5.h new file mode 100644 index 0000000..b583c24 --- /dev/null +++ b/src/engine/md5.h @@ -0,0 +1,751 @@ +struct md5; + +md5 *loadingmd5 = NULL; + +string md5dir; + +struct md5joint +{ + vec pos; + quat orient; +}; + +struct md5weight +{ + int joint; + float bias; + vec pos; +}; + +struct md5vert +{ + float u, v; + ushort start, count; +}; + +struct md5hierarchy +{ + string name; + int parent, flags, start; +}; + +struct md5 : skelmodel +{ + md5(const char *name) : skelmodel(name) {} + + int type() const { return MDL_MD5; } + + struct md5mesh : skelmesh + { + md5weight *weightinfo; + int numweights; + md5vert *vertinfo; + + md5mesh() : weightinfo(NULL), numweights(0), vertinfo(NULL) + { + } + + ~md5mesh() + { + cleanup(); + } + + void cleanup() + { + DELETEA(weightinfo); + DELETEA(vertinfo); + } + + void buildverts(vector &joints) + { + loopi(numverts) + { + md5vert &v = vertinfo[i]; + vec pos(0, 0, 0); + loopk(v.count) + { + md5weight &w = weightinfo[v.start+k]; + md5joint &j = joints[w.joint]; + pos.add(j.orient.rotate(w.pos).add(j.pos).mul(w.bias)); + } + vert &vv = verts[i]; + vv.pos = pos; + vv.u = v.u; + vv.v = v.v; + + blendcombo c; + int sorted = 0; + loopj(v.count) + { + md5weight &w = weightinfo[v.start+j]; + sorted = c.addweight(sorted, w.bias, w.joint); + } + c.finalize(sorted); + vv.blend = addblendcombo(c); + } + } + + void buildnorms(bool areaweight = true) + { + loopi(numverts) verts[i].norm = vec(0, 0, 0); + loopi(numtris) + { + tri &t = tris[i]; + vert &v1 = verts[t.vert[0]], &v2 = verts[t.vert[1]], &v3 = verts[t.vert[2]]; + vec norm; + norm.cross(vec(v2.pos).sub(v1.pos), vec(v3.pos).sub(v1.pos)); + if(!areaweight) norm.normalize(); + v1.norm.add(norm); + v2.norm.add(norm); + v3.norm.add(norm); + } + loopi(numverts) verts[i].norm.normalize(); + } + + void load(FILE *f, char *buf, size_t bufsize) + { + md5weight w; + md5vert v; + tri t; + int index; + + for(;;) + { + fgets(buf, bufsize, f); + if(buf[0]=='}' || feof(f)) break; + if(strstr(buf, "// meshes:")) + { + char *start = strchr(buf, ':')+1; + if(*start==' ') start++; + char *end = start + strlen(start)-1; + while(end >= start && isspace(*end)) end--; + name = newstring(start, end+1-start); + } + else if(strstr(buf, "shader")) + { + char *start = strchr(buf, '"'), *end = start ? strchr(start+1, '"') : NULL; + if(start && end) + { + char *texname = newstring(start+1, end-(start+1)); + part *p = loadingmd5->parts.last(); + p->initskins(notexture, notexture, group->meshes.length()); + skin &s = p->skins.last(); + s.tex = textureload(makerelpath(md5dir, texname), 0, true, false); + delete[] texname; + } + } + else if(sscanf(buf, " numverts %d", &numverts)==1) + { + numverts = max(numverts, 0); + if(numverts) + { + vertinfo = new md5vert[numverts]; + verts = new vert[numverts]; + } + } + else if(sscanf(buf, " numtris %d", &numtris)==1) + { + numtris = max(numtris, 0); + if(numtris) tris = new tri[numtris]; + } + else if(sscanf(buf, " numweights %d", &numweights)==1) + { + numweights = max(numweights, 0); + if(numweights) weightinfo = new md5weight[numweights]; + } + else if(sscanf(buf, " vert %d ( %f %f ) %hu %hu", &index, &v.u, &v.v, &v.start, &v.count)==5) + { + if(index>=0 && index=0 && index=0 && index basejoints; + for(;;) + { + fgets(buf, sizeof(buf), f); + if(feof(f)) break; + int tmp; + if(sscanf(buf, " MD5Version %d", &tmp)==1) + { + if(tmp!=10) { fclose(f); return false; } + } + else if(sscanf(buf, " numJoints %d", &tmp)==1) + { + if(tmp<1) { fclose(f); return false; } + if(skel->numbones>0) continue; + skel->numbones = tmp; + skel->bones = new boneinfo[skel->numbones]; + } + else if(sscanf(buf, " numMeshes %d", &tmp)==1) + { + if(tmp<1) { fclose(f); return false; } + } + else if(strstr(buf, "joints {")) + { + string name; + int parent; + md5joint j; + for(;;) + { + fgets(buf, sizeof(buf), f); + if(buf[0]=='}' || feof(f)) break; + if(sscanf(buf, " %s %d ( %f %f %f ) ( %f %f %f )", + name, &parent, &j.pos.x, &j.pos.y, &j.pos.z, + &j.orient.x, &j.orient.y, &j.orient.z)==8) + { + j.pos.y = -j.pos.y; + j.orient.x = -j.orient.x; + j.orient.z = -j.orient.z; + if(basejoints.length()numbones) + { + if(!skel->bones[basejoints.length()].name) + { + char *start = strchr(name, '"'), *end = start ? strchr(start+1, '"') : NULL; + skel->bones[basejoints.length()].name = start && end ? newstring(start+1, end-(start+1)) : newstring(name); + } + skel->bones[basejoints.length()].parent = parent; + } + j.orient.restorew(); + basejoints.add(j); + } + } + if(basejoints.length()!=skel->numbones) { fclose(f); return false; } + } + else if(strstr(buf, "mesh {")) + { + md5mesh *m = new md5mesh; + m->group = this; + meshes.add(m); + m->load(f, buf, sizeof(buf)); + if(!m->numtris || !m->numverts) + { + conoutf("empty mesh in %s", filename); + meshes.removeobj(m); + delete m; + } + } + } + + if(skel->shared <= 1) + { + skel->linkchildren(); + loopv(basejoints) skel->bones[i].base = dualquat(basejoints[i].orient, basejoints[i].pos); + } + + loopv(meshes) + { + md5mesh &m = *(md5mesh *)meshes[i]; + m.buildverts(basejoints); + m.buildnorms(); + m.cleanup(); + } + + sortblendcombos(); + + fclose(f); + return true; + } + + skelanimspec *loadmd5anim(const char *filename) + { + skelanimspec *sa = skel->findskelanim(filename); + if(sa) return sa; + + FILE *f = openfile(filename, "r"); + if(!f) return NULL; + + vector hierarchy; + vector basejoints; + int animdatalen = 0, animframes = 0; + float *animdata = NULL; + dualquat *animbones = NULL; + char buf[512]; + for(;;) + { + fgets(buf, sizeof(buf), f); + if(feof(f)) break; + int tmp; + if(sscanf(buf, " MD5Version %d", &tmp)==1) + { + if(tmp!=10) { fclose(f); return NULL; } + } + else if(sscanf(buf, " numJoints %d", &tmp)==1) + { + if(tmp!=skel->numbones) { fclose(f); return NULL; } + } + else if(sscanf(buf, " numFrames %d", &animframes)==1) + { + if(animframes<1) { fclose(f); return NULL; } + } + else if(sscanf(buf, " frameRate %d", &tmp)==1); + else if(sscanf(buf, " numAnimatedComponents %d", &animdatalen)==1) + { + if(animdatalen<1) { fclose(f); return NULL; } + animdata = new float[animdatalen]; + } + else if(strstr(buf, "bounds {")) + { + for(;;) + { + fgets(buf, sizeof(buf), f); + if(buf[0]=='}' || feof(f)) break; + } + } + else if(strstr(buf, "hierarchy {")) + { + for(;;) + { + fgets(buf, sizeof(buf), f); + if(buf[0]=='}' || feof(f)) break; + md5hierarchy h; + if(sscanf(buf, " %s %d %d %d", h.name, &h.parent, &h.flags, &h.start)==4) + hierarchy.add(h); + } + } + else if(strstr(buf, "baseframe {")) + { + for(;;) + { + fgets(buf, sizeof(buf), f); + if(buf[0]=='}' || feof(f)) break; + md5joint j; + if(sscanf(buf, " ( %f %f %f ) ( %f %f %f )", &j.pos.x, &j.pos.y, &j.pos.z, &j.orient.x, &j.orient.y, &j.orient.z)==6) + { + j.pos.y = -j.pos.y; + j.orient.x = -j.orient.x; + j.orient.z = -j.orient.z; + j.orient.restorew(); + basejoints.add(j); + } + } + if(basejoints.length()!=skel->numbones) { fclose(f); return NULL; } + animbones = new dualquat[(skel->numframes+animframes)*skel->numbones]; + if(skel->bones) + { + memcpy(animbones, skel->framebones, skel->numframes*skel->numbones*sizeof(dualquat)); + delete[] skel->framebones; + } + skel->framebones = animbones; + animbones += skel->numframes*skel->numbones; + + sa = &skel->addskelanim(filename); + sa->frame = skel->numframes; + sa->range = animframes; + + skel->numframes += animframes; + } + else if(sscanf(buf, " frame %d", &tmp)==1) + { + loopi(animdatalen) fscanf(f, "%f", &animdata[i]); + dualquat *frame = &animbones[tmp*skel->numbones]; + loopv(basejoints) + { + md5hierarchy &h = hierarchy[i]; + md5joint j = basejoints[i]; + float *jdata = &animdata[h.start]; + if(h.flags) + { + if(h.flags&1) j.pos.x = *jdata++; + if(h.flags&2) j.pos.y = -*jdata++; + if(h.flags&4) j.pos.z = *jdata++; + if(h.flags&8) j.orient.x = -*jdata++; + if(h.flags&16) j.orient.y = *jdata++; + if(h.flags&32) j.orient.z = -*jdata++; + j.orient.restorew(); + /*if(memcmp(&j, &basejoints[i], sizeof(j))) usedjoints[i] = 1; */ + } + frame[i] = dualquat(j.orient, j.pos); +#if 0 + if(h.parent<0) frame[i] = dualquat(j.orient, j.pos); + else (frame[i] = frame[h.parent]).mul(dualquat(j.orient, j.pos)); +#endif + } + } + } + + DELETEA(animdata); + fclose(f); + +#if 0 + vector invbase; + loopi(numbones) + { + dualquat &d = invbase.add(basebones[i]); +#if 1 + d.translate(vec(translate).neg()); + d.scale(1.0f/scale); +#endif + d.invert(); + } + loopi(animframes) + { + dualquat *frame = &animbones[i*numbones]; + loopj(numbones) + { + dualquat &d = frame[j]; +#if 1 + d.mul(invbase[j]); +#endif + d.scale(scale); + d.translate(translate); +#if 0 + d.mul(invbase[j]); +#endif + } + } +#endif + + return sa; + } + + bool load(const char *meshfile) + { + name = newstring(meshfile); + + if(!loadmd5mesh(meshfile)) return false; + + return true; + } + }; + + void extendbb(int frame, vec ¢er, vec &radius, modelattach &a) + { + vec acenter, aradius; + a.m->boundbox(frame, acenter, aradius); + float margin = 2*max(aradius.x, max(aradius.y, aradius.z)); + radius.x += margin; + radius.y += margin; + } + + meshgroup *loadmeshes(char *name, va_list args) + { + md5meshgroup *group = new md5meshgroup; + group->shareskeleton(va_arg(args, char *)); + if(!group->load(name)) { delete group; return NULL; } + return group; + } + + bool loaddefaultparts() + { + skelpart &mdl = *new skelpart; + parts.add(&mdl); + mdl.model = this; + mdl.index = 0; + mdl.pitchscale = mdl.pitchoffset = mdl.pitchmin = mdl.pitchmax = 0; + const char *fname = loadname + strlen(loadname); + do --fname; while(fname >= loadname && *fname!='/' && *fname!='\\'); + fname++; + s_sprintfd(meshname)("packages/models/%s/%s.md5mesh", loadname, fname); + mdl.meshes = sharemeshes(path(meshname)); + if(!mdl.meshes) return false; + mdl.initanimparts(); + mdl.initskins(); + s_sprintfd(animname)("packages/models/%s/%s.md5anim", loadname, fname); + ((md5meshgroup *)mdl.meshes)->loadmd5anim(path(animname)); + return true; + } + + bool load() + { + if(loaded) return true; + s_sprintf(md5dir)("packages/models/%s", loadname); + s_sprintfd(cfgname)("packages/models/%s/md5.cfg", loadname); + + loadingmd5 = this; + persistidents = false; + if(execfile(cfgname) && parts.length()) // configured md5, will call the md5* commands below + { + persistidents = true; + loadingmd5 = NULL; + loopv(parts) if(!parts[i]->meshes) return false; + } + else if(!loaddefaultparts()) // md5 without configuration, try default tris and skin + { + persistidents = true; + loadingmd5 = NULL; + return false; + } + loadingmd5 = NULL; + loopv(parts) + { + skelpart *p = (skelpart *)parts[i]; + p->endanimparts(); + p->meshes = p->meshes->scaleverts(scale/4.0f, i ? vec(0, 0, 0) : vec(translate.x, translate.y, translate.z)); + } + return loaded = true; + } +}; + +void md5load(char *meshfile, char *skelname) +{ + if(!loadingmd5) { conoutf("not loading an md5"); return; } + s_sprintfd(filename)("%s/%s", md5dir, meshfile); + md5::skelpart &mdl = *new md5::skelpart; + loadingmd5->parts.add(&mdl); + mdl.model = loadingmd5; + mdl.index = loadingmd5->parts.length()-1; + mdl.pitchscale = mdl.pitchoffset = mdl.pitchmin = mdl.pitchmax = 0; + mdl.meshes = loadingmd5->sharemeshes(path(filename), skelname[0] ? skelname : NULL); + if(!mdl.meshes) conoutf("could not load %s", filename); // ignore failure + else + { + mdl.initanimparts(); + mdl.initskins(); + } +} + +void md5tag(char *name, char *tagname) +{ + if(!loadingmd5 || loadingmd5->parts.empty()) { conoutf("not loading an md5"); return; } + md5::part &mdl = *loadingmd5->parts.last(); + int i = mdl.meshes ? ((md5::skelmeshgroup *)mdl.meshes)->skel->findbone(name) : -1; + if(i >= 0) + { + ((md5::skelmeshgroup *)mdl.meshes)->skel->addtag(tagname, i); + return; + } + conoutf("could not find bone %s for tag %s", name, tagname); +} + +void md5pitch(char *name, float *pitchscale, float *pitchoffset, float *pitchmin, float *pitchmax) +{ + if(!loadingmd5 || loadingmd5->parts.empty()) { conoutf("not loading an md5"); return; } + md5::part &mdl = *loadingmd5->parts.last(); + + if(name[0]) + { + int i = mdl.meshes ? ((md5::skelmeshgroup *)mdl.meshes)->skel->findbone(name) : -1; + if(i>=0) + { + md5::boneinfo &b = ((md5::skelmeshgroup *)mdl.meshes)->skel->bones[i]; + b.pitchscale = *pitchscale; + b.pitchoffset = *pitchoffset; + if(*pitchmin || *pitchmax) + { + b.pitchmin = *pitchmin; + b.pitchmax = *pitchmax; + } + else + { + b.pitchmin = -360*b.pitchscale; + b.pitchmax = 360*b.pitchscale; + } + return; + } + conoutf("could not find bone %s to pitch", name); + return; + } + + mdl.pitchscale = *pitchscale; + mdl.pitchoffset = *pitchoffset; + if(*pitchmin || *pitchmax) + { + mdl.pitchmin = *pitchmin; + mdl.pitchmax = *pitchmax; + } + else + { + mdl.pitchmin = -360*mdl.pitchscale; + mdl.pitchmax = 360*mdl.pitchscale; + } +} + +#define loopmd5meshes(meshname, m, body) \ + if(!loadingmd5 || loadingmd5->parts.empty()) { conoutf("not loading an md5"); return; } \ + md5::part &mdl = *loadingmd5->parts.last(); \ + if(!mdl.meshes) return; \ + loopv(mdl.meshes->meshes) \ + { \ + md5::skelmesh &m = *(md5::skelmesh *)mdl.meshes->meshes[i]; \ + if(!strcmp(meshname, "*") || (m.name && !strcmp(m.name, meshname))) \ + { \ + body; \ + } \ + } + +#define loopmd5skins(meshname, s, body) loopmd5meshes(meshname, m, { md5::skin &s = mdl.skins[i]; body; }) + +void md5skin(char *meshname, char *tex, char *masks, float *envmapmax, float *envmapmin) +{ + loopmd5skins(meshname, s, + s.tex = textureload(makerelpath(md5dir, tex), 0, true, false); + if(*masks) + { + s.masks = textureload(makerelpath(md5dir, masks, ""), 0, true, false); + s.envmapmax = *envmapmax; + s.envmapmin = *envmapmin; + } + ); +} + +void md5spec(char *meshname, int *percent) +{ + float spec = 1.0f; + if(*percent>0) spec = *percent/100.0f; + else if(*percent<0) spec = 0.0f; + loopmd5skins(meshname, s, s.spec = spec); +} + +void md5ambient(char *meshname, int *percent) +{ + float ambient = 0.3f; + if(*percent>0) ambient = *percent/100.0f; + else if(*percent<0) ambient = 0.0f; + loopmd5skins(meshname, s, s.ambient = ambient); +} + +void md5glow(char *meshname, int *percent) +{ + float glow = 3.0f; + if(*percent>0) glow = *percent/100.0f; + else if(*percent<0) glow = 0.0f; + loopmd5skins(meshname, s, s.glow = glow); +} + +void md5glare(char *meshname, float *specglare, float *glowglare) +{ + loopmd5skins(meshname, s, { s.specglare = *specglare; s.glowglare = *glowglare; }); +} + +void md5alphatest(char *meshname, float *cutoff) +{ + loopmd5skins(meshname, s, s.alphatest = max(0.0f, min(1.0f, *cutoff))); +} + +void md5alphablend(char *meshname, int *blend) +{ + loopmd5skins(meshname, s, s.alphablend = *blend!=0); +} + +void md5envmap(char *meshname, char *envmap) +{ + Texture *tex = cubemapload(envmap); + loopmd5skins(meshname, s, s.envmap = tex); +} + +void md5bumpmap(char *meshname, char *normalmap, char *skin) +{ + Texture *normalmaptex = NULL, *skintex = NULL; + normalmaptex = textureload(makerelpath(md5dir, normalmap, ""), 0, true, false); + if(skin[0]) skintex = textureload(makerelpath(md5dir, skin, ""), 0, true, false); + loopmd5skins(meshname, s, { s.unlittex = skintex; s.normalmap = normalmaptex; m.calctangents(); }); +} + +void md5translucent(char *meshname, float *translucency) +{ + loopmd5skins(meshname, s, s.translucency = *translucency); +} + +void md5fullbright(char *meshname, float *fullbright) +{ + loopmd5skins(meshname, s, s.fullbright = *fullbright); +} + +void md5shader(char *meshname, char *shader) +{ + loopmd5skins(meshname, s, s.shader = lookupshaderbyname(shader)); +} + +void md5scroll(char *meshname, float *scrollu, float *scrollv) +{ + loopmd5skins(meshname, s, { s.scrollu = *scrollu; s.scrollv = *scrollv; }); +} + +void md5anim(char *anim, char *animfile, float *speed, int *priority) +{ + if(!loadingmd5 || loadingmd5->parts.empty()) { conoutf("not loading an md5"); return; } + + vector anims; + findanims(anim, anims); + if(anims.empty()) conoutf("could not find animation %s", anim); + else + { + s_sprintfd(filename)("%s/%s", md5dir, animfile); + md5::part *p = loadingmd5->parts.last(); + md5::skelanimspec *sa = ((md5::md5meshgroup *)p->meshes)->loadmd5anim(path(filename)); + if(!sa) conoutf("could not load md5anim file %s", filename); + else loopv(anims) + { + loadingmd5->parts.last()->setanim(p->numanimparts-1, anims[i], sa->frame, sa->range, *speed, *priority); + } + } +} + +void md5animpart(char *maskstr) +{ + if(!loadingmd5 || loadingmd5->parts.empty()) { conoutf("not loading an md5"); return; } + + md5::skelpart *p = (md5::skelpart *)loadingmd5->parts.last(); + + vector bonestrs; + explodelist(maskstr, bonestrs); + vector bonemask; + loopv(bonestrs) + { + char *bonestr = bonestrs[i]; + int bone = p->meshes ? ((md5::skelmeshgroup *)p->meshes)->skel->findbone(bonestr[0]=='!' ? bonestr+1 : bonestr) : -1; + if(bone<0) { conoutf("could not find bone %s for anim part mask [%s]", bonestr, maskstr); bonestrs.deletecontentsa(); return; } + bonemask.add(bone | (bonestr[0]=='!' ? BONEMASK_NOT : 0)); + } + bonestrs.deletecontentsa(); + bonemask.sort(bonemaskcmp); + if(bonemask.length()) bonemask.add(BONEMASK_END); + + if(!p->addanimpart(bonemask.getbuf())) conoutf("too many animation parts"); +} + +void md5link(int *parent, int *child, char *tagname) +{ + if(!loadingmd5) { conoutf("not loading an md5"); return; } + if(!loadingmd5->parts.inrange(*parent) || !loadingmd5->parts.inrange(*child)) { conoutf("no models loaded to link"); return; } + if(!loadingmd5->parts[*parent]->link(loadingmd5->parts[*child], tagname)) conoutf("could not link model %s", loadingmd5->loadname); +} + +void md5noclip(char *meshname, int *noclip) +{ + loopmd5meshes(meshname, m, m.noclip = *noclip!=0); +} + +COMMAND(md5load, "ss"); +COMMAND(md5tag, "ss"); +COMMAND(md5pitch, "sffff"); +COMMAND(md5skin, "sssff"); +COMMAND(md5spec, "si"); +COMMAND(md5ambient, "si"); +COMMAND(md5glow, "si"); +COMMAND(md5glare, "sff"); +COMMAND(md5alphatest, "sf"); +COMMAND(md5alphablend, "si"); +COMMAND(md5envmap, "ss"); +COMMAND(md5bumpmap, "sss"); +COMMAND(md5translucent, "sf"); +COMMAND(md5fullbright, "sf"); +COMMAND(md5shader, "ss"); +COMMAND(md5scroll, "sff"); +COMMAND(md5animpart, "s"); +COMMAND(md5anim, "ssfi"); +COMMAND(md5link, "iis"); +COMMAND(md5noclip, "si"); diff --git a/src/engine/menus.cpp b/src/engine/menus.cpp new file mode 100644 index 0000000..3a606d0 --- /dev/null +++ b/src/engine/menus.cpp @@ -0,0 +1,457 @@ +// menus.cpp: ingame menu system (also used for scores and serverlist) + +#include "pch.h" +#include "engine.h" + +#define GUI_TITLE_COLOR 0x9f0000 +//#define GUI_TITLE_COLOR 0xFFDD88 +#define GUI_BUTTON_COLOR 0xFFFFFF +#define GUI_TEXT_COLOR 0xDDFFDD + +static vec menupos; +static int menustart = 0; +static int menutab = 1; +static g3d_gui *cgui = NULL; + +struct menu : g3d_callback +{ + char *name, *header, *contents; + + menu() : name(NULL), header(NULL), contents(NULL) {} + + void gui(g3d_gui &g, bool firstpass) + { + cgui = &g; + cgui->start(menustart, 0.03f, &menutab); + cgui->tab(header ? header : name, GUI_TITLE_COLOR); + execute(contents); + cgui->end(); + cgui = NULL; + } + + virtual void clear() {} +}; + +static hashtable guis; +static vector guistack; +static vector executelater; +static bool shouldclearmenu = true, clearlater = false; + +VARP(menudistance, 16, 40, 256); +VARP(menuautoclose, 32, 120, 4096); + +vec menuinfrontofplayer() +{ + vec dir; + vecfromyawpitch(camera1->yaw, 0, 1, 0, dir); + dir.mul(menudistance).add(camera1->o); + dir.z -= player->eyeheight-1; + return dir; +} + +void popgui() +{ + menu *m = guistack.pop(); + m->clear(); +} + +void removegui(menu *m) +{ + loopv(guistack) if(guistack[i]==m) + { + guistack.remove(i); + m->clear(); + return; + } +} + +void pushgui(menu *m, int pos = -1) +{ + if(guistack.empty()) + { + menupos = menuinfrontofplayer(); + g3d_resetcursor(); + } + if(pos < 0) guistack.add(m); + else guistack.insert(pos, m); + if(pos < 0 || pos==guistack.length()-1) + { + menutab = 1; + menustart = totalmillis; + } +} + +void restoregui(int pos) +{ + int clear = guistack.length()-pos-1; + loopi(clear) popgui(); + menutab = 1; + menustart = totalmillis; +} + +void showgui(const char *name) +{ + menu *m = guis.access(name); + if(!m) return; + int pos = guistack.find(m); + if(pos<0) pushgui(m); + else restoregui(pos); +} + +int cleargui(int n = 0) +{ + int clear = guistack.length(); + if(n>0) clear = min(clear, n); + loopi(clear) popgui(); + if(!guistack.empty()) restoregui(guistack.length()-1); + return clear; +} + +void cleargui_(int *n) +{ + intret(cleargui(*n)); +} + +void guistayopen(char *contents) +{ + bool oldclearmenu = shouldclearmenu; + shouldclearmenu = false; + execute(contents); + shouldclearmenu = oldclearmenu; +} + +void guinoautotab(char *contents) +{ + if(!cgui) return; + cgui->allowautotab(false); + execute(contents); + cgui->allowautotab(true); +} + +//@DOC name and icon are optional +void guibutton(char *name, char *action, char *icon) +{ + if(!cgui) return; + int ret = cgui->button(name, GUI_BUTTON_COLOR, *icon ? icon : (strstr(action, "showgui") ? "menu" : "action")); + if(ret&G3D_UP) + { + executelater.add(newstring(*action ? action : name)); + if(shouldclearmenu) clearlater = true; + } + else if(ret&G3D_ROLLOVER) + { + alias("guirollovername", name); + alias("guirolloveraction", action); + } +} + +void guiimage(char *path, char *action, float *scale, int *overlaid, char *alt) +{ + if(!cgui) return; + Texture *t = textureload(path, 0, true, false); + if(t==notexture) + { + if(alt[0]) t = textureload(alt, 0, true, false); + if(t==notexture) return; + } + int ret = cgui->image(t, *scale, *overlaid!=0); + if(ret&G3D_UP) + { + if(*action) + { + executelater.add(newstring(action)); + if(shouldclearmenu) clearlater = true; + } + } + else if(ret&G3D_ROLLOVER) + { + alias("guirolloverimgpath", path); + alias("guirolloverimgaction", action); + } +} + +void guitext(char *name, char *icon) +{ + if(cgui) cgui->text(name, icon[0] ? GUI_BUTTON_COLOR : GUI_TEXT_COLOR, icon[0] ? icon : "info"); +} + +void guititle(char *name) +{ + if(cgui) cgui->title(name, GUI_TITLE_COLOR); +} + +void guitab(char *name) +{ + if(cgui) cgui->tab(name, GUI_TITLE_COLOR); +} + +void guibar() +{ + if(cgui) cgui->separator(); +} + +static void updateval(char *var, int val, char *onchange) +{ + ident *id = getident(var); + string assign; + if(!id) return; + switch(id->type) + { + case ID_VAR: + case ID_FVAR: + case ID_SVAR: + s_sprintf(assign)("%s %d", var, val); + break; + case ID_ALIAS: + s_sprintf(assign)("%s = %d", var, val); + break; + default: + return; + } + executelater.add(newstring(assign)); + if(onchange[0]) executelater.add(newstring(onchange)); +} + +static int getval(char *var) +{ + ident *id = getident(var); + if(!id) return 0; + switch(id->type) + { + case ID_VAR: return *id->storage.i; + case ID_FVAR: return int(*id->storage.f); + case ID_SVAR: return atoi(*id->storage.s); + case ID_ALIAS: return atoi(id->action); + default: return 0; + } +} + +void guislider(char *var, int *min, int *max, char *onchange) +{ + if(!cgui) return; + int oldval = getval(var), val = oldval, vmin = *max ? *min : getvarmin(var), vmax = *max ? *max : getvarmax(var); + cgui->slider(val, vmin, vmax, GUI_TITLE_COLOR); + if(val != oldval) updateval(var, val, onchange); +} + +void guilistslider(char *var, char *list, char *onchange) +{ + if(!cgui) return; + vector vals; + list += strspn(list, "\n\t "); + while(*list) + { + vals.add(atoi(list)); + list += strcspn(list, "\n\t \0"); + list += strspn(list, "\n\t "); + } + if(vals.empty()) return; + int val = getval(var), oldoffset = vals.length()-1, offset = oldoffset; + loopv(vals) if(val <= vals[i]) { oldoffset = offset = i; break; } + s_sprintfd(label)("%d", val); + cgui->slider(offset, 0, vals.length()-1, GUI_TITLE_COLOR, label); + if(offset != oldoffset) updateval(var, vals[offset], onchange); +} + +void guicheckbox(char *name, char *var, int *on, int *off, char *onchange) +{ + bool enabled = getval(var)!=*off; + if(cgui && cgui->button(name, GUI_BUTTON_COLOR, enabled ? "checkbox_on" : "checkbox_off")&G3D_UP) + { + updateval(var, enabled ? *off : (*on || *off ? *on : 1), onchange); + } +} + +void guiradio(char *name, char *var, int *n, char *onchange) +{ + bool enabled = getval(var)==*n; + if(cgui && cgui->button(name, GUI_BUTTON_COLOR, enabled ? "radio_on" : "radio_off")&G3D_UP) + { + if(!enabled) updateval(var, *n, onchange); + } +} + +void guibitfield(char *name, char *var, int *mask, char *onchange) +{ + int val = getval(var); + bool enabled = (val & *mask) != 0; + if(cgui && cgui->button(name, GUI_BUTTON_COLOR, enabled ? "checkbox_on" : "checkbox_off")&G3D_UP) + { + updateval(var, enabled ? val & ~*mask : val | *mask, onchange); + } +} + +//-ve length indicates a wrapped text field of any (approx 260 chars) length, |length| is the field width +void guifield(char *var, int *maxlength, char *onchange) +{ + if(!cgui) return; + const char *initval = ""; + ident *id = getident(var); + if(id && id->type==ID_ALIAS) initval = id->action; + char *result = cgui->field(var, GUI_BUTTON_COLOR, *maxlength ? *maxlength : 12, 0, initval); + if(result) + { + alias(var, result); + if(onchange[0]) execute(onchange); + } +} + +//-ve maxlength indicates a wrapped text field of any (approx 260 chars) length, |maxlength| is the field width +void guieditor(char *name, int *maxlength, int *height, int *mode) +{ + if(!cgui) return; + cgui->field(name, GUI_BUTTON_COLOR, *maxlength ? *maxlength : 12, *height, NULL, *mode<=0 ? EDITORFOREVER : *mode); + //returns a non-NULL pointer (the currentline) when the user commits, could then manipulate via text* commands +} + +COMMAND(guieditor, "siii"); +//use text to do more... + + +void guilist(char *contents) +{ + if(!cgui) return; + cgui->pushlist(); + execute(contents); + cgui->poplist(); +} + +void newgui(char *name, char *contents, char *header) +{ + menu *m = guis.access(name); + if(!m) + { + name = newstring(name); + m = &guis[name]; + m->name = name; + } + else + { + DELETEA(m->header); + DELETEA(m->contents); + } + m->header = header && header[0] ? newstring(header) : NULL; + m->contents = newstring(contents); +} + +void guiservers() +{ + extern const char *showservers(g3d_gui *cgui); + if(cgui) + { + const char *name = showservers(cgui); + if(name) + { + s_sprintfd(connect)("connect %s", name); + executelater.add(newstring(connect)); + if(shouldclearmenu) clearlater = true; + } + } +} + +COMMAND(newgui, "sss"); +COMMAND(guibutton, "sss"); +COMMAND(guitext, "ss"); +COMMAND(guiservers, "s"); +COMMANDN(cleargui, cleargui_, "i"); +COMMAND(showgui, "s"); +COMMAND(guistayopen, "s"); +COMMAND(guinoautotab, "s"); + +COMMAND(guilist, "s"); +COMMAND(guititle, "s"); +COMMAND(guibar,""); +COMMAND(guiimage,"ssfis"); +COMMAND(guislider,"siis"); +COMMAND(guilistslider, "sss"); +COMMAND(guiradio,"ssis"); +COMMAND(guibitfield, "ssis"); +COMMAND(guicheckbox, "ssiis"); +COMMAND(guitab, "s"); +COMMAND(guifield, "sis"); + +struct change +{ + int type; + const char *desc; + + change() {} + change(int type, const char *desc) : type(type), desc(desc) {} +}; +static vector needsapply; + +static struct applymenu : menu +{ + void gui(g3d_gui &g, bool firstpass) + { + if(guistack.empty()) return; + g.start(menustart, 0.03f); + g.text("the following settings have changed:", GUI_TEXT_COLOR, "info"); + loopv(needsapply) g.text(needsapply[i].desc, GUI_TEXT_COLOR, "info"); + g.separator(); + g.text("apply changes now?", GUI_TEXT_COLOR, "info"); + if(g.button("yes", GUI_BUTTON_COLOR, "action")&G3D_UP) + { + int changetypes = 0; + loopv(needsapply) changetypes |= needsapply[i].type; + if(changetypes&CHANGE_GFX) executelater.add(newstring("resetgl")); + if(changetypes&CHANGE_SOUND) executelater.add(newstring("resetsound")); + clearlater = true; + } + if(g.button("no", GUI_BUTTON_COLOR, "action")&G3D_UP) + clearlater = true; + g.end(); + } + + void clear() + { + needsapply.setsize(0); + } +} applymenu; + +VARP(applydialog, 0, 1, 1); + +void addchange(const char *desc, int type) +{ + if(!applydialog) return; + loopv(needsapply) if(!strcmp(needsapply[i].desc, desc)) return; + needsapply.add(change(type, desc)); + if(needsapply.length() && guistack.find(&applymenu) < 0) + pushgui(&applymenu, 0); +} + +void clearchanges(int type) +{ + loopv(needsapply) + { + if(needsapply[i].type&type) + { + needsapply[i].type &= ~type; + if(!needsapply[i].type) needsapply.remove(i--); + } + } + if(needsapply.empty()) removegui(&applymenu); +} + +void menuprocess() +{ + int level = guistack.length(); + loopv(executelater) execute(executelater[i]); + executelater.deletecontentsa(); + if(clearlater) + { + if(level==guistack.length()) loopi(level) popgui(); + clearlater = false; + } +} + +void g3d_mainmenu() +{ + if(!guistack.empty()) + { + extern int usegui2d; + if(!usegui2d && camera1->o.dist(menupos) > menuautoclose) cleargui(); + else g3d_addgui(guistack.last(), menupos, GUI_2D | GUI_FOLLOW); + } +} + diff --git a/src/engine/model.h b/src/engine/model.h new file mode 100644 index 0000000..d8f2f6f --- /dev/null +++ b/src/engine/model.h @@ -0,0 +1,81 @@ +enum { MDL_MD2 = 1, MDL_MD3, MDL_MD5, MDL_OBJ }; + +struct model +{ + float spin, offsetyaw, offsetpitch; + bool collide, ellipsecollide, cullface, shadow; + float scale; + vec translate; + BIH *bih; + vec bbcenter, bbradius; + float eyeheight, collideradius, collideheight; + int batch; + + model() : spin(0), offsetyaw(0), offsetpitch(0), collide(true), ellipsecollide(false), cullface(true), shadow(true), scale(1.0f), translate(0, 0, 0), bih(0), bbcenter(0, 0, 0), bbradius(0, 0, 0), eyeheight(0.9f), collideradius(0), collideheight(0), batch(-1) {} + virtual ~model() { DELETEP(bih); } + virtual void calcbb(int frame, vec ¢er, vec &radius) = 0; + virtual void extendbb(int frame, vec ¢er, vec &radius, modelattach &a) {} + virtual void render(int anim, float speed, int basetime, const vec &o, float yaw, float pitch, dynent *d, modelattach *a = NULL, const vec &color = vec(0, 0, 0), const vec &dir = vec(0, 0, 0)) = 0; + virtual bool load() = 0; + virtual char *name() = 0; + virtual int type() const = 0; + virtual BIH *setBIH() { return 0; } + virtual bool envmapped() { return false; } + + virtual void setshader(Shader *shader) {} + virtual void setenvmap(float envmapmin, float envmapmax, Texture *envmap) {} + virtual void setspec(float spec) {} + virtual void setambient(float ambient) {} + virtual void setglow(float glow) {} + virtual void setglare(float specglare, float glowglare) {} + virtual void setalphatest(float alpha) {} + virtual void setalphablend(bool blend) {} + virtual void settranslucency(float translucency) {} + virtual void setfullbright(float fullbright) {} + + virtual void cleanup() {} + + virtual void startrender() {} + virtual void endrender() {} + + void boundbox(int frame, vec ¢er, vec &radius, modelattach *a = NULL) + { + if(frame) calcbb(frame, center, radius); + else + { + if(bbradius.iszero()) calcbb(0, bbcenter, bbradius); + center = bbcenter; + radius = bbradius; + } + if(a) for(int i = 0; a[i].name; i++) if(a[i].m) extendbb(frame, center, radius, a[i]); + } + + void collisionbox(int frame, vec ¢er, vec &radius) + { + boundbox(frame, center, radius); + if(collideradius) + { + center[0] = center[1] = 0; + radius[0] = radius[1] = collideradius; + } + if(collideheight) + { + center[2] = radius[2] = collideheight/2; + } + } + + float boundsphere(int frame, vec ¢er, modelattach *a = NULL) + { + vec radius; + boundbox(frame, center, radius, a); + return radius.magnitude(); + } + + float above(int frame = 0) + { + vec center, radius; + boundbox(frame, center, radius); + return center.z+radius.z; + } +}; + diff --git a/src/engine/normal.cpp b/src/engine/normal.cpp new file mode 100644 index 0000000..81dab13 --- /dev/null +++ b/src/engine/normal.cpp @@ -0,0 +1,320 @@ +#include "pch.h" +#include "engine.h" + +struct normal +{ + int next; + vec surface; +}; + +struct nkey +{ + ivec v; + + nkey() {} + nkey(const ivec &origin, const vvec &offset) + : v(((origin.x&~VVEC_INT_MASK)< normalgroups(1<<16); +vector normals; + +VARF(lerpangle, 0, 44, 180, hdr.lerpangle = lerpangle); + +static float lerpthreshold = 0; + +void addnormal(const ivec &origin, const vvec &offset, const vec &surface) +{ + nkey key(origin, offset); + nval &val = normalgroups[key]; + normal &n = normals.add(); + n.next = val.normals; + n.surface = surface; + val.normals = normals.length()-1; +} + +void findnormal(const ivec &origin, const vvec &offset, const vec &surface, vec &v) +{ + nkey key(origin, offset); + nval *val = normalgroups.access(key); + if(!val) { v = surface; return; } + + v = vec(0, 0, 0); + int total = 0; + for(int cur = val->normals; cur >= 0;) + { + normal &o = normals[cur]; + if(o.surface.dot(surface) >= lerpthreshold) + { + v.add(o.surface); + total++; + } + cur = o.next; + } + if(total > 1) v.normalize(); + else if(!total) v = surface; +} + +VAR(lerpsubdiv, 0, 2, 4); +VAR(lerpsubdivsize, 4, 4, 128); + +static uint progress = 0; + +void show_calcnormals_progress() +{ + float bar1 = float(progress) / float(allocnodes); + show_out_of_renderloop_progress(bar1, "computing normals..."); +} + +#define CHECK_PROGRESS(exit) CHECK_CALCLIGHT_PROGRESS(exit, show_calcnormals_progress) + +void addnormals(cube &c, const ivec &o, int size) +{ + CHECK_PROGRESS(return); + + if(c.children) + { + progress++; + size >>= 1; + loopi(8) addnormals(c.children[i], ivec(i, o.x, o.y, o.z, size), size); + return; + } + else if(isempty(c)) return; + + vvec vvecs[8]; + bool usefaces[6]; + int vertused = calcverts(c, o.x, o.y, o.z, size, vvecs, usefaces); + vec verts[8]; + loopi(8) if(vertused&(1< lerpsubdivsize) // && faceedges(c, i) == F_SOLID) + { + subdiv = 1<>= 1; + } + vec avg; + if(numplanes >= 2) + { + avg = planes[0]; + avg.add(planes[1]); + avg.normalize(); + } + int idxs[4]; + loopj(4) idxs[j] = faceverts(c, i, j); + loopj(4) + { + const vvec &v = vvecs[idxs[j]], &vn = vvecs[idxs[(j+1)%4]]; + if(v==vn) continue; + const vec &cur = numplanes < 2 || j == 1 ? planes[0] : (j == 3 ? planes[1] : avg); + addnormal(o, v, cur); + if(subdiv < 2) continue; + ivec dv; + loopk(3) dv[k] = (int(vn[k]) - int(v[k])) / subdiv; + if(dv.iszero()) continue; + vvec vs(v); + if(numplanes < 2) loopk(subdiv - 1) + { + vs.add(dv); + addnormal(o, vs, planes[0]); + } + else + { + vec dn(j==0 ? planes[0] : (j == 2 ? planes[1] : avg)); + dn.sub(cur); + dn.div(subdiv); + vec n(cur); + loopk(subdiv - 1) + { + vs.add(dv); + n.add(dn); + addnormal(o, vs, vec(dn).normalize()); + } + } + } + } +} + +void calcnormals() +{ + if(!lerpangle) return; + lerpthreshold = cos(lerpangle*RAD) - 1e-5f; + progress = 1; + loopi(8) addnormals(worldroot[i], ivec(i, 0, 0, 0, hdr.worldsize/2), hdr.worldsize/2); +} + +void clearnormals() +{ + normalgroups.clear(); + normals.setsizenodelete(0); +} + +void calclerpverts(const vec &origin, const vec *p, const vec *n, const vec &ustep, const vec &vstep, lerpvert *lv, int &numv) +{ + float ul = ustep.squaredlen(), vl = vstep.squaredlen(); + int i = 0; + loopj(numv) + { + if(j) + { + if(p[j] == p[j-1] && n[j] == n[j-1]) continue; + if(j == numv-1 && p[j] == p[0] && n[j] == n[0]) continue; + } + vec dir(p[j]); + dir.sub(origin); + lv[i].normal = n[j]; + lv[i].u = ustep.dot(dir)/ul; + lv[i].v = vstep.dot(dir)/vl; + i++; + } + numv = i; +} + +void setlerpstep(float v, lerpbounds &bounds) +{ + if(bounds.min->v + 1 > bounds.max->v) + { + bounds.nstep = vec(0, 0, 0); + bounds.normal = bounds.min->normal; + if(bounds.min->normal != bounds.max->normal) + { + bounds.normal.add(bounds.max->normal); + bounds.normal.normalize(); + } + bounds.ustep = 0; + bounds.u = bounds.min->u; + return; + } + + bounds.nstep = bounds.max->normal; + bounds.nstep.sub(bounds.min->normal); + bounds.nstep.div(bounds.max->v-bounds.min->v); + + bounds.normal = bounds.nstep; + bounds.normal.mul(v - bounds.min->v); + bounds.normal.add(bounds.min->normal); + + bounds.ustep = (bounds.max->u-bounds.min->u) / (bounds.max->v-bounds.min->v); + bounds.u = bounds.ustep * (v-bounds.min->v) + bounds.min->u; +} + +void initlerpbounds(const lerpvert *lv, int numv, lerpbounds &start, lerpbounds &end) +{ + const lerpvert *first = &lv[0], *second = NULL; + loopi(numv-1) + { + if(lv[i+1].v < first->v) { second = first; first = &lv[i+1]; } + else if(!second || lv[i+1].v < second->v) second = &lv[i+1]; + } + + if(int(first->v) < int(second->v)) { start.min = end.min = first; } + else if(first->u > second->u) { start.min = second; end.min = first; } + else { start.min = first; end.min = second; } + + start.max = (start.min == lv ? &lv[numv-1] : start.min-1); + end.max = (end.min == &lv[numv-1] ? lv : end.min+1); + + setlerpstep(0, start); + setlerpstep(0, end); +} + +void updatelerpbounds(float v, const lerpvert *lv, int numv, lerpbounds &start, lerpbounds &end) +{ + if(v >= start.max->v) + { + const lerpvert *next = (start.max == lv ? &lv[numv-1] : start.max-1); + if(next->v > start.max->v) + { + start.min = start.max; + start.max = next; + setlerpstep(v, start); + } + } + if(v >= end.max->v) + { + const lerpvert *next = (end.max == &lv[numv-1] ? lv : end.max+1); + if(next->v > end.max->v) + { + end.min = end.max; + end.max = next; + setlerpstep(v, end); + } + } +} + +void lerpnormal(float v, const lerpvert *lv, int numv, lerpbounds &start, lerpbounds &end, vec &normal, vec &nstep) +{ + updatelerpbounds(v, lv, numv, start, end); + + if(start.u + 1 > end.u) + { + nstep = vec(0, 0, 0); + normal = start.normal; + normal.add(end.normal); + normal.normalize(); + } + else + { + vec nstart(start.normal), nend(end.normal); + nstart.normalize(); + nend.normalize(); + + nstep = nend; + nstep.sub(nstart); + nstep.div(end.u-start.u); + + normal = nstep; + normal.mul(-start.u); + normal.add(nstart); + normal.normalize(); + } + + start.normal.add(start.nstep); + start.u += start.ustep; + + end.normal.add(end.nstep); + end.u += end.ustep; +} + +void newnormals(cube &c) +{ + if(!c.ext) newcubeext(c); + if(!c.ext->normals) + { + c.ext->normals = new surfacenormals[6]; + memset(c.ext->normals, 128, 6*sizeof(surfacenormals)); + } +} + +void freenormals(cube &c) +{ + if(c.ext) DELETEA(c.ext->normals); +} + diff --git a/src/engine/obj.h b/src/engine/obj.h new file mode 100644 index 0000000..b457854 --- /dev/null +++ b/src/engine/obj.h @@ -0,0 +1,369 @@ +struct obj; + +obj *loadingobj = 0; + +string objdir; + +struct obj : vertmodel +{ + obj(const char *name) : vertmodel(name) {} + + int type() const { return MDL_OBJ; } + + struct objmeshgroup : vertmeshgroup + { + void parsevert(char *s, vector &out) + { + vec &v = out.add(vec(0, 0, 0)); + while(isalpha(*s)) s++; + loopi(3) + { + v[i] = strtod(s, &s); + while(isspace(*s)) s++; + if(!*s) break; + } + } + + bool load(char *filename) + { + int len = strlen(filename); + if(len < 4 || strcasecmp(&filename[len-4], ".obj")) return false; + + FILE *file = openfile(filename, "rb"); + if(!file) return false; + + name = newstring(filename); + + numframes = 1; + + vector attrib[3]; + char buf[512]; + + hashtable verthash; + vector verts; + vector tcverts; + vector tris; + + #define STARTMESH do { \ + vertmesh &m = *new vertmesh; \ + m.group = this; \ + m.name = meshname[0] ? newstring(meshname) : NULL; \ + meshes.add(&m); \ + curmesh = &m; \ + verthash.clear(); \ + verts.setsizenodelete(0); \ + tcverts.setsizenodelete(0); \ + tris.setsizenodelete(0); \ + } while(0) + + #define FLUSHMESH do { \ + curmesh->numverts = verts.length(); \ + if(verts.length()) \ + { \ + curmesh->verts = new vert[verts.length()]; \ + memcpy(curmesh->verts, verts.getbuf(), verts.length()*sizeof(vert)); \ + curmesh->tcverts = new tcvert[verts.length()]; \ + memcpy(curmesh->tcverts, tcverts.getbuf(), tcverts.length()*sizeof(tcvert)); \ + } \ + curmesh->numtris = tris.length(); \ + if(tris.length()) \ + { \ + curmesh->tris = new tri[tris.length()]; \ + memcpy(curmesh->tris, tris.getbuf(), tris.length()*sizeof(tri)); \ + } \ + } while(0) + + string meshname = ""; + vertmesh *curmesh = NULL; + for(;;) + { + fgets(buf, sizeof(buf), file); + if(feof(file)) break; + char *c = buf; + while(isspace(*c)) c++; + switch(*c) + { + case '#': continue; + case 'v': + if(isspace(c[1])) parsevert(c, attrib[0]); + else if(c[1]=='t') parsevert(c, attrib[1]); + else if(c[1]=='n') parsevert(c, attrib[2]); + break; + case 'g': + { + while(isalpha(*c)) c++; + while(isspace(*c)) c++; + char *name = c; + size_t namelen = strlen(name); + while(namelen > 0 && isspace(name[namelen-1])) namelen--; + s_strncpy(meshname, name, min(namelen+1, sizeof(meshname))); + + if(curmesh) FLUSHMESH; + curmesh = NULL; + break; + } + case 'f': + { + if(!curmesh) STARTMESH; + int v0 = -1, v1 = -1; + while(isalpha(*c)) c++; + for(;;) + { + while(isspace(*c)) c++; + if(!*c) break; + ivec vkey(-1, -1, -1); + loopi(3) + { + vkey[i] = strtol(c, &c, 10); + if(vkey[i] < 0) vkey[i] = attrib[i].length() - vkey[i]; + else vkey[i]--; + if(!attrib[i].inrange(vkey[i])) vkey[i] = -1; + if(*c!='/') break; + c++; + } + int *index = verthash.access(vkey); + if(!index) + { + index = &verthash[vkey]; + *index = verts.length(); + vert &v = verts.add(); + v.pos = vkey.x < 0 ? vec(0, 0, 0) : attrib[0][vkey.x]; + v.norm = vkey.z < 0 ? vec(0, 0, 0) : attrib[2][vkey.z]; + tcvert &tcv = tcverts.add(); + if(vkey.y < 0) tcv.u = tcv.v = 0; + else { tcv.u = attrib[1][vkey.y].x; tcv.v = attrib[1][vkey.y].y; } + } + if(v0 < 0) v0 = *index; + else if(v1 < 0) v1 = *index; + else + { + tri &t = tris.add(); + t.vert[0] = ushort(v0); + t.vert[1] = ushort(v1); + t.vert[2] = ushort(*index); + v1 = *index; + } + } + break; + } + } + } + + if(curmesh) FLUSHMESH; + + fclose(file); + + return true; + } + }; + + meshgroup *loadmeshes(char *name, va_list args) + { + objmeshgroup *group = new objmeshgroup; + if(!group->load(name)) { delete group; return NULL; } + return group; + } + + bool loaddefaultparts() + { + part &mdl = *new part; + parts.add(&mdl); + mdl.model = this; + mdl.index = 0; + const char *pname = parentdir(loadname); + s_sprintfd(name1)("packages/models/%s/tris.obj", loadname); + mdl.meshes = sharemeshes(path(name1)); + if(!mdl.meshes) + { + s_sprintfd(name2)("packages/models/%s/tris.obj", pname); // try obj in parent folder (vert sharing) + mdl.meshes = sharemeshes(path(name2)); + if(!mdl.meshes) return false; + } + Texture *tex, *masks; + loadskin(loadname, pname, tex, masks); + mdl.initskins(tex, masks); + if(tex==notexture) conoutf("could not load model skin for %s", name1); + return true; + } + + bool load() + { + if(loaded) return true; + s_sprintf(objdir)("packages/models/%s", loadname); + s_sprintfd(cfgname)("packages/models/%s/obj.cfg", loadname); + + loadingobj = this; + persistidents = false; + if(execfile(cfgname) && parts.length()) // configured obj, will call the obj* commands below + { + persistidents = true; + loadingobj = NULL; + loopv(parts) if(!parts[i]->meshes) return false; + } + else // obj without configuration, try default tris and skin + { + persistidents = true; + loadingobj = NULL; + if(!loaddefaultparts()) return false; + } + loopv(parts) parts[i]->meshes = parts[i]->meshes->scaleverts(scale/4.0f, i ? vec(0, 0, 0) : vec(translate.x, -translate.y, translate.z)); + return loaded = true; + } +}; + +void objload(char *model) +{ + if(!loadingobj) { conoutf("not loading an obj"); return; } + s_sprintfd(filename)("%s/%s", objdir, model); + obj::part &mdl = *new obj::part; + loadingobj->parts.add(&mdl); + mdl.model = loadingobj; + mdl.index = loadingobj->parts.length()-1; + if(mdl.index) mdl.pitchscale = mdl.pitchoffset = mdl.pitchmin = mdl.pitchmax = 0; + mdl.meshes = loadingobj->sharemeshes(path(filename)); + if(!mdl.meshes) conoutf("could not load %s", filename); // ignore failure + else mdl.initskins(); +} + +void objpitch(float *pitchscale, float *pitchoffset, float *pitchmin, float *pitchmax) +{ + if(!loadingobj || loadingobj->parts.empty()) { conoutf("not loading an obj"); return; } + obj::part &mdl = *loadingobj->parts.last(); + + mdl.pitchscale = *pitchscale; + mdl.pitchoffset = *pitchoffset; + if(*pitchmin || *pitchmax) + { + mdl.pitchmin = *pitchmin; + mdl.pitchmax = *pitchmax; + } + else + { + mdl.pitchmin = -360*mdl.pitchscale; + mdl.pitchmax = 360*mdl.pitchscale; + } +} + +#define loopobjmeshes(meshname, m, body) \ + if(!loadingobj || loadingobj->parts.empty()) { conoutf("not loading an obj"); return; } \ + obj::part &mdl = *loadingobj->parts.last(); \ + if(!mdl.meshes) return; \ + loopv(mdl.meshes->meshes) \ + { \ + obj::vertmesh &m = *(obj::vertmesh *)mdl.meshes->meshes[i]; \ + if(!strcmp(meshname, "*") || (m.name && !strcmp(m.name, meshname))) \ + { \ + body; \ + } \ + } + +#define loopobjskins(meshname, s, body) loopobjmeshes(meshname, m, { obj::skin &s = mdl.skins[i]; body; }) + +void objskin(char *meshname, char *tex, char *masks, float *envmapmax, float *envmapmin) +{ + loopobjskins(meshname, s, + s.tex = textureload(makerelpath(objdir, tex), 0, true, false); + if(*masks) + { + s.masks = textureload(makerelpath(objdir, masks, ""), 0, true, false); + s.envmapmax = *envmapmax; + s.envmapmin = *envmapmin; + } + ); +} + +void objspec(char *meshname, int *percent) +{ + float spec = 1.0f; + if(*percent>0) spec = *percent/100.0f; + else if(*percent<0) spec = 0.0f; + loopobjskins(meshname, s, s.spec = spec); +} + +void objambient(char *meshname, int *percent) +{ + float ambient = 0.3f; + if(*percent>0) ambient = *percent/100.0f; + else if(*percent<0) ambient = 0.0f; + loopobjskins(meshname, s, s.ambient = ambient); +} + +void objglow(char *meshname, int *percent) +{ + float glow = 3.0f; + if(*percent>0) glow = *percent/100.0f; + else if(*percent<0) glow = 0.0f; + loopobjskins(meshname, s, s.glow = glow); +} + +void objglare(char *meshname, float *specglare, float *glowglare) +{ + loopobjskins(meshname, s, { s.specglare = *specglare; s.glowglare = *glowglare; }); +} + +void objalphatest(char *meshname, float *cutoff) +{ + loopobjskins(meshname, s, s.alphatest = max(0.0f, min(1.0f, *cutoff))); +} + +void objalphablend(char *meshname, int *blend) +{ + loopobjskins(meshname, s, s.alphablend = *blend!=0); +} + +void objenvmap(char *meshname, char *envmap) +{ + Texture *tex = cubemapload(envmap); + loopobjskins(meshname, s, s.envmap = tex); +} + +void objbumpmap(char *meshname, char *normalmap, char *skin) +{ + Texture *normalmaptex = NULL, *skintex = NULL; + normalmaptex = textureload(makerelpath(objdir, normalmap, ""), 0, true, false); + if(skin[0]) skintex = textureload(makerelpath(objdir, skin, ""), 0, true, false); + loopobjskins(meshname, s, { s.unlittex = skintex; s.normalmap = normalmaptex; m.calctangents(); }); +} + +void objtranslucent(char *meshname, float *translucency) +{ + loopobjskins(meshname, s, s.translucency = *translucency); +} + +void objfullbright(char *meshname, float *fullbright) +{ + loopobjskins(meshname, s, s.fullbright = *fullbright); +} + +void objshader(char *meshname, char *shader) +{ + loopobjskins(meshname, s, s.shader = lookupshaderbyname(shader)); +} + +void objscroll(char *meshname, float *scrollu, float *scrollv) +{ + loopobjskins(meshname, s, { s.scrollu = *scrollu; s.scrollv = *scrollv; }); +} + +void objnoclip(char *meshname, int *noclip) +{ + loopobjmeshes(meshname, m, m.noclip = *noclip!=0); +} + +COMMAND(objload, "s"); +COMMAND(objpitch, "ffff"); +COMMAND(objskin, "sssff"); +COMMAND(objspec, "si"); +COMMAND(objambient, "si"); +COMMAND(objglow, "si"); +COMMAND(objglare, "sff"); +COMMAND(objalphatest, "sf"); +COMMAND(objalphablend, "si"); +COMMAND(objenvmap, "ss"); +COMMAND(objbumpmap, "sss"); +COMMAND(objtranslucent, "sf"); +COMMAND(objfullbright, "sf"); +COMMAND(objshader, "ss"); +COMMAND(objscroll, "sff"); +COMMAND(objnoclip, "si"); + diff --git a/src/engine/octa.cpp b/src/engine/octa.cpp new file mode 100644 index 0000000..d6e36a5 --- /dev/null +++ b/src/engine/octa.cpp @@ -0,0 +1,1388 @@ +// core world management routines + +#include "pch.h" +#include "engine.h" + +cube *worldroot = newcubes(F_SOLID); +int allocnodes = 0; + +cubeext *newcubeext(cube &c) +{ + if(c.ext) return c.ext; + c.ext = new cubeext; + c.ext->material = MAT_AIR; + c.ext->visible = 0; + c.ext->merged = 0; + c.ext->mergeorigin = 0; + c.ext->va = NULL; + c.ext->clip = NULL; + c.ext->surfaces = NULL; + c.ext->normals = NULL; + c.ext->ents = NULL; + c.ext->merges = NULL; + c.ext->tjoints = -1; + return c.ext; +} + +cube *newcubes(uint face) +{ + cube *c = new cube[8]; + loopi(8) + { + c->children = NULL; + c->ext = NULL; + setfaces(*c, face); + loopl(6) + { + c->texture[l] = 2+l; + } + c++; + } + allocnodes++; + return c-8; +} + +int familysize(cube &c) +{ + int size = 1; + if(c.children) loopi(8) size += familysize(c.children[i]); + return size; +} + +void freeocta(cube *c) +{ + if(!c) return; + loopi(8) discardchildren(c[i]); + delete[] c; + allocnodes--; +} + +void freecubeext(cube &c) +{ + DELETEP(c.ext); +} + +void discardchildren(cube &c) +{ + if(c.ext) + { + if(c.ext->va) destroyva(c.ext->va); + c.ext->va = NULL; + c.ext->merged = 0; + c.ext->tjoints = -1; + freesurfaces(c); + freenormals(c); + freeclipplanes(c); + freeoctaentities(c); + freemergeinfo(c); + freecubeext(c); + } + if(c.children) + { + freeocta(c.children); + c.children = NULL; + } +} + +void getcubevector(cube &c, int d, int x, int y, int z, ivec &p) +{ + ivec v(d, x, y, z); + + loopi(3) + p[i] = edgeget(cubeedge(c, i, v[R[i]], v[C[i]]), v[D[i]]); +} + +void setcubevector(cube &c, int d, int x, int y, int z, ivec &p) +{ + ivec v(d, x, y, z); + + loopi(3) + edgeset(cubeedge(c, i, v[R[i]], v[C[i]]), v[D[i]], p[i]); +} + +void optiface(uchar *p, cube &c) +{ + loopi(4) if(edgeget(p[i], 0)!=edgeget(p[i], 1)) return; + emptyfaces(c); +} + +void printcube() +{ + cube &c = lookupcube(lu.x, lu.y, lu.z, 0); // assume this is cube being pointed at + conoutf(CON_DEBUG, "= %p = (%d, %d, %d) @ %d", &c, lu.x, lu.y, lu.z, lusize); + conoutf(CON_DEBUG, " x %.8x", c.faces[0]); + conoutf(CON_DEBUG, " y %.8x", c.faces[1]); + conoutf(CON_DEBUG, " z %.8x", c.faces[2]); +} + +COMMAND(printcube, ""); + +bool isvalidcube(cube &c) +{ + clipplanes p; + genclipplanes(c, 0, 0, 0, 256, p); + loopi(8) // test that cube is convex + { + vvec v; + calcvert(c, 0, 0, 0, 256, v, i); + if(!pointincube(p, v.tovec())) + return false; + } + return true; +} + +void validatec(cube *c, int size) +{ + loopi(8) + { + if(c[i].children) + { + if(size<=(8>>VVEC_FRAC)) + { + solidfaces(c[i]); + discardchildren(c[i]); + } + else validatec(c[i].children, size>>1); + } + else + { + loopj(3) optiface((uchar *)&(c[i].faces[j]), c[i]); + loopj(12) + if(edgeget(c[i].edges[j], 1)>8 || + edgeget(c[i].edges[j], 1)>= 1; + ASSERT(size); + if(tz>=z+size) { z += size; c += 4; } + if(ty>=y+size) { y += size; c += 2; } + if(tx>=x+size) { x += size; c += 1; } + //if(tsize==size) break; + if(abs(tsize)>=size) break; + if(c->children==NULL) + { + //if(!tsize) break; + if(tsize<=0) break; + subdividecube(*c); + } + c = c->children; + } + lu.x = x; + lu.y = y; + lu.z = z; + lusize = size; + return *c; +} + +cube &neighbourcube(int x, int y, int z, int size, int rsize, int orient) +{ + switch(orient) + { + case O_BOTTOM: z -= size; break; + case O_TOP: z += size; break; + case O_BACK: y -= size; break; + case O_FRONT: y += size; break; + case O_LEFT: x -= size; break; + case O_RIGHT: x += size; break; + } + return lookupcube(x, y, z, rsize); +} + +int lookupmaterial(const vec &v) +{ + ivec o(v); + if(!insideworld(o)) return MAT_AIR; + int scale = worldscale-1; + cube *c = &worldroot[octastep(o.x, o.y, o.z, scale)]; + while(c->children) + { + scale--; + c = &c->children[octastep(o.x, o.y, o.z, scale)]; + } + return c->ext ? c->ext->material : MAT_AIR; +} + +////////// (re)mip ////////// + +int getmippedtexture(cube &p, int orient) +{ + cube *c = p.children; + int d = dimension(orient); + int dc = dimcoord(orient); + int tex[4] = {-1,-1,-1,-1}; + loop(x,2) loop(y,2) + { + int n = octaindex(d, x, y, dc); + if(isempty(c[n])) + n = oppositeocta(d, n); + if(isempty(c[n])) + continue; + + loopk(3) + if(tex[k] == c[n].texture[orient]) + return tex[k]; + + if(c[n].texture[orient] > 0) // assume 0 is sky. favour non-sky tex + tex[x*2+y] = c[n].texture[orient]; + } + + loopk(4) + if(tex[k]>0) return tex[k]; + + return p.texture[orient]; +} + +void forcemip(cube &c) +{ + cube *ch = c.children; + emptyfaces(c); + + loopi(8) loopj(8) + { + int n = i^(j==3 ? 4 : (j==4 ? 3 : j)); + if(!isempty(ch[n])) // breadth first search for cube near vert + { + ivec v, p(i); + getcubevector(ch[n], 2, p.x, p.y, p.z, v); + + loopk(3) // adjust vert to parent size + { + if(octacoord(k, n) == 1) + v[k] += 8; + v[k] >>= 1; + } + + setcubevector(c, 2, p.x, p.y, p.z, v); + break; + } + } + + loopj(6) + c.texture[j] = getmippedtexture(c, j); +} + +int midedge(const ivec &a, const ivec &b, int xd, int yd, bool &perfect) +{ + int ax = a[xd], bx = b[xd]; + int ay = a[yd], by = b[yd]; + if(ay==by) return ay; + if(ax==bx) { perfect = false; return ay; } + bool crossx = (ax<8 && bx>8) || (ax>8 && bx<8); + bool crossy = (ay<8 && by>8) || (ay>8 && by<8); + if(crossy && !crossx) { midedge(a,b,yd,xd,perfect); return 8; } // to test perfection + if(ax<=8 && bx<=8) return ax>bx ? ay : by; + if(ax>=8 && bx>=8) return ax16)) perfect = false; + return crossy ? 8 : min(max(y, 0), 16); +} + +bool subdividecube(cube &c, bool fullcheck, bool brighten) +{ + if(c.children) return true; + if(isempty(c) || isentirelysolid(c)) + { + int mat = c.ext ? c.ext->material : MAT_AIR; + c.children = newcubes(isempty(c) ? F_EMPTY : F_SOLID); + loopi(8) + { + loopl(6) c.children[i].texture[l] = c.texture[l]; + if(mat!=MAT_AIR) ext(c.children[i]).material = mat; + if(brighten && !isempty(c)) brightencube(c.children[i]); + } + return true; + } + cube *ch = c.children = newcubes(F_SOLID); + bool perfect = true, p1, p2; + int mat = c.ext ? c.ext->material : MAT_AIR; + ivec v[8]; + loopi(8) + { + ivec p(i); + getcubevector(c, 2, p.x, p.y, p.z, v[i]); + v[i].mul(2); + if(mat!=MAT_AIR) ext(ch[i]).material = mat; + } + + loopj(6) + { + int d = dimension(j); + int z = dimcoord(j); + int e[3][3]; + ivec *v1[2][2]; + loop(y, 2) loop(x, 2) + v1[x][y] = v+octaindex(d, x, y, z); + + loop(y, 3) loop(x, 3) // gen edges + { + if(x==1 && y==1) // center + { + int c1 = midedge(*v1[0][0], *v1[1][1], R[d], d, p1 = perfect); + int c2 = midedge(*v1[0][1], *v1[1][0], R[d], d, p2 = perfect); + e[x][y] = z ? max(c1,c2) : min(c1,c2); + perfect = e[x][y]==c1 ? p1 : p2; + } + else if(((x+y)&1)==0) // corner + e[x][y] = (*v1[x>>1][y>>1])[d]; + else // edge + { + int a = min(x, y), b = x&1; + e[x][y] = midedge(*v1[a][a], *v1[a^b][a^(1-b)], x==1?R[d]:C[d], d, perfect); + } + } + + loopi(8) + { + ivec o(i); + ch[i].texture[j] = c.texture[j]; + loop(y, 2) loop(x, 2) // assign child edges + { + int ce = e[x+o[R[d]]][y+o[C[d]]]; + if(o[D[d]]) ce -= 8; + ce = min(max(ce, 0), 8); + uchar &f = cubeedge(ch[i], d, x, y); + edgeset(f, z, ce); + } + } + } + + validatec(ch, hdr.worldsize); + if(fullcheck) loopi(8) if(!isvalidcube(ch[i])) // not so good... + { + emptyfaces(ch[i]); + perfect=false; + } + if(brighten) loopi(8) if(!isempty(ch[i])) brightencube(ch[i]); + return perfect; +} + +bool crushededge(uchar e, int dc) { return dc ? e==0 : e==0x88; } + +int visibleorient(cube &c, int orient) +{ + loopi(2) loopj(2) + { + int a = faceedgesidx[orient][i*2 + 0]; + int b = faceedgesidx[orient][i*2 + 1]; + if(crushededge(c.edges[a],j) && + crushededge(c.edges[b],j) && + touchingface(c, orient)) return ((a>>2)<<1) + j; + } + return orient; +} + +VAR(mipvis, 0, 0, 1); + +static int remipprogress = 0, remiptotal = 0; + +bool remip(cube &c, int x, int y, int z, int size) +{ + if(c.ext) + { + c.ext->merged = 0; + if(c.ext->merges) freemergeinfo(c); + } + + cube *ch = c.children; + if(!ch) + { + if(size<<1 <= VVEC_INT_MASK+1) return true; + subdividecube(c); + ch = c.children; + } + else if((remipprogress++&0x7FF)==1) show_out_of_renderloop_progress(float(remipprogress)/remiptotal, "remipping..."); + + bool perfect = true; + uchar mat = ch[0].ext ? ch[0].ext->material : MAT_AIR; + + loopi(8) + { + ivec o(i, x, y, z, size); + if(!remip(ch[i], o.x, o.y, o.z, size>>1)) perfect = false; + } + + solidfaces(c); // so texmip is more consistent + loopj(6) + c.texture[j] = getmippedtexture(c, j); // parents get child texs regardless + + if(!perfect) return false; + if(size<<1 > VVEC_INT_MASK+1) return false; + + cube n = c; + forcemip(n); + n.children = NULL; + if(!subdividecube(n, false, false)) + { freeocta(n.children); return false; } + + cube *nh = n.children; + uchar vis[6] = {0, 0, 0, 0, 0, 0}; + loopi(8) + { + if(ch[i].faces[0] != nh[i].faces[0] || + ch[i].faces[1] != nh[i].faces[1] || + ch[i].faces[2] != nh[i].faces[2] || + (ch[i].ext ? ch[i].ext->material : MAT_AIR) != mat) + { freeocta(nh); return false; } + + if(isempty(ch[i]) && isempty(nh[i])) continue; + + ivec o(i, x, y, z, size); + loop(orient, 6) + if(visibleface(ch[i], orient, o.x, o.y, o.z, size)) + { + if(ch[i].texture[orient] != n.texture[orient]) { freeocta(nh); return false; } + vis[orient] |= 1<edittrigger(sel, EDIT_REMIP); + remipprogress = 1; + remiptotal = allocnodes; + loopi(8) + { + ivec o(i, 0, 0, 0, hdr.worldsize>>1); + remip(worldroot[i], o.x, o.y, o.z, hdr.worldsize>>2); + } + calcmerges(); + if(!local) allchanged(); +} + +void remip_() +{ + mpremip(true); + allchanged(); +} + +COMMANDN(remip, remip_, ""); + +uchar &edgelookup(cube &c, const ivec &p, int dim) +{ + return c.edges[dim*4 +(p[C[dim]]>>3)*2 +(p[R[dim]]>>3)]; +} + +int edgeval(cube &c, const ivec &p, int dim, int coord) +{ + return edgeget(edgelookup(c,p,dim), coord); +} + +void genvertp(cube &c, ivec &p1, ivec &p2, ivec &p3, plane &pl) +{ + int dim = 0; + if(p1.y==p2.y && p2.y==p3.y) dim = 1; + else if(p1.z==p2.z && p2.z==p3.z) dim = 2; + + int coord = p1[dim]; + + ivec v1(p1), v2(p2), v3(p3); + v1[D[dim]] = edgeval(c, p1, dim, coord); + v2[D[dim]] = edgeval(c, p2, dim, coord); + v3[D[dim]] = edgeval(c, p3, dim, coord); + + pl.toplane(v1.tovec(), v2.tovec(), v3.tovec()); +} + +bool threeplaneintersect(plane &pl1, plane &pl2, plane &pl3, vec &dest) +{ + vec &t1 = dest, t2, t3, t4; + t1.cross(pl1, pl2); t4 = t1; t1.mul(pl3.offset); + t2.cross(pl3, pl1); t2.mul(pl2.offset); + t3.cross(pl2, pl3); t3.mul(pl1.offset); + t1.add(t2); + t1.add(t3); + t1.mul(-1); + float d = t4.dot(pl3); + if(d==0) return false; + t1.div(d); + return true; +} + +void genedgespanvert(ivec &p, cube &c, vec &v) +{ + ivec p1(8-p.x, p.y, p.z); + ivec p2(p.x, 8-p.y, p.z); + ivec p3(p.x, p.y, 8-p.z); + + cube s; + solidfaces(s); + + plane plane1, plane2, plane3; + genvertp(c, p, p1, p2, plane1); + genvertp(c, p, p2, p3, plane2); + genvertp(c, p, p3, p1, plane3); + if(plane1==plane2) genvertp(s, p, p1, p2, plane1); + if(plane1==plane3) genvertp(s, p, p1, p2, plane1); + if(plane2==plane3) genvertp(s, p, p2, p3, plane2); + + ASSERT(threeplaneintersect(plane1, plane2, plane3, v)); + //ASSERT(v.x>=0 && v.x<=8); + //ASSERT(v.y>=0 && v.y<=8); + //ASSERT(v.z>=0 && v.z<=8); + v.x = max(0.0f, min(8.0f, v.x)); + v.y = max(0.0f, min(8.0f, v.y)); + v.z = max(0.0f, min(8.0f, v.z)); +} + +void edgespan2vectorcube(cube &c) +{ + vec v; + + if(c.children) loopi(8) edgespan2vectorcube(c.children[i]); + + if(isentirelysolid(c) || isempty(c)) return; + + cube n = c; + + loop(x,2) loop(y,2) loop(z,2) + { + ivec p(8*x, 8*y, 8*z); + genedgespanvert(p, c, v); + + edgeset(cubeedge(n, 0, y, z), x, int(v.x+0.49f)); + edgeset(cubeedge(n, 1, z, x), y, int(v.y+0.49f)); + edgeset(cubeedge(n, 2, x, y), z, int(v.z+0.49f)); + } + + c = n; +} + +void converttovectorworld() +{ + conoutf(CON_WARN, "WARNING: old map, use savecurrentmap"); + loopi(8) edgespan2vectorcube(worldroot[i]); +} + +void genvectorvert(const ivec &p, cube &c, ivec &v) +{ + v.x = edgeval(c, p, 0, p.x); + v.y = edgeval(c, p, 1, p.y); + v.z = edgeval(c, p, 2, p.z); +} + +const ivec cubecoords[8] = // verts of bounding cube +{ + ivec(8, 8, 0), + ivec(0, 8, 0), + ivec(0, 8, 8), + ivec(8, 8, 8), + ivec(8, 0, 8), + ivec(0, 0, 8), + ivec(0, 0, 0), + ivec(8, 0, 0), +}; + +const ushort fv[6][4] = // indexes for cubecoords, per each vert of a face orientation +{ + { 2, 1, 6, 5 }, + { 3, 4, 7, 0 }, + { 4, 5, 6, 7 }, + { 1, 2, 3, 0 }, + { 6, 1, 0, 7 }, + { 5, 4, 3, 2 }, +}; + +const uchar fvmasks[64] = // mask of verts used given a mask of visible face orientations +{ + 0x00, 0x66, 0x99, 0xFF, 0xF0, 0xF6, 0xF9, 0xFF, + 0x0F, 0x6F, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC3, 0xE7, 0xDB, 0xFF, 0xF3, 0xF7, 0xFB, 0xFF, + 0xCF, 0xEF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x3C, 0x7E, 0xBD, 0xFF, 0xFC, 0xFE, 0xFD, 0xFF, + 0x3F, 0x7F, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +}; + +const uchar faceedgesidx[6][4] = // ordered edges surrounding each orient +{//1st face,2nd face + { 4, 5, 8, 10 }, + { 6, 7, 9, 11 }, + { 0, 2, 8, 9 }, + { 1, 3, 10,11 }, + { 0, 1, 4, 6 }, + { 2, 3, 5, 7 }, +}; + +const uchar faceedgesrcidx[6][4] = +{//0..1 = row edges, 2..3 = column edges + { 4, 5, 8, 10 }, + { 6, 7, 9, 11 }, + { 8, 9, 0, 2 }, + { 10, 11, 1, 3 }, + { 0, 1, 4, 6 }, + { 2, 3, 5, 7 }, +}; + +bool flataxisface(cube &c, int orient) +{ + uint face = c.faces[dimension(orient)]; + if(dimcoord(orient)) face >>= 4; + face &= 0x0F0F0F0F; + return face == 0x01010101*(face&0x0F); +} + +bool touchingface(cube &c, int orient) +{ + uint face = c.faces[dimension(orient)]; + return dimcoord(orient) ? (face&0xF0F0F0F0)==0x80808080 : (face&0x0F0F0F0F)==0; +} + +int faceconvexity(cube &c, int orient) +{ + /* // fast approximation + vec v[4]; + int d = dimension(orient); + loopi(4) vertrepl(c, *(ivec *)cubecoords[fv[orient][i]], v[i], d, dimcoord(orient)); + int n = (int)(v[0][d] - v[1][d] + v[2][d] - v[3][d]); + if (!dimcoord(orient)) n *= -1; + return n; // returns +ve if convex when tris are verts 012, 023. -ve for concave. + */ + // slow perfect + ivec v[4]; + + if(flataxisface(c, orient)) return 0; + + loopi(4) genvectorvert(cubecoords[fv[orient][i]], c, v[i]); + + ivec n; + n.cross(v[1].sub(v[0]), v[2].sub(v[0])); + int x = n.dot(v[0]), y = n.dot(v[3]); + if(x < y) return -1; // concave + else if(x > y) return 1; // convex + else return 0; // flat +} + +int faceorder(cube &c, int orient) +{ +/* + uchar *edges = &c.edges[4*dimension(orient)]; + uchar h[4]; + loopi(4) h[i] = dimcoord(orient) ? edges[i]>>4 : 8-(edges[i]&0xF); + if(h[0]+h[3]>VVEC_FRAC)+(pos[C[dim]]<>VVEC_FRAC)+(pos[R[dim]]<= 0) + { + if(cx <= o.x || cx >= o.x+dir.x) return 0; + } + else if(cx <= o.x+dir.x || cx >= o.x) return 0; + + int t = (o.y-cy) + (cx-o.x)*dir.y/dir.x; + if(t <= 0 || t >= size) return 0; + + r.x = cx; + r.y = cy + t; + return 1; +} + +static inline int clipfacevecx(const facevec &o, const facevec &dir, int cx, int cy, int size, facevec &r) +{ + if(dir.y >= 0) + { + if(cy <= o.y || cy >= o.y+dir.y) return 0; + } + else if(cy <= o.y+dir.y || cy >= o.y) return 0; + + int t = (o.x-cx) + (cy-o.y)*dir.x/dir.y; + if(t <= 0 || t >= size) return 0; + + r.x = cx + t; + r.y = cy; + return 1; +} + +static inline int clipfacevec(const facevec &o, const facevec &dir, int cx, int cy, int size, facevec *rvecs) +{ + int r = 0; + + if(o.x >= cx && o.x <= cx+size && + o.y >= cy && o.y <= cy+size && + ((o.x != cx && o.x != cx+size) || (o.y != cy && o.y != cy+size))) + { + rvecs[0].x = o.x; + rvecs[0].y = o.y; + r++; + } + + r += clipfacevecx(o, dir, cx, cy, size, rvecs[r]); + r += clipfacevecx(o, dir, cx, cy+size, size, rvecs[r]); + r += clipfacevecy(o, dir, cx, cy, size, rvecs[r]); + r += clipfacevecy(o, dir, cx+size, cy, size, rvecs[r]); + + ASSERT(r <= 2); + return r; +} + +static inline bool insideface(const facevec *p, int nump, const facevec *o) +{ + int bounds = 0; + loopi(4) + { + const facevec &cur = o[i], &next = o[(i+1)%4]; + if(cur == next) continue; + facevec dir(next.x-cur.x, next.y-cur.y); + int offset = dir.x*cur.y - dir.y*cur.x; + loopj(nump) if(dir.x*p[j].y - dir.y*p[j].x > offset) return false; + bounds++; + } + return bounds>=3; +} + +static inline int clipfacevecs(const facevec *o, int cx, int cy, int size, facevec *rvecs) +{ + cx <<= VVEC_FRAC; + cy <<= VVEC_FRAC; + size <<= VVEC_FRAC; + + int r = 0; + loopi(4) + { + const facevec &cur = o[i], &next = o[(i+1)%4]; + if(cur == next) continue; + facevec dir(next.x-cur.x, next.y-cur.y); + r += clipfacevec(cur, dir, cx, cy, size, &rvecs[r]); + } + facevec corner[4] = {facevec(cx, cy), facevec(cx+size, cy), facevec(cx+size, cy+size), facevec(cx, cy+size)}; + loopi(4) if(insideface(&corner[i], 1, o)) rvecs[r++] = corner[i]; + ASSERT(r <= 8); + return r; +} + +bool collapsedface(uint cfe) +{ + return ((cfe >> 4) & 0x0F0F) == (cfe & 0x0F0F) || + ((cfe >> 20) & 0x0F0F) == ((cfe >> 16) & 0x0F0F); +} + +static inline bool occludesface(cube &c, int orient, const ivec &o, int size, const ivec &vo, int vsize, uchar vmat, uchar nmat, uchar matmask, const facevec *vf) +{ + int dim = dimension(orient); + if(!c.children) + { + if(nmat != MAT_AIR && c.ext && (c.ext->material&matmask) == nmat) + { + facevec nf[8]; + return clipfacevecs(vf, o[C[dim]], o[R[dim]], size, nf) < 3; + } + if(isentirelysolid(c)) return true; + if(vmat != MAT_AIR && c.ext && ((c.ext->material&matmask) == vmat || (isliquid(vmat) && isclipped(c.ext->material&MATF_VOLUME)))) return true; + if(touchingface(c, orient) && faceedges(c, orient) == F_SOLID) return true; + facevec cf[8]; + int numc = clipfacevecs(vf, o[C[dim]], o[R[dim]], size, cf); + if(numc < 3) return true; + if(isempty(c) || !touchingface(c, orient)) return false; + facevec of[4]; + genfacevecs(c, orient, o, size, false, of); + return insideface(cf, numc, of); + } + + size >>= 1; + int coord = dimcoord(orient); + loopi(8) if(octacoord(dim, i) == coord) + { + if(!occludesface(c.children[i], orient, ivec(i, o.x, o.y, o.z, size), size, vo, vsize, vmat, nmat, matmask, vf)) return false; + } + + return true; +} + +bool visibleface(cube &c, int orient, int x, int y, int z, int size, uchar mat, uchar nmat, uchar matmask) +{ + uint cfe = faceedges(c, orient); + if(mat != MAT_AIR) + { + if(cfe==F_SOLID && touchingface(c, orient)) return false; + } + else + { + if(!touchingface(c, orient)) return true; + if(collapsedface(cfe)) return false; + } + + cube &o = neighbourcube(x, y, z, size, -size, orient); + if(&o==&c) return false; + + if(lusize > size || (lusize == size && !o.children)) + { + if(nmat != MAT_AIR && o.ext && (o.ext->material&matmask) == nmat) return true; + if(isentirelysolid(o)) return false; + if(mat != MAT_AIR && o.ext && ((o.ext->material&matmask) == mat || (isliquid(mat) && (o.ext->material&MATF_VOLUME) == MAT_GLASS))) return false; + if(isempty(o) || !touchingface(o, opposite(orient))) return true; + if(faceedges(o, opposite(orient)) == F_SOLID) return false; + + ivec vo(x, y, z); + vo.mask(VVEC_INT_MASK); + lu.mask(VVEC_INT_MASK); + facevec cf[4], of[4]; + genfacevecs(c, orient, vo, size, mat != MAT_AIR, cf); + genfacevecs(o, opposite(orient), lu, lusize, false, of); + return !insideface(cf, 4, of); + } + + ivec vo(x, y, z); + vo.mask(VVEC_INT_MASK); + lu.mask(VVEC_INT_MASK); + facevec cf[4]; + genfacevecs(c, orient, vo, size, mat != MAT_AIR, cf); + return !occludesface(o, opposite(orient), lu, lusize, vo, size, mat, nmat, matmask, cf); +} + +void calcvert(cube &c, int x, int y, int z, int size, vvec &v, int i, bool solid) +{ + ivec vv; + if(solid || isentirelysolid(c)) vv = cubecoords[i]; + else genvectorvert(cubecoords[i], c, vv); + v = vvec(vv.v); + // avoid overflow + if(size>=8) v.mul(size/8); + else v.div(8/size); + v.add(vvec(x, y, z)); +} + +void calcvert(cube &c, int x, int y, int z, int size, vec &v, int i, bool solid) +{ + ivec vv; + if(solid || isentirelysolid(c)) vv = cubecoords[i]; + else genvectorvert(cubecoords[i], c, vv); + v = vv.tovec().mul(size/8.0f).add(vec(x, y, z)); +} + +int calcverts(cube &c, int x, int y, int z, int size, vvec *verts, bool *usefaces) +{ + int vertused = 0; + loopi(6) if((usefaces[i] = visibleface(c, i, x, y, z, size))) vertused |= fvmasks[1<v2 < y->v2) return -1; + if(x->v2 > y->v2) return 1; + if(x->u1 < y->u1) return -1; + if(x->u1 > y->u1) return 1; + return 0; +} + +static int mergefacev(int orient, cubeface *m, int sz, cubeface &n) +{ + for(int i = sz-1; i >= 0; --i) + { + if(m[i].v2 < n.v1) break; + if(m[i].v2 == n.v1 && m[i].u1 == n.u1 && m[i].u2 == n.u2) + { + if(m[i].c) ext(*m[i].c).merged |= 1< faces; +}; + +static hashtable cfaces; + +void mincubeface(cube &cu, int orient, const ivec &o, int size, const mergeinfo &orig, mergeinfo &cf) +{ + int dim = dimension(orient); + if(cu.children) + { + size >>= 1; + int coord = dimcoord(orient); + loopi(8) if(octacoord(dim, i) == coord) + mincubeface(cu.children[i], orient, ivec(i, o.x, o.y, o.z, size), size, orig, cf); + return; + } + int c = C[dim], r = R[dim]; + ushort uco = ushort((o[c]&VVEC_INT_MASK)<>VVEC_FRAC)), + u1 = max(c1&0xF, c2&0xF)*scale+uco, u2 = min(c1>>4, c2>>4)*scale+uco, + v1 = max(r1&0xF, r2&0xF)*scale+vco, v2 = min(r1>>4, r2>>4)*scale+vco; + u1 = max(u1, orig.u1); + u2 = min(u2, orig.u2); + v1 = max(v1, orig.v1); + v2 = min(v2, orig.v2); + if(v2-v1==vc2-vc1) + { + if(u2-u1==uc2-uc1) return; + if(u1==uc1) uc1 = u2; + if(u2==uc2) uc2 = u1; + } + else if(u2-u1==uc2-uc1) + { + if(v1==vc1) vc1 = v2; + if(v2==vc2) vc2 = v1; + } + } + if(uc1==uc2 || vc1==vc2) return; + cf.u1 = min(cf.u1, uc1); + cf.u2 = max(cf.u2, uc2); + cf.v1 = min(cf.v1, vc1); + cf.v2 = max(cf.v2, vc2); +} + +bool mincubeface(cube &cu, int orient, const ivec &co, int size, mergeinfo &orig) +{ + cube &nc = neighbourcube(co.x, co.y, co.z, size, -size, orient); + mergeinfo mincf; + mincf.u1 = orig.u2; + mincf.u2 = orig.u1; + mincf.v1 = orig.v2; + mincf.v2 = orig.v1; + mincubeface(nc, opposite(orient), lu, lusize, orig, mincf); + bool smaller = false; + if(mincf.u1 > orig.u1) { orig.u1 = mincf.u1; smaller = true; } + if(mincf.u2 < orig.u2) { orig.u2 = mincf.u2; smaller = true; } + if(mincf.v1 > orig.v1) { orig.v1 = mincf.v1; smaller = true; } + if(mincf.v2 < orig.v2) { orig.v2 = mincf.v2; smaller = true; } + return smaller; +} + +VAR(minface, 0, 1, 1); + +bool gencubeface(cube &cu, int orient, const ivec &co, int size, ivec &n, int &offset, cubeface &cf) +{ + uchar cfe[4]; + *(uint *)cfe = faceedges(cu, orient); + if(cfe[0]!=cfe[1] || cfe[2]!=cfe[3] || (cfe[0]>>4)==(cfe[0]&0xF) || (cfe[2]>>4)==(cfe[2]&0xF)) return false; + if(faceconvexity(cu, orient)) return false; + + cf.c = &cu; + + ivec v[4]; + loopi(4) genvectorvert(cubecoords[fv[orient][i]], cu, v[i]); + + int scale = size/(8>>VVEC_FRAC); + v[3].mul(scale); + int dim = dimension(orient), c = C[dim], r = R[dim]; + cf.u1 = cf.u2 = ushort(v[3][c]); + cf.v1 = cf.v2 = ushort(v[3][r]); + + loopi(3) + { + ushort uc = ushort(v[i][c]*scale), vc = ushort(v[i][r]*scale); + cf.u1 = min(cf.u1, uc); + cf.u2 = max(cf.u2, uc); + cf.v1 = min(cf.v1, vc); + cf.v2 = max(cf.v2, vc); + } + + ivec vo(co); + vo.mask(VVEC_INT_MASK); + vo.mul(1<>= 1; + n[1] >>= 1; + n[2] >>= 1; + } + + v[3].add(vo); + offset = -n.dot(v[3]); + + if(minface && touchingface(cu, orient) && mincubeface(cu, orient, co, size, cf)) + { + ext(cu).merged |= 1<mergeorigin&(1<mergeorigin&(1<<(i+orient+1))) total++; + mergeinfo *m = new mergeinfo[total+1]; + if(index) memcpy(m, c.ext->merges, index*sizeof(mergeinfo)); + if(total>index) memcpy(&m[index+1], &c.ext->merges[index], (total-index)*sizeof(mergeinfo)); + if(c.ext->merges) delete[] c.ext->merges; + c.ext->merges = m; + m += index; + c.ext->mergeorigin |= 1<u1 = cf.u1; + m->u2 = cf.u2; + m->v1 = cf.v1; + m->v2 = cf.v2; +} + +void freemergeinfo(cube &c) +{ + if(!c.ext) return; + c.ext->mergeorigin = 0; + DELETEA(c.ext->merges); +} + +VAR(maxmerge, 0, 6, VVEC_INT-1); + +static int genmergeprogress = 0; + +void genmergeinfo(cube *c = worldroot, const ivec &o = ivec(0, 0, 0), int size = hdr.worldsize>>1) +{ + if((genmergeprogress++&0x7FF)==0) show_out_of_renderloop_progress(float(genmergeprogress)/allocnodes, "merging surfaces..."); + loopi(8) + { + ivec co(i, o.x, o.y, o.z, size); + if(c[i].ext) + { + if(c[i].ext->merges) freemergeinfo(c[i]); + c[i].ext->merged = 0; + } + if(c[i].children) genmergeinfo(c[i].children, co, size>>1); + else if(!isempty(c[i])) loopj(6) if(visibleface(c[i], j, co.x, co.y, co.z, size)) + { + cfkey k; + cubeface cf; + if(gencubeface(c[i], j, co, size, k.n, k.offset, cf)) + { + if(size >= 1<merged&(1<ext && val.faces[j].c->ext->merged&(1<= 8>>VVEC_FRAC); + v[0].mul(size/(8>>VVEC_FRAC)); + v[0].add(vo); + int offset = -n.dot(v[0]); + + int dim = dimension(orient), c = C[dim], r = R[dim]; + loopi(4) + { + const ivec &coords = cubecoords[fv[orient][i]]; + int cc = coords[c] ? m.u2 : m.u1, + rc = coords[r] ? m.v2 : m.v1, + dc = -(offset + n[c]*cc + n[r]*rc)/n[dim]; + vv[i][c] = ushort(cc); + vv[i][r] = ushort(rc); + vv[i][dim] = ushort(dc); + } + + if(p) + { + ivec po(co); + po.mask(~VVEC_INT_MASK); + vec pn(n.tovec()); + float mag = pn.magnitude(); + pn.div(mag); + *p = plane(pn, (offset-(n.dot(po)<= d2 && + mo[c] <= m.u1 && mo[c] + (1<= m.u2 && + mo[r] <= m.v1 && mo[r] + (1<= m.v2) + break; + bits++; + } + return bits-VVEC_FRAC; +} + +void invalidatemerges(cube &c) +{ + if(c.ext) + { + if(c.ext->va) + { + if(!(c.ext->va->hasmerges&(MERGE_PART | MERGE_ORIGIN))) return; + destroyva(c.ext->va); + c.ext->va = NULL; + } + if(c.ext->merged) + { + brightencube(c); + c.ext->merged = 0; + if(c.ext->merges) freemergeinfo(c); + } + if(c.ext->tjoints >= 0) c.ext->tjoints = -1; + } + if(c.children) loopi(8) invalidatemerges(c.children[i]); +} + +void calcmerges() +{ + genmergeprogress = 0; + genmergeinfo(); +} + diff --git a/src/engine/octa.h b/src/engine/octa.h new file mode 100644 index 0000000..c3f5e90 --- /dev/null +++ b/src/engine/octa.h @@ -0,0 +1,301 @@ +// 6-directional octree heightfield map format + +struct elementset +{ + ushort texture, lmid, envmap; + ushort length[6]; + ushort minvert[6], maxvert[6]; +}; + +enum +{ + EMID_NONE = 0, + EMID_CUSTOM, + EMID_SKY, + EMID_RESERVED +}; + +struct materialsurface +{ + ivec o; + ushort csize, rsize; + union + { + short index; + short depth; + }; + uchar material, orient; + union + { + entity *light; + ushort envmap; + uchar ends; + }; +}; + +struct surfaceinfo +{ + uchar texcoords[8]; + uchar w, h; + ushort x, y, lmid; +}; + +struct surfacenormals +{ + bvec normals[4]; +}; + +struct grasstri +{ + vvec v[4]; + surfaceinfo *surface; + ushort texture; +}; + +enum +{ + GRASS_SAMPLE = 0<<14, + GRASS_BOUNDS = 1<<14, + GRASS_TEXTURE = 2<<14, + + GRASS_TYPE = 3<<14 +}; + +struct grassbounds +{ + ushort x, y, z; + ushort radius, numsamples; +}; + +struct grasssample +{ + ushort x, y, z; + uchar color[3], reserved; +}; + +struct grasstexture +{ + ushort x, y, z; + ushort texture, reserved; +}; + +struct occludequery +{ + void *owner; + GLuint id; + int fragments; +}; + +struct vtxarray; + +struct octaentities +{ + vector mapmodels; + vector other; + occludequery *query; + octaentities *next; + int distance; + ivec o; + int size; + ivec bbmin, bbmax; + + octaentities(const ivec &o, int size) : query(0), o(o), size(size), bbmin(o), bbmax(o) + { + bbmin.add(size); + } +}; + +enum +{ + OCCLUDE_NOTHING = 0, + OCCLUDE_GEOM, + OCCLUDE_BB, + OCCLUDE_PARENT +}; + +enum +{ + MERGE_ORIGIN = 1<<0, + MERGE_PART = 1<<1, + MERGE_USE = 1<<2 +}; + +struct vtxarray +{ + vtxarray *parent; + vector children; + vtxarray *next, *rnext; // linked list of visible VOBs + vertex *vdata; // vertex data + ushort voffset; // offset into vertex data + ushort *edata, *skydata; // vertex indices + GLuint vbuf, ebuf, skybuf; // VBOs + ushort minvert, maxvert; // DRE info + elementset *eslist; // List of element indices sets (range) per texture + materialsurface *matbuf; // buffer of material surfaces + int verts, tris, texs, texmask, sky, explicitsky, skyfaces, skyclip, matsurfs, distance; + double skyarea; + ivec o; + int size; // location and size of cube. + ivec geommin, geommax; // BB of geom + ivec shadowmapmin, shadowmapmax; // BB of shadowmapped surfaces + ivec matmin, matmax; // BB of any materials + ivec bbmin, bbmax; // BB of everything including children + uchar curvfc, occluded; + occludequery *query, *rquery; + vector *mapmodels; + vector *grasstris; + vector *grasssamples; + int hasmerges; + uint dynlightmask; + bool shadowed; +}; + +struct cube; + +struct clipplanes +{ + vec o, r; + int size; + plane p[12]; + cube *owner; +}; + +struct mergeinfo +{ + ushort u1, u2, v1, v2; +}; + +struct tjoint +{ + int next; + ushort offset; + uchar edge; +}; + +struct cubeext +{ + uchar material; // empty-space material + uchar visible; // visible faces of the cube + uchar merged; // merged faces of the cube + uchar mergeorigin; // whether this face describes a larger merged face + vtxarray *va; // vertex array for children, or NULL + clipplanes *clip; // collision planes + surfaceinfo *surfaces; // lighting info for each surface + surfacenormals *normals; // per-vertex normals for each surface + octaentities *ents; // list of map entites totally inside cube + mergeinfo *merges; // bounds of merged surfaces + int tjoints; // linked list of t-joints +}; + +struct cube +{ + cube *children; // points to 8 cube structures which are its children, or NULL. -Z first, then -Y, -X + union + { + uchar edges[12]; // edges of the cube, each uchar is 2 4bit values denoting the range. + // see documentation jpgs for more info. + uint faces[3]; // 4 edges of each dimension together representing 2 perpendicular faces + }; + union + { + ushort texture[6]; // one for each face. same order as orient. + struct + { + uchar clipmask, vismask; + uchar vismasks[8]; + }; + }; + cubeext *ext; // extended info for the cube +}; + +static inline cubeext &ext(cube &c) +{ + extern cubeext *newcubeext(cube &c); + return *(c.ext ? c.ext : newcubeext(c)); +} + +struct block3 +{ + ivec o, s; + int grid, orient; + block3() {} + block3(const selinfo &sel) : o(sel.o), s(sel.s), grid(sel.grid), orient(sel.orient) {} + cube *c() { return (cube *)(this+1); } + int size() const { return s.x*s.y*s.z; } +}; + +struct editinfo +{ + block3 *copy; + editinfo() : copy(NULL) {} +}; + +struct undoent { int i; entity e; }; +struct undoblock // undo header, all data sits in payload +{ + undoblock *prev, *next; + int size, timestamp, numents; // if numents is 0, is a cube undo record, otherwise an entity undo record + + block3 *block() { return (block3 *)(this + 1); } + int *gridmap() + { + block3 *ub = block(); + return (int *)(ub->c() + ub->size()); + } + undoent *ents() { return (undoent *)(this + 1); } +}; + +extern cube *worldroot; // the world data. only a ptr to 8 cubes (ie: like cube.children above) +extern ivec lu; +extern int lusize; +extern int wtris, wverts, vtris, vverts, glde, gbatches, rplanes; +extern int allocnodes, allocva, selchildcount; + +const uint F_EMPTY = 0; // all edges in the range (0,0) +const uint F_SOLID = 0x80808080; // all edges in the range (0,8) + +#define isempty(c) ((c).faces[0]==F_EMPTY) +#define isentirelysolid(c) ((c).faces[0]==F_SOLID && (c).faces[1]==F_SOLID && (c).faces[2]==F_SOLID) +#define setfaces(c, face) { (c).faces[0] = (c).faces[1] = (c).faces[2] = face; } +#define solidfaces(c) setfaces(c, F_SOLID) +#define emptyfaces(c) setfaces(c, F_EMPTY) + +#define edgemake(a, b) ((b)<<4|a) +#define edgeget(edge, coord) ((coord) ? (edge)>>4 : (edge)&0xF) +#define edgeset(edge, coord, val) ((edge) = ((coord) ? ((edge)&0xF)|((val)<<4) : ((edge)&0xF0)|(val))) + +#define cubeedge(c, d, x, y) ((c).edges[(((d)<<2)+((y)<<1)+(x))]) + +#define octadim(d) (1<<(d)) // creates mask for bit of given dimension +#define octacoord(d, i) (((i)&octadim(d))>>(d)) +#define oppositeocta(d, i) ((i)^octadim(D[d])) +#define octaindex(d,x,y,z) (octadim(D[d])*(z)+octadim(C[d])*(y)+octadim(R[d])*(x)) +#define octastep(x, y, z, scale) (((((z)>>(scale))&1)<<2) | ((((y)>>(scale))&1)<<1) | (((x)>>(scale))&1)) + +#define loopoctabox(c, size, o, s) uchar possible = octantrectangleoverlap(c, size, o, s); loopi(8) if(possible&(1<>1) +#define dimcoord(orient) ((orient)&1) +#define opposite(orient) ((orient)^1) + +enum +{ + VFC_FULL_VISIBLE = 0, + VFC_PART_VISIBLE, + VFC_FOGGED, + VFC_NOT_VISIBLE, + PVS_FULL_VISIBLE, + PVS_PART_VISIBLE, + PVS_FOGGED +}; + diff --git a/src/engine/octaedit.cpp b/src/engine/octaedit.cpp new file mode 100644 index 0000000..267413e --- /dev/null +++ b/src/engine/octaedit.cpp @@ -0,0 +1,1773 @@ +#include "pch.h" +#include "engine.h" + +extern int outline; + +void boxs(int orient, vec o, const vec &s) +{ + int d = dimension(orient), + dc= dimcoord(orient); + + float f = !outline ? 0 : (dc>0 ? 0.2f : -0.2f); + o[D[d]] += float(dc) * s[D[d]] + f, + + glBegin(GL_POLYGON); + + glVertex3fv(o.v); o[R[d]] += s[R[d]]; + glVertex3fv(o.v); o[C[d]] += s[C[d]]; + glVertex3fv(o.v); o[R[d]] -= s[R[d]]; + glVertex3fv(o.v); + + glEnd(); + xtraverts += 4; +} + +void boxs3D(const vec &o, vec s, int g) +{ + s.mul(g); + loopi(6) + boxs(i, o, s); +} + +void boxsgrid(int orient, vec o, vec s, int g) +{ + int d = dimension(orient), + dc= dimcoord(orient); + float ox = o[R[d]], + oy = o[C[d]], + xs = s[R[d]], + ys = s[C[d]], + f = !outline ? 0 : (dc>0 ? 0.2f : -0.2f); + + o[D[d]] += dc * s[D[d]]*g + f; + + glBegin(GL_LINES); + loop(x, xs) { + o[R[d]] += g; + glVertex3fv(o.v); + o[C[d]] += ys*g; + glVertex3fv(o.v); + o[C[d]] = oy; + } + loop(y, ys) { + o[C[d]] += g; + o[R[d]] = ox; + glVertex3fv(o.v); + o[R[d]] += xs*g; + glVertex3fv(o.v); + } + glEnd(); + xtraverts += 2*int(xs+ys); +} + +selinfo sel = { 0 }, lastsel; + +int orient = 0; +int gridsize = 8; +ivec cor, lastcor; +ivec cur, lastcur; + +extern int entediting; +bool editmode = false; +bool havesel = false; +bool hmapsel = false; +int horient = 0; + +extern int entmoving; + +VARF(dragging, 0, 0, 1, + if(!dragging || cor[0]<0) return; + lastcur = cur; + lastcor = cor; + sel.grid = gridsize; + sel.orient = orient; +); + +VARF(moving, 0, 0, 1, + if(!moving) return; + vec v(cur.v); v.add(1); + moving = pointinsel(sel, v); + if(moving) havesel = false; // tell cursorupdate to create handle +); + +VARF(gridpower, 3-VVEC_FRAC, 3, VVEC_INT-1, +{ + if(dragging) return; + gridsize = 1<=hdr.worldsize) gridsize = hdr.worldsize/2; + cancelsel(); +}); + +VAR(passthroughsel, 0, 0, 1); +VAR(editing, 1, 0, 0); +VAR(selectcorners, 0, 0, 1); +VARF(hmapedit, 0, 0, 1, horient = sel.orient); + +void forcenextundo() { lastsel.orient = -1; } + +void cubecancel() +{ + havesel = false; + moving = dragging = hmapedit = passthroughsel = 0; + forcenextundo(); +} + +extern void entcancel(); + +void cancelsel() +{ + cubecancel(); + entcancel(); +} + +void toggleedit(bool force) +{ + if(player->state!=CS_ALIVE && player->state!=CS_DEAD && player->state!=CS_EDITING) return; // do not allow dead players to edit to avoid state confusion + if(!editmode && !cc->allowedittoggle()) return; // not in most multiplayer modes + if(!(editmode = !editmode)) + { + player->state = player->editstate; + player->o.z -= player->eyeheight; // entinmap wants feet pos + entinmap(player); // find spawn closest to current floating pos + } + else + { + cl->resetgamestate(); + player->editstate = player->state; + player->state = CS_EDITING; + } + cancelsel(); + keyrepeat(editmode); + editing = entediting = editmode; + extern int fullbright; + if(fullbright) initlights(); + if(!force) cc->edittoggled(editmode); +} + +bool noedit(bool view) +{ + if(!editmode) { conoutf(CON_ERROR, "operation only allowed in edit mode"); return true; } + if(view || haveselent()) return false; + float r = 1.0f; + vec o, s; + o = sel.o.v; + s = sel.s.v; + s.mul(float(sel.grid) / 2.0f); + o.add(s); + r = float(max(s.x, max(s.y, s.z))); + bool viewable = (isvisiblesphere(r, o) != VFC_NOT_VISIBLE); + if(!viewable) conoutf(CON_ERROR, "selection not in view"); + return !viewable; +} + +extern void createheightmap(); + +void reorient() +{ + sel.cx = 0; + sel.cy = 0; + sel.cxs = sel.s[R[dimension(orient)]]*2; + sel.cys = sel.s[C[dimension(orient)]]*2; + sel.orient = orient; +} + +void selextend() +{ + if(noedit(true)) return; + loopi(3) + { + if(cur[i]=sel.o[i]+sel.s[i]*sel.grid) + { + sel.s[i] = (cur[i]-sel.o[i])/sel.grid+1; + } + } +} + +ICOMMAND(edittoggle, "", (), toggleedit(false)); +COMMAND(entcancel, ""); +COMMAND(cubecancel, ""); +COMMAND(cancelsel, ""); +COMMAND(reorient, ""); +COMMAND(selextend, ""); + +///////// selection support ///////////// + +cube &blockcube(int x, int y, int z, const block3 &b, int rgrid) // looks up a world cube, based on coordinates mapped by the block +{ + ivec s(dimension(b.orient), x*b.grid, y*b.grid, dimcoord(b.orient)*(b.s[dimension(b.orient)]-1)*b.grid); + + return neighbourcube(b.o.x+s.x, b.o.y+s.y, b.o.z+s.z, -z*b.grid, rgrid, b.orient); +} + +#define loopxy(b) loop(y,(b).s[C[dimension((b).orient)]]) loop(x,(b).s[R[dimension((b).orient)]]) +#define loopxyz(b, r, f) { loop(z,(b).s[D[dimension((b).orient)]]) loopxy((b)) { cube &c = blockcube(x,y,z,b,r); f; } } +#define loopselxyz(f) { makeundo(); loopxyz(sel, sel.grid, f); changed(sel); } +#define selcube(x, y, z) blockcube(x, y, z, sel, sel.grid) + +////////////// cursor /////////////// + +int selchildcount=0; + +ICOMMAND(havesel, "", (), intret(havesel ? selchildcount : 0)); + +void countselchild(cube *c, const ivec &cor, int size) +{ + ivec ss(sel.s); + ss.mul(sel.grid); + loopoctabox(cor, size, sel.o, ss) + { + ivec o(i, cor.x, cor.y, cor.z, size); + if(c[i].children) countselchild(c[i].children, o, size/2); + else selchildcount++; + } +} + +void normalizelookupcube(int x, int y, int z) +{ + if(lusize>gridsize) + { + lu.x += (x-lu.x)/gridsize*gridsize; + lu.y += (y-lu.y)/gridsize*gridsize; + lu.z += (z-lu.z)/gridsize*gridsize; + } + else if(gridsize>lusize) + { + lu.x &= ~(gridsize-1); + lu.y &= ~(gridsize-1); + lu.z &= ~(gridsize-1); + } + lusize = gridsize; +} + +void updateselection() +{ + sel.o.x = min(lastcur.x, cur.x); + sel.o.y = min(lastcur.y, cur.y); + sel.o.z = min(lastcur.z, cur.z); + sel.s.x = abs(lastcur.x-cur.x)/sel.grid+1; + sel.s.y = abs(lastcur.y-cur.y)/sel.grid+1; + sel.s.z = abs(lastcur.z-cur.z)/sel.grid+1; +} + +void editmoveplane(const vec &o, const vec &ray, int d, float off, vec &handle, vec &dest, bool first) +{ + plane pl(d, off); + float dist = 0.0f; + + if(pl.rayintersect(player->o, ray, dist)) + { + dest = ray; + dest.mul(dist); + dest.add(player->o); + if(first) + { + handle = dest; + handle.sub(o); + } + dest.sub(handle); + } +} + +inline bool isheightmap(int orient, int d, bool empty, cube *c); +extern void entdrag(const vec &ray); +extern bool hoveringonent(int ent, int orient); +extern void renderentselection(const vec &o, const vec &ray, bool entmoving); +extern float rayent(const vec &o, const vec &ray, vec &hitpos, float radius, int mode, int size, int &orient, int &ent); + +VAR(gridlookup, 0, 0, 1); +VAR(passthroughcube, 0, 1, 1); + +void cursorupdate() +{ + if(sel.grid == 0) sel.grid = gridsize; + + vec target(worldpos); + if(!insideworld(target)) loopi(3) + target[i] = max(min(target[i], float(hdr.worldsize)), 0.0f); + vec ray(target); + ray.sub(player->o).normalize(); + int d = dimension(sel.orient), + od = dimension(orient), + odc = dimcoord(orient); + + bool hidecursor = g3d_windowhit(true, false), hovering = false; + hmapsel = false; + + if(moving) + { + ivec e; + static vec v, handle; + editmoveplane(sel.o.tovec(), ray, od, sel.o[D[od]]+odc*sel.grid*sel.s[D[od]], handle, v, !havesel); + if(!havesel) + { + v.add(handle); + (e = handle).mask(~(sel.grid-1)); + v.sub(handle = e.v); + havesel = true; + } + (e = v).mask(~(sel.grid-1)); + sel.o[R[od]] = e[R[od]]; + sel.o[C[od]] = e[C[od]]; + } + else + if(entmoving) + { + entdrag(ray); + } + else + { + vec v; + ivec w; + float sdist = 0, wdist = 0, t; + int entorient = 0, ent = -1; + + wdist = rayent(player->o, ray, v, 0, (editmode && showmat ? RAY_EDITMAT : 0) // select cubes first + | (!dragging && entediting ? RAY_ENTS : 0) + | RAY_SKIPFIRST + | (passthroughcube==1 ? RAY_PASS : 0), gridsize, entorient, ent); + + if((havesel || dragging) && !passthroughsel && !hmapedit) // now try selecting the selection + if(rayrectintersect(sel.o.tovec(), vec(sel.s.tovec()).mul(sel.grid), player->o, ray, sdist, orient)) + { // and choose the nearest of the two + if(sdist < wdist) + { + wdist = sdist; + ent = -1; + } + } + + if((hovering = hoveringonent(hidecursor ? -1 : ent, entorient))) + { + if(!havesel) + { + selchildcount = 0; + sel.s = ivec(0, 0, 0); + } + } + else + { + + v = ray; + v.mul(wdist+0.1f); + v.add(player->o); + w = v; + cube *c = &lookupcube(w.x, w.y, w.z); + if(gridlookup && !dragging && !moving && !havesel && hmapedit!=1) gridsize = lusize; + int mag = lusize / gridsize; + normalizelookupcube(w.x, w.y, w.z); + if(sdist == 0 || sdist > wdist) rayrectintersect(lu.tovec(), vec(gridsize), player->o, ray, t=0, orient); // just getting orient + cur = lu; + cor = vec(v).mul(2).div(gridsize); + od = dimension(orient); + d = dimension(sel.orient); + + if(hmapedit==1 && dimcoord(horient) == (ray[dimension(horient)]<0)) + { + hmapsel = isheightmap(horient, dimension(horient), false, c); + if(hmapsel) + od = dimension(orient = horient); + } + + if(dragging) + { + updateselection(); + sel.cx = min(cor[R[d]], lastcor[R[d]]); + sel.cy = min(cor[C[d]], lastcor[C[d]]); + sel.cxs = max(cor[R[d]], lastcor[R[d]]); + sel.cys = max(cor[C[d]], lastcor[C[d]]); + + if(!selectcorners) + { + sel.cx &= ~1; + sel.cy &= ~1; + sel.cxs &= ~1; + sel.cys &= ~1; + sel.cxs -= sel.cx-2; + sel.cys -= sel.cy-2; + } + else + { + sel.cxs -= sel.cx-1; + sel.cys -= sel.cy-1; + } + + sel.cx &= 1; + sel.cy &= 1; + havesel = true; + } + else if(!havesel) + { + sel.o = lu; + sel.s.x = sel.s.y = sel.s.z = 1; + sel.cx = sel.cy = 0; + sel.cxs = sel.cys = 2; + sel.grid = gridsize; + sel.orient = orient; + d = od; + } + + sel.corner = (cor[R[d]]-(lu[R[d]]*2)/gridsize)+(cor[C[d]]-(lu[C[d]]*2)/gridsize)*2; + selchildcount = 0; + countselchild(worldroot, ivec(0, 0, 0), hdr.worldsize/2); + if(mag>1 && selchildcount==1) selchildcount = -mag; + } + } + + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); + + // cursors + + renderentselection(player->o, ray, entmoving!=0); + + enablepolygonoffset(GL_POLYGON_OFFSET_LINE); + + if(!moving && !hovering && !hidecursor) + { + if(hmapedit==1) + glColor3ub(0, hmapsel ? 255 : 40, 0); + else + glColor3ub(120,120,120); + boxs(orient, lu.tovec(), vec(lusize)); + } + + // selections + if(havesel) + { + d = dimension(sel.orient); + glColor3ub(50,50,50); // grid + boxsgrid(sel.orient, sel.o.tovec(), sel.s.tovec(), sel.grid); + glColor3ub(200,0,0); // 0 reference + boxs3D(sel.o.tovec().sub(0.5f*min(gridsize*0.25f, 2.0f)), vec(min(gridsize*0.25f, 2.0f)), 1); + glColor3ub(200,200,200);// 2D selection box + vec co(sel.o.v), cs(sel.s.v); + co[R[d]] += 0.5f*(sel.cx*gridsize); + co[C[d]] += 0.5f*(sel.cy*gridsize); + cs[R[d]] = 0.5f*(sel.cxs*gridsize); + cs[C[d]] = 0.5f*(sel.cys*gridsize); + cs[D[d]] *= gridsize; + boxs(sel.orient, co, cs); + if(hmapedit==1) // 3D selection box + glColor3ub(0,120,0); + else + glColor3ub(0,0,120); + boxs3D(sel.o.tovec(), sel.s.tovec(), sel.grid); + } + + disablepolygonoffset(GL_POLYGON_OFFSET_LINE); + + glDisable(GL_BLEND); +} + +//////////// ready changes to vertex arrays //////////// + +static bool invalidatedmerges = false, haschanged = false; + +void readychanges(block3 &b, cube *c, const ivec &cor, int size) +{ + loopoctabox(cor, size, b.o, b.s) + { + ivec o(i, cor.x, cor.y, cor.z, size); + if(c[i].ext) + { + if(c[i].ext->va) // removes va s so that octarender will recreate + { + int hasmerges = c[i].ext->va->hasmerges; + destroyva(c[i].ext->va); + c[i].ext->va = NULL; + if(hasmerges) + { + if(!invalidatedmerges) + { + show_out_of_renderloop_progress(0, "invalidating merged surfaces..."); + invalidatedmerges = true; + } + invalidatemerges(c[i]); + } + } + freeoctaentities(c[i]); + c[i].ext->tjoints = -1; + } + if(c[i].children) + { + if(size<=(8>>VVEC_FRAC)) + { + solidfaces(c[i]); + discardchildren(c[i]); + brightencube(c[i]); + } + else readychanges(b, c[i].children, o, size/2); + } + else brightencube(c[i]); + } +} + +void commitchanges() +{ + if(!haschanged) return; + haschanged = false; + invalidatedmerges = false; + + extern vector valist; + int oldlen = valist.length(); + entitiesinoctanodes(); + inbetweenframes = false; + octarender(); + inbetweenframes = true; + setupmaterials(oldlen); + invalidatepostfx(); + updatevabbs(); +} + +void changed(const block3 &sel, bool commit = true) +{ + if(sel.s.iszero()) return; + block3 b = sel; + loopi(3) b.s[i] *= b.grid; + b.grid = 1; + loopi(3) // the changed blocks are the selected cubes + { + b.o[i] -= 1; + b.s[i] += 2; + readychanges(b, worldroot, ivec(0, 0, 0), hdr.worldsize/2); + b.o[i] += 1; + b.s[i] -= 2; + } + haschanged = true; + + if(commit) commitchanges(); +} + +//////////// copy and undo ///////////// +cube copycube(cube &src) +{ + cube c = src; + c.ext = NULL; // src cube is responsible for va destruction + if(src.children) + { + c.children = newcubes(F_EMPTY); + loopi(8) c.children[i] = copycube(src.children[i]); + } + else if(src.ext && src.ext->material!=MAT_AIR) ext(c).material = src.ext->material; + return c; +} + +void pastecube(cube &src, cube &dest) +{ + discardchildren(dest); + dest = copycube(src); +} + +void blockcopy(const block3 &s, int rgrid, block3 *b) +{ + *b = s; + cube *q = b->c(); + loopxyz(s, rgrid, *q++ = copycube(c)); +} + +block3 *blockcopy(const block3 &s, int rgrid) +{ + block3 *b = (block3 *)new uchar[sizeof(block3)+sizeof(cube)*s.size()]; + blockcopy(s, rgrid, b); + return b; +} + +void freeblock(block3 *b, bool alloced = true) +{ + cube *q = b->c(); + loopi(b->size()) discardchildren(*q++); + if(alloced) delete[] b; +} + +void selgridmap(selinfo &sel, int *g) // generates a map of the cube sizes at each grid point +{ + loopxyz(sel, -sel.grid, (*g++ = lusize, c)); +} + +void freeundo(undoblock *u) +{ + if(!u->numents) freeblock(u->block(), false); + delete[] (uchar *)u; +} + +void pasteundo(undoblock *u) +{ + if(u->numents) pasteundoents(u); + else + { + block3 *b = u->block(); + cube *s = b->c(); + int *g = u->gridmap(); + loopxyz(*b, *g++, pastecube(*s++, c)); + } +} + +static inline int undosize(undoblock *u) +{ + if(u->numents) return u->numents*sizeof(undoent); + else + { + block3 *b = u->block(); + cube *q = b->c(); + int size = b->size(), total = size*sizeof(int); + loopj(size) total += familysize(*q++)*sizeof(cube); + return total; + } +} + +struct undolist +{ + undoblock *first, *last; + + undolist() : first(NULL), last(NULL) {} + + bool empty() { return !first; } + + void add(undoblock *u) + { + u->next = NULL; + u->prev = last; + if(!first) first = last = u; + else + { + last->next = u; + last = u; + } + } + + undoblock *popfirst() + { + undoblock *u = first; + first = first->next; + if(first) first->prev = NULL; + else last = NULL; + return u; + } + + undoblock *poplast() + { + undoblock *u = last; + last = last->prev; + if(last) last->next = NULL; + else first = NULL; + return u; + } +}; + +undolist undos, redos; +VARP(undomegs, 0, 5, 100); // bounded by n megs +int totalundos = 0; + +void pruneundos(int maxremain) // bound memory +{ + while(totalundos > maxremain && !undos.empty()) + { + undoblock *u = undos.popfirst(); + totalundos -= u->size; + freeundo(u); + } + //conoutf(CON_DEBUG, "undo: %d of %d(%%%d)", totalundos, undomegs<<20, totalundos*100/(undomegs<<20)); + while(!redos.empty()) + { + undoblock *u = redos.popfirst(); + totalundos -= u->size; + freeundo(u); + } +} + +void clearundos() { pruneundos(0); } + +COMMAND(clearundos, ""); + +undoblock *newundocube(selinfo &s) +{ + int ssize = s.size(), + selgridsize = ssize*sizeof(int), + blocksize = sizeof(block3)+ssize*sizeof(cube); + undoblock *u = (undoblock *)new uchar[sizeof(undoblock) + blocksize + selgridsize]; + u->numents = 0; + block3 *b = (block3 *)(u + 1); + blockcopy(s, -s.grid, b); + int *g = (int *)((uchar *)b + blocksize); + selgridmap(s, g); + return u; +} + +void addundo(undoblock *u) +{ + u->size = undosize(u); + u->timestamp = totalmillis; + undos.add(u); + totalundos += u->size; + pruneundos(undomegs<<20); +} + +void makeundoex(selinfo &s) +{ + if(multiplayer(false)) return; + undoblock *u = newundocube(s); + addundo(u); +} + +void makeundo() // stores state of selected cubes before editing +{ + if(lastsel==sel || sel.s.iszero()) return; + lastsel=sel; + makeundoex(sel); +} + +void swapundo(undolist &a, undolist &b, const char *s) +{ + if(noedit() || multiplayer()) return; + if(a.empty()) { conoutf(CON_WARN, "nothing more to %s", s); return; } + int ts = a.last->timestamp; + selinfo l = sel; + while(!a.empty() && ts==a.last->timestamp) + { + undoblock *u = a.poplast(), *r; + if(u->numents) r = copyundoents(u); + else + { + block3 *ub = u->block(); + l.o = ub->o; + l.s = ub->s; + l.grid = ub->grid; + l.orient = ub->orient; + r = newundocube(l); + } + r->size = u->size; + r->timestamp = totalmillis; + b.add(r); + pasteundo(u); + if(!u->numents) changed(l, false); + freeundo(u); + } + commitchanges(); + if(!hmapsel) + { + sel = l; + reorient(); + } + forcenextundo(); +} + +void editundo() { swapundo(undos, redos, "undo"); } +void editredo() { swapundo(redos, undos, "redo"); } + +editinfo *localedit = NULL; + +void freeeditinfo(editinfo *&e) +{ + if(!e) return; + if(e->copy) freeblock(e->copy); + delete e; + e = NULL; +} + +// guard against subdivision +#define protectsel(f) { undoblock *_u = newundocube(sel); f; pasteundo(_u); freeundo(_u); } + +void mpcopy(editinfo *&e, selinfo &sel, bool local) +{ + if(local) cl->edittrigger(sel, EDIT_COPY); + if(e==NULL) e = new editinfo; + if(e->copy) freeblock(e->copy); + e->copy = NULL; + protectsel(e->copy = blockcopy(block3(sel), sel.grid)); + changed(sel); +} + +void mppaste(editinfo *&e, selinfo &sel, bool local) +{ + if(e==NULL) return; + if(local) cl->edittrigger(sel, EDIT_PASTE); + if(e->copy) + { + sel.s = e->copy->s; + int o = sel.orient; + sel.orient = e->copy->orient; + cube *s = e->copy->c(); + loopselxyz(if (!isempty(*s) || s->children) pastecube(*s, c); s++); // 'transparent'. old opaque by 'delcube; paste' + sel.orient = o; + } +} + +void copy() +{ + if(noedit(true)) return; + mpcopy(localedit, sel, true); +} + +void pastehilite() +{ + if(!localedit) return; + sel.s = localedit->copy->s; + reorient(); + havesel = true; +} + +void paste() +{ + if(noedit()) return; + mppaste(localedit, sel, true); +} + +COMMAND(copy, ""); +COMMAND(pastehilite, ""); +COMMAND(paste, ""); +COMMANDN(undo, editundo, ""); +COMMANDN(redo, editredo, ""); + +///////////// height maps //////////////// + +#define MAXBRUSH 64 +#define MAXBRUSHC 63 +#define MAXBRUSH2 32 +int brush[MAXBRUSH][MAXBRUSH]; +VAR(brushx, 0, MAXBRUSH2, MAXBRUSH); +VAR(brushy, 0, MAXBRUSH2, MAXBRUSH); +bool paintbrush = 0; +int brushmaxx = 0, brushminx = MAXBRUSH; +int brushmaxy = 0, brushminy = MAXBRUSH; + +void clearbrush() +{ + memset(brush, 0, sizeof brush); + brushmaxx = brushmaxy = 0; + brushminx = brushminy = MAXBRUSH; + paintbrush = false; +} + +void brushvert(int *x, int *y, int *v) +{ + *x += MAXBRUSH2 - brushx + 1; // +1 for automatic padding + *y += MAXBRUSH2 - brushy + 1; + if(*x<0 || *y<0 || *x>=MAXBRUSH || *y>=MAXBRUSH) return; + brush[*x][*y] = clamp(*v, 0, 8); + paintbrush = paintbrush || (brush[*x][*y] > 0); + brushmaxx = min(MAXBRUSH-1, max(brushmaxx, *x+1)); + brushmaxy = min(MAXBRUSH-1, max(brushmaxy, *y+1)); + brushminx = max(0, min(brushminx, *x-1)); + brushminy = max(0, min(brushminy, *y-1)); +} + +vector htextures; + +COMMAND(clearbrush, ""); +COMMAND(brushvert, "iii"); +ICOMMAND(hmapcancel, "", (), htextures.setsizenodelete(0); ); +ICOMMAND(hmapselect, "", (), + int t = lookupcube(cur.x, cur.y, cur.z).texture[orient]; + int i = htextures.find(t); + if(i<0) + htextures.add(t); + else + htextures.remove(i); +); + +inline bool ishtexture(int t) +{ + loopv(htextures) + if(t == htextures[i]) + return false; + return true; +} + +VARP(bypassheightmapcheck, 0, 0, 1); // temp + +inline bool isheightmap(int o, int d, bool empty, cube *c) +{ + return havesel || + (empty && isempty(*c)) || + ishtexture(c->texture[o]); +} + +namespace hmap +{ +# define PAINTED 1 +# define NOTHMAP 2 +# define MAPPED 16 + uchar flags[MAXBRUSH][MAXBRUSH]; + cube *cmap[MAXBRUSHC][MAXBRUSHC][4]; + int mapz[MAXBRUSHC][MAXBRUSHC]; + int map [MAXBRUSH][MAXBRUSH]; + + selinfo changes; + bool selecting; + int d, dc, dr, dcr, biasup, br, hws, fg; + int gx, gy, gz, mx, my, mz, nx, ny, nz, bmx, bmy, bnx, bny; + uint fs; + selinfo hundo; + + cube *getcube(ivec t, int f) + { + t[d] += dcr*f*gridsize; + if(t[d] > nz || t[d] < mz) return NULL; + cube *c = &lookupcube(t.x, t.y, t.z, gridsize); + if(c->children) forcemip(*c); + discardchildren(*c); + if(!isheightmap(sel.orient, d, true, c)) return NULL; + if (t.x < changes.o.x) changes.o.x = t.x; + else if(t.x > changes.s.x) changes.s.x = t.x; + if (t.y < changes.o.y) changes.o.y = t.y; + else if(t.y > changes.s.y) changes.s.y = t.y; + if (t.z < changes.o.z) changes.o.z = t.z; + else if(t.z > changes.s.z) changes.s.z = t.z; + return c; + } + + uint getface(cube *c, int d) + { + return 0x0f0f0f0f & ((dc ? c->faces[d] : 0x88888888 - c->faces[d]) >> fs); + } + + void pushside(cube &c, int d, int x, int y, int z) + { + ivec a; + getcubevector(c, d, x, y, z, a); + a[R[d]] = 8 - a[R[d]]; + setcubevector(c, d, x, y, z, a); + } + + void addpoint(int x, int y, int z, int v) + { + if(!(flags[x][y] & MAPPED)) + map[x][y] = v + (z*8); + flags[x][y] |= MAPPED; + } + + void select(int x, int y, int z) + { + if((NOTHMAP & flags[x][y]) || (PAINTED & flags[x][y])) return; + ivec t(d, x+gx, y+gy, dc ? z : hws-z); + t.shl(gridpower); + + // selections may damage; must makeundo before + hundo.o = t; + hundo.o[D[d]] -= dcr*gridsize*2; + makeundoex(hundo); + + cube **c = cmap[x][y]; + loopk(4) c[k] = NULL; + c[1] = getcube(t, 0); + if(!c[1] || !isempty(*c[1])) + { // try up + c[2] = c[1]; + c[1] = getcube(t, 1); + if(!c[1] || isempty(*c[1])) { + c[0] = c[1], c[1] = c[2], c[2] = NULL; + }else + z++, t[d]+=fg; + } + else // drop down + { + z--; + t[d]-= fg; + c[0] = c[1]; + c[1] = getcube(t, 0); + } + + if(!c[1] || isempty(*c[1])) { flags[x][y] |= NOTHMAP; return; } + + flags[x][y] |= PAINTED; + mapz [x][y] = z; + + if(!c[0]) c[0] = getcube(t, 1); + if(!c[2]) c[2] = getcube(t, -1); + c[3] = getcube(t, -2); + c[2] = !c[2] || isempty(*c[2]) ? NULL : c[2]; + c[3] = !c[3] || isempty(*c[3]) ? NULL : c[3]; + + uint face = getface(c[1], d); + if(face == 0x08080808 && (!c[0] || !isempty(*c[0]))) { flags[x][y] |= NOTHMAP; return; } + if(c[1]->faces[R[d]] == F_SOLID) // was single + face += 0x08080808; + else // was pair + face += c[2] ? getface(c[2], d) : 0x08080808; + face += 0x08080808; // c[3] + uchar *f = (uchar*)&face; + addpoint(x, y, z, f[0]); + addpoint(x+1, y, z, f[1]); + addpoint(x, y+1, z, f[2]); + addpoint(x+1, y+1, z, f[3]); + + if(selecting) // continue to adjacent cubes + { + if(x>bmx) select(x-1, y, z); + if(xbmy) select(x, y-1, z); + if(y, <, 1, 0, -); + else + pullhmap(hdr.worldsize, <, >, 0, 8, +); + + cube **c = cmap[x][y]; + int e[2][2]; + int notempty = 0; + + loopk(4) if(c[k]) { + loopi(2) loopj(2) { + e[i][j] = min(8, map[x+i][y+j] - (mapz[x][y]+3-k)*8); + notempty |= e[i][j] > 0; + } + if(notempty) + { + c[k]->texture[sel.orient] = c[1]->texture[sel.orient]; + solidfaces(*c[k]); + loopi(2) loopj(2) + { + int f = e[i][j]; + if(f<0 || (f==0 && e[1-i][j]==0 && e[i][1-j]==0)) + { + f=0; + pushside(*c[k], d, i, j, 0); + pushside(*c[k], d, i, j, 1); + } + edgeset(cubeedge(*c[k], d, i, j), dc, dc ? f : 8-f); + } + } + else + emptyfaces(*c[k]); + } + + if(!changed) return; + if(x>mx) ripple(x-1, y, mapz[x][y], true); + if(xmy) ripple(x, y-1, mapz[x][y], true); + if(ymx && y>my)); // do diagonals because adjacents + DIAGONAL_RIPPLE(-1, +1, (x>mx && ymy)); + } + +#define loopbrush(i) for(int x=bmx; x<=bnx+i; x++) for(int y=bmy; y<=bny+i; y++) + + void paint() + { + loopbrush(1) + map[x][y] -= dr * brush[x][y]; + } + + void smooth() + { + int sum, div; + loopbrush(-2) + { + sum = 0; + div = 9; + loopi(3) loopj(3) + if(flags[x+i][y+j] & MAPPED) + sum += map[x+i][y+j]; + else div--; + if(div) + map[x+1][y+1] = sum / div; + } + } + + void rippleandset() + { + loopbrush(0) + ripple(x, y, gz, false); + } + + void run(int dir, int mode) + { + d = dimension(sel.orient); + dc = dimcoord(sel.orient); + dcr= dc ? 1 : -1; + dr = dir>0 ? 1 : -1; + br = dir>0 ? 0x08080808 : 0; + // biasup = mode == dir<0; + biasup = dir<0; + bool paintme = paintbrush; + int cx = (sel.corner&1 ? 0 : -1); + int cy = (sel.corner&2 ? 0 : -1); + hws= (hdr.worldsize>>gridpower); + gx = (cur[R[d]] >> gridpower) + cx - MAXBRUSH2; + gy = (cur[C[d]] >> gridpower) + cy - MAXBRUSH2; + gz = (cur[D[d]] >> gridpower); + fs = dc ? 4 : 0; + fg = dc ? gridsize : -gridsize; + mx = max(0, -gx); // ripple range + my = max(0, -gy); + nx = min(MAXBRUSH-1, hws-gx) - 1; + ny = min(MAXBRUSH-1, hws-gy) - 1; + if(havesel) + { // selection range + bmx = mx = max(mx, (sel.o[R[d]]>>gridpower)-gx); + bmy = my = max(my, (sel.o[C[d]]>>gridpower)-gy); + bnx = nx = min(nx, (sel.s[R[d]]+(sel.o[R[d]]>>gridpower))-gx-1); + bny = ny = min(ny, (sel.s[C[d]]+(sel.o[C[d]]>>gridpower))-gy-1); + } + if(havesel && mode<0) // -ve means smooth selection + paintme = false; + else + { // brush range + bmx = max(mx, brushminx); + bmy = max(my, brushminy); + bnx = min(nx, brushmaxx-1); + bny = min(ny, brushmaxy-1); + } + nz = hdr.worldsize-gridsize; + mz = 0; + hundo.s = ivec(d,1,1,5); + hundo.orient = sel.orient; + hundo.grid = gridsize; + forcenextundo(); + + changes.grid = gridsize; + changes.s = changes.o = cur; + memset(map, 0, sizeof map); + memset(flags, 0, sizeof flags); + + selecting = true; + select(clamp(MAXBRUSH2-cx, bmx, bnx), + clamp(MAXBRUSH2-cy, bmy, bny), + dc ? gz : hws - gz); + selecting = false; + if(paintme) + paint(); + else + smooth(); + rippleandset(); // pull up points to cubify, and set + changes.s.sub(changes.o).shr(gridpower).add(1); + changed(changes); + } +} + +void edithmap(int dir, int mode) { + if(multiplayer() || !hmapsel || gridsize < 8) return; + hmap::run(dir, mode); +} + +///////////// main cube edit //////////////// + +int bounded(int n) { return n<0 ? 0 : (n>8 ? 8 : n); } + +void pushedge(uchar &edge, int dir, int dc) +{ + int ne = bounded(edgeget(edge, dc)+dir); + edge = edgeset(edge, dc, ne); + int oe = edgeget(edge, 1-dc); + if((dir<0 && dc && oe>ne) || (dir>0 && dc==0 && oematerial : MAT_AIR; +} + +VAR(invalidcubeguard, 0, 1, 1); + +void mpeditface(int dir, int mode, selinfo &sel, bool local) +{ + if(mode==1 && (sel.cx || sel.cy || sel.cxs&1 || sel.cys&1)) mode = 0; + int d = dimension(sel.orient); + int dc = dimcoord(sel.orient); + int seldir = dc ? -dir : dir; + + if(local) + cl->edittrigger(sel, EDIT_FACE, dir, mode); + + if(mode==1) + { + int h = sel.o[d]+dc*sel.grid; + if(((dir>0) == dc && h<=0) || ((dir<0) == dc && h>=hdr.worldsize)) return; + if(dir<0) sel.o[d] += sel.grid * seldir; + } + + if(dc) sel.o[d] += sel.us(d)-sel.grid; + sel.s[d] = 1; + + loopselxyz( + if(c.children) solidfaces(c); + uchar mat = getmaterial(c); + discardchildren(c); + if(mat!=MAT_AIR) ext(c).material = mat; + if(mode==1) // fill command + { + if(dir<0) + { + solidfaces(c); + cube &o = blockcube(x, y, 1, sel, -sel.grid); + loopi(6) + c.texture[i] = o.texture[i]; + } + else + emptyfaces(c); + } + else + { + uint bak = c.faces[d]; + uchar *p = (uchar *)&c.faces[d]; + + if(mode==2) + linkedpush(c, d, sel.corner&1, sel.corner>>1, dc, seldir); // corner command + else + { + loop(mx,2) loop(my,2) // pull/push edges command + { + if(x==0 && mx==0 && sel.cx) continue; + if(y==0 && my==0 && sel.cy) continue; + if(x==sel.s[R[d]]-1 && mx==1 && (sel.cx+sel.cxs)&1) continue; + if(y==sel.s[C[d]]-1 && my==1 && (sel.cy+sel.cys)&1) continue; + if(p[mx+my*2] != ((uchar *)&bak)[mx+my*2]) continue; + + linkedpush(c, d, mx, my, dc, seldir); + } + } + + optiface(p, c); + if(invalidcubeguard==1 && !isvalidcube(c)) + { + uint newbak = c.faces[d]; + uchar *m = (uchar *)&bak; + uchar *n = (uchar *)&newbak; + loopk(4) if(n[k] != m[k]) // tries to find partial edit that is valid + { + c.faces[d] = bak; + c.edges[d*4+k] = n[k]; + if(isvalidcube(c)) + m[k] = n[k]; + } + c.faces[d] = bak; + } + } + ); + if (mode==1 && dir>0) + sel.o[d] += sel.grid * seldir; +} + +void editface(int *dir, int *mode) +{ + if(noedit(moving!=0)) return; + if(hmapedit!=1) + mpeditface(*dir, *mode, sel, true); + else + edithmap(*dir, *mode); +} + +VAR(selectionsurf, 0, 0, 1); + +void pushsel(int *dir) +{ + if(noedit(moving!=0)) return; + int d = dimension(orient); + int s = dimcoord(orient) ? -*dir : *dir; + sel.o[d] += s*sel.grid; + if(selectionsurf==1) player->o[d] += s*sel.grid; +} + +void mpdelcube(selinfo &sel, bool local) +{ + if(local) cl->edittrigger(sel, EDIT_DELCUBE); + loopselxyz(discardchildren(c); emptyfaces(c)); +} + +void delcube() +{ + if(noedit()) return; + mpdelcube(sel, true); +} + +COMMAND(pushsel, "i"); +COMMAND(editface, "ii"); +COMMAND(delcube, ""); + +/////////// texture editing ////////////////// + +int curtexindex = -1, lasttex = 0; +int texpaneltimer = 0; +vector texmru; + +void tofronttex() // maintain most recently used of the texture lists when applying texture +{ + int c = curtexindex; + if(c>=0) + { + texmru.insert(0, texmru.remove(c)); + curtexindex = -1; + } +} + +selinfo repsel; +int reptex = -1; + +void edittexcube(cube &c, int tex, int orient, bool &findrep) +{ + if(orient<0) loopi(6) c.texture[i] = tex; + else + { + int i = visibleorient(c, orient); + if(findrep) + { + if(reptex < 0) reptex = c.texture[i]; + else if(reptex != c.texture[i]) findrep = false; + } + c.texture[i] = tex; + } + if(c.children) loopi(8) edittexcube(c.children[i], tex, orient, findrep); +} + +extern int curtexnum; +VAR(allfaces, 0, 0, 1); + +void mpedittex(int tex, int allfaces, selinfo &sel, bool local) +{ + if(local) + { + cl->edittrigger(sel, EDIT_TEX, tex, allfaces); + if(allfaces || !(repsel == sel)) reptex = -1; + repsel = sel; + } + bool findrep = local && !allfaces && reptex < 0; + loopselxyz(edittexcube(c, tex, allfaces ? -1 : sel.orient, findrep)); +} + +void filltexlist() +{ + if(texmru.length()!=curtexnum) + { + loopv(texmru) if(texmru[i]>=curtexnum) texmru.remove(i--); + loopi(curtexnum) if(texmru.find(i)<0) texmru.add(i); + } +} + +void edittex(int i) +{ + curtexindex = i = min(max(i, 0), curtexnum-1); + int t = lasttex = texmru[i]; + mpedittex(t, allfaces, sel, true); +} + +void edittex_(int *dir) +{ + if(noedit()) return; + filltexlist(); + texpaneltimer = 5000; + if(!(lastsel==sel)) tofronttex(); + edittex(curtexindex<0 ? 0 : curtexindex+*dir); +} + +void gettex() +{ + if(noedit()) return; + filltexlist(); + loopxyz(sel, sel.grid, curtexindex = c.texture[sel.orient]); + loopi(curtexnum) if(texmru[i]==curtexindex) + { + curtexindex = i; + tofronttex(); + return; + } +} + +void getcurtex() +{ + if(noedit()) return; + filltexlist(); + int index = curtexindex < 0 ? 0 : curtexindex; + if(!texmru.inrange(index)) return; + intret(texmru[index]); +} + +void getseltex() +{ + if(noedit()) return; + cube &c = lookupcube(sel.o.x, sel.o.y, sel.o.z, -sel.grid); + if(c.children || isempty(c)) return; + intret(c.texture[sel.orient]); +} + +void gettexname(int *tex, int *subslot) +{ + if(noedit() || *tex<0) return; + Slot &slot = lookuptexture(*tex); + if(!slot.sts.inrange(*subslot)) return; + result(slot.sts[*subslot].name); +} + +COMMANDN(edittex, edittex_, "i"); +COMMAND(gettex, ""); +COMMAND(getcurtex, ""); +COMMAND(getseltex, ""); +COMMAND(gettexname, "ii"); + +void replacetexcube(cube &c, int oldtex, int newtex) +{ + loopi(6) if(c.texture[i] == oldtex) c.texture[i] = newtex; + if(c.children) loopi(8) replacetexcube(c.children[i], oldtex, newtex); +} + +void mpreplacetex(int oldtex, int newtex, selinfo &sel, bool local) +{ + if(local) cl->edittrigger(sel, EDIT_REPLACE, oldtex, newtex); + loopi(8) replacetexcube(worldroot[i], oldtex, newtex); + allchanged(); +} + +void replace() +{ + if(noedit()) return; + if(reptex < 0) { conoutf(CON_ERROR, "can only replace after a texture edit"); return; } + mpreplacetex(reptex, lasttex, sel, true); +} + +COMMAND(replace, ""); + +////////// flip and rotate /////////////// +uint dflip(uint face) { return face==F_EMPTY ? face : 0x88888888 - (((face&0xF0F0F0F0)>>4) | ((face&0x0F0F0F0F)<<4)); } +uint cflip(uint face) { return ((face&0xFF00FF00)>>8) | ((face&0x00FF00FF)<<8); } +uint rflip(uint face) { return ((face&0xFFFF0000)>>16)| ((face&0x0000FFFF)<<16); } +uint mflip(uint face) { return (face&0xFF0000FF) | ((face&0x00FF0000)>>8) | ((face&0x0000FF00)<<8); } + +void flipcube(cube &c, int d) +{ + swap(c.texture[d*2], c.texture[d*2+1]); + c.faces[D[d]] = dflip(c.faces[D[d]]); + c.faces[C[d]] = cflip(c.faces[C[d]]); + c.faces[R[d]] = rflip(c.faces[R[d]]); + if(c.children) + { + loopi(8) if(i&octadim(d)) swap(c.children[i], c.children[i-octadim(d)]); + loopi(8) flipcube(c.children[i], d); + } +} + +void rotatequad(cube &a, cube &b, cube &c, cube &d) +{ + cube t = a; a = b; b = c; c = d; d = t; +} + +void rotatecube(cube &c, int d) // rotates cube clockwise. see pics in cvs for help. +{ + c.faces[D[d]] = cflip (mflip(c.faces[D[d]])); + c.faces[C[d]] = dflip (mflip(c.faces[C[d]])); + c.faces[R[d]] = rflip (mflip(c.faces[R[d]])); + swap(c.faces[R[d]], c.faces[C[d]]); + + swap(c.texture[2*R[d]], c.texture[2*C[d]+1]); + swap(c.texture[2*C[d]], c.texture[2*R[d]+1]); + swap(c.texture[2*C[d]], c.texture[2*C[d]+1]); + + if(c.children) + { + int row = octadim(R[d]); + int col = octadim(C[d]); + for(int i=0; i<=octadim(d); i+=octadim(d)) rotatequad + ( + c.children[i+row], + c.children[i], + c.children[i+col], + c.children[i+col+row] + ); + loopi(8) rotatecube(c.children[i], d); + } +} + +void mpflip(selinfo &sel, bool local) +{ + if(local) cl->edittrigger(sel, EDIT_FLIP); + int zs = sel.s[dimension(sel.orient)]; + makeundo(); + loopxy(sel) + { + loop(z,zs) flipcube(selcube(x, y, z), dimension(sel.orient)); + loop(z,zs/2) + { + cube &a = selcube(x, y, z); + cube &b = selcube(x, y, zs-z-1); + swap(a, b); + } + } + changed(sel); +} + +void flip() +{ + if(noedit()) return; + mpflip(sel, true); +} + +void mprotate(int cw, selinfo &sel, bool local) +{ + if(local) cl->edittrigger(sel, EDIT_ROTATE, cw); + int d = dimension(sel.orient); + if(!dimcoord(sel.orient)) cw = -cw; + int m = sel.s[C[d]] < sel.s[R[d]] ? C[d] : R[d]; + int ss = sel.s[m] = max(sel.s[R[d]], sel.s[C[d]]); + makeundo(); + loop(z,sel.s[D[d]]) loopi(cw>0 ? 1 : 3) + { + loopxy(sel) rotatecube(selcube(x,y,z), d); + loop(y,ss/2) loop(x,ss-1-y*2) rotatequad + ( + selcube(ss-1-y, x+y, z), + selcube(x+y, y, z), + selcube(y, ss-1-x-y, z), + selcube(ss-1-x-y, ss-1-y, z) + ); + } + changed(sel); +} + +void rotate(int *cw) +{ + if(noedit()) return; + mprotate(*cw, sel, true); +} + +COMMAND(flip, ""); +COMMAND(rotate, "i"); + +void setmat(cube &c, uchar mat, uchar matmask) +{ + if(c.children) + loopi(8) setmat(c.children[i], mat, matmask); + else if(mat!=MAT_AIR) + { + cubeext &e = ext(c); + e.material &= matmask; + e.material |= mat; + } + else if(c.ext) c.ext->material = MAT_AIR; +} + +void mpeditmat(int matid, selinfo &sel, bool local) +{ + if(local) cl->edittrigger(sel, EDIT_MAT, matid); + + uchar matmask = matid&MATF_VOLUME ? 0 : (matid&MATF_CLIP ? ~MATF_CLIP : 0xFF); + if(isclipped(matid&MATF_VOLUME)) matid |= MAT_CLIP; + if(isdeadly(matid&MATF_VOLUME)) matid |= MAT_DEATH; + loopselxyz(setmat(c, matid, matmask)); +} + +void editmat(char *name) +{ + if(noedit()) return; + int id = findmaterial(name); + if(id<0) { conoutf(CON_ERROR, "unknown material \"%s\"", name); return; } + mpeditmat(id, sel, true); +} + +COMMAND(editmat, "s"); + +#define TEXTURE_WIDTH 10 +#define TEXTURE_HEIGHT 7 +extern int menudistance, menuautoclose; + +VAR(thumbtime, 0, 50, 1000); + +static int lastthumbnail = 0; + +VARP(texgui2d, 0, 1, 1); + +struct texturegui : g3d_callback +{ + bool menuon; + vec menupos; + int menustart; + + void gui(g3d_gui &g, bool firstpass) + { + int menutab = 1+curtexindex/(TEXTURE_WIDTH*TEXTURE_HEIGHT); + int origtab = menutab; + g.start(menustart, 0.04f, &menutab); + loopi(1+curtexnum/(TEXTURE_WIDTH*TEXTURE_HEIGHT)) + { + g.tab((i==0)?"Textures":NULL, 0xAAFFAA); + if(i != origtab-1) continue; //don't load textures on non-visible tabs! + loopj(TEXTURE_HEIGHT) + { + g.pushlist(); + loopk(TEXTURE_WIDTH) + { + int ti = (i*TEXTURE_HEIGHT+j)*TEXTURE_WIDTH+k; + if(ti=thumbtime) { tex = loadthumbnail(slot); lastthumbnail = lastmillis; } + if(g.texture(tex, 1.0, slot.rotation, slot.xoffset, slot.yoffset, glowtex, slot.glowcolor)&G3D_UP && (slot.loaded || tex!=notexture)) + edittex(ti); + } + else + g.texture(notexture, 1.0); //create an empty space + } + g.poplist(); + } + } + g.end(); + if(origtab != menutab) curtexindex = (menutab-1)*TEXTURE_WIDTH*TEXTURE_HEIGHT; + } + + void showtextures(bool on) + { + if(on != menuon && (menuon = on)) { menupos = menuinfrontofplayer(); menustart = starttime(); } + } + + void show() + { + if(!menuon) return; + filltexlist(); + if(!editmode || camera1->o.dist(menupos) > menuautoclose) menuon = false; + else g3d_addgui(this, menupos, texgui2d ? GUI_2D : 0); + } +} gui; + +void g3d_texturemenu() +{ + gui.show(); +} + +void showtexgui(int *n) +{ + if(!editmode) { conoutf(CON_ERROR, "operation only allowed in edit mode"); return; } + gui.showtextures(*n==0 ? !gui.menuon : *n==1); +} + +// 0/noargs = toggle, 1 = on, other = off - will autoclose if too far away or exit editmode +COMMAND(showtexgui, "i"); + +void render_texture_panel(int w, int h) +{ + if((texpaneltimer -= curtime)>0 && editmode) + { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glLoadIdentity(); + int width = w*1800/h; + glOrtho(0, width, 1800, 0, -1, 1); + int y = 50, gap = 10; + + static Shader *rgbonlyshader = NULL; + if(!rgbonlyshader) rgbonlyshader = lookupshaderbyname("rgbonly"); + + rgbonlyshader->set(); + + loopi(7) + { + int s = (i == 3 ? 285 : 220), ti = curtexindex+i-3; + if(ti>=0 && tixs/(float)tex->ys), sy = min(1.0f, tex->ys/(float)tex->xs); + int x = width-s-50, r = s; + float tc[4][2] = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 } }; + float xoff = slot.xoffset, yoff = slot.yoffset; + if(slot.rotation) + { + if((slot.rotation&5) == 1) { swap(xoff, yoff); loopk(4) swap(tc[k][0], tc[k][1]); } + if(slot.rotation >= 2 && slot.rotation <= 4) { xoff *= -1; loopk(4) tc[k][0] *= -1; } + if(slot.rotation <= 2 || slot.rotation == 5) { yoff *= -1; loopk(4) tc[k][1] *= -1; } + } + loopk(4) { tc[k][0] = tc[k][0]/sx - xoff/tex->xs; tc[k][1] = tc[k][1]/sy - yoff/tex->ys; } + glBindTexture(GL_TEXTURE_2D, tex->id); + loopj(glowtex ? 3 : 2) + { + if(j < 2) glColor4f(j, j, j, texpaneltimer/1000.0f); + else + { + glBindTexture(GL_TEXTURE_2D, glowtex->id); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glColor4f(slot.glowcolor.x, slot.glowcolor.y, slot.glowcolor.z, texpaneltimer/1000.0f); + } + glBegin(GL_QUADS); + glTexCoord2fv(tc[0]); glVertex2f(x, y); + glTexCoord2fv(tc[1]); glVertex2f(x+r, y); + glTexCoord2fv(tc[2]); glVertex2f(x+r, y+r); + glTexCoord2fv(tc[3]); glVertex2f(x, y+r); + glEnd(); + xtraverts += 4; + if(!j) + { + r -= 10; + x += 5; + y += 5; + } + else if(j == 2) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + } + y += s+gap; + } + + defaultshader->set(); + } +} diff --git a/src/engine/octarender.cpp b/src/engine/octarender.cpp new file mode 100644 index 0000000..7d127c0 --- /dev/null +++ b/src/engine/octarender.cpp @@ -0,0 +1,1560 @@ +// octarender.cpp: fill vertex arrays with different cube surfaces. + +#include "pch.h" +#include "engine.h" + +VARF(floatvtx, 0, 0, 1, allchanged()); + +#define GENVERTS(type, ptr, offset, body) \ + { \ + type *f = (type *)ptr; \ + loopv(verts) \ + { \ + const vertex &v = verts[i]; \ + f->x = v.x offset; \ + f->y = v.y offset; \ + f->z = v.z offset; \ + body; \ + f++; \ + } \ + } +#define GENVERTSUV(type, ptr, offset, body) GENVERTS(type, ptr, offset, { f->u = v.u; f->v = v.v; body; }) + +void genverts(vector &verts, void *buf, const vec &origin) +{ + if(renderpath==R_FIXEDFUNCTION) + { + if(nolights) + { + if(floatvtx) { GENVERTS(fvertexffc, buf, , { f->add(origin); }); } + else { GENVERTS(vertexffc, buf, - 0x8000, { f->reserved = 0; }); } + } + else if(floatvtx) { GENVERTSUV(fvertexff, buf, , { f->add(origin); }); } + else { GENVERTSUV(vertexff, buf, - 0x8000, { f->reserved = 0; }); } + } + else if(floatvtx) { GENVERTSUV(fvertex, buf, , { f->add(origin); f->n = v.n; }); } + else { GENVERTSUV(vertex, buf, - 0x8000, { f->reserved = 0; f->n = v.n; }); } +} + +struct vboinfo +{ + int uses; + uchar *data; +}; + +static inline uint hthash(GLuint key) +{ + return key; +} + +static inline bool htcmp(GLuint x, GLuint y) +{ + return x==y; +} + +hashtable vbos; + +VAR(printvbo, 0, 0, 1); +VARFN(vbosize, maxvbosize, 0, 1<<15, 1<<16, allchanged()); + +enum +{ + VBO_VBUF = 0, + VBO_EBUF, + VBO_SKYBUF, + NUMVBO +}; + +static vector vbodata[NUMVBO]; +static vector vbovas[NUMVBO]; +static int vbosize[NUMVBO]; + +void destroyvbo(GLuint vbo) +{ + vboinfo *exists = vbos.access(vbo); + if(!exists) return; + vboinfo &vbi = *exists; + if(vbi.uses <= 0) return; + vbi.uses--; + if(!vbi.uses) + { + if(hasVBO) glDeleteBuffers_(1, &vbo); + else if(vbi.data) delete[] vbi.data; + vbos.remove(vbo); + } +} + +void genvbo(int type, void *buf, int len, vtxarray **vas, int numva) +{ + GLuint vbo; + uchar *data = NULL; + if(hasVBO) + { + glGenBuffers_(1, &vbo); + GLenum target = type==VBO_VBUF ? GL_ARRAY_BUFFER_ARB : GL_ELEMENT_ARRAY_BUFFER_ARB; + glBindBuffer_(target, vbo); + glBufferData_(target, len, buf, GL_STATIC_DRAW_ARB); + glBindBuffer_(target, 0); + } + else + { + static GLuint nextvbo = 0; + if(!nextvbo) nextvbo++; // just in case it ever wraps around + vbo = nextvbo++; + data = new uchar[len]; + memcpy(data, buf, len); + } + vboinfo &vbi = vbos[vbo]; + vbi.uses = numva; + vbi.data = data; + + if(printvbo) conoutf(CON_DEBUG, "vbo %d: type %d, size %d, %d uses", vbo, type, len, numva); + + loopi(numva) + { + vtxarray *va = vas[i]; + switch(type) + { + case VBO_VBUF: + va->vbuf = vbo; + if(!hasVBO) va->vdata = (vertex *)(data + (size_t)va->vdata); + break; + case VBO_EBUF: + va->ebuf = vbo; + if(!hasVBO) va->edata = (ushort *)(data + (size_t)va->edata); + break; + case VBO_SKYBUF: + va->skybuf = vbo; + if(!hasVBO) va->skydata = (ushort *)(data + (size_t)va->skydata); + break; + } + } +} + +bool readva(vtxarray *va, ushort *&edata, uchar *&vdata) +{ + if(!va->vbuf || !va->ebuf) return false; + + edata = new ushort[3*va->tris]; + vdata = new uchar[va->verts*VTXSIZE]; + + if(hasVBO) + { + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->ebuf); + glGetBufferSubData_(GL_ELEMENT_ARRAY_BUFFER_ARB, (size_t)va->edata, 3*va->tris*sizeof(ushort), edata); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + + glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf); + glGetBufferSubData_(GL_ARRAY_BUFFER_ARB, va->voffset*VTXSIZE, va->verts*VTXSIZE, vdata); + glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0); + return true; + } + else + { + memcpy(edata, va->edata, 3*va->tris*sizeof(ushort)); + memcpy(vdata, (uchar *)va->vdata + va->voffset*VTXSIZE, va->verts*VTXSIZE); + return true; + } +} + +void flushvbo(int type = -1) +{ + if(type < 0) + { + loopi(NUMVBO) flushvbo(i); + return; + } + + vector &data = vbodata[type]; + if(data.empty()) return; + vector &vas = vbovas[type]; + genvbo(type, data.getbuf(), data.length(), vas.getbuf(), vas.length()); + data.setsizenodelete(0); + vas.setsizenodelete(0); + vbosize[type] = 0; +} + +uchar *addvbo(vtxarray *va, int type, int numelems, int elemsize) +{ + vbosize[type] += numelems; + + vector &data = vbodata[type]; + vector &vas = vbovas[type]; + + vas.add(va); + + int len = numelems*elemsize; + uchar *buf = data.reserve(len).buf; + data.advance(len); + return buf; +} + +struct verthash +{ + static const int SIZE = 1<<13; + int table[SIZE]; + vector verts; + vector chain; + + verthash() { clearverts(); } + + void clearverts() + { + memset(table, -1, sizeof(table)); + chain.setsizenodelete(0); + verts.setsizenodelete(0); + } + + int addvert(const vvec &v, short tu, short tv, const bvec &n) + { + const uchar *iv = (const uchar *)&v; + uint h = 5381; + loopl(sizeof(v)) h = ((h<<5)+h)^iv[l]; + h = h&(SIZE-1); + for(int i = table[h]; i>=0; i = chain[i]) + { + const vertex &c = verts[i]; + if(c.x==v.x && c.y==v.y && c.z==v.z && c.n==n) + { + if(!tu && !tv) return i; + if(c.u==tu && c.v==tv) return i; + } + } + if(verts.length() >= USHRT_MAX) return -1; + vertex &vtx = verts.add(); + ((vvec &)vtx) = v; + vtx.u = tu; + vtx.v = tv; + vtx.n = n; + chain.add(table[h]); + return table[h] = verts.length()-1; + } +}; + +struct sortkey +{ + ushort tex, lmid, envmap; + sortkey() {} + sortkey(ushort tex, ushort lmid, ushort envmap = EMID_NONE) + : tex(tex), lmid(lmid), envmap(envmap) + {} + + bool operator==(const sortkey &o) const { return tex==o.tex && lmid==o.lmid && envmap==o.envmap; } +}; + +struct sortval +{ + int unlit; + usvector dims[6]; + + sortval() : unlit(0) {} +}; + +static inline bool htcmp(const sortkey &x, const sortkey &y) +{ + return x == y; +} + +static inline uint hthash(const sortkey &k) +{ + return k.tex + k.lmid*9741; +} + +struct vacollect : verthash +{ + hashtable indices; + vector texs; + vector grasstris; + vector matsurfs; + vector mapmodels; + usvector skyindices, explicitskyindices; + int curtris, skyfaces, skyclip; + + void clear() + { + clearverts(); + curtris = 0; + skyfaces = 0; + skyclip = INT_MAX; + indices.clear(); + skyindices.setsizenodelete(0); + explicitskyindices.setsizenodelete(0); + matsurfs.setsizenodelete(0); + mapmodels.setsizenodelete(0); + grasstris.setsizenodelete(0); + texs.setsizenodelete(0); + } + + void remapunlit(vector &remap) + { + uint lastlmid[2] = { LMID_AMBIENT, LMID_AMBIENT }, firstlmid[2] = { LMID_AMBIENT, LMID_AMBIENT }; + int firstlit[2] = { -1, -1 }; + loopv(texs) + { + sortkey &k = texs[i]; + if(k.lmid>=LMID_RESERVED) + { + LightMapTexture &lmtex = lightmaptexs[k.lmid]; + int type = lmtex.type; + lastlmid[type] = lmtex.unlitx>=0 ? k.lmid : LMID_AMBIENT; + if(firstlmid[type]==LMID_AMBIENT && lastlmid[type]!=LMID_AMBIENT) + { + firstlit[type] = i; + firstlmid[type] = lastlmid[type]; + } + } + else if(k.lmid==LMID_AMBIENT) + { + Shader *s = lookuptexture(k.tex, false).shader; + if(!s) continue; + int type = s->type&SHADER_NORMALSLMS ? LM_BUMPMAP0 : LM_DIFFUSE; + if(lastlmid[type]!=LMID_AMBIENT) + { + sortval &t = indices[k]; + if(t.unlit<=0) t.unlit = lastlmid[type]; + } + } + } + if(firstlmid[0]!=LMID_AMBIENT || firstlmid[1]!=LMID_AMBIENT) loopi(max(firstlit[0], firstlit[1])) + { + sortkey &k = texs[i]; + if(k.lmid!=LMID_AMBIENT) continue; + Shader *s = lookuptexture(k.tex, false).shader; + if(!s) continue; + int type = s->type&SHADER_NORMALSLMS ? LM_BUMPMAP0 : LM_DIFFUSE; + if(firstlmid[type]==LMID_AMBIENT) continue; + indices[k].unlit = firstlmid[type]; + } + loopv(remap) + { + sortkey &k = remap[i]; + sortval &t = indices[k]; + if(t.unlit<=0) continue; + LightMapTexture &lm = lightmaptexs[t.unlit]; + short u = short(ceilf((lm.unlitx + 0.5f) * SHRT_MAX/lm.w)), + v = short(ceilf((lm.unlity + 0.5f) * SHRT_MAX/lm.h)); + loopl(6) loopvj(t.dims[l]) + { + vertex &vtx = verts[t.dims[l][j]]; + if(!vtx.u && !vtx.v) + { + vtx.u = u; + vtx.v = v; + } + else if(vtx.u != u || vtx.v != v) + { + // necessary to copy these in case vechash reallocates verts before copying vtx + vvec vv = vtx; + bvec n = vtx.n; + t.dims[l][j] = addvert(vv, u, v, n); + } + } + sortval *dst = indices.access(sortkey(k.tex, t.unlit, k.envmap)); + if(dst) loopl(6) loopvj(t.dims[l]) dst->dims[l].add(t.dims[l][j]); + } + } + + void optimize() + { + vector remap; + enumeratekt(indices, sortkey, k, sortval, t, + loopl(6) if(t.dims[l].length() && t.unlit<=0) + { + if(k.lmid>=LMID_RESERVED && lightmaptexs[k.lmid].unlitx>=0) + { + sortkey ukey(k.tex, LMID_AMBIENT, k.envmap); + sortval *uval = indices.access(ukey); + if(uval && uval->unlit<=0) + { + if(uval->unlit<0) texs.removeobj(ukey); + else remap.add(ukey); + uval->unlit = k.lmid; + } + } + else if(k.lmid==LMID_AMBIENT) + { + remap.add(k); + t.unlit = -1; + } + texs.add(k); + break; + } + ); + texs.sort(texsort); + + remapunlit(remap); + + matsurfs.setsize(optimizematsurfs(matsurfs.getbuf(), matsurfs.length())); + } + + static int texsort(const sortkey *x, const sortkey *y) + { + if(x->tex == y->tex) + { + if(x->lmid < y->lmid) return -1; + if(x->lmid > y->lmid) return 1; + if(x->envmap < y->envmap) return -1; + if(x->envmap > y->envmap) return 1; + return 0; + } + if(renderpath!=R_FIXEDFUNCTION) + { + Slot &xs = lookuptexture(x->tex, false), &ys = lookuptexture(y->tex, false); + if(xs.shader < ys.shader) return -1; + if(xs.shader > ys.shader) return 1; + if(xs.params.length() < ys.params.length()) return -1; + if(xs.params.length() > ys.params.length()) return 1; + } + if(x->tex < y->tex) return -1; + else return 1; + } + + void setupdata(vtxarray *va) + { + va->verts = verts.length(); + va->tris = curtris; + va->vbuf = 0; + va->vdata = 0; + va->minvert = 0; + va->maxvert = va->verts-1; + va->voffset = 0; + if(va->verts) + { + if(vbovas[VBO_VBUF].length()) + { + vtxarray *loc = vbovas[VBO_VBUF][0]; + if(((va->o.x^loc->o.x)|(va->o.y^loc->o.y)|(va->o.z^loc->o.z))&~VVEC_INT_MASK) + flushvbo(); + } + if(vbosize[VBO_VBUF] + verts.length() > maxvbosize || + vbosize[VBO_EBUF] + 3*curtris > USHRT_MAX || + vbosize[VBO_SKYBUF] + skyindices.length() + explicitskyindices.length() > USHRT_MAX) + flushvbo(); + + va->voffset = vbosize[VBO_VBUF]; + uchar *vdata = addvbo(va, VBO_VBUF, va->verts, VTXSIZE); + genverts(verts, vdata, ivec(va->o).mask(~VVEC_INT_MASK).shl(VVEC_FRAC).tovec()); + va->minvert += va->voffset; + va->maxvert += va->voffset; + } + + va->matbuf = NULL; + va->matsurfs = matsurfs.length(); + if(va->matsurfs) + { + va->matbuf = new materialsurface[matsurfs.length()]; + memcpy(va->matbuf, matsurfs.getbuf(), matsurfs.length()*sizeof(materialsurface)); + } + + va->skybuf = 0; + va->skydata = 0; + va->sky = skyindices.length(); + va->explicitsky = explicitskyindices.length(); + if(va->sky+va->explicitsky) + { + va->skydata += vbosize[VBO_SKYBUF]; + ushort *skydata = (ushort *)addvbo(va, VBO_SKYBUF, va->sky+va->explicitsky, sizeof(ushort)); + memcpy(skydata, skyindices.getbuf(), va->sky*sizeof(ushort)); + memcpy(skydata+va->sky, explicitskyindices.getbuf(), va->explicitsky*sizeof(ushort)); + if(va->voffset) loopi(va->sky+va->explicitsky) skydata[i] += va->voffset; + } + + va->eslist = NULL; + va->texs = texs.length(); + va->ebuf = 0; + va->edata = 0; + if(va->texs) + { + va->eslist = new elementset[va->texs]; + va->edata += vbosize[VBO_EBUF]; + ushort *edata = (ushort *)addvbo(va, VBO_EBUF, 3*curtris, sizeof(ushort)), *curbuf = edata; + loopv(texs) + { + const sortkey &k = texs[i]; + const sortval &t = indices[k]; + elementset &e = va->eslist[i]; + e.texture = k.tex; + e.lmid = t.unlit>0 ? t.unlit : k.lmid; + e.envmap = k.envmap; + ushort *startbuf = curbuf; + loopl(6) + { + e.minvert[l] = USHRT_MAX; + e.maxvert[l] = 0; + + if(t.dims[l].length()) + { + memcpy(curbuf, t.dims[l].getbuf(), t.dims[l].length() * sizeof(ushort)); + + loopvj(t.dims[l]) + { + curbuf[j] += va->voffset; + e.minvert[l] = min(e.minvert[l], curbuf[j]); + e.maxvert[l] = max(e.maxvert[l], curbuf[j]); + } + + curbuf += t.dims[l].length(); + } + e.length[l] = curbuf-startbuf; + } + } + } + + va->texmask = 0; + loopi(va->texs) + { + Slot &slot = lookuptexture(va->eslist[i].texture, false); + loopvj(slot.sts) va->texmask |= 1<grasstris = new vector; + va->grasstris->move(grasstris); + } + + if(mapmodels.length()) va->mapmodels = new vector(mapmodels); + } + + bool emptyva() + { + return verts.empty() && matsurfs.empty() && skyindices.empty() && explicitskyindices.empty() && grasstris.empty() && mapmodels.empty(); + } +} vc; + +VARF(lodsize, 0, 32, 128, hdr.mapwlod = lodsize); +VAR(loddistance, 0, 2000, 100000); + +int recalcprogress = 0; +#define progress(s) if((recalcprogress++&0x7FF)==0) show_out_of_renderloop_progress(recalcprogress/(float)allocnodes, s); + +vector tjoints; + +vvec shadowmapmin, shadowmapmax; + +int calcshadowmask(vvec *vv) +{ + extern vec shadowdir; + int mask = 0, used = 0; + if(vv[0]==vv[2]) return 0; + vec v0 = vv[0].tovec(), v2 = vv[2].tovec().sub(v0); + if(vv[0]!=vv[1] && vv[1]!=vv[2]) + { + vec v1 = vv[1].tovec().sub(v0), n; + n.cross(v1, v2); + if(n.dot(shadowdir)>0) { mask |= 1; used |= 0x7; } + } + if(vv[0]!=vv[3] && vv[2]!=vv[3]) + { + vec v3 = vv[3].tovec().sub(v0), n; + n.cross(v2, v3); + if(n.dot(shadowdir)>0) { mask |= 2; used |= 0xD; } + } + if(used) loopi(4) if(used&(1<shadowmapmax[k]) shadowmapmax[k] = v[k]; + } + } + return mask; +} + +VARFP(filltjoints, 0, 1, 1, allchanged()); + +void reduceslope(ivec &n) +{ + int mindim = -1, minval = 64; + loopi(3) if(n[i]) + { + int val = abs(n[i]); + if(mindim < 0 || val < minval) + { + mindim = i; + minval = val; + } + } + if(!(n[R[mindim]]%minval) && !(n[C[mindim]]%minval)) n.div(minval); + while(!((n.x|n.y|n.z)&1)) n.shr(1); +} + +struct texcoords +{ + short u, v; +}; + +void addcubeverts(int orient, int size, vvec *vv, ushort texture, surfaceinfo *surface, surfacenormals *normals, int tj = -1, ushort envmap = EMID_NONE) +{ + int index[4]; + int shadowmask = texture==DEFAULT_SKY || renderpath==R_FIXEDFUNCTION ? 0 : calcshadowmask(vv); + LightMap *lm = NULL; + LightMapTexture *lmtex = NULL; + if(!nolights && surface && lightmaps.inrange(surface->lmid-LMID_RESERVED)) + { + lm = &lightmaps[surface->lmid-LMID_RESERVED]; + if(lm->type==LM_DIFFUSE || + (lm->type==LM_BUMPMAP0 && + lightmaps.inrange(surface->lmid+1-LMID_RESERVED) && + lightmaps[surface->lmid+1-LMID_RESERVED].type==LM_BUMPMAP1)) + lmtex = &lightmaptexs[lm->tex]; + else lm = NULL; + } + texcoords tc[4]; + loopk(4) + { + if(lmtex) + { + tc[k].u = short(ceilf((lm->offsetx + surface->x + (surface->texcoords[k*2] / 255.0f) * (surface->w - 1) + 0.5f) * SHRT_MAX/lmtex->w)); + tc[k].v = short(ceilf((lm->offsety + surface->y + (surface->texcoords[k*2 + 1] / 255.0f) * (surface->h - 1) + 0.5f) * SHRT_MAX/lmtex->h)); + } + else tc[k].u = tc[k].v = 0; + index[k] = vc.addvert(vv[k], tc[k].u, tc[k].v, renderpath!=R_FIXEDFUNCTION && normals ? normals->normals[k] : bvec(128, 128, 128)); + if(index[k] < 0) return; + } + + if(texture == DEFAULT_SKY) + { + loopk(4) vc.skyclip = min(vc.skyclip, int(vv[k].z>>VVEC_FRAC)); + vc.skyfaces |= 0x3F&~(1<lmid < LMID_RESERVED) lmid = surface->lmid; + else if(lm) lmid = lm->tex; + } + + int dim = dimension(orient); + sortkey key(texture, lmid, envmap); + loopi(2) if(index[0]!=index[i+1] && index[i+1]!=index[i+2] && index[i+2]!=index[0]) + { + usvector &idxs = texture==DEFAULT_SKY ? vc.explicitskyindices : vc.indices[key].dims[2*dim + ((shadowmask>>i)&1)]; + int left = index[2*i], mid = index[2*i + 1], right = index[(2*i + 2)%4]; + loopj(2) + { + int e1 = 2*i + j, edge = orient*4 + e1; + if(tj < 0 || tjoints[tj].edge > edge) continue; + int e2 = (e1 + 1)%4; + texcoords &tc1 = tc[e1], &tc2 = tc[e2]; + bvec n1, n2; + if(renderpath!=R_FIXEDFUNCTION && normals) + { + n1 = normals->normals[e1]; + n2 = normals->normals[e2]; + } + else n1 = n2 = bvec(128, 128, 128); + const vvec &vv1 = vv[e1], &vv2 = vv[e2]; + ivec d; + loopk(3) d[k] = int(vv1[k]) - int(vv2[k]); + int axis = abs(d.x) > abs(d.y) ? (abs(d.x) > abs(d.z) ? 0 : 2) : (abs(d.y) > abs(d.z) ? 1 : 2); + if(d[axis] < 0) d.neg(); + reduceslope(d); + int offset1 = vv1[axis] / d[axis], offset2 = vv2[axis] / d[axis]; + ivec o; + loopk(3) o[k] = int(vv1[k]) - offset1*d[k]; + float doffset = 1.0f / (offset2 - offset1); + + if(j) + { + int tmp = right; + right = left; + left = mid; + mid = tmp; + } + + while(tj >= 0) + { + tjoint &t = tjoints[tj]; + if(t.edge != edge) break; + vvec vvt; + loopk(3) vvt[k] = ushort(o[k] + t.offset*d[k]); + float offset = (t.offset - offset1) * doffset; + short ut = short(tc1.u + (tc2.u-tc1.u)*offset), + vt = short(tc1.v + (tc2.v-tc1.v)*offset); + bvec nt; + loopk(3) nt[k] = uchar(n1[k] + (n2[k] - n1[k])*offset); + int nextindex = vc.addvert(vvt, ut, vt, nt); + if(nextindex < 0) return; + if(idxs.length() + 3 > USHRT_MAX) return; + idxs.add(right); + idxs.add(left); + idxs.add(nextindex); + if(texture==DEFAULT_SKY) explicitsky++; else vc.curtris++; + tj = t.next; + left = nextindex; + } + } + + if(idxs.length() + 3 > USHRT_MAX) return; + idxs.add(right); + idxs.add(left); + idxs.add(mid); + if(texture==DEFAULT_SKY) explicitsky++; else vc.curtris++; + } +} + +struct edgegroup +{ + ivec slope, origin; + int axis; +}; + +static uint hthash(const edgegroup &g) +{ + return g.slope.x^g.slope.y^g.slope.z^g.origin.x^g.origin.y^g.origin.z; +} + +static bool htcmp(const edgegroup &x, const edgegroup &y) +{ + return x.slope==y.slope && x.origin==y.origin; +} + +enum +{ + CE_START = 1<<0, + CE_END = 1<<1, + CE_FLIP = 1<<2, + CE_DUP = 1<<3 +}; + +struct cubeedge +{ + cube *c; + int next, offset; + ushort size; + uchar index, flags; +}; + +vector cubeedges; +hashtable edgegroups(1<<13); + +void gencubeedges(cube &c, int x, int y, int z, int size) +{ + ivec vv[4]; + vvec vvcheck[4]; + int mergeindex = 0; + loopi(6) if(visibleface(c, i, x, y, z, size)) + { + if(c.ext && c.ext->merged&(1<mergeorigin&(1<merges[mergeindex++]; + vvec mv[4]; + ivec mo(x, y, z); + genmergedverts(c, i, mo, size, m, mv); + loopj(4) + { + loopk(3) vv[j][k] = mv[j][k] + ((mo[k]&~VVEC_INT_MASK)<>VVEC_FRAC)).add(ivec(x, y, z).mul(1< abs(d.y) ? (abs(d.x) > abs(d.z) ? 0 : 2) : (abs(d.y) > abs(d.z) ? 1 : 2); + if(d[axis] < 0) + { + d.neg(); + swap(e1, e2); + } + reduceslope(d); + + int t1 = vv[e1][axis]/d[axis], + t2 = vv[e2][axis]/d[axis]; + edgegroup g; + loopk(3) g.origin[k] = vv[e1][k] - t1*d[k]; + g.slope = d; + g.axis = axis; + cubeedge ce; + ce.c = &c; + ce.offset = t1; + ce.size = t2 - t1; + ce.index = i*4+j; + ce.flags = CE_START | CE_END | (e1!=j ? CE_FLIP : 0); + ce.next = -1; + + bool insert = true; + int *exists = edgegroups.access(g); + if(exists) + { + int prev = -1, cur = *exists; + while(cur >= 0) + { + cubeedge &p = cubeedges[cur]; + if(p.flags&CE_DUP ? + ce.offset>=p.offset && ce.offset+ce.size<=p.offset+p.size : + ce.offset==p.offset && ce.size==p.size) + { + p.flags |= CE_DUP; + insert = false; + break; + } + else if(ce.offset >= p.offset) + { + if(ce.offset == p.offset+p.size) ce.flags &= ~CE_START; + prev = cur; + cur = p.next; + } + else break; + } + if(insert) + { + ce.next = cur; + while(cur >= 0) + { + cubeedge &p = cubeedges[cur]; + if(ce.offset+ce.size==p.offset) { ce.flags &= ~CE_END; break; } + cur = p.next; + } + if(prev>=0) cubeedges[prev].next = cubeedges.length(); + else *exists = cubeedges.length(); + } + } + else edgegroups[g] = cubeedges.length(); + + if(insert) cubeedges.add(ce); + } + } +} + +void gencubeedges(cube *c = worldroot, int x = 0, int y = 0, int z = 0, int size = hdr.worldsize>>1) +{ + progress("fixing t-joints..."); + loopi(8) + { + ivec o(i, x, y, z, size); + if(c[i].ext) c[i].ext->tjoints = -1; + if(c[i].children) gencubeedges(c[i].children, o.x, o.y, o.z, size>>1); + else if(!isempty(c[i])) gencubeedges(c[i], o.x, o.y, o.z, size); + } +} + +void gencubeverts(cube &c, int x, int y, int z, int size, int csi, uchar &vismask, uchar &clipmask) +{ + freeclipplanes(c); // physics planes based on rendering + + int tj = c.ext ? c.ext->tjoints : -1; + loopi(6) if(visibleface(c, i, x, y, z, size)) + { + if(c.texture[i]!=DEFAULT_SKY) vismask |= 1<type&SHADER_ENVMAP) + { + loopv(slot.sts) if(slot.sts[i].type==TEX_ENVMAP) { envmap = EMID_CUSTOM; break; } + if(envmap==EMID_NONE) envmap = closestenvmap(i, x, y, z, size); + } + while(tj >= 0 && tjoints[tj].edge < i*4) tj = tjoints[tj].next; + addcubeverts(i, size, vv, c.texture[i], e.surfaces ? &e.surfaces[i] : NULL, e.normals ? &e.normals[i] : NULL, tj >= 0 && tjoints[tj].edge/4 == i ? tj : -1, envmap); + if(slot.autograss && i!=O_BOTTOM) + { + grasstri &g = vc.grasstris.add(); + memcpy(g.v, vv, sizeof(vv)); + g.surface = e.surfaces ? &e.surfaces[i] : NULL; + g.texture = c.texture[i]; + } + } + else if(touchingface(c, i)) + { + if(visibleface(c, i, x, y, z, size, MAT_AIR, MAT_NOCLIP, MATF_CLIP)) ext(c).visible |= 1< skyfaces[6]; + +void minskyface(cube &cu, int orient, const ivec &co, int size, mergeinfo &orig) +{ + mergeinfo mincf; + mincf.u1 = orig.u2; + mincf.u2 = orig.u1; + mincf.v1 = orig.v2; + mincf.v2 = orig.v1; + mincubeface(cu, orient, co, size, orig, mincf); + orig.u1 = max(mincf.u1, orig.u1); + orig.u2 = min(mincf.u2, orig.u2); + orig.v1 = max(mincf.v1, orig.v1); + orig.v2 = min(mincf.v2, orig.v2); +} + +void genskyfaces(cube &c, const ivec &o, int size) +{ + if(isentirelysolid(c)) return; + + int faces[6], + numfaces = hasskyfaces(c, o.x, o.y, o.z, size, faces); + if(!numfaces) return; + + loopi(numfaces) + { + int orient = faces[i], dim = dimension(orient); + cubeface m; + m.c = NULL; + m.u1 = (o[C[dim]]&VVEC_INT_MASK)<= m.u2 || m.v1 >= m.v2) continue; + skyarea += (int(m.u2-m.u1)*int(m.v2-m.v1) + (1<<(2*VVEC_FRAC))-1)>>(2*VVEC_FRAC); + skyfaces[orient].add(m); + } +} + +void addskyverts(const ivec &o, int size) +{ + loopi(6) + { + int dim = dimension(i), c = C[dim], r = R[dim]; + vector &sf = skyfaces[i]; + if(sf.empty()) continue; + vc.skyfaces |= 0x3F&~(1<>VVEC_FRAC)); + } + if(vc.skyindices.length() + 6 > USHRT_MAX) break; + vc.skyindices.add(index[0]); + vc.skyindices.add(index[1]); + vc.skyindices.add(index[2]); + + vc.skyindices.add(index[0]); + vc.skyindices.add(index[2]); + vc.skyindices.add(index[3]); + nextskyface:; + } + sf.setsizenodelete(0); + } +} + +////////// Vertex Arrays ////////////// + +int allocva = 0; +int wtris = 0, wverts = 0, vtris = 0, vverts = 0, glde = 0, gbatches = 0; +vector valist, varoot; + +vtxarray *newva(int x, int y, int z, int size) +{ + vc.optimize(); + + vtxarray *va = new vtxarray; + va->parent = NULL; + va->o = ivec(x, y, z); + va->size = size; + va->explicitsky = explicitsky; + va->skyarea = skyarea; + va->skyfaces = vc.skyfaces; + va->skyclip = vc.skyclip < INT_MAX ? vc.skyclip + (z&~VVEC_INT_MASK) : INT_MAX; + va->curvfc = VFC_NOT_VISIBLE; + va->occluded = OCCLUDE_NOTHING; + va->query = NULL; + va->mapmodels = NULL; + va->bbmin = ivec(-1, -1, -1); + va->bbmax = ivec(-1, -1, -1); + va->grasstris = NULL; + va->grasssamples = NULL; + va->hasmerges = 0; + + vc.setupdata(va); + + wverts += va->verts; + wtris += va->tris; + allocva++; + valist.add(va); + + return va; +} + +void destroyva(vtxarray *va, bool reparent) +{ + wverts -= va->verts; + wtris -= va->tris; + allocva--; + valist.removeobj(va); + if(!va->parent) varoot.removeobj(va); + if(reparent) + { + if(va->parent) va->parent->children.removeobj(va); + loopv(va->children) + { + vtxarray *child = va->children[i]; + child->parent = va->parent; + if(child->parent) child->parent->children.add(child); + } + } + if(va->vbuf) destroyvbo(va->vbuf); + if(va->ebuf) destroyvbo(va->ebuf); + if(va->skybuf) destroyvbo(va->skybuf); + if(va->eslist) delete[] va->eslist; + if(va->matbuf) delete[] va->matbuf; + if(va->mapmodels) delete va->mapmodels; + if(va->grasstris) delete va->grasstris; + if(va->grasssamples) delete va->grasssamples; + delete[] (uchar *)va; +} + +void vaclearc(cube *c) +{ + loopi(8) + { + if(c[i].ext) + { + if(c[i].ext->va) destroyva(c[i].ext->va, false); + c[i].ext->va = NULL; + c[i].ext->tjoints = -1; + } + if(c[i].children) vaclearc(c[i].children); + } +} + +void updatevabb(vtxarray *va, bool force) +{ + if(!force && va->bbmin.x >= 0) return; + + va->bbmin = va->geommin; + va->bbmax = va->geommax; + loopk(3) + { + va->bbmin[k] = min(va->bbmin[k], va->matmin[k]); + va->bbmax[k] = max(va->bbmax[k], va->matmax[k]); + } + loopv(va->children) + { + vtxarray *child = va->children[i]; + updatevabb(child, force); + loopk(3) + { + va->bbmin[k] = min(va->bbmin[k], child->bbmin[k]); + va->bbmax[k] = max(va->bbmax[k], child->bbmax[k]); + } + } + if(va->mapmodels) + { + loopv(*va->mapmodels) + { + octaentities *oe = (*va->mapmodels)[i]; + loopk(3) + { + va->bbmin[k] = min(va->bbmin[k], oe->bbmin[k]); + va->bbmax[k] = max(va->bbmax[k], oe->bbmax[k]); + } + } + } + + if(va->skyfaces) + { + va->skyfaces |= 0x80; + if(va->sky) loop(dim, 3) if(va->skyfaces&(3<<(2*dim))) + { + int r = R[dim], c = C[dim]; + if((va->skyfaces&(1<<(2*dim)) && va->o[dim] < va->bbmin[dim]) || + (va->skyfaces&(2<<(2*dim)) && va->o[dim]+va->size > va->bbmax[dim]) || + va->o[r] < va->bbmin[r] || va->o[r]+va->size > va->bbmax[r] || + va->o[c] < va->bbmin[c] || va->o[c]+va->size > va->bbmax[c]) + { + va->skyfaces &= ~0x80; + break; + } + } + } +} + +void updatevabbs(bool force) +{ + loopv(varoot) updatevabb(varoot[i], force); +} + +struct mergedface +{ + uchar orient; + ushort tex, envmap; + vvec v[4]; + surfaceinfo *surface; + surfacenormals *normals; + int tjoints; +}; + +static int vahasmerges = 0, vamergemax = 0; +static vector vamerges[VVEC_INT]; + +void genmergedfaces(cube &c, const ivec &co, int size, int minlevel = -1) +{ + if(!c.ext || !c.ext->merges || isempty(c)) return; + int index = 0, tj = c.ext->tjoints; + loopi(6) if(c.ext->mergeorigin & (1<merges[index++]; + if(m.u1>=m.u2 || m.v1>=m.v2) continue; + mergedface mf; + mf.orient = i; + mf.tex = c.texture[i]; + mf.envmap = EMID_NONE; + Slot &slot = lookuptexture(mf.tex, false); + if(slot.shader && slot.shader->type&SHADER_ENVMAP) + { + loopv(slot.sts) if(slot.sts[i].type==TEX_ENVMAP) { mf.envmap = EMID_CUSTOM; break; } + if(mf.envmap==EMID_NONE) mf.envmap = closestenvmap(i, co.x, co.y, co.z, size); + } + mf.surface = c.ext->surfaces ? &c.ext->surfaces[i] : NULL; + mf.normals = c.ext->normals ? &c.ext->normals[i] : NULL; + mf.tjoints = -1; + genmergedverts(c, i, co, size, m, mf.v); + int level = calcmergedsize(i, co, size, m, mf.v); + if(level > minlevel) + { + while(tj >= 0 && tjoints[tj].edge < i*4) tj = tjoints[tj].next; + if(tj >= 0 && tjoints[tj].edge/4 == i) mf.tjoints = tj; + + vamerges[level].add(mf); + vamergemax = max(vamergemax, level); + vahasmerges |= MERGE_ORIGIN; + } + } +} + +void findmergedfaces(cube &c, const ivec &co, int size, int csi, int minlevel) +{ + if(c.ext && c.ext->va && !(c.ext->va->hasmerges&MERGE_ORIGIN)) return; + if(c.children) + { + loopi(8) + { + ivec o(i, co.x, co.y, co.z, size/2); + findmergedfaces(c.children[i], o, size/2, csi-1, minlevel); + } + } + else if(c.ext && c.ext->merges) genmergedfaces(c, co, size, minlevel); +} + +void addmergedverts(int level) +{ + vector &mfl = vamerges[level]; + if(mfl.empty()) return; + loopv(mfl) + { + mergedface &mf = mfl[i]; + addcubeverts(mf.orient, 1<va) + { + vismask = c.children ? c.vismask : 0x3F; + clipmask = c.children ? c.clipmask : 0; + return; // don't re-render + } + + if(c.children) + { + uchar visparent = 0, clipparent = 0x3F; + uchar clipchild[8]; + loopi(8) + { + ivec o(i, cx, cy, cz, size/2); + rendercube(c.children[i], o.x, o.y, o.z, size/2, csi-1, c.vismasks[i], clipchild[i]); + uchar mask = (1<ents && c.ext->ents->mapmodels.length()) vc.mapmodels.add(c.ext->ents); + } + return; + } + + genskyfaces(c, ivec(cx, cy, cz), size); + + vismask = clipmask = 0; + + if(!isempty(c)) gencubeverts(c, cx, cy, cz, size, csi, vismask, clipmask); + + if(c.ext) + { + if(c.ext->ents && c.ext->ents->mapmodels.length()) vc.mapmodels.add(c.ext->ents); + if(c.ext->material != MAT_AIR) genmatsurfs(c, cx, cy, cz, size, vc.matsurfs, vismask, clipmask); + if(c.ext->merges) genmergedfaces(c, ivec(cx, cy, cz), size); + if(c.ext->merged & ~c.ext->mergeorigin) vahasmerges |= MERGE_PART; + } + + if(csi < VVEC_INT && vamerges[csi].length()) addmergedverts(csi); +} + +void calcgeombb(int cx, int cy, int cz, int size, ivec &bbmin, ivec &bbmax) +{ + vvec vmin(cx, cy, cz), vmax = vmin; + vmin.add(size); + + loopv(vc.verts) + { + vvec &v = vc.verts[i]; + loopj(3) + { + if(v[j]vmax[j]) vmax[j] = v[j]; + } + } + + bbmin = vmin.toivec(cx, cy, cz); + loopi(3) vmax[i] += (1<geommin = bbmin; + va->geommax = bbmax; + calcmatbb(cx, cy, cz, size, va->matmin, va->matmax); + va->shadowmapmin = shadowmapmin.toivec(va->o); + loopk(3) shadowmapmax[k] += (1<shadowmapmax = shadowmapmax.toivec(va->o); + va->hasmerges = vahasmerges; + } + + explicitsky = 0; + skyarea = 0; + vc.clear(); +} + +VARF(vacubemax, 64, 512, 256*256, allchanged()); +VARF(vacubesize, 32, 128, VVEC_INT_MASK+1, allchanged()); +VARF(vacubemin, 0, 128, 256*256, allchanged()); + +int updateva(cube *c, int cx, int cy, int cz, int size, int csi) +{ + progress("recalculating geometry..."); + static int faces[6]; + int ccount = 0, cmergemax = vamergemax, chasmerges = vahasmerges; + loopi(8) // counting number of semi-solid/solid children cubes + { + int count = 0, childpos = varoot.length(); + ivec o(i, cx, cy, cz, size); + vamergemax = 0; + vahasmerges = 0; + if(c[i].ext && c[i].ext->va) + { + //count += vacubemax+1; // since must already have more then max cubes + varoot.add(c[i].ext->va); + if(c[i].ext->va->hasmerges&MERGE_ORIGIN) findmergedfaces(c[i], o, size, csi, csi); + } + else + { + if(c[i].children) count += updateva(c[i].children, o.x, o.y, o.z, size/2, csi-1); + else if(!isempty(c[i]) || hasskyfaces(c[i], o.x, o.y, o.z, size, faces)) count++; + int tcount = count + (csi < VVEC_INT ? vamerges[csi].length() : 0); + if(tcount > vacubemax || (tcount >= vacubemin && size >= vacubesize) || size == min(VVEC_INT_MASK+1, hdr.worldsize/2)) + { + setva(c[i], o.x, o.y, o.z, size, csi); + if(c[i].ext && c[i].ext->va) + { + while(varoot.length() > childpos) + { + vtxarray *child = varoot.pop(); + c[i].ext->va->children.add(child); + child->parent = c[i].ext->va; + } + varoot.add(c[i].ext->va); + if(vamergemax > size) + { + cmergemax = max(cmergemax, vamergemax); + chasmerges |= vahasmerges&~MERGE_USE; + } + continue; + } + else count = 0; + } + } + if(csi < VVEC_INT-1 && vamerges[csi].length()) vamerges[csi+1].move(vamerges[csi]); + cmergemax = max(cmergemax, vamergemax); + chasmerges |= vahasmerges; + ccount += count; + } + + vamergemax = cmergemax; + vahasmerges = chasmerges; + + return ccount; +} + +void buildclipmasks(cube &c, uchar &vismask = unusedmask, uchar &clipmask = unusedmask) +{ + if(c.ext && c.ext->va) + { + vismask = c.children ? c.vismask : 0x3F; + clipmask = c.children ? c.clipmask : 0; + return; + } + if(!c.children) + { + if(isempty(c)) c.vismask = c.clipmask = 0; + vismask = clipmask = 0; + return; + } + uchar visparent = 0, clipparent = 0x3F; + uchar clipchild[8]; + loopi(8) + { + buildclipmasks(c.children[i], c.vismasks[i], clipchild[i]); + uchar mask = (1<= 0) + { + tjoint &o = tjoints[cur]; + if(tj.edge < o.edge || (tj.edge==o.edge && (e.flags&CE_FLIP ? tj.offset > o.offset : tj.offset < o.offset))) break; + prev = cur; + cur = o.next; + } + + tj.next = cur; + if(prev < 0) e.c->ext->tjoints = tjoints.length()-1; + else tjoints[prev].next = tjoints.length()-1; +} + +void findtjoints(int cur, const edgegroup &g) +{ + int active = -1; + while(cur >= 0) + { + cubeedge &e = cubeedges[cur]; + int prevactive = -1, curactive = active; + while(curactive >= 0) + { + cubeedge &a = cubeedges[curactive]; + if(a.offset+a.size <= e.offset) + { + if(prevactive >= 0) cubeedges[prevactive].next = a.next; + else active = a.next; + } + else + { + prevactive = curactive; + if(!(a.flags&CE_DUP)) + { + if(e.flags&CE_START && e.offset > a.offset && e.offset < a.offset+a.size) + addtjoint(g, a, e.offset); + if(e.flags&CE_END && e.offset+e.size > a.offset && e.offset+e.size < a.offset+a.size) + addtjoint(g, a, e.offset+e.size); + } + if(!(e.flags&CE_DUP)) + { + if(a.flags&CE_START && a.offset > e.offset && a.offset < e.offset+e.size) + addtjoint(g, e, a.offset); + if(a.flags&CE_END && a.offset+a.size > e.offset && a.offset+a.size < e.offset+e.size) + addtjoint(g, e, a.offset+a.size); + } + } + curactive = a.next; + } + int next = e.next; + e.next = active; + active = cur; + cur = next; + } +} + +void octarender() // creates va s for all leaf cubes that don't already have them +{ + int csi = 0; + while(1<explicitsky; + skyarea += va->skyarea; + } +} + +void precachetextures(vtxarray *va) { loopi(va->texs) lookuptexture(va->eslist[i].texture); } +void precacheall() { loopv(valist) precachetextures(valist[i]); } + +void allchanged(bool load) +{ + show_out_of_renderloop_progress(0, "clearing VBOs..."); + vaclearc(worldroot); + resetqueries(); + if(load) initenvmaps(); + guessshadowdir(); + entitiesinoctanodes(); + tjoints.setsizenodelete(0); + if(filltjoints) + { + recalcprogress = 0; + gencubeedges(); + enumeratekt(edgegroups, edgegroup, g, int, e, findtjoints(e, g)); + cubeedges.setsizenodelete(0); + edgegroups.clear(); + } + octarender(); + if(load) precacheall(); + setupmaterials(); + invalidatepostfx(); + updatevabbs(true); + if(load) genenvmaps(); +} + +void recalc() +{ + allchanged(true); +} + +COMMAND(recalc, ""); + diff --git a/src/engine/physics.cpp b/src/engine/physics.cpp new file mode 100644 index 0000000..da3c5a7 --- /dev/null +++ b/src/engine/physics.cpp @@ -0,0 +1,1658 @@ +// physics.cpp: no physics books were hurt nor consulted in the construction of this code. +// All physics computations and constants were invented on the fly and simply tweaked until +// they "felt right", and have no basis in reality. Collision detection is simplistic but +// very robust (uses discrete steps at fixed fps). + +#include "pch.h" +#include "engine.h" + +const int MAXCLIPPLANES = 1024; + +clipplanes clipcache[MAXCLIPPLANES], *nextclip = clipcache; + +static inline void setcubeclip(cube &c, int x, int y, int z, int size) +{ + if(!c.ext || !c.ext->clip || c.ext->clip->owner!=&c) + { + if(nextclip >= &clipcache[MAXCLIPPLANES]) nextclip = clipcache; + ext(c).clip = nextclip; + nextclip->owner = &c; + genclipplanes(c, x, y, z, size, *nextclip); + nextclip++; + } +} + +void freeclipplanes(cube &c) +{ + if(!c.ext || !c.ext->clip) return; + if(c.ext->clip->owner==&c) c.ext->clip->owner = NULL; + c.ext->clip = NULL; +} + +///////////////////////// ray - cube collision /////////////////////////////////////////////// + +static inline void pushvec(vec &o, const vec &ray, float dist) +{ + vec d(ray); + d.mul(dist); + o.add(d); +} + +static inline bool pointinbox(const vec &v, const vec &bo, const vec &br) +{ + return v.x <= bo.x+br.x && + v.x >= bo.x-br.x && + v.y <= bo.y+br.y && + v.y >= bo.y-br.y && + v.z <= bo.z+br.z && + v.z >= bo.z-br.z; +} + +bool pointincube(const clipplanes &p, const vec &v) +{ + if(!pointinbox(v, p.o, p.r)) return false; + loopi(p.size) if(p.p[i].dist(v)>1e-3f) return false; + return true; +} + +#define INTERSECTPLANES(setentry) \ + clipplanes &p = *c.ext->clip; \ + float enterdist = -1e16f, exitdist = 1e16f; \ + loopi(p.size) \ + { \ + float pdist = p.p[i].dist(o), facing = ray.dot(p.p[i]); \ + if(facing < 0) \ + { \ + pdist /= -facing; \ + if(pdist > enterdist) \ + { \ + if(pdist > exitdist) return false; \ + enterdist = pdist; \ + setentry; \ + } \ + } \ + else if(facing > 0) \ + { \ + pdist /= -facing; \ + if(pdist < exitdist) \ + { \ + if(pdist < enterdist) return false; \ + exitdist = pdist; \ + } \ + } \ + else if(pdist > 0) return false; \ + } + +// optimized shadow version +bool shadowcubeintersect(const cube &c, const vec &o, const vec &ray, float &dist) +{ + INTERSECTPLANES({}); + if(exitdist < 0) return false; + enterdist += 0.1f; + if(enterdist < 0) enterdist = 0; + if(!pointinbox(vec(ray).mul(enterdist).add(o), p.o, p.r)) return false; + dist = enterdist; + return true; +} + +vec hitsurface; + +bool raycubeintersect(const cube &c, const vec &o, const vec &ray, float &dist) +{ + int entry = -1, bbentry = -1; + INTERSECTPLANES(entry = i); + loop(i, 3) + { + if(ray[i]) + { + float pdist = ((ray[i] > 0 ? p.o[i]-p.r[i] : p.o[i]+p.r[i]) - o[i]) / ray[i]; + if(pdist > enterdist) + { + if(pdist > exitdist) return false; + enterdist = pdist; + bbentry = i; + } + pdist += 2*p.r[i]/fabs(ray[i]); + if(pdist < exitdist) + { + if(pdist < enterdist) return false; + exitdist = pdist; + } + } + else if(o[i] < p.o[i]-p.r[i] || o[i] > p.o[i]+p.r[i]) return false; + } + if(exitdist < 0) return false; + dist = max(enterdist+0.1f, 0.0f); + if(bbentry>=0) { hitsurface = vec(0, 0, 0); hitsurface[bbentry] = ray[bbentry]>0 ? -1 : 1; } + else hitsurface = p.p[entry]; + return true; +} + +extern void entselectionbox(const entity &e, vec &eo, vec &es); +extern int entselradius; +float hitentdist; +int hitent, hitorient; + +static float disttoent(octaentities *oc, octaentities *last, const vec &o, const vec &ray, float radius, int mode, extentity *t) +{ + vec eo, es; + int orient; + float dist = 1e16f, f = 0.0f; + if(oc == last || oc == NULL) return dist; + const vector &ents = et->getents(); + + #define entintersect(mask, type, func) {\ + if((mode&(mask))==(mask)) \ + { \ + loopv(oc->type) \ + if(!last || last->type.find(oc->type[i])<0) \ + { \ + extentity &e = *ents[oc->type[i]]; \ + if(!e.inoctanode || &e==t) continue; \ + func; \ + if(f0) { \ + hitentdist = dist = f; \ + hitent = oc->type[i]; \ + hitorient = orient; \ + } \ + } \ + } \ + } + + entintersect(RAY_POLY, mapmodels, + if(e.attr3 && (e.triggerstate == TRIGGER_DISAPPEARED || !checktriggertype(e.attr3, TRIG_COLLIDE) || e.triggerstate == TRIGGERED) && (mode&RAY_ENTS)!=RAY_ENTS) continue; + orient = 0; // FIXME, not set + if(!mmintersect(e, o, ray, radius, mode, f)) continue; + ); + + entintersect(RAY_ENTS, other, + entselectionbox(e, eo, es); + if(!rayrectintersect(eo, es, o, ray, f, orient)) continue; + ); + + entintersect(RAY_ENTS, mapmodels, + entselectionbox(e, eo, es); + if(!rayrectintersect(eo, es, o, ray, f, orient)) continue; + ); + + return dist; +} + +// optimized shadow version +static float shadowent(octaentities *oc, octaentities *last, const vec &o, const vec &ray, float radius, int mode, extentity *t) +{ + float dist = 1e16f, f = 0.0f; + if(oc == last || oc == NULL) return dist; + const vector &ents = et->getents(); + loopv(oc->mapmodels) if(!last || last->mapmodels.find(oc->mapmodels[i])<0) + { + extentity &e = *ents[oc->mapmodels[i]]; + if(!e.inoctanode || &e==t) continue; + if(e.attr3 && (e.triggerstate == TRIGGER_DISAPPEARED || !checktriggertype(e.attr3, TRIG_COLLIDE) || e.triggerstate == TRIGGERED)) continue; + if(!mmintersect(e, o, ray, radius, mode, f)) continue; + if(f>0 && f0 ? 1 : 0, invray.y>0 ? 1 : 0, invray.z>0 ? 1 : 0); \ + +#define CHECKINSIDEWORLD \ + if(!insideworld(o)) \ + { \ + float disttoworld = 0, exitworld = 1e16f; \ + loopi(3) \ + { \ + float c = v[i]; \ + if(c<0 || c>=hdr.worldsize) \ + { \ + float d = ((invray[i]>0?0:hdr.worldsize)-c)*invray[i]; \ + if(d<0) return (radius>0?radius:-1); \ + disttoworld = max(disttoworld, 0.1f + d); \ + } \ + float e = ((invray[i]>0?hdr.worldsize:0)-c)*invray[i]; \ + exitworld = min(exitworld, e); \ + } \ + if(disttoworld > exitworld) return (radius>0?radius:-1); \ + pushvec(v, ray, disttoworld); \ + dist += disttoworld; \ + } + +#define DOWNOCTREE(disttoent, earlyexit) \ + cube *lc = levels[lshift]; \ + for(;;) \ + { \ + lshift--; \ + lc += octastep(x, y, z, lshift); \ + if(lc->ext && lc->ext->ents && dent > 1e15f) \ + { \ + dent = disttoent(lc->ext->ents, oclast, o, ray, radius, mode, t); \ + if(dent < 1e15f earlyexit) return min(dent, dist); \ + oclast = lc->ext->ents; \ + } \ + if(lc->children==NULL) break; \ + lc = lc->children; \ + levels[lshift] = lc; \ + } + +#define FINDCLOSEST(xclosest, yclosest, zclosest) \ + float dx = (lo.x+(lsizemask.x<= uint(hdr.worldsize)) exitworld; \ + diff >>= lshift; \ + if(!diff) exitworld; \ + do \ + { \ + lshift++; \ + diff >>= 1; \ + } while(diff); + +float raycube(const vec &o, const vec &ray, float radius, int mode, int size, extentity *t) +{ + if(ray.iszero()) return 0; + + INITRAYCUBE; + CHECKINSIDEWORLD; + + int closest = -1, x = int(v.x), y = int(v.y), z = int(v.z); + for(;;) + { + DOWNOCTREE(disttoent, && (mode&RAY_SHADOW)); + + int lsize = 1<0 || !(mode&RAY_SKIPFIRST)) && + (((mode&RAY_CLIPMAT) && c.ext && isclipped(c.ext->material&MATF_VOLUME)) || + ((mode&RAY_EDITMAT) && c.ext && c.ext->material != MAT_AIR) || + (!(mode&RAY_PASS) && lsize==size && !isempty(c)) || + isentirelysolid(c) || + dent < dist)) + { + if(closest >= 0) { hitsurface = vec(0, 0, 0); hitsurface[closest] = ray[closest]>0 ? -1 : 1; } + return min(dent, dist); + } + + ivec lo(x&(~0<0 || !(mode&RAY_SKIPFIRST))) + return min(dent, dist+f); + } + + FINDCLOSEST(closest = 0, closest = 1, closest = 2); + + if(radius>0 && dist>=radius) return min(dent, dist); + + UPOCTREE(return min(dent, radius>0 ? radius : dist)); + } +} + +// optimized version for lightmap shadowing... every cycle here counts!!! +float shadowray(const vec &o, const vec &ray, float radius, int mode, extentity *t) +{ + INITRAYCUBE; + CHECKINSIDEWORLD; + + int x = int(v.x), y = int(v.y), z = int(v.z); + for(;;) + { + DOWNOCTREE(shadowent, ); + + cube &c = *lc; + if(isentirelysolid(c)) return dist; + + ivec lo(x&(~0<=radius) return dist; + + UPOCTREE(return radius); + } +} + +float rayent(const vec &o, const vec &ray, vec &hitpos, float radius, int mode, int size, int &orient, int &ent) +{ + hitent = -1; + float d = raycubepos(o, ray, hitpos, hitentdist = radius, mode, size); + orient = hitorient; + ent = (hitentdist == d) ? hitent : -1; + return d; +} + +float raycubepos(const vec &o, const vec &ray, vec &hitpos, float radius, int mode, int size) +{ + hitpos = ray; + float dist = raycube(o, ray, radius, mode, size); + hitpos.mul(dist); + hitpos.add(o); + return dist; +} + +bool raycubelos(const vec &o, const vec &dest, vec &hitpos) +{ + vec ray(dest); + ray.sub(o); + float mag = ray.magnitude(); + ray.mul(1/mag); + float distance = raycubepos(o, ray, hitpos, mag, RAY_CLIPMAT|RAY_POLY); + return distance >= mag; +} + +float rayfloor(const vec &o, vec &floor, int mode, float radius) +{ + if(o.z<=0) return -1; + hitsurface = vec(0, 0, 1); + float dist = raycube(o, vec(0, 0, -1), radius, mode); + if(dist<0 || (radius>0 && dist>=radius)) return dist; + floor = hitsurface; + return dist; +} + +///////////////////////// entity collision /////////////////////////////////////////////// + +// info about collisions +bool inside; // whether an internal collision happened +physent *hitplayer; // whether the collection hit a player +vec wall; // just the normal vectors. +float walldistance; +const float STAIRHEIGHT = 4.1f; +const float FLOORZ = 0.867f; +const float SLOPEZ = 0.5f; +const float WALLZ = 0.2f; +const float JUMPVEL = 125.0f; +const float GRAVITY = 200.0f; +const float STEPSPEED = 1.0f; + +bool ellipsecollide(physent *d, const vec &dir, const vec &o, float yaw, float xr, float yr, float hi, float lo) +{ + float below = (o.z-lo) - (d->o.z+d->aboveeye), + above = (d->o.z-d->eyeheight) - (o.z+hi); + if(below>=0 || above>=0) return true; + float x = o.x - d->o.x, y = o.y - d->o.y; + float angle = atan2f(y, x), dangle = angle-(d->yaw+90)*RAD, eangle = angle-(yaw+90)*RAD; + float dx = d->xradius*cosf(dangle), dy = d->yradius*sinf(dangle); + float ex = xr*cosf(eangle), ey = yr*sinf(eangle); + float dist = sqrtf(x*x + y*y) - sqrtf(dx*dx + dy*dy) - sqrtf(ex*ex + ey*ey); + if(dist < 0) + { + if(dist > (d->o.z < o.z ? below : above) && (dir.iszero() || x*dir.x + y*dir.y > 0)) + { + wall = vec(-x, -y, 0); + if(!wall.iszero()) wall.normalize(); + return false; + } + if(d->o.z < o.z) + { + if(dir.iszero() || (dir.z > 0 && (d->type>=ENT_INANIMATE || below >= d->zmargin-(d->eyeheight+d->aboveeye)/4.0f))) + { + wall = vec(0, 0, -1); + return false; + } + } + else if(dir.iszero() || (dir.z < 0 && (d->type>=ENT_INANIMATE || above >= d->zmargin-(d->eyeheight+d->aboveeye)/3.0f))) + { + wall = vec(0, 0, 1); + return false; + } + inside = true; + } + return true; +} + +bool rectcollide(physent *d, const vec &dir, const vec &o, float xr, float yr, float hi, float lo, uchar visible = 0xFF, bool collideonly = true, float cutoff = 0) +{ + if(collideonly && !visible) return true; + vec s(d->o); + s.sub(o); + float dxr = d->collidetype==COLLIDE_ELLIPSE ? d->radius : d->xradius, dyr = d->collidetype==COLLIDE_ELLIPSE ? d->radius : d->yradius; + xr += dxr; + yr += dyr; + walldistance = -1e10f; + float zr = s.z>0 ? d->eyeheight+hi : d->aboveeye+lo; + float ax = fabs(s.x)-xr; + float ay = fabs(s.y)-yr; + float az = fabs(s.z)-zr; + if(ax>0 || ay>0 || az>0) return true; + wall.x = wall.y = wall.z = 0; +#define TRYCOLLIDE(dim, ON, OP, N, P) \ + { \ + if(s.dim<0) { if(visible&(1<0 && (d->type>=ENT_INANIMATE || (N))))) { walldistance = a ## dim; wall.dim = -1; return false; } } \ + else if(visible&(1<type>=ENT_INANIMATE || (P))))) { walldistance = a ## dim; wall.dim = 1; return false; } \ + } + if(ax>ay && ax>az) TRYCOLLIDE(x, O_LEFT, O_RIGHT, ax > -dxr, ax > -dxr); + if(ay>az) TRYCOLLIDE(y, O_BACK, O_FRONT, ay > -dyr, ay > -dyr); + TRYCOLLIDE(z, O_BOTTOM, O_TOP, + az >= d->zmargin-(d->eyeheight+d->aboveeye)/4.0f, + az >= d->zmargin-(d->eyeheight+d->aboveeye)/3.0f); + if(collideonly) inside = true; + return collideonly; +} + +#define DYNENTCACHESIZE 1024 + +static uint dynentframe = 0; + +static struct dynentcacheentry +{ + int x, y; + uint frame; + vector dynents; +} dynentcache[DYNENTCACHESIZE]; + +void cleardynentcache() +{ + dynentframe++; + if(!dynentframe || dynentframe == 1) loopi(DYNENTCACHESIZE) dynentcache[i].frame = 0; + if(!dynentframe) dynentframe = 1; +} + +VARF(dynentsize, 4, 7, 12, cleardynentcache()); + +#define DYNENTHASH(x, y) (((((x)^(y))<<5) + (((x)^(y))>>5)) & (DYNENTCACHESIZE - 1)) + +const vector &checkdynentcache(int x, int y) +{ + dynentcacheentry &dec = dynentcache[DYNENTHASH(x, y)]; + if(dec.x == x && dec.y == y && dec.frame == dynentframe) return dec.dynents; + dec.x = x; + dec.y = y; + dec.frame = dynentframe; + dec.dynents.setsize(0); + int numdyns = cl->numdynents(), dsize = 1<iterdynents(i); + if(!d || d->state != CS_ALIVE || + d->o.x+d->radius <= dx || d->o.x-d->radius >= dx+dsize || + d->o.y+d->radius <= dy || d->o.y-d->radius >= dy+dsize) + continue; + dec.dynents.add(d); + } + return dec.dynents; +} + +#define loopdynentcache(curx, cury, o, radius) \ + for(int curx = max(int(o.x-radius), 0)>>dynentsize, endx = min(int(o.x+radius), hdr.worldsize-1)>>dynentsize; curx <= endx; curx++) \ + for(int cury = max(int(o.y-radius), 0)>>dynentsize, endy = min(int(o.y+radius), hdr.worldsize-1)>>dynentsize; cury <= endy; cury++) + +void updatedynentcache(physent *d) +{ + loopdynentcache(x, y, d->o, d->radius) + { + dynentcacheentry &dec = dynentcache[DYNENTHASH(x, y)]; + if(dec.x != x || dec.y != y || dec.frame != dynentframe || dec.dynents.find(d) >= 0) continue; + dec.dynents.add(d); + } +} + +bool overlapsdynent(const vec &o, float radius) +{ + loopdynentcache(x, y, o, radius) + { + const vector &dynents = checkdynentcache(x, y); + loopv(dynents) + { + physent *d = dynents[i]; + if(o.dist(d->o)-d->radius < radius) return true; + } + } + return false; +} + +bool plcollide(physent *d, const vec &dir) // collide with player or monster +{ + if(d->type==ENT_CAMERA || d->state!=CS_ALIVE) return true; + loopdynentcache(x, y, d->o, d->radius) + { + const vector &dynents = checkdynentcache(x, y); + loopv(dynents) + { + physent *o = dynents[i]; + if(o==d || d->o.reject(o->o, d->radius+o->radius)) continue; + if(d->collidetype!=COLLIDE_ELLIPSE || o->collidetype!=COLLIDE_ELLIPSE) + { + if(!rectcollide(d, dir, o->o, o->collidetype==COLLIDE_ELLIPSE ? o->radius : o->xradius, o->collidetype==COLLIDE_ELLIPSE ? o->radius : o->yradius, o->aboveeye, o->eyeheight)) + { + hitplayer = o; + if((d->type==ENT_AI || d->type==ENT_INANIMATE) && wall.z>0) d->onplayer = o; + return false; + } + } + else if(!ellipsecollide(d, dir, o->o, o->yaw, o->xradius, o->yradius, o->aboveeye, o->eyeheight)) + { + hitplayer = o; + if((d->type==ENT_AI || d->type==ENT_INANIMATE) && wall.z>0) d->onplayer = o; + return false; + } + } + } + return true; +} + +void rotatebb(vec ¢er, vec &radius, int yaw) +{ + yaw = (yaw+7)-(yaw+7)%15; + yaw += 180; + if(yaw < 0) yaw = 360 + yaw%360; + else if(yaw >= 360) yaw %= 360; + switch(yaw) + { + case 0: break; + case 180: + center.x = -center.x; + center.y = -center.y; + break; + case 90: + swap(radius.x, radius.y); + swap(center.x, center.y); + center.x = -center.x; + break; + case 270: + swap(radius.x, radius.y); + swap(center.x, center.y); + center.y = -center.y; + break; + default: + radius.x = radius.y = max(radius.x, radius.y) + max(fabs(center.x), fabs(center.y)); + center.x = center.y = 0.0f; + break; + } +} + +bool mmcollide(physent *d, const vec &dir, octaentities &oc) // collide with a mapmodel +{ + const vector &ents = et->getents(); + loopv(oc.mapmodels) + { + extentity &e = *ents[oc.mapmodels[i]]; + if(e.attr3 && e.attr3!=15 && (e.triggerstate == TRIGGER_DISAPPEARED || !checktriggertype(e.attr3, TRIG_COLLIDE) || e.triggerstate == TRIGGERED || (e.triggerstate == TRIGGERING && lastmillis-e.lasttrigger >= 500))) continue; + model *m = loadmodel(NULL, e.attr2); + if(!m || !m->collide) continue; + vec center, radius; + m->collisionbox(0, center, radius); + if(!m->ellipsecollide || d->collidetype!=COLLIDE_ELLIPSE) + { + rotatebb(center, radius, e.attr1); + if(!rectcollide(d, dir, center.add(e.o), radius.x, radius.y, radius.z, radius.z)) return false; + } + else if(!ellipsecollide(d, dir, center.add(e.o), float((e.attr1+7)-(e.attr1+7)%15), radius.x, radius.y, radius.z, radius.z)) return false; + } + return true; +} + +bool cubecollide(physent *d, const vec &dir, float cutoff, cube &c, int x, int y, int z, int size, bool solid) // collide with cube geometry +{ + if(solid || isentirelysolid(c)) + { + int s2 = size>>1; + vec o = vec(x+s2, y+s2, z+s2); + vec r = vec(s2, s2, s2); + return rectcollide(d, dir, o, r.x, r.y, r.z, r.z, isentirelysolid(c) ? (c.ext ? c.ext->visible : 0) : 0xFF, true, cutoff); + } + + setcubeclip(c, x, y, z, size); + clipplanes &p = *c.ext->clip; + + float r = d->radius, + zr = (d->aboveeye+d->eyeheight)/2; + vec o(d->o), *w = &wall; + o.z += zr - d->eyeheight; + + if(rectcollide(d, dir, p.o, p.r.x, p.r.y, p.r.z, p.r.z, c.ext->visible, !p.size, cutoff)) return true; + + if(p.size) + { + if(!wall.iszero()) + { + vec wo(o), wrad(r, r, zr); + loopi(3) if(wall[i]) { wo[i] = p.o[i]+wall[i]*p.r[i]; wrad[i] = 0; break; } + loopi(p.size) + { + plane &f = p.p[i]; + if(!wall.dot(f)) continue; + if(f.dist(wo) >= vec(f.x*wrad.x, f.y*wrad.y, f.z*wrad.z).magnitude()) + { + wall = vec(0, 0, 0); + walldistance = -1e10f; + break; + } + } + } + float m = walldistance; + loopi(p.size) + { + plane &f = p.p[i]; + float dist = f.dist(o) - vec(f.x*r, f.y*r, f.z*zr).magnitude(); + if(dist > 0) return true; + if(dist > m) + { + if(!dir.iszero()) + { + if(f.dot(dir) >= -cutoff*dir.magnitude()) continue; + if(d->typezmargin-(d->eyeheight+d->aboveeye)/(dir.z < 0 ? 3.0f : 4.0f) : + ((dir.x*f.x < 0 || dir.y*f.y < 0) ? -r : 0))) + continue; + } + if(f.x && (f.x>0 ? o.x-p.o.x : p.o.x-o.x) + p.r.x - r < dist && + f.dist(vec(p.o.x + (f.x>0 ? -p.r.x : p.r.x), o.y, o.z)) >= vec(0, f.y*r, f.z*zr).magnitude()) + continue; + if(f.y && (f.y>0 ? o.y-p.o.y : p.o.y-o.y) + p.r.y - r < dist && + f.dist(vec(o.x, p.o.y + (f.y>0 ? -p.r.y : p.r.y), o.z)) >= vec(f.x*r, 0, f.z*zr).magnitude()) + continue; + if(f.z && (f.z>0 ? o.z-p.o.z : p.o.z-o.z) + p.r.z - zr < dist && + f.dist(vec(o.x, o.y, p.o.z + (f.z>0 ? -p.r.z : p.r.z))) >= vec(f.x*r, f.y*r, 0).magnitude()) + continue; + w = &f; + m = dist; + } + } + wall = *w; + if(wall.iszero()) + { + inside = true; + return true; + } + } + return false; +} + +static inline bool octacollide(physent *d, const vec &dir, float cutoff, const ivec &bo, const ivec &bs, cube *c, const ivec &cor, int size) // collide with octants +{ + loopoctabox(cor, size, bo, bs) + { + if(c[i].ext && c[i].ext->ents) if(!mmcollide(d, dir, *c[i].ext->ents)) return false; + ivec o(i, cor.x, cor.y, cor.z, size); + if(c[i].children) + { + if(!octacollide(d, dir, cutoff, bo, bs, c[i].children, o, size>>1)) return false; + } + else + { + bool solid = false; + if(c[i].ext) switch(c[i].ext->material&MATF_CLIP) + { + case MAT_NOCLIP: continue; + case MAT_AICLIP: if(d->type==ENT_AI) solid = true; break; + case MAT_CLIP: if(isclipped(c[i].ext->material&MATF_VOLUME) || d->type= uint(hdr.worldsize)) + return octacollide(d, dir, cutoff, bo, bs, worldroot, ivec(0, 0, 0), hdr.worldsize>>1); + cube *c = &worldroot[octastep(bo.x, bo.y, bo.z, scale)]; + if(c->ext && c->ext->ents && !mmcollide(d, dir, *c->ext->ents)) return false; + scale--; + while(c->children && !(diff&(1<children[octastep(bo.x, bo.y, bo.z, scale)]; + if(c->ext && c->ext->ents && !mmcollide(d, dir, *c->ext->ents)) return false; + scale--; + } + if(c->children) return octacollide(d, dir, cutoff, bo, bs, c->children, ivec(bo).mask(~((2<ext) switch(c->ext->material&MATF_CLIP) + { + case MAT_NOCLIP: return true; + case MAT_AICLIP: if(d->type==ENT_AI) solid = true; break; + case MAT_CLIP: if(isclipped(c->ext->material&MATF_VOLUME) || d->typeo.x-d->radius), int(d->o.y-d->radius), int(d->o.z-d->eyeheight)), + bs(int(d->radius)*2, int(d->radius)*2, int(d->eyeheight+d->aboveeye)); + bs.add(2); // guard space for rounding errors + if(!octacollide(d, dir, cutoff, bo, bs)) return false;//, worldroot, ivec(0, 0, 0), hdr.worldsize>>1)) return false; // collide with world + return !playercol || plcollide(d, dir); +} + +void recalcdir(physent *d, const vec &oldvel, vec &dir) +{ + float speed = oldvel.magnitude(); + if(speed > 1e-6f) + { + float step = dir.magnitude(); + dir = d->vel; + dir.add(d->falling); + dir.mul(step/speed); + } +} + +void slideagainst(physent *d, vec &dir, const vec &obstacle, bool foundfloor) +{ + vec wall(obstacle); + if(foundfloor && wall.z) + { + wall.z = 0; + if(!wall.iszero()) wall.normalize(); + } + vec oldvel(d->vel); + oldvel.add(d->falling); + d->vel.project(wall); + d->falling.project(wall); + recalcdir(d, oldvel, dir); +} + +void switchfloor(physent *d, vec &dir, const vec &floor) +{ + if(floor.z >= FLOORZ) d->falling = vec(0, 0, 0); + + vec oldvel(d->vel); + oldvel.add(d->falling); + if(dir.dot(floor) >= 0) + { + if(d->physstate < PHYS_SLIDE || fabs(dir.dot(d->floor)) > 0.01f*dir.magnitude()) return; + d->vel.projectxy(floor, 0.0f); + } + else d->vel.projectxy(floor); + d->falling.project(floor); + recalcdir(d, oldvel, dir); +} + +bool trystepup(physent *d, vec &dir, float maxstep) +{ + vec old(d->o); + /* check if there is space atop the stair to move to */ + if(d->physstate != PHYS_STEP_UP) + { + d->o.add(dir); + d->o.z += maxstep + 0.1f; + if(!collide(d)) + { + d->o = old; + return false; + } + } + /* try stepping up */ + d->o = old; + d->o.z += dir.magnitude()*STEPSPEED; + if(collide(d, vec(0, 0, 1))) + { + if(d->physstate == PHYS_FALL) + { + d->timeinair = 0; + d->floor = vec(0, 0, 1); + switchfloor(d, dir, d->floor); + } + d->physstate = PHYS_STEP_UP; + return true; + } + d->o = old; + return false; +} + +#if 0 +bool trystepdown(physent *d, vec &dir, float step, float a, float b) +{ + vec old(d->o); + vec dv(dir.x*a, dir.y*a, -step*b), v(dv); + v.mul(STAIRHEIGHT/(step*b)); + d->o.add(v); + if(!collide(d, vec(0, 0, -1), SLOPEZ)) + { + d->o = old; + d->o.add(dv); + if(collide(d, vec(0, 0, -1))) return true; + } + d->o = old; + return false; +} +#endif + +void falling(physent *d, vec &dir, const vec &floor) +{ +#if 0 + if(d->physstate >= PHYS_FLOOR && (floor.z == 0.0f || floor.z == 1.0f)) + { + vec moved(d->o); + d->o.z -= STAIRHEIGHT + 0.1f; + if(!collide(d, vec(0, 0, -1), SLOPEZ)) + { + d->o = moved; + d->physstate = PHYS_STEP_DOWN; + return; + } + else d->o = moved; + } +#endif + if(floor.z > 0.0f && floor.z < SLOPEZ) + { + if(floor.z >= WALLZ) switchfloor(d, dir, floor); + d->timeinair = 0; + d->physstate = PHYS_SLIDE; + d->floor = floor; + } + else d->physstate = PHYS_FALL; +} + +void landing(physent *d, vec &dir, const vec &floor) +{ +#if 0 + if(d->physstate == PHYS_FALL) + { + d->timeinair = 0; + if(dir.z < 0.0f) dir.z = d->vel.z = 0.0f; + } +#endif + switchfloor(d, dir, floor); + d->timeinair = 0; + if(floor.z >= FLOORZ) d->physstate = PHYS_FLOOR; + else d->physstate = PHYS_SLOPE; + d->floor = floor; +} + +bool findfloor(physent *d, bool collided, const vec &obstacle, bool &slide, vec &floor) +{ + bool found = false; + vec moved(d->o); + d->o.z -= 0.1f; + if(!collide(d, vec(0, 0, -1), d->physstate == PHYS_SLOPE ? SLOPEZ : FLOORZ)) + { + floor = wall; + found = true; + } + else if(collided && obstacle.z >= SLOPEZ) + { + floor = obstacle; + found = true; + slide = false; + } + else if(d->physstate == PHYS_STEP_UP || d->physstate == PHYS_SLIDE) + { + if(!collide(d, vec(0, 0, -1)) && wall.z > 0.0f) + { + floor = wall; + if(floor.z >= SLOPEZ) found = true; + } + } + else if(d->physstate >= PHYS_SLOPE && d->floor.z < 1.0f) + { + d->o.z -= d->radius; + if(!collide(d, vec(d->floor).neg(), 0.95f) || !collide(d, vec(0, 0, -1))) + { + floor = wall; + if(floor.z >= SLOPEZ && floor.z < 1.0f) found = true; + } + } + if(collided && (!found || obstacle.z > floor.z)) + { + floor = obstacle; + slide = !found && (floor.z < WALLZ || floor.z >= SLOPEZ); + } + d->o = moved; + return found; +} + +bool move(physent *d, vec &dir) +{ + vec old(d->o); +#if 0 + if(d->physstate == PHYS_STEP_DOWN && dir.z <= 0.0f && cl->allowmove(pl) && (d->move || d->strafe)) + { + float step = dir.magnitude()*STEPSPEED; + if(trystepdown(d, dir, step, 0.75f, 0.25f)) return true; + if(trystepdown(d, dir, step, 0.5f, 0.5f)) return true; + if(trystepdown(d, dir, step, 0.25f, 0.75f)) return true; + d->o.z -= step; + if(collide(d, vec(0, 0, -1))) return true; + d->o = old; + } +#endif + bool collided = false, slidecollide = false; + vec obstacle; + d->o.add(dir); + if(!collide(d, d->type!=ENT_CAMERA ? dir : vec(0, 0, 0)) || ((d->type==ENT_AI || d->type==ENT_INANIMATE) && !collide(d))) + { + obstacle = wall; + /* check to see if there is an obstacle that would prevent this one from being used as a floor (or ceiling bump) */ + if(d->type==ENT_PLAYER && ((wall.z>=SLOPEZ && dir.z<0) || (wall.z<=-SLOPEZ && dir.z>0)) && (dir.x || dir.y) && !collide(d, vec(dir.x, dir.y, 0))) + { + if(wall.dot(dir) >= 0) slidecollide = true; + obstacle = wall; + } + d->o = old; + if(d->type == ENT_CAMERA) return false; + float stepdist = (d->physstate >= PHYS_SLOPE && d->floor.z < 1.0f ? d->radius+0.1f : STAIRHEIGHT); + d->o.z -= stepdist; + d->zmargin = -stepdist; + if(d->physstate == PHYS_SLOPE || d->physstate == PHYS_FLOOR || (!collide(d, vec(0, 0, -1), SLOPEZ) && (d->physstate==PHYS_STEP_UP || wall.z>=FLOORZ))) + { + d->o = old; + d->zmargin = 0; + float floorz = (d->physstate == PHYS_SLOPE || d->physstate == PHYS_FLOOR ? d->floor.z : wall.z); + if(trystepup(d, dir, floorz < 1.0f ? d->radius+0.1f : STAIRHEIGHT)) return true; + } + else + { + d->o = old; + d->zmargin = 0; + } + /* can't step over the obstacle, so just slide against it */ + collided = true; + } + vec floor(0, 0, 0); + bool slide = collided, + found = findfloor(d, collided, obstacle, slide, floor); + if(slide || (!collided && floor.z > 0 && floor.z < WALLZ)) + { + slideagainst(d, dir, slide ? obstacle : floor, found || slidecollide); + if(d->type == ENT_AI || d->type == ENT_INANIMATE) d->blocked = true; + } + if(found) + { + if(d->type == ENT_CAMERA) return false; + landing(d, dir, floor); + } + else falling(d, dir, floor); + return !collided; +} + +bool bounce(physent *d, float secs, float elasticity, float waterfric) +{ + int mat = lookupmaterial(vec(d->o.x, d->o.y, d->o.z + (d->aboveeye - d->eyeheight)/2)); + bool water = isliquid(mat); + if(water) + { + d->vel.z -= GRAVITY/16*secs; + d->vel.mul(max(1.0f - secs/waterfric, 0.0f)); + } + else d->vel.z -= GRAVITY*secs; + vec old(d->o); + loopi(2) + { + vec dir(d->vel); + dir.mul(secs); + d->o.add(dir); + if(collide(d, dir)) + { + if(inside) + { + d->o = old; + d->vel.mul(-elasticity); + } + break; + } + else if(hitplayer) break; + d->o = old; + float c = wall.dot(d->vel), + k = 1.0f + (1.0f-elasticity)*c/d->vel.magnitude(); + d->vel.mul(k); + d->vel.sub(vec(wall).mul(elasticity*2.0f*c)); + } + if(d->physstate!=PHYS_BOUNCE) + { + // make sure bouncers don't start inside geometry + if(d->o == old) return !hitplayer; + d->physstate = PHYS_BOUNCE; + } + return hitplayer!=0; +} + +void avoidcollision(physent *d, const vec &dir, physent *obstacle, float space) +{ + float rad = obstacle->radius+d->radius; + vec bbmin(obstacle->o); + bbmin.x -= rad; + bbmin.y -= rad; + bbmin.z -= obstacle->eyeheight+d->aboveeye; + bbmin.sub(space); + vec bbmax(obstacle->o); + bbmax.x += rad; + bbmax.y += rad; + bbmax.z += obstacle->aboveeye+d->eyeheight; + bbmax.add(space); + + loopi(3) if(d->o[i] <= bbmin[i] || d->o[i] >= bbmax[i]) return; + + float mindist = 1e16f; + loopi(3) if(dir[i] != 0) + { + float dist = ((dir[i] > 0 ? bbmax[i] : bbmin[i]) - d->o[i]) / dir[i]; + mindist = min(mindist, dist); + } + if(mindist >= 0.0f && mindist < 1e15f) d->o.add(vec(dir).mul(mindist)); +} + +bool droptofloor(vec &o, float radius, float height) +{ + if(!insideworld(o)) return false; + vec v(0.0001f, 0.0001f, -1); + v.normalize(); + if(raycube(o, v, hdr.worldsize) >= hdr.worldsize) return false; + physent d; + d.type = ENT_CAMERA; + d.o = o; + d.vel = vec(0, 0, -1); + d.radius = radius; + d.eyeheight = height; + d.aboveeye = radius; + loopi(hdr.worldsize) if(!move(&d, v)) + { + o = d.o; + return true; + } + return false; +} + +void dropenttofloor(entity *e) +{ + droptofloor(e->o, 1.0f, et->dropheight(*e)); +} + +void phystest() +{ + static const char *states[] = {"float", "fall", "slide", "slope", "floor", "step up", "step down", "bounce"}; + printf ("PHYS(pl): %s, air %d, floor: (%f, %f, %f), vel: (%f, %f, %f), g: (%f, %f, %f)\n", states[player->physstate], player->timeinair, player->floor.x, player->floor.y, player->floor.z, player->vel.x, player->vel.y, player->vel.z, player->falling.x, player->falling.y, player->falling.z); + printf ("PHYS(cam): %s, air %d, floor: (%f, %f, %f), vel: (%f, %f, %f), g: (%f, %f, %f)\n", states[camera1->physstate], camera1->timeinair, camera1->floor.x, camera1->floor.y, camera1->floor.z, camera1->vel.x, camera1->vel.y, camera1->vel.z, camera1->falling.x, camera1->falling.y, camera1->falling.z); +} + +COMMAND(phystest, ""); + +void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m) +{ + if(move) + { + m.x = move*sinf(RAD*yaw); + m.y = move*-cosf(RAD*yaw); + } + else m.x = m.y = 0; + + if(pitch) + { + m.x *= cosf(RAD*pitch); + m.y *= cosf(RAD*pitch); + m.z = move*sinf(RAD*pitch); + } + else m.z = 0; + + if(strafe) + { + m.x += strafe*-cosf(RAD*yaw); + m.y += strafe*-sinf(RAD*yaw); + } +} + +void vectoyawpitch(const vec &v, float &yaw, float &pitch) +{ + yaw = -(float)atan2(v.x, v.y)/RAD + 180; + pitch = asin(v.z/v.magnitude())/RAD; +} + +VARP(maxroll, 0, 3, 20); +VAR(floatspeed, 10, 100, 1000); + +void modifyvelocity(physent *pl, bool local, bool water, bool floating, int curtime) +{ + if(floating) + { + if(pl->jumpnext) + { + pl->jumpnext = false; + pl->vel.z = JUMPVEL; + } + } + else if(pl->physstate >= PHYS_SLOPE || water) + { + if(pl->type != ENT_CAMERA && water && !pl->inwater) pl->vel.div(8); + if(pl->jumpnext) + { + pl->jumpnext = false; + + pl->vel.z = JUMPVEL; // physics impulse upwards + if(water) { pl->vel.x /= 8.0f; pl->vel.y /= 8.0f; } // dampen velocity change even harder, gives correct water feel + + cl->physicstrigger(pl, local, 1, 0); + } + } + if(!floating && pl->physstate == PHYS_FALL) pl->timeinair += curtime; + + vec m(0.0f, 0.0f, 0.0f); + if(pl->type==ENT_AI) + { + dynent *d = (dynent *)pl; + if(d->rotspeed && d->yaw!=d->targetyaw) + { + float oldyaw = d->yaw, diff = d->rotspeed*curtime/1000.0f, maxdiff = fabs(d->targetyaw-d->yaw); + if(diff >= maxdiff) + { + d->yaw = d->targetyaw; + d->rotspeed = 0; + } + else d->yaw += (d->targetyaw>d->yaw ? 1 : -1) * min(diff, maxdiff); + d->normalize_yaw(d->targetyaw); + if(!plcollide(d, vec(0, 0, 0))) + { + d->yaw = oldyaw; + m.x = d->o.x - hitplayer->o.x; + m.y = d->o.y - hitplayer->o.y; + if(!m.iszero()) m.normalize(); + } + } + } + + if(m.iszero() && cl->allowmove(pl) && (pl->move || pl->strafe)) + { + vecfromyawpitch(pl->yaw, floating || water || pl->type==ENT_CAMERA ? pl->pitch : 0, pl->move, pl->strafe, m); + + if(!floating && pl->physstate >= PHYS_SLIDE) + { + /* move up or down slopes in air + * but only move up slopes in water + */ + float dz = -(m.x*pl->floor.x + m.y*pl->floor.y)/pl->floor.z; + if(water) m.z = max(m.z, dz); + else if(pl->floor.z >= WALLZ) m.z = dz; + } + + m.normalize(); + } + + vec d(m); + d.mul(pl->maxspeed); + if(floating) + { + if(pl==player) d.mul(floatspeed/100.0f); + } + //else if(!water && cl->allowmove(pl)) d.mul((pl->move && !pl->strafe ? 0.6f : 0.6f) * (pl->physstate < PHYS_SLOPE ? 1.3f : 1.0f)); // EXPERIMENTAL + // Segfault: Fix the first value, 0.6f = forward, second = strafe, speed values independant depending on player gun etc. + else if(!water && cl->allowmove(pl)) d.mul((pl->move && !pl->strafe ? 1.3f : 1.0f) * (pl->physstate < PHYS_SLOPE ? 1.3f : 1.0f)); // EXPERIMENTAL + float friction = water && !floating ? 20.0f : (pl->physstate >= PHYS_SLOPE || floating ? 6.0f : 30.0f); + float fpsfric = friction/curtime*20.0f; + + pl->vel.mul(fpsfric-1); + pl->vel.add(d); + pl->vel.div(fpsfric); +} + +void modifygravity(physent *pl, bool water, int curtime) +{ + float secs = curtime/1000.0f; + vec g(0, 0, 0); + if(pl->physstate == PHYS_FALL) g.z -= GRAVITY*secs; + else if(pl->floor.z > 0 && pl->floor.z < FLOORZ) + { + g.z = -1; + g.project(pl->floor); + g.normalize(); + g.mul(GRAVITY*secs); + } + if(!water || !cl->allowmove(pl) || (!pl->move && !pl->strafe)) pl->falling.add(g); + + if(water || pl->physstate >= PHYS_SLOPE) + { + float friction = water ? 2.0f : 6.0f, + fpsfric = friction/curtime*20.0f, + c = water ? 1.0f : clamp((pl->floor.z - SLOPEZ)/(FLOORZ-SLOPEZ), 0.0f, 1.0f); + pl->falling.mul(1 - c/fpsfric); + } +} + +// main physics routine, moves a player/monster for a curtime step +// moveres indicated the physics precision (which is lower for monsters and multiplayer prediction) +// local is false for multiplayer prediction + +bool moveplayer(physent *pl, int moveres, bool local, int curtime) +{ + int material = lookupmaterial(vec(pl->o.x, pl->o.y, pl->o.z + (3*pl->aboveeye - pl->eyeheight)/4)); + bool water = isliquid(material&MATF_VOLUME); + bool floating = pl->state==CS_EDITING || (pl->type!=ENT_CAMERA && pl->state==CS_SPECTATOR); + float secs = curtime/1000.f; + + // apply gravity + if(!floating && pl->type!=ENT_CAMERA) modifygravity(pl, water, curtime); + // apply any player generated changes in velocity + modifyvelocity(pl, local, water, floating, curtime); + + vec d(pl->vel), oldpos(pl->o); + + if(!floating && pl->type!=ENT_CAMERA && water) d.mul(0.5f); + + d.add(pl->falling); + d.mul(secs); + + pl->blocked = false; + pl->moving = true; + pl->onplayer = NULL; + + if(floating) // just apply velocity + { + if(pl->physstate != PHYS_FLOAT) + { + pl->physstate = PHYS_FLOAT; + pl->timeinair = 0; + pl->falling = vec(0, 0, 0); + } + pl->o.add(d); + } + else // apply velocity with collision + { + const float f = 1.0f/moveres; // Segfault: FIX: Adjust it so the player can adjust it to its own speed. + const int timeinair = pl->timeinair; + int collisions = 0; + + d.mul(f); + loopi(moveres) if(!move(pl, d)) { if(pl->type==ENT_CAMERA) return false; if(++collisions<5) i--; } // discrete steps collision detection & sliding + if(timeinair > 800 && !pl->timeinair && !water) // if we land after long time must have been a high jump, make thud sound + { + cl->physicstrigger(pl, local, -1, 0); + } + } + + if(pl->type!=ENT_CAMERA && pl->state==CS_ALIVE) updatedynentcache(pl); + + if(!pl->timeinair && pl->physstate >= PHYS_FLOOR && pl->vel.squaredlen() < 1e-4f) pl->moving = false; + + pl->lastmoveattempt = lastmillis; + if(pl->o!=oldpos) pl->lastmove = lastmillis; + + // automatically apply smooth roll when strafing + + if(pl->strafe==0) + { + pl->roll = pl->roll/(1+(float)sqrtf((float)curtime)/25); + } + else + { + pl->roll += pl->strafe*curtime/-30.0f; + if(pl->roll>maxroll) pl->roll = (float)maxroll; + if(pl->roll<-maxroll) pl->roll = (float)-maxroll; + } + + // play sounds on water transitions + + if(pl->type!=ENT_CAMERA) + { + if(pl->inwater && !water) + { + material = lookupmaterial(vec(pl->o.x, pl->o.y, pl->o.z + (pl->aboveeye - pl->eyeheight)/2)); + water = isliquid(material&MATF_VOLUME); + } + if(!pl->inwater && water) cl->physicstrigger(pl, local, 0, -1, material&MATF_VOLUME); + else if(pl->inwater && !water) cl->physicstrigger(pl, local, 0, 1, pl->inwater); + pl->inwater = water ? material&MATF_VOLUME : MAT_AIR; + + if(pl->state==CS_ALIVE && (pl->o.z < 0 || material&MAT_DEATH)) cl->suicide(pl); + } + + return true; +} + +#define PHYSFRAMETIME 5 + +int physsteps = 0, physframetime = PHYSFRAMETIME, lastphysframe = 0; + +void physicsframe() // optimally schedule physics frames inside the graphics frames +{ + int diff = lastmillis + curtime - lastphysframe; + if(diff <= 0) physsteps = 0; + else + { + extern int gamespeed; + physframetime = clamp((PHYSFRAMETIME*gamespeed)/100, 1, PHYSFRAMETIME); + physsteps = (diff + physframetime - 1)/physframetime; + lastphysframe += physsteps * physframetime; + } + cleardynentcache(); +} + +VAR(physinterp, 0, 1, 1); + +void interppos(physent *pl) +{ + pl->o = pl->newpos; + + int diff = lastphysframe - (lastmillis + curtime); + if(diff <= 0 || !physinterp) return; + + vec deltapos(pl->deltapos); + deltapos.mul(min(diff, physframetime)/float(physframetime)); + pl->o.add(deltapos); +} + +void moveplayer(physent *pl, int moveres, bool local) +{ + if(physsteps <= 0) + { + if(local) interppos(pl); + return; + } + + if(local) pl->o = pl->newpos; + loopi(physsteps-1) moveplayer(pl, moveres, local, physframetime); + if(local) pl->deltapos = pl->o; + moveplayer(pl, moveres, local, physframetime); + if(local) + { + pl->newpos = pl->o; + pl->deltapos.sub(pl->newpos); + interppos(pl); + } +} + +bool bounce(physent *d, float elasticity, float waterfric) +{ + if(physsteps <= 0) + { + interppos(d); + return false; + } + + d->o = d->newpos; + bool hitplayer = false; + loopi(physsteps-1) + { + if(bounce(d, physframetime/1000.0f, elasticity, waterfric)) hitplayer = true; + } + d->deltapos = d->o; + if(bounce(d, physframetime/1000.0f, elasticity, waterfric)) hitplayer = true; + d->newpos = d->o; + d->deltapos.sub(d->newpos); + interppos(d); + return hitplayer; +} + +void updatephysstate(physent *d) +{ + if(d->physstate == PHYS_FALL) return; + d->timeinair = 0; + vec old(d->o); + /* Attempt to reconstruct the floor state. + * May be inaccurate since movement collisions are not considered. + * If good floor is not found, just keep the old floor and hope it's correct enough. + */ + switch(d->physstate) + { + case PHYS_SLOPE: + case PHYS_FLOOR: + d->o.z -= 0.1f; + if(!collide(d, vec(0, 0, -1), d->physstate == PHYS_SLOPE ? SLOPEZ : FLOORZ)) + d->floor = wall; + else if(d->physstate == PHYS_SLOPE) + { + d->o.z -= d->radius; + if(!collide(d, vec(0, 0, -1), SLOPEZ)) + d->floor = wall; + } + break; + + case PHYS_STEP_UP: + d->o.z -= STAIRHEIGHT+0.1f; + if(!collide(d, vec(0, 0, -1), SLOPEZ)) + d->floor = wall; + break; + + case PHYS_SLIDE: + d->o.z -= d->radius+0.1f; + if(!collide(d, vec(0, 0, -1)) && wall.z < SLOPEZ) + d->floor = wall; + break; + } + if(d->physstate > PHYS_FALL && d->floor.z <= 0) d->floor = vec(0, 0, 1); + d->o = old; +} + +bool intersect(physent *d, vec &from, vec &to) // if lineseg hits entity bounding box +{ + vec v = to, w = d->o, *p; + v.sub(from); + w.sub(from); + float c1 = w.dot(v); + + if(c1<=0) p = &from; + else + { + float c2 = v.dot(v); + if(c2<=c1) p = &to; + else + { + float f = c1/c2; + v.mul(f); + v.add(from); + p = &v; + } + } + + return p->x <= d->o.x+d->radius + && p->x >= d->o.x-d->radius + && p->y <= d->o.y+d->radius + && p->y >= d->o.y-d->radius + && p->z <= d->o.z+d->aboveeye + && p->z >= d->o.z-d->eyeheight; +} + +const float PLATFORMMARGIN = 0.2f; +const float PLATFORMBORDER = 10.0f; + +struct platformcollision +{ + physent *d; + int next; + + platformcollision() {} + platformcollision(physent *d, int next) : d(d), next(next) {} +}; + +bool platformcollide(physent *d, physent *o, const vec &dir, float margin = 0) +{ + if(d->collidetype!=COLLIDE_ELLIPSE || o->collidetype!=COLLIDE_ELLIPSE) + { + if(rectcollide(d, dir, o->o, + o->collidetype==COLLIDE_ELLIPSE ? o->radius : o->xradius, + o->collidetype==COLLIDE_ELLIPSE ? o->radius : o->yradius, o->aboveeye, + o->eyeheight + margin)) + return true; + } + else if(ellipsecollide(d, dir, o->o, o->yaw, o->xradius, o->yradius, o->aboveeye, o->eyeheight + margin)) + return true; + return false; +} + +bool moveplatform(physent *p, const vec &dir) +{ + if(!insideworld(p->newpos)) return false; + + vec oldpos(p->o); + (p->o = p->newpos).add(dir); + if(!collide(p, dir, 0, dir.z<=0)) + { + p->o = oldpos; + return false; + } + p->o = oldpos; + + static vector candidates; + candidates.setsizenodelete(0); + for(int x = int(max(p->o.x-p->radius-PLATFORMBORDER, 0.0f))>>dynentsize, ex = int(min(p->o.x+p->radius+PLATFORMBORDER, hdr.worldsize-1.0f))>>dynentsize; x <= ex; x++) + for(int y = int(max(p->o.y-p->radius-PLATFORMBORDER, 0.0f))>>dynentsize, ey = int(min(p->o.y+p->radius+PLATFORMBORDER, hdr.worldsize-1.0f))>>dynentsize; y <= ey; y++) + { + const vector &dynents = checkdynentcache(x, y); + loopv(dynents) + { + physent *d = dynents[i]; + if(p==d || d->o.z-d->eyeheight < p->o.z+p->aboveeye || p->o.reject(d->o, p->radius+PLATFORMBORDER+d->radius) || candidates.find(d) >= 0) continue; + candidates.add(d); + d->stacks = d->collisions = -1; + } + } + static vector passengers, colliders; + passengers.setsizenodelete(0); + colliders.setsizenodelete(0); + static vector collisions; + collisions.setsizenodelete(0); + // build up collision DAG of colliders to be pushed off, and DAG of stacked passengers + loopv(candidates) + { + physent *d = candidates[i]; + // check if the dynent is on top of the platform + if(!platformcollide(p, d, vec(0, 0, 1), PLATFORMMARGIN)) passengers.add(d); + vec doldpos(d->o); + (d->o = d->newpos).add(dir); + if(!collide(d, dir, 0, false)) colliders.add(d); + d->o = doldpos; + loopvj(candidates) + { + physent *o = candidates[j]; + if(!platformcollide(d, o, dir)) + { + collisions.add(platformcollision(d, o->collisions)); + o->collisions = collisions.length() - 1; + } + if(d->o.z < o->o.z && !platformcollide(d, o, vec(0, 0, 1), PLATFORMMARGIN)) + { + collisions.add(platformcollision(o, d->stacks)); + d->stacks = collisions.length() - 1; + } + } + } + loopv(colliders) // propagate collisions + { + physent *d = colliders[i]; + for(int n = d->collisions; n>=0; n = collisions[n].next) + { + physent *o = collisions[n].d; + if(colliders.find(o)<0) colliders.add(o); + } + } + if(dir.z>0) + { + loopv(passengers) // if any stacked passengers collide, stop the platform + { + physent *d = passengers[i]; + if(colliders.find(d)>=0) return false; + for(int n = d->stacks; n>=0; n = collisions[n].next) + { + physent *o = collisions[n].d; + if(passengers.find(o)<0) passengers.add(o); + } + } + loopv(passengers) + { + physent *d = passengers[i]; + d->o.add(dir); + d->newpos.add(dir); + d->lastmove = lastmillis; + if(dir.x || dir.y) updatedynentcache(d); + } + } + else loopv(passengers) // move any stacked passengers who aren't colliding with non-passengers + { + physent *d = passengers[i]; + if(colliders.find(d)>=0) continue; + + d->o.add(dir); + d->newpos.add(dir); + d->lastmove = lastmillis; + if(dir.x || dir.y) updatedynentcache(d); + + for(int n = d->stacks; n>=0; n = collisions[n].next) + { + physent *o = collisions[n].d; + if(passengers.find(o)<0) passengers.add(o); + } + } + + p->o.add(dir); + p->newpos.add(dir); + p->lastmove = lastmillis; + if(dir.x || dir.y) updatedynentcache(p); + + return true; +} + +#define dir(name,v,d,s,os) ICOMMAND(name, "D", (int *down), { player->s = *down!=0; player->v = player->s ? d : (player->os ? -(d) : 0); }); + +dir(backward, move, -1, k_down, k_up); +dir(forward, move, 1, k_up, k_down); +dir(left, strafe, 1, k_left, k_right); +dir(right, strafe, -1, k_right, k_left); + +ICOMMAND(jump, "D", (int *down), { if(cl->canjump()) player->jumpnext = *down!=0; }); +ICOMMAND(attack, "D", (int *down), { cl->doattack(*down!=0); }); + +bool entinmap(dynent *d, bool avoidplayers) // brute force but effective way to find a free spawn spot in the map +{ + d->o.z += d->eyeheight; // pos specified is at feet + vec orig = d->o; + loopi(100) // try max 100 times + { + if(i) + { + d->o = orig; + d->o.x += (rnd(21)-10)*i/5; // increasing distance + d->o.y += (rnd(21)-10)*i/5; + d->o.z += (rnd(21)-10)*i/5; + } + + if(collide(d) && !inside) + { + if(hitplayer) + { + if(!avoidplayers) continue; + d->o = orig; + d->resetinterp(); + return false; + } + + d->resetinterp(); + return true; + } + } + // leave ent at original pos, possibly stuck + d->o = orig; + d->resetinterp(); + conoutf(CON_WARN, "can't find entity spawn spot! (%.1f, %.1f, %.1f)", d->o.x, d->o.y, d->o.z); + return false; +} + diff --git a/src/engine/pvs.cpp b/src/engine/pvs.cpp new file mode 100644 index 0000000..1ed80f6 --- /dev/null +++ b/src/engine/pvs.cpp @@ -0,0 +1,1313 @@ +#include "pch.h" +#include "engine.h" +#include "SDL_thread.h" + +enum +{ + PVS_HIDE_GEOM = 1<<0, + PVS_HIDE_BB = 1<<1 +}; + +struct pvsnode +{ + bvec edges; + uchar flags; + uint children; +}; + +static vector origpvsnodes; + +static bool mergepvsnodes(pvsnode &p, pvsnode *children) +{ + loopi(7) if(children[i].flags!=children[7].flags) return false; + bvec bbs[4]; + loop(x, 2) loop(y, 2) + { + const bvec &lo = children[octaindex(2, x, y, 0)].edges, + &hi = children[octaindex(2, x, y, 1)].edges; + if(lo.x!=0xFF && (lo.x&0x11 || lo.y&0x11 || lo.z&0x11)) return false; + if(hi.x!=0xFF && (hi.x&0x11 || hi.y&0x11 || hi.z&0x11)) return false; + +#define MERGEBBS(res, coord, row, col) \ + if(lo.coord==0xFF) \ + { \ + if(hi.coord!=0xFF) \ + { \ + res.coord = ((hi.coord&~0x11)>>1) + 0x44; \ + res.row = hi.row; \ + res.col = hi.col; \ + } \ + } \ + else if(hi.coord==0xFF) \ + { \ + res.coord = (lo.coord&0xEE)>>1; \ + res.row = lo.row; \ + res.col = lo.col; \ + } \ + else if(lo.row!=hi.row || lo.col!=hi.col || (lo.coord&0xF0)!=0x80 || (hi.coord&0xF)!=0) return false; \ + else \ + { \ + res.coord = ((lo.coord&~0xF1)>>1) | (((hi.coord&~0x1F)>>1) + 0x40); \ + res.row = lo.row; \ + res.col = lo.col; \ + } + + bvec &res = bbs[x + 2*y]; + MERGEBBS(res, z, x, y); + res.x = lo.x; + res.y = lo.y; + } + loop(x, 2) + { + bvec &lo = bbs[x], &hi = bbs[x+2]; + MERGEBBS(lo, y, x, z); + } + bvec &lo = bbs[0], &hi = bbs[1]; + MERGEBBS(p.edges, x, y, z); + + return true; +} + +static void genpvsnodes(cube *c, int parent = 0, const ivec &co = ivec(0, 0, 0), int size = hdr.worldsize/2) +{ + int index = origpvsnodes.length(); + loopi(8) + { + ivec o(i, co.x, co.y, co.z, size); + pvsnode &n = origpvsnodes.add(); + n.flags = 0; + n.children = 0; + if(c[i].children || isempty(c[i])) memset(n.edges.v, 0xFF, 3); + else loopk(3) + { + uint face = c[i].faces[k]; + if(face==F_SOLID) n.edges[k] = 0x80; + else + { + uchar low = max(max(face&0xF, (face>>8)&0xF), max((face>>16)&0xF, (face>>24)&0xF)), + high = min(min((face>>4)&0xF, (face>>12)&0xF), min((face>>20)&0xF, (face>>28)&0xF)); + if(size<8) + { + if(low&((8/size)-1)) { low += 8/size - (low&((8/size)-1)); } + if(high&((8/size)-1)) high &= ~(8/size-1); + } + if(low >= high) { memset(n.edges.v, 0xFF, 3); break; } + n.edges[k] = low | (high<<4); + } + } + } + int branches = 0; + loopi(8) if(c[i].children) + { + ivec o(i, co.x, co.y, co.z, size); + genpvsnodes(c[i].children, index+i, o, size>>1); + if(origpvsnodes[index+i].children) branches++; + } + if(!branches && mergepvsnodes(origpvsnodes[parent], &origpvsnodes[index])) origpvsnodes.setsizenodelete(index); + else origpvsnodes[parent].children = index; +} + +struct shaftplane +{ + float r, c, offset; + uchar rnear, cnear, rfar, cfar; +}; + +struct usvec +{ + union + { + struct { ushort x, y, z; }; + ushort v[3]; + }; + + ushort &operator[](int i) { return v[i]; } + ushort operator[](int i) const { return v[i]; } +}; + +struct shaftbb +{ + union + { + ushort v[6]; + struct { usvec min, max; }; + }; + + shaftbb() {} + shaftbb(const ivec &o, int size) + { + min.x = o.x; + min.y = o.y; + min.z = o.z; + max.x = o.x + size; + max.y = o.y + size; + max.z = o.z + size; + } + shaftbb(const ivec &o, int size, const bvec &edges) + { + min.x = o.x + (size*(edges.x&0xF))/8; + min.y = o.y + (size*(edges.y&0xF))/8; + min.z = o.z + (size*(edges.z&0xF))/8; + max.x = o.x + (size*(edges.x>>4))/8; + max.y = o.y + (size*(edges.y>>4))/8; + max.z = o.z + (size*(edges.z>>4))/8; + } + + ushort &operator[](int i) { return v[i]; } + ushort operator[](int i) const { return v[i]; } + + bool contains(const shaftbb &o) const + { + return min.x<=o.min.x && min.y<=o.min.y && min.z<=o.min.z && + max.x>=o.max.x && max.y>=o.max.y && max.z>=o.max.z; + } + + bool outside(const ivec &o, int size) const + { + return o.x>=max.x || o.y>=max.y || o.z>=max.z || + o.x+size<=min.x || o.y+size<=min.y || o.z+size<=min.z; + } + + bool outside(const shaftbb &o) const + { + return o.min.x>max.x || o.min.y>max.y || o.min.z>max.z || + o.max.xmax.x || o.max.y>max.y || o.max.z>max.z; + } +}; + +struct shaft +{ + shaftbb bounds; + shaftplane planes[8]; + int numplanes; + + shaft(const shaftbb &from, const shaftbb &to) + { + calcshaft(from, to); + } + + void calcshaft(const shaftbb &from, const shaftbb &to) + { + uchar match = 0, color = 0; + loopi(3) + { + if(to.min[i] < from.min[i]) { color |= 1< from.min[i]) bounds.min[i] = to.min[i]+1; + else { match |= 1< from.max[i]) { color |= 8<>i)^(color>>j))&1) + { + int r = i%3, c = j%3, d = (r+1)%3; + if(d==c) d = (c+1)%3; + shaftplane &p = planes[numplanes++]; + p.r = from[j] - to[j]; + if(i<3 ? p.r >= 0 : p.r < 0) + { + p.r = -p.r; + p.c = from[i] - to[i]; + } + else p.c = to[i] - from[i]; + p.offset = -(from[i]*p.r + from[j]*p.c); + p.rnear = p.r >= 0 ? r : 3+r; + p.cnear = p.c >= 0 ? c : 3+c; + p.rfar = p.r < 0 ? r : 3+r; + p.cfar = p.c < 0 ? c : 3+c; + } + } + + bool outside(const shaftbb &o) const + { + if(bounds.outside(o)) return true; + + for(const shaftplane *p = planes; p < &planes[numplanes]; p++) + { + if(o[p->rnear]*p->r + o[p->cnear]*p->c + p->offset > 0) return true; + } + return false; + } + + bool inside(const shaftbb &o) const + { + if(bounds.notinside(o)) return false; + + for(const shaftplane *p = planes; p < &planes[numplanes]; p++) + { + if(o[p->rfar]*p->r + o[p->cfar]*p->c + p->offset > 0) return false; + } + return true; + } +}; + +struct pvsdata +{ + int offset, len; + + pvsdata() {} + pvsdata(int offset, int len) : offset(offset), len(len) {} +}; + +static vector pvsbuf; + +static inline uint hthash(const pvsdata &k) +{ + uint h = 5381; + loopi(k.len) h = ((h<<5)+h)^pvsbuf[k.offset+i]; + return h; +} + +static inline bool htcmp(const pvsdata &x, const pvsdata &y) +{ + return x.len==y.len && !memcmp(&pvsbuf[x.offset], &pvsbuf[y.offset], x.len); +} + +static SDL_mutex *pvsmutex = NULL; +static hashtable pvscompress; +static vector pvs; + +static SDL_mutex *viewcellmutex = NULL; +struct viewcellrequest +{ + int *result; + ivec o; + int size; +}; +static vector viewcellrequests; + +static bool genpvs_canceled = false; +static int numviewcells = 0; + +VAR(maxpvsblocker, 1, 512, 1<<16); +VAR(pvsleafsize, 1, 64, 1024); + +#define MAXWATERPVS 32 + +static struct +{ + int height; + vector matsurfs; +} waterplanes[MAXWATERPVS]; +static vector waterfalls; +uint numwaterplanes = 0; + +struct pvsworker +{ + pvsworker() : thread(NULL), pvsnodes(new pvsnode[origpvsnodes.length()]) + { + } + ~pvsworker() + { + delete[] pvsnodes; + } + + SDL_Thread *thread; + pvsnode *pvsnodes; + + shaftbb viewcellbb; + + pvsnode *levels[32]; + int curlevel; + ivec origin; + + void resetlevels() + { + curlevel = worldscale; + levels[curlevel] = &pvsnodes[0]; + origin = ivec(0, 0, 0); + } + + int hasvoxel(const ivec &p, int coord, int dir, int ocoord = 0, int odir = 0, int *omin = NULL) + { + uint diff = (origin.x^p.x)|(origin.y^p.y)|(origin.z^p.z); + if(diff >= uint(hdr.worldsize)) return 0; + diff >>= curlevel; + while(diff) + { + curlevel++; + diff >>= 1; + } + + pvsnode *cur = levels[curlevel]; + while(cur->children && !(cur->flags&PVS_HIDE_BB)) + { + cur = &pvsnodes[cur->children]; + curlevel--; + cur += ((p.z>>(curlevel-2))&4) | ((p.y>>(curlevel-1))&2) | ((p.x>>curlevel)&1); + levels[curlevel] = cur; + } + + origin = ivec(p.x&(~0<flags&PVS_HIDE_BB || cur->edges==bvec(0x80, 0x80, 0x80)) + { + if(omin) + { + int step = origin[ocoord] + (odir< *omin) *omin = step; + } + return origin[coord] + (dir<edges.x==0xFF) return 0; + ivec bbp(p); + bbp.sub(origin); + ivec bbmin, bbmax; + bbmin.x = ((cur->edges.x&0xF)<edges.x>>4)<= bbmax.x) return 0; + bbmin.y = ((cur->edges.y&0xF)<edges.y>>4)<= bbmax.y) return 0; + bbmin.z = ((cur->edges.z&0xF)<edges.z>>4)<= bbmax.z) return 0; + + if(omin) + { + int step = (odir ? bbmax[ocoord] : bbmin[ocoord]) - bbp[ocoord] + (odir - 1); + if(odir ? step < *omin : step > *omin) *omin = step; + } + return (dir ? bbmax[coord] : bbmin[coord]) - bbp[coord] + (dir - 1); + } + + void hidepvs(pvsnode &p) + { + if(p.children) + { + pvsnode *children = &pvsnodes[p.children]; + loopi(8) hidepvs(children[i]); + p.flags |= PVS_HIDE_BB; + return; + } + p.flags |= PVS_HIDE_BB; + if(p.edges.x!=0xFF) p.flags |= PVS_HIDE_GEOM; + } + + void shaftcullpvs(shaft &s, pvsnode &p, const ivec &co = ivec(0, 0, 0), int size = hdr.worldsize) + { + if(p.flags&PVS_HIDE_BB) return; + shaftbb bb(co, size); + if(s.outside(bb)) return; + if(s.inside(bb)) { hidepvs(p); return; } + if(p.children) + { + pvsnode *children = &pvsnodes[p.children]; + uchar flags = 0xFF; + loopi(8) + { + ivec o(i, co.x, co.y, co.z, size>>1); + shaftcullpvs(s, children[i], o, size>>1); + flags &= children[i].flags; + } + if(flags & PVS_HIDE_BB) p.flags |= PVS_HIDE_BB; + return; + } + if(p.edges.x==0xFF) return; + shaftbb geom(co, size, p.edges); + if(s.inside(geom)) p.flags |= PVS_HIDE_GEOM; + } + + ringbuf prevblockers; + + void cullpvs(pvsnode &p, const ivec &co = ivec(0, 0, 0), int size = hdr.worldsize) + { + if(p.flags&(PVS_HIDE_BB | PVS_HIDE_GEOM) || genpvs_canceled) return; + if(p.children && !(p.flags&PVS_HIDE_BB)) + { + pvsnode *children = &pvsnodes[p.children]; + loopi(8) + { + ivec o(i, co.x, co.y, co.z, size>>1); + cullpvs(children[i], o, size>>1); + } + if(!(p.flags & PVS_HIDE_BB)) return; + } + bvec edges = p.children ? bvec(0x80, 0x80, 0x80) : p.edges; + if(edges.x==0xFF) return; + shaftbb geom(co, size, edges); + loopi(6) + { + int dim = dimension(i), dc = dimcoord(i), r = R[dim], c = C[dim]; + int ccenter = geom.min[c]; + if(geom.min[r]==geom.max[r] || geom.min[c]==geom.max[c]) continue; + while(ccenter < geom.max[c]) + { + ivec rmin; + rmin[dim] = geom[dim + 3*dc] + (dc ? -1 : 0); + rmin[r] = geom.min[r]; + rmin[c] = ccenter; + ivec rmax = rmin; + rmax[r] = geom.max[r] - 1; + int rcenter = (rmin[r] + rmax[r])/2; + resetlevels(); + for(int minstep = -1, maxstep = 1; (minstep || maxstep) && rmax[r] - rmin[r] < maxpvsblocker;) + { + if(minstep) minstep = hasvoxel(rmin, r, 0); + if(maxstep) maxstep = hasvoxel(rmax, r, 1); + rmin[r] += minstep; + rmax[r] += maxstep; + } + rmin[r] = rcenter + (rmin[r] - rcenter)/2; + rmax[r] = rcenter + (rmax[r] - rcenter)/2; + if(rmin[r]>=geom.min[r] && rmax[r]=geom.min[r] && rmax[r]=geom.min[c] && cmax[c]geom.min[r]) emin[r] = geom.min[r]; + if(emax[r]= viewcellbb.max[dim] || bb.max[dim] <= viewcellbb.min[dim]) + { + int ddir = bb.min[dim] >= viewcellbb.max[dim] ? 1 : -1, + dval = ddir>0 ? USHRT_MAX-1 : 0, + dlimit = maxpvsblocker, + numsides = 0; + loopj(4) + { + ivec dmax; + int odim = j < 2 ? c : r; + if(j&1) + { + if(bb.max[odim] >= viewcellbb.max[odim]) continue; + dmax[odim] = bb.max[odim]-1; + } + else + { + if(bb.min[odim] <= viewcellbb.min[odim]) continue; + dmax[odim] = bb.min[odim]; + } + numsides++; + dmax[dim] = bb.min[dim]; + int stepdim = j < 2 ? r : c, stepstart = bb.min[stepdim], stepend = bb.max[stepdim]; + int dstep = ddir; + for(; dstep && ddir*(dmax[dim] - (int)bb.min[dim]) < dlimit;) + { + dmax[dim] += dstep; dstep = ddir > 0 ? INT_MAX : INT_MIN; + dmax[stepdim] = stepstart; + resetlevels(); + for(int step = 1; step && dmax[stepdim] < stepend;) + { + step = hasvoxel(dmax, stepdim, 1, dim, (ddir+1)/2, &dstep); + dmax[stepdim] += step; + } + if(dmax[stepdim] < stepend) dstep = 0; + } + dlimit = min(dlimit, ddir*(dmax[dim] - (int)bb.min[dim])); + if(!dstep) dmax[dim] -= ddir; + if(ddir>0) dval = min(dval, dmax[dim]); + else dval = max(dval, dmax[dim]); + } + if(numsides>0) + { + if(ddir>0) bb.max[dim] = dval+1; + else bb.min[dim] = dval; + } + //printf("(%d,%d,%d) x %d,%d,%d, side %d, ccenter = %d, origin = (%d,%d,%d), size = %d\n", bb.min.x, bb.min.y, bb.min.z, bb.max.x-bb.min.x, bb.max.y-bb.min.y, bb.max.z-bb.min.z, i, ccenter, co.x, co.y, co.z, size); + } + bool dup = false; + loopvj(prevblockers) + { + if(prevblockers[j].contains(bb)) { dup = true; break; } + } + if(!dup) + { + shaft s(viewcellbb, bb); + shaftcullpvs(s, pvsnodes[0]); + prevblockers.add(bb); + } + if(bb.contains(geom)) return; + ccenter = cmax[c] + 1; + } + } + } + + bool compresspvs(pvsnode &p, int size, int threshold) + { + if(!p.children) return true; + if(p.flags&PVS_HIDE_BB) { p.children = 0; return true; } + pvsnode *children = &pvsnodes[p.children]; + bool canreduce = true; + loopi(8) + { + if(!compresspvs(children[i], size/2, threshold)) canreduce = false; + } + if(canreduce) + { + int hide = children[7].flags&PVS_HIDE_BB; + loopi(7) if((children[i].flags&PVS_HIDE_BB)!=hide) canreduce = false; + if(canreduce) + { + p.flags = (p.flags & ~PVS_HIDE_BB) | hide; + p.children = 0; + return true; + } + } + if(size <= threshold) + { + p.children = 0; + return true; + } + return false; + } + + vector outbuf; + + bool serializepvs(pvsnode &p, int storage = -1) + { + if(!p.children) + { + outbuf.add(0xFF); + loopi(8) outbuf.add(p.flags&PVS_HIDE_BB ? 0xFF : 0); + return true; + } + int index = outbuf.length(); + pvsnode *children = &pvsnodes[p.children]; + int i = 0; + uchar leafvalues = 0; + if(storage>=0) + { + for(; i < 8; i++) + { + pvsnode &child = children[i]; + if(child.flags&PVS_HIDE_BB) leafvalues |= 1<255) { outbuf[storage] = 0; return false; } + outbuf[storage] = uchar(offset); + } + outbuf.add(0); + loopj(8) outbuf.add(leafvalues&(1< &matsurfs) + { + if(pvsnodes[0].flags & PVS_HIDE_BB) return true; + if(!pvsnodes[0].children) return false; + loopv(matsurfs) + { + materialsurface &m = *matsurfs[i]; + ivec bborigin(m.o), bbsize(0, 0, 0); + int dim = dimension(m.orient); + bbsize[C[dim]] = m.csize; + bbsize[R[dim]] = m.rsize; + bborigin[dim] -= 2; + bbsize[dim] = 2; + if(!materialoccluded(pvsnodes[0], vec(0, 0, 0), hdr.worldsize/2, bborigin, bbsize)) return false; + } + return true; + } + + int wateroccluded, waterbytes; + + void calcpvs(const ivec &co, int size) + { + loopk(3) + { + viewcellbb.min[k] = co[k]; + viewcellbb.max[k] = co[k]+size; + } + memcpy(pvsnodes, origpvsnodes.getbuf(), origpvsnodes.length()*sizeof(pvsnode)); + prevblockers.clear(); + cullpvs(pvsnodes[0]); + + wateroccluded = 0; + loopi(numwaterplanes) + { + if(waterplanes[i].height < 0) + { + if(waterfalls.length() && materialoccluded(waterfalls)) wateroccluded |= 1<>(i*8))&0xFF); + pvsbuf.put(outbuf.getbuf(), outbuf.length()); + int *val = pvscompress.access(key); + if(val) pvsbuf.setsizenodelete(key.offset); + else + { + val = &pvscompress[key]; + *val = pvs.length(); + pvs.add(key); + } + if(pvsmutex) SDL_UnlockMutex(pvsmutex); + return *val; + } + + static int run(void *data) + { + pvsworker *w = (pvsworker *)data; + SDL_LockMutex(viewcellmutex); + while(viewcellrequests.length()) + { + viewcellrequest req = viewcellrequests.pop(); + SDL_UnlockMutex(viewcellmutex); + int result = w->genviewcell(req.o, req.size); + SDL_LockMutex(viewcellmutex); + *req.result = result; + } + SDL_UnlockMutex(viewcellmutex); + return 0; + } +}; + +struct viewcellnode +{ + uchar leafmask; + union viewcellchild + { + int pvs; + viewcellnode *node; + } children[8]; + + viewcellnode() : leafmask(0xFF) + { + loopi(8) children[i].pvs = -1; + } + ~viewcellnode() + { + loopi(8) if(!(leafmask&(1< pvsworkers; + +static volatile bool check_genpvs_progress = false; + +static Uint32 genpvs_timer(Uint32 interval, void *param) +{ + check_genpvs_progress = true; + return interval; +} + +static int totalviewcells = 0; + +static void show_genpvs_progress(int unique = pvs.length(), int processed = numviewcells) +{ + float bar1 = float(processed) / float(totalviewcells>0 ? totalviewcells : 1), + bar2 = float(unique) / float(totalviewcells>0 ? totalviewcells : 1); + + s_sprintfd(text1)("%d%% - %d of %d view cells", int(bar1 * 100), processed, totalviewcells); + s_sprintfd(text2)("%d unique view cells", unique); + + show_out_of_renderloop_progress(bar1, text1, bar2, text2); + + if(interceptkey(SDLK_ESCAPE)) genpvs_canceled = true; + check_genpvs_progress = false; +} + +static shaftbb pvsbounds; + +static void calcpvsbounds() +{ + loopk(3) pvsbounds.min[k] = USHRT_MAX; + loopk(3) pvsbounds.max[k] = 0; + extern vector valist; + loopv(valist) + { + vtxarray *va = valist[i]; + loopk(3) + { + if(va->geommin[k]>va->geommax[k]) continue; + pvsbounds.min[k] = min(pvsbounds.min[k], (ushort)va->geommin[k]); + pvsbounds.max[k] = max(pvsbounds.max[k], (ushort)va->geommax[k]); + } + } +} + +static inline bool isallclip(cube *c) +{ + loopi(8) + { + cube &h = c[i]; + if(h.children ? !isallclip(h.children) : (!isentirelysolid(h) && (!h.ext || (h.ext->material&MATF_CLIP)!=MAT_CLIP))) + return false; + } + return true; +} + +static int countviewcells(cube *c, const ivec &co, int size, int threshold) +{ + int count = 0; + loopi(8) + { + ivec o(i, co.x, co.y, co.z, size); + if(pvsbounds.outside(o, size)) continue; + cube &h = c[i]; + if(h.children) + { + if(size>threshold) + { + count += countviewcells(h.children, o, size>>1, threshold); + continue; + } + if(isallclip(h.children)) continue; + } + else if(isentirelysolid(h) || (h.ext && (h.ext->material&MATF_CLIP)==MAT_CLIP)) continue; + count++; + } + return count; +} + +static void genviewcells(viewcellnode &p, cube *c, const ivec &co, int size, int threshold) +{ + if(genpvs_canceled) return; + loopi(8) + { + ivec o(i, co.x, co.y, co.z, size); + if(pvsbounds.outside(o, size)) continue; + cube &h = c[i]; + if(h.children) + { + if(size>threshold) + { + p.leafmask &= ~(1<>1, threshold); + continue; + } + if(isallclip(h.children)) continue; + } + else if(isentirelysolid(h) || (h.ext && (h.ext->material&MATF_CLIP)==MAT_CLIP)) continue; + if(pvsthreads<=1) + { + if(genpvs_canceled) return; + p.children[i].pvs = pvsworkers[0]->genviewcell(o, size); + if(check_genpvs_progress) show_genpvs_progress(); + } + else + { + viewcellrequest &req = viewcellrequests.add(); + req.result = &p.children[i].pvs; + req.o = o; + req.size = size; + } + } +} + +static viewcellnode *viewcells = NULL; +static int lockedwaterplanes[MAXWATERPVS]; +static uchar *curpvs = NULL, *lockedpvs = NULL; +static int curwaterpvs = 0, lockedwaterpvs = 0; + +static inline pvsdata *lookupviewcell(const vec &p) +{ + uint x = uint(floor(p.x)), y = uint(floor(p.y)), z = uint(floor(p.z)); + if(!viewcells || (x|y|z)>=uint(hdr.worldsize)) return NULL; + viewcellnode *vc = viewcells; + for(int scale = worldscale-1; scale>=0; scale--) + { + int i = octastep(x, y, z, scale); + if(vc->leafmask&(1<children[i].pvs>=0 ? &pvs[vc->children[i].pvs] : NULL; + } + vc = vc->children[i].node; + } + return NULL; +} + +static void lockpvs_(bool lock) +{ + if(lockedpvs) DELETEA(lockedpvs); + if(!lock) return; + pvsdata *d = lookupviewcell(camera1->o); + if(!d) return; + int wbytes = d->len%9, len = d->len - wbytes; + lockedpvs = new uchar[len]; + memcpy(lockedpvs, &pvsbuf[d->offset + wbytes], len); + lockedwaterpvs = 0; + loopi(wbytes) lockedwaterpvs |= pvsbuf[d->offset + i] << (i*8); + loopi(MAXWATERPVS) lockedwaterplanes[i] = waterplanes[i].height; + conoutf("locked view cell at %.1f, %.1f, %.1f", camera1->o.x, camera1->o.y, camera1->o.z); +} + +VARF(lockpvs, 0, 0, 1, lockpvs_(lockpvs!=0)); + +VARN(pvs, usepvs, 0, 1, 1); +VARN(waterpvs, usewaterpvs, 0, 1, 1); + +void setviewcell(const vec &p) +{ + if(!usepvs) curpvs = NULL; + else if(lockedpvs) + { + curpvs = lockedpvs; + curwaterpvs = lockedwaterpvs; + } + else + { + pvsdata *d = lookupviewcell(p); + curpvs = d ? &pvsbuf[d->offset] : NULL; + curwaterpvs = 0; + if(d) + { + loopi(d->len%9) curwaterpvs |= *curpvs++ << (i*8); + } + } + if(!usepvs || !usewaterpvs) curwaterpvs = 0; +} + +void clearpvs() +{ + DELETEP(viewcells); + pvs.setsizenodelete(0); + pvsbuf.setsizenodelete(0); + curpvs = NULL; + numwaterplanes = 0; + lockpvs = 0; + lockpvs_(false); +} + +COMMAND(clearpvs, ""); + +static void findwaterplanes() +{ + extern vector valist; + loopi(MAXWATERPVS) + { + waterplanes[i].height = -1; + waterplanes[i].matsurfs.setsizenodelete(0); + } + waterfalls.setsizenodelete(0); + numwaterplanes = 0; + loopv(valist) + { + vtxarray *va = valist[i]; + loopj(va->matsurfs) + { + materialsurface &m = va->matbuf[j]; + if(m.material!=MAT_WATER || m.orient==O_BOTTOM) continue; + if(m.orient!=O_TOP) + { + waterfalls.add(&m); + continue; + } + loopk(numwaterplanes) if(waterplanes[k].height == m.o.z) + { + waterplanes[k].matsurfs.add(&m); + goto nextmatsurf; + } + if(numwaterplanes < MAXWATERPVS) + { + waterplanes[numwaterplanes].height = m.o.z; + waterplanes[numwaterplanes].matsurfs.add(&m); + numwaterplanes++; + } + nextmatsurf:; + } + } + if(waterfalls.length() > 0 && numwaterplanes < MAXWATERPVS) numwaterplanes++; +} + +void testpvs(int *vcsize) +{ + lockpvs_(false); + + uint oldnumwaterplanes = numwaterplanes; + int oldwaterplanes[MAXWATERPVS]; + loopi(numwaterplanes) oldwaterplanes[i] = waterplanes[i].height; + + findwaterplanes(); + + pvsnode &root = origpvsnodes.add(); + memset(root.edges.v, 0xFF, 3); + root.flags = 0; + root.children = 0; + genpvsnodes(worldroot); + + genpvs_canceled = false; + check_genpvs_progress = false; + + int size = *vcsize>0 ? *vcsize : 32; + for(int mask = 1; mask < size; mask <<= 1) size &= ~mask; + + ivec o = camera1->o; + o.mask(~(size-1)); + pvsworker w; + int len; + lockedpvs = w.testviewcell(o, size, &lockedwaterpvs, &len); + loopi(MAXWATERPVS) lockedwaterplanes[i] = waterplanes[i].height; + lockpvs = 1; + conoutf("generated test view cell of size %d at %.1f, %.1f, %.1f (%d B)", size, camera1->o.x, camera1->o.y, camera1->o.z, len); + + origpvsnodes.setsizenodelete(0); + numwaterplanes = oldnumwaterplanes; + loopi(numwaterplanes) waterplanes[i].height = oldwaterplanes[i]; +} + +COMMAND(testpvs, "i"); + +void genpvs(int *viewcellsize) +{ + if(hdr.worldsize > 1<<15) + { + conoutf(CON_ERROR, "map is too large for PVS"); + return; + } + + computescreen("generating PVS (esc to abort)"); + genpvs_canceled = false; + Uint32 start = SDL_GetTicks(); + + show_out_of_renderloop_progress(0, "finding view cells"); + + clearpvs(); + calcpvsbounds(); + findwaterplanes(); + + pvsnode &root = origpvsnodes.add(); + memset(root.edges.v, 0xFF, 3); + root.flags = 0; + root.children = 0; + genpvsnodes(worldroot); + + totalviewcells = countviewcells(worldroot, ivec(0, 0, 0), hdr.worldsize>>1, *viewcellsize>0 ? *viewcellsize : 32); + numviewcells = 0; + genpvs_canceled = false; + check_genpvs_progress = false; + SDL_TimerID timer = NULL; + if(pvsthreads<=1) + { + pvsworkers.add(new pvsworker); + timer = SDL_AddTimer(500, genpvs_timer, NULL); + } + viewcells = new viewcellnode; + genviewcells(*viewcells, worldroot, ivec(0, 0, 0), hdr.worldsize>>1, *viewcellsize>0 ? *viewcellsize : 32); + if(pvsthreads<=1) + { + SDL_RemoveTimer(timer); + } + else + { + show_out_of_renderloop_progress(0, "creating threads"); + if(!pvsmutex) pvsmutex = SDL_CreateMutex(); + if(!viewcellmutex) viewcellmutex = SDL_CreateMutex(); + loopi(pvsthreads) + { + pvsworker *w = pvsworkers.add(new pvsworker); + w->thread = SDL_CreateThread(pvsworker::run, w); + } + show_genpvs_progress(0, 0); + while(!genpvs_canceled) + { + SDL_Delay(500); + SDL_LockMutex(viewcellmutex); + int unique = pvs.length(), processed = numviewcells, remaining = viewcellrequests.length(); + SDL_UnlockMutex(viewcellmutex); + show_genpvs_progress(unique, processed); + if(!remaining) break; + } + SDL_LockMutex(viewcellmutex); + viewcellrequests.setsizenodelete(0); + SDL_UnlockMutex(viewcellmutex); + loopv(pvsworkers) SDL_WaitThread(pvsworkers[i]->thread, NULL); + } + pvsworkers.deletecontentsp(); + + origpvsnodes.setsizenodelete(0); + pvscompress.clear(); + + Uint32 end = SDL_GetTicks(); + if(genpvs_canceled) + { + clearpvs(); + conoutf("genpvs aborted"); + } + else conoutf("generated %d unique view cells totaling %.1f kB and averaging %d B (%.1f seconds)", + pvs.length(), pvsbuf.length()/1024.0f, pvsbuf.length()/max(pvs.length(), 1), (end - start) / 1000.0f); +} + +COMMAND(genpvs, "i"); + +void pvsstats() +{ + conoutf("%d unique view cells totaling %.1f kB and averaging %d B", + pvs.length(), pvsbuf.length()/1024.0f, pvsbuf.length()/max(pvs.length(), 1)); +} + +COMMAND(pvsstats, ""); + +static inline bool pvsoccluded(uchar *buf, const ivec &co, int size, const ivec &bborigin, const ivec &bbsize) +{ + uchar leafmask = buf[0]; + loopoctabox(co, size, bborigin, bbsize) + { + ivec o(i, co.x, co.y, co.z, size); + if(leafmask&(1<>1, bborigin, bbsize)&~leafvalues)) + return false; + } + else if(!pvsoccluded(buf+9*buf[1+i], o, size>>1, bborigin, bbsize)) return false; + } + return true; +} + +static inline bool pvsoccluded(uchar *buf, const ivec &bborigin, const ivec &bbsize) +{ + int diff = (bborigin.x^(bborigin.x+bbsize.x)) | (bborigin.y^(bborigin.y+bbsize.y)) | (bborigin.z^(bborigin.z+bbsize.z)); + if(diff&~((1<0 ? 0x80000000U : 0); + endianswap(&totallen, sizeof(uint), 1); + gzwrite(f, &totallen, sizeof(uint)); + if(numwaterplanes>0) + { + uint numwp = numwaterplanes; + endianswap(&numwp, sizeof(uint), 1); + gzwrite(f, &numwp, sizeof(uint)); + loopi(numwaterplanes) + { + int height = waterplanes[i].height; + endianswap(&height, sizeof(int), 1); + gzwrite(f, &height, sizeof(int)); + if(waterplanes[i].height < 0) break; + } + } + loopv(pvs) + { + ushort len = pvs[i].len; + endianswap(&len, sizeof(ushort), 1); + gzwrite(f, &len, sizeof(ushort)); + } + gzwrite(f, pvsbuf.getbuf(), pvsbuf.length()); + saveviewcells(f, *viewcells); +} + +viewcellnode *loadviewcells(gzFile f) +{ + viewcellnode *p = new viewcellnode; + p->leafmask = gzgetc(f); + loopi(8) + { + if(p->leafmask&(1<children[i].pvs, sizeof(int)); + endianswap(&p->children[i].pvs, sizeof(int), 1); + } + else p->children[i].node = loadviewcells(f); + } + return p; +} + +void loadpvs(gzFile f) +{ + uint totallen = pvsbuf.length(); + gzread(f, &totallen, sizeof(uint)); + endianswap(&totallen, sizeof(uint), 1); + if(totallen & 0x80000000U) + { + totallen &= ~0x80000000U; + gzread(f, &numwaterplanes, sizeof(uint)); + endianswap(&numwaterplanes, sizeof(uint), 1); + loopi(numwaterplanes) + { + gzread(f, &waterplanes[i].height, sizeof(int)); + endianswap(&waterplanes[i].height, sizeof(int), 1); + } + } + int offset = 0; + loopi(hdr.numpvs) + { + ushort len; + gzread(f, &len, sizeof(ushort)); + endianswap(&len, sizeof(ushort), 1); + pvs.add(pvsdata(offset, len)); + offset += len; + } + gzread(f, pvsbuf.reserve(totallen).buf, totallen); + pvsbuf.advance(totallen); + viewcells = loadviewcells(f); +} + +int getnumviewcells() { return pvs.length(); } + diff --git a/src/engine/rendergl.cpp b/src/engine/rendergl.cpp new file mode 100644 index 0000000..2159188 --- /dev/null +++ b/src/engine/rendergl.cpp @@ -0,0 +1,1559 @@ +// rendergl.cpp: core opengl rendering stuff + +#include "pch.h" +#include "engine.h" + +bool hasVBO = false, hasDRE = false, hasOQ = false, hasTR = false, hasFBO = false, hasDS = false, hasTF = false, hasBE = false, hasCM = false, hasNP2 = false, hasTC = false, hasTE = false, hasMT = false, hasD3 = false, hasstencil = false, hasAF = false, hasVP2 = false, hasVP3 = false, hasPP = false, hasMDA = false, hasTE3 = false, hasTE4 = false, hasVP = false, hasFP = false, hasGLSL = false, hasGM = false, hasNVFB = false; + +VAR(renderpath, 1, 0, 0); + +// GL_ARB_vertex_buffer_object +PFNGLGENBUFFERSARBPROC glGenBuffers_ = NULL; +PFNGLBINDBUFFERARBPROC glBindBuffer_ = NULL; +PFNGLMAPBUFFERARBPROC glMapBuffer_ = NULL; +PFNGLUNMAPBUFFERARBPROC glUnmapBuffer_ = NULL; +PFNGLBUFFERDATAARBPROC glBufferData_ = NULL; +PFNGLBUFFERSUBDATAARBPROC glBufferSubData_ = NULL; +PFNGLDELETEBUFFERSARBPROC glDeleteBuffers_ = NULL; +PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubData_ = NULL; + +// GL_ARB_multitexture +PFNGLACTIVETEXTUREARBPROC glActiveTexture_ = NULL; +PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTexture_ = NULL; +PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2f_ = NULL; +PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3f_ = NULL; +PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4f_ = NULL; + +// GL_ARB_vertex_program, GL_ARB_fragment_program +PFNGLGENPROGRAMSARBPROC glGenPrograms_ = NULL; +PFNGLDELETEPROGRAMSARBPROC glDeletePrograms_ = NULL; +PFNGLBINDPROGRAMARBPROC glBindProgram_ = NULL; +PFNGLPROGRAMSTRINGARBPROC glProgramString_ = NULL; +PFNGLGETPROGRAMIVARBPROC glGetProgramiv_ = NULL; +PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4f_ = NULL; +PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fv_ = NULL; +PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArray_ = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArray_ = NULL; +PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointer_ = NULL; + +// GL_EXT_gpu_program_parameters +PFNGLPROGRAMENVPARAMETERS4FVEXTPROC glProgramEnvParameters4fv_ = NULL; +PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC glProgramLocalParameters4fv_ = NULL; + +// GL_ARB_occlusion_query +PFNGLGENQUERIESARBPROC glGenQueries_ = NULL; +PFNGLDELETEQUERIESARBPROC glDeleteQueries_ = NULL; +PFNGLBEGINQUERYARBPROC glBeginQuery_ = NULL; +PFNGLENDQUERYARBPROC glEndQuery_ = NULL; +PFNGLGETQUERYIVARBPROC glGetQueryiv_ = NULL; +PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectiv_ = NULL; +PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuiv_ = NULL; + +// GL_EXT_framebuffer_object +PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbuffer_ = NULL; +PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffers_ = NULL; +PFNGLGENFRAMEBUFFERSEXTPROC glGenRenderbuffers_ = NULL; +PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorage_ = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatus_ = NULL; +PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebuffer_ = NULL; +PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffers_ = NULL; +PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffers_ = NULL; +PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2D_ = NULL; +PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbuffer_ = NULL; +PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmap_ = NULL; + +// GL_ARB_shading_language_100, GL_ARB_shader_objects, GL_ARB_fragment_shader, GL_ARB_vertex_shader +PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObject_ = NULL; +PFNGLDELETEOBJECTARBPROC glDeleteObject_ = NULL; +PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObject_ = NULL; +PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObject_ = NULL; +PFNGLSHADERSOURCEARBPROC glShaderSource_ = NULL; +PFNGLCOMPILESHADERARBPROC glCompileShader_ = NULL; +PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameteriv_ = NULL; +PFNGLATTACHOBJECTARBPROC glAttachObject_ = NULL; +PFNGLGETINFOLOGARBPROC glGetInfoLog_ = NULL; +PFNGLLINKPROGRAMARBPROC glLinkProgram_ = NULL; +PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocation_ = NULL; +PFNGLUNIFORM4FVARBPROC glUniform4fv_ = NULL; +PFNGLUNIFORM1IARBPROC glUniform1i_ = NULL; + +// GL_EXT_draw_range_elements +PFNGLDRAWRANGEELEMENTSEXTPROC glDrawRangeElements_ = NULL; + +// GL_EXT_blend_minmax +PFNGLBLENDEQUATIONEXTPROC glBlendEquation_ = NULL; + +// GL_EXT_multi_draw_arrays +PFNGLMULTIDRAWARRAYSEXTPROC glMultiDrawArrays_ = NULL; +PFNGLMULTIDRAWELEMENTSEXTPROC glMultiDrawElements_ = NULL; + +void *getprocaddress(const char *name) +{ + return SDL_GL_GetProcAddress(name); +} + +VARP(ati_skybox_bug, 0, 0, 1); +VAR(ati_texgen_bug, 0, 0, 1); +VAR(ati_oq_bug, 0, 0, 1); +VAR(ati_minmax_bug, 0, 0, 1); +VAR(ati_dph_bug, 0, 0, 1); +VAR(nvidia_texgen_bug, 0, 0, 1); +VAR(nvidia_scissor_bug, 0, 0, 1); +VAR(apple_glsldepth_bug, 0, 0, 1); +VAR(apple_ff_bug, 0, 0, 1); +VAR(apple_vp_bug, 0, 0, 1); +VAR(intel_quadric_bug, 0, 0, 1); +VAR(mesa_program_bug, 0, 0, 1); +VAR(avoidshaders, 1, 0, 0); +VAR(minimizetcusage, 1, 0, 0); +VAR(emulatefog, 1, 0, 0); +VAR(usevp2, 1, 0, 0); +VAR(usevp3, 1, 0, 0); +VAR(usetexrect, 1, 0, 0); +VAR(rtscissor, 0, 1, 1); +VAR(blurtile, 0, 1, 1); +VAR(rtsharefb, 0, 1, 1); + +static bool checkseries(const char *s, int low, int high) +{ + while(*s && !isdigit(*s)) ++s; + if(!*s) return false; + int n = 0; + while(isdigit(*s)) n = n*10 + (*s++ - '0'); + return n >= low && n < high; +} + +void gl_checkextensions() +{ + const char *vendor = (const char *)glGetString(GL_VENDOR); + const char *exts = (const char *)glGetString(GL_EXTENSIONS); + const char *renderer = (const char *)glGetString(GL_RENDERER); + const char *version = (const char *)glGetString(GL_VERSION); + conoutf(CON_INIT, "Renderer: %s (%s)", renderer, vendor); + conoutf(CON_INIT, "Driver: %s", version); + +#ifdef __APPLE__ + extern int mac_osversion(); + int osversion = mac_osversion(); /* 0x1050 = 10.5 (Leopard) */ +#endif + + //extern int shaderprecision; + // default to low precision shaders on certain cards, can be overridden with -f3 + // char *weakcards[] = { "GeForce FX", "Quadro FX", "6200", "9500", "9550", "9600", "9700", "9800", "X300", "X600", "FireGL", "Intel", "Chrome", NULL } + // if(shaderprecision==2) for(char **wc = weakcards; *wc; wc++) if(strstr(renderer, *wc)) shaderprecision = 1; + + if(strstr(exts, "GL_EXT_texture_env_combine") || strstr(exts, "GL_ARB_texture_env_combine")) + { + hasTE = true; + if(strstr(exts, "GL_ATI_texture_env_combine3")) hasTE3 = true; + if(strstr(exts, "GL_NV_texture_env_combine4")) hasTE4 = true; + if(strstr(exts, "GL_EXT_texture_env_dot3") || strstr(exts, "GL_ARB_texture_env_dot3")) hasD3 = true; + } + else conoutf(CON_WARN, "WARNING: No texture_env_combine extension! (your video card is WAY too old)"); + + if(strstr(exts, "GL_ARB_multitexture")) + { + glActiveTexture_ = (PFNGLACTIVETEXTUREARBPROC) getprocaddress("glActiveTextureARB"); + glClientActiveTexture_ = (PFNGLCLIENTACTIVETEXTUREARBPROC)getprocaddress("glClientActiveTextureARB"); + glMultiTexCoord2f_ = (PFNGLMULTITEXCOORD2FARBPROC) getprocaddress("glMultiTexCoord2fARB"); + glMultiTexCoord3f_ = (PFNGLMULTITEXCOORD3FARBPROC) getprocaddress("glMultiTexCoord3fARB"); + glMultiTexCoord4f_ = (PFNGLMULTITEXCOORD4FARBPROC) getprocaddress("glMultiTexCoord4fARB"); + hasMT = true; + } + else conoutf(CON_WARN, "WARNING: No multitexture extension!"); + + if(strstr(exts, "GL_ARB_vertex_buffer_object")) + { + glGenBuffers_ = (PFNGLGENBUFFERSARBPROC) getprocaddress("glGenBuffersARB"); + glBindBuffer_ = (PFNGLBINDBUFFERARBPROC) getprocaddress("glBindBufferARB"); + glMapBuffer_ = (PFNGLMAPBUFFERARBPROC) getprocaddress("glMapBufferARB"); + glUnmapBuffer_ = (PFNGLUNMAPBUFFERARBPROC) getprocaddress("glUnmapBufferARB"); + glBufferData_ = (PFNGLBUFFERDATAARBPROC) getprocaddress("glBufferDataARB"); + glBufferSubData_ = (PFNGLBUFFERSUBDATAARBPROC) getprocaddress("glBufferSubDataARB"); + glDeleteBuffers_ = (PFNGLDELETEBUFFERSARBPROC) getprocaddress("glDeleteBuffersARB"); + glGetBufferSubData_ = (PFNGLGETBUFFERSUBDATAARBPROC)getprocaddress("glGetBufferSubDataARB"); + hasVBO = true; + //conoutf(CON_INIT, "Using GL_ARB_vertex_buffer_object extension."); + } + else conoutf(CON_WARN, "WARNING: No vertex_buffer_object extension! (geometry heavy maps will be SLOW)"); + + if(strstr(exts, "GL_EXT_draw_range_elements")) + { + glDrawRangeElements_ = (PFNGLDRAWRANGEELEMENTSEXTPROC)getprocaddress("glDrawRangeElementsEXT"); + hasDRE = true; + } + + if(strstr(exts, "GL_EXT_multi_draw_arrays")) + { + glMultiDrawArrays_ = (PFNGLMULTIDRAWARRAYSEXTPROC) getprocaddress("glMultiDrawArraysEXT"); + glMultiDrawElements_ = (PFNGLMULTIDRAWELEMENTSEXTPROC)getprocaddress("glMultiDrawElementsEXT"); + hasMDA = true; + } + +#ifdef __APPLE__ + // floating point FBOs not fully supported until 10.5 + if(osversion>=0x1050) +#endif + if(strstr(exts, "GL_ARB_texture_float") || strstr(exts, "GL_ATI_texture_float")) + { + hasTF = true; + //conoutf("Using GL_ARB_texture_float extension"); + shadowmap = 1; + extern int smoothshadowmappeel; + smoothshadowmappeel = 1; + } + + if(strstr(exts, "GL_NV_float_buffer")) hasNVFB = true; + + if(strstr(exts, "GL_EXT_framebuffer_object")) + { + glBindRenderbuffer_ = (PFNGLBINDRENDERBUFFEREXTPROC) getprocaddress("glBindRenderbufferEXT"); + glDeleteRenderbuffers_ = (PFNGLDELETERENDERBUFFERSEXTPROC) getprocaddress("glDeleteRenderbuffersEXT"); + glGenRenderbuffers_ = (PFNGLGENFRAMEBUFFERSEXTPROC) getprocaddress("glGenRenderbuffersEXT"); + glRenderbufferStorage_ = (PFNGLRENDERBUFFERSTORAGEEXTPROC) getprocaddress("glRenderbufferStorageEXT"); + glCheckFramebufferStatus_ = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) getprocaddress("glCheckFramebufferStatusEXT"); + glBindFramebuffer_ = (PFNGLBINDFRAMEBUFFEREXTPROC) getprocaddress("glBindFramebufferEXT"); + glDeleteFramebuffers_ = (PFNGLDELETEFRAMEBUFFERSEXTPROC) getprocaddress("glDeleteFramebuffersEXT"); + glGenFramebuffers_ = (PFNGLGENFRAMEBUFFERSEXTPROC) getprocaddress("glGenFramebuffersEXT"); + glFramebufferTexture2D_ = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) getprocaddress("glFramebufferTexture2DEXT"); + glFramebufferRenderbuffer_ = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)getprocaddress("glFramebufferRenderbufferEXT"); + glGenerateMipmap_ = (PFNGLGENERATEMIPMAPEXTPROC) getprocaddress("glGenerateMipmapEXT"); + hasFBO = true; + //conoutf(CON_INIT, "Using GL_EXT_framebuffer_object extension."); + } + else conoutf(CON_WARN, "WARNING: No framebuffer object support. (reflective water may be slow)"); + + if(strstr(exts, "GL_ARB_occlusion_query")) + { + GLint bits; + glGetQueryiv_ = (PFNGLGETQUERYIVARBPROC)getprocaddress("glGetQueryivARB"); + glGetQueryiv_(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, &bits); + if(bits) + { + glGenQueries_ = (PFNGLGENQUERIESARBPROC) getprocaddress("glGenQueriesARB"); + glDeleteQueries_ = (PFNGLDELETEQUERIESARBPROC) getprocaddress("glDeleteQueriesARB"); + glBeginQuery_ = (PFNGLBEGINQUERYARBPROC) getprocaddress("glBeginQueryARB"); + glEndQuery_ = (PFNGLENDQUERYARBPROC) getprocaddress("glEndQueryARB"); + glGetQueryObjectiv_ = (PFNGLGETQUERYOBJECTIVARBPROC) getprocaddress("glGetQueryObjectivARB"); + glGetQueryObjectuiv_ = (PFNGLGETQUERYOBJECTUIVARBPROC)getprocaddress("glGetQueryObjectuivARB"); + hasOQ = true; + //conoutf(CON_INIT, "Using GL_ARB_occlusion_query extension."); +#if defined(__APPLE__) && SDL_BYTEORDER == SDL_BIG_ENDIAN + if(strstr(vendor, "ATI") && (osversion<0x1050)) ati_oq_bug = 1; +#endif + if(ati_oq_bug) conoutf(CON_WARN, "WARNING: Using ATI occlusion query bug workaround. (use \"/ati_oq_bug 0\" to disable if unnecessary)"); + } + } + if(!hasOQ) + { + conoutf(CON_WARN, "WARNING: No occlusion query support! (large maps may be SLOW)"); + zpass = 0; + extern int vacubesize; + vacubesize = 64; + waterreflect = 0; + } + + extern int reservedynlighttc, reserveshadowmaptc, maxtexsize, batchlightmaps; + if(strstr(vendor, "ATI")) + { + floatvtx = 1; + //conoutf("WARNING: ATI cards may show garbage in skybox. (use \"/ati_skybox_bug 1\" to fix)"); + + reservedynlighttc = 2; + reserveshadowmaptc = 3; + minimizetcusage = 1; + emulatefog = 1; + extern int depthfxprecision; + if(hasTF) depthfxprecision = 1; + + ati_texgen_bug = 1; + } + else if(strstr(vendor, "NVIDIA")) + { + reservevpparams = 10; + rtsharefb = 0; // work-around for strange driver stalls involving when using many FBOs + extern int filltjoints; + if(!strstr(exts, "GL_EXT_gpu_shader4")) filltjoints = 0; // DX9 or less NV cards seem to not cause many sparklies + + nvidia_texgen_bug = 1; + if(hasFBO && !hasTF) nvidia_scissor_bug = 1; // 5200 bug, clearing with scissor on an FBO messes up on reflections, may affect lesser cards too + extern int fpdepthfx; + if(hasTF && (!strstr(renderer, "GeForce") || !checkseries(renderer, 6000, 6600))) + fpdepthfx = 1; // FP filtering causes software fallback on 6200? + } + else if(strstr(vendor, "Intel")) + { + avoidshaders = 1; + intel_quadric_bug = 1; + maxtexsize = 256; + reservevpparams = 20; + batchlightmaps = 0; + + if(!hasOQ) waterrefract = 0; + +#ifdef __APPLE__ + apple_vp_bug = 1; +#endif + } + else if(strstr(vendor, "Tungsten") || strstr(vendor, "Mesa") || strstr(vendor, "Microsoft") || strstr(vendor, "S3 Graphics")) + { + avoidshaders = 1; + floatvtx = 1; + maxtexsize = 256; + reservevpparams = 20; + batchlightmaps = 0; + + if(!hasOQ) waterrefract = 0; + } + //if(floatvtx) conoutf("WARNING: Using floating point vertexes. (use \"/floatvtx 0\" to disable)"); + + if(strstr(exts, "GL_ARB_vertex_program") && strstr(exts, "GL_ARB_fragment_program")) + { + hasVP = hasFP = true; + glGenPrograms_ = (PFNGLGENPROGRAMSARBPROC) getprocaddress("glGenProgramsARB"); + glDeletePrograms_ = (PFNGLDELETEPROGRAMSARBPROC) getprocaddress("glDeleteProgramsARB"); + glBindProgram_ = (PFNGLBINDPROGRAMARBPROC) getprocaddress("glBindProgramARB"); + glProgramString_ = (PFNGLPROGRAMSTRINGARBPROC) getprocaddress("glProgramStringARB"); + glGetProgramiv_ = (PFNGLGETPROGRAMIVARBPROC) getprocaddress("glGetProgramivARB"); + glProgramEnvParameter4f_ = (PFNGLPROGRAMENVPARAMETER4FARBPROC) getprocaddress("glProgramEnvParameter4fARB"); + glProgramEnvParameter4fv_ = (PFNGLPROGRAMENVPARAMETER4FVARBPROC) getprocaddress("glProgramEnvParameter4fvARB"); + glEnableVertexAttribArray_ = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC) getprocaddress("glEnableVertexAttribArrayARB"); + glDisableVertexAttribArray_ = (PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) getprocaddress("glDisableVertexAttribArrayARB"); + glVertexAttribPointer_ = (PFNGLVERTEXATTRIBPOINTERARBPROC) getprocaddress("glVertexAttribPointerARB"); + + if(strstr(exts, "GL_ARB_shading_language_100") && strstr(exts, "GL_ARB_shader_objects") && strstr(exts, "GL_ARB_vertex_shader") && strstr(exts, "GL_ARB_fragment_shader")) + { + glCreateProgramObject_ = (PFNGLCREATEPROGRAMOBJECTARBPROC) getprocaddress("glCreateProgramObjectARB"); + glDeleteObject_ = (PFNGLDELETEOBJECTARBPROC) getprocaddress("glDeleteObjectARB"); + glUseProgramObject_ = (PFNGLUSEPROGRAMOBJECTARBPROC) getprocaddress("glUseProgramObjectARB"); + glCreateShaderObject_ = (PFNGLCREATESHADEROBJECTARBPROC) getprocaddress("glCreateShaderObjectARB"); + glShaderSource_ = (PFNGLSHADERSOURCEARBPROC) getprocaddress("glShaderSourceARB"); + glCompileShader_ = (PFNGLCOMPILESHADERARBPROC) getprocaddress("glCompileShaderARB"); + glGetObjectParameteriv_ = (PFNGLGETOBJECTPARAMETERIVARBPROC) getprocaddress("glGetObjectParameterivARB"); + glAttachObject_ = (PFNGLATTACHOBJECTARBPROC) getprocaddress("glAttachObjectARB"); + glGetInfoLog_ = (PFNGLGETINFOLOGARBPROC) getprocaddress("glGetInfoLogARB"); + glLinkProgram_ = (PFNGLLINKPROGRAMARBPROC) getprocaddress("glLinkProgramARB"); + glGetUniformLocation_ = (PFNGLGETUNIFORMLOCATIONARBPROC) getprocaddress("glGetUniformLocationARB"); + glUniform4fv_ = (PFNGLUNIFORM4FVARBPROC) getprocaddress("glUniform4fvARB"); + glUniform1i_ = (PFNGLUNIFORM1IARBPROC) getprocaddress("glUniform1iARB"); + + extern bool checkglslsupport(); + if(checkglslsupport()) + { + hasGLSL = true; +#ifdef __APPLE__ + //if(osversion<0x1050) ?? + apple_glsldepth_bug = 1; +#endif + if(apple_glsldepth_bug) conoutf(CON_WARN, "WARNING: Using Apple GLSL depth bug workaround. (use \"/apple_glsldepth_bug 0\" to disable if unnecessary"); + } + } + + if(strstr(vendor, "ATI")) ati_dph_bug = 1; + else if(strstr(vendor, "Tungsten")) mesa_program_bug = 1; + +#ifdef __APPLE__ + if(osversion>=0x1050) + { + apple_ff_bug = 1; + conoutf(CON_WARN, "WARNING: Using Leopard ARB_position_invariant bug workaround. (use \"/apple_ff_bug 0\" to disable if unnecessary)"); + } +#endif + } + + if(strstr(exts, "GL_NV_vertex_program2_option")) { usevp2 = 1; hasVP2 = true; } + if(strstr(exts, "GL_NV_vertex_program3")) { usevp3 = 1; hasVP3 = true; } + + if(strstr(exts, "GL_EXT_gpu_program_parameters")) + { + glProgramEnvParameters4fv_ = (PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) getprocaddress("glProgramEnvParameters4fvEXT"); + glProgramLocalParameters4fv_ = (PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC)getprocaddress("glProgramLocalParameters4fvEXT"); + hasPP = true; + } + + if(strstr(exts, "GL_EXT_texture_rectangle") || strstr(exts, "GL_ARB_texture_rectangle")) + { + usetexrect = 1; + hasTR = true; + //conoutf(CON_INIT, "Using GL_ARB_texture_rectangle extension."); + } + else if(hasMT && hasVP && hasFP) conoutf(CON_WARN, "WARNING: No texture rectangle support. (no full screen shaders)"); + + if(strstr(exts, "GL_EXT_packed_depth_stencil") || strstr(exts, "GL_NV_packed_depth_stencil")) + { + hasDS = true; + //conoutf(CON_INIT, "Using GL_EXT_packed_depth_stencil extension."); + } + + if(strstr(exts, "GL_EXT_blend_minmax")) + { + glBlendEquation_ = (PFNGLBLENDEQUATIONEXTPROC) getprocaddress("glBlendEquationEXT"); + hasBE = true; + if(strstr(vendor, "ATI")) ati_minmax_bug = 1; + //conoutf(CON_INIT, "Using GL_EXT_blend_minmax extension."); + } + + if(strstr(exts, "GL_ARB_texture_cube_map")) + { + GLint val; + glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, &val); + hwcubetexsize = val; + hasCM = true; + //conoutf(CON_INIT, "Using GL_ARB_texture_cube_map extension."); + } + else conoutf(CON_WARN, "WARNING: No cube map texture support. (no reflective glass)"); + + if(strstr(exts, "GL_ARB_texture_non_power_of_two")) + { + hasNP2 = true; + //conoutf(CON_INIT, "Using GL_ARB_texture_non_power_of_two extension."); + } + else conoutf(CON_WARN, "WARNING: Non-power-of-two textures not supported!"); + + if(strstr(exts, "GL_EXT_texture_compression_s3tc")) + { + hasTC = true; + //conoutf(CON_INIT, "Using GL_EXT_texture_compression_s3tc extension."); + } + + if(strstr(exts, "GL_EXT_texture_filter_anisotropic")) + { + GLint val; + glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &val); + hwmaxaniso = val; + hasAF = true; + //conoutf(CON_INIT, "Using GL_EXT_texture_filter_anisotropic extension."); + } + + if(strstr(exts, "GL_SGIS_generate_mipmap")) + { + hasGM = true; + //conoutf(CON_INIT, "Using GL_SGIS_generate_mipmap extension."); + } + + GLint val; + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &val); + hwtexsize = val; +} + +void glext(char *ext) +{ + const char *exts = (const char *)glGetString(GL_EXTENSIONS); + intret(strstr(exts, ext) ? 1 : 0); +} +COMMAND(glext, "s"); + +void gl_init(int w, int h, int bpp, int depth, int fsaa) +{ + #define fogvalues 0.5f, 0.6f, 0.7f, 1.0f + + glViewport(0, 0, w, h); + glClearColor(fogvalues); + glClearDepth(1); + glDepthFunc(GL_LESS); + glEnable(GL_DEPTH_TEST); + glShadeModel(GL_SMOOTH); + + + glEnable(GL_FOG); + glFogi(GL_FOG_MODE, GL_LINEAR); + glFogf(GL_FOG_DENSITY, 0.25f); + glHint(GL_FOG_HINT, GL_NICEST); + GLfloat fogcolor[4] = { fogvalues }; + glFogfv(GL_FOG_COLOR, fogcolor); + + + glEnable(GL_LINE_SMOOTH); + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); + + glCullFace(GL_FRONT); + glEnable(GL_CULL_FACE); + + extern int useshaders; + if(!useshaders || (useshaders<0 && avoidshaders) || !hasMT || !hasVP || !hasFP) + { + if(!hasMT || !hasVP || !hasFP) conoutf(CON_WARN, "WARNING: No shader support! Using fixed-function fallback. (no fancy visuals for you)"); + else if(useshaders<0 && !hasTF) conoutf(CON_WARN, "WARNING: Disabling shaders for extra performance. (use \"/shaders 1\" to enable shaders if desired)"); + renderpath = R_FIXEDFUNCTION; + conoutf(CON_INIT, "Rendering using the OpenGL 1.5 fixed-function path."); + if(ati_texgen_bug) conoutf(CON_WARN, "WARNING: Using ATI texgen bug workaround. (use \"/ati_texgen_bug 0\" to disable if unnecessary)"); + if(nvidia_texgen_bug) conoutf(CON_WARN, "WARNING: Using NVIDIA texgen bug workaround. (use \"/nvidia_texgen_bug 0\" to disable if unnecessary)"); + } + else + { + renderpath = hasGLSL ? R_GLSLANG : R_ASMSHADER; + if(renderpath==R_GLSLANG) conoutf(CON_INIT, "Rendering using the OpenGL 1.5 GLSL shader path."); + else conoutf(CON_INIT, "Rendering using the OpenGL 1.5 assembly shader path."); + } + + if(fsaa) glEnable(GL_MULTISAMPLE); + + inittmus(); +} + +void cleanupgl() +{ + if(glIsEnabled(GL_MULTISAMPLE)) glDisable(GL_MULTISAMPLE); + + extern int nomasks, nolights, nowater; + nomasks = nolights = nowater = 0; +} + +VAR(wireframe, 0, 0, 1); + +vec worldpos, camdir, camright, camup; + +void findorientation() +{ + vecfromyawpitch(camera1->yaw, camera1->pitch, 1, 0, camdir); + vecfromyawpitch(camera1->yaw, 0, 0, -1, camright); + vecfromyawpitch(camera1->yaw, camera1->pitch+90, 1, 0, camup); + + if(raycubepos(camera1->o, camdir, worldpos, 0, RAY_CLIPMAT|RAY_SKIPFIRST) == -1) + worldpos = vec(camdir).mul(2*hdr.worldsize).add(camera1->o); //otherwise 3dgui won't work when outside of map + + setviewcell(camera1->o); +} + +void transplayer() +{ + glLoadIdentity(); + + glRotatef(camera1->roll, 0, 0, 1); + glRotatef(camera1->pitch, -1, 0, 0); + glRotatef(camera1->yaw, 0, 1, 0); + + // move from RH to Z-up LH quake style worldspace + glRotatef(-90, 1, 0, 0); + glScalef(1, -1, 1); + + glTranslatef(-camera1->o.x, -camera1->o.y, -camera1->o.z); +} + +float curfov = 100, curhgfov = 65, fovy, aspect; +int farplane; +VARP(zoominvel, 0, 250, 5000); +VARP(zoomoutvel, 0, 100, 5000); +VARP(zoomfov, 10, 35, 60); +VARFP(fov, 10, 100, 150, curfov = fov); +VAR(hudgunzoomfov, 10, 25, 60); +VARF(hudgunfov, 10, 65, 150, curhgfov = 65); + +static int zoommillis = 0; +VARF(zoom, -1, 0, 1, + if(zoom) zoommillis = totalmillis; +); + +void computezoom() +{ + if(!zoom) { curfov = fov; curhgfov = hudgunfov; return; } + if(zoom < 0 && curfov >= fov) { zoom = 0; return; } // don't zoom-out if not zoomed-in + int zoomvel = zoom > 0 ? zoominvel : zoomoutvel, + oldfov = zoom > 0 ? fov : zoomfov, + newfov = zoom > 0 ? zoomfov : fov, + oldhgfov = zoom > 0 ? hudgunfov : hudgunzoomfov, + newhgfov = zoom > 0 ? hudgunzoomfov : hudgunfov; + float t = zoomvel ? float(zoomvel - (totalmillis - zoommillis)) / zoomvel : 0; + if(t <= 0) + { + if(!zoomvel && fabs(newfov - curfov) >= 1) + { + curfov = newfov; + curhgfov = newhgfov; + } + zoom = max(zoom, 0); + } + else + { + curfov = oldfov*t + newfov*(1 - t); + curhgfov = oldhgfov*t + newhgfov*(1 - t); + } +} + +VARP(zoomsens, 1, 1, 10000); +VARP(zoomautosens, 0, 1, 1); +VARP(sensitivity, 0, 3, 10000); +VARP(sensitivityscale, 1, 1, 10000); +VARP(invmouse, 0, 0, 1); + +VAR(thirdperson, 0, 0, 2); +VAR(thirdpersondistance, 10, 50, 1000); +physent *camera1 = NULL; +bool detachedcamera = false; +bool isthirdperson() { return player!=camera1 || detachedcamera || reflecting; } + +void fixcamerarange() +{ + const float MAXPITCH = 90.0f; + if(camera1->pitch>MAXPITCH) camera1->pitch = MAXPITCH; + if(camera1->pitch<-MAXPITCH) camera1->pitch = -MAXPITCH; + while(camera1->yaw<0.0f) camera1->yaw += 360.0f; + while(camera1->yaw>=360.0f) camera1->yaw -= 360.0f; +} + +void mousemove(int dx, int dy) +{ + float cursens = sensitivity; + if(zoom) + { + if(zoomautosens) cursens = float(sensitivity*zoomfov)/fov; + else cursens = zoomsens; + } + cursens /= 33.0f*sensitivityscale; + camera1->yaw += dx*cursens; + camera1->pitch -= dy*cursens*(invmouse ? -1 : 1); + fixcamerarange(); + if(camera1!=player && !detachedcamera) + { + player->yaw = camera1->yaw; + player->pitch = camera1->pitch; + } +} + +void recomputecamera() +{ + cl->setupcamera(); + computezoom(); + + bool shoulddetach = thirdperson > 1 || cl->detachcamera(); + if(!thirdperson && !shoulddetach) + { + camera1 = player; + detachedcamera = false; + } + else + { + static physent tempcamera; + camera1 = &tempcamera; + if(detachedcamera && shoulddetach) camera1->o = player->o; + else + { + *camera1 = *player; + detachedcamera = shoulddetach; + } + camera1->reset(); + camera1->type = ENT_CAMERA; + camera1->move = -1; + camera1->eyeheight = 2; + + loopi(10) + { + if(!moveplayer(camera1, 10, true, thirdpersondistance)) break; + } + } +} + +void project(float fovy, float aspect, int farplane, bool flipx = false, bool flipy = false, bool swapxy = false) +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + if(swapxy) glRotatef(90, 0, 0, 1); + if(flipx || flipy!=swapxy) glScalef(flipx ? -1 : 1, flipy!=swapxy ? -1 : 1, 1); + gluPerspective(fovy, aspect, 0.54f, farplane); + glMatrixMode(GL_MODELVIEW); +} + +VAR(reflectclip, 0, 6, 64); + +GLfloat clipmatrix[16]; + +void genclipmatrix(float a, float b, float c, float d, GLfloat matrix[16]) +{ + // transform the clip plane into camera space + float clip[4]; + loopi(4) clip[i] = a*invmvmatrix[i*4 + 0] + b*invmvmatrix[i*4 + 1] + c*invmvmatrix[i*4 + 2] + d*invmvmatrix[i*4 + 3]; + + memcpy(matrix, projmatrix, 16*sizeof(GLfloat)); + + float x = ((clip[0]<0 ? -1 : (clip[0]>0 ? 1 : 0)) + matrix[8]) / matrix[0], + y = ((clip[1]<0 ? -1 : (clip[1]>0 ? 1 : 0)) + matrix[9]) / matrix[5], + w = (1 + matrix[10]) / matrix[14], + scale = 2 / (x*clip[0] + y*clip[1] - clip[2] + w*clip[3]); + matrix[2] = clip[0]*scale; + matrix[6] = clip[1]*scale; + matrix[10] = clip[2]*scale + 1.0f; + matrix[14] = clip[3]*scale; +} + +void setclipmatrix(GLfloat matrix[16]) +{ + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadMatrixf(matrix); + glMatrixMode(GL_MODELVIEW); +} + +void undoclipmatrix() +{ + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); +} + +FVAR(polygonoffsetfactor, -3.0f); +FVAR(polygonoffsetunits, -3.0f); +FVAR(depthoffset, 0.01f); + +void enablepolygonoffset(GLenum type) +{ + if(!depthoffset) + { + glPolygonOffset(polygonoffsetfactor, polygonoffsetunits); + glEnable(type); + return; + } + + bool clipped = reflectz < 1e15f && reflectclip; + + GLfloat offsetmatrix[16]; + memcpy(offsetmatrix, clipped ? clipmatrix : projmatrix, 16*sizeof(GLfloat)); + offsetmatrix[14] += depthoffset * projmatrix[10]; + + glMatrixMode(GL_PROJECTION); + if(!clipped) glPushMatrix(); + glLoadMatrixf(offsetmatrix); + glMatrixMode(GL_MODELVIEW); +} + +void disablepolygonoffset(GLenum type) +{ + if(!depthoffset) + { + glDisable(type); + return; + } + + bool clipped = reflectz < 1e15f && reflectclip; + + glMatrixMode(GL_PROJECTION); + if(clipped) glLoadMatrixf(clipmatrix); + else glPopMatrix(); + glMatrixMode(GL_MODELVIEW); +} + +VARR(fog, 16, 4000, 1000024); +VARR(fogcolour, 0, 0x8099B3, 0xFFFFFF); + +void setfogplane(const plane &p, bool flush) +{ + static float fogselect[4] = {0, 0, 0, 0}; + if(flush) + { + flushenvparamfv("fogselect", SHPARAM_VERTEX, 8, fogselect); + flushenvparamfv("fogplane", SHPARAM_VERTEX, 9, p.v); + } + else + { + setenvparamfv("fogselect", SHPARAM_VERTEX, 8, fogselect); + setenvparamfv("fogplane", SHPARAM_VERTEX, 9, p.v); + } +} + +void setfogplane(float scale, float z, bool flush, float fadescale, float fadeoffset) +{ + float fogselect[4] = {1, fadescale, fadeoffset, 0}, fogplane[4] = {0, 0, 0, 0}; + if(scale || z) + { + fogselect[0] = 0; + fogplane[2] = scale; + fogplane[3] = -z; + } + if(flush) + { + flushenvparamfv("fogselect", SHPARAM_VERTEX, 8, fogselect); + flushenvparamfv("fogplane", SHPARAM_VERTEX, 9, fogplane); + } + else + { + setenvparamfv("fogselect", SHPARAM_VERTEX, 8, fogselect); + setenvparamfv("fogplane", SHPARAM_VERTEX, 9, fogplane); + } +} + +static float findsurface(int fogmat, const vec &v, int &abovemat) +{ + ivec o(v); + do + { + cube &c = lookupcube(o.x, o.y, o.z); + if(!c.ext || (c.ext->material&MATF_VOLUME) != fogmat) + { + abovemat = c.ext && isliquid(c.ext->material&MATF_VOLUME) ? c.ext->material&MATF_VOLUME : MAT_AIR; + return o.z; + } + o.z = lu.z + lusize; + } + while(o.z < hdr.worldsize); + abovemat = MAT_AIR; + return hdr.worldsize; +} + +static void blendfog(int fogmat, float blend, float logblend, float &start, float &end, float *fogc) +{ + uchar col[3]; + switch(fogmat) + { + case MAT_WATER: + getwatercolour(col); + loopk(3) fogc[k] += blend*col[k]/255.0f; + end += logblend*min(fog, max(waterfog*4, 32)); + break; + + case MAT_LAVA: + getlavacolour(col); + loopk(3) fogc[k] += blend*col[k]/255.0f; + end += logblend*min(fog, max(lavafog*4, 32)); + break; + + default: + fogc[0] += blend*(fogcolour>>16)/255.0f; + fogc[1] += blend*((fogcolour>>8)&255)/255.0f; + fogc[2] += blend*(fogcolour&255)/255.0f; + start += logblend*(fog+64)/8; + end += logblend*fog; + break; + } +} + +static void setfog(int fogmat, float below = 1, int abovemat = MAT_AIR) +{ + float fogc[4] = { 0, 0, 0, 1 }; + float start = 0, end = 0; + float logscale = 256, logblend = log(1 + (logscale - 1)*below) / log(logscale); + + blendfog(fogmat, below, logblend, start, end, fogc); + if(below < 1) blendfog(abovemat, 1-below, 1-logblend, start, end, fogc); + + glFogf(GL_FOG_START, start); + glFogf(GL_FOG_END, end); + glFogfv(GL_FOG_COLOR, fogc); + glClearColor(fogc[0], fogc[1], fogc[2], 1.0f); + + if(renderpath!=R_FIXEDFUNCTION) setfogplane(); +} + +static void blendfogoverlay(int fogmat, float blend, float *overlay) +{ + uchar col[3]; + float maxc; + switch(fogmat) + { + case MAT_WATER: + getwatercolour(col); + maxc = max(col[0], max(col[1], col[2])); + loopk(3) overlay[k] += blend*max(0.4f, col[k]/min(32.0f + maxc*7.0f/8.0f, 255.0f)); + break; + + case MAT_LAVA: + getlavacolour(col); + maxc = max(col[0], max(col[1], col[2])); + loopk(3) overlay[k] += blend*max(0.4f, col[k]/min(32.0f + maxc*7.0f/8.0f, 255.0f)); + break; + + default: + loopk(3) overlay[k] += blend; + break; + } +} + +bool renderedgame = false; + +void rendergame() +{ + cl->rendergame(); + if(!shadowmapping) renderedgame = true; +} + +VARP(skyboxglare, 0, 1, 1); + +void drawglare() +{ + glaring = true; + refracting = -1; + + float oldfogstart, oldfogend, oldfogcolor[4], zerofog[4] = { 0, 0, 0, 1 }; + glGetFloatv(GL_FOG_START, &oldfogstart); + glGetFloatv(GL_FOG_END, &oldfogend); + glGetFloatv(GL_FOG_COLOR, oldfogcolor); + + glFogi(GL_FOG_START, (fog+64)/8); + glFogi(GL_FOG_END, fog); + glFogfv(GL_FOG_COLOR, zerofog); + + glClearColor(0, 0, 0, 1); + glClear((skyboxglare ? 0 : GL_COLOR_BUFFER_BIT) | GL_DEPTH_BUFFER_BIT); + + rendergeom(); + + if(skyboxglare) drawskybox(farplane, false); + + renderreflectedmapmodels(); + rendergame(); + + renderwater(); + rendermaterials(); + render_particles(0); + + if(!isthirdperson()) + { + project(curhgfov, aspect, farplane); + cl->drawhudgun(); + project(fovy, aspect, farplane); + } + + glFogf(GL_FOG_START, oldfogstart); + glFogf(GL_FOG_END, oldfogend); + glFogfv(GL_FOG_COLOR, oldfogcolor); + + refracting = 0; + glaring = false; +} + +VARP(reflectmms, 0, 1, 1); + +void drawreflection(float z, bool refract, bool clear) +{ + uchar wcol[3]; + getwatercolour(wcol); + float fogc[4] = { wcol[0]/256.0f, wcol[1]/256.0f, wcol[2]/256.0f, 1.0f }; + + if(refract && !waterfog) + { + glClearColor(fogc[0], fogc[1], fogc[2], 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + return; + } + + reflectz = z < 0 ? 1e16f : z; + reflecting = !refract; + refracting = refract ? (z < 0 || camera1->o.z >= z ? -1 : 1) : 0; + fading = renderpath!=R_FIXEDFUNCTION && waterrefract && waterfade && hasFBO && z>=0; + fogging = refracting<0 && z>=0 && (renderpath!=R_FIXEDFUNCTION || refractfog); + + float oldfogstart, oldfogend, oldfogcolor[4]; + if(renderpath==R_FIXEDFUNCTION && fogging) glDisable(GL_FOG); + else + { + glGetFloatv(GL_FOG_START, &oldfogstart); + glGetFloatv(GL_FOG_END, &oldfogend); + glGetFloatv(GL_FOG_COLOR, oldfogcolor); + + if(fogging) + { + glFogi(GL_FOG_START, 0); + glFogi(GL_FOG_END, waterfog); + glFogfv(GL_FOG_COLOR, fogc); + } + else + { + glFogi(GL_FOG_START, (fog+64)/8); + glFogi(GL_FOG_END, fog); + float fogc[4] = { (fogcolour>>16)/255.0f, ((fogcolour>>8)&255)/255.0f, (fogcolour&255)/255.0f, 1.0f }; + glFogfv(GL_FOG_COLOR, fogc); + } + } + + if(clear) + { + glClearColor(fogc[0], fogc[1], fogc[2], 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + } + + if(reflecting) + { + glPushMatrix(); + glTranslatef(0, 0, 2*z); + glScalef(1, 1, -1); + + glCullFace(GL_BACK); + } + + if(reflectclip && z>=0) + { + float zoffset = reflectclip/4.0f, zclip; + if(refracting<0) + { + zclip = z+zoffset; + if(camera1->o.z<=zclip) zclip = z; + } + else + { + zclip = z-zoffset; + if(camera1->o.z>=zclip && camera1->o.z<=z+4.0f) zclip = z; + if(reflecting) zclip = 2*z - zclip; + } + genclipmatrix(0, 0, refracting>0 ? 1 : -1, refracting>0 ? -zclip : zclip, clipmatrix); + setclipmatrix(clipmatrix); + } + + + renderreflectedgeom(refracting<0 && z>=0 && caustics, fogging); + + if(reflecting || refracting>0 || z<0) + { + if(fading) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + if(reflectclip && z>=0) undoclipmatrix(); + drawskybox(farplane, false); + if(reflectclip && z>=0) setclipmatrix(clipmatrix); + if(fading) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); + } + else if(fading) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); + + if(reflectmms) renderreflectedmapmodels(); + rendergame(); + + if(fogging) setfogplane(1, z); + if(refracting) rendergrass(); + renderdecals(0); + rendermaterials(); + render_particles(0); + + if(fading) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + + if(fogging) setfogplane(); + + if(reflectclip && z>=0) undoclipmatrix(); + + if(reflecting) + { + glPopMatrix(); + + glCullFace(GL_FRONT); + } + + if(renderpath==R_FIXEDFUNCTION && fogging) glEnable(GL_FOG); + else + { + glFogf(GL_FOG_START, oldfogstart); + glFogf(GL_FOG_END, oldfogend); + glFogfv(GL_FOG_COLOR, oldfogcolor); + } + + reflectz = 1e16f; + refracting = 0; + reflecting = fading = fogging = false; +} + +bool envmapping = false; + +void drawcubemap(int size, const vec &o, float yaw, float pitch, const cubemapside &side) +{ + envmapping = true; + + physent *oldcamera = camera1; + static physent cmcamera; + cmcamera = *player; + cmcamera.reset(); + cmcamera.type = ENT_CAMERA; + cmcamera.o = o; + cmcamera.yaw = yaw; + cmcamera.pitch = pitch; + cmcamera.roll = 0; + camera1 = &cmcamera; + + defaultshader->set(); + + int fogmat = lookupmaterial(o)&MATF_VOLUME; + if(fogmat!=MAT_WATER && fogmat!=MAT_LAVA) fogmat = MAT_AIR; + + setfog(fogmat); + + glClear(GL_DEPTH_BUFFER_BIT); + + int farplane = hdr.worldsize*2; + + project(90.0f, 1.0f, farplane, !side.flipx, !side.flipy, side.swapxy); + + transplayer(); + + glEnable(GL_TEXTURE_2D); + + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + + xtravertsva = xtraverts = glde = gbatches = 0; + + visiblecubes(90, 90); + + if(limitsky()) drawskybox(farplane, true); + + rendergeom(); + + if(!limitsky()) drawskybox(farplane, false); + +// queryreflections(); + + rendermapmodels(); + +// drawreflections(); + +// renderwater(); +// rendermaterials(); + + glDisable(GL_TEXTURE_2D); + + camera1 = oldcamera; + envmapping = false; +} + +bool dopostfx = false; + +void invalidatepostfx() +{ + dopostfx = false; +} + +GLfloat mvmatrix[16], projmatrix[16], mvpmatrix[16], invmvmatrix[16]; + +void readmatrices() +{ + glGetFloatv(GL_MODELVIEW_MATRIX, mvmatrix); + glGetFloatv(GL_PROJECTION_MATRIX, projmatrix); + + loopi(4) loopj(4) + { + float c = 0; + loopk(4) c += projmatrix[k*4 + j] * mvmatrix[i*4 + k]; + mvpmatrix[i*4 + j] = c; + } + + loopi(3) + { + loopj(3) invmvmatrix[i*4 + j] = mvmatrix[i + j*4]; + invmvmatrix[i*4 + 3] = 0; + } + loopi(3) + { + float c = 0; + loopj(3) c -= mvmatrix[i*4 + j] * mvmatrix[12 + j]; + invmvmatrix[12 + i] = c; + } + invmvmatrix[15] = 1; +} + +void gl_drawhud(int w, int h, int fogmat, float fogblend, int abovemat); + +int xtraverts, xtravertsva; + +void gl_drawframe(int w, int h) +{ + defaultshader->set(); + + recomputecamera(); + + updatedynlights(); + + aspect = w/float(h); + fovy = 2*atan2(tan(curfov/2*RAD), aspect)/RAD; + + int fogmat = lookupmaterial(camera1->o)&MATF_VOLUME, abovemat = MAT_AIR; + float fogblend = 1.0f, causticspass = 0.0f; + if(fogmat==MAT_WATER || fogmat==MAT_LAVA) + { + float z = findsurface(fogmat, camera1->o, abovemat) - WATER_OFFSET; + if(camera1->o.z < z + 1) fogblend = min(z + 1 - camera1->o.z, 1.0f); + else fogmat = abovemat; + if(caustics && fogmat==MAT_WATER && camera1->o.z < z) + causticspass = renderpath==R_FIXEDFUNCTION ? 1.0f : min(z - camera1->o.z, 1.0f); + } + else fogmat = MAT_AIR; + setfog(fogmat, fogblend, abovemat); + if(fogmat!=MAT_AIR) + { + float blend = abovemat==MAT_AIR ? fogblend : 1.0f; + fovy += blend*sinf(lastmillis/1000.0)*2.0f; + aspect += blend*sinf(lastmillis/1000.0+PI)*0.1f; + } + + farplane = hdr.worldsize*2; + + project(fovy, aspect, farplane); + transplayer(); + readmatrices(); + + glEnable(GL_TEXTURE_2D); + + glPolygonMode(GL_FRONT_AND_BACK, wireframe && editmode ? GL_LINE : GL_FILL); + + xtravertsva = xtraverts = glde = gbatches = 0; + + if(!hasFBO) + { + if(dopostfx) + { + drawglaretex(); + drawdepthfxtex(); + drawreflections(); + } + else dopostfx = true; + } + + visiblecubes(curfov, fovy); + + if(shadowmap && !hasFBO) rendershadowmap(); + + glClear(GL_DEPTH_BUFFER_BIT|(wireframe && editmode ? GL_COLOR_BUFFER_BIT : 0)|(hasstencil ? GL_STENCIL_BUFFER_BIT : 0)); + + if(limitsky()) drawskybox(farplane, true); + + rendergeom(causticspass); + + extern int outline; + if(!wireframe && editmode && outline) renderoutline(); + + queryreflections(); + + if(!limitsky()) drawskybox(farplane, false); + + rendermapmodels(); + rendergame(); + + if(hasFBO) + { + drawglaretex(); + drawdepthfxtex(); + drawreflections(); + } + + renderdecals(curtime); + + renderwater(); + rendergrass(); + + rendermaterials(); + render_particles(curtime); + + if(!isthirdperson()) + { + project(curhgfov, aspect, farplane); + cl->drawhudgun(); + project(fovy, aspect, farplane); + } + + glDisable(GL_FOG); + glDisable(GL_CULL_FACE); + + addglare(); + renderfullscreenshader(w, h); + + defaultshader->set(); + g3d_render(); + + glDisable(GL_TEXTURE_2D); + notextureshader->set(); + + gl_drawhud(w, h, fogmat, fogblend, abovemat); + + glEnable(GL_CULL_FACE); + glEnable(GL_FOG); + + renderedgame = false; +} + +VARNP(damagecompass, usedamagecompass, 0, 1, 1); +VARP(damagecompassfade, 1, 1000, 10000); +VARP(damagecompasssize, 1, 30, 100); +VARP(damagecompassalpha, 1, 25, 100); +VARP(damagecompassmin, 1, 25, 1000); +VARP(damagecompassmax, 1, 200, 1000); + +float dcompass[4] = { 0, 0, 0, 0 }; +void damagecompass(int n, const vec &loc) +{ + if(!usedamagecompass) return; + vec delta(loc); + delta.sub(camera1->o); + float yaw, pitch; + if(delta.magnitude()<4) yaw = camera1->yaw; + else vectoyawpitch(delta, yaw, pitch); + yaw -= camera1->yaw; + if(yaw<0) yaw += 360; + int dir = ((int(yaw)+45)%360)/90; + dcompass[dir] += max(n, damagecompassmin)/float(damagecompassmax); + if(dcompass[dir]>1) dcompass[dir] = 1; + +} +void drawdamagecompass() +{ + int dirs = 0; + float size = damagecompasssize/100.0f*min(screen->h, screen->w)/2.0f; + loopi(4) if(dcompass[i]>0) + { + if(!dirs) + { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4f(1, 0, 0, damagecompassalpha/100.0f); + } + dirs++; + + glPushMatrix(); + glTranslatef(screen->w/2, screen->h/2, 0); + glRotatef(i*90, 0, 0, 1); + glTranslatef(0, -size/2.0f-min(screen->h, screen->w)/4.0f, 0); + float logscale = 32, + scale = log(1 + (logscale - 1)*dcompass[i]) / log(logscale); + glScalef(size*scale, size*scale, 0); + + glBegin(GL_TRIANGLES); + glVertex3f(1, 1, 0); + glVertex3f(-1, 1, 0); + glVertex3f(0, 0, 0); + glEnd(); + glPopMatrix(); + + // fade in log space so short blips don't disappear too quickly + scale -= float(curtime)/damagecompassfade; + dcompass[i] = scale > 0 ? (pow(logscale, scale) - 1) / (logscale - 1) : 0; + } +} + +VARNP(damageblend, usedamageblend, 0, 1, 1); +VARP(damageblendfactor, 1, 300, 1000); + +float dblend = 0; +void damageblend(int n) { if(usedamageblend) dblend += n; } + +VARP(hidestats, 0, 0, 1); +VARP(hidehud, 0, 0, 1); + +VARP(crosshairsize, 0, 15, 50); +VARP(cursorsize, 0, 30, 50); +VARP(crosshairfx, 0, 1, 1); + +#define MAXCROSSHAIRS 4 +static Texture *crosshairs[MAXCROSSHAIRS] = { NULL, NULL, NULL, NULL }; + +void loadcrosshair(const char *name, int i) +{ + if(i < 0 || i >= MAXCROSSHAIRS) return; + crosshairs[i] = name ? textureload(name, 3, true) : notexture; + if(crosshairs[i] == notexture) + { + name = cl->defaultcrosshair(i); + if(!name) name = "data/crosshair.png"; + crosshairs[i] = textureload(name, 3, true); + } +} + +void loadcrosshair_(const char *name, int *i) +{ + loadcrosshair(name, *i); +} + +COMMANDN(loadcrosshair, loadcrosshair_, "si"); + +void writecrosshairs(FILE *f) +{ + loopi(MAXCROSSHAIRS) if(crosshairs[i] && crosshairs[i]!=notexture) + fprintf(f, "loadcrosshair \"%s\" %d\n", crosshairs[i]->name, i); + fprintf(f, "\n"); +} + +void drawcrosshair(int w, int h) +{ + bool windowhit = g3d_windowhit(true, false); + if(!windowhit && hidehud) return; //(hidehud || player->state==CS_SPECTATOR || player->state==CS_DEAD)) return; + + float r = 1, g = 1, b = 1, cx = 0.5f, cy = 0.5f, chsize; + Texture *crosshair; + if(windowhit) + { + static Texture *cursor = NULL; + if(!cursor) cursor = textureload("data/guicursor.png", 3, true); + crosshair = cursor; + chsize = cursorsize*w/300.0f; + g3d_cursorpos(cx, cy); + } + else + { + int index = cl->selectcrosshair(r, g, b); + if(index < 0) return; + if(!crosshairfx) + { + index = 0; + r = g = b = 1; + } + crosshair = crosshairs[index]; + if(!crosshair) + { + loadcrosshair(NULL, index); + crosshair = crosshairs[index]; + } + chsize = crosshairsize*w/300.0f; + } + if(crosshair->bpp==32) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + else glBlendFunc(GL_ONE, GL_ONE); + glColor3f(r, g, b); + float x = cx*w*3.0f - (windowhit ? 0 : chsize/2.0f); + float y = cy*h*3.0f - (windowhit ? 0 : chsize/2.0f); + glBindTexture(GL_TEXTURE_2D, crosshair->id); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(x, y); + glTexCoord2f(1, 0); glVertex2f(x + chsize, y); + glTexCoord2f(1, 1); glVertex2f(x + chsize, y + chsize); + glTexCoord2f(0, 1); glVertex2f(x, y + chsize); + glEnd(); +} + +VARP(showfpsrange, 0, 0, 1); +VAR(showeditstats, 0, 0, 1); +VAR(statrate, 0, 200, 1000); + +void gl_drawhud(int w, int h, int fogmat, float fogblend, int abovemat) +{ + if(editmode && !hidehud) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + glDepthMask(GL_FALSE); + cursorupdate(); + glDepthMask(GL_TRUE); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + } + + glDisable(GL_DEPTH_TEST); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + gettextres(w, h); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, w, h, 0, -1, 1); + + glColor3f(1, 1, 1); + + extern int debugsm; + if(debugsm) + { + extern void viewshadowmap(); + viewshadowmap(); + } + + extern int debugglare; + if(debugglare) + { + extern void viewglaretex(); + viewglaretex(); + } + + extern int debugdepthfx; + if(debugdepthfx) + { + extern void viewdepthfxtex(); + viewdepthfxtex(); + } + + glEnable(GL_BLEND); + + if(dblend || fogmat==MAT_WATER || fogmat==MAT_LAVA) + { + glBlendFunc(GL_ZERO, GL_SRC_COLOR); + if(dblend) + { + glColor3f(1.0f, 0.1f, 0.1f); + dblend -= curtime*(100.0f/damageblendfactor); + if(dblend<0) dblend = 0; + } + else + { + float overlay[3] = { 0, 0, 0 }; + blendfogoverlay(fogmat, fogblend, overlay); + blendfogoverlay(abovemat, 1-fogblend, overlay); + glColor3fv(overlay); + } + glBegin(GL_QUADS); + glVertex2f(0, 0); + glVertex2f(w, 0); + glVertex2f(w, h); + glVertex2f(0, h); + glEnd(); + } + + drawdamagecompass(); + + glEnable(GL_TEXTURE_2D); + defaultshader->set(); + + glLoadIdentity(); + glOrtho(0, w*3, h*3, 0, -1, 1); + + drawcrosshair(w, h); + + int abovehud = h*3 - FONTH; + + if(!hidehud) + { + /*int coff = */ renderconsole(w, h); + // can render stuff below console output here + + if(!hidestats) + { + extern void getfps(int &fps, int &bestdiff, int &worstdiff); + int fps, bestdiff, worstdiff; + getfps(fps, bestdiff, worstdiff); + if(showfpsrange) draw_textf("fps %d+%d-%d", w*3-7*FONTH, h*3-100, fps, bestdiff, worstdiff); + else draw_textf("fps %d", w*3-5*FONTH, h*3-100, fps); + + if(editmode || showeditstats) + { + static int laststats = 0, prevstats[8] = { 0, 0, 0, 0, 0, 0, 0 }, curstats[8] = { 0, 0, 0, 0, 0, 0, 0 }; + if(totalmillis - laststats >= statrate) + { + memcpy(prevstats, curstats, sizeof(prevstats)); + laststats = totalmillis - (totalmillis%statrate); + } + int nextstats[8] = + { + vtris*100/max(wtris, 1), + vverts*100/max(wverts, 1), + xtraverts/1024, + xtravertsva/1024, + glde, + gbatches, + getnumqueries(), + rplanes + }; + loopi(8) if(prevstats[i]==curstats[i]) curstats[i] = nextstats[i]; + + abovehud -= 2*FONTH; + draw_textf("wtr:%dk(%d%%) wvt:%dk(%d%%) evt:%dk eva:%dk", FONTH/2, abovehud, wtris/1024, curstats[0], wverts/1024, curstats[1], curstats[2], curstats[3]); + draw_textf("ond:%d va:%d gl:%d(%d) oq:%d lm:%d rp:%d pvs:%d", FONTH/2, abovehud+FONTH, allocnodes*8, allocva, curstats[4], curstats[5], curstats[6], lightmaps.length(), curstats[7], getnumviewcells()); + g3d_limitscale((2*abovehud - h*3) / float(h*3)); + } + + if(editmode) + { + abovehud -= FONTH; + draw_textf("cube %s%d", FONTH/2, abovehud, selchildcount<0 ? "1/" : "", abs(selchildcount)); + + char *editinfo = executeret("edithud"); + if(editinfo) + { + abovehud -= FONTH; + draw_text(editinfo, FONTH/2, abovehud); + DELETEA(editinfo); + } + } + } + + if(!editmode && !showeditstats) + { + cl->gameplayhud(w, h); + abovehud = int(h*3*cl->abovegameplayhud()); + g3d_limitscale((2*abovehud - h*3) / float(h*3)); + } + + render_texture_panel(w, h); + } + else g3d_limitscale((2*abovehud - h*3) / float(h*3)); + + glLoadIdentity(); + glOrtho(0, w*3, h*3, 0, -1, 1); + + rendercommand(FONTH/2, abovehud - FONTH*3/2, w*3-FONTH); + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + glEnable(GL_DEPTH_TEST); +} + diff --git a/src/engine/rendermodel.cpp b/src/engine/rendermodel.cpp new file mode 100644 index 0000000..58afdb9 --- /dev/null +++ b/src/engine/rendermodel.cpp @@ -0,0 +1,1000 @@ +#include "pch.h" +#include "engine.h" + +VARP(oqdynent, 0, 1, 1); +VARP(animationinterpolationtime, 0, 150, 1000); + +model *loadingmodel = NULL; + +#include "animmodel.h" +#include "vertmodel.h" +#include "skelmodel.h" +#include "md2.h" +#include "md3.h" +#include "md5.h" +#include "obj.h" + +#define checkmdl if(!loadingmodel) { conoutf(CON_ERROR, "not loading a model"); return; } + +void mdlcullface(int *cullface) +{ + checkmdl; + loadingmodel->cullface = *cullface!=0; +} + +COMMAND(mdlcullface, "i"); + +void mdlcollide(int *collide) +{ + checkmdl; + loadingmodel->collide = *collide!=0; +} + +COMMAND(mdlcollide, "i"); + +void mdlellipsecollide(int *collide) +{ + checkmdl; + loadingmodel->ellipsecollide = *collide!=0; +} + +COMMAND(mdlellipsecollide, "i"); + +void mdlspec(int *percent) +{ + checkmdl; + float spec = 1.0f; + if(*percent>0) spec = *percent/100.0f; + else if(*percent<0) spec = 0.0f; + loadingmodel->setspec(spec); +} + +COMMAND(mdlspec, "i"); + +void mdlambient(int *percent) +{ + checkmdl; + float ambient = 0.3f; + if(*percent>0) ambient = *percent/100.0f; + else if(*percent<0) ambient = 0.0f; + loadingmodel->setambient(ambient); +} + +COMMAND(mdlambient, "i"); + +void mdlalphatest(float *cutoff) +{ + checkmdl; + loadingmodel->setalphatest(max(0.0f, min(1.0f, *cutoff))); +} + +COMMAND(mdlalphatest, "f"); + +void mdlalphablend(int *blend) +{ + checkmdl; + loadingmodel->setalphablend(*blend!=0); +} + +COMMAND(mdlalphablend, "i"); + +void mdlglow(int *percent) +{ + checkmdl; + float glow = 3.0f; + if(*percent>0) glow = *percent/100.0f; + else if(*percent<0) glow = 0.0f; + loadingmodel->setglow(glow); +} + +COMMAND(mdlglow, "i"); + +void mdlglare(float *specglare, float *glowglare) +{ + checkmdl; + loadingmodel->setglare(*specglare, *glowglare); +} + +COMMAND(mdlglare, "ff"); + +void mdlenvmap(float *envmapmax, float *envmapmin, char *envmap) +{ + checkmdl; + loadingmodel->setenvmap(*envmapmin, *envmapmax, envmap[0] ? cubemapload(envmap) : NULL); +} + +COMMAND(mdlenvmap, "ffs"); + +void mdltranslucent(float *translucency) +{ + checkmdl; + loadingmodel->settranslucency(*translucency); +} + +COMMAND(mdltranslucent, "f"); + +void mdlfullbright(float *fullbright) +{ + checkmdl; + loadingmodel->setfullbright(*fullbright); +} + +COMMAND(mdlfullbright, "f"); + +void mdlshader(char *shader) +{ + checkmdl; + loadingmodel->setshader(lookupshaderbyname(shader)); +} + +COMMAND(mdlshader, "s"); + +void mdlspin(float *rate) +{ + checkmdl; + loadingmodel->spin = *rate; +} + +COMMAND(mdlspin, "f"); + +void mdlscale(int *percent) +{ + checkmdl; + float scale = 0.3f; + if(*percent>0) scale = *percent/100.0f; + else if(*percent<0) scale = 0.0f; + loadingmodel->scale = scale; +} + +COMMAND(mdlscale, "i"); + +void mdltrans(float *x, float *y, float *z) +{ + checkmdl; + loadingmodel->translate = vec(*x, *y, *z); +} + +COMMAND(mdltrans, "fff"); + +void mdlyaw(float *angle) +{ + checkmdl; + loadingmodel->offsetyaw = *angle; +} + +COMMAND(mdlyaw, "f"); + +void mdlpitch(float *angle) +{ + checkmdl; + loadingmodel->offsetpitch = *angle; +} + +COMMAND(mdlpitch, "f"); + +void mdlshadow(int *shadow) +{ + checkmdl; + loadingmodel->shadow = *shadow!=0; +} + +COMMAND(mdlshadow, "i"); + +void mdlbb(float *rad, float *h, float *eyeheight) +{ + checkmdl; + loadingmodel->collideradius = *rad; + loadingmodel->collideheight = *h; + loadingmodel->eyeheight = *eyeheight; +} + +COMMAND(mdlbb, "fff"); + +void mdlname() +{ + checkmdl; + result(loadingmodel->name()); +} + +COMMAND(mdlname, ""); + +// mapmodels + +vector mapmodels; + +void mmodel(char *name) +{ + mapmodelinfo &mmi = mapmodels.add(); + s_strcpy(mmi.name, name); + mmi.m = NULL; +} + +void mapmodelcompat(int *rad, int *h, int *tex, char *name, char *shadow) +{ + mmodel(name); +} + +void mapmodelreset() { mapmodels.setsize(0); } + +mapmodelinfo &getmminfo(int i) { return mapmodels.inrange(i) ? mapmodels[i] : *(mapmodelinfo *)0; } +const char *mapmodelname(int i) { return mapmodels.inrange(i) ? mapmodels[i].name : NULL; } + +COMMAND(mmodel, "s"); +COMMANDN(mapmodel, mapmodelcompat, "iiiss"); +COMMAND(mapmodelreset, ""); +ICOMMAND(mapmodelname, "i", (int *index), { result(mapmodels.inrange(*index) ? mapmodels[*index].name : ""); }); +ICOMMAND(nummapmodels, "", (), { intret(mapmodels.length()); }); + +// model registry + +hashtable mdllookup; + +model *loadmodel(const char *name, int i, bool msg) +{ + if(!name) + { + if(!mapmodels.inrange(i)) return NULL; + mapmodelinfo &mmi = mapmodels[i]; + if(mmi.m) return mmi.m; + name = mmi.name; + } + model **mm = mdllookup.access(name); + model *m; + if(mm) m = *mm; + else + { + if(msg) + { + s_sprintfd(filename)("packages/models/%s", name); + show_out_of_renderloop_progress(0, filename); + } + m = new md2(name); + loadingmodel = m; + if(!m->load()) + { + delete m; + m = new md3(name); + loadingmodel = m; + if(!m->load()) + { + delete m; + m = new md5(name); + loadingmodel = m; + if(!m->load()) + { + delete m; + m = new obj(name); + loadingmodel = m; + if(!m->load()) + { + delete m; + loadingmodel = NULL; + return NULL; + } + } + } + } + loadingmodel = NULL; + mdllookup.access(m->name(), &m); + } + if(mapmodels.inrange(i) && !mapmodels[i].m) mapmodels[i].m = m; + return m; +} + +void clear_mdls() +{ + enumerate(mdllookup, model *, m, delete m); +} + +void cleanupmodels() +{ + enumerate(mdllookup, model *, m, m->cleanup()); +} + +void clearmodel(char *name) +{ + model **m = mdllookup.access(name); + if(!m) { conoutf("model %s is not loaded", name); return; } + mdllookup.remove(name); + (*m)->cleanup(); + delete *m; + conoutf("cleared model %s", name); +} + +COMMAND(clearmodel, "s"); + +bool modeloccluded(const vec ¢er, float radius) +{ + int br = int(radius*2)+1; + return pvsoccluded(ivec(int(center.x-radius), int(center.y-radius), int(center.z-radius)), ivec(br, br, br)) || + bboccluded(ivec(int(center.x-radius), int(center.y-radius), int(center.z-radius)), ivec(br, br, br)); +} + +VAR(showboundingbox, 0, 0, 2); + +void render2dbox(vec &o, float x, float y, float z) +{ + glBegin(GL_LINE_LOOP); + glVertex3f(o.x, o.y, o.z); + glVertex3f(o.x, o.y, o.z+z); + glVertex3f(o.x+x, o.y+y, o.z+z); + glVertex3f(o.x+x, o.y+y, o.z); + glEnd(); +} + +void render3dbox(vec &o, float tofloor, float toceil, float xradius, float yradius) +{ + if(yradius<=0) yradius = xradius; + vec c = o; + c.sub(vec(xradius, yradius, tofloor)); + float xsz = xradius*2, ysz = yradius*2; + float h = tofloor+toceil; + notextureshader->set(); + glDisable(GL_TEXTURE_2D); + glColor3f(1, 1, 1); + render2dbox(c, xsz, 0, h); + render2dbox(c, 0, ysz, h); + c.add(vec(xsz, ysz, 0)); + render2dbox(c, -xsz, 0, h); + render2dbox(c, 0, -ysz, h); + xtraverts += 16; + glEnable(GL_TEXTURE_2D); +} + +void renderellipse(vec &o, float xradius, float yradius, float yaw) +{ + notextureshader->set(); + glDisable(GL_TEXTURE_2D); + glColor3f(0.5f, 0.5f, 0.5f); + glBegin(GL_LINE_LOOP); + loopi(16) + { + vec p(xradius*cosf(2*M_PI*i/16.0f), yradius*sinf(2*M_PI*i/16.0f), 0); + p.rotate_around_z((yaw+90)*RAD); + p.add(o); + glVertex3fv(p.v); + } + glEnd(); + glEnable(GL_TEXTURE_2D); +} + +void setshadowmatrix(const plane &p, const vec &dir) +{ + float d = p.dot(dir); + GLfloat m[16] = + { + d-dir.x*p.x, -dir.y*p.x, -dir.z*p.x, 0, + -dir.x*p.y, d-dir.y*p.y, -dir.z*p.y, 0, + -dir.x*p.z, -dir.y*p.z, d-dir.z*p.z, 0, + -dir.x*p.offset, -dir.y*p.offset, -dir.z*p.offset, d + }; + glMultMatrixf(m); +} + +VARP(bounddynshadows, 0, 1, 1); +VARP(dynshadow, 0, 60, 100); + +void rendershadow(vec &dir, model *m, int anim, const vec &o, vec center, float radius, float yaw, float pitch, float speed, int basetime, dynent *d, int cull, modelattach *a) +{ + vec floor; + float dist = rayfloor(center, floor, 0, center.z); + if(dist<=0 || dist>=center.z) return; + center.z -= dist; + if((cull&MDL_CULL_VFC) && refracting<0 && center.z>=reflectz) return; + if(vec(center).sub(camera1->o).dot(floor)>0) return; + + vec shaddir; + if(cull&MDL_DYNSHADOW) + { + extern vec shadowdir; + shaddir = shadowdir; + shaddir.normalize(); + } + else + { + shaddir = dir; + shaddir.z = 0; + if(!shaddir.iszero()) shaddir.normalize(); + shaddir.z = 1.5f*(dir.z*0.5f+1); + shaddir.normalize(); + } + + glDisable(GL_TEXTURE_2D); + glDepthMask(GL_FALSE); + + if(!hasFBO || !reflecting || !refracting || hasDS) + { + glEnable(GL_STENCIL_TEST); + + if(bounddynshadows) + { + nocolorshader->set(); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + glStencilFunc(GL_ALWAYS, 1, 1); + glStencilOp(GL_KEEP, GL_REPLACE, GL_ZERO); + + vec below(center); + below.z -= 1.0f; + glPushMatrix(); + setshadowmatrix(plane(floor, -floor.dot(below)), shaddir); + glBegin(GL_QUADS); + loopi(6) if((shaddir[dimension(i)]>0)==dimcoord(i)) loopj(4) + { + const ivec &cc = cubecoords[fv[i][j]]; + glVertex3f(center.x + (cc.x ? 1.5f : -1.5f)*radius, + center.y + (cc.y ? 1.5f : -1.5f)*radius, + cc.z ? center.z + dist + radius : below.z); + xtraverts += 4; + } + glEnd(); + glPopMatrix(); + + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, fading ? GL_FALSE : GL_TRUE); + } + } + + float intensity = dynshadow/100.0f; + if(fogging) + { + if(renderpath!=R_FIXEDFUNCTION) setfogplane(0, max(0.1f, reflectz-center.z)); + else intensity *= 1.0f - max(0.0f, min(1.0f, (reflectz - center.z)/waterfog)); + } + if((anim&ANIM_INDEX)==ANIM_DYING) intensity *= max(1.0f - (lastmillis - basetime)/1000.0f, 0.0f); + glColor4f(0, 0, 0, intensity); + + if(!hasFBO || !reflecting || !refracting || hasDS) + { + glStencilFunc(GL_NOTEQUAL, bounddynshadows ? 0 : 1, 1); + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + } + + vec above(center); + above.z += 0.25f; + + glPushMatrix(); + setshadowmatrix(plane(floor, -floor.dot(above)), shaddir); + m->render(anim|ANIM_NOSKIN|ANIM_SHADOW, speed, basetime, o, yaw, pitch, d, a); + glPopMatrix(); + + glEnable(GL_TEXTURE_2D); + glDepthMask(GL_TRUE); + + if(!hasFBO || !reflecting || !refracting || hasDS) glDisable(GL_STENCIL_TEST); +} + +struct batchedmodel +{ + vec pos, color, dir; + int anim; + float yaw, pitch, speed; + int basetime, cull; + dynent *d; + int attached; + occludequery *query; +}; +struct modelbatch +{ + model *m; + vector batched; +}; +static vector batches; +static vector modelattached; +static int numbatches = -1; +static occludequery *modelquery = NULL; + +void startmodelbatches() +{ + numbatches = 0; + modelattached.setsizenodelete(0); +} + +batchedmodel &addbatchedmodel(model *m) +{ + modelbatch *b = NULL; + if(m->batch>=0 && m->batchbatch]->m==m) b = batches[m->batch]; + else + { + if(numbatchesbatched.setsizenodelete(0); + } + else b = batches.add(new modelbatch); + b->m = m; + m->batch = numbatches++; + } + batchedmodel &bm = b->batched.add(); + bm.query = modelquery; + return bm; +} + +void renderbatchedmodel(model *m, batchedmodel &b) +{ + modelattach *a = NULL; + if(b.attached>=0) a = &modelattached[b.attached]; + if((!shadowmap || renderpath==R_FIXEDFUNCTION) && (b.cull&(MDL_SHADOW|MDL_DYNSHADOW)) && dynshadow && hasstencil && !reflecting && refracting<=0) + { + vec center; + float radius = m->boundsphere(0/*frame*/, center, a); // FIXME + center.add(b.pos); + rendershadow(b.dir, m, b.anim, b.pos, center, radius, b.yaw, b.pitch, b.speed, b.basetime, b.d, b.cull, a); + if((b.cull&MDL_CULL_VFC) && refracting<0 && center.z-radius>=reflectz) return; + } + + int anim = b.anim; + if(shadowmapping) + { + anim |= ANIM_NOSKIN; + setenvparamf("shadowintensity", SHPARAM_VERTEX, 1, + (anim&ANIM_INDEX)==ANIM_DYING ? max(1.0f - (lastmillis - b.basetime)/1000.0f, 0.0f) : 1.0f); + } + else + { + if(b.cull&MDL_TRANSLUCENT) anim |= ANIM_TRANSLUCENT; + if(b.cull&MDL_FULLBRIGHT) anim |= ANIM_FULLBRIGHT; + } + + m->render(anim, b.speed, b.basetime, b.pos, b.yaw, b.pitch, b.d, a, b.color, b.dir); +} + +struct translucentmodel +{ + model *m; + batchedmodel *batched; + float dist; +}; + +static int sorttranslucentmodels(const translucentmodel *x, const translucentmodel *y) +{ + if(x->dist > y->dist) return -1; + if(x->dist < y->dist) return 1; + return 0; +} + +void endmodelbatches() +{ + vector translucent; + loopi(numbatches) + { + modelbatch &b = *batches[i]; + if(b.batched.empty()) continue; + bool rendered = false; + occludequery *query = NULL; + loopvj(b.batched) + { + batchedmodel &bm = b.batched[j]; + if(bm.query!=query) + { + if(query) endquery(query); + query = bm.query; + if(query) startquery(query); + } + if(bm.cull&MDL_TRANSLUCENT && (!query || query->owner==bm.d)) + { + translucentmodel &tm = translucent.add(); + tm.m = b.m; + tm.batched = &bm; + tm.dist = camera1->o.dist(bm.pos); + continue; + } + if(!rendered) { b.m->startrender(); rendered = true; } + renderbatchedmodel(b.m, bm); + } + if(query) endquery(query); + if(rendered) b.m->endrender(); + } + if(translucent.length()) + { + translucent.sort(sorttranslucentmodels); + model *lastmodel = NULL; + occludequery *query = NULL; + loopv(translucent) + { + translucentmodel &tm = translucent[i]; + if(lastmodel!=tm.m) + { + if(lastmodel) lastmodel->endrender(); + (lastmodel = tm.m)->startrender(); + } + if(query!=tm.batched->query) + { + if(query) endquery(query); + query = tm.batched->query; + if(query) startquery(query); + } + renderbatchedmodel(tm.m, *tm.batched); + } + if(query) endquery(query); + if(lastmodel) lastmodel->endrender(); + } + numbatches = -1; +} + +void startmodelquery(occludequery *query) +{ + modelquery = query; +} + +void endmodelquery() +{ + int querybatches = 0; + loopi(numbatches) + { + modelbatch &b = *batches[i]; + if(b.batched.empty() || b.batched.last().query!=modelquery) continue; + querybatches++; + } + if(querybatches<=1) + { + if(!querybatches) modelquery->fragments = 0; + modelquery = NULL; + return; + } + int minattached = modelattached.length(); + startquery(modelquery); + loopi(numbatches) + { + modelbatch &b = *batches[i]; + if(b.batched.empty() || b.batched.last().query!=modelquery) continue; + b.m->startrender(); + do + { + batchedmodel &bm = b.batched.pop(); + if(bm.attached>=0) minattached = min(minattached, bm.attached); + renderbatchedmodel(b.m, bm); + } + while(b.batched.length() && b.batched.last().query==modelquery); + b.m->endrender(); + } + endquery(modelquery); + modelquery = NULL; + modelattached.setsizenodelete(minattached); +} + +VARP(maxmodelradiusdistance, 10, 200, 1000); + +void rendermodelquery(model *m, dynent *d, const vec ¢er, float radius) +{ + if(fabs(camera1->o.x-center.x) < radius+1 && + fabs(camera1->o.y-center.y) < radius+1 && + fabs(camera1->o.z-center.z) < radius+1) + { + d->query = NULL; + return; + } + d->query = newquery(d); + if(!d->query) return; + nocolorshader->set(); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + glDepthMask(GL_FALSE); + startquery(d->query); + int br = int(radius*2)+1; + drawbb(ivec(int(center.x-radius), int(center.y-radius), int(center.z-radius)), ivec(br, br, br)); + endquery(d->query); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, fading ? GL_FALSE : GL_TRUE); + glDepthMask(GL_TRUE); +} + +extern int oqfrags; + +void rendermodel(entitylight *light, const char *mdl, int anim, const vec &o, float yaw, float pitch, int cull, dynent *d, modelattach *a, int basetime, float speed) +{ + if(shadowmapping && !(cull&(MDL_SHADOW|MDL_DYNSHADOW))) return; + model *m = loadmodel(mdl); + if(!m) return; + vec center; + float radius = 0; + bool shadow = (!shadowmap || renderpath==R_FIXEDFUNCTION) && (cull&(MDL_SHADOW|MDL_DYNSHADOW)) && dynshadow && hasstencil, + doOQ = cull&MDL_CULL_QUERY && hasOQ && oqfrags && oqdynent; + if(cull&(MDL_CULL_VFC|MDL_CULL_DIST|MDL_CULL_OCCLUDED|MDL_CULL_QUERY|MDL_SHADOW|MDL_DYNSHADOW)) + { + radius = m->boundsphere(0/*frame*/, center, a); // FIXME + center.rotate_around_z((-180-yaw)*RAD); + center.add(o); + if(cull&MDL_CULL_DIST && center.dist(camera1->o)/radius>maxmodelradiusdistance) return; + if(cull&MDL_CULL_VFC) + { + if(reflecting || refracting) + { + if(reflecting || refracting>0) + { + if(center.z+radius<=reflectz) return; + } + else + { + if(fogging && center.z+radius=reflectz) return; + } + if(center.dist(camera1->o)-radius>reflectdist) return; + } + if(isvisiblesphere(radius, center) >= VFC_FOGGED) return; + if(shadowmapping && !isshadowmapcaster(center, radius)) return; + } + if(shadowmapping) + { + if(d) + { + if(cull&MDL_CULL_OCCLUDED && d->occluded>=OCCLUDE_PARENT) return; + if(doOQ && d->occluded+1>=OCCLUDE_BB && d->query && d->query->owner==d && checkquery(d->query)) return; + } + if(!addshadowmapcaster(center, radius, radius)) return; + } + else if(cull&MDL_CULL_OCCLUDED && modeloccluded(center, radius)) + { + if(!reflecting && !refracting && d) + { + d->occluded = OCCLUDE_PARENT; + if(doOQ) rendermodelquery(m, d, center, radius); + } + return; + } + else if(doOQ && d && d->query && d->query->owner==d && checkquery(d->query)) + { + if(!reflecting && !refracting) + { + if(d->occludedoccluded++; + rendermodelquery(m, d, center, radius); + } + return; + } + } + if(showboundingbox && !shadowmapping && !reflecting && !refracting) + { + if(d && showboundingbox==1) + { + render3dbox(d->o, d->eyeheight, d->aboveeye, d->radius); + renderellipse(d->o, d->xradius, d->yradius, d->yaw); + } + else + { + vec center, radius; + if(showboundingbox==1) m->collisionbox(0, center, radius); + else m->boundbox(0, center, radius); + rotatebb(center, radius, int(yaw)); + center.add(o); + render3dbox(center, radius.z, radius.z, radius.x, radius.y); + } + } + + vec lightcolor(1, 1, 1), lightdir(0, 0, 1); + if(!shadowmapping) + { + if(d) + { + if(!reflecting && !refracting) d->occluded = OCCLUDE_NOTHING; + if(!light) light = &d->light; + if(cull&MDL_LIGHT && light->millis!=lastmillis) + { + lightreaching(d->o, light->color, light->dir); + dynlightreaching(o, light->color, light->dir); + cl->lighteffects(d, light->color, light->dir); + light->millis = lastmillis; + } + } + else if(cull&MDL_LIGHT) + { + if(!light) + { + lightreaching(o, lightcolor, lightdir); + dynlightreaching(o, lightcolor, lightdir); + } + else if(light->millis!=lastmillis) + { + lightreaching(o, light->color, light->dir); + dynlightreaching(o, light->color, light->dir); + light->millis = lastmillis; + } + } + if(light) { lightcolor = light->color; lightdir = light->dir; } + if(cull&MDL_DYNLIGHT) dynlightreaching(o, lightcolor, lightdir); + } + + if(a) for(int i = 0; a[i].name; i++) + { + a[i].m = loadmodel(a[i].name); + //if(a[i].m && a[i].m->type()!=m->type()) a[i].m = NULL; + } + + if(!d || reflecting || refracting || shadowmapping) doOQ = false; + + if(numbatches>=0) + { + batchedmodel &b = addbatchedmodel(m); + b.pos = o; + b.color = lightcolor; + b.dir = lightdir; + b.anim = anim; + b.yaw = yaw; + b.pitch = pitch; + b.speed = speed; + b.basetime = basetime; + b.cull = cull; + b.d = d; + b.attached = a ? modelattached.length() : -1; + if(a) for(int i = 0;; i++) { modelattached.add(a[i]); if(!a[i].name) break; } + if(doOQ) d->query = b.query = newquery(d); + return; + } + + m->startrender(); + + if(shadow && !reflecting && refracting<=0) + { + rendershadow(lightdir, m, anim, o, center, radius, yaw, pitch, speed, basetime, d, cull, a); + if((cull&MDL_CULL_VFC) && refracting<0 && center.z-radius>=reflectz) { m->endrender(); return; } + } + + if(shadowmapping) + { + anim |= ANIM_NOSKIN; + setenvparamf("shadowintensity", SHPARAM_VERTEX, 1, + (anim&ANIM_INDEX)==ANIM_DYING ? max(1.0f - (lastmillis - basetime)/1000.0f, 0.0f) : 1.0f); + } + else + { + if(cull&MDL_TRANSLUCENT) anim |= ANIM_TRANSLUCENT; + if(cull&MDL_FULLBRIGHT) anim |= ANIM_FULLBRIGHT; + } + + if(doOQ) + { + d->query = newquery(d); + if(d->query) startquery(d->query); + } + + m->render(anim, speed, basetime, o, yaw, pitch, d, a, lightcolor, lightdir); + + if(doOQ && d->query) endquery(d->query); + + m->endrender(); +} + +void abovemodel(vec &o, const char *mdl) +{ + model *m = loadmodel(mdl); + if(!m) return; + o.z += m->above(0/*frame*/); +} + +bool matchanim(const char *name, const char *pattern) +{ + for(;; pattern++) + { + const char *s = name; + char c; + for(;; pattern++) + { + c = *pattern; + if(!c || c=='|') break; + else if(c=='*') + { + if(!*s || isspace(*s)) break; + do s++; while(*s && !isspace(*s)); + } + else if(c!=*s) break; + else s++; + } + if(!*s && (!c || c=='|')) return true; + pattern = strchr(pattern, '|'); + if(!pattern) break; + } + return false; +} + +void findanims(const char *pattern, vector &anims) +{ + static const char *names[] = + { + "dead", "dying", "idle", + "forward", "backward", "left", "right", + "punch", "shoot", "pain", + "jump", "sink", "swim", + "edit", "lag", "taunt", "win", "lose", + "gun shoot", "gun idle", + "vwep", "shield", "powerup", + "mapmodel", "trigger" + }; + loopi(sizeof(names)/sizeof(names[0])) if(matchanim(names[i], pattern)) anims.add(i); +} + +void loadskin(const char *dir, const char *altdir, Texture *&skin, Texture *&masks) // model skin sharing +{ +#define ifnoload(tex, path) if((tex = textureload(path, 0, true, false))==notexture) +#define tryload(tex, prefix, name) \ + ifnoload(tex, makerelpath(mdir, name ".jpg", prefix)) \ + { \ + ifnoload(tex, makerelpath(mdir, name ".png", prefix)) \ + { \ + ifnoload(tex, makerelpath(maltdir, name ".jpg", prefix)) \ + { \ + ifnoload(tex, makerelpath(maltdir, name ".png", prefix)) return; \ + } \ + } \ + } + + s_sprintfd(mdir)("packages/models/%s", dir); + s_sprintfd(maltdir)("packages/models/%s", altdir); + masks = notexture; + tryload(skin, NULL, "skin"); + tryload(masks, "", "masks"); +} + +// convenient function that covers the usual anims for players/monsters/npcs + +VAR(animoverride, -1, 0, NUMANIMS-1); +VAR(testanims, 0, 0, 1); +VAR(testpitch, -90, 0, 90); + +void renderclient(dynent *d, const char *mdlname, modelattach *attachments, int attack, int attackdelay, int lastaction, int lastpain, float sink) +{ + int anim = ANIM_IDLE|ANIM_LOOP; + float yaw = d->yaw, pitch = d->pitch; + vec o(d->o); + o.z -= d->eyeheight + sink; + int basetime = 0; + if(animoverride) anim = (animoverride<0 ? ANIM_ALL : animoverride)|ANIM_LOOP; + else if(d->state==CS_DEAD) + { + pitch = 0; + anim = ANIM_DYING; + basetime = lastpain; + int t = lastmillis-lastpain; + if(t<0 || t>20000) return; + if(t>1000) { anim = ANIM_DEAD|ANIM_LOOP; if(t>1600) { t -= 1600; o.z -= t*t/10000000000.0f*t/16.0f; } } + if(o.z<-1000) return; + } + else if(d->state==CS_EDITING || d->state==CS_SPECTATOR) anim = ANIM_EDIT|ANIM_LOOP; + else if(d->state==CS_LAGGED) anim = ANIM_LAG|ANIM_LOOP; + else + { + if(lastmillis-lastpain<300) + { + anim = ANIM_PAIN; + basetime = lastpain; + } + else if(lastpain < lastaction && (attack<0 || (d->type!=ENT_AI && lastmillis-lastactioninwater && d->physstate<=PHYS_FALL) anim |= (((cl->allowmove(d) && (d->move || d->strafe)) || d->vel.z+d->falling.z>0 ? ANIM_SWIM : ANIM_SINK)|ANIM_LOOP)<timeinair>100) anim |= (ANIM_JUMP|ANIM_END)<allowmove(d)) + { + if(d->move>0) anim |= (ANIM_FORWARD|ANIM_LOOP)<strafe) anim |= ((d->strafe>0 ? ANIM_LEFT : ANIM_RIGHT)|ANIM_LOOP)<move<0) anim |= (ANIM_BACKWARD|ANIM_LOOP)<>ANIM_SECONDARY)&ANIM_INDEX) anim >>= ANIM_SECONDARY; + } + if(!((anim>>ANIM_SECONDARY)&ANIM_INDEX)) anim |= (ANIM_IDLE|ANIM_LOOP)<type==ENT_PLAYER) flags |= MDL_FULLBRIGHT; + else flags |= MDL_CULL_DIST; + if(d->state==CS_LAGGED) flags |= MDL_TRANSLUCENT; + else if((anim&ANIM_INDEX)!=ANIM_DEAD) flags |= MDL_DYNSHADOW; + rendermodel(NULL, mdlname, anim, o, testanims && d==player ? 0 : yaw+90, testpitch && d==player ? testpitch : pitch, flags, d, attachments, basetime); +} + +void setbbfrommodel(dynent *d, const char *mdl) +{ + model *m = loadmodel(mdl); + if(!m) return; + vec center, radius; + m->collisionbox(0, center, radius); + if(d->type==ENT_INANIMATE && !m->ellipsecollide) + { + d->collidetype = COLLIDE_AABB; + rotatebb(center, radius, int(d->yaw)); + } + d->xradius = radius.x + fabs(center.x); + d->yradius = radius.y + fabs(center.y); + d->radius = max(d->xradius, d->yradius); + if(d->collidetype!=COLLIDE_ELLIPSE) d->xradius = d->yradius = d->radius; + d->eyeheight = (center.z-radius.z) + radius.z*2*m->eyeheight; + d->aboveeye = radius.z*2*(1.0f-m->eyeheight); +} + diff --git a/src/engine/renderparticles.cpp b/src/engine/renderparticles.cpp new file mode 100644 index 0000000..d321ad3 --- /dev/null +++ b/src/engine/renderparticles.cpp @@ -0,0 +1,1124 @@ +// renderparticles.cpp + +#include "pch.h" +#include "engine.h" +#include "rendertarget.h" + +Shader *particleshader = NULL, *particlenotextureshader = NULL; + +VARP(particlesize, 20, 100, 500); + +// Check emit_particles() to limit the rate that paricles can be emitted for models/sparklies +// Automatically stops particles being emitted when paused or in reflective drawing +VARP(emitmillis, 1, 17, 1000); +static int lastemitframe = 0; +static bool emit = false; + +static bool emit_particles() +{ + if(reflecting || refracting) return false; + return emit; +} + +enum +{ + PT_PART = 0, + PT_TAPE, + PT_TRAIL, + PT_TEXT, + PT_TEXTUP, + PT_METER, + PT_METERVS, + PT_FIREBALL, + PT_LIGHTNING, + PT_FLARE, + + PT_MOD = 1<<8, + PT_RND4 = 1<<9, + PT_LERP = 1<<10, // use very sparingly - order of blending issues + PT_TRACK = 1<<11, + PT_GLARE = 1<<12, +}; + +const char *partnames[] = { "part", "tape", "trail", "text", "textup", "meter", "metervs", "fireball", "lightning", "flare" }; + +struct particle +{ + vec o, d; + int fade, millis; + bvec color; + uchar flags; + float size; + union + { + const char *text; // will call delete[] on this only if it starts with an @ + float val; + physent *owner; + }; +}; + +struct partvert +{ + vec pos; + float u, v; + bvec color; + uchar alpha; +}; + +#define COLLIDERADIUS 8.0f +#define COLLIDEERROR 1.0f + +struct partrenderer +{ + Texture *tex; + const char *texname; + uint type; + int grav, collide; + + partrenderer(const char *texname, int type, int grav, int collide) + : tex(NULL), texname(texname), type(type), grav(grav), collide(collide) + { + } + virtual ~partrenderer() + { + } + + virtual void init(int n) { } + virtual void reset() = NULL; + virtual void resettracked(physent *owner) { } + virtual particle *addpart(const vec &o, const vec &d, int fade, int color, float size) = NULL; + virtual void update() { } + virtual void render() = NULL; + virtual bool haswork() = NULL; + virtual int count() = NULL; //for debug + virtual bool usesvertexarray() { return false; } + virtual void cleanup() {} + + //blend = 0 => remove it + void calc(particle *p, int &blend, int &ts, vec &o, vec &d, bool lastpass = true) + { + o = p->o; + d = p->d; + if(type&PT_TRACK && p->owner) cl->particletrack(p->owner, o, d); + if(p->fade <= 5) + { + ts = 1; + blend = 255; + } + else + { + ts = lastmillis-p->millis; + blend = max(255 - (ts<<8)/p->fade, 0); + if(grav) + { + if(ts > p->fade) ts = p->fade; + float t = (float)(ts); + vec v = d; + v.mul(t/5000.0f); + o.add(v); + o.z -= t*t/(2.0f * 5000.0f * grav); + } + if(collide && o.z < p->val && lastpass) + { + vec surface; + float floorz = rayfloor(vec(o.x, o.y, p->val), surface, RAY_CLIPMAT, COLLIDERADIUS); + float collidez = floorz<0 ? o.z-COLLIDERADIUS : p->val - rayfloor(vec(o.x, o.y, p->val), surface, RAY_CLIPMAT, COLLIDERADIUS); + if(o.z >= collidez+COLLIDEERROR) + p->val = collidez+COLLIDEERROR; + else + { + adddecal(collide, vec(o.x, o.y, collidez), vec(p->o).sub(o).normalize(), 2*p->size, p->color, type&PT_RND4 ? detrnd((size_t)p, 4) : 0); + blend = 0; + } + } + } + } +}; + +struct listparticle : particle +{ + listparticle *next; +}; + +static listparticle *parempty = NULL; + +VARP(outlinemeters, 0, 0, 1); + +struct listrenderer : partrenderer +{ + listparticle *list; + + listrenderer(const char *texname, int type, int grav, int collide) + : partrenderer(texname, type, grav, collide), list(NULL) + { + } + + virtual ~listrenderer() + { + } + + virtual void cleanup(listparticle *p) + { + } + + void reset() + { + if(!list) return; + listparticle *p = list; + for(;;) + { + cleanup(p); + if(p->next) p = p->next; + else break; + } + p->next = parempty; + parempty = list; + list = NULL; + } + + void resettracked(physent *owner) + { + if(!(type&PT_TRACK)) return; + for(listparticle **prev = &list, *cur = list; cur; cur = *prev) + { + if(!owner || cur->owner==owner) + { + *prev = cur->next; + cur->next = parempty; + parempty = cur; + } + else prev = &cur->next; + } + } + + particle *addpart(const vec &o, const vec &d, int fade, int color, float size) + { + if(!parempty) + { + listparticle *ps = new listparticle[256]; + loopi(255) ps[i].next = &ps[i+1]; + ps[255].next = parempty; + parempty = ps; + } + listparticle *p = parempty; + parempty = p->next; + p->next = list; + list = p; + p->o = o; + p->d = d; + p->fade = fade; + p->millis = lastmillis; + p->color = bvec(color>>16, (color>>8)&0xFF, color&0xFF); + p->size = size; + p->owner = NULL; + return p; + } + + int count() + { + int num = 0; + listparticle *lp; + for(lp = list; lp; lp = lp->next) num++; + return num; + } + + bool haswork() + { + return (list != NULL); + } + + virtual void startrender() = 0; + virtual void endrender() = 0; + virtual void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color) = 0; + + void render() + { + startrender(); + if(texname) + { + if(!tex) tex = textureload(texname); + glBindTexture(GL_TEXTURE_2D, tex->id); + } + + bool lastpass = !reflecting && !refracting; + + for(listparticle **prev = &list, *p = list; p; p = *prev) + { + vec o, d; + int blend, ts; + calc(p, blend, ts, o, d, lastpass); + if(blend > 0) + { + renderpart(p, o, d, blend, ts, p->color.v); + + if(p->fade > 5 || !lastpass) + { + prev = &p->next; + continue; + } + } + //remove + *prev = p->next; + p->next = parempty; + cleanup(p); + parempty = p; + } + + endrender(); + } +}; + +struct meterrenderer : listrenderer +{ + meterrenderer(int type) + : listrenderer(NULL, type, 0, 0) + {} + + void startrender() + { + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + particlenotextureshader->set(); + } + + void endrender() + { + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + if(fogging && renderpath!=R_FIXEDFUNCTION) setfogplane(1, reflectz); + particleshader->set(); + } + + void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color) + { + int basetype = type&0xFF; + + glPushMatrix(); + glTranslatef(o.x, o.y, o.z); + if(fogging && renderpath!=R_FIXEDFUNCTION) setfogplane(0, reflectz - o.z, true); + glRotatef(camera1->yaw-180, 0, 0, 1); + glRotatef(camera1->pitch-90, 1, 0, 0); + + float scale = p->size/80.0f; + glScalef(-scale, scale, -scale); + + float right = 8*FONTH, left = p->val*right; + glTranslatef(-right/2.0f, 0, 0); + glColor3ubv(color); + glBegin(GL_TRIANGLE_STRIP); + loopk(10) + { + float c = -0.5f*sinf(k/9.0f*M_PI), s = 0.5f + 0.5f*cosf(k/9.0f*M_PI); + glVertex2f(left - c*FONTH, s*FONTH); + glVertex2f(c*FONTH, s*FONTH); + } + glEnd(); + + if(basetype==PT_METERVS) glColor3ub(color[2], color[1], color[0]); //swap r<->b + else glColor3f(0, 0, 0); + glBegin(GL_TRIANGLE_STRIP); + loopk(10) + { + float c = 0.5f*sinf(k/9.0f*M_PI), s = 0.5f - 0.5f*cosf(k/9.0f*M_PI); + glVertex2f(left + c*FONTH, s*FONTH); + glVertex2f(right + c*FONTH, s*FONTH); + } + glEnd(); + + if(outlinemeters) + { + glColor3f(0, 0.8f, 0); + glBegin(GL_LINE_LOOP); + loopk(10) + { + float c = -0.5f*sinf(k/9.0f*M_PI), s = 0.5f + 0.5f*cosf(k/9.0f*M_PI); + glVertex2f(c*FONTH, s*FONTH); + } + loopk(10) + { + float c = 0.5f*sinf(k/9.0f*M_PI), s = 0.5f - 0.5f*cosf(k/9.0f*M_PI); + glVertex2f(right + c*FONTH, s*FONTH); + } + glEnd(); + + glBegin(GL_LINE_STRIP); + loopk(10) + { + float c = 0.5f*sinf(k/9.0f*M_PI), s = 0.5f - 0.5f*cosf(k/9.0f*M_PI); + glVertex2f(left + c*FONTH, s*FONTH); + } + glEnd(); + } + + glPopMatrix(); + } +}; +static meterrenderer meters(PT_METER|PT_LERP), metervs(PT_METERVS|PT_LERP); + +struct textrenderer : listrenderer +{ + textrenderer(int type, int grav = 0) + : listrenderer(NULL, type, grav, 0) + {} + + void startrender() + { + } + + void endrender() + { + if(fogging && renderpath!=R_FIXEDFUNCTION) setfogplane(1, reflectz); + } + + void cleanup(listparticle *p) + { + if(p->text && p->text[0]=='@') delete[] p->text; + } + + void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color) + { + glPushMatrix(); + glTranslatef(o.x, o.y, o.z); + if(fogging) + { + if(renderpath!=R_FIXEDFUNCTION) setfogplane(0, reflectz - o.z, true); + else blend = (uchar)(blend * max(0.0f, min(1.0f, 1.0f - (reflectz - o.z)/waterfog))); + } + + glRotatef(camera1->yaw-180, 0, 0, 1); + glRotatef(camera1->pitch-90, 1, 0, 0); + + float scale = p->size/80.0f; + glScalef(-scale, scale, -scale); + + const char *text = p->text+(p->text[0]=='@' ? 1 : 0); + float xoff = -text_width(text)/2; + float yoff = 0; + if((type&0xFF)==PT_TEXTUP) { xoff += detrnd((size_t)p, 100)-50; yoff -= detrnd((size_t)p, 101); } //@TODO instead in worldspace beforehand? + glTranslatef(xoff, yoff, 50); + + draw_text(text, 0, 0, color[0], color[1], color[2], blend); + + glPopMatrix(); + } +}; +static textrenderer texts(PT_TEXT|PT_LERP), textups(PT_TEXTUP|PT_LERP, -8); + +template +static inline void modifyblend(const vec &o, int &blend) +{ + blend = min(blend<<2, 255); + if(renderpath==R_FIXEDFUNCTION && fogging) blend = (uchar)(blend * max(0.0f, min(1.0f, 1.0f - (reflectz - o.z)/waterfog))); +} + +template<> +inline void modifyblend(const vec &o, int &blend) +{ +} + +template +static inline void genpos(const vec &o, const vec &d, float size, int grav, int ts, partvert *vs) +{ + vec udir = vec(camup).sub(camright).mul(size); + vec vdir = vec(camup).add(camright).mul(size); + vs[0].pos = vec(o.x + udir.x, o.y + udir.y, o.z + udir.z); + vs[1].pos = vec(o.x + vdir.x, o.y + vdir.y, o.z + vdir.z); + vs[2].pos = vec(o.x - udir.x, o.y - udir.y, o.z - udir.z); + vs[3].pos = vec(o.x - vdir.x, o.y - vdir.y, o.z - vdir.z); +} + +template<> +inline void genpos(const vec &o, const vec &d, float size, int ts, int grav, partvert *vs) +{ + vec dir1 = d, dir2 = d, c; + dir1.sub(o); + dir2.sub(camera1->o); + c.cross(dir2, dir1).normalize().mul(size); + vs[0].pos = vec(d.x-c.x, d.y-c.y, d.z-c.z); + vs[1].pos = vec(o.x-c.x, o.y-c.y, o.z-c.z); + vs[2].pos = vec(o.x+c.x, o.y+c.y, o.z+c.z); + vs[3].pos = vec(d.x+c.x, d.y+c.y, d.z+c.z); +} + +template<> +inline void genpos(const vec &o, const vec &d, float size, int ts, int grav, partvert *vs) +{ + vec e = d; + if(grav) e.z -= float(ts)/grav; + e.div(-75.0f); + e.add(o); + genpos(o, e, size, ts, grav, vs); +} + +template +struct varenderer : partrenderer +{ + partvert *verts; + particle *parts; + int maxparts, numparts, lastupdate; + + varenderer(const char *texname, int type, int grav, int collide) + : partrenderer(texname, type, grav, collide), + verts(NULL), parts(NULL), maxparts(0), numparts(0), lastupdate(-1) + { + } + + void init(int n) + { + DELETEA(parts); + DELETEA(verts); + parts = new particle[n]; + verts = new partvert[n*4]; + maxparts = n; + numparts = 0; + lastupdate = -1; + } + + void reset() + { + numparts = 0; + lastupdate = -1; + } + + void resettracked(physent *owner) + { + if(!(type&PT_TRACK)) return; + loopi(numparts) + { + particle *p = parts+i; + if(!owner || (p->owner == owner)) p->fade = -1; + } + lastupdate = -1; + } + + int count() + { + return numparts; + } + + bool haswork() + { + return (numparts > 0); + } + + bool usesvertexarray() { return true; } + + particle *addpart(const vec &o, const vec &d, int fade, int color, float size) + { + particle *p = parts + (numparts < maxparts ? numparts++ : rnd(maxparts)); //next free slot, or kill a random kitten + p->o = o; + p->d = d; + p->fade = fade; + p->millis = lastmillis; + p->color = bvec(color>>16, (color>>8)&0xFF, color&0xFF); + p->size = size; + p->owner = NULL; + p->flags = 0x80; + int offset = p-parts; + if(type&PT_RND4) p->flags |= detrnd(offset, 4)<<2; + if((type&0xFF)==PT_PART) p->flags |= detrnd(offset*offset+37, 4); + lastupdate = -1; + return p; + } + + void genverts(particle *p, partvert *vs, bool regen) + { + vec o, d; + int blend, ts; + + calc(p, blend, ts, o, d); + if(blend <= 1 || p->fade <= 5) p->fade = -1; //mark to remove on next pass (i.e. after render) + + modifyblend(o, blend); + + if(regen) + { + p->flags &= ~0x80; + + int orient = p->flags&3; + #define SETTEXCOORDS(u1, u2, v1, v2) \ + do { \ + vs[orient].u = u1; \ + vs[orient].v = v2; \ + vs[(orient+1)&3].u = u2; \ + vs[(orient+1)&3].v = v2; \ + vs[(orient+2)&3].u = u2; \ + vs[(orient+2)&3].v = v1; \ + vs[(orient+3)&3].u = u1; \ + vs[(orient+3)&3].v = v1; \ + } while(0) + if(type&PT_RND4) + { + float tx = 0.5f*((p->flags>>2)&1), ty = 0.5f*((p->flags>>3)&1); + SETTEXCOORDS(tx, tx + 0.5f, ty, ty + 0.5f); + } + else SETTEXCOORDS(0, 1, 0, 1); + + #define SETCOLOR(r, g, b, a) \ + do { \ + uchar col[4] = { r, g, b, a }; \ + loopi(4) memcpy(vs[i].color.v, col, sizeof(col)); \ + } while(0) + #define SETMODCOLOR SETCOLOR((p->color[0]*blend)>>8, (p->color[1]*blend)>>8, (p->color[2]*blend)>>8, 255) + if(type&PT_MOD) SETMODCOLOR; + else SETCOLOR(p->color[0], p->color[1], p->color[2], blend); + } + else if(type&PT_MOD) SETMODCOLOR; + else loopi(4) vs[i].alpha = blend; + + genpos(o, d, p->size, ts, grav, vs); + } + + void update() + { + if(lastmillis == lastupdate) return; + lastupdate = lastmillis; + + loopi(numparts) + { + particle *p = &parts[i]; + partvert *vs = &verts[i*4]; + if(p->fade < 0) + { + do + { + --numparts; + if(numparts <= i) return; + } + while(parts[numparts].fade < 0); + *p = parts[numparts]; + genverts(p, vs, true); + } + else genverts(p, vs, (p->flags&0x80)!=0); + } + } + + void render() + { + if(!tex) tex = textureload(texname); + glBindTexture(GL_TEXTURE_2D, tex->id); + glVertexPointer(3, GL_FLOAT, sizeof(partvert), &verts->pos); + glTexCoordPointer(2, GL_FLOAT, sizeof(partvert), &verts->u); + glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(partvert), &verts->color); + glDrawArrays(GL_QUADS, 0, numparts*4); + } +}; +typedef varenderer quadrenderer; +typedef varenderer taperenderer; +typedef varenderer trailrenderer; + +#include "explosion.h" +#include "lensflare.h" +#include "lightning.h" + +static partrenderer *parts[] = +{ + new quadrenderer("packages/particles/blood.png", PT_PART|PT_MOD|PT_RND4, 2, 1), // 0 blood spats (note: rgb is inverted) + new quadrenderer("packages/particles/spark.png", PT_PART|PT_GLARE, 2, 0), // 1 sparks + new quadrenderer("packages/particles/smoke.png", PT_PART, -20, 0), // 2 small slowly rising smoke + new quadrenderer("packages/particles/base.png", PT_PART|PT_GLARE, 20, 0), // 3 edit mode entities + new quadrenderer("packages/particles/ball1.png", PT_PART|PT_GLARE, 20, 0), // 4 fireball1 + new quadrenderer("packages/particles/smoke.png", PT_PART, -20, 0), // 5 big slowly rising smoke + new quadrenderer("packages/particles/ball2.png", PT_PART|PT_GLARE, 20, 0), // 6 fireball2 + new quadrenderer("packages/particles/ball3.png", PT_PART|PT_GLARE, 20, 0), // 7 big fireball3 + &textups, // 8 TEXT, floats up + new taperenderer("packages/particles/flare.jpg", PT_TAPE|PT_GLARE, 0, 0), // 9 streak + &texts, // 10 TEXT, SMALL, NON-MOVING + &meters, // 11 METER, SMALL, NON-MOVING + &metervs, // 12 METER vs., SMALL, NON-MOVING + new quadrenderer("packages/particles/smoke.png", PT_PART, 20, 0), // 13 small slowly sinking smoke trail + &fireballs, // 14 explosion fireball + &lightnings, // 15 lightning + new quadrenderer("packages/particles/smoke.png", PT_PART, -15, 0), // 16 big fast rising smoke + new trailrenderer("packages/particles/base.png", PT_TRAIL|PT_LERP, 2, 0), // 17 water, entity + &noglarefireballs, // 18 explosion fireball no glare + &flares // must be done last +}; + +VARFP(maxparticles, 10, 4000, 40000, particleinit()); + +void particleinit() +{ + if(!particleshader) particleshader = lookupshaderbyname("particle"); + if(!particlenotextureshader) particlenotextureshader = lookupshaderbyname("particlenotexture"); + loopi(sizeof(parts)/sizeof(parts[0])) parts[i]->init(maxparticles); +} + +void clearparticles() +{ + loopi(sizeof(parts)/sizeof(parts[0])) parts[i]->reset(); +} + +void cleanupparticles() +{ + loopi(sizeof(parts)/sizeof(parts[0])) parts[i]->cleanup(); +} + +void removetrackedparticles(physent *owner) +{ + loopi(sizeof(parts)/sizeof(parts[0])) parts[i]->resettracked(owner); +} + +VARP(particleglare, 0, 4, 100); + +VAR(debugparticles, 0, 0, 1); + +void render_particles(int time) +{ + //want to debug BEFORE the lastpass render (that would delete particles) + if(debugparticles && !glaring && !reflecting && !refracting) + { + int n = sizeof(parts)/sizeof(parts[0]); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, FONTH*n*2, FONTH*n*2, 0, -1, 1); //squeeze into top-left corner + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + glDisable(GL_DEPTH_TEST); + glEnable(GL_BLEND); + defaultshader->set(); + loopi(n) + { + int type = parts[i]->type; + const char *title = parts[i]->texname ? strrchr(parts[i]->texname, '/')+1 : NULL; + string info = ""; + if(type&PT_GLARE) s_strcat(info, "g,"); + if(type&PT_LERP) s_strcat(info, "l,"); + if(type&PT_MOD) s_strcat(info, "m,"); + if(type&PT_RND4) s_strcat(info, "r,"); + if(type&PT_TRACK) s_strcat(info, "t,"); + if(parts[i]->collide) s_strcat(info, "c,"); + s_sprintfd(ds)("%d\t%s(%s%d) %s", parts[i]->count(), partnames[type&0xFF], info, parts[i]->grav, (title?title:"")); + draw_text(ds, FONTH, (i+n/2)*FONTH); + } + glDisable(GL_BLEND); + glEnable(GL_DEPTH_TEST); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + } + + if(glaring && !particleglare) return; + + loopi(sizeof(parts)/sizeof(parts[0])) + { + if(glaring && !(parts[i]->type&PT_GLARE)) continue; + parts[i]->update(); + } + + static float zerofog[4] = { 0, 0, 0, 1 }; + float oldfogc[4]; + bool rendered = false; + uint lastflags = PT_LERP; + + loopi(sizeof(parts)/sizeof(parts[0])) + { + partrenderer *p = parts[i]; + if(glaring && !(p->type&PT_GLARE)) continue; + if(!p->haswork()) continue; + + if(!rendered) + { + rendered = true; + glDepthMask(GL_FALSE); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + if(glaring) setenvparamf("colorscale", SHPARAM_VERTEX, 4, particleglare, particleglare, particleglare, 1); + else setenvparamf("colorscale", SHPARAM_VERTEX, 4, 1, 1, 1, 1); + + particleshader->set(); + glGetFloatv(GL_FOG_COLOR, oldfogc); + } + + uint flags = p->type & (PT_LERP|PT_MOD); + if(p->usesvertexarray()) flags |= 0x01; //0x01 = VA marker + uint changedbits = (flags ^ lastflags); + if(changedbits != 0x0000) + { + if(changedbits&0x01) + { + if(flags&0x01) + { + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + } + else + { + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + } + } + if(changedbits&PT_LERP) glFogfv(GL_FOG_COLOR, (flags&PT_LERP) ? oldfogc : zerofog); + if(changedbits&(PT_LERP|PT_MOD)) + { + if(flags&PT_LERP) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + else if(flags&PT_MOD) glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); + else glBlendFunc(GL_SRC_ALPHA, GL_ONE); + } + lastflags = flags; + } + p->render(); + } + + if(rendered) + { + if(lastflags&(PT_LERP|PT_MOD)) glBlendFunc(GL_SRC_ALPHA, GL_ONE); + if(!(lastflags&PT_LERP)) glFogfv(GL_FOG_COLOR, oldfogc); + if(lastflags&0x01) + { + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + } + glDisable(GL_BLEND); + glDepthMask(GL_TRUE); + } +} + +static inline particle *newparticle(const vec &o, const vec &d, int fade, int type, int color, float size) +{ + return parts[type]->addpart(o, d, fade, color, size); +} + +VARP(maxparticledistance, 256, 1024, 4096); + +static void splash(int type, int color, int radius, int num, int fade, const vec &p, float size) +{ + if(camera1->o.dist(p) > maxparticledistance) return; + float collidez = parts[type]->collide ? p.z - raycube(p, vec(0, 0, -1), COLLIDERADIUS, RAY_CLIPMAT) + COLLIDEERROR : -1; + int fmin = 1; + int fmax = fade*3; + loopi(num) + { + int x, y, z; + do + { + x = rnd(radius*2)-radius; + y = rnd(radius*2)-radius; + z = rnd(radius*2)-radius; + } + while(x*x+y*y+z*z>radius*radius); + vec tmp = vec((float)x, (float)y, (float)z); + int f = (num < 10) ? (fmin + rnd(fmax)) : (fmax - (i*(fmax-fmin))/(num-1)); //help deallocater by using fade distribution rather than random + newparticle(p, tmp, f, type, color, size)->val = collidez; + } +} + +static void regularsplash(int type, int color, int radius, int num, int fade, const vec &p, float size, int delay=0) +{ + if(!emit_particles() || (delay > 0 && rnd(delay) != 0)) return; + splash(type, color, radius, num, fade, p, size); +} + +//maps 'classic' particles types to newer types and colors +// @NOTE potentially this and the following public funcs can be tidied up, but lets please defer that for a little bit... +static struct partmap { int type; int color; float size; } partmaps[] = +{ + { 1, 0xB49B4B, 0.24f}, // 0 yellow: sparks + { 2, 0x897661, 0.6f }, // 1 greyish-brown: small slowly rising smoke + { 3, 0x3232FF, 0.32f}, // 2 blue: edit mode entities + { 0, 0x60FFFF, 2.96f}, // 3 red: blood spats (note: rgb is inverted) + { 4, 0xFFC8C8, 4.8f }, // 4 yellow: fireball1 + { 5, 0x897661, 2.4f }, // 5 greyish-brown: big slowly rising smoke + { 6, 0xFFFFFF, 4.8f }, // 6 blue: fireball2 + { 7, 0xFFFFFF, 4.8f }, // 7 green: big fireball3 + { 8, 0xFF4B19, 4.0f }, // 8 TEXT RED + { 8, 0x32FF64, 4.0f }, // 9 TEXT GREEN + { 9, 0xFFC864, 0.28f}, // 10 yellow flare + { 10, 0x1EC850, 2.0f }, // 11 TEXT DARKGREEN, SMALL, NON-MOVING + { 7, 0xFFFFFF, 2.0f }, // 12 green small fireball3 + { 10, 0xFF4B19, 2.0f }, // 13 TEXT RED, SMALL, NON-MOVING + { 10, 0xB4B4B4, 2.0f }, // 14 TEXT GREY, SMALL, NON-MOVING + { 8, 0xFFC864, 4.0f }, // 15 TEXT YELLOW + { 10, 0x6496FF, 2.0f }, // 16 TEXT BLUE, SMALL, NON-MOVING + { 11, 0xFF1932, 2.0f }, // 17 METER RED, SMALL, NON-MOVING + { 11, 0x3219FF, 2.0f }, // 18 METER BLUE, SMALL, NON-MOVING + { 12, 0xFF1932, 2.0f }, // 19 METER RED vs. BLUE, SMALL, NON-MOVING (note swaps r<->b) + { 12, 0x3219FF, 2.0f }, // 20 METER BLUE vs. RED, SMALL, NON-MOVING (note swaps r<->b) + { 13, 0x897661, 0.6f }, // 21 greyish-brown: small slowly sinking smoke trail + { 14, 0xFF8080, 4.0f }, // 22 red explosion fireball + { 14, 0xA0C080, 4.0f }, // 23 orange explosion fireball + /* @UNUSED */ { -1, 0, 0.0f}, // 24 + { 16, 0x897661, 2.4f }, // 25 greyish-brown: big fast rising smoke + /* @UNUSED */ { -1, 0, 0.0f}, // 26 + /* @UNUSED */ { -1, 0, 0.0f}, // 27 + { 15, 0xFFFFFF, 0.28f}, // 28 lightning + { 15, 0xFF2222, 0.28f}, // 29 lightning: red + { 15, 0x2222FF, 0.28f}, // 30 lightning: blue + { 18, 0x802020, 4.8f }, // 31 fireball: red, no glare + { 18, 0x2020FF, 4.8f }, // 32 fireball: blue, no glare + { 18, 0x208020, 4.8f }, // 33 fireball: green, no glare + { 8, 0x6496FF, 4.0f }, // 34 TEXT BLUE + { 14, 0x802020, 4.8f }, // 35 fireball: red + { 14, 0x2020FF, 4.8f }, // 36 fireball: blue + // fill the above @UNUSED slots first! +}; + +static inline float partsize(int type) +{ + return partmaps[type].size * particlesize/100.0f; +} + +void regular_particle_splash(int type, int num, int fade, const vec &p, int delay) +{ + if(shadowmapping) return; + int radius = (type==5 || type == 25) ? 50 : 150; + regularsplash(partmaps[type].type, partmaps[type].color, radius, num, fade, p, partsize(type), delay); +} + +void particle_splash(int type, int num, int fade, const vec &p) +{ + if(shadowmapping || renderedgame) return; + splash(partmaps[type].type, partmaps[type].color, 150, num, fade, p, partsize(type)); +} + +VARP(maxtrail, 1, 500, 10000); + +void particle_trail(int type, int fade, const vec &s, const vec &e) +{ + if(shadowmapping || renderedgame) return; + vec v; + float d = e.dist(s, v); + int steps = clamp(int(d*2), 1, maxtrail); + v.div(steps); + vec p = s; + int ptype = partmaps[type].type; + int color = partmaps[type].color; + float size = partsize(type); + loopi(steps) + { + p.add(v); + vec tmp = vec(float(rnd(11)-5), float(rnd(11)-5), float(rnd(11)-5)); + newparticle(p, tmp, rnd(fade)+fade, ptype, color, size); + } +} + +VARP(particletext, 0, 1, 1); + +void particle_text(const vec &s, const char *t, int type, int fade) +{ + if(shadowmapping || renderedgame) return; + if(!particletext || camera1->o.dist(s) > 128) return; + if(t[0]=='@') t = newstring(t); + newparticle(s, vec(0, 0, 1), fade, partmaps[type].type, partmaps[type].color, partmaps[type].size)->text = t; +} + +void particle_meter(const vec &s, float val, int type, int fade) +{ + if(shadowmapping || renderedgame) return; + newparticle(s, vec(0, 0, 1), fade, partmaps[type].type, partmaps[type].color, partmaps[type].size)->val = val; +} + +void particle_flare(const vec &p, const vec &dest, int fade, int type, physent *owner) +{ + if(shadowmapping || renderedgame) return; + newparticle(p, dest, fade, partmaps[type].type, partmaps[type].color, partsize(type))->owner = owner; +} + +void particle_fireball(const vec &dest, float maxsize, int type, int fade) +{ + if(shadowmapping || renderedgame) return; + float size = partsize(type); + float growth = maxsize - size; + if(fade < 0) fade = int(growth*25); + newparticle(dest, vec(0, 0, 1), fade, partmaps[type].type, partmaps[type].color, size)->val = growth; +} + +//dir = 0..6 where 0=up +static inline vec offsetvec(vec o, int dir, int dist) +{ + vec v = vec(o); + v[(2+dir)%3] += (dir>2)?(-dist):dist; + return v; +} + +//converts a 16bit color to 24bit +static inline int colorfromattr(int attr) +{ + return (((attr&0xF)<<4) | ((attr&0xF0)<<8) | ((attr&0xF00)<<12)) + 0x0F0F0F; +} + +/* Experiments in shapes... + * dir: (where dir%3 is similar to offsetvec with 0=up) + * 0..2 circle + * 3.. 5 cylinder shell + * 6..11 cone shell + * 12..14 plane volume + * 15..20 line volume, i.e. wall + * 21 sphere + * +32 to inverse direction + */ +void regularshape(int type, int radius, int color, int dir, int num, int fade, const vec &p, float size) +{ + if(!emit_particles()) return; + + int basetype = parts[type]->type&0xFF; + bool flare = (basetype == PT_TAPE) || (basetype == PT_LIGHTNING); + + bool inv = (dir >= 32); + dir = dir&0x1F; + loopi(num) + { + vec to, from; + if(dir < 12) + { + float a = PI2*float(rnd(1000))/1000.0; + to[dir%3] = sinf(a)*radius; + to[(dir+1)%3] = cosf(a)*radius; + to[(dir+2)%3] = 0.0; + to.add(p); + if(dir < 3) //circle + from = p; + else if(dir < 6) //cylinder + { + from = to; + to[(dir+2)%3] += radius; + from[(dir+2)%3] -= radius; + } + else //cone + { + from = p; + to[(dir+2)%3] += (dir < 9)?radius:(-radius); + } + } + else if(dir < 15) //plane + { + to[dir%3] = float(rnd(radius<<4)-(radius<<3))/8.0; + to[(dir+1)%3] = float(rnd(radius<<4)-(radius<<3))/8.0; + to[(dir+2)%3] = radius; + to.add(p); + from = to; + from[(dir+2)%3] -= 2*radius; + } + else if(dir < 21) //line + { + if(dir < 18) + { + to[dir%3] = float(rnd(radius<<4)-(radius<<3))/8.0; + to[(dir+1)%3] = 0.0; + } + else + { + to[dir%3] = 0.0; + to[(dir+1)%3] = float(rnd(radius<<4)-(radius<<3))/8.0; + } + to[(dir+2)%3] = 0.0; + to.add(p); + from = to; + to[(dir+2)%3] += radius; + } + else //sphere + { + to = vec(PI2*float(rnd(1000))/1000.0, PI*float(rnd(1000)-500)/1000.0).mul(radius); + to.add(p); + from = p; + } + + if(flare) + newparticle(inv?to:from, inv?from:to, rnd(fade*3)+1, type, color, size); + else + { + vec d(to); + d.sub(from); + d.normalize().mul(inv ? -200.0f : 200.0f); //velocity + newparticle(inv?to:from, d, rnd(fade*3)+1, type, color, size); + } + } +} + +static void makeparticles(entity &e) +{ + switch(e.attr1) + { + case 0: //fire + regularsplash(4, 0xFFC8C8, 150, 1, 40, e.o, 4.8); + regularsplash(5, 0x897661, 50, 1, 200, vec(e.o.x, e.o.y, e.o.z+3.0), 2.4, 3); + break; + case 1: //smoke vent - + regularsplash(5, 0x897661, 50, 1, 200, offsetvec(e.o, e.attr2, rnd(10)), 2.4); + break; + case 2: //water fountain - + { + uchar col[3]; + getwatercolour(col); + int color = (col[0]<<16) | (col[1]<<8) | col[2]; + regularsplash(17, color, 150, 4, 200, offsetvec(e.o, e.attr2, rnd(10)), 0.6); + break; + } + case 3: //fire ball - + newparticle(e.o, vec(0, 0, 1), 1, 14, colorfromattr(e.attr3), 4.0)->val = 1+e.attr2; + break; + case 4: //tape - + case 7: //lightning + case 8: //fire + case 9: //smoke + case 10: //water + { + const int typemap[] = { 9, -1, -1, 15, 4, 5, 17 }; + const float sizemap[] = { 0.28, 0.0, 0.0, 0.28, 4.8, 2.4, 0.60 }; + int type = typemap[e.attr1-4]; + float size = sizemap[e.attr1-4]; + if(e.attr2 >= 256) regularshape(type, 1+e.attr3, colorfromattr(e.attr4), e.attr2-256, 5, 200, e.o, size); + else newparticle(e.o, offsetvec(e.o, e.attr2, 1+e.attr3), 1, type, colorfromattr(e.attr4), size); + break; + } + case 5: //meter, metervs - + case 6: + newparticle(e.o, vec(0, 0, 1), 1, (e.attr1==5)?11:12, colorfromattr(e.attr3), 2.0)->val = min(1.0f, float(e.attr2)/100); + break; + case 32: //lens flares - plain/sparkle/sun/sparklesun + case 33: + case 34: + case 35: + flares.addflare(e.o, e.attr2, e.attr3, e.attr4, (e.attr1&0x02)!=0, (e.attr1&0x01)!=0); + break; + default: + s_sprintfd(ds)("@particles %d?", e.attr1); + particle_text(e.o, ds, 16, 1); + } +} + +void entity_particles() +{ + if(lastmillis - lastemitframe >= emitmillis) + { + emit = true; + lastemitframe = lastmillis - (lastmillis%emitmillis); + } + else emit = false; + + flares.makelightflares(); + + const vector &ents = et->getents(); + if(!editmode) + { + loopv(ents) + { + entity &e = *ents[i]; + if(e.type != ET_PARTICLES || e.o.dist(camera1->o) > maxparticledistance) continue; + makeparticles(e); + } + } + else // show sparkly thingies for map entities in edit mode + { + // note: order matters in this case as particles of the same type are drawn in the reverse order that they are added + loopv(entgroup) + { + entity &e = *ents[entgroup[i]]; + particle_text(e.o, entname(e), 13, 1); + } + loopv(ents) + { + entity &e = *ents[i]; + if(e.type==ET_EMPTY) continue; + particle_text(e.o, entname(e), 11, 1); + regular_particle_splash(2, 2, 40, e.o); + } + } +} diff --git a/src/engine/rendersky.cpp b/src/engine/rendersky.cpp new file mode 100644 index 0000000..e6d0db8 --- /dev/null +++ b/src/engine/rendersky.cpp @@ -0,0 +1,321 @@ +#include "pch.h" +#include "engine.h" + +Texture *sky[6] = { 0, 0, 0, 0, 0, 0 }, *clouds[6] = { 0, 0, 0, 0, 0, 0 }; + +void loadsky(const char *basename, Texture *texs[6]) +{ + loopi(6) + { + const char *side = cubemapsides[i].name; + s_sprintfd(name)("packages/%s_%s.jpg", basename, side); + if((texs[i] = textureload(name, 3, true, false))==notexture) + { + strcpy(name+strlen(name)-3, "png"); + if((texs[i] = textureload(name, 3, true, false))==notexture) conoutf(CON_ERROR, "could not load sky texture packages/%s_%s", basename, side); + } + } +} + +Texture *cloudoverlay = NULL; + +Texture *loadskyoverlay(const char *basename) +{ + s_sprintfd(name)("packages/%s.jpg", basename); + Texture *t = textureload(name, 0, true, false); + if(t!=notexture) return t; + strcpy(name+strlen(name)-3, "png"); + t = textureload(name, 0, true, false); + if(t==notexture) conoutf(CON_ERROR, "could not load sky overlay texture packages/%s", basename); + return t; +} + +SVARFR(skybox, "", { if(skybox[0]) loadsky(skybox, sky); }); +FVARR(spinsky, 0); +VARR(yawsky, 0, 0, 360); +SVARFR(cloudbox, "", { if(cloudbox[0]) loadsky(cloudbox, clouds); }); +FVARR(spinclouds, 0); +VARR(yawclouds, 0, 0, 360); +FVARR(cloudclip, 0.5f); +SVARFR(cloudlayer, "", { if(cloudlayer[0]) cloudoverlay = loadskyoverlay(cloudlayer); }); +FVARR(cloudscrollx, 0); +FVARR(cloudscrolly, 0); +FVARR(cloudscale, 1); +FVARR(spincloudlayer, 0); +FVARR(yawcloudlayer, 0); +FVARR(cloudheight, 0.2f); +FVARR(cloudfade, 0.2f); +VARR(cloudsubdiv, 4, 16, 64); +VARR(cloudcolour, 0, 0xFFFFFF, 0xFFFFFF); + +void draw_envbox_face(float s0, float t0, int x0, int y0, int z0, + float s1, float t1, int x1, int y1, int z1, + float s2, float t2, int x2, int y2, int z2, + float s3, float t3, int x3, int y3, int z3, + GLuint texture) +{ + glBindTexture(GL_TEXTURE_2D, texture); + glBegin(GL_QUADS); + glTexCoord2f(s3, t3); glVertex3f(x3, y3, z3); + glTexCoord2f(s2, t2); glVertex3f(x2, y2, z2); + glTexCoord2f(s1, t1); glVertex3f(x1, y1, z1); + glTexCoord2f(s0, t0); glVertex3f(x0, y0, z0); + glEnd(); + xtraverts += 4; +} + +void draw_envbox(int w, float zclip = 0.0f, int faces = 0x3F, Texture **sky = NULL) +{ + float vclip = 1-zclip; + int z = int(ceil(2*w*(vclip-0.5f))); + + if(faces&0x01) + draw_envbox_face(0.0f, 0.0f, -w, -w, -w, + 1.0f, 0.0f, -w, w, -w, + 1.0f, vclip, -w, w, z, + 0.0f, vclip, -w, -w, z, sky[0] ? sky[0]->id : notexture->id); + + if(faces&0x02) + draw_envbox_face(1.0f, vclip, +w, -w, z, + 0.0f, vclip, +w, w, z, + 0.0f, 0.0f, +w, w, -w, + 1.0f, 0.0f, +w, -w, -w, sky[1] ? sky[1]->id : notexture->id); + + if(faces&0x04) + draw_envbox_face(1.0f, vclip, -w, -w, z, + 0.0f, vclip, w, -w, z, + 0.0f, 0.0f, w, -w, -w, + 1.0f, 0.0f, -w, -w, -w, sky[2] ? sky[2]->id : notexture->id); + + if(faces&0x08) + draw_envbox_face(1.0f, vclip, +w, w, z, + 0.0f, vclip, -w, w, z, + 0.0f, 0.0f, -w, w, -w, + 1.0f, 0.0f, +w, w, -w, sky[3] ? sky[3]->id : notexture->id); + + if(!zclip && faces&0x10) + draw_envbox_face(0.0f, 1.0f, -w, w, w, + 0.0f, 0.0f, +w, w, w, + 1.0f, 0.0f, +w, -w, w, + 1.0f, 1.0f, -w, -w, w, sky[4] ? sky[4]->id : notexture->id); + + if(faces&0x20) + draw_envbox_face(0.0f, 1.0f, +w, w, -w, + 0.0f, 0.0f, -w, w, -w, + 1.0f, 0.0f, -w, -w, -w, + 1.0f, 1.0f, +w, -w, -w, sky[5] ? sky[5]->id : notexture->id); +} + +void draw_env_overlay(int w, Texture *overlay = NULL, float tx = 0, float ty = 0) +{ + float z = -w*cloudheight, tsz = 0.5f*(1-cloudfade)/cloudscale, psz = w*(1-cloudfade); + glBindTexture(GL_TEXTURE_2D, overlay ? overlay->id : notexture->id); + float r = (cloudcolour>>16)/255.0f, g = ((cloudcolour>>8)&255)/255.0f, b = (cloudcolour&255)/255.0f; + glColor3f(r, g, b); + glBegin(GL_POLYGON); + loopi(cloudsubdiv) + { + vec p(1, 1, 0); + p.rotate_around_z((-2.0f*M_PI*i)/cloudsubdiv); + glTexCoord2f(tx + p.x*tsz, ty + p.y*tsz); glVertex3f(p.x*psz, p.y*psz, z); + } + glEnd(); + float tsz2 = 0.5f/cloudscale; + glBegin(GL_QUAD_STRIP); + loopi(cloudsubdiv+1) + { + vec p(1, 1, 0); + p.rotate_around_z((-2.0f*M_PI*i)/cloudsubdiv); + glColor4f(r, g, b, 1); + glTexCoord2f(tx + p.x*tsz, ty + p.y*tsz); glVertex3f(p.x*psz, p.y*psz, z); + glColor4f(r, g, b, 0); + glTexCoord2f(tx + p.x*tsz2, ty + p.y*tsz2); glVertex3f(p.x*w, p.y*w, z); + } + glEnd(); +} + +VARP(sparklyfix, 0, 0, 1); +VAR(showsky, 0, 1, 1); +VAR(clipsky, 0, 1, 1); + +bool drawskylimits(bool explicitonly) +{ + nocolorshader->set(); + + glDisable(GL_TEXTURE_2D); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + bool rendered = rendersky(explicitonly); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glEnable(GL_TEXTURE_2D); + + return rendered; +} + +void drawskyoutline() +{ + notextureshader->set(); + + glDisable(GL_TEXTURE_2D); + glDepthMask(GL_FALSE); + extern int wireframe; + if(!wireframe) + { + enablepolygonoffset(GL_POLYGON_OFFSET_LINE); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + } + glColor3f(0.5f, 0.0f, 0.5f); + rendersky(true); + if(!wireframe) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + disablepolygonoffset(GL_POLYGON_OFFSET_LINE); + } + glDepthMask(GL_TRUE); + glEnable(GL_TEXTURE_2D); + + if(!glaring) defaultshader->set(); +} + +VAR(clampsky, 0, 1, 1); + +void drawskybox(int farplane, bool limited) +{ + extern int renderedskyfaces, renderedskyclip; // , renderedsky, renderedexplicitsky; + bool alwaysrender = editmode || !insideworld(camera1->o) || reflecting, + explicitonly = false; + if(limited) + { + explicitonly = alwaysrender || !sparklyfix || refracting; + if(!drawskylimits(explicitonly) && !alwaysrender) return; + extern int ati_skybox_bug; + if(!alwaysrender && !renderedskyfaces && !ati_skybox_bug) explicitonly = false; + } + else if(!alwaysrender) + { + extern vtxarray *visibleva; + renderedskyfaces = 0; + renderedskyclip = INT_MAX; + for(vtxarray *va = visibleva; va; va = va->next) + { + if(va->occluded >= OCCLUDE_BB && va->skyfaces&0x80) continue; + renderedskyfaces |= va->skyfaces&0x3F; + if(!(va->skyfaces&0x1F) || camera1->o.z < va->skyclip) renderedskyclip = min(renderedskyclip, va->skyclip); + else renderedskyclip = 0; + } + if(!renderedskyfaces) return; + } + + if(alwaysrender) + { + renderedskyfaces = 0x3F; + renderedskyclip = 0; + } + + float skyclip = clipsky ? max(renderedskyclip-1, 0) : 0; + if(reflectzskyclip) skyclip = reflectz; + + if(glaring) + { + static Shader *skyboxglareshader = NULL; + if(!skyboxglareshader) skyboxglareshader = lookupshaderbyname("skyboxglare"); + skyboxglareshader->set(); + } + else defaultshader->set(); + + bool fog = glIsEnabled(GL_FOG)==GL_TRUE; + if(fog) glDisable(GL_FOG); + + if(limited) + { + if(explicitonly) glDisable(GL_DEPTH_TEST); + else glDepthFunc(GL_GEQUAL); + } + else glDepthFunc(GL_LEQUAL); + + glDepthMask(GL_FALSE); + + if(clampsky) glDepthRange(1, 1); + + glColor3f(1, 1, 1); + + glPushMatrix(); + glLoadIdentity(); + glRotatef(camera1->roll, 0, 0, 1); + glRotatef(camera1->pitch, -1, 0, 0); + glRotatef(camera1->yaw+spinsky*lastmillis/1000.0f+yawsky, 0, 1, 0); + glRotatef(90, 1, 0, 0); + if(reflecting) glScalef(1, 1, -1); + draw_envbox(farplane/2, skyclip ? 0.5f + 0.5f*(skyclip-camera1->o.z)/float(hdr.worldsize) : 0, renderedskyfaces | ((spinsky || yawsky) && renderedskyfaces&0x0F ? 0x0F : 0), sky); + glPopMatrix(); + + if(!glaring && cloudbox[0]) + { + if((spinclouds || yawclouds) && renderedskyfaces&0x0F) renderedskyfaces |= 0x0F; + + if(fading) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glPushMatrix(); + glLoadIdentity(); + glRotatef(camera1->roll, 0, 0, 1); + glRotatef(camera1->pitch, -1, 0, 0); + glRotatef(camera1->yaw+spinclouds*lastmillis/1000.0f+yawclouds, 0, 1, 0); + glRotatef(90, 1, 0, 0); + if(reflecting) glScalef(1, 1, -1); + draw_envbox(farplane/2, skyclip ? 0.5f + 0.5f*(skyclip-camera1->o.z)/float(hdr.worldsize) : cloudclip, renderedskyfaces | ((spinclouds || yawclouds) && renderedskyfaces&0x0F ? 0x0F : 0), clouds); + glPopMatrix(); + + glDisable(GL_BLEND); + } + + if(!glaring && cloudlayer[0] && cloudheight && renderedskyfaces&(cloudheight < 0 ? 0x1F : 0x2F)) + { + if(fading) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); + + glDisable(GL_CULL_FACE); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glPushMatrix(); + glLoadIdentity(); + glRotatef(camera1->roll, 0, 0, 1); + glRotatef(camera1->pitch, -1, 0, 0); + glRotatef(camera1->yaw+spincloudlayer*lastmillis/1000.0f+yawcloudlayer, 0, 1, 0); + glRotatef(90, 1, 0, 0); + if(reflecting) glScalef(1, 1, -1); + draw_env_overlay(farplane/2, cloudoverlay, cloudscrollx * lastmillis/1000.0f, cloudscrolly * lastmillis/1000.0f); + glPopMatrix(); + + glDisable(GL_BLEND); + + glEnable(GL_CULL_FACE); + } + + if(clampsky) glDepthRange(0, 1); + + glDepthMask(GL_TRUE); + + if(limited) + { + if(explicitonly) glEnable(GL_DEPTH_TEST); + else glDepthFunc(GL_LESS); + if(!reflecting && !refracting && !envmapping && editmode && showsky) drawskyoutline(); + } + else glDepthFunc(GL_LESS); + + if(fog) glEnable(GL_FOG); +} + +VARNR(skytexture, useskytexture, 0, 1, 1); + +int explicitsky = 0; +double skyarea = 0; + +bool limitsky() +{ + return (explicitsky && (useskytexture || editmode)) || (sparklyfix && skyarea / (double(hdr.worldsize)*double(hdr.worldsize)*6) < 0.9); +} + diff --git a/src/engine/rendertarget.h b/src/engine/rendertarget.h new file mode 100644 index 0000000..5f2b684 --- /dev/null +++ b/src/engine/rendertarget.h @@ -0,0 +1,505 @@ +extern int rtsharefb, rtscissor, blurtile; + +struct rendertarget +{ + int texw, texh, vieww, viewh; + GLenum colorfmt, depthfmt, target; + GLuint rendertex, renderfb, renderdb, blurtex, blurfb, blurdb; + int blursize; + float blursigma; + float blurweights[MAXBLURRADIUS+1], bluroffsets[MAXBLURRADIUS+1]; + + float scissorx1, scissory1, scissorx2, scissory2; +#define BLURTILES 32 +#define BLURTILEMASK (0xFFFFFFFFU>>(32-BLURTILES)) + uint blurtiles[BLURTILES+1]; + + rendertarget() : texw(0), texh(0), vieww(0), viewh(0), colorfmt(GL_FALSE), depthfmt(GL_FALSE), target(GL_TEXTURE_2D), rendertex(0), renderfb(0), renderdb(0), blurtex(0), blurfb(0), blurdb(0), blursize(0), blursigma(0) + { + } + + virtual ~rendertarget() {} + + virtual const GLenum *colorformats() const + { + static const GLenum colorfmts[] = { GL_RGB, GL_RGB8, GL_FALSE }; + return colorfmts; + } + + virtual const GLenum *depthformats() const + { + static const GLenum depthfmts[] = { GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT32, GL_FALSE }; + return depthfmts; + } + + void cleanup(bool fullclean = false) + { + if(renderfb) { glDeleteFramebuffers_(1, &renderfb); renderfb = 0; } + if(renderdb) { glDeleteRenderbuffers_(1, &renderdb); renderdb = 0; } + if(rendertex) { glDeleteTextures(1, &rendertex); rendertex = 0; } + texw = texh = 0; + cleanupblur(); + + if(fullclean) colorfmt = depthfmt = GL_FALSE; + } + + void cleanupblur() + { + if(blurfb) { glDeleteFramebuffers_(1, &blurfb); blurfb = 0; } + if(blurtex) { glDeleteTextures(1, &blurtex); blurtex = 0; } + if(blurdb) { glDeleteRenderbuffers_(1, &blurdb); blurdb = 0; } + blursize = 0; + blursigma = 0.0f; + } + + void setupblur() + { + if(!hasFBO) return; + if(!blurtex) glGenTextures(1, &blurtex); + createtexture(blurtex, texw, texh, NULL, 3, false, colorfmt, target); + + if(!swaptexs() || rtsharefb) return; + if(!blurfb) glGenFramebuffers_(1, &blurfb); + glBindFramebuffer_(GL_FRAMEBUFFER_EXT, blurfb); + glFramebufferTexture2D_(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, blurtex, 0); + if(!blurdb) glGenRenderbuffers_(1, &blurdb); + glGenRenderbuffers_(1, &blurdb); + glBindRenderbuffer_(GL_RENDERBUFFER_EXT, blurdb); + glRenderbufferStorage_(GL_RENDERBUFFER_EXT, depthfmt, texw, texh); + glFramebufferRenderbuffer_(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, blurdb); + glBindFramebuffer_(GL_FRAMEBUFFER_EXT, 0); + } + + void setup(int w, int h) + { + if(hasFBO) + { + if(!renderfb) glGenFramebuffers_(1, &renderfb); + glBindFramebuffer_(GL_FRAMEBUFFER_EXT, renderfb); + } + if(!rendertex) glGenTextures(1, &rendertex); + + target = texrect() ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D; + + const GLenum *colorfmts = colorformats(); + int find = 0; + do + { + createtexture(rendertex, w, h, NULL, 3, false, colorfmt ? colorfmt : colorfmts[find], target, false, filter()); + if(!hasFBO) break; + else + { + glFramebufferTexture2D_(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, rendertex, 0); + if(glCheckFramebufferStatus_(GL_FRAMEBUFFER_EXT)==GL_FRAMEBUFFER_COMPLETE_EXT) break; + } + } + while(!colorfmt && colorfmts[++find]); + if(!colorfmt) colorfmt = colorfmts[find]; + + if(hasFBO) + { + if(!renderdb) { glGenRenderbuffers_(1, &renderdb); depthfmt = GL_FALSE; } + if(!depthfmt) glBindRenderbuffer_(GL_RENDERBUFFER_EXT, renderdb); + const GLenum *depthfmts = depthformats(); + find = 0; + do + { + if(!depthfmt) glRenderbufferStorage_(GL_RENDERBUFFER_EXT, depthfmts[find], w, h); + glFramebufferRenderbuffer_(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, renderdb); + if(glCheckFramebufferStatus_(GL_FRAMEBUFFER_EXT)==GL_FRAMEBUFFER_COMPLETE_EXT) break; + } + while(!depthfmt && depthfmts[++find]); + if(!depthfmt) depthfmt = depthfmts[find]; + + glBindFramebuffer_(GL_FRAMEBUFFER_EXT, 0); + } + texw = w; + texh = h; + } + + bool addblurtiles(float x1, float y1, float x2, float y2, float blurmargin = 0) + { + if(x1 >= 1 || y1 >= 1 || x2 <= -1 || y2 <= -1) return false; + + scissorx1 = min(scissorx1, max(x1, -1.0f)); + scissory1 = min(scissory1, max(y1, -1.0f)); + scissorx2 = max(scissorx2, min(x2, 1.0f)); + scissory2 = max(scissory2, min(y2, 1.0f)); + + float blurerror = 2.0f*float(2*blursize + blurmargin); + int tx1 = max(0, min(BLURTILES - 1, int((x1-blurerror/vieww + 1)/2 * BLURTILES))), + ty1 = max(0, min(BLURTILES - 1, int((y1-blurerror/viewh + 1)/2 * BLURTILES))), + tx2 = max(0, min(BLURTILES - 1, int((x2+blurerror/vieww + 1)/2 * BLURTILES))), + ty2 = max(0, min(BLURTILES - 1, int((y2+blurerror/viewh + 1)/2 * BLURTILES))); + + uint mask = (BLURTILEMASK>>(BLURTILES - (tx2+1))) & (BLURTILEMASK< scissorx2 || y1-blurerror/viewh > scissory2) + return false; + + if(!blurtile) return true; + + int tx1 = max(0, min(BLURTILES - 1, int((x1 + 1)/2 * BLURTILES))), + ty1 = max(0, min(BLURTILES - 1, int((y1 + 1)/2 * BLURTILES))), + tx2 = max(0, min(BLURTILES - 1, int((x2 + 1)/2 * BLURTILES))), + ty2 = max(0, min(BLURTILES - 1, int((y2 + 1)/2 * BLURTILES))); + + uint mask = (BLURTILEMASK>>(BLURTILES - (tx2+1))) & (BLURTILEMASK<>= 8; x += 8; } + while(!(mask&1)) { mask >>= 1; x++; } + int xstart = x; + do { mask >>= 1; x++; } while(mask&1); + uint strip = (BLURTILEMASK>>(BLURTILES - x)) & (BLURTILEMASK<w-vieww; + y += screen->h-viewh; + } + else if(!blurtex) setupblur(); + if(blursize!=wantsblursize || (wantsblursize && blursigma!=wantsblursigma)) + { + setupblurkernel(wantsblursize, wantsblursigma, blurweights, bluroffsets); + blursize = wantsblursize; + blursigma = wantsblursigma; + } + + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + + if(scissor) + { + glScissor(x, y, w, h); + glEnable(GL_SCISSOR_TEST); + } + + loopi(2) + { + setblurshader(i, target == GL_TEXTURE_RECTANGLE_ARB ? 1 : (i ? texh : texw), blursize, blurweights, bluroffsets, target); + + if(hasFBO) + { + if(!swaptexs() || rtsharefb) glFramebufferTexture2D_(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, i ? rendertex : blurtex, 0); + else glBindFramebuffer_(GL_FRAMEBUFFER_EXT, i ? renderfb : blurfb); + glBindTexture(target, i ? blurtex : rendertex); + } + + rendertiles(); + + if(!hasFBO) glCopyTexSubImage2D(target, 0, x-(screen->w-vieww), y-(screen->h-viewh), x, y, w, h); + } + + if(scissor) glDisable(GL_SCISSOR_TEST); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + } + + virtual bool swaptexs() const { return false; } + + virtual bool dorender() { return true; } + + virtual bool shouldrender() { return true; } + + virtual void doblur(int blursize, float blursigma) + { + int sx, sy, sw, sh; + bool scissoring = rtscissor && scissorblur(sx, sy, sw, sh) && sw > 0 && sh > 0; + if(!scissoring) { sx = sy = 0; sw = vieww; sh = viewh; } + blur(blursize, blursigma, sx, sy, sw, sh, scissoring); + } + + virtual bool scissorrender(int &x, int &y, int &w, int &h) + { + if(scissorx1 >= scissorx2 || scissory1 >= scissory2) + { + if(vieww < texw || viewh < texh) + { + x = y = 0; + w = vieww; + h = viewh; + return true; + } + return false; + } + x = max(int(floor((scissorx1+1)/2*vieww)) - 2*blursize, 0); + y = max(int(floor((scissory1+1)/2*viewh)) - 2*blursize, 0); + w = min(int(ceil((scissorx2+1)/2*vieww)) + 2*blursize, vieww) - x; + h = min(int(ceil((scissory2+1)/2*viewh)) + 2*blursize, viewh) - y; + return true; + } + + virtual bool scissorblur(int &x, int &y, int &w, int &h) + { + if(scissorx1 >= scissorx2 || scissory1 >= scissory2) + { + if(vieww < texw || viewh < texh) + { + x = y = 0; + w = vieww; + h = viewh; + return true; + } + return false; + } + x = max(int(floor((scissorx1+1)/2*vieww)), 0); + y = max(int(floor((scissory1+1)/2*viewh)), 0); + w = min(int(ceil((scissorx2+1)/2*vieww)), vieww) - x; + h = min(int(ceil((scissory2+1)/2*viewh)), viewh) - y; + return true; + } + + virtual void doclear() {} + + virtual bool screenview() const { return false; } + virtual bool texrect() const { return false; } + virtual bool filter() const { return true; } + + void render(int w, int h, int blursize, float blursigma) + { + w = min(w, hwtexsize); + h = min(h, hwtexsize); + if(texrect()) + { + if(w > screen->w) w = screen->w; + if(h > screen->h) h = screen->h; + vieww = w; + viewh = h; + } + else if(screenview()) + { + while(screen->w < (w*3)/4) w /= 2; + while(screen->h < (h*3)/4) h /= 2; + vieww = min(w, screen->w); + viewh = min(h, screen->h); + } + else + { + if(!hasFBO) + { + while(w > screen->w) w /= 2; + while(h > screen->h) h /= 2; + } + vieww = w; + viewh = h; + } + if(w!=texw || h!=texh || (texrect() ? target!=GL_TEXTURE_RECTANGLE_ARB : target!=GL_TEXTURE_2D) || (hasFBO && (swaptexs() && !rtsharefb ? !blurfb : blurfb))) cleanup(); + + if(!filter()) + { + if(blurtex) cleanupblur(); + blursize = 0; + } + + if(!rendertex) setup(w, h); + + scissorx2 = scissory2 = -1; + scissorx1 = scissory1 = 1; + memset(blurtiles, 0, sizeof(blurtiles)); + + if(!shouldrender()) return; + + if(hasFBO) + { + if(blursize && !blurtex) setupblur(); + if(swaptexs() && blursize) + { + swap(rendertex, blurtex); + if(!rtsharefb) + { + swap(renderfb, blurfb); + swap(renderdb, blurdb); + } + } + glBindFramebuffer_(GL_FRAMEBUFFER_EXT, renderfb); + if(swaptexs() && blursize && rtsharefb) + glFramebufferTexture2D_(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, rendertex, 0); + glViewport(0, 0, vieww, viewh); + } + else glViewport(screen->w-vieww, screen->h-viewh, vieww, viewh); + + doclear(); + + int sx, sy, sw, sh; + bool scissoring = rtscissor && scissorrender(sx, sy, sw, sh) && sw > 0 && sh > 0; + if(scissoring) + { + if(!hasFBO) + { + sx += screen->w-vieww; + sy += screen->h-viewh; + } + glScissor(sx, sy, sw, sh); + glEnable(GL_SCISSOR_TEST); + } + else + { + sx = hasFBO ? 0 : screen->w-vieww; + sy = hasFBO ? 0 : screen->h-viewh; + sw = vieww; + sh = viewh; + } + + bool succeeded = dorender(); + + if(scissoring) glDisable(GL_SCISSOR_TEST); + + if(succeeded) + { + if(!hasFBO) + { + glBindTexture(target, rendertex); + glCopyTexSubImage2D(target, 0, sx-(screen->w-vieww), sy-(screen->h-viewh), sx, sy, sw, sh); + } + + if(blursize) doblur(blursize, blursigma); + } + + if(hasFBO) glBindFramebuffer_(GL_FRAMEBUFFER_EXT, 0); + glViewport(0, 0, screen->w, screen->h); + } + + virtual void dodebug(int w, int h) {} + virtual bool flipdebug() const { return true; } + + void debugscissor(int w, int h, bool lines = false) + { + if(!rtscissor || scissorx1 >= scissorx2 || scissory1 >= scissory2) return; + int sx = int(0.5f*(scissorx1 + 1)*w), + sy = int(0.5f*(scissory1 + 1)*h), + sw = int(0.5f*(scissorx2 - scissorx1)*w), + sh = int(0.5f*(scissory2 - scissory1)*h); + if(flipdebug()) { sy = h - sy; sh = -sh; } + glBegin(lines ? GL_LINE_LOOP : GL_QUADS); + glVertex2i(sx, sy); + glVertex2i(sx + sw, sy); + glVertex2i(sx + sw, sy + sh); + glVertex2i(sx, sy + sh); + glEnd(); + } + + void debugblurtiles(int w, int h, bool lines = false) + { + if(!blurtile) return; + float vxsz = float(w)/BLURTILES, vysz = float(h)/BLURTILES; + loop(y, BLURTILES+1) + { + uint mask = blurtiles[y]; + int x = 0; + while(mask) + { + while(!(mask&0xFF)) { mask >>= 8; x += 8; } + while(!(mask&1)) { mask >>= 1; x++; } + int xstart = x; + do { mask >>= 1; x++; } while(mask&1); + uint strip = (BLURTILEMASK>>(BLURTILES - x)) & (BLURTILEMASK<w, screen->h)/2, h = (w*screen->h)/screen->w; + (target==GL_TEXTURE_RECTANGLE_ARB ? rectshader : defaultshader)->set(); + glColor3f(1, 1, 1); + glEnable(target); + glBindTexture(target, rendertex); + float tx1 = 0, tx2 = vieww, ty1 = 0, ty2 = viewh; + if(target!=GL_TEXTURE_RECTANGLE_ARB) + { + tx2 /= vieww; + ty2 /= viewh; + } + if(flipdebug()) swap(ty1, ty2); + glBegin(GL_QUADS); + glTexCoord2f(tx1, ty1); glVertex2i(0, 0); + glTexCoord2f(tx2, ty1); glVertex2i(w, 0); + glTexCoord2f(tx2, ty2); glVertex2i(w, h); + glTexCoord2f(tx1, ty2); glVertex2i(0, h); + glEnd(); + notextureshader->set(); + glDisable(target); + dodebug(w, h); + } +}; + diff --git a/src/engine/rendertext.cpp b/src/engine/rendertext.cpp new file mode 100644 index 0000000..85465c0 --- /dev/null +++ b/src/engine/rendertext.cpp @@ -0,0 +1,271 @@ +#include "pch.h" +#include "engine.h" + +static hashtable fonts; +static font *fontdef = NULL; + +font *curfont = NULL; + +void newfont(char *name, char *tex, int *defaultw, int *defaulth, int *offsetx, int *offsety, int *offsetw, int *offseth) +{ + font *f = fonts.access(name); + if(!f) + { + name = newstring(name); + f = &fonts[name]; + f->name = name; + } + + f->tex = textureload(tex); + f->chars.setsize(0); + f->defaultw = *defaultw; + f->defaulth = *defaulth; + f->offsetx = *offsetx; + f->offsety = *offsety; + f->offsetw = *offsetw; + f->offseth = *offseth; + + fontdef = f; +} + +void fontchar(int *x, int *y, int *w, int *h) +{ + if(!fontdef) return; + + font::charinfo &c = fontdef->chars.add(); + c.x = *x; + c.y = *y; + c.w = *w ? *w : fontdef->defaultw; + c.h = *h ? *h : fontdef->defaulth; +} + +COMMANDN(font, newfont, "ssiiiiii"); +COMMAND(fontchar, "iiii"); + +bool setfont(const char *name) +{ + font *f = fonts.access(name); + if(!f) return false; + curfont = f; + return true; +} + +void gettextres(int &w, int &h) +{ + if(w < MINRESW || h < MINRESH) + { + if(MINRESW > w*MINRESH/h) + { + h = h*MINRESW/w; + w = MINRESW; + } + else + { + w = w*MINRESH/h; + h = MINRESH; + } + } +} + +#define PIXELTAB (4*curfont->defaultw) + +int text_width(const char *str) { //@TODO deprecate in favour of text_bounds(..) + int width, height; + text_bounds(str, width, height); + return width; +} + +void draw_textf(const char *fstr, int left, int top, ...) +{ + s_sprintfdlv(str, top, fstr); + draw_text(str, left, top); +} + +static int draw_char(int c, int x, int y) +{ + font::charinfo &info = curfont->chars[c-33]; + float tc_left = (info.x + curfont->offsetx) / float(curfont->tex->xs); + float tc_top = (info.y + curfont->offsety) / float(curfont->tex->ys); + float tc_right = (info.x + info.w + curfont->offsetw) / float(curfont->tex->xs); + float tc_bottom = (info.y + info.h + curfont->offseth) / float(curfont->tex->ys); + + glTexCoord2f(tc_left, tc_top ); glVertex2f(x, y); + glTexCoord2f(tc_right, tc_top ); glVertex2f(x + info.w, y); + glTexCoord2f(tc_right, tc_bottom); glVertex2f(x + info.w, y + info.h); + glTexCoord2f(tc_left, tc_bottom); glVertex2f(x, y + info.h); + + xtraverts += 4; + return info.w; +} + +//stack[sp] is current color index +static void text_color(char c, char *stack, int size, int &sp, bvec color, int a) +{ + if(c=='s') // save color + { + c = stack[sp]; + if(sp 0) ? --sp : sp]; // restore color + else stack[sp] = c; + switch(c) + { + case '0': color = bvec( 64, 255, 128); break; // green: player talk + case '1': color = bvec( 96, 160, 255); break; // blue: "echo" command + case '2': color = bvec(255, 192, 64); break; // yellow: gameplay messages + case '3': color = bvec(255, 64, 64); break; // red: important errors + case '4': color = bvec(128, 128, 128); break; // gray + case '5': color = bvec(192, 64, 192); break; // magenta + case '6': color = bvec(255, 128, 0); break; // orange + // white (provided color): everything else + } + glColor4ub(color.x, color.y, color.z, a); + } +} + +#define TEXTSKELETON \ + int y = 0, x = 0;\ + int i;\ + for(i = 0; str[i]; i++)\ + {\ + TEXTINDEX(i)\ + int c = str[i];\ + if(c=='\t') { x = ((x+PIXELTAB)/PIXELTAB)*PIXELTAB; TEXTWHITE(i) }\ + else if(c==' ') { x += curfont->defaultw; TEXTWHITE(i) }\ + else if(c=='\n') { TEXTLINE(i) x = 0; y += FONTH; }\ + else if(c=='\f') { if(str[i+1]) { i++; TEXTCOLOR(i) }}\ + else if(curfont->chars.inrange(c-33))\ + {\ + if(maxwidth != -1)\ + {\ + int j = i;\ + int w = curfont->chars[c-33].w;\ + for(; str[i+1]; i++)\ + {\ + int c = str[i+1];\ + if(c=='\f') { if(str[i+2]) i++; continue; }\ + if(i-j > 16) break;\ + if(!curfont->chars.inrange(c-33)) break;\ + int cw = curfont->chars[c-33].w + 1;\ + if(w + cw >= maxwidth) break;\ + w += cw;\ + }\ + if(x + w >= maxwidth && j!=0) { TEXTLINE(j-1) x = 0; y += FONTH; }\ + TEXTWORD\ + }\ + else\ + { TEXTCHAR(i) }\ + }\ + } + +//all the chars are guaranteed to be either drawable or color commands +#define TEXTWORDSKELETON \ + for(; j <= i; j++)\ + {\ + TEXTINDEX(j)\ + int c = str[j];\ + if(c=='\f') { if(str[j+1]) { j++; TEXTCOLOR(j) }}\ + else { TEXTCHAR(j) }\ + } + +int text_visible(const char *str, int hitx, int hity, int maxwidth) +{ + #define TEXTINDEX(idx) + #define TEXTWHITE(idx) if(y+FONTH > hity && x >= hitx) return idx; + #define TEXTLINE(idx) if(y+FONTH > hity) return idx; + #define TEXTCOLOR(idx) + #define TEXTCHAR(idx) x += curfont->chars[c-33].w+1; TEXTWHITE(idx) + #define TEXTWORD TEXTWORDSKELETON + TEXTSKELETON + #undef TEXTINDEX + #undef TEXTWHITE + #undef TEXTLINE + #undef TEXTCOLOR + #undef TEXTCHAR + #undef TEXTWORD + return i; +} + +//inverse of text_visible +void text_pos(const char *str, int cursor, int &cx, int &cy, int maxwidth) +{ + #define TEXTINDEX(idx) if(idx == cursor) { cx = x; cy = y; break; } + #define TEXTWHITE(idx) + #define TEXTLINE(idx) + #define TEXTCOLOR(idx) + #define TEXTCHAR(idx) x += curfont->chars[c-33].w + 1; + #define TEXTWORD TEXTWORDSKELETON if(i >= cursor) break; + cx = INT_MIN; + cy = 0; + TEXTSKELETON + if(cx == INT_MIN) { cx = x; cy = y; } + #undef TEXTINDEX + #undef TEXTWHITE + #undef TEXTLINE + #undef TEXTCOLOR + #undef TEXTCHAR + #undef TEXTWORD +} + +void text_bounds(const char *str, int &width, int &height, int maxwidth) +{ + #define TEXTINDEX(idx) + #define TEXTWHITE(idx) + #define TEXTLINE(idx) if(x > width) width = x; + #define TEXTCOLOR(idx) + #define TEXTCHAR(idx) x += curfont->chars[c-33].w + 1; + #define TEXTWORD x += w + 1; + width = 0; + TEXTSKELETON + height = y + FONTH; + TEXTLINE(_) + #undef TEXTINDEX + #undef TEXTWHITE + #undef TEXTLINE + #undef TEXTCOLOR + #undef TEXTCHAR + #undef TEXTWORD +} + +void draw_text(const char *str, int left, int top, int r, int g, int b, int a, int cursor, int maxwidth) +{ + #define TEXTINDEX(idx) if(idx == cursor) { cx = x; cy = y; } + #define TEXTWHITE(idx) + #define TEXTLINE(idx) + #define TEXTCOLOR(idx) text_color(str[idx], colorstack, sizeof(colorstack), colorpos, color, a); + #define TEXTCHAR(idx) x += draw_char(c, left+x, top+y)+1; + #define TEXTWORD TEXTWORDSKELETON + char colorstack[10]; + bvec color(r, g, b); + int colorpos = 0, cx = INT_MIN, cy = 0; + colorstack[0] = 'c'; //indicate user color + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBindTexture(GL_TEXTURE_2D, curfont->tex->id); + glBegin(GL_QUADS); + glColor4ub(color.x, color.y, color.z, a); + TEXTSKELETON + if(cursor >= 0 && (totalmillis/250)&1) + { + glColor4ub(r, g, b, a); + if(cx == INT_MIN) { cx = x; cy = y; } + if(maxwidth != -1 && cx >= maxwidth) { cx = 0; cy += FONTH; } + draw_char('_', left+cx, top+cy); + } + glEnd(); + #undef TEXTINDEX + #undef TEXTWHITE + #undef TEXTLINE + #undef TEXTCOLOR + #undef TEXTCHAR + #undef TEXTWORD +} + +void reloadfonts() +{ + enumerate(fonts, font, f, + if(!reloadtexture(*f.tex)) fatal("failed to reload font texture"); + ); +} + diff --git a/src/engine/renderva.cpp b/src/engine/renderva.cpp new file mode 100644 index 0000000..29dfaed --- /dev/null +++ b/src/engine/renderva.cpp @@ -0,0 +1,2260 @@ +// renderva.cpp: handles the occlusion and rendering of vertex arrays + +#include "pch.h" +#include "engine.h" + +static inline void drawtris(GLsizei numindices, const GLvoid *indices, ushort minvert, ushort maxvert) +{ + if(hasDRE) glDrawRangeElements_(GL_TRIANGLES, minvert, maxvert, numindices, GL_UNSIGNED_SHORT, indices); + else glDrawElements(GL_TRIANGLES, numindices, GL_UNSIGNED_SHORT, indices); + glde++; +} + +static inline void drawvatris(vtxarray *va, GLsizei numindices, const GLvoid *indices) +{ + drawtris(numindices, indices, va->minvert, va->maxvert); +} + +///////// view frustrum culling /////////////////////// + +plane vfcP[5]; // perpindictular vectors to view frustrum bounding planes +float vfcDfog; // far plane culling distance (fog limit). +float vfcDnear[5], vfcDfar[5]; +float vfcfov, vfcfovy; + +vtxarray *visibleva; + +int isvisiblesphere(float rad, const vec &cv) +{ + int v = VFC_FULL_VISIBLE; + float dist; + + loopi(5) + { + dist = vfcP[i].dist(cv); + if(dist < -rad) return VFC_NOT_VISIBLE; + if(dist < rad) v = VFC_PART_VISIBLE; + } + + dist -= vfcDfog; + if(dist > rad) return VFC_FOGGED; //VFC_NOT_VISIBLE; // culling when fog is closer than size of world results in HOM + if(dist > -rad) v = VFC_PART_VISIBLE; + + return v; +} + +int isvisiblecube(const ivec &o, int size) +{ + int v = VFC_FULL_VISIBLE; + float dist; + + loopi(5) + { + dist = o.dist(vfcP[i]); + if(dist < -vfcDfar[i]*size) return VFC_NOT_VISIBLE; + if(dist < -vfcDnear[i]*size) v = VFC_PART_VISIBLE; + } + + dist -= vfcDfog; + if(dist > -vfcDnear[4]*size) return VFC_FOGGED; + if(dist > -vfcDfar[4]*size) v = VFC_PART_VISIBLE; + + return v; +} + +float vadist(vtxarray *va, const vec &p) +{ + return p.dist_to_bb(va->bbmin, va->bbmax); +} + +#define VASORTSIZE 64 + +static vtxarray *vasort[VASORTSIZE]; + +void addvisibleva(vtxarray *va) +{ + float dist = vadist(va, camera1->o); + va->distance = int(dist); /*cv.dist(camera1->o) - va->size*SQRT3/2*/ + + int hash = min(int(dist*VASORTSIZE/hdr.worldsize), VASORTSIZE-1); + vtxarray **prev = &vasort[hash], *cur = vasort[hash]; + + while(cur && va->distance >= cur->distance) + { + prev = &cur->next; + cur = cur->next; + } + + va->next = *prev; + *prev = va; +} + +void sortvisiblevas() +{ + visibleva = NULL; + vtxarray **last = &visibleva; + loopi(VASORTSIZE) if(vasort[i]) + { + vtxarray *va = vasort[i]; + *last = va; + while(va->next) va = va->next; + last = &va->next; + } +} + +void findvisiblevas(vector &vas, bool resetocclude = false) +{ + loopv(vas) + { + vtxarray &v = *vas[i]; + int prevvfc = resetocclude ? VFC_NOT_VISIBLE : v.curvfc; + v.curvfc = isvisiblecube(v.o, v.size); + if(v.curvfc!=VFC_NOT_VISIBLE) + { + if(pvsoccluded(v.o, v.size)) + { + v.curvfc += PVS_FULL_VISIBLE - VFC_FULL_VISIBLE; + continue; + } + addvisibleva(&v); + if(v.children.length()) findvisiblevas(v.children, prevvfc>=VFC_NOT_VISIBLE); + if(prevvfc>=VFC_NOT_VISIBLE) + { + v.occluded = !v.texs || pvsoccluded(v.geommin, v.geommax) ? OCCLUDE_GEOM : OCCLUDE_NOTHING; + v.query = NULL; + } + } + } +} + +void calcvfcD() +{ + loopi(5) + { + plane &p = vfcP[i]; + vfcDnear[i] = vfcDfar[i] = 0; + loopk(3) if(p[k] > 0) vfcDfar[i] += p[k]; + else vfcDnear[i] += p[k]; + } +} + +void setvfcP(float yaw, float pitch, const vec &camera, float minyaw = -M_PI, float maxyaw = M_PI, float minpitch = -M_PI, float maxpitch = M_PI) +{ + yaw *= RAD; + pitch *= RAD; + vfcP[0].toplane(vec(yaw + M_PI/2 - min(vfcfov, -minyaw), pitch), camera); // left plane + vfcP[1].toplane(vec(yaw - M_PI/2 + min(vfcfov, maxyaw), pitch), camera); // right plane + vfcP[2].toplane(vec(yaw, pitch + M_PI/2 - min(vfcfovy, -minpitch)), camera); // top plane + vfcP[3].toplane(vec(yaw, pitch - M_PI/2 + min(vfcfovy, maxpitch)), camera); // bottom plane + vfcP[4].toplane(vec(yaw, pitch), camera); // near/far planes + extern int fog; + vfcDfog = fog; + calcvfcD(); +} + +plane oldvfcP[5]; + +void reflectvfcP(float z, float minyaw, float maxyaw, float minpitch, float maxpitch) +{ + memcpy(oldvfcP, vfcP, sizeof(vfcP)); + + if(z < 0) setvfcP(camera1->yaw, camera1->pitch, camera1->o, minyaw, maxyaw, minpitch, maxpitch); + else + { + vec o(camera1->o); + o.z = z-(camera1->o.z-z); + setvfcP(camera1->yaw, -camera1->pitch, o, minyaw, maxyaw, -maxpitch, -minpitch); + } +} + +void restorevfcP() +{ + memcpy(vfcP, oldvfcP, sizeof(vfcP)); + calcvfcD(); +} + +extern vector varoot; + +void visiblecubes(float fov, float fovy) +{ + memset(vasort, 0, sizeof(vasort)); + + vfcfov = fov*0.5f*RAD; + vfcfovy = fovy*0.5f*RAD; + + // Calculate view frustrum: Only changes if resize, but... + setvfcP(camera1->yaw, camera1->pitch, camera1->o); + + findvisiblevas(varoot); + sortvisiblevas(); +} + +static inline bool insideva(const vtxarray *va, const vec &v, int margin = 1) +{ + int size = va->size + margin; + return v.x>=va->o.x-margin && v.y>=va->o.y-margin && v.z>=va->o.z-margin && + v.x<=va->o.x+size && v.y<=va->o.y+size && v.z<=va->o.z+size; +} + +static ivec vaorigin; + +static void resetorigin() +{ + vaorigin = ivec(-1, -1, -1); +} + +static bool setorigin(vtxarray *va, bool shadowmatrix = false) +{ + ivec o = floatvtx ? ivec(0, 0, 0) : ivec(va->o).mask(~VVEC_INT_MASK).add(0x8000>>VVEC_FRAC); + if(o != vaorigin) + { + vaorigin = o; + glPopMatrix(); + glPushMatrix(); + glTranslatef(o.x, o.y, o.z); + static const float scale = 1.0f / (1<= qf.max) + { + if(qf.max >= MAXQUERY) return NULL; + glGenQueries_(1, &qf.queries[qf.max++].id); + } + occludequery *query = &qf.queries[qf.cur++]; + query->owner = owner; + query->fragments = -1; + return query; +} + +void resetqueries() +{ + loopi(2) loopj(queryframes[i].max) queryframes[i].queries[j].owner = NULL; +} + +void clearqueries() +{ + loopi(2) + { + queryframe &qf = queryframes[i]; + loopj(qf.max) + { + glDeleteQueries_(1, &qf.queries[j].id); + qf.queries[j].owner = NULL; + } + qf.cur = qf.max = 0; + } +} + +VAR(oqfrags, 0, 8, 64); +VAR(oqreflect, 0, 4, 64); + +bool checkquery(occludequery *query, bool nowait) +{ + GLuint fragments; + if(query->fragments >= 0) fragments = query->fragments; + else + { + if(nowait) + { + GLint avail; + glGetQueryObjectiv_(query->id, GL_QUERY_RESULT_AVAILABLE, &avail); + if(!avail) return false; + } + glGetQueryObjectuiv_(query->id, GL_QUERY_RESULT_ARB, &fragments); + query->fragments = fragments; + } + return fragments < (uint)(reflecting || refracting ? oqreflect : oqfrags); +} + +void drawbb(const ivec &bo, const ivec &br, const vec &camera, int scale, const ivec &origin) +{ + glBegin(GL_QUADS); + + loopi(6) + { + int dim = dimension(i), coord = dimcoord(i); + + if(coord) + { + if(camera[dim] < bo[dim] + br[dim]) continue; + } + else if(camera[dim] > bo[dim]) continue; + + loopj(4) + { + const ivec &cc = cubecoords[fv[i][j]]; + glVertex3f(((cc.x ? bo.x+br.x : bo.x) - origin.x) << scale, + ((cc.y ? bo.y+br.y : bo.y) - origin.y) << scale, + ((cc.z ? bo.z+br.z : bo.z) - origin.z) << scale); + } + + xtraverts += 4; + } + + glEnd(); +} + +extern int octaentsize; + +static octaentities *visiblemms, **lastvisiblemms; + +void findvisiblemms(const vector &ents) +{ + for(vtxarray *va = visibleva; va; va = va->next) + { + if(!va->mapmodels || va->curvfc >= VFC_FOGGED || va->occluded >= OCCLUDE_BB) continue; + loopv(*va->mapmodels) + { + octaentities *oe = (*va->mapmodels)[i]; + if(isvisiblecube(oe->o, oe->size) >= VFC_FOGGED || pvsoccluded(oe->bbmin, ivec(oe->bbmax).sub(oe->bbmin))) continue; + + bool occluded = oe->query && oe->query->owner == oe && checkquery(oe->query); + if(occluded) + { + oe->distance = -1; + + oe->next = NULL; + *lastvisiblemms = oe; + lastvisiblemms = &oe->next; + } + else + { + int visible = 0; + loopv(oe->mapmodels) + { + extentity &e = *ents[oe->mapmodels[i]]; + if(e.visible || (e.attr3 && e.triggerstate == TRIGGER_DISAPPEARED)) continue; + e.visible = true; + ++visible; + } + if(!visible) continue; + + oe->distance = int(camera1->o.dist_to_bb(oe->o, oe->size)); + + octaentities **prev = &visiblemms, *cur = visiblemms; + while(cur && cur->distance >= 0 && oe->distance > cur->distance) + { + prev = &cur->next; + cur = cur->next; + } + + if(*prev == NULL) lastvisiblemms = &oe->next; + oe->next = *prev; + *prev = oe; + } + } + } +} + +VAR(oqmm, 0, 4, 8); + +extern bool getentboundingbox(extentity &e, ivec &o, ivec &r); + +void rendermapmodel(extentity &e) +{ + int anim = ANIM_MAPMODEL|ANIM_LOOP, basetime = 0; + if(e.attr3) switch(e.triggerstate) + { + case TRIGGER_RESET: anim = ANIM_TRIGGER|ANIM_START; break; + case TRIGGERING: anim = ANIM_TRIGGER; basetime = e.lasttrigger; break; + case TRIGGERED: anim = ANIM_TRIGGER|ANIM_END; break; + case TRIGGER_RESETTING: anim = ANIM_TRIGGER|ANIM_REVERSE; basetime = e.lasttrigger; break; + } + mapmodelinfo &mmi = getmminfo(e.attr2); + if(&mmi) rendermodel(&e.light, mmi.name, anim, e.o, (float)((e.attr1+7)-(e.attr1+7)%15), 0, MDL_CULL_VFC | MDL_CULL_DIST | MDL_DYNLIGHT, NULL, NULL, basetime); +} + +extern int reflectdist; + +static vector renderedmms; + +vtxarray *reflectedva; + +void renderreflectedmapmodels() +{ + vector reflectedmms; + vector &mms = reflecting ? reflectedmms : renderedmms; + const vector &ents = et->getents(); + + if(reflecting) + { + for(vtxarray *va = reflectedva; va; va = va->rnext) + { + if(!va->mapmodels || va->distance > reflectdist) continue; + loopv(*va->mapmodels) reflectedmms.add((*va->mapmodels)[i]); + } + } + loopv(mms) + { + octaentities *oe = mms[i]; + if(reflecting || refracting>0 ? oe->bbmax.z <= reflectz : oe->bbmin.z >= reflectz) continue; + if(isvisiblecube(oe->o, oe->size) >= VFC_FOGGED) continue; + loopv(oe->mapmodels) + { + extentity &e = *ents[oe->mapmodels[i]]; + if(e.visible || (e.attr3 && e.triggerstate == TRIGGER_DISAPPEARED)) continue; + e.visible = true; + } + } + if(mms.length()) + { + startmodelbatches(); + loopv(mms) + { + octaentities *oe = mms[i]; + loopv(oe->mapmodels) + { + extentity &e = *ents[oe->mapmodels[i]]; + if(!e.visible) continue; + rendermapmodel(e); + e.visible = false; + } + } + endmodelbatches(); + } +} + +void rendermapmodels() +{ + const vector &ents = et->getents(); + + visiblemms = NULL; + lastvisiblemms = &visiblemms; + findvisiblemms(ents); + + static int skipoq = 0; + bool doquery = hasOQ && oqfrags && oqmm; + + renderedmms.setsizenodelete(0); + startmodelbatches(); + for(octaentities *oe = visiblemms; oe; oe = oe->next) if(oe->distance>=0) + { + loopv(oe->mapmodels) + { + extentity &e = *ents[oe->mapmodels[i]]; + if(!e.visible || (e.attr3 && e.triggerstate == TRIGGER_DISAPPEARED)) continue; + if(renderedmms.empty() || renderedmms.last()!=oe) + { + renderedmms.add(oe); + oe->query = doquery && oe->distance>0 && !(++skipoq%oqmm) ? newquery(oe) : NULL; + if(oe->query) startmodelquery(oe->query); + } + rendermapmodel(e); + e.visible = false; + } + if(renderedmms.length() && renderedmms.last()==oe && oe->query) endmodelquery(); + } + endmodelbatches(); + + bool colormask = true; + for(octaentities *oe = visiblemms; oe; oe = oe->next) if(oe->distance<0) + { + oe->query = doquery ? newquery(oe) : NULL; + if(!oe->query) continue; + if(colormask) + { + glDepthMask(GL_FALSE); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + nocolorshader->set(); + colormask = false; + } + startquery(oe->query); + drawbb(oe->bbmin, ivec(oe->bbmax).sub(oe->bbmin)); + endquery(oe->query); + } + if(!colormask) + { + glDepthMask(GL_TRUE); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, fading ? GL_FALSE : GL_TRUE); + } +} + +static inline bool bbinsideva(const ivec &bo, const ivec &br, vtxarray *va) +{ + return bo.x >= va->bbmin.x && bo.y >= va->bbmin.y && va->o.z >= va->bbmin.z && + bo.x + br.x <= va->bbmax.x && bo.y + br.y <= va->bbmax.y && bo.z + br.z <= va->bbmax.z; +} + +static inline bool bboccluded(const ivec &bo, const ivec &br, cube *c, const ivec &o, int size) +{ + loopoctabox(o, size, bo, br) + { + ivec co(i, o.x, o.y, o.z, size); + if(c[i].ext && c[i].ext->va) + { + vtxarray *va = c[i].ext->va; + if(va->curvfc >= VFC_FOGGED || (va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va))) continue; + } + if(c[i].children && bboccluded(bo, br, c[i].children, co, size>>1)) continue; + return false; + } + return true; +} + +bool bboccluded(const ivec &bo, const ivec &br) +{ + int diff = (bo.x^(bo.x+br.x)) | (bo.y^(bo.y+br.y)) | (bo.z^(bo.z+br.z)); + if(diff&~((1<ext && c->ext->va) + { + vtxarray *va = c->ext->va; + if(va->curvfc >= VFC_FOGGED || va->occluded >= OCCLUDE_BB) return true; + } + scale--; + while(c->children && !(diff&(1<children[octastep(bo.x, bo.y, bo.z, scale)]; + if(c->ext && c->ext->va) + { + vtxarray *va = c->ext->va; + if(va->curvfc >= VFC_FOGGED || va->occluded >= OCCLUDE_BB) return true; + } + scale--; + } + if(c->children) return bboccluded(bo, br, c->children, ivec(bo).mask(~((2<set(); + + glDisable(GL_TEXTURE_2D); + glEnableClientState(GL_VERTEX_ARRAY); + + glPushMatrix(); + + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + glColor3ub((outline>>16)&0xFF, (outline>>8)&0xFF, outline&0xFF); + + enablepolygonoffset(GL_POLYGON_OFFSET_LINE); + + if(!dtoutline) glDisable(GL_DEPTH_TEST); + + resetorigin(); + vtxarray *prev = NULL; + for(vtxarray *va = visibleva; va; va = va->next) + { + if(!va->texs || va->occluded >= OCCLUDE_GEOM) continue; + + if(!prev || va->vbuf != prev->vbuf) + { + setorigin(va); + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->ebuf); + } + glVertexPointer(3, floatvtx ? GL_FLOAT : GL_SHORT, VTXSIZE, &va->vdata[0].x); + } + + drawvatris(va, 3*va->tris, va->edata); + xtravertsva += va->verts; + + prev = va; + } + + if(!dtoutline) glEnable(GL_DEPTH_TEST); + + disablepolygonoffset(GL_POLYGON_OFFSET_LINE); + + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + + glPopMatrix(); + + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + glDisableClientState(GL_VERTEX_ARRAY); + glEnable(GL_TEXTURE_2D); + + defaultshader->set(); +} + +void rendershadowmapreceivers() +{ + if(!hasBE) return; + + static Shader *shadowmapshader = NULL; + if(!shadowmapshader) shadowmapshader = lookupshaderbyname("shadowmapreceiver"); + shadowmapshader->set(); + + glDisable(GL_TEXTURE_2D); + glEnableClientState(GL_VERTEX_ARRAY); + + glCullFace(GL_BACK); + glDepthMask(GL_FALSE); + glDepthFunc(GL_GREATER); + + extern int ati_minmax_bug; + if(!ati_minmax_bug) glColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_FALSE); + + glEnable(GL_BLEND); + glBlendEquation_(GL_MAX_EXT); + glBlendFunc(GL_ONE, GL_ONE); + + glPushMatrix(); + + resetorigin(); + vtxarray *prev = NULL; + for(vtxarray *va = visibleva; va; va = va->next) + { + if(!va->texs || va->curvfc >= VFC_FOGGED || !isshadowmapreceiver(va)) continue; + + if(!prev || va->vbuf != prev->vbuf) + { + setorigin(va); + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->ebuf); + } + glVertexPointer(3, floatvtx ? GL_FLOAT : GL_SHORT, VTXSIZE, &va->vdata[0].x); + } + + drawvatris(va, 3*va->tris, va->edata); + xtravertsva += va->verts; + + prev = va; + } + + glPopMatrix(); + + glDisable(GL_BLEND); + glBlendEquation_(GL_FUNC_ADD_EXT); + + glCullFace(GL_FRONT); + glDepthMask(GL_TRUE); + glDepthFunc(GL_LESS); + + if(!ati_minmax_bug) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + glDisableClientState(GL_VERTEX_ARRAY); + glEnable(GL_TEXTURE_2D); +} + +void renderdepthobstacles(const vec &bbmin, const vec &bbmax, float scale, float *ranges, int numranges) +{ + float scales[4] = { 0, 0, 0, 0 }, offsets[4] = { 0, 0, 0, 0 }; + if(numranges < 0) + { + SETSHADER(depthfxsplitworld); + + loopi(-numranges) + { + if(!i) scales[i] = 1.0f/scale; + else scales[i] = scales[i-1]*256; + } + } + else + { + SETSHADER(depthfxworld); + + if(!numranges) loopi(4) scales[i] = 1.0f/scale; + else loopi(numranges) + { + scales[i] = 1.0f/scale; + offsets[i] = -ranges[i]/scale; + } + } + setlocalparamfv("depthscale", SHPARAM_VERTEX, 0, scales); + setlocalparamfv("depthoffsets", SHPARAM_VERTEX, 1, offsets); + + glDisable(GL_TEXTURE_2D); + glEnableClientState(GL_VERTEX_ARRAY); + + glPushMatrix(); + + resetorigin(); + vtxarray *prev = NULL; + for(vtxarray *va = visibleva; va; va = va->next) + { + if(!va->texs || va->occluded >= OCCLUDE_GEOM || + va->o.x > bbmax.x || va->o.y > bbmax.y || va->o.z > bbmax.z || + va->o.x + va->size < bbmin.x || va->o.y + va->size < bbmin.y || va->o.z + va->size < bbmin.z) + continue; + + if(!prev || va->vbuf != prev->vbuf) + { + setorigin(va); + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->ebuf); + } + glVertexPointer(3, floatvtx ? GL_FLOAT : GL_SHORT, VTXSIZE, &va->vdata[0].x); + } + + drawvatris(va, 3*va->tris, va->edata); + xtravertsva += va->verts; + + prev = va; + } + + glPopMatrix(); + + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + glDisableClientState(GL_VERTEX_ARRAY); + glEnable(GL_TEXTURE_2D); + + defaultshader->set(); +} + +// [rotation][dimension] = vec4 +float orientation_tangent [6][3][4] = +{ + { { 0, 1, 0, 0 }, { 1, 0, 0, 0 }, { 1, 0, 0, 0 } }, + { { 0, 0, -1, 0 }, { 0, 0, -1, 0 }, { 0, 1, 0, 0 } }, + { { 0, -1, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 } }, + { { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, -1, 0, 0 } }, + { { 0, -1, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 } }, + { { 0, 1, 0, 0 }, { 1, 0, 0, 0 }, { 1, 0, 0, 0 } }, +}; +float orientation_binormal[6][3][4] = +{ + { { 0, 0, -1, 0 }, { 0, 0, -1, 0 }, { 0, 1, 0, 0 } }, + { { 0, -1, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 } }, + { { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, -1, 0, 0 } }, + { { 0, 1, 0, 0 }, { 1, 0, 0, 0 }, { 1, 0, 0, 0 } }, + { { 0, 0, -1, 0 }, { 0, 0, -1, 0 }, { 0, 1, 0, 0 } }, + { { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, -1, 0, 0 } }, +}; + +struct renderstate +{ + bool colormask, depthmask, mtglow, skippedglow; + GLuint vbuf; + float fogplane; + int diffusetmu, lightmaptmu, glowtmu, fogtmu, causticstmu; + GLfloat color[4]; + vec glowcolor; + GLuint textures[8]; + Slot *slot; + float texgenSk, texgenSoff, texgenTk, texgenToff; + int texgendim; + bool mttexgen; + int visibledynlights; + uint dynlightmask; + + renderstate() : colormask(true), depthmask(true), mtglow(false), skippedglow(false), vbuf(0), fogplane(-1), diffusetmu(0), lightmaptmu(1), glowtmu(-1), fogtmu(-1), causticstmu(-1), glowcolor(1, 1, 1), slot(NULL), texgendim(-1), mttexgen(false), visibledynlights(0), dynlightmask(0) + { + loopk(4) color[k] = 1; + loopk(8) textures[k] = 0; + } +}; + +void renderquery(renderstate &cur, occludequery *query, vtxarray *va) +{ + nocolorshader->set(); + if(cur.colormask) { cur.colormask = false; glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); } + if(cur.depthmask) { cur.depthmask = false; glDepthMask(GL_FALSE); } + + vec camera(camera1->o); + if(reflecting) camera.z = reflectz; + + startquery(query); + + drawbb(va->bbmin, ivec(va->bbmax).sub(va->bbmin), camera, vaorigin.x >= 0 ? VVEC_FRAC : 0, vaorigin.x >= 0 ? vaorigin : ivec(0, 0, 0)); + + endquery(query); +} + +enum +{ + RENDERPASS_LIGHTMAP = 0, + RENDERPASS_COLOR, + RENDERPASS_Z, + RENDERPASS_GLOW, + RENDERPASS_CAUSTICS, + RENDERPASS_FOG +}; + +struct geombatch +{ + const elementset &es; + Slot &slot; + ushort *edata; + vtxarray *va; + int next, batch; + + geombatch(const elementset &es, ushort *edata, vtxarray *va) + : es(es), slot(lookuptexture(es.texture)), edata(edata), va(va), + next(-1), batch(-1) + {} + + int compare(const geombatch &b) const + { + if(va->vbuf < b.va->vbuf) return -1; + if(va->vbuf > b.va->vbuf) return 1; + if(va->dynlightmask < b.va->dynlightmask) return -1; + if(va->dynlightmask > b.va->dynlightmask) return 1; + if(renderpath!=R_FIXEDFUNCTION) + { + if(slot.shader < b.slot.shader) return -1; + if(slot.shader > b.slot.shader) return 1; + if(slot.params.length() < b.slot.params.length()) return -1; + if(slot.params.length() > b.slot.params.length()) return 1; + } + if(es.texture < b.es.texture) return -1; + if(es.texture > b.es.texture) return 1; + if(es.lmid < b.es.lmid) return -1; + if(es.lmid > b.es.lmid) return 1; + if(es.envmap < b.es.envmap) return -1; + if(es.envmap > b.es.envmap) return 1; + return 0; + } +}; + +static vector geombatches; +static int firstbatch = -1, numbatches = 0; + +static void mergetexs(vtxarray *va, elementset *texs = NULL, int numtexs = 0, ushort *edata = NULL) +{ + if(!texs) + { + texs = va->eslist; + numtexs = va->texs; + edata = va->edata; + } + + if(firstbatch < 0) + { + firstbatch = geombatches.length(); + numbatches = numtexs; + loopi(numtexs-1) + { + geombatches.add(geombatch(texs[i], edata, va)).next = i+1; + edata += texs[i].length[5]; + } + geombatches.add(geombatch(texs[numtexs-1], edata, va)); + return; + } + + int prevbatch = -1, curbatch = firstbatch, curtex = 0; + do + { + geombatch &b = geombatches.add(geombatch(texs[curtex], edata, va)); + edata += texs[curtex].length[5]; + int dir = -1; + while(curbatch >= 0) + { + dir = b.compare(geombatches[curbatch]); + if(dir <= 0) break; + prevbatch = curbatch; + curbatch = geombatches[curbatch].next; + } + if(!dir) + { + int last = curbatch, next; + for(;;) + { + next = geombatches[last].batch; + if(next < 0) break; + last = next; + } + if(last==curbatch) + { + b.batch = curbatch; + b.next = geombatches[curbatch].next; + if(prevbatch < 0) firstbatch = geombatches.length()-1; + else geombatches[prevbatch].next = geombatches.length()-1; + curbatch = geombatches.length()-1; + } + else + { + b.batch = next; + geombatches[last].batch = geombatches.length()-1; + } + } + else + { + numbatches++; + b.next = curbatch; + if(prevbatch < 0) firstbatch = geombatches.length()-1; + else geombatches[prevbatch].next = geombatches.length()-1; + prevbatch = geombatches.length()-1; + } + } + while(++curtex < numtexs); +} + +static void mergeglowtexs(vtxarray *va) +{ + int start = -1; + ushort *edata = va->edata, *startdata = NULL; + loopi(va->texs) + { + elementset &es = va->eslist[i]; + Slot &slot = lookuptexture(es.texture, false); + if(slot.texmask&(1<=0) + { + mergetexs(va, &va->eslist[start], i-start, startdata); + start = -1; + } + edata += es.length[5]; + } + if(start>=0) mergetexs(va, &va->eslist[start], va->texs-start, startdata); +} + +static void changefogplane(renderstate &cur, int pass, vtxarray *va) +{ + if(renderpath!=R_FIXEDFUNCTION) + { + if(fading || fogging) + { + float fogplane = reflectz - vaorigin.z; + if(cur.fogplane!=fogplane) + { + cur.fogplane = fogplane; + if(fogging) setfogplane(1.0f/(1<=0 && (pass==RENDERPASS_LIGHTMAP || pass==RENDERPASS_GLOW))) + { + if(pass==RENDERPASS_LIGHTMAP) glActiveTexture_(GL_TEXTURE0_ARB+cur.fogtmu); + else if(pass==RENDERPASS_GLOW) glActiveTexture_(GL_TEXTURE1_ARB); + GLfloat s[4] = { 0, 0, -1.0f/(waterfog<vbuf); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->ebuf); + } + cur.vbuf = va->vbuf; + + glVertexPointer(3, floatvtx ? GL_FLOAT : GL_SHORT, VTXSIZE, &va->vdata[0].x); + + if(pass==RENDERPASS_LIGHTMAP) + { + glClientActiveTexture_(GL_TEXTURE0_ARB+cur.lightmaptmu); + glTexCoordPointer(2, GL_SHORT, VTXSIZE, floatvtx ? &((fvertex *)va->vdata)[0].u : &va->vdata[0].u); + glClientActiveTexture_(GL_TEXTURE0_ARB+cur.diffusetmu); + + if(renderpath!=R_FIXEDFUNCTION) + { + glColorPointer(3, GL_UNSIGNED_BYTE, VTXSIZE, floatvtx ? &((fvertex *)va->vdata)[0].n : &va->vdata[0].n); + setenvparamf("camera", SHPARAM_VERTEX, 4, + (camera1->o.x - vaorigin.x)*(1<o.y - vaorigin.y)*(1<o.z - vaorigin.z)*(1<type&SHADER_NORMALSLMS) + { + if(cur.textures[tmu]!=lightmaptexs[lmid+1].id) + { + glActiveTexture_(GL_TEXTURE0_ARB+tmu); + glBindTexture(GL_TEXTURE_2D, cur.textures[tmu] = lightmaptexs[lmid+1].id); + changed = true; + } + tmu++; + } + if(b.slot.shader->type&SHADER_ENVMAP && b.es.envmap!=EMID_CUSTOM) + { + GLuint emtex = lookupenvmap(b.es.envmap); + if(cur.textures[tmu]!=emtex) + { + glActiveTexture_(GL_TEXTURE0_ARB+tmu); + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, cur.textures[tmu] = emtex); + changed = true; + } + } + } + if(changed) glActiveTexture_(GL_TEXTURE0_ARB+cur.diffusetmu); +} + +static void changeglow(renderstate &cur, int pass, Slot &slot) +{ + vec color = slot.glowcolor; + if(slot.pulseglowspeed) + { + float k = lastmillis*slot.pulseglowspeed; + k -= floor(k); + k = fabs(k*2 - 1); + color.lerp(color, slot.pulseglowcolor, k); + } + if(pass==RENDERPASS_GLOW) + { + if(cur.glowcolor!=color) glColor3fv(color.v); + } + else + { + if(cur.glowcolor!=color) + { + if(color==vec(1, 1, 1)) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.glowtmu); + setuptmu(cur.glowtmu, "P + T"); + } + else if(hasTE3 || hasTE4) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.glowtmu); + if(cur.glowcolor==vec(1, 1, 1)) + { + if(hasTE3) setuptmu(cur.glowtmu, "TPK3"); + else if(hasTE4) setuptmu(cur.glowtmu, "TKP14"); + } + colortmu(cur.glowtmu, color.x, color.y, color.z); + } + else + { + slot.mtglowed = false; + cur.skippedglow = true; + return; + } + } + else glActiveTexture_(GL_TEXTURE0_ARB+cur.glowtmu); + if(!cur.mtglow) { glEnable(GL_TEXTURE_2D); cur.mtglow = true; } + slot.mtglowed = true; + } + loopvj(slot.sts) + { + Slot::Tex &t = slot.sts[j]; + if(t.type==TEX_GLOW && t.combined<0) + { + if(cur.textures[cur.glowtmu]!=t.t->id) + glBindTexture(GL_TEXTURE_2D, cur.textures[cur.glowtmu] = t.t->id); + break; + } + } + cur.glowcolor = color; +} + +static void changeslottmus(renderstate &cur, int pass, Slot &slot) +{ + if(pass==RENDERPASS_LIGHTMAP || pass==RENDERPASS_COLOR) + { + GLuint diffusetex = slot.sts.empty() ? notexture->id : slot.sts[0].t->id; + if(cur.textures[cur.diffusetmu]!=diffusetex) + glBindTexture(GL_TEXTURE_2D, cur.textures[cur.diffusetmu] = diffusetex); + } + + if(renderpath==R_FIXEDFUNCTION) + { + if(slot.texmask&(1<type&SHADER_NORMALSLMS) tmu++; + if(slot.shader->type&SHADER_ENVMAP) envmaptmu = tmu++; + loopvj(slot.sts) + { + Slot::Tex &t = slot.sts[j]; + if(t.type==TEX_DIFFUSE || t.combined>=0) continue; + if(t.type==TEX_ENVMAP) + { + if(envmaptmu>=0 && cur.textures[envmaptmu]!=t.t->id) + { + glActiveTexture_(GL_TEXTURE0_ARB+envmaptmu); + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, cur.textures[envmaptmu] = t.t->id); + } + continue; + } + else if(cur.textures[tmu]!=t.t->id) + { + glActiveTexture_(GL_TEXTURE0_ARB+tmu); + glBindTexture(GL_TEXTURE_2D, cur.textures[tmu] = t.t->id); + } + tmu++; + } + glActiveTexture_(GL_TEXTURE0_ARB+cur.diffusetmu); + } + + Texture *curtex = !cur.slot || cur.slot->sts.empty() ? notexture : cur.slot->sts[0].t, + *tex = slot.sts.empty() ? notexture : slot.sts[0].t; + if(!cur.slot || slot.sts.empty() || + (curtex->xs != tex->xs || curtex->ys != tex->ys || + cur.slot->rotation != slot.rotation || cur.slot->scale != slot.scale || + cur.slot->xoffset != slot.xoffset || cur.slot->yoffset != slot.yoffset || + cur.slot->scrollS != slot.scrollS || cur.slot->scrollT != slot.scrollT)) + { + float k = 8.0f/slot.scale/(1<=2 && slot.rotation<=4 ? -tex->xs : tex->xs, + ys = (slot.rotation>=1 && slot.rotation<=2) || slot.rotation==5 ? -tex->ys : tex->ys; + if((slot.rotation&5)==1) + { + cur.texgenSk = k/xs; cur.texgenSoff = (slot.scrollT*lastmillis*tex->xs - slot.yoffset)/xs; + cur.texgenTk = k/ys; cur.texgenToff = (slot.scrollS*lastmillis*tex->ys - slot.xoffset)/ys; + } + else + { + cur.texgenSk = k/xs; cur.texgenSoff = (slot.scrollS*lastmillis*tex->xs - slot.xoffset)/xs; + cur.texgenTk = k/ys; cur.texgenToff = (slot.scrollT*lastmillis*tex->ys - slot.yoffset)/ys; + } + cur.texgendim = -1; + } + + cur.slot = &slot; +} + +static void changeshader(renderstate &cur, Shader *s, Slot &slot, bool shadowed) +{ + if(glaring) + { + Shader *g = s->hasvariant(min(s->variants[4].length()-1, cur.visibledynlights), 4); + if(g) g->set(&slot); + else + { + static Shader *noglareshader = NULL; + if(!noglareshader) noglareshader = lookupshaderbyname("noglareworld"); + noglareshader->set(&slot); + } + } + else if(fading) + { + if(shadowed) s->variant(min(s->variants[3].length()-1, cur.visibledynlights), 3)->set(&slot); + else s->variant(min(s->variants[2].length()-1, cur.visibledynlights), 2)->set(&slot); + } + else if(shadowed) s->variant(min(s->variants[1].length()-1, cur.visibledynlights), 1)->set(&slot); + else if(!cur.visibledynlights) s->set(&slot); + else s->variant(min(s->variants[0].length()-1, cur.visibledynlights-1))->set(&slot); + if(s->type&SHADER_GLSLANG) cur.texgendim = -1; +} + +static void changetexgen(renderstate &cur, Slot &slot, int dim) +{ + static const int si[] = { 1, 0, 0 }; + static const int ti[] = { 2, 2, 1 }; + + GLfloat sgen[4] = { 0.0f, 0.0f, 0.0f, cur.texgenSoff }, + tgen[4] = { 0.0f, 0.0f, 0.0f, cur.texgenToff }; + int sdim = si[dim], tdim = ti[dim]; + if((slot.rotation&5)==1) + { + sgen[tdim] = (dim <= 1 ? -cur.texgenSk : cur.texgenSk); + sgen[3] += (vaorigin[tdim]<shadowed ? b.es.minvert[dim] : min(b.es.minvert[dim], b.es.minvert[dim+1])), + maxvert(b.va->shadowed ? b.es.maxvert[dim] : max(b.es.maxvert[dim], b.es.maxvert[dim+1])) + {} +}; + +static void renderbatch(renderstate &cur, int pass, geombatch &b) +{ + static vector draws[6]; + for(geombatch *curbatch = &b;; curbatch = &geombatches[curbatch->batch]) + { + int dim = 0; + ushort offset = 0, len = 0; + loopi(3) + { + offset += len; + len = curbatch->es.length[dim + (curbatch->va->shadowed ? 0 : 1)] - offset; + if(len) draws[dim].add(batchdrawinfo(*curbatch, dim, offset, len)); + dim++; + + if(curbatch->va->shadowed) + { + offset += len; + len = curbatch->es.length[dim] - offset; + if(len) draws[dim].add(batchdrawinfo(*curbatch, dim, offset, len)); + } + dim++; + } + if(curbatch->batch < 0) break; + } + loop(shadowed, 2) + { + bool rendered = false; + loop(dim, 3) + { + vector &draw = draws[2*dim + shadowed]; + if(draw.empty()) continue; + + if(!rendered) + { + if(renderpath!=R_FIXEDFUNCTION) changeshader(cur, b.slot.shader, b.slot, shadowed!=0); + rendered = true; + } + if(cur.texgendim!=dim || cur.mtglow>cur.mttexgen) + changetexgen(cur, b.slot, dim); + + gbatches++; + loopv(draw) + { + batchdrawinfo &info = draw[i]; + drawtris(info.len, info.edata, info.minvert, info.maxvert); + vtris += info.len/3; + } + draw.setsizenodelete(0); + } + } +} + +static void resetbatches() +{ + geombatches.setsizenodelete(0); + firstbatch = -1; + numbatches = 0; +} + +static void renderbatches(renderstate &cur, int pass) +{ + cur.slot = NULL; + int curbatch = firstbatch; + if(curbatch >= 0) + { + if(!cur.depthmask) { cur.depthmask = true; glDepthMask(GL_TRUE); } + if(!cur.colormask) { cur.colormask = true; glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } + } + while(curbatch >= 0) + { + geombatch &b = geombatches[curbatch]; + curbatch = b.next; + + if(cur.vbuf != b.va->vbuf) + { + changevbuf(cur, pass, b.va); + changefogplane(cur, pass, b.va); + } + if(pass == RENDERPASS_LIGHTMAP) + { + changebatchtmus(cur, pass, b); + if(cur.dynlightmask != b.va->dynlightmask) + { + cur.visibledynlights = setdynlights(b.va, vaorigin); + cur.dynlightmask = b.va->dynlightmask; + } + } + if(cur.slot != &b.slot) changeslottmus(cur, pass, b.slot); + + renderbatch(cur, pass, b); + } + + if(pass == RENDERPASS_LIGHTMAP && cur.mtglow) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.glowtmu); + glDisable(GL_TEXTURE_2D); + glActiveTexture_(GL_TEXTURE0_ARB+cur.diffusetmu); + cur.mtglow = false; + } + + resetbatches(); +} + +void renderzpass(renderstate &cur, vtxarray *va) +{ + if(cur.vbuf!=va->vbuf) changevbuf(cur, RENDERPASS_Z, va); + if(!cur.depthmask) { cur.depthmask = true; glDepthMask(GL_TRUE); } + if(cur.colormask) { cur.colormask = false; glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); } + + extern int apple_glsldepth_bug; + if(renderpath!=R_GLSLANG || !apple_glsldepth_bug) + { + nocolorshader->set(); + drawvatris(va, 3*va->tris, va->edata); + } + else + { + static Shader *nocolorglslshader = NULL; + if(!nocolorglslshader) nocolorglslshader = lookupshaderbyname("nocolorglsl"); + Slot *lastslot = NULL; + int lastdraw = 0, offset = 0; + loopi(va->texs) + { + Slot &slot = lookuptexture(va->eslist[i].texture); + if(lastslot && (slot.shader->type&SHADER_GLSLANG) != (lastslot->shader->type&SHADER_GLSLANG) && offset > lastdraw) + { + (lastslot->shader->type&SHADER_GLSLANG ? nocolorglslshader : nocolorshader)->set(); + drawvatris(va, offset-lastdraw, va->edata+lastdraw); + lastdraw = offset; + } + lastslot = &slot; + offset += va->eslist[i].length[5]; + } + if(offset > lastdraw) + { + (lastslot->shader->type&SHADER_GLSLANG ? nocolorglslshader : nocolorshader)->set(); + drawvatris(va, offset-lastdraw, va->edata+lastdraw); + } + } + xtravertsva += va->verts; +} + +vector foggedvas; + +#define startvaquery(va, flush) \ + do { \ + if(!refracting) \ + { \ + occludequery *query = reflecting ? va->rquery : va->query; \ + if(query) \ + { \ + flush; \ + startquery(query); \ + } \ + } \ + } while(0) + + +#define endvaquery(va, flush) \ + do { \ + if(!refracting) \ + { \ + occludequery *query = reflecting ? va->rquery : va->query; \ + if(query) \ + { \ + flush; \ + endquery(query); \ + } \ + } \ + } while(0) + +void renderfoggedvas(renderstate &cur, bool doquery = false) +{ + static Shader *fogshader = NULL; + if(!fogshader) fogshader = lookupshaderbyname("fogworld"); + fogshader->set(); + + glDisable(GL_TEXTURE_2D); + + uchar wcol[3]; + getwatercolour(wcol); + glColor3ubv(wcol); + + loopv(foggedvas) + { + vtxarray *va = foggedvas[i]; + if(cur.vbuf!=va->vbuf) changevbuf(cur, RENDERPASS_FOG, va); + + if(doquery) startvaquery(va, ); + drawvatris(va, 3*va->tris, va->edata); + vtris += va->tris; + if(doquery) endvaquery(va, ); + } + + glEnable(GL_TEXTURE_2D); + + foggedvas.setsizenodelete(0); +} + +VAR(batchgeom, 0, 1, 1); + +void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bool fogpass = false, bool doquery = false) +{ + switch(pass) + { + case RENDERPASS_GLOW: + if(!(va->texmask&(1<verts; + va->shadowed = false; + va->dynlightmask = 0; + if(fogpass ? va->geommax.z<=reflectz-waterfog : va->curvfc==VFC_FOGGED) + { + foggedvas.add(va); + break; + } + if(renderpath!=R_FIXEDFUNCTION && !envmapping) + { + va->shadowed = isshadowmapreceiver(va); + calcdynlightmask(va); + } + if(doquery) startvaquery(va, { if(geombatches.length()) renderbatches(cur, pass); }); + mergetexs(va); + if(doquery) endvaquery(va, { if(geombatches.length()) renderbatches(cur, pass); }); + else if(!batchgeom && geombatches.length()) renderbatches(cur, pass); + break; + + case RENDERPASS_FOG: + if(cur.vbuf!=va->vbuf) + { + changevbuf(cur, pass, va); + changefogplane(cur, pass, va); + } + drawvatris(va, 3*va->tris, va->edata); + xtravertsva += va->verts; + break; + + case RENDERPASS_CAUSTICS: + if(cur.vbuf!=va->vbuf) changevbuf(cur, pass, va); + drawvatris(va, 3*va->tris, va->edata); + xtravertsva += va->verts; + break; + + case RENDERPASS_Z: + if(doquery) startvaquery(va, ); + renderzpass(cur, va); + if(doquery) endvaquery(va, ); + break; + } +} + +VAR(oqdist, 0, 256, 1024); +VAR(zpass, 0, 1, 1); +VAR(glowpass, 0, 1, 1); + +extern int ati_texgen_bug; + +static void setuptexgen(int dims = 2) +{ + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glEnable(GL_TEXTURE_GEN_S); + if(dims>=2) + { + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glEnable(GL_TEXTURE_GEN_T); + if(ati_texgen_bug) glEnable(GL_TEXTURE_GEN_R); // should not be needed, but apparently makes some ATI drivers happy + } +} + +static void disabletexgen(int dims = 2) +{ + glDisable(GL_TEXTURE_GEN_S); + if(dims>=2) + { + glDisable(GL_TEXTURE_GEN_T); + if(ati_texgen_bug) glDisable(GL_TEXTURE_GEN_R); + } +} + +GLuint fogtex = 0; + +void createfogtex() +{ + extern int bilinear; + uchar buf[2*256] = { 255, 0, 255, 255 }; + if(!bilinear) loopi(256) { buf[2*i] = 255; buf[2*i+1] = i; } + glGenTextures(1, &fogtex); + createtexture(fogtex, bilinear ? 2 : 256, 1, buf, 3, false, GL_LUMINANCE_ALPHA, GL_TEXTURE_1D); +} + +#define NUMCAUSTICS 32 + +VARR(causticscale, 0, 100, 10000); +VARR(causticmillis, 0, 75, 1000); +VARP(caustics, 0, 1, 1); + +static Texture *caustictex[NUMCAUSTICS] = { NULL }; + +void loadcaustics() +{ + if(caustictex[0]) return; + loopi(NUMCAUSTICS) + { + s_sprintfd(name)( + renderpath==R_FIXEDFUNCTION ? + "packages/caustics/caust%.2d.png" : + "packages/caustics/caust%.2d.png", + i); + caustictex[i] = textureload(name); + } +} + +void cleanupva() +{ + vaclearc(worldroot); + clearqueries(); + if(fogtex) { glDeleteTextures(1, &fogtex); fogtex = 0; } + loopi(NUMCAUSTICS) caustictex[i] = NULL; +} + +void setupcaustics(int tmu, float blend, GLfloat *color = NULL) +{ + if(!caustictex[0]) loadcaustics(); + + GLfloat s[4] = { 0.011f, 0, 0.0066f, 0 }; + GLfloat t[4] = { 0, 0.011f, 0.0066f, 0 }; + loopk(3) + { + s[k] *= 100.0f/(causticscale<id); + if(renderpath==R_FIXEDFUNCTION) + { + setuptexgen(); + setuptmu(tmu+i, !i ? "= T" : "T , P @ Ca"); + glTexGenfv(GL_S, GL_OBJECT_PLANE, s); + glTexGenfv(GL_T, GL_OBJECT_PLANE, t); + } + } + if(renderpath!=R_FIXEDFUNCTION) + { + static Shader *causticshader = NULL; + if(!causticshader) causticshader = lookupshaderbyname("caustic"); + causticshader->set(); + setlocalparamfv("texgenS", SHPARAM_VERTEX, 0, s); + setlocalparamfv("texgenT", SHPARAM_VERTEX, 1, t); + setlocalparamf("frameoffset", SHPARAM_PIXEL, 0, blend*(1-frac), blend*frac, blend); + } +} + +void setupTMUs(renderstate &cur, float causticspass, bool fogpass) +{ + if(!reflecting && !refracting && !envmapping && shadowmap && hasFBO) + { + glDisableClientState(GL_VERTEX_ARRAY); + + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + + rendershadowmap(); + + glEnableClientState(GL_VERTEX_ARRAY); + } + + if(renderpath==R_FIXEDFUNCTION) + { + if(nolights) cur.lightmaptmu = -1; + else if(maxtmus>=3) + { + if(maxtmus>=4 && causticspass>=1) + { + cur.causticstmu = 0; + cur.diffusetmu = 2; + cur.lightmaptmu = 3; + if(maxtmus>=5) + { + if(fogpass) cur.fogtmu = 4; + else if(glowpass) cur.glowtmu = 4; + } + } + else if(fogpass && causticspass<1) cur.fogtmu = 2; + else if(glowpass) cur.glowtmu = 2; + } + if(cur.glowtmu>=0) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.glowtmu); + setuptexgen(); + setuptmu(cur.glowtmu, "P + T"); + } + if(cur.fogtmu>=0) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.fogtmu); + glEnable(GL_TEXTURE_1D); + setuptexgen(1); + setuptmu(cur.fogtmu, "C , P @ Ta"); + if(!fogtex) createfogtex(); + glBindTexture(GL_TEXTURE_1D, fogtex); + uchar wcol[3]; + getwatercolour(wcol); + loopk(3) cur.color[k] = wcol[k]/255.0f; + } + if(cur.causticstmu>=0) setupcaustics(cur.causticstmu, causticspass, cur.color); + } + else + { + // need to invalidate vertex params in case they were used somewhere else for streaming params + invalidateenvparams(SHPARAM_VERTEX, 10, RESERVEDSHADERPARAMS + MAXSHADERPARAMS - 10); + glEnableClientState(GL_COLOR_ARRAY); + loopi(8-2) { glActiveTexture_(GL_TEXTURE2_ARB+i); glEnable(GL_TEXTURE_2D); } + glActiveTexture_(GL_TEXTURE0_ARB); + setenvparamf("ambient", SHPARAM_PIXEL, 5, hdr.ambient/255.0f, hdr.ambient/255.0f, hdr.ambient/255.0f); + setenvparamf("millis", SHPARAM_VERTEX, 6, lastmillis/1000.0f, lastmillis/1000.0f, lastmillis/1000.0f); + } + + glColor4fv(cur.color); + + if(cur.lightmaptmu>=0) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.lightmaptmu); + glClientActiveTexture_(GL_TEXTURE0_ARB+cur.lightmaptmu); + + setuptmu(cur.lightmaptmu, "P * T x 2"); + glEnable(GL_TEXTURE_2D); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glScalef(1.0f/SHRT_MAX, 1.0f/SHRT_MAX, 1.0f); + glMatrixMode(GL_MODELVIEW); + + glActiveTexture_(GL_TEXTURE0_ARB+cur.diffusetmu); + glClientActiveTexture_(GL_TEXTURE0_ARB+cur.diffusetmu); + glEnable(GL_TEXTURE_2D); + setuptmu(cur.diffusetmu, cur.diffusetmu>0 ? "P * T" : "= T"); + } + + if(renderpath==R_FIXEDFUNCTION) setuptexgen(); +} + +void cleanupTMUs(renderstate &cur) +{ + if(cur.lightmaptmu>=0) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.lightmaptmu); + glClientActiveTexture_(GL_TEXTURE0_ARB+cur.lightmaptmu); + + resettmu(cur.lightmaptmu); + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + } + if(cur.glowtmu>=0) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.glowtmu); + resettmu(cur.glowtmu); + disabletexgen(); + glDisable(GL_TEXTURE_2D); + } + if(cur.fogtmu>=0) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.fogtmu); + resettmu(cur.fogtmu); + disabletexgen(1); + glDisable(GL_TEXTURE_1D); + } + if(cur.causticstmu>=0) loopi(2) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.causticstmu+i); + resettmu(cur.causticstmu+i); + disabletexgen(); + glDisable(GL_TEXTURE_2D); + } + + if(cur.lightmaptmu>=0) + { + glActiveTexture_(GL_TEXTURE0_ARB+cur.diffusetmu); + resettmu(cur.diffusetmu); + glDisable(GL_TEXTURE_2D); + } + + if(renderpath==R_FIXEDFUNCTION) disabletexgen(); + else + { + glDisableClientState(GL_COLOR_ARRAY); + loopi(8-2) { glActiveTexture_(GL_TEXTURE2_ARB+i); glDisable(GL_TEXTURE_2D); } + } + + if(cur.lightmaptmu>=0) + { + glActiveTexture_(GL_TEXTURE0_ARB); + glClientActiveTexture_(GL_TEXTURE0_ARB); + glEnable(GL_TEXTURE_2D); + } +} + +#define FIRSTVA (reflecting ? reflectedva : visibleva) +#define NEXTVA (reflecting ? va->rnext : va->next) + +void rendergeommultipass(renderstate &cur, int pass, bool fogpass) +{ + cur.vbuf = 0; + for(vtxarray *va = FIRSTVA; va; va = NEXTVA) + { + if(!va->texs || va->occluded >= OCCLUDE_GEOM) continue; + if(refracting) + { + if(refracting < 0 ? va->geommin.z > reflectz : va->geommax.z <= reflectz) continue; + if(isvisiblecube(va->o, va->size) >= VFC_NOT_VISIBLE) continue; + if((!hasOQ || !oqfrags) && va->distance > reflectdist) break; + } + else if(reflecting) + { + if(va->geommax.z <= reflectz || (va->rquery && checkquery(va->rquery))) continue; + } + if(fogpass ? va->geommax.z <= reflectz-waterfog : va->curvfc==VFC_FOGGED) continue; + renderva(cur, va, pass, fogpass); + } + if(geombatches.length()) renderbatches(cur, pass); +} + +VAR(oqgeom, 0, 1, 1); +VAR(oqbatch, 0, 1, 1); + +void rendergeom(float causticspass, bool fogpass) +{ + renderstate cur; + + if(causticspass && ((renderpath==R_FIXEDFUNCTION && maxtmus<2) || !causticscale || !causticmillis)) causticspass = 0; + + glEnableClientState(GL_VERTEX_ARRAY); + + if(!reflecting && !refracting) + { + flipqueries(); + vtris = vverts = 0; + } + + bool doOQ = reflecting ? hasOQ && oqfrags && oqreflect : !refracting && zpass!=0; + if(!doOQ) + { + setupTMUs(cur, causticspass, fogpass); + if(shadowmap) pushshadowmap(); + } + + finddynlights(); + + glPushMatrix(); + + resetorigin(); + + resetbatches(); + + for(vtxarray *va = FIRSTVA; va; va = NEXTVA) + { + if(!va->texs) continue; + if(refracting) + { + if((refracting < 0 ? va->geommin.z > reflectz : va->geommax.z <= reflectz) || va->occluded >= OCCLUDE_GEOM) continue; + if(isvisiblecube(va->o, va->size) >= VFC_NOT_VISIBLE) continue; + if((!hasOQ || !oqfrags) && va->distance > reflectdist) break; + } + else if(reflecting) + { + if(va->geommax.z <= reflectz) continue; + if(doOQ) + { + va->rquery = newquery(&va->rquery); + if(!va->rquery) continue; + if(va->occluded >= OCCLUDE_BB || va->curvfc >= VFC_NOT_VISIBLE) + { + renderquery(cur, va->rquery, va); + continue; + } + } + } + else if(hasOQ && oqfrags && (zpass || va->distance > oqdist) && !insideva(va, camera1->o) && oqgeom) + { + if(!zpass && va->query && va->query->owner == va) + { + if(checkquery(va->query)) va->occluded = min(va->occluded+1, int(OCCLUDE_BB)); + else va->occluded = pvsoccluded(va->geommin, va->geommax) ? OCCLUDE_GEOM : OCCLUDE_NOTHING; + } + if(zpass && oqbatch) + { + if(va->parent && va->parent->occluded >= OCCLUDE_BB) + { + va->query = NULL; + va->occluded = OCCLUDE_PARENT; + continue; + } + bool succeeded = false; + if(va->query && va->query->owner == va && checkquery(va->query)) + { + va->occluded = min(va->occluded+1, int(OCCLUDE_BB)); + succeeded = true; + } + va->query = newquery(va); + if(!va->query || !succeeded) + va->occluded = pvsoccluded(va->geommin, va->geommax) ? OCCLUDE_GEOM : OCCLUDE_NOTHING; + if(va->occluded >= OCCLUDE_GEOM) + { + if(va->query) renderquery(cur, va->query, va); + continue; + } + } + else if(zpass && va->parent && + (va->parent->occluded == OCCLUDE_PARENT || + (va->parent->occluded >= OCCLUDE_BB && + va->parent->query && va->parent->query->owner == va->parent && va->parent->query->fragments < 0))) + { + va->query = NULL; + if(va->occluded >= OCCLUDE_GEOM || pvsoccluded(va->geommin, va->geommax)) + { + va->occluded = OCCLUDE_PARENT; + continue; + } + } + else if(va->occluded >= OCCLUDE_GEOM) + { + va->query = newquery(va); + if(va->query) renderquery(cur, va->query, va); + continue; + } + else va->query = newquery(va); + } + else + { + va->query = NULL; + va->occluded = pvsoccluded(va->geommin, va->geommax) ? OCCLUDE_GEOM : OCCLUDE_NOTHING; + if(va->occluded >= OCCLUDE_GEOM) continue; + } + + renderva(cur, va, doOQ ? RENDERPASS_Z : (nolights ? RENDERPASS_COLOR : RENDERPASS_LIGHTMAP), fogpass, true); + } + + if(geombatches.length()) renderbatches(cur, nolights ? RENDERPASS_COLOR : RENDERPASS_LIGHTMAP); + + if(!cur.colormask) { cur.colormask = true; glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } + if(!cur.depthmask) { cur.depthmask = true; glDepthMask(GL_TRUE); } + + if(doOQ) + { + setupTMUs(cur, causticspass, fogpass); + if(shadowmap) + { + glPopMatrix(); + glPushMatrix(); + pushshadowmap(); + resetorigin(); + } + glDepthFunc(GL_LEQUAL); + cur.vbuf = 0; + + for(vtxarray **prevva = &FIRSTVA, *va = FIRSTVA; va; prevva = &NEXTVA, va = NEXTVA) + { + if(!va->texs) continue; + if(reflecting) + { + if(va->geommax.z <= reflectz) continue; + if(va->rquery && checkquery(va->rquery)) + { + if(va->occluded >= OCCLUDE_BB || va->curvfc >= VFC_NOT_VISIBLE) *prevva = va->rnext; + continue; + } + } + else if(oqbatch) + { + if(va->occluded >= OCCLUDE_GEOM) continue; + } + else if(va->parent && va->parent->occluded >= OCCLUDE_BB && (!va->parent->query || va->parent->query->fragments >= 0)) + { + va->query = NULL; + va->occluded = OCCLUDE_BB; + continue; + } + else + { + if(va->query && checkquery(va->query)) va->occluded = min(va->occluded+1, int(OCCLUDE_BB)); + else va->occluded = pvsoccluded(va->geommin, va->geommax) ? OCCLUDE_GEOM : OCCLUDE_NOTHING; + if(va->occluded >= OCCLUDE_GEOM) continue; + } + + renderva(cur, va, nolights ? RENDERPASS_COLOR : RENDERPASS_LIGHTMAP, fogpass); + } + if(geombatches.length()) renderbatches(cur, nolights ? RENDERPASS_COLOR : RENDERPASS_LIGHTMAP); + if(oqbatch && !reflecting) for(vtxarray **prevva = &FIRSTVA, *va = FIRSTVA; va; prevva = &NEXTVA, va = NEXTVA) + { + if(!va->texs || va->occluded < OCCLUDE_GEOM) continue; + else if(va->query && checkquery(va->query)) continue; + else if(va->parent && (va->parent->occluded >= OCCLUDE_BB || + (va->parent->occluded >= OCCLUDE_GEOM && va->parent->query && checkquery(va->parent->query)))) + { + va->occluded = OCCLUDE_BB; + continue; + } + else + { + va->occluded = pvsoccluded(va->geommin, va->geommax) ? OCCLUDE_GEOM : OCCLUDE_NOTHING; + if(va->occluded >= OCCLUDE_GEOM) continue; + } + renderva(cur, va, nolights ? RENDERPASS_COLOR : RENDERPASS_LIGHTMAP, fogpass); + } + if(geombatches.length()) renderbatches(cur, nolights ? RENDERPASS_COLOR : RENDERPASS_LIGHTMAP); + + if(foggedvas.empty()) glDepthFunc(GL_LESS); + } + + if(shadowmap) popshadowmap(); + + cleanupTMUs(cur); + + if(foggedvas.length()) + { + renderfoggedvas(cur, !doOQ); + if(doOQ) glDepthFunc(GL_LESS); + } + + if(renderpath==R_FIXEDFUNCTION ? (glowpass && cur.skippedglow) || (causticspass>=1 && cur.causticstmu<0) || (fogpass && cur.fogtmu<0) : causticspass) + { + glDepthFunc(GL_LEQUAL); + glDepthMask(GL_FALSE); + glEnable(GL_BLEND); + static GLfloat zerofog[4] = { 0, 0, 0, 1 }, onefog[4] = { 1, 1, 1, 1 }; + GLfloat oldfogc[4]; + glGetFloatv(GL_FOG_COLOR, oldfogc); + + if(renderpath==R_FIXEDFUNCTION && glowpass && cur.skippedglow) + { + glBlendFunc(GL_ONE, GL_ONE); + glFogfv(GL_FOG_COLOR, zerofog); + setuptexgen(); + if(cur.fogtmu>=0) + { + setuptmu(0, "C * T"); + glActiveTexture_(GL_TEXTURE1_ARB); + glEnable(GL_TEXTURE_1D); + setuptexgen(1); + setuptmu(1, "P * T~a"); + if(!fogtex) createfogtex(); + glBindTexture(GL_TEXTURE_1D, fogtex); + glActiveTexture_(GL_TEXTURE0_ARB); + } + cur.glowcolor = vec(-1, -1, -1); + cur.glowtmu = 0; + rendergeommultipass(cur, RENDERPASS_GLOW, fogpass); + disabletexgen(); + if(cur.fogtmu>=0) + { + resettmu(0); + glActiveTexture_(GL_TEXTURE1_ARB); + resettmu(1); + disabletexgen(); + glDisable(GL_TEXTURE_1D); + glActiveTexture_(GL_TEXTURE0_ARB); + } + } + + if(renderpath==R_FIXEDFUNCTION ? causticspass>=1 && cur.causticstmu<0 : causticspass) + { + setupcaustics(0, causticspass); + glBlendFunc(GL_ZERO, renderpath==R_FIXEDFUNCTION ? GL_SRC_COLOR : GL_ONE_MINUS_SRC_COLOR); + glFogfv(GL_FOG_COLOR, renderpath==R_FIXEDFUNCTION ? onefog : zerofog); + if(fading) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); + rendergeommultipass(cur, RENDERPASS_CAUSTICS, fogpass); + if(fading) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + loopi(2) + { + glActiveTexture_(GL_TEXTURE0_ARB+i); + resettmu(i); + if(renderpath==R_FIXEDFUNCTION || !i) + { + resettmu(i); + disabletexgen(); + } + if(i) glDisable(GL_TEXTURE_2D); + } + glActiveTexture_(GL_TEXTURE0_ARB); + } + + if(renderpath==R_FIXEDFUNCTION && fogpass && cur.fogtmu<0) + { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDisable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_1D); + setuptexgen(1); + if(!fogtex) createfogtex(); + glBindTexture(GL_TEXTURE_1D, fogtex); + setuptexgen(1); + uchar wcol[3]; + getwatercolour(wcol); + glColor3ubv(wcol); + rendergeommultipass(cur, RENDERPASS_FOG, fogpass); + disabletexgen(1); + glDisable(GL_TEXTURE_1D); + glEnable(GL_TEXTURE_2D); + } + + glFogfv(GL_FOG_COLOR, oldfogc); + glDisable(GL_BLEND); + glDepthFunc(GL_LESS); + glDepthMask(GL_TRUE); + } + + glPopMatrix(); + + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + glDisableClientState(GL_VERTEX_ARRAY); +} + +void findreflectedvas(vector &vas, int prevvfc = VFC_PART_VISIBLE) +{ + bool doOQ = hasOQ && oqfrags && oqreflect; + loopv(vas) + { + vtxarray *va = vas[i]; + if(prevvfc >= VFC_NOT_VISIBLE) va->curvfc = prevvfc; + if(va->curvfc == VFC_FOGGED || va->curvfc == PVS_FOGGED || va->o.z+va->size <= reflectz || isvisiblecube(va->o, va->size) >= VFC_FOGGED) continue; + bool render = true; + if(va->curvfc == VFC_FULL_VISIBLE) + { + if(va->occluded >= OCCLUDE_BB) continue; + if(va->occluded >= OCCLUDE_GEOM) render = false; + } + else if(va->curvfc == PVS_FULL_VISIBLE) continue; + if(render) + { + if(va->curvfc >= VFC_NOT_VISIBLE) va->distance = (int)vadist(va, camera1->o); + if(!doOQ && va->distance > reflectdist) continue; + va->rquery = NULL; + vtxarray **vprev = &reflectedva, *vcur = reflectedva; + while(vcur && va->distance > vcur->distance) + { + vprev = &vcur->rnext; + vcur = vcur->rnext; + } + va->rnext = *vprev; + *vprev = va; + } + if(va->children.length()) findreflectedvas(va->children, va->curvfc); + } +} + +void renderreflectedgeom(bool causticspass, bool fogpass) +{ + if(reflecting) + { + reflectedva = NULL; + findreflectedvas(varoot); + rendergeom(causticspass ? 1 : 0, fogpass); + } + else rendergeom(causticspass ? 1 : 0, fogpass); +} + +static vtxarray *prevskyva = NULL; + +void renderskyva(vtxarray *va, bool explicitonly = false) +{ + if(!prevskyva || va->vbuf != prevskyva->vbuf) + { + if(!prevskyva) + { + glEnableClientState(GL_VERTEX_ARRAY); + glPushMatrix(); + resetorigin(); + } + + setorigin(va); + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->skybuf); + } + glVertexPointer(3, floatvtx ? GL_FLOAT : GL_SHORT, VTXSIZE, &va->vdata[0].x); + } + + drawvatris(va, explicitonly ? va->explicitsky : va->sky+va->explicitsky, explicitonly ? va->skydata+va->sky : va->skydata); + + if(!explicitonly) xtraverts += va->sky/3; + xtraverts += va->explicitsky/3; + + prevskyva = va; +} + +int renderedsky = 0, renderedexplicitsky = 0, renderedskyfaces = 0, renderedskyclip = INT_MAX; + +static inline void updateskystats(vtxarray *va) +{ + renderedsky += va->sky; + renderedexplicitsky += va->explicitsky; + renderedskyfaces |= va->skyfaces&0x3F; + if(!(va->skyfaces&0x1F) || camera1->o.z < va->skyclip) renderedskyclip = min(renderedskyclip, va->skyclip); + else renderedskyclip = 0; +} + +void renderreflectedskyvas(vector &vas, int prevvfc = VFC_PART_VISIBLE) +{ + loopv(vas) + { + vtxarray *va = vas[i]; + if(prevvfc >= VFC_NOT_VISIBLE) va->curvfc = prevvfc; + if((va->curvfc == VFC_FULL_VISIBLE && va->occluded >= OCCLUDE_BB) || va->curvfc==PVS_FULL_VISIBLE) continue; + if(va->o.z+va->size <= reflectz || isvisiblecube(va->o, va->size) == VFC_NOT_VISIBLE) continue; + if(va->sky+va->explicitsky) + { + updateskystats(va); + renderskyva(va); + } + if(va->children.length()) renderreflectedskyvas(va->children, va->curvfc); + } +} + +bool rendersky(bool explicitonly) +{ + prevskyva = NULL; + renderedsky = renderedexplicitsky = renderedskyfaces = 0; + renderedskyclip = INT_MAX; + + if(reflecting) + { + renderreflectedskyvas(varoot); + } + else for(vtxarray *va = visibleva; va; va = va->next) + { + if((va->occluded >= OCCLUDE_BB && va->skyfaces&0x80) || !(va->sky+va->explicitsky)) continue; + + // count possibly visible sky even if not actually rendered + updateskystats(va); + if(explicitonly && !va->explicitsky) continue; + renderskyva(va, explicitonly); + } + + if(prevskyva) + { + glPopMatrix(); + glDisableClientState(GL_VERTEX_ARRAY); + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + } + } + + return renderedsky+renderedexplicitsky > 0; +} + diff --git a/src/engine/server.cpp b/src/engine/server.cpp new file mode 100644 index 0000000..ec951f8 --- /dev/null +++ b/src/engine/server.cpp @@ -0,0 +1,719 @@ +// server.cpp: little more than enhanced multicaster +// runs dedicated or as client coroutine + +#include "pch.h" + +#ifdef STANDALONE +#include "cube.h" +#include "iengine.h" +#include "igame.h" +void localservertoclient(int chan, uchar *buf, int len) {} +void fatal(const char *s, ...) +{ + void cleanupserver(); + cleanupserver(); + s_sprintfdlv(msg,s,s); + printf("servererror: %s\n", msg); + exit(EXIT_FAILURE); +} +#else +#include "engine.h" +#endif + +igameclient *cl = NULL; +igameserver *sv = NULL; +iclientcom *cc = NULL; +icliententities *et = NULL; + +hashtable *gamereg = NULL; + +vector gameargs; + +void registergame(const char *name, igame *ig) +{ + if(!gamereg) gamereg = new hashtable; + (*gamereg)[name] = ig; +} + +void initgame(const char *game) +{ + igame **ig = gamereg->access(game); + if(!ig) fatal("cannot start game module: %s", game); + sv = (*ig)->newserver(); + cl = (*ig)->newclient(); + if(cl) + { + cc = cl->getcom(); + et = cl->getents(); + cl->initclient(); + } + loopv(gameargs) + { + if(!cl || !cl->clientoption(gameargs[i])) + { + if(!sv->serveroption(gameargs[i])) +#ifdef STANDALONE + printf("unknown command-line option: %s\n", gameargs[i]); +#else + conoutf(CON_ERROR, "unknown command-line option: %s", gameargs[i]); +#endif + } + } +} + +// all network traffic is in 32bit ints, which are then compressed using the following simple scheme (assumes that most values are small). + +void putint(ucharbuf &p, int n) +{ + if(n<128 && n>-127) p.put(n); + else if(n<0x8000 && n>=-0x8000) { p.put(0x80); p.put(n); p.put(n>>8); } + else { p.put(0x81); p.put(n); p.put(n>>8); p.put(n>>16); p.put(n>>24); } +} + +int getint(ucharbuf &p) +{ + int c = (char)p.get(); + if(c==-128) { int n = p.get(); n |= char(p.get())<<8; return n; } + else if(c==-127) { int n = p.get(); n |= p.get()<<8; n |= p.get()<<16; return n|(p.get()<<24); } + else return c; +} + +// much smaller encoding for unsigned integers up to 28 bits, but can handle signed +void putuint(ucharbuf &p, int n) +{ + if(n < 0 || n >= (1<<21)) + { + p.put(0x80 | (n & 0x7F)); + p.put(0x80 | ((n >> 7) & 0x7F)); + p.put(0x80 | ((n >> 14) & 0x7F)); + p.put(n >> 21); + } + else if(n < (1<<7)) p.put(n); + else if(n < (1<<14)) + { + p.put(0x80 | (n & 0x7F)); + p.put(n >> 7); + } + else + { + p.put(0x80 | (n & 0x7F)); + p.put(0x80 | ((n >> 7) & 0x7F)); + p.put(n >> 14); + } +} + +int getuint(ucharbuf &p) +{ + int n = p.get(); + if(n & 0x80) + { + n += (p.get() << 7) - 0x80; + if(n & (1<<14)) n += (p.get() << 14) - (1<<14); + if(n & (1<<21)) n += (p.get() << 21) - (1<<21); + if(n & (1<<28)) n |= 0xF0000000; + } + return n; +} + +void sendstring(const char *t, ucharbuf &p) +{ + while(*t) putint(p, *t++); + putint(p, 0); +} + +void getstring(char *text, ucharbuf &p, int len) +{ + char *t = text; + do + { + if(t>=&text[len]) { text[len-1] = 0; return; } + if(!p.remaining()) { *t = 0; return; } + *t = getint(p); + } + while(*t++); +} + +void filtertext(char *dst, const char *src, bool whitespace, int len) +{ + for(int c = *src; c; c = *++src) + { + switch(c) + { + case '\f': ++src; continue; + } + if(isspace(c) ? whitespace : isprint(c)) + { + *dst++ = c; + if(!--len) break; + } + } + *dst = '\0'; +} + +enum { ST_EMPTY, ST_LOCAL, ST_TCPIP }; + +struct client // server side version of "dynent" type +{ + int type; + int num; + ENetPeer *peer; + string hostname; + void *info; +}; + +vector clients; + +ENetHost *serverhost = NULL; +size_t bsend = 0, brec = 0; +int laststatus = 0; +ENetSocket pongsock = ENET_SOCKET_NULL; + +void cleanupserver() +{ + if(serverhost) enet_host_destroy(serverhost); +} + +void sendfile(int cn, int chan, FILE *file, const char *format, ...) +{ +#ifndef STANDALONE + extern ENetHost *clienthost; +#endif + if(cn < 0) + { +#ifndef STANDALONE + if(!clienthost || clienthost->peers[0].state != ENET_PEER_STATE_CONNECTED) +#endif + return; + } + else if(cn >= clients.length() || clients[cn]->type != ST_TCPIP) return; + + fseek(file, 0, SEEK_END); + int len = ftell(file); + bool reliable = false; + if(*format=='r') { reliable = true; ++format; } + ENetPacket *packet = enet_packet_create(NULL, MAXTRANS+len, ENET_PACKET_FLAG_RELIABLE); + rewind(file); + + ucharbuf p(packet->data, packet->dataLength); + va_list args; + va_start(args, format); + while(*format) switch(*format++) + { + case 'i': + { + int n = isdigit(*format) ? *format++-'0' : 1; + loopi(n) putint(p, va_arg(args, int)); + break; + } + case 's': sendstring(va_arg(args, const char *), p); break; + case 'l': putint(p, len); break; + } + va_end(args); + enet_packet_resize(packet, p.length()+len); + + fread(&packet->data[p.length()], 1, len, file); + enet_packet_resize(packet, p.length()+len); + + if(cn >= 0) enet_peer_send(clients[cn]->peer, chan, packet); +#ifndef STANDALONE + else enet_peer_send(&clienthost->peers[0], chan, packet); +#endif + + if(!packet->referenceCount) enet_packet_destroy(packet); +} + +void process(ENetPacket *packet, int sender, int chan); +//void disconnect_client(int n, int reason); + +void *getinfo(int i) { return !clients.inrange(i) || clients[i]->type==ST_EMPTY ? NULL : clients[i]->info; } +int getnumclients() { return clients.length(); } +uint getclientip(int n) { return clients.inrange(n) && clients[n]->type==ST_TCPIP ? clients[n]->peer->address.host : 0; } + +void sendpacket(int n, int chan, ENetPacket *packet, int exclude) +{ + if(n<0) + { + sv->recordpacket(chan, packet->data, packet->dataLength); + loopv(clients) if(i!=exclude) sendpacket(i, chan, packet); + return; + } + switch(clients[n]->type) + { + case ST_TCPIP: + { + enet_peer_send(clients[n]->peer, chan, packet); + bsend += packet->dataLength; + break; + } + + case ST_LOCAL: + localservertoclient(chan, packet->data, (int)packet->dataLength); + break; + } +} + +void sendf(int cn, int chan, const char *format, ...) +{ + int exclude = -1; + bool reliable = false; + if(*format=='r') { reliable = true; ++format; } + ENetPacket *packet = enet_packet_create(NULL, MAXTRANS, reliable ? ENET_PACKET_FLAG_RELIABLE : 0); + ucharbuf p(packet->data, packet->dataLength); + va_list args; + va_start(args, format); + while(*format) switch(*format++) + { + case 'x': + exclude = va_arg(args, int); + break; + + case 'v': + { + int n = va_arg(args, int); + int *v = va_arg(args, int *); + loopi(n) putint(p, v[i]); + break; + } + + case 'i': + { + int n = isdigit(*format) ? *format++-'0' : 1; + loopi(n) putint(p, va_arg(args, int)); + break; + } + case 's': sendstring(va_arg(args, const char *), p); break; + case 'm': + { + int n = va_arg(args, int); + enet_packet_resize(packet, packet->dataLength+n); + p.buf = packet->data; + p.maxlen += n; + p.put(va_arg(args, uchar *), n); + break; + } + } + va_end(args); + enet_packet_resize(packet, p.length()); + sendpacket(cn, chan, packet, exclude); + if(packet->referenceCount==0) enet_packet_destroy(packet); +} + +const char *disc_reasons[] = { "normal", "end of packet", "client num", "kicked/banned", "tag type", "ip is banned", "server is in private mode", "server FULL (maxclients)" }; + +void disconnect_client(int n, int reason) +{ + if(clients[n]->type!=ST_TCPIP) return; + s_sprintfd(s)("client (%s) disconnected because: %s\n", clients[n]->hostname, disc_reasons[reason]); + puts(s); + enet_peer_disconnect(clients[n]->peer, reason); + sv->clientdisconnect(n); + clients[n]->type = ST_EMPTY; + clients[n]->peer->data = NULL; + sv->deleteinfo(clients[n]->info); + clients[n]->info = NULL; + sv->sendservmsg(s); +} + +void process(ENetPacket *packet, int sender, int chan) // sender may be -1 +{ + ucharbuf p(packet->data, (int)packet->dataLength); + sv->parsepacket(sender, chan, (packet->flags&ENET_PACKET_FLAG_RELIABLE)!=0, p); + if(p.overread()) { disconnect_client(sender, DISC_EOP); return; } +} + +void send_welcome(int n) +{ + ENetPacket *packet = enet_packet_create (NULL, MAXTRANS, ENET_PACKET_FLAG_RELIABLE); + ucharbuf p(packet->data, packet->dataLength); + int chan = sv->welcomepacket(p, n, packet); + enet_packet_resize(packet, p.length()); + sendpacket(n, chan, packet); + if(packet->referenceCount==0) enet_packet_destroy(packet); +} + +void localclienttoserver(int chan, ENetPacket *packet) +{ + process(packet, 0, chan); + if(packet->referenceCount==0) enet_packet_destroy(packet); +} + +client &addclient() +{ + loopv(clients) if(clients[i]->type==ST_EMPTY) + { + clients[i]->info = sv->newinfo(); + return *clients[i]; + } + client *c = new client; + c->num = clients.length(); + c->info = sv->newinfo(); + clients.add(c); + return *c; +} + +int localclients = 0, nonlocalclients = 0; + +bool hasnonlocalclients() { return nonlocalclients!=0; } +bool haslocalclients() { return localclients!=0; } + +static ENetAddress pongaddr; + +void sendserverinforeply(ucharbuf &p) +{ + ENetBuffer buf; + buf.data = p.buf; + buf.dataLength = p.length(); + enet_socket_send(pongsock, &pongaddr, &buf, 1); +} + +void sendpongs() // reply all server info requests +{ + ENetBuffer buf; + uchar pong[MAXTRANS]; + int len; + enet_uint32 events = ENET_SOCKET_WAIT_RECEIVE; + buf.data = pong; + while(enet_socket_wait(pongsock, &events, 0) >= 0 && events) + { + buf.dataLength = sizeof(pong); + len = enet_socket_receive(pongsock, &pongaddr, &buf, 1); + if(len < 0) return; + ucharbuf req(pong, len), p(pong, sizeof(pong)); + p.len += len; + sv->serverinforeply(req, p); + } +} + +#ifdef STANDALONE +bool resolverwait(const char *name, ENetAddress *address) +{ + return enet_address_set_host(address, name) >= 0; +} + +int connectwithtimeout(ENetSocket sock, const char *hostname, ENetAddress &remoteaddress) +{ + int result = enet_socket_connect(sock, &remoteaddress); + if(result<0) enet_socket_destroy(sock); + return result; +} +#endif + +ENetSocket httpgetsend(ENetAddress &remoteaddress, const char *hostname, const char *req, const char *ref, const char *agent, ENetAddress *localaddress = NULL) +{ + if(remoteaddress.host==ENET_HOST_ANY) + { +#ifdef STANDALONE + printf("looking up %s...\n", hostname); +#endif + if(!resolverwait(hostname, &remoteaddress)) return ENET_SOCKET_NULL; + } + ENetSocket sock = enet_socket_create(ENET_SOCKET_TYPE_STREAM, localaddress); + if(sock==ENET_SOCKET_NULL || connectwithtimeout(sock, hostname, remoteaddress)<0) + { +#ifdef STANDALONE + printf(sock==ENET_SOCKET_NULL ? "could not open socket\n" : "could not connect\n"); +#endif + return ENET_SOCKET_NULL; + } + ENetBuffer buf; + s_sprintfd(httpget)("GET %s HTTP/1.0\nHost: %s\nReferer: %s\nUser-Agent: %s\n\n", req, hostname, ref, agent); + buf.data = httpget; + buf.dataLength = strlen((char *)buf.data); +#ifdef STANDALONE + printf("sending request to %s...\n", hostname); +#endif + enet_socket_send(sock, NULL, &buf, 1); + return sock; +} + +bool httpgetreceive(ENetSocket sock, ENetBuffer &buf, int timeout = 0) +{ + if(sock==ENET_SOCKET_NULL) return false; + enet_uint32 events = ENET_SOCKET_WAIT_RECEIVE; + if(enet_socket_wait(sock, &events, timeout) >= 0 && events) + { + int len = enet_socket_receive(sock, NULL, &buf, 1); + if(len<=0) + { + enet_socket_destroy(sock); + return false; + } + buf.data = ((char *)buf.data)+len; + ((char*)buf.data)[0] = 0; + buf.dataLength -= len; + } + return true; +} + +uchar *stripheader(uchar *b) +{ + char *s = strstr((char *)b, "\n\r\n"); + if(!s) s = strstr((char *)b, "\n\n"); + return s ? (uchar *)s : b; +} + +ENetSocket mssock = ENET_SOCKET_NULL; +ENetAddress msaddress = { ENET_HOST_ANY, ENET_PORT_ANY }; +ENetAddress masterserver = { ENET_HOST_ANY, 80 }; +int lastupdatemaster = 0; +string masterbase; +string masterpath; +uchar masterrep[MAXTRANS]; +ENetBuffer masterb; + +void updatemasterserver() +{ + s_sprintfd(path)("%sregister.do?action=add", masterpath); + if(mssock!=ENET_SOCKET_NULL) enet_socket_destroy(mssock); + mssock = httpgetsend(masterserver, masterbase, path, sv->servername(), sv->servername(), &msaddress); + masterrep[0] = 0; + masterb.data = masterrep; + masterb.dataLength = MAXTRANS-1; +} + +void checkmasterreply() +{ + if(mssock!=ENET_SOCKET_NULL && !httpgetreceive(mssock, masterb)) + { + mssock = ENET_SOCKET_NULL; + printf("masterserver reply: %s\n", stripheader(masterrep)); + } +} + +#ifndef STANDALONE + +#define RETRIEVELIMIT 20000 + +uchar *retrieveservers(uchar *buf, int buflen) +{ + buf[0] = '\0'; + + s_sprintfd(path)("%sretrieve.do?item=list", masterpath); + ENetAddress address = masterserver; + ENetSocket sock = httpgetsend(address, masterbase, path, sv->servername(), sv->servername()); + if(sock==ENET_SOCKET_NULL) return buf; + /* only cache this if connection succeeds */ + masterserver = address; + + s_sprintfd(text)("retrieving servers from %s... (esc to abort)", masterbase); + show_out_of_renderloop_progress(0, text); + + ENetBuffer eb; + eb.data = buf; + eb.dataLength = buflen-1; + + int starttime = SDL_GetTicks(), timeout = 0; + while(httpgetreceive(sock, eb, 250)) + { + timeout = SDL_GetTicks() - starttime; + show_out_of_renderloop_progress(min(float(timeout)/RETRIEVELIMIT, 1.0f), text); + if(interceptkey(SDLK_ESCAPE)) timeout = RETRIEVELIMIT + 1; + if(timeout > RETRIEVELIMIT) + { + buf[0] = '\0'; + enet_socket_destroy(sock); + return buf; + } + } + + return stripheader(buf); +} +#endif + +#define DEFAULTCLIENTS 6 + +int uprate = 0, maxclients = DEFAULTCLIENTS; +const char *ip = "", *master = NULL; +const char *game = "fps"; + +#ifdef STANDALONE +int lastmillis = 0, totalmillis = 0; +#endif + +void serverslice(uint timeout) // main server update, called from main loop in sp, or from below in dedicated server +{ + localclients = nonlocalclients = 0; + loopv(clients) switch(clients[i]->type) + { + case ST_LOCAL: localclients++; break; + case ST_TCPIP: nonlocalclients++; break; + } + + if(!serverhost) + { + sv->serverupdate(lastmillis, totalmillis); + return; + } + + // below is network only + + lastmillis = totalmillis = (int)enet_time_get(); + sv->serverupdate(lastmillis, totalmillis); + + sendpongs(); + + if(*masterpath) checkmasterreply(); + + if(totalmillis-lastupdatemaster>60*60*1000 && *masterpath) // send alive signal to masterserver every hour of uptime + { + updatemasterserver(); + lastupdatemaster = totalmillis; + } + + if(totalmillis-laststatus>60*1000) // display bandwidth stats, useful for server ops + { + laststatus = totalmillis; + if(nonlocalclients || bsend || brec) printf("status: %d remote clients, %.1f send, %.1f rec (K/sec)\n", nonlocalclients, bsend/60.0f/1024, brec/60.0f/1024); + bsend = brec = 0; + } + + ENetEvent event; + bool serviced = false; + while(!serviced) + { + if(enet_host_check_events(serverhost, &event) <= 0) + { + if(enet_host_service(serverhost, &event, timeout) <= 0) break; + serviced = true; + } + switch(event.type) + { + case ENET_EVENT_TYPE_CONNECT: + { + client &c = addclient(); + c.type = ST_TCPIP; + c.peer = event.peer; + c.peer->data = &c; + char hn[1024]; + s_strcpy(c.hostname, (enet_address_get_host_ip(&c.peer->address, hn, sizeof(hn))==0) ? hn : "unknown"); + printf("client connected (%s)\n", c.hostname); + int reason = DISC_MAXCLIENTS; + if(nonlocalclientsclientconnect(c.num, c.peer->address.host))) + { + nonlocalclients++; + send_welcome(c.num); + } + else disconnect_client(c.num, reason); + break; + } + case ENET_EVENT_TYPE_RECEIVE: + { + brec += event.packet->dataLength; + client *c = (client *)event.peer->data; + if(c) process(event.packet, c->num, event.channelID); + if(event.packet->referenceCount==0) enet_packet_destroy(event.packet); + break; + } + case ENET_EVENT_TYPE_DISCONNECT: + { + client *c = (client *)event.peer->data; + if(!c) break; + printf("disconnected client (%s)\n", c->hostname); + sv->clientdisconnect(c->num); + nonlocalclients--; + c->type = ST_EMPTY; + event.peer->data = NULL; + sv->deleteinfo(c->info); + c->info = NULL; + break; + } + default: + break; + } + } + if(sv->sendpackets()) enet_host_flush(serverhost); +} + +void localdisconnect() +{ + loopv(clients) if(clients[i]->type==ST_LOCAL) + { + sv->localdisconnect(i); + localclients--; + clients[i]->type = ST_EMPTY; + sv->deleteinfo(clients[i]->info); + clients[i]->info = NULL; + } +} + +void localconnect() +{ + client &c = addclient(); + c.type = ST_LOCAL; + s_strcpy(c.hostname, "local"); + localclients++; + sv->localconnect(c.num); + send_welcome(c.num); +} + +void initserver(bool dedicated) +{ + initgame(game); + + if(!master) master = sv->getdefaultmaster(); + const char *mid = strstr(master, "/"); + if(!mid) mid = master; + s_strcpy(masterpath, mid); + s_strncpy(masterbase, master, mid-master+1); + + if(dedicated) + { + ENetAddress address = { ENET_HOST_ANY, sv->serverport() }; + if(*ip) + { + if(enet_address_set_host(&address, ip)<0) printf("WARNING: server ip not resolved"); + else msaddress.host = address.host; + } + serverhost = enet_host_create(&address, maxclients+1, 0, uprate); + if(!serverhost) fatal("could not create server host"); + loopi(maxclients) serverhost->peers[i].data = NULL; + address.port = sv->serverinfoport(); + pongsock = enet_socket_create(ENET_SOCKET_TYPE_DATAGRAM, &address); + if(pongsock == ENET_SOCKET_NULL) fatal("could not create server info socket"); + else enet_socket_set_option(pongsock, ENET_SOCKOPT_NONBLOCK, 1); + } + + sv->serverinit(); + + if(dedicated) // do not return, this becomes main loop + { + #ifdef WIN32 + SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); + #endif + printf("dedicated server started, waiting for clients...\nCtrl-C to exit\n\n"); + atexit(enet_deinitialize); + atexit(cleanupserver); + enet_time_set(0); + if(*masterpath) updatemasterserver(); + for(;;) serverslice(5); + } +} + +bool serveroption(char *opt) +{ + switch(opt[1]) + { + case 'u': uprate = atoi(opt+2); return true; + case 'c': + { + int clients = atoi(opt+2); + if(clients > 0) maxclients = min(clients, MAXCLIENTS); + else maxclients = DEFAULTCLIENTS; + return true; + } + case 'i': ip = opt+2; return true; + case 'm': master = opt+2; return true; + case 'g': game = opt+2; return true; + default: return false; + } +} + +#ifdef STANDALONE +int main(int argc, char* argv[]) +{ + for(int i = 1; i resolverthreads; +vector resolverqueries; +vector resolverresults; +SDL_mutex *resolvermutex; +SDL_cond *querycond, *resultcond; + +#define RESOLVERTHREADS 1 +#define RESOLVERLIMIT 3000 + +int resolverloop(void * data) +{ + resolverthread *rt = (resolverthread *)data; + SDL_LockMutex(resolvermutex); + SDL_Thread *thread = rt->thread; + SDL_UnlockMutex(resolvermutex); + if(!thread || SDL_GetThreadID(thread) != SDL_ThreadID()) + return 0; + while(thread == rt->thread) + { + SDL_LockMutex(resolvermutex); + while(resolverqueries.empty()) SDL_CondWait(querycond, resolvermutex); + rt->query = resolverqueries.pop(); + rt->starttime = totalmillis; + SDL_UnlockMutex(resolvermutex); + + ENetAddress address = { ENET_HOST_ANY, sv->serverinfoport() }; + enet_address_set_host(&address, rt->query); + + SDL_LockMutex(resolvermutex); + if(rt->query && thread == rt->thread) + { + resolverresult &rr = resolverresults.add(); + rr.query = rt->query; + rr.address = address; + rt->query = NULL; + rt->starttime = 0; + SDL_CondSignal(resultcond); + } + SDL_UnlockMutex(resolvermutex); + } + return 0; +} + +void resolverinit() +{ + resolvermutex = SDL_CreateMutex(); + querycond = SDL_CreateCond(); + resultcond = SDL_CreateCond(); + + SDL_LockMutex(resolvermutex); + loopi(RESOLVERTHREADS) + { + resolverthread &rt = resolverthreads.add(); + rt.query = NULL; + rt.starttime = 0; + rt.thread = SDL_CreateThread(resolverloop, &rt); + } + SDL_UnlockMutex(resolvermutex); +} + +void resolverstop(resolverthread &rt) +{ + SDL_LockMutex(resolvermutex); + if(rt.query) + { +#ifndef __APPLE__ + SDL_KillThread(rt.thread); +#endif + rt.thread = SDL_CreateThread(resolverloop, &rt); + } + rt.query = NULL; + rt.starttime = 0; + SDL_UnlockMutex(resolvermutex); +} + +void resolverclear() +{ + if(resolverthreads.empty()) return; + + SDL_LockMutex(resolvermutex); + resolverqueries.setsize(0); + resolverresults.setsize(0); + loopv(resolverthreads) + { + resolverthread &rt = resolverthreads[i]; + resolverstop(rt); + } + SDL_UnlockMutex(resolvermutex); +} + +void resolverquery(const char *name) +{ + if(resolverthreads.empty()) resolverinit(); + + SDL_LockMutex(resolvermutex); + resolverqueries.add(name); + SDL_CondSignal(querycond); + SDL_UnlockMutex(resolvermutex); +} + +bool resolvercheck(const char **name, ENetAddress *address) +{ + bool resolved = false; + SDL_LockMutex(resolvermutex); + if(!resolverresults.empty()) + { + resolverresult &rr = resolverresults.pop(); + *name = rr.query; + address->host = rr.address.host; + resolved = true; + } + else loopv(resolverthreads) + { + resolverthread &rt = resolverthreads[i]; + if(rt.query && totalmillis - rt.starttime > RESOLVERLIMIT) + { + resolverstop(rt); + *name = rt.query; + resolved = true; + } + } + SDL_UnlockMutex(resolvermutex); + return resolved; +} + +bool resolverwait(const char *name, ENetAddress *address) +{ + if(resolverthreads.empty()) resolverinit(); + + s_sprintfd(text)("resolving %s... (esc to abort)", name); + show_out_of_renderloop_progress(0, text); + + SDL_LockMutex(resolvermutex); + resolverqueries.add(name); + SDL_CondSignal(querycond); + int starttime = SDL_GetTicks(), timeout = 0; + bool resolved = false; + for(;;) + { + SDL_CondWaitTimeout(resultcond, resolvermutex, 250); + loopv(resolverresults) if(resolverresults[i].query == name) + { + address->host = resolverresults[i].address.host; + resolverresults.remove(i); + resolved = true; + break; + } + if(resolved) break; + + timeout = SDL_GetTicks() - starttime; + show_out_of_renderloop_progress(min(float(timeout)/RESOLVERLIMIT, 1.0f), text); + if(interceptkey(SDLK_ESCAPE)) timeout = RESOLVERLIMIT + 1; + if(timeout > RESOLVERLIMIT) break; + } + if(!resolved && timeout > RESOLVERLIMIT) + { + loopv(resolverthreads) + { + resolverthread &rt = resolverthreads[i]; + if(rt.query == name) { resolverstop(rt); break; } + } + } + SDL_UnlockMutex(resolvermutex); + return resolved; +} + +SDL_Thread *connthread = NULL; +SDL_mutex *connmutex = NULL; +SDL_cond *conncond = NULL; + +struct connectdata +{ + ENetSocket sock; + ENetAddress address; + int result; +}; + +// do this in a thread to prevent timeouts +// could set timeouts on sockets, but this is more reliable and gives more control +int connectthread(void *data) +{ + SDL_LockMutex(connmutex); + if(!connthread || SDL_GetThreadID(connthread) != SDL_ThreadID()) + { + SDL_UnlockMutex(connmutex); + return 0; + } + connectdata cd = *(connectdata *)data; + SDL_UnlockMutex(connmutex); + + int result = enet_socket_connect(cd.sock, &cd.address); + + SDL_LockMutex(connmutex); + if(!connthread || SDL_GetThreadID(connthread) != SDL_ThreadID()) + { + enet_socket_destroy(cd.sock); + SDL_UnlockMutex(connmutex); + return 0; + } + ((connectdata *)data)->result = result; + SDL_CondSignal(conncond); + SDL_UnlockMutex(connmutex); + + return 0; +} + +#define CONNLIMIT 20000 + +int connectwithtimeout(ENetSocket sock, const char *hostname, ENetAddress &address) +{ + s_sprintfd(text)("connecting to %s... (esc to abort)", hostname); + show_out_of_renderloop_progress(0, text); + + if(!connmutex) connmutex = SDL_CreateMutex(); + if(!conncond) conncond = SDL_CreateCond(); + SDL_LockMutex(connmutex); + connectdata cd = { sock, address, -1 }; + connthread = SDL_CreateThread(connectthread, &cd); + + int starttime = SDL_GetTicks(), timeout = 0; + for(;;) + { + if(!SDL_CondWaitTimeout(conncond, connmutex, 250)) + { + if(cd.result<0) enet_socket_destroy(sock); + break; + } + timeout = SDL_GetTicks() - starttime; + show_out_of_renderloop_progress(min(float(timeout)/CONNLIMIT, 1.0f), text); + if(interceptkey(SDLK_ESCAPE)) timeout = CONNLIMIT + 1; + if(timeout > CONNLIMIT) break; + } + + /* thread will actually timeout eventually if its still trying to connect + * so just leave it (and let it destroy socket) instead of causing problems on some platforms by killing it + */ + connthread = NULL; + SDL_UnlockMutex(connmutex); + + return cd.result; +} + +enum { UNRESOLVED = 0, RESOLVING, RESOLVED }; + +struct serverinfo +{ + string name; + string map; + string sdesc; + int numplayers, ping, resolved; + vector attr; + ENetAddress address; + + serverinfo() + : numplayers(0), ping(999), resolved(UNRESOLVED) + { + name[0] = map[0] = sdesc[0] = '\0'; + } +}; + +vector servers; +ENetSocket pingsock = ENET_SOCKET_NULL; +int lastinfo = 0; + +char *getservername(int n) { return servers[n]->name; } + +static serverinfo *newserver(const char *name, uint ip = ENET_HOST_ANY, uint port = sv->serverinfoport()) +{ + serverinfo *si = new serverinfo; + si->address.host = ip; + si->address.port = port; + if(ip!=ENET_HOST_ANY) si->resolved = RESOLVED; + + if(name) s_strcpy(si->name, name); + else if(ip==ENET_HOST_ANY || enet_address_get_host_ip(&si->address, si->name, sizeof(si->name)) < 0) + { + delete si; + return NULL; + + } + + servers.add(si); + + return si; +} + +void addserver(char *servername) +{ + loopv(servers) if(!strcmp(servers[i]->name, servername)) return; + newserver(servername); +} + +VAR(searchlan, 0, 0, 1); + +void pingservers() +{ + if(pingsock == ENET_SOCKET_NULL) + { + pingsock = enet_socket_create(ENET_SOCKET_TYPE_DATAGRAM, NULL); + if(pingsock == ENET_SOCKET_NULL) + { + lastinfo = totalmillis; + return; + } + enet_socket_set_option(pingsock, ENET_SOCKOPT_NONBLOCK, 1); + enet_socket_set_option(pingsock, ENET_SOCKOPT_BROADCAST, 1); + } + ENetBuffer buf; + uchar ping[MAXTRANS]; + ucharbuf p(ping, sizeof(ping)); + putint(p, totalmillis); + loopv(servers) + { + serverinfo &si = *servers[i]; + if(si.address.host == ENET_HOST_ANY) continue; + buf.data = ping; + buf.dataLength = p.length(); + enet_socket_send(pingsock, &si.address, &buf, 1); + } + if(searchlan) + { + ENetAddress address; + address.host = ENET_HOST_BROADCAST; + address.port = sv->serverinfoport(); + buf.data = ping; + buf.dataLength = p.length(); + enet_socket_send(pingsock, &address, &buf, 1); + } + lastinfo = totalmillis; +} + +void checkresolver() +{ + int resolving = 0; + loopv(servers) + { + serverinfo &si = *servers[i]; + if(si.resolved == RESOLVED) continue; + if(si.address.host == ENET_HOST_ANY) + { + if(si.resolved == UNRESOLVED) { si.resolved = RESOLVING; resolverquery(si.name); } + resolving++; + } + } + if(!resolving) return; + + const char *name = NULL; + ENetAddress addr = { ENET_HOST_ANY, sv->serverinfoport() }; + while(resolvercheck(&name, &addr)) + { + loopv(servers) + { + serverinfo &si = *servers[i]; + if(name == si.name) + { + si.resolved = RESOLVED; + si.address = addr; + addr.host = ENET_HOST_ANY; + break; + } + } + } +} + +void checkpings() +{ + if(pingsock==ENET_SOCKET_NULL) return; + enet_uint32 events = ENET_SOCKET_WAIT_RECEIVE; + ENetBuffer buf; + ENetAddress addr; + uchar ping[MAXTRANS]; + char text[MAXTRANS]; + buf.data = ping; + buf.dataLength = sizeof(ping); + while(enet_socket_wait(pingsock, &events, 0) >= 0 && events) + { + int len = enet_socket_receive(pingsock, &addr, &buf, 1); + if(len <= 0) return; + serverinfo *si = NULL; + loopv(servers) if(addr.host == servers[i]->address.host) { si = servers[i]; break; } + if(!si && searchlan) si = newserver(NULL, addr.host); + if(!si) continue; + ucharbuf p(ping, len); + si->ping = totalmillis - getint(p); + si->numplayers = getint(p); + int numattr = getint(p); + si->attr.setsize(0); + loopj(numattr) si->attr.add(getint(p)); + getstring(text, p); + filtertext(si->map, text); + getstring(text, p); + filtertext(si->sdesc, text); + } +} + +int sicompare(serverinfo **ap, serverinfo **bp) +{ + serverinfo *a = *ap, *b = *bp; + bool ac = sv->servercompatible(a->name, a->sdesc, a->map, a->ping, a->attr, a->numplayers), + bc = sv->servercompatible(b->name, b->sdesc, b->map, b->ping, b->attr, b->numplayers); + if(ac>bc) return -1; + if(bc>ac) return 1; + if(a->numplayersnumplayers) return 1; + if(a->numplayers>b->numplayers) return -1; + if(a->ping>b->ping) return 1; + if(a->pingping) return -1; + return strcmp(a->name, b->name); +} + +void refreshservers() +{ + static int lastrefresh = 0; + if(lastrefresh==totalmillis) return; + lastrefresh = totalmillis; + + checkresolver(); + checkpings(); + if(totalmillis - lastinfo >= 5000) pingservers(); + servers.sort(sicompare); +} + +const char *showservers(g3d_gui *cgui) +{ + refreshservers(); + const char *name = NULL; + for(int start = 0; start < servers.length();) + { + if(start > 0) cgui->tab(); + int end = servers.length(); + cgui->pushlist(); + loopi(10) + { + if(!cl->serverinfostartcolumn(cgui, i)) break; + for(int j = start; j < end; j++) + { + if(!i && cgui->shouldtab()) { end = j; break; } + serverinfo &si = *servers[j]; + const char *sdesc = si.sdesc; + if(si.address.host == ENET_HOST_ANY) sdesc = "[unknown host]"; + else if(si.ping == 999) sdesc = "[waiting for response]"; + if(cl->serverinfoentry(cgui, i, si.name, sdesc, si.map, sdesc == si.sdesc ? si.ping : -1, si.attr, si.numplayers)) + name = si.name; + } + cl->serverinfoendcolumn(cgui, i); + } + cgui->poplist(); + start = end; + } + return name; +} + +void clearservers() +{ + resolverclear(); + servers.deletecontentsp(); +} + +void updatefrommaster() +{ + uchar buf[32000]; + uchar *reply = retrieveservers(buf, sizeof(buf)); + if(!*reply || strstr((char *)reply, "") || strstr((char *)reply, "")) conoutf("master server not replying"); + else + { + clearservers(); + execute((char *)reply); + } + refreshservers(); +} + +COMMAND(addserver, "s"); +COMMAND(clearservers, ""); +COMMAND(updatefrommaster, ""); + +void writeservercfg() +{ + if(!cl->savedservers()) return; + FILE *f = openfile(path(cl->savedservers(), true), "w"); + if(!f) return; + fprintf(f, "// servers connected to are added here automatically\n\n"); + loopvrev(servers) fprintf(f, "addserver %s\n", servers[i]->name); + fclose(f); +} + diff --git a/src/engine/shader.cpp b/src/engine/shader.cpp new file mode 100644 index 0000000..a697a29 --- /dev/null +++ b/src/engine/shader.cpp @@ -0,0 +1,1706 @@ +// shader.cpp: OpenGL assembly/GLSL shader management + +#include "pch.h" +#include "engine.h" + +Shader *Shader::lastshader = NULL; + +Shader *defaultshader = NULL, *rectshader = NULL, *notextureshader = NULL, *nocolorshader = NULL, *foggedshader = NULL, *foggednotextureshader = NULL, *stdworldshader = NULL; + +static hashtable shaders; +static Shader *curshader = NULL; +static vector curparams; +static ShaderParamState vertexparamstate[RESERVEDSHADERPARAMS + MAXSHADERPARAMS], pixelparamstate[RESERVEDSHADERPARAMS + MAXSHADERPARAMS]; +static bool dirtyenvparams = false, standardshader = false; + +VAR(reservevpparams, 1, 16, 0); +VAR(maxvpenvparams, 1, 0, 0); +VAR(maxvplocalparams, 1, 0, 0); +VAR(maxfpenvparams, 1, 0, 0); +VAR(maxfplocalparams, 1, 0, 0); + +void loadshaders() +{ + if(renderpath!=R_FIXEDFUNCTION) + { + GLint val; + glGetProgramiv_(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &val); + maxvpenvparams = val; + glGetProgramiv_(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, &val); + maxvplocalparams = val; + glGetProgramiv_(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &val); + maxfpenvparams = val; + glGetProgramiv_(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, &val); + maxfplocalparams = val; + } + + standardshader = true; + exec("data/stdshader.cfg"); + standardshader = false; + defaultshader = lookupshaderbyname("default"); + stdworldshader = lookupshaderbyname("stdworld"); + if(!defaultshader || !stdworldshader) fatal("cannot find shader definitions"); + + extern Slot dummyslot; + dummyslot.shader = stdworldshader; + + rectshader = lookupshaderbyname("rect"); + notextureshader = lookupshaderbyname("notexture"); + nocolorshader = lookupshaderbyname("nocolor"); + foggedshader = lookupshaderbyname("fogged"); + foggednotextureshader = lookupshaderbyname("foggednotexture"); + + if(renderpath!=R_FIXEDFUNCTION) + { + glEnable(GL_VERTEX_PROGRAM_ARB); + glEnable(GL_FRAGMENT_PROGRAM_ARB); + } + + defaultshader->set(); +} + +Shader *lookupshaderbyname(const char *name) +{ + Shader *s = shaders.access(name); + if(!s || s->type==SHADER_INVALID) return NULL; + return s->altshader ? s->altshader : s; +} + +static bool compileasmshader(GLenum type, GLuint &idx, const char *def, const char *tname, const char *name, bool msg = true, bool nativeonly = false) +{ + glGenPrograms_(1, &idx); + glBindProgram_(type, idx); + def += strspn(def, " \t\r\n"); + glProgramString_(type, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(def), def); + GLint err = -1, native = 1; + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &err); + extern int apple_vp_bug; + if(type!=GL_VERTEX_PROGRAM_ARB || !apple_vp_bug) + glGetProgramiv_(type, GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB, &native); + if(msg && err!=-1) + { + conoutf(CON_ERROR, "COMPILE ERROR (%s:%s) - %s", tname, name, glGetString(GL_PROGRAM_ERROR_STRING_ARB)); + if(err>=0 && err<(int)strlen(def)) + { + loopi(err) putchar(*def++); + puts(" <> "); + while(*def) putchar(*def++); + } + } + else if(msg && !native) conoutf(CON_ERROR, "%s:%s EXCEEDED NATIVE LIMITS", tname, name); + if(err!=-1 || (!native && nativeonly)) + { + glDeletePrograms_(1, &idx); + idx = 0; + } + return native!=0; +} + +static void showglslinfo(GLhandleARB obj, const char *tname, const char *name) +{ + GLint length = 0; + glGetObjectParameteriv_(obj, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); + if(length > 1) + { + GLcharARB *log = new GLcharARB[length]; + glGetInfoLog_(obj, length, &length, log); + conoutf(CON_ERROR, "GLSL ERROR (%s:%s)", tname, name); + puts(log); + delete[] log; + } +} + +static void compileglslshader(GLenum type, GLhandleARB &obj, const char *def, const char *tname, const char *name, bool msg = true) +{ + const GLcharARB *source = (const GLcharARB*)(def + strspn(def, " \t\r\n")); + obj = glCreateShaderObject_(type); + glShaderSource_(obj, 1, &source, NULL); + glCompileShader_(obj); + GLint success; + glGetObjectParameteriv_(obj, GL_OBJECT_COMPILE_STATUS_ARB, &success); + if(!success) + { + if(msg) showglslinfo(obj, tname, name); + glDeleteObject_(obj); + obj = 0; + } +} + +static void linkglslprogram(Shader &s, bool msg = true) +{ + s.program = s.vsobj && s.psobj ? glCreateProgramObject_() : 0; + GLint success = 0; + if(s.program) + { + glAttachObject_(s.program, s.vsobj); + glAttachObject_(s.program, s.psobj); + glLinkProgram_(s.program); + glGetObjectParameteriv_(s.program, GL_OBJECT_LINK_STATUS_ARB, &success); + } + if(success) + { + glUseProgramObject_(s.program); + loopi(8) + { + s_sprintfd(arg)("tex%d", i); + GLint loc = glGetUniformLocation_(s.program, arg); + if(loc != -1) glUniform1i_(loc, i); + } + loopv(s.defaultparams) + { + ShaderParam ¶m = s.defaultparams[i]; + string pname; + if(param.type==SHPARAM_UNIFORM) s_strcpy(pname, param.name); + else s_sprintf(pname)("%s%d", param.type==SHPARAM_VERTEX ? "v" : "p", param.index); + param.loc = glGetUniformLocation_(s.program, pname); + } + glUseProgramObject_(0); + } + else if(s.program) + { + if(msg) showglslinfo(s.program, "PROG", s.name); + glDeleteObject_(s.program); + s.program = 0; + } +} + +bool checkglslsupport() +{ + /* check if GLSL profile supports loops + * might need to rewrite this if compiler does strength reduction + */ + const GLcharARB *source = + "uniform int N;\n" + "uniform vec4 delta;\n" + "void main(void) {\n" + " vec4 test = vec4(0.0, 0.0, 0.0, 0.0);\n" + " for(int i = 0; i < N; i++) test += delta;\n" + " gl_FragColor = test;\n" + "}\n"; + GLhandleARB obj = glCreateShaderObject_(GL_FRAGMENT_SHADER_ARB); + if(!obj) return false; + glShaderSource_(obj, 1, &source, NULL); + glCompileShader_(obj); + GLint success; + glGetObjectParameteriv_(obj, GL_OBJECT_COMPILE_STATUS_ARB, &success); + if(!success) + { + glDeleteObject_(obj); + return false; + } + GLhandleARB program = glCreateProgramObject_(); + if(!program) + { + glDeleteObject_(obj); + return false; + } + glAttachObject_(program, obj); + glLinkProgram_(program); + glGetObjectParameteriv_(program, GL_OBJECT_LINK_STATUS_ARB, &success); + glDeleteObject_(obj); + glDeleteObject_(program); + return success!=0; +} + +#define ALLOCEXTPARAM 0xFF +#define UNUSEDEXTPARAM 0xFE + +static void allocglsluniformparam(Shader &s, int type, int index, bool local = false) +{ + ShaderParamState &val = (type==SHPARAM_VERTEX ? vertexparamstate[index] : pixelparamstate[index]); + int loc = val.name ? glGetUniformLocation_(s.program, val.name) : -1; + if(loc == -1) + { + s_sprintfd(altname)("%s%d", type==SHPARAM_VERTEX ? "v" : "p", index); + loc = glGetUniformLocation_(s.program, val.name); + } + else + { + uchar alt = (type==SHPARAM_VERTEX ? s.extpixparams[index] : s.extvertparams[index]); + if(alt < RESERVEDSHADERPARAMS && s.extparams[alt].loc == loc) + { + if(type==SHPARAM_VERTEX) s.extvertparams[index] = alt; + else s.extpixparams[index] = alt; + return; + } + } + if(loc == -1) + { + if(type==SHPARAM_VERTEX) s.extvertparams[index] = local ? UNUSEDEXTPARAM : ALLOCEXTPARAM; + else s.extpixparams[index] = local ? UNUSEDEXTPARAM : ALLOCEXTPARAM; + return; + } + if(!(s.numextparams%4)) + { + LocalShaderParamState *extparams = new LocalShaderParamState[s.numextparams+4]; + if(s.extparams) + { + memcpy(extparams, s.extparams, s.numextparams*sizeof(LocalShaderParamState)); + delete[] s.extparams; + } + s.extparams = extparams; + } + LocalShaderParamState &ext = s.extparams[s.numextparams]; + ext.name = val.name; + ext.type = type; + ext.index = local ? -1 : index; + ext.loc = loc; + if(type==SHPARAM_VERTEX) s.extvertparams[index] = s.numextparams; + else s.extpixparams[index] = s.numextparams; + s.numextparams++; +} + +void Shader::allocenvparams(Slot *slot) +{ + if(!(type & SHADER_GLSLANG)) return; + + if(slot) + { +#define UNIFORMTEX(name, tmu) \ + { \ + loc = glGetUniformLocation_(program, name); \ + int val = tmu; \ + if(loc != -1) glUniform1i_(loc, val); \ + } + int loc, tmu = 2; + if(type & SHADER_NORMALSLMS) + { + UNIFORMTEX("lmcolor", 1); + UNIFORMTEX("lmdir", 2); + tmu++; + } + else UNIFORMTEX("lightmap", 1); + if(type & SHADER_ENVMAP) UNIFORMTEX("envmap", tmu++); + UNIFORMTEX("shadowmap", 7); + int stex = 0; + loopv(slot->sts) + { + Slot::Tex &t = slot->sts[i]; + switch(t.type) + { + case TEX_DIFFUSE: UNIFORMTEX("diffusemap", 0); break; + case TEX_NORMAL: UNIFORMTEX("normalmap", tmu++); break; + case TEX_GLOW: UNIFORMTEX("glowmap", tmu++); break; + case TEX_DECAL: UNIFORMTEX("decal", tmu++); break; + case TEX_SPEC: if(t.combined<0) UNIFORMTEX("specmap", tmu++); break; + case TEX_DEPTH: if(t.combined<0) UNIFORMTEX("depthmap", tmu++); break; + case TEX_UNKNOWN: + { + s_sprintfd(sname)("stex%d", stex++); + UNIFORMTEX(sname, tmu++); + break; + } + } + } + } + if(!extvertparams) + { + extvertparams = new uchar[2*RESERVEDSHADERPARAMS]; + extpixparams = extvertparams + RESERVEDSHADERPARAMS; + } + memset(extvertparams, ALLOCEXTPARAM, 2*RESERVEDSHADERPARAMS); + loopi(RESERVEDSHADERPARAMS) if(vertexparamstate[i].name && !vertexparamstate[i].local) + allocglsluniformparam(*this, SHPARAM_VERTEX, i); + loopi(RESERVEDSHADERPARAMS) if(pixelparamstate[i].name && !pixelparamstate[i].local) + allocglsluniformparam(*this, SHPARAM_PIXEL, i); +} + +static inline void flushparam(int type, int index) +{ + ShaderParamState &val = (type==SHPARAM_VERTEX ? vertexparamstate[index] : pixelparamstate[index]); + if(Shader::lastshader && Shader::lastshader->type&SHADER_GLSLANG) + { + uchar &extindex = (type==SHPARAM_VERTEX ? Shader::lastshader->extvertparams[index] : Shader::lastshader->extpixparams[index]); + if(extindex == ALLOCEXTPARAM) allocglsluniformparam(*Shader::lastshader, type, index, val.local); + if(extindex >= RESERVEDSHADERPARAMS) return; + LocalShaderParamState &ext = Shader::lastshader->extparams[extindex]; + if(!memcmp(ext.curval, val.val, sizeof(ext.curval))) return; + memcpy(ext.curval, val.val, sizeof(ext.curval)); + glUniform4fv_(ext.loc, 1, ext.curval); + } + else if(val.dirty==ShaderParamState::DIRTY) + { + glProgramEnvParameter4fv_(type==SHPARAM_VERTEX ? GL_VERTEX_PROGRAM_ARB : GL_FRAGMENT_PROGRAM_ARB, index, val.val); + val.dirty = ShaderParamState::CLEAN; + } +} + +static inline ShaderParamState &setparamf(const char *name, int type, int index, float x, float y, float z, float w) +{ + ShaderParamState &val = (type==SHPARAM_VERTEX ? vertexparamstate[index] : pixelparamstate[index]); + val.name = name; + if(val.dirty==ShaderParamState::INVALID || val.val[0]!=x || val.val[1]!=y || val.val[2]!=z || val.val[3]!=w) + { + val.val[0] = x; + val.val[1] = y; + val.val[2] = z; + val.val[3] = w; + val.dirty = ShaderParamState::DIRTY; + } + return val; +} + +static inline ShaderParamState &setparamfv(const char *name, int type, int index, const float *v) +{ + ShaderParamState &val = (type==SHPARAM_VERTEX ? vertexparamstate[index] : pixelparamstate[index]); + val.name = name; + if(val.dirty==ShaderParamState::INVALID || memcmp(val.val, v, sizeof(val.val))) + { + memcpy(val.val, v, sizeof(val.val)); + val.dirty = ShaderParamState::DIRTY; + } + return val; +} + +void setenvparamf(const char *name, int type, int index, float x, float y, float z, float w) +{ + ShaderParamState &val = setparamf(name, type, index, x, y, z, w); + val.local = false; + if(val.dirty==ShaderParamState::DIRTY) dirtyenvparams = true; +} + +void setenvparamfv(const char *name, int type, int index, const float *v) +{ + ShaderParamState &val = setparamfv(name, type, index, v); + val.local = false; + if(val.dirty==ShaderParamState::DIRTY) dirtyenvparams = true; +} + +void flushenvparamf(const char *name, int type, int index, float x, float y, float z, float w) +{ + ShaderParamState &val = setparamf(name, type, index, x, y, z, w); + val.local = false; + flushparam(type, index); +} + +void flushenvparamfv(const char *name, int type, int index, const float *v) +{ + ShaderParamState &val = setparamfv(name, type, index, v); + val.local = false; + flushparam(type, index); +} + +void setlocalparamf(const char *name, int type, int index, float x, float y, float z, float w) +{ + ShaderParamState &val = setparamf(name, type, index, x, y, z, w); + val.local = true; + flushparam(type, index); +} + +void setlocalparamfv(const char *name, int type, int index, const float *v) +{ + ShaderParamState &val = setparamfv(name, type, index, v); + val.local = true; + flushparam(type, index); +} + +void invalidateenvparams(int type, int start, int count) +{ + ShaderParamState *paramstate = type==SHPARAM_VERTEX ? vertexparamstate : pixelparamstate; + int end = min(start + count, RESERVEDSHADERPARAMS + MAXSHADERPARAMS); + while(start < end) + { + paramstate[start].dirty = ShaderParamState::INVALID; + start++; + } +} + +void Shader::flushenvparams(Slot *slot) +{ + if(type & SHADER_GLSLANG) + { + if(!used) allocenvparams(slot); + + loopi(numextparams) + { + LocalShaderParamState &ext = extparams[i]; + if(ext.index<0) continue; + float *val = ext.type==SHPARAM_VERTEX ? vertexparamstate[ext.index].val : pixelparamstate[ext.index].val; + if(!memcmp(ext.curval, val, sizeof(ext.val))) continue; + memcpy(ext.curval, val, sizeof(ext.val)); + glUniform4fv_(ext.loc, 1, ext.curval); + } + } + else if(dirtyenvparams) + { + loopi(RESERVEDSHADERPARAMS) + { + ShaderParamState &val = vertexparamstate[i]; + if(val.local || val.dirty!=ShaderParamState::DIRTY) continue; + glProgramEnvParameter4fv_(GL_VERTEX_PROGRAM_ARB, i, val.val); + val.dirty = ShaderParamState::CLEAN; + } + loopi(RESERVEDSHADERPARAMS) + { + ShaderParamState &val = pixelparamstate[i]; + if(val.local || val.dirty!=ShaderParamState::DIRTY) continue; + glProgramEnvParameter4fv_(GL_FRAGMENT_PROGRAM_ARB, i, val.val); + val.dirty = ShaderParamState::CLEAN; + } + dirtyenvparams = false; + } + used = true; +} + +void Shader::setslotparams(Slot &slot) +{ + uint unimask = 0, vertmask = 0, pixmask = 0; + loopv(slot.params) + { + ShaderParam &p = slot.params[i]; + if(type & SHADER_GLSLANG) + { + LocalShaderParamState &l = defaultparams[p.index]; + unimask |= p.index; + if(!memcmp(l.curval, p.val, sizeof(l.curval))) continue; + memcpy(l.curval, p.val, sizeof(l.curval)); + glUniform4fv_(l.loc, 1, l.curval); + } + else if(p.type!=SHPARAM_UNIFORM) + { + ShaderParamState &val = (p.type==SHPARAM_VERTEX ? vertexparamstate[RESERVEDSHADERPARAMS+p.index] : pixelparamstate[RESERVEDSHADERPARAMS+p.index]); + if(p.type==SHPARAM_VERTEX) vertmask |= 1<type & SHADER_GLSLANG) glUseProgramObject_(0); + + glBindProgram_(GL_VERTEX_PROGRAM_ARB, vs); + glBindProgram_(GL_FRAGMENT_PROGRAM_ARB, ps); + } + lastshader = this; +} + +VARFN(shaders, useshaders, -1, -1, 1, initwarning("shaders")); +VARF(shaderprecision, 0, 0, 2, initwarning("shader quality")); +VARP(shaderdetail, 0, MAXSHADERDETAIL, MAXSHADERDETAIL); + +VAR(dbgshader, 0, 0, 1); + +bool Shader::compile() +{ + if(type & SHADER_GLSLANG) + { + if(!vsstr) vsobj = reusevs && reusevs->type != SHADER_INVALID ? reusevs->vsobj : 0; + else compileglslshader(GL_VERTEX_SHADER_ARB, vsobj, vsstr, "VS", name, dbgshader || !variantshader); + if(!psstr) psobj = reuseps && reuseps->type != SHADER_INVALID ? reuseps->psobj : 0; + else compileglslshader(GL_FRAGMENT_SHADER_ARB, psobj, psstr, "PS", name, dbgshader || !variantshader); + linkglslprogram(*this, !variantshader); + return program!=0; + } + else + { + if(!vsstr) vs = reusevs && reusevs->type != SHADER_INVALID ? reusevs->vs : 0; + else if(!compileasmshader(GL_VERTEX_PROGRAM_ARB, vs, vsstr, "VS", name, dbgshader || !variantshader, variantshader!=NULL)) + native = false; + if(!psstr) ps = reuseps && reuseps->type != SHADER_INVALID ? reuseps->ps : 0; + else if(!compileasmshader(GL_FRAGMENT_PROGRAM_ARB, ps, psstr, "PS", name, dbgshader || !variantshader, variantshader!=NULL)) + native = false; + return vs && ps && (!variantshader || native); + } +} + +void Shader::cleanup(bool invalid) +{ + used = false; + native = true; + if(vs) { if(reusevs) glDeletePrograms_(1, &vs); vs = 0; } + if(ps) { if(reuseps) glDeletePrograms_(1, &ps); ps = 0; } + if(vsobj) { if(reusevs) glDeleteObject_(vsobj); vsobj = 0; } + if(psobj) { if(reuseps) glDeleteObject_(psobj); psobj = 0; } + if(program) { glDeleteObject_(program); program = 0; } + numextparams = 0; + DELETEA(extparams); + DELETEA(extvertparams); + extpixparams = NULL; + loopv(defaultparams) memset(defaultparams[i].curval, 0, sizeof(defaultparams[i].curval)); + if(standard || invalid) + { + type = SHADER_INVALID; + loopi(MAXVARIANTROWS) variants[i].setsizenodelete(0); + DELETEA(vsstr); + DELETEA(psstr); + defaultparams.setsizenodelete(0); + altshader = NULL; + reusevs = reuseps = NULL; + } +} + +Shader *newshader(int type, const char *name, const char *vs, const char *ps, Shader *variant = NULL, int row = 0) +{ + Shader *exists = shaders.access(name); + char *rname = exists ? exists->name : newstring(name); + Shader &s = shaders[rname]; + s.name = rname; + s.vsstr = newstring(vs); + s.psstr = newstring(ps); + s.type = type; + s.variantshader = variant; + s.standard = standardshader; + s.reusevs = s.reuseps = NULL; + if(variant) + { + int row = 0, col = 0; + if(!vs[0] || sscanf(vs, "%d , %d", &row, &col) >= 1) + { + DELETEA(s.vsstr); + s.reusevs = !vs[0] ? variant : (variant->variants[row].inrange(col) ? variant->variants[row][col] : NULL); + } + row = col = 0; + if(!ps[0] || sscanf(ps, "%d , %d", &row, &col) >= 1) + { + DELETEA(s.psstr); + s.reuseps = !ps[0] ? variant : (variant->variants[row].inrange(col) ? variant->variants[row][col] : NULL); + } + } + loopi(MAXSHADERDETAIL) s.fastshader[i] = &s; + if(variant) loopv(variant->defaultparams) s.defaultparams.add(variant->defaultparams[i]); + else loopv(curparams) s.defaultparams.add(curparams[i]); + if(renderpath!=R_FIXEDFUNCTION && !s.compile()) + { + s.cleanup(!standardshader); + if(standardshader) shaders.remove(rname); + return NULL; + } + if(variant) variant->variants[row].add(&s); + return &s; +} + +static uint findusedtexcoords(const char *str) +{ + uint used = 0; + for(;;) + { + const char *tc = strstr(str, "result.texcoord["); + if(!tc) break; + tc += strlen("result.texcoord["); + int n = strtol(tc, (char **)&str, 10); + if(n<0 || n>=16) continue; + used |= 1<=(int)sizeof(texcoords)) continue; + while(*str && *str!=']') str++; + if(*str==']') + { + if(*++str!='.') { texcoords[n] = 0xF; continue; } + for(;;) + { + switch(*++str) + { + case 'r': case 'x': texcoords[n] |= 1; continue; + case 'g': case 'y': texcoords[n] |= 2; continue; + case 'b': case 'z': texcoords[n] |= 4; continue; + case 'a': case 'w': texcoords[n] |= 8; continue; + } + break; + } + } + } + loopi(sizeof(texcoords)) if(texcoords[i]>0 && texcoords[i]<0xF) + { + loopk(4) if(!(texcoords[i]&(1< &vs, vector &ps, int row) +{ + char *vspragma = strstr(vs.getbuf(), "#pragma CUBE2_water"); + if(!vspragma) return false; + char *pspragma = strstr(ps.getbuf(), "#pragma CUBE2_water"); + if(!pspragma) return false; + vspragma += strcspn(vspragma, "\n"); + if(*vspragma) vspragma++; + pspragma += strcspn(pspragma, "\n"); + if(*pspragma) pspragma++; + if(s.type & SHADER_GLSLANG) + { + const char *fadedef = "waterfade = gl_Vertex.z*fogselect.y + fogselect.z;\n"; + vs.insert(vspragma-vs.getbuf(), fadedef, strlen(fadedef)); + const char *fadeuse = "gl_FragColor.a = waterfade;\n"; + ps.insert(pspragma-ps.getbuf(), fadeuse, strlen(fadeuse)); + const char *fadedecl = "varying float waterfade;\n"; + vs.insert(0, fadedecl, strlen(fadedecl)); + ps.insert(0, fadedecl, strlen(fadedecl)); + } + else + { + int fadetc = -1, fadecomp = -1; + if(!findunusedtexcoordcomponent(vs.getbuf(), fadetc, fadecomp)) + { + uint usedtc = findusedtexcoords(vs.getbuf()); + GLint maxtc = 0; + glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &maxtc); + int reservetc = row%2 ? reserveshadowmaptc : reservedynlighttc; + loopi(maxtc-reservetc) if(!(usedtc&(1<=0) + { + s_sprintfd(fadedef)("MAD result.texcoord[%d].%c, vertex.position.z, program.env[8].y, program.env[8].z;\n", + fadetc, fadecomp==3 ? 'w' : 'x'+fadecomp); + vs.insert(vspragma-vs.getbuf(), fadedef, strlen(fadedef)); + s_sprintfd(fadeuse)("MOV result.color.a, fragment.texcoord[%d].%c;\n", + fadetc, fadecomp==3 ? 'w' : 'x'+fadecomp); + ps.insert(pspragma-ps.getbuf(), fadeuse, strlen(fadeuse)); + } + else // fallback - use fog value, works under water but not above + { + const char *fogfade = "MAD result.color.a, fragment.fogcoord.x, 0.25, 0.5;\n"; + ps.insert(pspragma-ps.getbuf(), fogfade, strlen(fogfade)); + } + } + s_sprintfd(name)("%s", sname); + Shader *variant = newshader(s.type, name, vs.getbuf(), ps.getbuf(), &s, row); + return variant!=NULL; +} + +static void genwatervariant(Shader &s, const char *sname, const char *vs, const char *ps, int row = 2) +{ + vector vsw, psw; + vsw.put(vs, strlen(vs)+1); + psw.put(ps, strlen(ps)+1); + genwatervariant(s, sname, vsw, psw, row); +} + +static void gendynlightvariant(Shader &s, const char *sname, const char *vs, const char *ps, int row = 0) +{ + int numlights = 0, lights[MAXDYNLIGHTS]; + int emufogtc = -1, emufogcomp = -1; + const char *emufogcoord = NULL; + if(s.type & SHADER_GLSLANG) numlights = minimizedynlighttcusage ? 1 : MAXDYNLIGHTS; + else + { + uint usedtc = findusedtexcoords(vs); + GLint maxtc = 0; + glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &maxtc); + int reservetc = row%2 ? reserveshadowmaptc : reservedynlighttc; + if(maxtc-reservetc<0) return; + int limit = minimizedynlighttcusage ? 1 : MAXDYNLIGHTS; + loopi(maxtc-reservetc) if(!(usedtc&(1<=limit) break; + } + extern int emulatefog; + if(emulatefog && reservetc>0 && numlights+1 vsdl, psdl; + loopi(MAXDYNLIGHTS) + { + vsdl.setsizenodelete(0); + psdl.setsizenodelete(0); + + if(s.type & SHADER_GLSLANG) + { + loopk(i+1) + { + s_sprintfd(pos)("%sdynlight%dpos%s", + !k || k==numlights ? "uniform vec4 " : " ", + k, + k==i || k+1==numlights ? ";\n" : ","); + if(k=numlights) s_sprintf(tc)( + "%s" + "MAD dynlightdir.xyz, fragment.texcoord[%d], program.env[%d].w, program.env[%d];\n", + k==numlights ? "TEMP dynlightdir;\n" : "", + lights[0], k-1, k-1); + else if(ati_dph_bug || lights[k]==emufogtc) s_sprintf(tc)( + "MAD result.texcoord[%d].xyz, vertex.position, program.env[%d].w, program.env[%d];\n", + lights[k], 10+k, 10+k); + else s_sprintf(tc)( + "MAD result.texcoord[%d].xyz, vertex.position, program.env[%d].w, program.env[%d];\n" + "MOV result.texcoord[%d].w, 1;\n", + lights[k], 10+k, 10+k, lights[k]); + if(k < numlights) vsdl.put(tc, strlen(tc)); + else psdl.put(tc, strlen(tc)); + + if(s.type & SHADER_GLSLANG) s_sprintf(dl)( + "%s.rgb += dynlight%dcolor.rgb * (1.0 - clamp(dot(dynlight%ddir, dynlight%ddir), 0.0, 1.0));\n", + pslight, k, k, k); + else if(k>=numlights) s_sprintf(dl)( + "DP3_SAT dynlight.x, dynlightdir, dynlightdir;\n" + "SUB dynlight.x, 1, dynlight.x;\n" + "MAD %s.rgb, program.env[%d], dynlight.x, %s;\n", + pslight, 10+k, pslight); + else if(ati_dph_bug || lights[k]==emufogtc) s_sprintf(dl)( + "%s" + "DP3_SAT dynlight.x, fragment.texcoord[%d], fragment.texcoord[%d];\n" + "SUB dynlight.x, 1, dynlight.x;\n" + "MAD %s.rgb, program.env[%d], dynlight.x, %s;\n", + !k ? "TEMP dynlight;\n" : "", + lights[k], lights[k], + pslight, 10+k, pslight); + else s_sprintf(dl)( + "%s" + "DPH_SAT dynlight.x, -fragment.texcoord[%d], fragment.texcoord[%d];\n" + "MAD %s.rgb, program.env[%d], dynlight.x, %s;\n", + !k ? "TEMP dynlight;\n" : "", + lights[k], lights[k], + pslight, 10+k, pslight); + psdl.put(dl, strlen(dl)); + } + + EMUFOGVS(emufogcoord && i+1==numlights && emufogcoord >= vspragma, vsdl, vspragma, vspragma+strlen(vspragma)+1, emufogcoord, emufogtc, emufogcomp); + psdl.put(pspragma, strlen(pspragma)+1); + + EMUFOGPS(emufogcoord && i+1==numlights, psdl, emufogtc, emufogcomp); + + s_sprintfd(name)("%s", i+1, sname); + Shader *variant = newshader(s.type, name, vsdl.getbuf(), psdl.getbuf(), &s, row); + if(!variant) return; + if(row < 4) genwatervariant(s, name, vsdl, psdl, row+2); + } +} + +static void genshadowmapvariant(Shader &s, const char *sname, const char *vs, const char *ps, int row = 1) +{ + int smtc = -1, emufogtc = -1, emufogcomp = -1; + const char *emufogcoord = NULL; + if(!(s.type & SHADER_GLSLANG)) + { + uint usedtc = findusedtexcoords(vs); + GLint maxtc = 0; + glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &maxtc); + if(maxtc-reserveshadowmaptc<0) return; + loopi(maxtc-reserveshadowmaptc) if(!(usedtc&(1<0 && !(usedtc&(1<<(maxtc-reserveshadowmaptc))) && strstr(ps, "OPTION ARB_fog_linear;")) + { + emufogcoord = strstr(vs, "result.fogcoord"); + if(!emufogcoord || !findunusedtexcoordcomponent(vs, emufogtc, emufogcomp)) return; + smtc = maxtc-reserveshadowmaptc; + } + if(smtc<0) return; + } + + const char *vspragma = strstr(vs, "#pragma CUBE2_shadowmap"), *pspragma = strstr(ps, "#pragma CUBE2_shadowmap"); + string pslight; + vspragma += strcspn(vspragma, "\n"); + if(*vspragma) vspragma++; + + if(sscanf(pspragma, "#pragma CUBE2_shadowmap %s", pslight)!=1) return; + + pspragma += strcspn(pspragma, "\n"); + if(*pspragma) pspragma++; + + vector vssm, pssm; + + if(s.type & SHADER_GLSLANG) + { + const char *tc = "varying vec3 shadowmaptc;\n"; + vssm.put(tc, strlen(tc)); + pssm.put(tc, strlen(tc)); + const char *smtex = + "uniform sampler2D shadowmap;\n" + "uniform vec4 shadowmapambient;\n"; + pssm.put(smtex, strlen(smtex)); + if(!strstr(ps, "ambient")) + { + const char *amb = "uniform vec4 ambient;\n"; + pssm.put(amb, strlen(amb)); + } + } + + EMUFOGVS(emufogcoord && emufogcoord < vspragma, vssm, vs, vspragma, emufogcoord, emufogtc, emufogcomp); + pssm.put(ps, pspragma-ps); + + extern int smoothshadowmappeel; + if(s.type & SHADER_GLSLANG) + { + const char *tc = + "shadowmaptc = vec3(gl_TextureMatrix[2] * gl_Vertex);\n"; + vssm.put(tc, strlen(tc)); + const char *sm = + smoothshadowmappeel ? + "vec4 smvals = texture2D(shadowmap, shadowmaptc.xy);\n" + "vec2 smdiff = clamp(smvals.xz - shadowmaptc.zz*smvals.y, 0.0, 1.0);\n" + "float shadowed = clamp((smdiff.x > 0.0 ? smvals.w : 0.0) - 8.0*smdiff.y, 0.0, 1.0);\n" : + + "vec4 smvals = texture2D(shadowmap, shadowmaptc.xy);\n" + "float smtest = shadowmaptc.z*smvals.y;\n" + "float shadowed = smtest < smvals.x && smtest > smvals.z ? smvals.w : 0.0;\n"; + pssm.put(sm, strlen(sm)); + s_sprintfd(smlight)( + "%s.rgb -= shadowed*clamp(%s.rgb - shadowmapambient.rgb, 0.0, 1.0);\n", + pslight, pslight, pslight); + pssm.put(smlight, strlen(smlight)); + } + else + { + s_sprintfd(tc)( + "DP4 result.texcoord[%d].x, state.matrix.texture[2].row[0], vertex.position;\n" + "DP4 result.texcoord[%d].y, state.matrix.texture[2].row[1], vertex.position;\n" + "DP4 result.texcoord[%d].z, state.matrix.texture[2].row[2], vertex.position;\n", + smtc, smtc, smtc); + vssm.put(tc, strlen(tc)); + + s_sprintfd(sm)( + smoothshadowmappeel ? + "TEMP smvals, smdiff, smambient;\n" + "TEX smvals, fragment.texcoord[%d], texture[7], 2D;\n" + "MAD_SAT smdiff.xz, -fragment.texcoord[%d].z, smvals.y, smvals;\n" + "CMP smvals.w, -smdiff.x, smvals.w, 0;\n" + "MAD_SAT smvals.w, -8, smdiff.z, smvals.w;\n" : + + "TEMP smvals, smtest, smambient;\n" + "TEX smvals, fragment.texcoord[%d], texture[7], 2D;\n" + "MUL smtest.z, fragment.texcoord[%d].z, smvals.y;\n" + "SLT smtest.xz, smtest.z, smvals;\n" + "MAD_SAT smvals.w, smvals.w, smtest.x, -smtest.z;\n", + smtc, smtc); + pssm.put(sm, strlen(sm)); + s_sprintf(sm)( + "SUB_SAT smambient.rgb, %s, program.env[7];\n" + "MAD %s.rgb, smvals.w, -smambient, %s;\n", + pslight, pslight, pslight); + pssm.put(sm, strlen(sm)); + } + + if(!hasFBO) for(char *s = pssm.getbuf();;) + { + s = strstr(s, "smvals.w"); + if(!s) break; + s[7] = 'y'; + s += 8; + } + + EMUFOGVS(emufogcoord && emufogcoord >= vspragma, vssm, vspragma, vspragma+strlen(vspragma)+1, emufogcoord, emufogtc, emufogcomp); + pssm.put(pspragma, strlen(pspragma)+1); + + EMUFOGPS(emufogcoord, pssm, emufogtc, emufogcomp); + + s_sprintfd(name)("%s", sname); + Shader *variant = newshader(s.type, name, vssm.getbuf(), pssm.getbuf(), &s, row); + if(!variant) return; + genwatervariant(s, name, vssm.getbuf(), pssm.getbuf(), row+2); + + if(strstr(vs, "#pragma CUBE2_dynlight")) gendynlightvariant(s, name, vssm.getbuf(), pssm.getbuf(), row); +} + +void shader(int *type, char *name, char *vs, char *ps) +{ + if(lookupshaderbyname(name)) return; + + if((renderpath!=R_GLSLANG && *type & SHADER_GLSLANG) || + (!hasCM && strstr(ps, *type & SHADER_GLSLANG ? "textureCube" : "CUBE;")) || + (!hasTR && strstr(ps, *type & SHADER_GLSLANG ? "texture2DRect" : "RECT;"))) + { + loopv(curparams) + { + if(curparams[i].name) delete[] curparams[i].name; + } + curparams.setsize(0); + return; + } + + extern int mesa_program_bug; + if(renderpath!=R_FIXEDFUNCTION) + { + s_sprintfd(info)("shader %s", name); + show_out_of_renderloop_progress(0.0, info); + if(mesa_program_bug && standardshader) + { + glEnable(GL_VERTEX_PROGRAM_ARB); + glEnable(GL_FRAGMENT_PROGRAM_ARB); + } + } + Shader *s = newshader(*type, name, vs, ps); + if(s && renderpath!=R_FIXEDFUNCTION) + { + // '#' is a comment in vertex/fragment programs, while '#pragma' allows an escape for GLSL, so can handle both at once + if(strstr(vs, "#pragma CUBE2_water")) genwatervariant(*s, s->name, vs, ps); + if(strstr(vs, "#pragma CUBE2_shadowmap")) genshadowmapvariant(*s, s->name, vs, ps); + if(strstr(vs, "#pragma CUBE2_dynlight")) gendynlightvariant(*s, s->name, vs, ps); + } + if(renderpath!=R_FIXEDFUNCTION && mesa_program_bug && standardshader) + { + glDisable(GL_VERTEX_PROGRAM_ARB); + glDisable(GL_FRAGMENT_PROGRAM_ARB); + } + curparams.setsize(0); +} + +void variantshader(int *type, char *name, int *row, char *vs, char *ps) +{ + if(*row < 0) + { + shader(type, name, vs, ps); + return; + } + + if(renderpath==R_FIXEDFUNCTION && standardshader) return; + + Shader *s = lookupshaderbyname(name); + if(!s) return; + + s_sprintfd(varname)("%s", s->variants[*row].length(), *row, name); + //s_sprintfd(info)("shader %s", varname); + //show_out_of_renderloop_progress(0.0, info); + extern int mesa_program_bug; + if(renderpath!=R_FIXEDFUNCTION && mesa_program_bug && standardshader) + { + glEnable(GL_VERTEX_PROGRAM_ARB); + glEnable(GL_FRAGMENT_PROGRAM_ARB); + } + Shader *v = newshader(*type, varname, vs, ps, s, *row); + if(v && renderpath!=R_FIXEDFUNCTION) + { + // '#' is a comment in vertex/fragment programs, while '#pragma' allows an escape for GLSL, so can handle both at once + if(strstr(vs, "#pragma CUBE2_dynlight")) gendynlightvariant(*s, varname, vs, ps, *row); + } + if(renderpath!=R_FIXEDFUNCTION && mesa_program_bug && standardshader) + { + glDisable(GL_VERTEX_PROGRAM_ARB); + glDisable(GL_FRAGMENT_PROGRAM_ARB); + } +} + +void setshader(char *name) +{ + Shader *s = lookupshaderbyname(name); + if(!s) + { + if(renderpath!=R_FIXEDFUNCTION) conoutf(CON_ERROR, "no such shader: %s", name); + } + else curshader = s; + loopv(curparams) + { + if(curparams[i].name) delete[] curparams[i].name; + } + curparams.setsize(0); +} + +ShaderParam *findshaderparam(Slot &s, const char *name, int type, int index) +{ + if(!s.shader) return NULL; + loopv(s.params) + { + ShaderParam ¶m = s.params[i]; + if((name && param.name && !strcmp(name, param.name)) || (param.type==type && param.index==index)) return ¶m; + } + loopv(s.shader->defaultparams) + { + ShaderParam ¶m = s.shader->defaultparams[i]; + if((name && param.name && !strcmp(name, param.name)) || (param.type==type && param.index==index)) return ¶m; + } + return NULL; +} + +void setslotshader(Slot &s) +{ + s.shader = curshader; + if(!s.shader) + { + s.shader = stdworldshader; + return; + } + loopv(curparams) + { + ShaderParam ¶m = curparams[i], *defaultparam = findshaderparam(s, param.name, param.type, param.index); + if(!defaultparam || !memcmp(param.val, defaultparam->val, sizeof(param.val))) continue; + ShaderParam &override = s.params.add(param); + override.name = defaultparam->name; + if(s.shader->type&SHADER_GLSLANG) override.index = (LocalShaderParamState *)defaultparam - &s.shader->defaultparams[0]; + } + + if(strstr(s.shader->name, "glowworld")) + { + ShaderParam *cparam = findshaderparam(s, "glowscale", SHPARAM_PIXEL, 0); + if(!cparam) cparam = findshaderparam(s, "glowscale", SHPARAM_VERTEX, 0); + if(cparam) loopk(3) s.glowcolor[k] = cparam->val[k]; + if(strstr(s.shader->name, "pulse")) + { + ShaderParam *pulseparam, *speedparam; + if(strstr(s.shader->name, "bump")) + { + pulseparam = findshaderparam(s, "pulseglowscale", SHPARAM_PIXEL, 5); + speedparam = findshaderparam(s, "pulseglowspeed", SHPARAM_VERTEX, 4); + } + else + { + pulseparam = findshaderparam(s, "pulseglowscale", SHPARAM_VERTEX, 2); + speedparam = findshaderparam(s, "pulseglowspeed", SHPARAM_VERTEX, 1); + } + if(pulseparam) loopk(3) s.pulseglowcolor[k] = pulseparam->val[k]; + if(speedparam) s.pulseglowspeed = speedparam->val[0]/1000.0f; + } + } + else if(!strcmp(s.shader->name, "colorworld")) + { + ShaderParam *cparam = findshaderparam(s, "colorscale", SHPARAM_PIXEL, 0); + if(cparam && (cparam->val[0]!=1 || cparam->val[1]!=1 || cparam->val[2]!=1) && s.sts.length()>=1) + { + s_sprintfd(colorname)("%s", cparam->val[0], cparam->val[1], cparam->val[2], s.sts[0].name); + s_strcpy(s.sts[0].name, colorname); + } + } +} + +VAR(nativeshaders, 0, 1, 1); + +void altshader(char *origname, char *altname) +{ + Shader *alt = lookupshaderbyname(altname); + if(!alt) return; + Shader *orig = lookupshaderbyname(origname); + if(orig) + { + if(nativeshaders && !orig->native) orig->altshader = alt; + return; + } + Shader *exists = shaders.access(origname); + char *rname = exists ? exists->name : newstring(origname); + Shader &s = shaders[rname]; + s.name = rname; + s.altshader = alt; +} + +void fastshader(char *nice, char *fast, int *detail) +{ + Shader *ns = shaders.access(nice); + if(!ns || ns->type==SHADER_INVALID || ns->altshader) return; + Shader *fs = lookupshaderbyname(fast); + if(!fs) return; + loopi(min(*detail+1, MAXSHADERDETAIL)) ns->fastshader[i] = fs; +} + +COMMAND(shader, "isss"); +COMMAND(variantshader, "isiss"); +COMMAND(setshader, "s"); +COMMAND(altshader, "ss"); +COMMAND(fastshader, "ssi"); + +void isshaderdefined(char *name) +{ + Shader *s = lookupshaderbyname(name); + intret(s ? 1 : 0); +} + +void isshadernative(char *name) +{ + Shader *s = lookupshaderbyname(name); + intret(s && s->native ? 1 : 0); +} + +COMMAND(isshaderdefined, "s"); +COMMAND(isshadernative, "s"); + +void setshaderparam(char *name, int type, int n, float x, float y, float z, float w) +{ + if(!name && (n<0 || n>=MAXSHADERPARAMS)) + { + conoutf(CON_ERROR, "shader param index must be 0..%d\n", MAXSHADERPARAMS-1); + return; + } + loopv(curparams) + { + ShaderParam ¶m = curparams[i]; + if(param.type == type && (name ? !strstr(param.name, name) : param.index == n)) + { + param.val[0] = x; + param.val[1] = y; + param.val[2] = z; + param.val[3] = w; + return; + } + } + ShaderParam param = {name ? newstring(name) : NULL, type, n, -1, {x, y, z, w}}; + curparams.add(param); +} + +void setvertexparam(int *n, float *x, float *y, float *z, float *w) +{ + setshaderparam(NULL, SHPARAM_VERTEX, *n, *x, *y, *z, *w); +} + +void setpixelparam(int *n, float *x, float *y, float *z, float *w) +{ + setshaderparam(NULL, SHPARAM_PIXEL, *n, *x, *y, *z, *w); +} + +void setuniformparam(char *name, float *x, float *y, float *z, float *w) +{ + setshaderparam(name, SHPARAM_UNIFORM, -1, *x, *y, *z, *w); +} + +COMMAND(setvertexparam, "iffff"); +COMMAND(setpixelparam, "iffff"); +COMMAND(setuniformparam, "sffff"); + +const int NUMSCALE = 7; +Shader *fsshader = NULL, *scaleshader = NULL, *initshader = NULL; +GLuint rendertarget[NUMSCALE]; +GLuint fsfb[NUMSCALE-1]; +GLfloat fsparams[4]; +int fs_w = 0, fs_h = 0, fspasses = NUMSCALE, fsskip = 1; + +void setfullscreenshader(char *name, int *x, int *y, int *z, int *w) +{ + if(!hasTR || !*name) + { + fsshader = NULL; + } + else + { + Shader *s = lookupshaderbyname(name); + if(!s) return conoutf(CON_ERROR, "no such fullscreen shader: %s", name); + fsshader = s; + s_sprintfd(ssname)("%s_scale", name); + s_sprintfd(isname)("%s_init", name); + scaleshader = lookupshaderbyname(ssname); + initshader = lookupshaderbyname(isname); + fspasses = NUMSCALE; + fsskip = 1; + if(scaleshader) + { + int len = strlen(name); + char c = name[--len]; + if(isdigit(c)) + { + if(len>0 && isdigit(name[--len])) + { + fsskip = c-'0'; + fspasses = name[len]-'0'; + } + else fspasses = c-'0'; + } + } + conoutf("now rendering with: %s", name); + fsparams[0] = *x/255.0f; + fsparams[1] = *y/255.0f; + fsparams[2] = *z/255.0f; + fsparams[3] = *w/255.0f; + } +} + +COMMAND(setfullscreenshader, "siiii"); + +void renderfsquad(int w, int h, Shader *s) +{ + s->set(); + glViewport(0, 0, w, h); + if(s==scaleshader || s==initshader) + { + w <<= fsskip; + h <<= fsskip; + } + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex3f(-1, -1, 0); + glTexCoord2f(w, 0); glVertex3f( 1, -1, 0); + glTexCoord2f(w, h); glVertex3f( 1, 1, 0); + glTexCoord2f(0, h); glVertex3f(-1, 1, 0); + glEnd(); +} + +void renderfullscreenshader(int w, int h) +{ + if(!fsshader || renderpath==R_FIXEDFUNCTION) return; + + glDisable(GL_DEPTH_TEST); + glDepthMask(GL_FALSE); + glEnable(GL_TEXTURE_RECTANGLE_ARB); + + if(fs_w != w || fs_h != h) + { + if(!fs_w && !fs_h) + { + glGenTextures(NUMSCALE, rendertarget); + if(hasFBO) glGenFramebuffers_(NUMSCALE-1, fsfb); + } + loopi(NUMSCALE) + createtexture(rendertarget[i], w>>i, h>>i, NULL, 3, false, GL_RGB, GL_TEXTURE_RECTANGLE_ARB); + fs_w = w; + fs_h = h; + if(fsfb[0]) + { + loopi(NUMSCALE-1) + { + glBindFramebuffer_(GL_FRAMEBUFFER_EXT, fsfb[i]); + glFramebufferTexture2D_(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, rendertarget[i+1], 0); + } + glBindFramebuffer_(GL_FRAMEBUFFER_EXT, 0); + } + } + + setenvparamfv("fsparams", SHPARAM_PIXEL, 0, fsparams); + setenvparamf("millis", SHPARAM_VERTEX, 1, lastmillis/1000.0f, lastmillis/1000.0f, lastmillis/1000.0f); + + int nw = w, nh = h; + + loopi(fspasses) + { + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, rendertarget[i*fsskip]); + glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, 0, 0, nw, nh); + if(i>=fspasses-1 || !scaleshader || fsfb[0]) break; + renderfsquad(nw >>= fsskip, nh >>= fsskip, !i && initshader ? initshader : scaleshader); + } + if(scaleshader && fsfb[0]) + { + loopi(fspasses-1) + { + if(i) glBindTexture(GL_TEXTURE_RECTANGLE_ARB, rendertarget[i*fsskip]); + glBindFramebuffer_(GL_FRAMEBUFFER_EXT, fsfb[(i+1)*fsskip-1]); + renderfsquad(nw >>= fsskip, nh >>= fsskip, !i && initshader ? initshader : scaleshader); + } + glBindFramebuffer_(GL_FRAMEBUFFER_EXT, 0); + } + + if(scaleshader) loopi(fspasses) + { + glActiveTexture_(GL_TEXTURE0_ARB+i); + glEnable(GL_TEXTURE_RECTANGLE_ARB); + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, rendertarget[i*fsskip]); + } + renderfsquad(w, h, fsshader); + + if(scaleshader) loopi(fspasses) + { + glActiveTexture_(GL_TEXTURE0_ARB+i); + glDisable(GL_TEXTURE_RECTANGLE_ARB); + } + + glActiveTexture_(GL_TEXTURE0_ARB); + glDepthMask(GL_TRUE); + glEnable(GL_DEPTH_TEST); +} + +struct tmufunc +{ + GLenum combine, sources[4], ops[4]; + int scale; +}; + +struct tmu +{ + GLenum mode; + GLfloat color[4]; + tmufunc rgb, alpha; +}; + +#define INVALIDTMU \ +{ \ + 0, \ + { -1, -1, -1, -1 }, \ + { 0, { 0, 0, 0, -1 }, { 0, 0, 0, 0 }, 0 }, \ + { 0, { 0, 0, 0, -1 }, { 0, 0, 0, 0 }, 0 } \ +} + +#define INITTMU \ +{ \ + GL_MODULATE, \ + { 0, 0, 0, 0 }, \ + { GL_MODULATE, { GL_TEXTURE, GL_PREVIOUS_ARB, GL_CONSTANT_ARB, GL_ZERO }, { GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_COLOR }, 1 }, \ + { GL_MODULATE, { GL_TEXTURE, GL_PREVIOUS_ARB, GL_CONSTANT_ARB, GL_ZERO }, { GL_SRC_ALPHA, GL_SRC_ALPHA, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA }, 1 } \ +} + +#define MAXTMUS 8 + +tmu tmus[MAXTMUS] = +{ + INVALIDTMU, + INVALIDTMU, + INVALIDTMU, + INVALIDTMU, + INVALIDTMU, + INVALIDTMU, + INVALIDTMU, + INVALIDTMU +}; + +VAR(maxtmus, 1, 0, 0); + +void parsetmufunc(tmu &t, tmufunc &f, const char *s) +{ + int arg = -1; + while(*s) switch(*s++) + { + case 'T': + case 't': f.sources[++arg] = GL_TEXTURE; f.ops[arg] = GL_SRC_COLOR; break; + case 'P': + case 'p': f.sources[++arg] = GL_PREVIOUS_ARB; f.ops[arg] = GL_SRC_COLOR; break; + case 'K': + case 'k': f.sources[++arg] = GL_CONSTANT_ARB; f.ops[arg] = GL_SRC_COLOR; break; + case 'C': + case 'c': f.sources[++arg] = GL_PRIMARY_COLOR_ARB; f.ops[arg] = GL_SRC_COLOR; break; + case '~': f.ops[arg] = GL_ONE_MINUS_SRC_COLOR; break; + case 'A': + case 'a': f.ops[arg] = f.ops[arg]==GL_ONE_MINUS_SRC_COLOR ? GL_ONE_MINUS_SRC_ALPHA : GL_SRC_ALPHA; break; + case '=': f.combine = GL_REPLACE; break; + case '*': f.combine = GL_MODULATE; break; + case '+': f.combine = GL_ADD; break; + case '-': f.combine = GL_SUBTRACT_ARB; break; + case ',': + case '@': f.combine = GL_INTERPOLATE_ARB; break; + case 'X': + case 'x': while(!isdigit(*s)) s++; f.scale = *s++-'0'; break; + // EXT_texture_env_dot3 + case '.': f.combine = GL_DOT3_RGB_ARB; break; + // ATI_texture_env_combine3 + case '3': f.combine = GL_MODULATE_ADD_ATI; break; + // NV_texture_env_combine4 + case '4': t.mode = GL_COMBINE4_NV; f.combine = GL_ADD; break; + case '0': f.sources[++arg] = GL_ZERO; f.ops[arg] = GL_SRC_COLOR; break; + case '1': f.sources[++arg] = GL_ZERO; f.ops[arg] = GL_ONE_MINUS_SRC_COLOR; break; + } +} + +void committmufunc(GLenum mode, bool rgb, tmufunc &dst, tmufunc &src) +{ + if(dst.combine!=src.combine) glTexEnvi(GL_TEXTURE_ENV, rgb ? GL_COMBINE_RGB_ARB : GL_COMBINE_ALPHA_ARB, src.combine); + loopi(3) + { + if(dst.sources[i]!=src.sources[i]) glTexEnvi(GL_TEXTURE_ENV, (rgb ? GL_SOURCE0_RGB_ARB : GL_SOURCE0_ALPHA_ARB)+i, src.sources[i]); + if(dst.ops[i]!=src.ops[i]) glTexEnvi(GL_TEXTURE_ENV, (rgb ? GL_OPERAND0_RGB_ARB : GL_OPERAND0_ALPHA_ARB)+i, src.ops[i]); + } + if(mode==GL_COMBINE4_NV) + { + if(dst.sources[3]!=src.sources[3]) glTexEnvi(GL_TEXTURE_ENV, rgb ? GL_SOURCE3_RGB_NV : GL_SOURCE3_ALPHA_NV, src.sources[3]); + if(dst.ops[3]!=src.ops[3]) glTexEnvi(GL_TEXTURE_ENV, rgb ? GL_OPERAND3_RGB_NV : GL_OPERAND3_ALPHA_NV, src.ops[3]); + } + if(dst.scale!=src.scale) glTexEnvi(GL_TEXTURE_ENV, rgb ? GL_RGB_SCALE_ARB : GL_ALPHA_SCALE, src.scale); +} + +void committmu(int n, tmu &f) +{ + if(renderpath!=R_FIXEDFUNCTION || n>=maxtmus) return; + if(tmus[n].mode!=f.mode) glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, f.mode); + if(memcmp(tmus[n].color, f.color, sizeof(f.color))) glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, f.color); + committmufunc(f.mode, true, tmus[n].rgb, f.rgb); + committmufunc(f.mode, false, tmus[n].alpha, f.alpha); + tmus[n] = f; +} + +void resettmu(int n) +{ + tmu f = tmus[n]; + f.mode = GL_MODULATE; + f.rgb.scale = 1; + f.alpha.scale = 1; + committmu(n, f); +} + +void scaletmu(int n, int rgbscale, int alphascale) +{ + tmu f = tmus[n]; + if(rgbscale) f.rgb.scale = rgbscale; + if(alphascale) f.alpha.scale = alphascale; + committmu(n, f); +} + +void colortmu(int n, float r, float g, float b, float a) +{ + tmu f = tmus[n]; + f.color[0] = r; + f.color[1] = g; + f.color[2] = b; + f.color[3] = a; + committmu(n, f); +} + +void setuptmu(int n, const char *rgbfunc, const char *alphafunc) +{ + static tmu init = INITTMU; + tmu f = tmus[n]; + + f.mode = GL_COMBINE_ARB; + if(rgbfunc) parsetmufunc(f, f.rgb, rgbfunc); + else f.rgb = init.rgb; + if(alphafunc) parsetmufunc(f, f.alpha, alphafunc); + else f.alpha = init.alpha; + + committmu(n, f); +} + +VAR(nolights, 1, 0, 0); +VAR(nowater, 1, 0, 0); +VAR(nomasks, 1, 0, 0); + +void inittmus() +{ + if(hasTE && hasMT) + { + GLint val; + glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &val); + maxtmus = max(1, min(MAXTMUS, int(val))); + loopi(maxtmus) + { + glActiveTexture_(GL_TEXTURE0_ARB+i); + resettmu(i); + } + glActiveTexture_(GL_TEXTURE0_ARB); + } + else if(hasTE) { maxtmus = 1; resettmu(0); } + if(renderpath==R_FIXEDFUNCTION) + { + if(maxtmus<4) caustics = 0; + if(maxtmus<2) + { + nolights = nowater = nomasks = 1; + extern int lightmodels; + lightmodels = 0; + refractfog = 0; + } + } +} + +void cleanupshaders() +{ + if(fs_w || fs_h) + { + glDeleteTextures(NUMSCALE, rendertarget); + if(hasFBO) glDeleteFramebuffers_(NUMSCALE-1, fsfb); + fs_w = fs_h = 0; + } + fsshader = NULL; + + defaultshader = notextureshader = nocolorshader = foggedshader = foggednotextureshader = NULL; + enumerate(shaders, Shader, s, s.cleanup()); + Shader::lastshader = NULL; + if(renderpath!=R_FIXEDFUNCTION) + { + glBindProgram_(GL_VERTEX_PROGRAM_ARB, 0); + glBindProgram_(GL_FRAGMENT_PROGRAM_ARB, 0); + glDisable(GL_VERTEX_PROGRAM_ARB); + glDisable(GL_FRAGMENT_PROGRAM_ARB); + if(renderpath==R_GLSLANG) glUseProgramObject_(0); + } + loopi(RESERVEDSHADERPARAMS + MAXSHADERPARAMS) + { + vertexparamstate[i].dirty = ShaderParamState::INVALID; + pixelparamstate[i].dirty = ShaderParamState::INVALID; + } + + tmu invalidtmu = INVALIDTMU; + loopi(MAXTMUS) tmus[i] = invalidtmu; +} + +void reloadshaders() +{ + persistidents = false; + loadshaders(); + persistidents = true; + if(renderpath!=R_FIXEDFUNCTION) enumerate(shaders, Shader, s, + if(!s.standard && s.type!=SHADER_INVALID && !s.variantshader) + { + s_sprintfd(info)("shader %s", s.name); + show_out_of_renderloop_progress(0.0, info); + if(!s.compile()) s.cleanup(true); + loopi(MAXVARIANTROWS) loopvj(s.variants[i]) + { + Shader *v = s.variants[i][j]; + if((v->reusevs && v->reusevs->type==SHADER_INVALID) || + (v->reuseps && v->reuseps->type==SHADER_INVALID) || + !v->compile()) + v->cleanup(true); + } + } + ); +} + +void setupblurkernel(int radius, float sigma, float *weights, float *offsets) +{ + if(radius<1 || radius>MAXBLURRADIUS) return; + sigma *= 2*radius; + float total = 1.0f/sigma, lastoffset = 0; + weights[0] = 1.0f/sigma; + // rely on bilinear filtering to sample 2 pixels at once + // transforms a*X + b*Y into (u+v)*[X*u/(u+v) + Y*(1 - u/(u+v))] + loopi(radius) + { + float weight1 = exp(-((2*i)*(2*i)) / (2*sigma*sigma)) / sigma, + weight2 = exp(-((2*i+1)*(2*i+1)) / (2*sigma*sigma)) / sigma, + scale = weight1 + weight2, + offset = 2*i+1 + weight2 / scale; + weights[i+1] = scale; + offsets[i+1] = offset - lastoffset; + lastoffset = offset; + total += 2*scale; + } + loopi(radius+1) weights[i] /= total; + for(int i = radius+1; i <= MAXBLURRADIUS; i++) weights[i] = offsets[i] = 0; +} + +void setblurshader(int pass, int size, int radius, float *weights, float *offsets, GLenum target) +{ + if(radius<1 || radius>MAXBLURRADIUS) return; + static Shader *blurshader[7][2] = { { NULL, NULL }, { NULL, NULL }, { NULL, NULL }, { NULL, NULL }, { NULL, NULL }, { NULL, NULL }, { NULL, NULL } }, + *blurrectshader[7][2] = { { NULL, NULL }, { NULL, NULL }, { NULL, NULL }, { NULL, NULL }, { NULL, NULL }, { NULL, NULL }, { NULL, NULL } }; + Shader *&s = (target == GL_TEXTURE_RECTANGLE_ARB ? blurrectshader : blurshader)[radius-1][pass]; + if(!s) + { + s_sprintfd(name)("blur%c%d%s", 'x'+pass, radius, target == GL_TEXTURE_RECTANGLE_ARB ? "rect" : ""); + s = lookupshaderbyname(name); + } + s->set(); + setlocalparamfv("weights", SHPARAM_PIXEL, 0, weights); + setlocalparamfv("weights2", SHPARAM_PIXEL, 2, &weights[4]); + setlocalparamf("offsets", SHPARAM_PIXEL, 1, + pass==0 ? offsets[1]/size : offsets[0]/size, + pass==1 ? offsets[1]/size : offsets[0]/size, + offsets[2]/size, + offsets[3]/size); + setlocalparamf("offsets2", SHPARAM_PIXEL, 3, + offsets[4]/size, + offsets[5]/size, + offsets[6]/size, + offsets[7]/size); +} + diff --git a/src/engine/shadowmap.cpp b/src/engine/shadowmap.cpp new file mode 100644 index 0000000..0b3b7c2 --- /dev/null +++ b/src/engine/shadowmap.cpp @@ -0,0 +1,379 @@ +#include "pch.h" +#include "engine.h" +#include "rendertarget.h" + +VARP(shadowmap, 0, 0, 1); + +extern void cleanshadowmap(); +VARFP(shadowmapsize, 7, 9, 11, cleanshadowmap()); +VARP(shadowmapradius, 64, 96, 256); +VAR(shadowmapheight, 0, 32, 128); +VARP(shadowmapdist, 128, 256, 512); +VARFP(fpshadowmap, 0, 0, 1, cleanshadowmap()); +VARFP(shadowmapprecision, 0, 0, 1, cleanshadowmap()); +VARR(shadowmapambient, 0, 0, 0xFFFFFF); + +VARP(blurshadowmap, 0, 1, 3); +VARP(blursmsigma, 1, 100, 200); + +#define SHADOWSKEW 0.7071068f + +vec shadowoffset(0, 0, 0), shadowfocus(0, 0, 0), shadowdir(0, SHADOWSKEW, 1); +VAR(shadowmapcasters, 1, 0, 0); + +void setshadowdir(int angle) +{ + shadowdir = vec(0, SHADOWSKEW, 1); + shadowdir.rotate_around_z(angle*RAD); +} + +VARFR(shadowmapangle, 0, 0, 360, setshadowdir(shadowmapangle)); + +void guessshadowdir() +{ + if(shadowmapangle) return; + vec lightpos(0, 0, 0), casterpos(0, 0, 0); + int numlights = 0, numcasters = 0; + const vector &ents = et->getents(); + loopv(ents) + { + extentity &e = *ents[i]; + switch(e.type) + { + case ET_LIGHT: + if(!e.attr1) { lightpos.add(e.o); numlights++; } + break; + + case ET_MAPMODEL: + casterpos.add(e.o); + numcasters++; + break; + + default: + if(e.typeyaw*RAD); + + vec dir; + vecfromyawpitch(camera1->yaw, camera1->pitch, 1, 0, dir); + dir.z = 0; + dir.mul(shadowmapradius); + + vec dirx, diry; + vecfromyawpitch(camera1->yaw, 0, 0, 1, dirx); + vecfromyawpitch(camera1->yaw, 0, 1, 0, diry); + shadowoffset.x = -fmod(dirx.dot(camera1->o) - skewdir.x*camera1->o.z, 2.0f*shadowmapradius/vieww); + shadowoffset.y = -fmod(diry.dot(camera1->o) - skewdir.y*camera1->o.z, 2.0f*shadowmapradius/viewh); + + GLfloat skew[] = + { + 1, 0, 0, 0, + 0, 1, 0, 0, + skewdir.x, skewdir.y, 1, 0, + 0, 0, 0, 1 + }; + glLoadMatrixf(skew); + glTranslatef(skewdir.x*shadowmapheight + shadowoffset.x, skewdir.y*shadowmapheight + shadowoffset.y + dir.magnitude(), -shadowmapheight); + glRotatef(camera1->yaw, 0, 0, -1); + glTranslatef(-camera1->o.x, -camera1->o.y, -camera1->o.z); + shadowfocus = camera1->o; + shadowfocus.add(dir); + shadowfocus.add(vec(-shadowdir.x, -shadowdir.y, 1).mul(shadowmapheight)); + shadowfocus.add(dirx.mul(shadowoffset.x)); + shadowfocus.add(diry.mul(shadowoffset.y)); + + glGetDoublev(GL_PROJECTION_MATRIX, shadowmapprojection); + glGetDoublev(GL_MODELVIEW_MATRIX, shadowmapmodelview); + + setenvparamf("shadowmapbias", SHPARAM_VERTEX, 0, -shadowmapbias/float(shadowmapdist), 1 - (shadowmapbias + (smoothshadowmappeel ? 0 : shadowmappeelbias))/float(shadowmapdist)); + + shadowmapcasters = 0; + shadowmapping = true; + rendergame(); + shadowmapping = false; + + if(shadowmapcasters && smdepthpeel) + { + int sx, sy, sw, sh; + bool scissoring = rtscissor && scissorblur(sx, sy, sw, sh) && sw > 0 && sh > 0; + if(scissoring) + { + if(!hasFBO) + { + sx += screen->w-vieww; + sy += screen->h-viewh; + } + glScissor(sx, sy, sw, sh); + } + if(!rtscissor || scissoring) rendershadowmapreceivers(); + } + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + + return shadowmapcasters>0; + } + + bool flipdebug() const { return false; } + + void dodebug(int w, int h) + { + if(shadowmapcasters) + { + glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); + debugscissor(w, h); + glColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_FALSE); + debugblurtiles(w, h); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + } + } +} shadowmaptex; + +void cleanshadowmap() +{ + shadowmaptex.cleanup(true); +} + +void calcshadowmapbb(const vec &o, float xyrad, float zrad, float &x1, float &y1, float &x2, float &y2) +{ + vec skewdir(shadowdir); + skewdir.neg(); + skewdir.rotate_around_z(-camera1->yaw*RAD); + + vec ro(o); + ro.sub(camera1->o); + ro.rotate_around_z(-camera1->yaw*RAD); + ro.x += ro.z * skewdir.x + shadowoffset.x; + ro.y += ro.z * skewdir.y + shadowmapradius * cosf(camera1->pitch*RAD) + shadowoffset.y; + + vec high(ro), low(ro); + high.x += zrad * skewdir.x; + high.y += zrad * skewdir.y; + low.x -= zrad * skewdir.x; + low.y -= zrad * skewdir.y; + + x1 = (min(high.x, low.x) - xyrad) / shadowmapradius; + y1 = (min(high.y, low.y) - xyrad) / shadowmapradius; + x2 = (max(high.x, low.x) + xyrad) / shadowmapradius; + y2 = (max(high.y, low.y) + xyrad) / shadowmapradius; +} + +bool addshadowmapcaster(const vec &o, float xyrad, float zrad) +{ + if(o.z + zrad <= shadowfocus.z - shadowmapdist || o.z - zrad >= shadowfocus.z) return false; + + float x1, y1, x2, y2; + calcshadowmapbb(o, xyrad, zrad, x1, y1, x2, y2); + + if(!shadowmaptex.addblurtiles(x1, y1, x2, y2, 2)) return false; + + shadowmapcasters++; + return true; +} + +bool isshadowmapreceiver(vtxarray *va) +{ + if(!shadowmap || renderpath==R_FIXEDFUNCTION || !shadowmapcasters) return false; + + if(va->shadowmapmax.z <= shadowfocus.z - shadowmapdist || va->shadowmapmin.z >= shadowfocus.z) return false; + + float xyrad = SQRT2*0.5f*max(va->shadowmapmax.x-va->shadowmapmin.x, va->shadowmapmax.y-va->shadowmapmin.y), + zrad = 0.5f*(va->shadowmapmax.z-va->shadowmapmin.z), + x1, y1, x2, y2; + if(xyrad<0 || zrad<0) return false; + + vec center(va->shadowmapmin.tovec()); + center.add(va->shadowmapmax.tovec()).mul(0.5f); + calcshadowmapbb(center, xyrad, zrad, x1, y1, x2, y2); + + return shadowmaptex.checkblurtiles(x1, y1, x2, y2, 2); + +#if 0 + // cheaper inexact test + float dz = va->o.z + va->size/2 - shadowfocus.z; + float cx = shadowfocus.x - dz*shadowdir.x, cy = shadowfocus.y - dz*shadowdir.y; + float skew = va->size/2*SHADOWSKEW; + if(!shadowmap || !shadowmaptex || + va->o.z + va->size <= shadowfocus.z - shadowmapdist || va->o.z >= shadowfocus.z || + va->o.x + va->size <= cx - shadowmapradius-skew || va->o.x >= cx + shadowmapradius+skew || + va->o.y + va->size <= cy - shadowmapradius-skew || va->o.y >= cy + shadowmapradius+skew) + return false; + return true; +#endif +} + +bool isshadowmapcaster(const vec &o, float rad) +{ + // cheaper inexact test + float dz = o.z - shadowfocus.z; + float cx = shadowfocus.x - dz*shadowdir.x, cy = shadowfocus.y - dz*shadowdir.y; + float skew = rad*SHADOWSKEW; + if(!shadowmapping || + o.z + rad <= shadowfocus.z - shadowmapdist || o.z - rad >= shadowfocus.z || + o.x + rad <= cx - shadowmapradius-skew || o.x - rad >= cx + shadowmapradius+skew || + o.y + rad <= cy - shadowmapradius-skew || o.y - rad >= cy + shadowmapradius+skew) + return false; + return true; +} + +void pushshadowmap() +{ + if(!shadowmap || !shadowmaptex.rendertex) return; + + glActiveTexture_(GL_TEXTURE7_ARB); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, shadowmaptex.rendertex); + + glActiveTexture_(GL_TEXTURE2_ARB); + glEnable(GL_TEXTURE_2D); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glTranslatef(0.5f, 0.5f, 1-shadowmapbias/float(shadowmapdist)); + glScalef(0.5f, 0.5f, -1); + glMultMatrixd(shadowmapprojection); + glMultMatrixd(shadowmapmodelview); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glActiveTexture_(GL_TEXTURE0_ARB); + glClientActiveTexture_(GL_TEXTURE0_ARB); + + float r, g, b; + if(!shadowmapambient) + { + if(hdr.skylight[0] || hdr.skylight[1] || hdr.skylight[2]) + { + r = max(25.0f, 0.4f*hdr.ambient + 0.6f*max(hdr.ambient, hdr.skylight[0])); + g = max(25.0f, 0.4f*hdr.ambient + 0.6f*max(hdr.ambient, hdr.skylight[1])); + b = max(25.0f, 0.4f*hdr.ambient + 0.6f*max(hdr.ambient, hdr.skylight[2])); + } + else r = g = b = max(25.0f, 2.0f*hdr.ambient); + } + else if(shadowmapambient<=255) r = g = b = shadowmapambient; + else { r = (shadowmapambient>>16)&0xFF; g = (shadowmapambient>>8)&0xFF; b = shadowmapambient&0xFF; } + setenvparamf("shadowmapambient", SHPARAM_PIXEL, 7, r/255.0f, g/255.0f, b/255.0f); +} + +void adjustshadowmatrix(const ivec &o, float scale) +{ + if(!shadowmap || !shadowmaptex.rendertex) return; + + glActiveTexture_(GL_TEXTURE2_ARB); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glPushMatrix(); + glTranslatef(o.x, o.y, o.z); + glScalef(scale, scale, scale); + glMatrixMode(GL_MODELVIEW); + glActiveTexture_(GL_TEXTURE0_ARB); +} + +void popshadowmap() +{ + if(!shadowmap || !shadowmaptex.rendertex) return; + + glActiveTexture_(GL_TEXTURE7_ARB); + glDisable(GL_TEXTURE_2D); + + glActiveTexture_(GL_TEXTURE2_ARB); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + + glActiveTexture_(GL_TEXTURE0_ARB); +} + +void rendershadowmap() +{ + if(!shadowmap || renderpath==R_FIXEDFUNCTION) return; + + // Apple/ATI bug - fixed-function fog state can force software fallback even when fragment program is enabled + glDisable(GL_FOG); + shadowmaptex.render(1<*y) return 1; + return 0; +} + +struct skelmodel : animmodel +{ + struct vert { vec pos, norm; float u, v; int blend, interpindex; }; + struct vvert { vec pos; float u, v; }; + struct vvertn : vvert { vec norm; }; + struct vvertw : vvertn { uchar weights[4]; uchar bones[4]; }; + struct vvertbump : vvertn { vec tangent; float bitangent; }; + struct vvertbumpw : vvertw { vec tangent; float bitangent; }; + struct bumpvert { vec tangent; float bitangent; }; + struct tri { ushort vert[3]; }; + + struct blendcombo + { + int uses, interpindex; + float weights[4]; + uchar bones[4], interpbones[4]; + + blendcombo() : uses(1) + { + } + + bool operator==(const blendcombo &c) const + { + loopk(4) if(bones[k] != c.bones[k]) return false; + loopk(4) if(weights[k] != c.weights[k]) return false; + return true; + } + + int size() const + { + int i = 0; + while(i < 4 && weights[i]) i++; + return i; + } + + static int sortcmp(const blendcombo *x, const blendcombo *y) + { + loopi(4) + { + if(x->weights[i]) + { + if(!y->weights[i]) return -1; + } + else if(y->weights[i]) return 1; + else break; + } + return 0; + } + + int addweight(int sorted, float weight, int bone) + { + loopk(sorted) if(weight > weights[k]) + { + for(int l = min(sorted-1, 2); l >= k; l--) + { + weights[l+1] = weights[l]; + bones[l+1] = bones[l]; + } + weights[k] = weight; + bones[k] = bone; + return sorted<4 ? sorted+1 : sorted; + } + if(sorted>=4) return sorted; + weights[sorted] = weight; + bones[sorted] = bone; + return sorted+1; + } + + void finalize(int sorted) + { + loopj(4-sorted) { weights[sorted+j] = 0; bones[sorted+j] = 0; } + + float total = 0; + loopj(sorted) total += weights[j]; + total = 1.0f/total; + loopj(sorted) weights[j] *= total; + } + + void serialize(vvertw &v) + { + if(interpindex >= 0) + { + v.weights[0] = 255; + loopk(3) v.weights[k+1] = 0; + v.bones[0] = (matskel ? 3 : 2)*interpindex; + loopk(3) v.bones[k+1] = 0; + } + else + { + loopk(4) v.weights[k] = uchar(weights[k]*255); + loopk(4) v.bones[k] = (matskel ? 3 : 2)*interpbones[k]; + } + } + }; + + + struct animcacheentry + { + animstate as[MAXANIMPARTS]; + float pitch; + int millis; + uchar *partmask; + + animcacheentry() + { + loopk(MAXANIMPARTS) as[k].cur.fr1 = as[k].prev.fr1 = -1; + } + + bool operator==(const animcacheentry &c) const + { + loopi(MAXANIMPARTS) if(as[i]!=c.as[i]) return false; + return pitch==c.pitch && partmask==c.partmask; + } + }; + + struct vbocacheentry : animcacheentry + { + uchar *vdata; + GLuint vbuf; + int owner; + + vbocacheentry() : vdata(NULL), vbuf(0), owner(-1) {} + }; + + struct skelcacheentry : animcacheentry + { + dualquat *bdata; + matrix3x4 *mdata; + + skelcacheentry() : bdata(NULL), mdata(NULL) {} + }; + + struct blendcacheentry : skelcacheentry + { + int owner; + + blendcacheentry() : owner(-1) {} + }; + + struct skelmeshgroup; + + struct skelmesh : mesh + { + vert *verts; + bumpvert *bumpverts; + tri *tris; + int numverts, numtris, maxweights; + + int voffset, eoffset, elen; + ushort minvert, maxvert; + + skelmesh() : verts(NULL), bumpverts(NULL), tris(0), numverts(0), numtris(0), maxweights(0) + { + } + + virtual ~skelmesh() + { + DELETEA(verts); + DELETEA(bumpverts); + DELETEA(tris); + } + + virtual mesh *allocate() { return new skelmesh; } + + mesh *copy() + { + skelmesh &m = *(skelmesh *)mesh::copy(); + m.numverts = numverts; + m.verts = new vert[numverts]; + memcpy(m.verts, verts, numverts*sizeof(vert)); + m.numtris = numtris; + m.tris = new tri[numtris]; + memcpy(m.tris, tris, numtris*sizeof(tri)); + m.maxweights = maxweights; + if(bumpverts) + { + m.bumpverts = new bumpvert[numverts]; + memcpy(m.bumpverts, bumpverts, numverts*sizeof(bumpvert)); + } + else m.bumpverts = NULL; + return &m; + } + + int addblendcombo(const blendcombo &c) + { + maxweights = max(maxweights, c.size()); + return ((skelmeshgroup *)group)->addblendcombo(c); + } + + void scaleverts(const vec &transdiff, float scalediff) + { + if(((skelmeshgroup *)group)->skel->numframes) loopi(numverts) verts[i].pos.mul(scalediff); + else loopi(numverts) verts[i].pos.add(transdiff).mul(scalediff); + } + + void calctangents(bool areaweight = true) + { + if(bumpverts) return; + vec *tangent = new vec[2*numverts], *bitangent = tangent+numverts; + memset(tangent, 0, 2*numverts*sizeof(vec)); + bumpverts = new bumpvert[numverts]; + loopi(numtris) + { + const tri &t = tris[i]; + const vert &av = verts[t.vert[0]], + &bv = verts[t.vert[1]], + &cv = verts[t.vert[2]]; + + vec e1(bv.pos), e2(cv.pos); + e1.sub(av.pos); + e2.sub(av.pos); + + float u1 = bv.u - av.u, v1 = bv.v - av.v, + u2 = cv.u - av.u, v2 = cv.v - av.v, + scale = u1*v2 - u2*v1; + if(scale!=0) scale = 1.0f / scale; + vec u(e1), v(e2); + u.mul(v2).sub(vec(e2).mul(v1)).mul(scale); + v.mul(u1).sub(vec(e1).mul(u2)).mul(scale); + + if(!areaweight) + { + u.normalize(); + v.normalize(); + } + + loopj(3) + { + tangent[t.vert[j]].add(u); + bitangent[t.vert[j]].add(v); + } + } + loopi(numverts) + { + const vec &n = verts[i].norm, + &t = tangent[i], + &bt = bitangent[i]; + bumpvert &bv = bumpverts[i]; + (bv.tangent = t).sub(vec(n).mul(n.dot(t))).normalize(); + bv.bitangent = vec().cross(n, t).dot(bt) < 0 ? -1 : 1; + } + delete[] tangent; + } + + void calcbb(int frame, vec &bbmin, vec &bbmax, const matrix3x4 &m) + { + loopj(numverts) + { + vec v = m.transform(verts[j].pos); + loopi(3) + { + bbmin[i] = min(bbmin[i], v[i]); + bbmax[i] = max(bbmax[i], v[i]); + } + } + } + + void gentris(int frame, Texture *tex, vector *out, const matrix3x4 &m) + { + loopj(numtris) + { + BIH::tri &t = out[noclip ? 1 : 0].add(); + t.tex = tex->bpp==32 ? tex : NULL; + vert &av = verts[tris[j].vert[0]], + &bv = verts[tris[j].vert[1]], + &cv = verts[tris[j].vert[2]]; + t.a = m.transform(av.pos); + t.b = m.transform(bv.pos); + t.c = m.transform(cv.pos); + t.tc[0] = av.u; + t.tc[1] = av.v; + t.tc[2] = bv.u; + t.tc[3] = bv.v; + t.tc[4] = cv.u; + t.tc[5] = cv.v; + } + } + + static inline bool comparevert(vvert &w, int j, vert &v) + { + return v.u==w.u && v.v==w.v && v.pos==w.pos; + } + + static inline bool comparevert(vvertn &w, int j, vert &v) + { + return v.u==w.u && v.v==w.v && v.pos==w.pos && v.norm==w.norm; + } + + inline bool comparevert(vvertbump &w, int j, vert &v) + { + return v.u==w.u && v.v==w.v && v.pos==w.pos && v.norm==w.norm && (!bumpverts || (bumpverts[j].tangent==w.tangent && bumpverts[j].bitangent==w.bitangent)); + } + + static inline void assignvert(vvert &vv, int j, vert &v, blendcombo &c) + { + vv.pos = v.pos; + vv.u = v.u; + vv.v = v.v; + } + + static inline void assignvert(vvertn &vv, int j, vert &v, blendcombo &c) + { + vv.pos = v.pos; + vv.norm = v.norm; + vv.u = v.u; + vv.v = v.v; + } + + inline void assignvert(vvertbump &vv, int j, vert &v, blendcombo &c) + { + vv.pos = v.pos; + vv.norm = v.norm; + vv.u = v.u; + vv.v = v.v; + if(bumpverts) + { + vv.tangent = bumpverts[j].tangent; + vv.bitangent = bumpverts[j].bitangent; + } + } + + static inline void assignvert(vvertw &vv, int j, vert &v, blendcombo &c) + { + vv.pos = v.pos; + vv.norm = v.norm; + vv.u = v.u; + vv.v = v.v; + c.serialize(vv); + } + + inline void assignvert(vvertbumpw &vv, int j, vert &v, blendcombo &c) + { + vv.pos = v.pos; + vv.norm = v.norm; + vv.u = v.u; + vv.v = v.v; + if(bumpverts) + { + vv.tangent = bumpverts[j].tangent; + vv.bitangent = bumpverts[j].bitangent; + } + c.serialize(vv); + } + + template + int genvbo(vector &idxs, int offset, vector &vverts) + { + voffset = offset; + eoffset = idxs.length(); + if(!((skelmeshgroup *)group)->skel->numframes) minvert = 0xFFFF; + loopi(numtris) + { + tri &t = tris[i]; + loopj(3) + { + int index = t.vert[j]; + vert &v = verts[index]; + if(!((skelmeshgroup *)group)->skel->numframes) + { + loopvk(vverts) + { + if(comparevert(vverts[k], index, v)) { minvert = min(minvert, (ushort)k); idxs.add((ushort)k); goto found; } + } + } + idxs.add(vverts.length()); + assignvert(vverts.add(), index, v, ((skelmeshgroup *)group)->blendcombos[v.blend]); + found:; + } + } + elen = idxs.length()-eoffset; + if(((skelmeshgroup *)group)->skel->numframes) + { + minvert = voffset; + maxvert = voffset + numverts-1; + return numverts; + } + else + { + minvert = min(minvert, ushort(voffset)); + maxvert = max(minvert, ushort(vverts.length()-1)); + return vverts.length()-voffset; + } + } + + int genvbo(vector &idxs, int offset) + { + loopi(numverts) verts[i].interpindex = ((skelmeshgroup *)group)->remapblend(verts[i].blend); + + voffset = offset; + eoffset = idxs.length(); + loopi(numtris) + { + tri &t = tris[i]; + loopj(3) idxs.add(voffset+t.vert[j]); + } + minvert = voffset; + maxvert = voffset + numverts-1; + elen = idxs.length()-eoffset; + return numverts; + } + + void filltc(uchar *vdata, size_t stride) + { + vdata = (uchar *)&((vvert *)&vdata[voffset*stride])->u; + loopi(numverts) + { + ((float *)vdata)[0] = verts[i].u; + ((float *)vdata)[1] = verts[i].v; + vdata += stride; + } + } + + void fillbump(uchar *vdata, size_t stride) + { + if(stride==sizeof(vvertbumpw)) vdata = (uchar *)&((vvertbumpw *)&vdata[voffset*stride])->tangent; + else vdata = (uchar *)&((vvertbump *)&vdata[voffset*stride])->tangent; + loopi(numverts) + { + ((bumpvert *)vdata)->bitangent = bumpverts[i].bitangent; + vdata += stride; + } + } + + void interpmatverts(skelcacheentry &sc, blendcacheentry *bc, bool norms, bool tangents, void *vdata, skin &s) + { + const int blendoffset = ((skelmeshgroup *)group)->skel->numinterpbones; + const matrix3x4 *mdata1 = sc.mdata, *mdata2 = bc ? bc->mdata - blendoffset : NULL; + + #define IPLOOPMAT(type, dosetup, dotransform) \ + loopi(numverts) \ + { \ + const vert &src = verts[i]; \ + type &dst = ((type *)vdata)[i]; \ + dosetup; \ + const matrix3x4 &m = (src.interpindex < blendoffset ? mdata1 : mdata2)[src.interpindex]; \ + dst.pos = m.transform(src.pos); \ + dotransform; \ + } + + if(tangents) + { + IPLOOPMAT(vvertbump, bumpvert &bsrc = bumpverts[i], + { + dst.norm = m.transformnormal(src.norm); + dst.tangent = m.transformnormal(bsrc.tangent); + }); + } + else if(norms) { IPLOOPMAT(vvertn, , dst.norm = m.transformnormal(src.norm)); } + else { IPLOOPMAT(vvert, , ); } + + #undef IPLOOPMAT + } + + void interpverts(skelcacheentry &sc, blendcacheentry *bc, bool norms, bool tangents, void *vdata, skin &s) + { + const int blendoffset = ((skelmeshgroup *)group)->skel->numinterpbones; + const dualquat * const bdata1 = sc.bdata, * const bdata2 = bc ? bc->bdata - blendoffset : NULL; + + #define IPLOOP(type, dosetup, dotransform) \ + loopi(numverts) \ + { \ + const vert &src = verts[i]; \ + type &dst = ((type *)vdata)[i]; \ + dosetup; \ + const dualquat &d = (src.interpindex < blendoffset ? bdata1 : bdata2)[src.interpindex]; \ + dst.pos = d.transform(src.pos); \ + dotransform; \ + } + + if(tangents) + { + IPLOOP(vvertbump, bumpvert &bsrc = bumpverts[i], + { + dst.norm = d.real.rotate(src.norm); + dst.tangent = d.real.rotate(bsrc.tangent); + }); + } + else if(norms) { IPLOOP(vvertn, , dst.norm = d.real.rotate(src.norm)); } + else { IPLOOP(vvert, , ); } + + #undef IPLOOP + } + + void setshader(Shader *s) + { + skelmeshgroup *g = (skelmeshgroup *)group; + if(glaring) + { + if(!g->skel->usegpuskel) s->variant(0, 2)->set(); + else if(g->skel->usematskel) s->variant(min(maxweights, g->vweights), 2)->set(); + else s->variant(maxweights-1, 3)->set(); + } + else if(!g->skel->usegpuskel) s->set(); + else if(g->skel->usematskel) s->variant(min(maxweights, g->vweights)-1, 0)->set(); + else s->variant(maxweights-1, 1)->set(); + } + + void render(const animstate *as, skin &s, vbocacheentry &vc) + { + s.bind(this, as); + + if(!(as->anim&ANIM_NOSKIN)) + { + if(s.multitextured()) + { + if(!enablemtc || lastmtcbuf!=lastvbuf) + { + glClientActiveTexture_(GL_TEXTURE1_ARB); + if(!enablemtc) glEnableClientState(GL_TEXTURE_COORD_ARRAY); + if(lastmtcbuf!=lastvbuf) + { + vvert *vverts = hasVBO ? 0 : (vvert *)vc.vdata; + glTexCoordPointer(2, GL_FLOAT, ((skelmeshgroup *)group)->vertsize, &vverts->u); + } + glClientActiveTexture_(GL_TEXTURE0_ARB); + lastmtcbuf = lastvbuf; + enablemtc = true; + } + } + else if(enablemtc) disablemtc(); + + if(s.tangents()) + { + if(!enabletangents || lastnbuf!=lastvbuf) + { + if(!enabletangents) glEnableVertexAttribArray_(1); + if(lastnbuf!=lastvbuf) + { + if(((skelmeshgroup *)group)->vertsize==sizeof(vvertbumpw)) + { + vvertbumpw *vverts = hasVBO ? 0 : (vvertbumpw *)vc.vdata; + glVertexAttribPointer_(1, 4, GL_FLOAT, GL_FALSE, ((skelmeshgroup *)group)->vertsize, &vverts->tangent.x); + } + else + { + vvertbump *vverts = hasVBO ? 0 : (vvertbump *)vc.vdata; + glVertexAttribPointer_(1, 4, GL_FLOAT, GL_FALSE, ((skelmeshgroup *)group)->vertsize, &vverts->tangent.x); + } + } + lastnbuf = lastvbuf; + enabletangents = true; + } + } + else if(enabletangents) disabletangents(); + + if(renderpath==R_FIXEDFUNCTION && (s.scrollu || s.scrollv)) + { + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glTranslatef(s.scrollu*lastmillis/1000.0f, s.scrollv*lastmillis/1000.0f, 0); + + if(s.multitextured()) + { + glActiveTexture_(GL_TEXTURE1_ARB); + glPushMatrix(); + glTranslatef(s.scrollu*lastmillis/1000.0f, s.scrollv*lastmillis/1000.0f, 0); + } + } + } + + if(hasDRE) glDrawRangeElements_(GL_TRIANGLES, minvert, maxvert, elen, GL_UNSIGNED_SHORT, &((skelmeshgroup *)group)->edata[eoffset]); + else glDrawElements(GL_TRIANGLES, elen, GL_UNSIGNED_SHORT, &((skelmeshgroup *)group)->edata[eoffset]); + glde++; + xtravertsva += numverts; + + if(renderpath==R_FIXEDFUNCTION && !(as->anim&ANIM_NOSKIN) && (s.scrollu || s.scrollv)) + { + if(s.multitextured()) + { + glPopMatrix(); + glActiveTexture_(GL_TEXTURE0_ARB); + } + + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + } + + return; + } + }; + + + struct tag + { + char *name; + int bone; + + tag() : name(NULL) {} + ~tag() { DELETEA(name); } + }; + + struct skelanimspec + { + char *name; + int frame, range; + + skelanimspec() : name(NULL), frame(0), range(0) {} + ~skelanimspec() + { + DELETEA(name); + } + }; + + struct boneinfo + { + const char *name; + int parent, children, next, interpindex, interpparent, interpgroup; + float pitchscale, pitchoffset, pitchmin, pitchmax; + dualquat base; + + boneinfo() : name(NULL), parent(-1), children(-1), next(-1), interpindex(-1), interpparent(-1), interpgroup(0), pitchscale(0), pitchoffset(0), pitchmin(0), pitchmax(0) {} + ~boneinfo() + { + DELETEA(name); + } + }; + + struct skeleton + { + char *name; + int shared; + vector users; + boneinfo *bones; + int numbones, numinterpbones, numgpubones, numframes, optimizedframes; + dualquat *invbones, *framebones; + matrix3x4 *matinvbones, *matframebones; + vector skelanims; + vector tags; + + bool usegpuskel, usematskel; + vector skelcache; + + skeleton() : name(NULL), shared(0), bones(NULL), numbones(0), numinterpbones(0), numgpubones(0), numframes(0), optimizedframes(0), invbones(NULL), framebones(NULL), matinvbones(NULL), matframebones(NULL), usegpuskel(false), usematskel(false) + { + } + + ~skeleton() + { + DELETEA(name); + DELETEA(bones); + DELETEA(invbones); + DELETEA(framebones); + DELETEA(matinvbones); + DELETEA(matframebones); + loopv(skelcache) + { + DELETEA(skelcache[i].bdata); + DELETEA(skelcache[i].mdata); + } + } + + + skelanimspec *findskelanim(const char *name) + { + loopv(skelanims) + { + if(skelanims[i].name && !strcmp(name, skelanims[i].name)) + return &skelanims[i]; + } + return NULL; + } + + skelanimspec &addskelanim(const char *name) + { + skelanimspec &sa = skelanims.add(); + sa.name = name ? newstring(name) : NULL; + return sa; + } + + int findbone(const char *name) + { + loopi(numbones) if(bones[i].name && !strcmp(bones[i].name, name)) return i; + return -1; + } + + int findtag(const char *name) + { + loopv(tags) if(!strcmp(tags[i].name, name)) return i; + return -1; + } + + bool addtag(const char *name, int bone) + { + if(findtag(name) >= 0) return false; + tag &t = tags.add(); + t.name = newstring(name); + t.bone = bone; + return true; + } + + skeleton *copy() + { + skeleton &s = *new skeleton; + s.numbones = numbones; + s.numinterpbones = numinterpbones; + s.numgpubones = numgpubones; + s.numframes = numframes; + s.optimizedframes = optimizedframes; + s.bones = new boneinfo[numbones]; + memcpy(s.bones, bones, numbones*sizeof(boneinfo)); + loopi(numbones) if(bones[i].name) s.bones[i].name = newstring(bones[i].name); + if(numframes) + { + s.framebones = new dualquat[numframes*numbones]; + memcpy(s.framebones, framebones, numframes*numbones*sizeof(dualquat)); + } + loopv(skelanims) + { + skelanimspec &sa = s.addskelanim(skelanims[i].name); + sa.frame = skelanims[i].frame; + sa.range = skelanims[i].range; + } + loopv(tags) + { + tag &t = s.tags.add(); + t.name = newstring(tags[i].name); + t.bone = tags[i].bone; + } + return &s; + } + + void remapbones() + { + loopi(numbones) + { + boneinfo &info = bones[i]; + info.interpindex = -1; + info.interpgroup = i; + } + numgpubones = 0; + loopv(users) + { + skelmeshgroup *group = users[i]; + loopvj(group->blendcombos) + { + blendcombo &c = group->blendcombos[j]; + int group = c.bones[0]; + for(int k = 1; k < 4; k++) if(c.weights[k]) group = min(group, int(c.bones[k])); + loopk(4) if(c.weights[k]) + { + boneinfo &info = bones[c.bones[k]]; + if(info.interpindex<0) info.interpindex = numgpubones++; + c.interpbones[k] = info.interpindex; + info.interpgroup = min(info.interpgroup, group); + } + } + } + loopi(numbones) + { + int group = bones[i].interpgroup; + bones[i].interpgroup = group < i ? bones[group].interpindex : -1; + } + numinterpbones = numgpubones; + loopi(numbones) + { + boneinfo &info = bones[i]; + if(!info.pitchscale) continue; + if(info.interpindex < 0) info.interpindex = numinterpbones++; + if(info.parent >= 0 && bones[info.parent].interpindex < 0) bones[info.parent].interpindex = numinterpbones++; + } + loopv(tags) + { + boneinfo &info = bones[tags[i].bone]; + if(info.interpindex < 0) info.interpindex = numinterpbones++; + } + } + + void compactbones() + { + loopi(numbones) + { + boneinfo &info = bones[i]; + if(info.interpindex < 0) continue; + int parent = info.parent; + while(parent >= 0 && bones[parent].interpindex < 0) parent = bones[parent].parent; + info.interpparent = parent >= 0 ? bones[parent].interpindex : -1; + } + } + + void optimizeframes() + { + while(optimizedframes < numframes) + { + dualquat *frame = &framebones[optimizedframes*numbones]; + loopi(numbones) + { + boneinfo &info = bones[i]; + if(info.interpindex < 0 || info.parent < 0 || bones[info.parent].interpindex >= 0) + { + frame[i].fixantipodal(framebones[i]); + continue; + } + dualquat d = frame[i]; + int parent = info.parent; + while(parent >= 0 && bones[parent].interpindex < 0) + { + d.mul(frame[parent], dualquat(d)); + parent = bones[parent].parent; + } + d.normalize(); + d.fixantipodal(framebones[i]); + frame[i] = d; + } + optimizedframes++; + } + } + + void optimize() + { + cleanup(); + remapbones(); + compactbones(); + optimizeframes(); + } + + void expandbonemask(uchar *expansion, int bone, int val) + { + expansion[bone] = val; + bone = bones[bone].children; + while(bone>=0) { expandbonemask(expansion, bone, val); bone = bones[bone].next; } + } + + void applybonemask(ushort *mask, uchar *partmask, int partindex) + { + if(!mask || *mask==BONEMASK_END) return; + uchar *expansion = new uchar[numbones]; + memset(expansion, *mask&BONEMASK_NOT ? 1 : 0, numbones); + while(*mask!=BONEMASK_END) + { + expandbonemask(expansion, *mask&BONEMASK_BONE, *mask&BONEMASK_NOT ? 0 : 1); + mask++; + } + loopi(numbones) if(expansion[i]) partmask[i] = partindex; + delete[] expansion; + } + + void linkchildren() + { + loopi(numbones) + { + boneinfo &b = bones[i]; + b.children = -1; + if(b.parent<0) b.next = -1; + else + { + b.next = bones[b.parent].children; + bones[b.parent].children = i; + } + } + } + + int availgpubones() const { return (min(maxvpenvparams - reservevpparams, 256) - 10) / (matskel ? 3 : 2); } + bool gpuaccelerate() const { return renderpath!=R_FIXEDFUNCTION && numframes && gpuskel && numgpubones<=availgpubones(); } + + void scaletags(const vec &transdiff, float scalediff) + { + DELETEA(invbones); + DELETEA(matinvbones); + DELETEA(matframebones); + if(shared > 1) return; + loopi(numbones) + { + if(bones[i].parent < 0) bones[i].base.translate(transdiff); + bones[i].base.scale(scalediff); + } + loopi(numframes) + { + dualquat *frame = &framebones[i*numbones]; + loopj(numbones) if(bones[j].interpindex >= 0) + { + if(bones[j].interpparent < 0) frame[j].translate(transdiff); + frame[j].scale(scalediff); + } + } + } + + void geninvbones() + { + if(invbones) return; + invbones = new dualquat[numinterpbones]; + loopi(numbones) + { + boneinfo &info = bones[i]; + if(info.interpindex < 0) continue; + invbones[info.interpindex] = dualquat(info.base).invert(); + } + } + + void interpmatbones(const animstate *as, float pitch, const vec &axis, int numanimparts, uchar *partmask, skelcacheentry &sc) + { + if(!invbones) geninvbones(); + if(!matframebones) + { + matframebones = new matrix3x4[numframes*numbones]; + loopi(numframes*numbones) matframebones[i] = framebones[i]; + } + if(!matinvbones) + { + matinvbones = new matrix3x4[numinterpbones]; + loopi(numinterpbones) matinvbones[i] = invbones[i]; + } + if(!sc.mdata) sc.mdata = new matrix3x4[numinterpbones]; + struct framedata + { + matrix3x4 *fr1, *fr2, *pfr1, *pfr2; + } partframes[MAXANIMPARTS]; + loopi(numanimparts) + { + partframes[i].fr1 = &matframebones[as[i].cur.fr1*numbones]; + partframes[i].fr2 = &matframebones[as[i].cur.fr2*numbones]; + if(as[i].interp<1) + { + partframes[i].pfr1 = &matframebones[as[i].prev.fr1*numbones]; + partframes[i].pfr2 = &matframebones[as[i].prev.fr2*numbones]; + } + } + loopi(numbones) if(bones[i].interpindex>=0) + { + const animstate &s = as[partmask[i]]; + const framedata &f = partframes[partmask[i]]; + matrix3x4 m; + (m = f.fr1[i]).scale((1-s.cur.t)*s.interp); + m.accumulate(f.fr2[i], s.cur.t*s.interp); + if(s.interp<1) + { + m.accumulate(f.pfr1[i], (1-s.prev.t)*(1-s.interp)); + m.accumulate(f.pfr2[i], s.prev.t*(1-s.interp)); + } + const boneinfo &b = bones[i]; + if(b.pitchscale) + { + float angle = b.pitchscale*pitch + b.pitchoffset; + if(b.pitchmin || b.pitchmax) angle = max(b.pitchmin, min(b.pitchmax, angle)); + matrix3x4 rmat; + rmat.rotate(angle*RAD, b.interpparent>=0 ? sc.mdata[b.interpparent].transposedtransformnormal(axis) : axis); + m.mul(rmat, matrix3x4(m)); + } + if(b.interpparent<0) sc.mdata[b.interpindex] = m; + else sc.mdata[b.interpindex].mul(sc.mdata[b.interpparent], m); + } + loopi(numinterpbones) + { + sc.mdata[i].normalize(); + sc.mdata[i].mul(matinvbones[i]); + } + } + + void interpbones(const animstate *as, float pitch, const vec &axis, int numanimparts, uchar *partmask, skelcacheentry &sc) + { + if(!invbones) geninvbones(); + if(!sc.bdata) sc.bdata = new dualquat[numinterpbones]; + struct framedata + { + dualquat *fr1, *fr2, *pfr1, *pfr2; + } partframes[MAXANIMPARTS]; + loopi(numanimparts) + { + partframes[i].fr1 = &framebones[as[i].cur.fr1*numbones]; + partframes[i].fr2 = &framebones[as[i].cur.fr2*numbones]; + if(as[i].interp<1) + { + partframes[i].pfr1 = &framebones[as[i].prev.fr1*numbones]; + partframes[i].pfr2 = &framebones[as[i].prev.fr2*numbones]; + } + } + loopi(numbones) if(bones[i].interpindex>=0) + { + const animstate &s = as[partmask[i]]; + const framedata &f = partframes[partmask[i]]; + dualquat d; + (d = f.fr1[i]).mul((1-s.cur.t)*s.interp); + d.accumulate(f.fr2[i], s.cur.t*s.interp); + if(s.interp<1) + { + d.accumulate(f.pfr1[i], (1-s.prev.t)*(1-s.interp)); + d.accumulate(f.pfr2[i], s.prev.t*(1-s.interp)); + } + const boneinfo &b = bones[i]; + if(b.pitchscale) + { + float angle = b.pitchscale*pitch + b.pitchoffset; + if(b.pitchmin || b.pitchmax) angle = max(b.pitchmin, min(b.pitchmax, angle)); + vec raxis = b.interpparent>=0 ? quat(sc.bdata[b.interpparent].real).invert().rotate(axis) : axis; + d.mul(dualquat(quat(raxis, angle*RAD)), dualquat(d)); + } + if(b.interpparent<0) sc.bdata[b.interpindex] = d; + else sc.bdata[b.interpindex].mul(sc.bdata[b.interpparent], d); + } + loopi(numinterpbones) + { + dualquat &d = sc.bdata[i]; + d.normalize(); + d.mul(invbones[i]); + } + loopi(numbones) + { + const boneinfo &b = bones[i]; + if(b.interpgroup>=0) sc.bdata[b.interpindex].fixantipodal(sc.bdata[b.interpgroup]); + } + } + + void concattagtransform(int frame, int i, const matrix3x4 &m, matrix3x4 &n) + { + matrix3x4 t = bones[tags[i].bone].base; + n.mul(m, t); + } + + void calctagmatrix(int bone, const matrix3x4 &m, linkedpart &l) + { + matrix3x4 t; + if(numframes) t.mul(m, bones[bone].base); + else t = m; + loopk(4) + { + l.matrix[4*k] = t.X[k]; + l.matrix[4*k+1] = t.Y[k]; + l.matrix[4*k+2] = t.Z[k]; + } + l.matrix[3] = l.matrix[7] = l.matrix[11] = 0.0f; + l.matrix[15] = 1.0f; + } + + void calctags(skelcacheentry &sc, part *p) + { + loopv(p->links) + { + int tagbone = tags[p->links[i].tag].bone, interpindex = bones[tagbone].interpindex; + calctagmatrix(tagbone, usematskel ? sc.mdata[interpindex] : sc.bdata[interpindex], p->links[i]); + } + } + + void calctags(part *p) + { + loopv(p->links) + { + int tagbone = tags[p->links[i].tag].bone; + calctagmatrix(tagbone, bones[tagbone].base, p->links[i]); + } + } + + void cleanup() + { + loopv(skelcache) + { + skelcacheentry &sc = skelcache[i]; + loopj(MAXANIMPARTS) sc.as[j].cur.fr1 = -1; + DELETEA(sc.bdata); + DELETEA(sc.mdata); + } + skelcache.setsizenodelete(0); + lastsdata = lastbdata = NULL; + loopv(users) users[i]->cleanup(); + } + + skelcacheentry &checkskelcache(const animstate *as, float pitch, const vec &axis) + { + if(skelcache.empty()) + { + usegpuskel = gpuaccelerate(); + usematskel = matskel!=0; + } + + int numanimparts = ((skelpart *)as->owner)->numanimparts; + uchar *partmask = ((skelpart *)as->owner)->partmask; + skelcacheentry *sc = NULL; + bool match = false; + loopv(skelcache) + { + skelcacheentry &c = skelcache[i]; + loopj(numanimparts) if(c.as[j]!=as[j]) goto mismatch; + if(c.pitch != pitch || c.partmask != partmask) goto mismatch; + match = true; + sc = &c; + break; + mismatch: + if(c.millis < lastmillis) { sc = &c; break; } + } + if(!sc) sc = &skelcache.add(); + if(!match) + { + loopi(numanimparts) sc->as[i] = as[i]; + sc->pitch = pitch; + sc->partmask = partmask; + if(matskel) interpmatbones(as, pitch, axis, numanimparts, partmask, *sc); + else interpbones(as, pitch, axis, numanimparts, partmask, *sc); + } + sc->millis = lastmillis; + return *sc; + } + + void setgpubones(skelcacheentry &sc, int count = 0) + { + if((count ? lastbdata : lastsdata) == (usematskel ? (void *)sc.mdata : (void *)sc.bdata)) return; + int offset = count ? numgpubones : 0; + if(!offset) count = numgpubones; + if(hasPP) + { + if(usematskel) glProgramEnvParameters4fv_(GL_VERTEX_PROGRAM_ARB, 10 + 3*offset, 3*count, sc.mdata[0].X.v); + else glProgramEnvParameters4fv_(GL_VERTEX_PROGRAM_ARB, 10 + 2*offset, 2*count, sc.bdata[0].real.v); + } + else if(usematskel) loopi(count) + { + glProgramEnvParameter4fv_(GL_VERTEX_PROGRAM_ARB, 10 + 3*(offset+i), sc.mdata[i].X.v); + glProgramEnvParameter4fv_(GL_VERTEX_PROGRAM_ARB, 11 + 3*(offset+i), sc.mdata[i].Y.v); + glProgramEnvParameter4fv_(GL_VERTEX_PROGRAM_ARB, 12 + 3*(offset+i), sc.mdata[i].Z.v); + } + else loopi(count) + { + glProgramEnvParameter4fv_(GL_VERTEX_PROGRAM_ARB, 10 + 2*(offset+i), sc.bdata[i].real.v); + glProgramEnvParameter4fv_(GL_VERTEX_PROGRAM_ARB, 11 + 2*(offset+i), sc.bdata[i].dual.v); + } + if(offset) lastbdata = usematskel ? (void *)sc.mdata : (void *)sc.bdata; + else lastsdata = usematskel ? (void *)sc.mdata : (void *)sc.bdata; + } + + bool shouldcleanup() const + { + return numframes && (skelcache.empty() || gpuaccelerate()!=usegpuskel || (matskel!=0)!=usematskel); + } + }; + + struct skelmeshgroup : meshgroup + { + skeleton *skel; + + vector blendcombos; + int numblends[4]; + + static const int MAXBLENDCACHE = 16; + blendcacheentry blendcache[MAXBLENDCACHE]; + + static const int MAXVBOCACHE = 16; + vbocacheentry vbocache[MAXVBOCACHE]; + + ushort *edata; + GLuint ebuf; + bool vnorms, vtangents; + int vlen, vertsize, vblends, vweights; + uchar *vdata; + + skelmeshgroup() : skel(NULL), edata(NULL), ebuf(0), vdata(NULL) + { + memset(numblends, 0, sizeof(numblends)); + } + + virtual ~skelmeshgroup() + { + if(skel) + { + if(skel->shared) skel->users.removeobj(this); + else DELETEP(skel); + } + if(ebuf) glDeleteBuffers_(1, &ebuf); + loopi(MAXBLENDCACHE) + { + DELETEA(blendcache[i].bdata); + DELETEA(blendcache[i].mdata); + } + loopi(MAXVBOCACHE) + { + DELETEA(vbocache[i].vdata); + if(vbocache[i].vbuf) glDeleteBuffers_(1, &vbocache[i].vbuf); + } + DELETEA(vdata); + } + + void shareskeleton(char *name) + { + if(!name) + { + skel = new skeleton; + skel->users.add(this); + return; + } + + static hashtable skeletons; + if(skeletons.access(name)) skel = skeletons[name]; + else + { + skel = new skeleton; + skel->name = newstring(name); + skeletons[skel->name] = skel; + } + skel->users.add(this); + skel->shared++; + } + + int findtag(const char *name) + { + return skel->findtag(name); + } + + virtual meshgroup *allocate() { return new skelmeshgroup; } + + meshgroup *copy() + { + skelmeshgroup &group = *(skelmeshgroup *)meshgroup::copy(); + group.skel = skel->shared ? skel : skel->copy(); + group.skel->users.add(&group); + if(skel->shared) skel->shared++; + loopv(blendcombos) group.blendcombos.add(blendcombos[i]); + memcpy(group.numblends, numblends, sizeof(numblends)); + return &group; + } + + int totalframes() const { return max(skel->numframes, 1); } + + void scaletags(const vec &transdiff, float scalediff) + { + skel->scaletags(transdiff, scalediff); + } + + void genvbo(bool norms, bool tangents, vbocacheentry &vc) + { + if(hasVBO) + { + if(!vc.vbuf) glGenBuffers_(1, &vc.vbuf); + if(ebuf) return; + } + else if(edata) + { + #define ALLOCVDATA(vdata) \ + do \ + { \ + DELETEA(vdata); \ + vdata = new uchar[vlen*vertsize]; \ + loopv(meshes) \ + { \ + skelmesh &m = *(skelmesh *)meshes[i]; \ + m.filltc(vdata, vertsize); \ + if(tangents) m.fillbump(vdata, vertsize); \ + } \ + } while(0) + if(!vc.vdata) ALLOCVDATA(vc.vdata); + return; + } + + vector idxs; + + vnorms = norms; + vtangents = tangents; + vlen = 0; + vblends = 0; + if(skel->numframes && !skel->usegpuskel) + { + vweights = 1; + loopv(blendcombos) + { + blendcombo &c = blendcombos[i]; + c.interpindex = c.weights[1] ? skel->numinterpbones + vblends++ : -1; + } + + vertsize = tangents ? sizeof(vvertbump) : (norms ? sizeof(vvertn) : sizeof(vvert)); + loopv(meshes) vlen += ((skelmesh *)meshes[i])->genvbo(idxs, vlen); + DELETEA(vdata); + if(hasVBO) ALLOCVDATA(vdata); + else ALLOCVDATA(vc.vdata); + } + else + { + if(skel->numframes) + { + vweights = 4; + int availbones = skel->availgpubones() - skel->numgpubones; + while(vweights > 1 && availbones >= numblends[vweights-1]) availbones -= numblends[--vweights]; + loopv(blendcombos) + { + blendcombo &c = blendcombos[i]; + c.interpindex = c.size() > vweights ? skel->numgpubones + vblends++ : -1; + } + } + else + { + vweights = 0; + loopv(blendcombos) blendcombos[i].interpindex = -1; + } + + if(hasVBO) glBindBuffer_(GL_ARRAY_BUFFER_ARB, vc.vbuf); + #define GENVBO(type) \ + do \ + { \ + vertsize = sizeof(type); \ + vector vverts; \ + loopv(meshes) vlen += ((skelmesh *)meshes[i])->genvbo(idxs, vlen, vverts); \ + if(hasVBO) glBufferData_(GL_ARRAY_BUFFER_ARB, vverts.length()*sizeof(type), vverts.getbuf(), GL_STATIC_DRAW_ARB); \ + else \ + { \ + DELETEA(vc.vdata); \ + vc.vdata = new uchar[vverts.length()*sizeof(type)]; \ + memcpy(vc.vdata, vverts.getbuf(), vverts.length()*sizeof(type)); \ + } \ + } while(0) + if(skel->numframes) + { + if(tangents) GENVBO(vvertbumpw); + else GENVBO(vvertw); + } + else if(tangents) GENVBO(vvertbump); + else if(norms) GENVBO(vvertn); + else GENVBO(vvert); + } + + if(hasVBO) + { + glGenBuffers_(1, &ebuf); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, ebuf); + glBufferData_(GL_ELEMENT_ARRAY_BUFFER_ARB, idxs.length()*sizeof(ushort), idxs.getbuf(), GL_STATIC_DRAW_ARB); + } + else + { + edata = new ushort[idxs.length()]; + memcpy(edata, idxs.getbuf(), idxs.length()*sizeof(ushort)); + } + #undef GENVBO + #undef ALLOCVDATA + } + + void bindvbo(const animstate *as, vbocacheentry &vc, skelcacheentry *sc = NULL, blendcacheentry *bc = NULL) + { + vvertn *vverts = hasVBO ? 0 : (vvertn *)vc.vdata; + if(hasVBO && lastebuf!=ebuf) + { + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, ebuf); + lastebuf = ebuf; + } + if(lastvbuf != (hasVBO ? (void *)(size_t)vc.vbuf : vc.vdata)) + { + if(hasVBO) glBindBuffer_(GL_ARRAY_BUFFER_ARB, vc.vbuf); + if(!lastvbuf) glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, vertsize, &vverts->pos); + lastvbuf = hasVBO ? (void *)(size_t)vc.vbuf : vc.vdata; + } + if(as->anim&ANIM_NOSKIN) + { + if(enabletc) disabletc(); + } + else if(!enabletc || lasttcbuf!=lastvbuf) + { + if(vnorms || vtangents) + { + if(!enabletc) glEnableClientState(GL_NORMAL_ARRAY); + if(lasttcbuf!=lastvbuf) glNormalPointer(GL_FLOAT, vertsize, &vverts->norm); + } + if(!enabletc) glEnableClientState(GL_TEXTURE_COORD_ARRAY); + if(lasttcbuf!=lastvbuf) glTexCoordPointer(2, GL_FLOAT, vertsize, &vverts->u); + lasttcbuf = lastvbuf; + enabletc = true; + } + if(!sc || !skel->usegpuskel) return; + if(!enablebones) + { + glEnableVertexAttribArray_(6); + glEnableVertexAttribArray_(7); + enablebones = true; + } + if(lastbbuf!=lastvbuf) + { + glVertexAttribPointer_(6, 4, GL_UNSIGNED_BYTE, GL_TRUE, vertsize, &((vvertw *)vverts)->weights); + glVertexAttribPointer_(7, 4, GL_UNSIGNED_BYTE, GL_FALSE, vertsize, &((vvertw *)vverts)->bones); + lastbbuf = lastvbuf; + } + skel->setgpubones(*sc); + if(bc && vblends) skel->setgpubones(*bc, vblends); + } + + void concattagtransform(int frame, int i, const matrix3x4 &m, matrix3x4 &n) + { + skel->concattagtransform(frame, i, m, n); + } + + int addblendcombo(const blendcombo &c) + { + loopv(blendcombos) if(blendcombos[i]==c) + { + blendcombos[i].uses += c.uses; + return i; + } + numblends[c.size()-1]++; + blendcombo &a = blendcombos.add(c); + return a.interpindex = blendcombos.length()-1; + } + + void sortblendcombos() + { + blendcombos.sort(blendcombo::sortcmp); + int *remap = new int[blendcombos.length()]; + loopv(blendcombos) remap[blendcombos[i].interpindex] = i; + loopv(meshes) + { + skelmesh *m = (skelmesh *)meshes[i]; + loopj(m->numverts) + { + vert &v = m->verts[j]; + v.blend = remap[v.blend]; + } + } + delete[] remap; + } + + int remapblend(int blend) + { + const blendcombo &c = blendcombos[blend]; + return c.weights[1] ? c.interpindex : c.interpbones[0]; + } + + void blendmatbones(const skelcacheentry &sc, blendcacheentry &bc) + { + if(!bc.mdata) bc.mdata = new matrix3x4[vblends]; + matrix3x4 *dst = bc.mdata - (skel->usegpuskel ? skel->numgpubones : skel->numinterpbones); + loopv(blendcombos) + { + const blendcombo &c = blendcombos[i]; + if(c.interpindex<0) break; + matrix3x4 &m = dst[c.interpindex]; + m = sc.mdata[c.interpbones[0]]; + m.scale(c.weights[0]); + m.accumulate(sc.mdata[c.interpbones[1]], c.weights[1]); + if(c.weights[2]) + { + m.accumulate(sc.mdata[c.interpbones[2]], c.weights[2]); + if(c.weights[3]) m.accumulate(sc.mdata[c.interpbones[3]], c.weights[3]); + } + } + } + + void blendbones(const skelcacheentry &sc, blendcacheentry &bc) + { + if(!bc.bdata) bc.bdata = new dualquat[vblends]; + dualquat *dst = bc.bdata - (skel->usegpuskel ? skel->numgpubones : skel->numinterpbones); + bool normalize = !skel->usegpuskel || vweights<=1; + loopv(blendcombos) + { + const blendcombo &c = blendcombos[i]; + if(c.interpindex<0) break; + dualquat &d = dst[c.interpindex]; + d = sc.bdata[c.interpbones[0]]; + d.mul(c.weights[0]); + d.accumulate(sc.bdata[c.interpbones[1]], c.weights[1]); + if(c.weights[2]) + { + d.accumulate(sc.bdata[c.interpbones[2]], c.weights[2]); + if(c.weights[3]) d.accumulate(sc.bdata[c.interpbones[3]], c.weights[3]); + } + if(normalize) d.normalize(); + } + } + + void cleanup() + { + loopi(MAXBLENDCACHE) + { + blendcacheentry &c = blendcache[i]; + DELETEA(c.bdata); + DELETEA(c.mdata); + c.owner = -1; + } + loopi(MAXVBOCACHE) + { + vbocacheentry &c = vbocache[i]; + if(c.vbuf) { glDeleteBuffers_(1, &c.vbuf); c.vbuf = 0; } + DELETEA(c.vdata); + c.owner = -1; + } + if(hasVBO) { if(ebuf) { glDeleteBuffers_(1, &ebuf); ebuf = 0; } } + else DELETEA(vdata); + lastvbuf = lasttcbuf = lastmtcbuf = lastnbuf = lastbbuf = lastbdata = NULL; + lastebuf = 0; + } + + #define SEARCHCACHE(cachesize, cacheentry, cache, reusecheck) \ + loopi(cachesize) \ + { \ + cacheentry &c = cache[i]; \ + if(c.owner==owner) \ + { \ + if(c==sc) return c; \ + else c.owner = -1; \ + break; \ + } \ + } \ + loopi(cachesize-1) \ + { \ + cacheentry &c = cache[i]; \ + if(reusecheck c.owner < 0 || c.millis < lastmillis) \ + return c; \ + } \ + return cache[cachesize-1]; + + vbocacheentry &checkvbocache(skelcacheentry &sc, int owner) + { + SEARCHCACHE(MAXVBOCACHE, vbocacheentry, vbocache, (hasVBO ? !c.vbuf : !c.vdata) || ); + } + + blendcacheentry &checkblendcache(skelcacheentry &sc, int owner) + { + SEARCHCACHE(MAXBLENDCACHE, blendcacheentry, blendcache, ) + } + + void render(const animstate *as, float pitch, const vec &axis, part *p) + { + bool norms = false, tangents = false; + loopv(p->skins) + { + if(p->skins[i].normals()) norms = true; + if(p->skins[i].tangents()) tangents = true; + } + if(skel->shouldcleanup()) skel->cleanup(); + else if(norms!=vnorms || tangents!=vtangents) cleanup(); + + if(!skel->numframes) + { + if(hasVBO ? !vbocache->vbuf : !vbocache->vdata) genvbo(norms, tangents, *vbocache); + bindvbo(as, *vbocache); + loopv(meshes) ((skelmesh *)meshes[i])->render(as, p->skins[i], *vbocache); + skel->calctags(p); + return; + } + + skelcacheentry &sc = skel->checkskelcache(as, pitch, axis); + int owner = &sc-&skel->skelcache[0]; + vbocacheentry &vc = skel->usegpuskel ? *vbocache : checkvbocache(sc, owner); + vc.millis = lastmillis; + if(hasVBO ? !vc.vbuf : !vc.vdata) genvbo(norms, tangents, vc); + blendcacheentry *bc = NULL; + if(vblends) + { + bc = &checkblendcache(sc, owner); + bc->millis = lastmillis; + if(bc->owner!=owner) + { + bc->owner = owner; + *(animcacheentry *)bc = sc; + if(skel->usematskel) blendmatbones(sc, *bc); + else blendbones(sc, *bc); + } + } + if(!skel->usegpuskel && vc.owner!=owner) + { + vc.owner = owner; + (animcacheentry &)vc = sc; + loopv(meshes) + { + skelmesh &m = *(skelmesh *)meshes[i]; + if(skel->usematskel) m.interpmatverts(sc, bc, norms, tangents, (hasVBO ? vdata : vc.vdata) + m.voffset*vertsize, p->skins[i]); + else m.interpverts(sc, bc, norms, tangents, (hasVBO ? vdata : vc.vdata) + m.voffset*vertsize, p->skins[i]); + } + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, vc.vbuf); + glBufferData_(GL_ARRAY_BUFFER_ARB, vlen*vertsize, vdata, GL_STREAM_DRAW_ARB); + } + } + + bindvbo(as, vc, &sc, bc); + loopv(meshes) ((skelmesh *)meshes[i])->render(as, p->skins[i], vc); + + skel->calctags(sc, p); + } + }; + + struct animpartmask + { + animpartmask *next; + int numbones; + uchar bones[1]; + }; + + struct skelpart : part + { + static animpartmask *buildingpartmask; + + uchar *partmask; + + skelpart() : partmask(NULL) + { + } + + virtual ~skelpart() + { + DELETEA(buildingpartmask); + } + + uchar *sharepartmask(animpartmask *o) + { + static animpartmask *partmasks = NULL; + animpartmask *p = partmasks; + for(; p; p = p->next) if(p->numbones==o->numbones && !memcmp(p->bones, o->bones, p->numbones)) + { + delete[] (uchar *)o; + return p->bones; + } + + o->next = p; + partmasks = o; + return o->bones; + } + + animpartmask *newpartmask() + { + animpartmask *p = (animpartmask *)new uchar[sizeof(animpartmask) + ((skelmeshgroup *)meshes)->skel->numbones-1]; + p->numbones = ((skelmeshgroup *)meshes)->skel->numbones; + memset(p->bones, 0, p->numbones); + return p; + } + + void initanimparts() + { + DELETEA(buildingpartmask); + buildingpartmask = newpartmask(); + } + + bool addanimpart(ushort *bonemask) + { + if(!buildingpartmask || numanimparts>=MAXANIMPARTS) return false; + ((skelmeshgroup *)meshes)->skel->applybonemask(bonemask, buildingpartmask->bones, numanimparts); + numanimparts++; + return true; + } + + void endanimparts() + { + if(buildingpartmask) + { + partmask = sharepartmask(buildingpartmask); + buildingpartmask = NULL; + } + + ((skelmeshgroup *)meshes)->skel->optimize(); + } + }; + + skelmodel(const char *name) : animmodel(name) + { + } + + int linktype(animmodel *m) const + { + return type()==m->type() && + ((skelmeshgroup *)parts[0]->meshes)->skel == ((skelmeshgroup *)m->parts[0]->meshes)->skel ? + LINK_REUSE : + LINK_TAG; + } +}; + +skelmodel::animpartmask *skelmodel::skelpart::buildingpartmask = NULL; + diff --git a/src/engine/sound.cpp b/src/engine/sound.cpp new file mode 100644 index 0000000..a7a3a62 --- /dev/null +++ b/src/engine/sound.cpp @@ -0,0 +1,453 @@ +// sound.cpp: basic positional sound using sdl_mixer + +#include "pch.h" +#include "engine.h" + +#include "SDL_mixer.h" +#define MAXVOL MIX_MAX_VOLUME +Mix_Music *mod = NULL; + +bool nosound = true; + +struct sample +{ + char *name; + Mix_Chunk *sound; + + sample() : name(NULL) {} + ~sample() { DELETEA(name); } +}; + +struct soundslot +{ + sample *s; + int vol; + int uses, maxuses; +}; + +struct soundloc { vec loc; bool inuse; soundslot *slot; extentity *ent; }; +vector soundlocs; + +void setmusicvol(int musicvol) +{ + if(nosound) return; + if(mod) Mix_VolumeMusic((musicvol*MAXVOL)/255); +} + +VARP(soundvol, 0, 255, 255); +VARFP(musicvol, 0, 128, 255, setmusicvol(musicvol)); + +char *musicfile = NULL, *musicdonecmd = NULL; + +void stopsound() +{ + if(nosound) return; + DELETEA(musicfile); + DELETEA(musicdonecmd); + if(mod) + { + Mix_HaltMusic(); + Mix_FreeMusic(mod); + mod = NULL; + } +} + +VARF(soundchans, 0, 32, 128, initwarning("sound configuration", INIT_RESET, CHANGE_SOUND)); +VARF(soundfreq, 0, MIX_DEFAULT_FREQUENCY, 44100, initwarning("sound configuration", INIT_RESET, CHANGE_SOUND)); +VARF(soundbufferlen, 128, 1024, 4096, initwarning("sound configuration", INIT_RESET, CHANGE_SOUND)); + +void initsound() +{ + if(Mix_OpenAudio(soundfreq, MIX_DEFAULT_FORMAT, 2, soundbufferlen)<0) + { + conoutf(CON_ERROR, "sound init failed (SDL_mixer): %s", (size_t)Mix_GetError()); + return; + } + Mix_AllocateChannels(soundchans); + nosound = false; +} + +void musicdone() +{ + if(!musicdonecmd) return; + if(mod) Mix_FreeMusic(mod); + mod = NULL; + DELETEA(musicfile); + char *cmd = musicdonecmd; + musicdonecmd = NULL; + execute(cmd); + delete[] cmd; +} + +void music(char *name, char *cmd) +{ + if(nosound) return; + stopsound(); + if(soundvol && musicvol && *name) + { + if(cmd[0]) musicdonecmd = newstring(cmd); + s_sprintfd(sn)("packages/%s", name); + const char *file = findfile(path(sn), "rb"); + if((mod = Mix_LoadMUS(file))) + { + musicfile = newstring(file); + Mix_PlayMusic(mod, cmd[0] ? 0 : -1); + Mix_VolumeMusic((musicvol*MAXVOL)/255); + } + else + { + conoutf(CON_ERROR, "could not play music: %s", sn); + } + } +} + +COMMAND(music, "ss"); + +hashtable samples; +vector gamesounds, mapsounds; + +int findsound(const char *name, int vol, vector &sounds) +{ + loopv(sounds) + { + if(!strcmp(sounds[i].s->name, name) && (!vol || sounds[i].vol==vol)) return i; + } + return -1; +} + +int addsound(const char *name, int vol, int maxuses, vector &sounds) +{ + sample *s = samples.access(name); + if(!s) + { + char *n = newstring(name); + s = &samples[n]; + s->name = n; + s->sound = NULL; + } + soundslot &slot = sounds.add(); + slot.s = s; + slot.vol = vol ? vol : 100; + slot.uses = 0; + slot.maxuses = maxuses; + return sounds.length()-1; +} + +void registersound(char *name, int *vol) { intret(addsound(name, *vol, 0, gamesounds)); } +COMMAND(registersound, "si"); + +void mapsound(char *name, int *vol, int *maxuses) { intret(addsound(name, *vol, *maxuses < 0 ? 0 : max(1, *maxuses), mapsounds)); } +COMMAND(mapsound, "sii"); + +void clear_sound() +{ + closemumble(); + if(nosound) return; + stopsound(); + gamesounds.setsizenodelete(0); + mapsounds.setsizenodelete(0); + samples.clear(); + Mix_CloseAudio(); +} + +void clearsoundlocs() +{ + loopv(soundlocs) if(soundlocs[i].inuse && soundlocs[i].ent) + { + if(Mix_Playing(i)) Mix_HaltChannel(i); + soundlocs[i].inuse = false; + soundlocs[i].ent->visible = false; + soundlocs[i].slot->uses--; + } + soundlocs.setsize(0); +} + +void clearmapsounds() +{ + clearsoundlocs(); + mapsounds.setsizenodelete(0); +} + +void checkmapsounds() +{ + const vector &ents = et->getents(); + loopv(ents) + { + extentity &e = *ents[i]; + if(e.type!=ET_SOUND || e.visible || camera1->o.dist(e.o)>=e.attr2) continue; + playsound(e.attr1, NULL, &e); + } +} + +VAR(stereo, 0, 1, 1); + +void updatechanvol(int chan, int svol, const vec *loc = NULL, extentity *ent = NULL) +{ + int vol = soundvol, pan = 255/2; + if(loc) + { + vec v; + float dist = camera1->o.dist(*loc, v); + if(ent) + { + int rad = ent->attr2; + if(ent->attr3) + { + rad -= ent->attr3; + dist -= ent->attr3; + } + vol -= (int)(min(max(dist/rad, 0.0f), 1.0f)*soundvol); + } + else + { + vol -= (int)(dist*3/4*soundvol/255); // simple mono distance attenuation + if(vol<0) vol = 0; + } + if(stereo && (v.x != 0 || v.y != 0) && dist>0) + { + float yaw = -atan2f(v.x, v.y) - camera1->yaw*RAD; // relative angle of sound along X-Y axis + pan = int(255.9f*(0.5f*sinf(yaw)+0.5f)); // range is from 0 (left) to 255 (right) + } + } + vol = (vol*MAXVOL*svol)/255/255; + vol = min(vol, MAXVOL); + Mix_Volume(chan, vol); + Mix_SetPanning(chan, 255-pan, pan); +} + +void newsoundloc(int chan, const vec *loc, soundslot *slot, extentity *ent = NULL) +{ + while(chan >= soundlocs.length()) soundlocs.add().inuse = false; + soundlocs[chan].loc = *loc; + soundlocs[chan].inuse = true; + soundlocs[chan].slot = slot; + soundlocs[chan].ent = ent; +} + +void updatevol() +{ + updatemumble(); + if(nosound) return; + loopv(soundlocs) if(soundlocs[i].inuse) + { + if(Mix_Playing(i)) + updatechanvol(i, soundlocs[i].slot->vol, &soundlocs[i].loc, soundlocs[i].ent); + else + { + soundlocs[i].inuse = false; + if(soundlocs[i].ent) + { + soundlocs[i].ent->visible = false; + soundlocs[i].slot->uses--; + } + } + } + if(mod && !Mix_PlayingMusic()) musicdone(); +} + +VARP(maxsoundsatonce, 0, 5, 100); + +void playsound(int n, const vec *loc, extentity *ent) +{ + if(nosound) return; + if(!soundvol) return; + + if(!ent) + { + static int soundsatonce = 0, lastsoundmillis = 0; + if(totalmillis==lastsoundmillis) soundsatonce++; else soundsatonce = 1; + lastsoundmillis = totalmillis; + if(maxsoundsatonce && soundsatonce>maxsoundsatonce) return; // avoid bursts of sounds with heavy packetloss and in sp + } + + vector &sounds = ent ? mapsounds : gamesounds; + if(!sounds.inrange(n)) { conoutf(CON_WARN, "unregistered sound: %d", n); return; } + soundslot &slot = sounds[n]; + if(ent && slot.maxuses && slot.uses>=slot.maxuses) return; + + if(!slot.s->sound) + { + const char *exts[] = { "", ".wav", ".ogg" }; + string buf; + loopi(sizeof(exts)/sizeof(exts[0])) + { + s_sprintf(buf)("packages/sounds/%s%s", slot.s->name, exts[i]); + const char *file = findfile(path(buf), "rb"); + slot.s->sound = Mix_LoadWAV(file); + if(slot.s->sound) break; + } + + if(!slot.s->sound) { conoutf(CON_ERROR, "failed to load sample: %s", buf); return; } + } + + int chan = Mix_PlayChannel(-1, slot.s->sound, 0); + if(chan<0) return; + + if(ent) + { + loc = &ent->o; + ent->visible = true; + slot.uses++; + } + if(loc) newsoundloc(chan, loc, &slot, ent); + updatechanvol(chan, slot.vol, loc, ent); +} + +void playsoundname(const char *s, const vec *loc, int vol) +{ + if(!vol) vol = 100; + int id = findsound(s, vol, gamesounds); + if(id < 0) id = addsound(s, vol, 0, gamesounds); + playsound(id, loc); +} + +void sound(int *n) { playsound(*n); } +COMMAND(sound, "i"); + +void resetsound() +{ + const SDL_version *v = Mix_Linked_Version(); + if(SDL_VERSIONNUM(v->major, v->minor, v->patch) <= SDL_VERSIONNUM(1, 2, 8)) + { + conoutf(CON_ERROR, "Sound reset not available in-game due to SDL_mixer-1.2.8 bug. Please restart for changes to take effect."); + return; + } + clearchanges(CHANGE_SOUND); + if(!nosound) + { + clearsoundlocs(); + enumerate(samples, sample, s, { Mix_FreeChunk(s.sound); s.sound = NULL; }); + if(mod) + { + Mix_HaltMusic(); + Mix_FreeMusic(mod); + } + Mix_CloseAudio(); + } + initsound(); + if(nosound) + { + DELETEA(musicfile); + DELETEA(musicdonecmd); + mod = NULL; + gamesounds.setsizenodelete(0); + mapsounds.setsizenodelete(0); + samples.clear(); + return; + } + if(mod && (mod = Mix_LoadMUS(musicfile))) + { + Mix_PlayMusic(mod, musicdonecmd[0] ? 0 : -1); + Mix_VolumeMusic((musicvol*MAXVOL)/255); + } +} + +COMMAND(resetsound, ""); + +#ifdef WIN32 + +#include + +#else + +#include + +#ifdef _POSIX_SHARED_MEMORY_OBJECTS +#include +#include +#include +#include +#include +#endif + +#endif + +#if defined(WIN32) || defined(_POSIX_SHARED_MEMORY_OBJECTS) +struct MumbleInfo +{ + int version, timestamp; + vec pos, front, top; + wchar_t name[256]; +}; +#endif + +#ifdef WIN32 +static HANDLE mumblelink = NULL; +static MumbleInfo *mumbleinfo = NULL; +#define VALID_MUMBLELINK (mumblelink && mumbleinfo) +#elif defined(_POSIX_SHARED_MEMORY_OBJECTS) +static int mumblelink = -1; +static MumbleInfo *mumbleinfo = (MumbleInfo *)-1; +#define VALID_MUMBLELINK (mumblelink >= 0 && mumbleinfo != (MumbleInfo *)-1) +#endif + +#ifdef VALID_MUMBLELINK +VARFP(mumble, 0, 1, 1, { if(mumble) initmumble(); else closemumble(); }); +#else +VARFP(mumble, 0, 0, 1, { if(mumble) initmumble(); else closemumble(); }); +#endif + +void initmumble() +{ + if(!mumble) return; +#ifdef VALID_MUMBLELINK + if(VALID_MUMBLELINK) return; + + #ifdef WIN32 + mumblelink = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, "MumbleLink"); + if(mumblelink) + { + mumbleinfo = (MumbleInfo *)MapViewOfFile(mumblelink, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(MumbleInfo)); + if(mumbleinfo) wcsncpy(mumbleinfo->name, L"Sauerbraten", 256); + } + #elif defined(_POSIX_SHARED_MEMORY_OBJECTS) + s_sprintfd(shmname)("/MumbleLink.%d", getuid()); + mumblelink = shm_open(shmname, O_RDWR, 0); + if(mumblelink >= 0) + { + mumbleinfo = (MumbleInfo *)mmap(NULL, sizeof(MumbleInfo), PROT_READ|PROT_WRITE, MAP_SHARED, mumblelink, 0); + if(mumbleinfo != (MumbleInfo *)-1) wcsncpy(mumbleinfo->name, L"Sauerbraten", 256); + } + #endif + if(!VALID_MUMBLELINK) closemumble(); +#else + conoutf(CON_ERROR, "Mumble positional audio is not available on this platform."); +#endif +} + +void closemumble() +{ +#ifdef WIN32 + if(mumbleinfo) { UnmapViewOfFile(mumbleinfo); mumbleinfo = NULL; } + if(mumblelink) { CloseHandle(mumblelink); mumblelink = NULL; } +#elif defined(_POSIX_SHARED_MEMORY_OBJECTS) + if(mumbleinfo != (MumbleInfo *)-1) { munmap(mumbleinfo, sizeof(MumbleInfo)); mumbleinfo = (MumbleInfo *)-1; } + if(mumblelink >= 0) { close(mumblelink); mumblelink = -1; } +#endif +} + +static inline vec mumblevec(const vec &v, bool pos = false) +{ + // change from Z up, -Y forward to Y up, +Z forward + // 8 cube units = 1 meter + vec m(v.x, v.z, -v.y); + if(pos) m.div(8); + return m; +} + +void updatemumble() +{ +#ifdef VALID_MUMBLELINK + if(!VALID_MUMBLELINK) return; + + static int timestamp = 0; + + mumbleinfo->version = 1; + mumbleinfo->timestamp = ++timestamp; + + mumbleinfo->pos = mumblevec(player->o, true); + mumbleinfo->front = mumblevec(vec(RAD*player->yaw, RAD*player->pitch)); + mumbleinfo->top = mumblevec(vec(RAD*player->yaw, RAD*(player->pitch+90))); +#endif +} + diff --git a/src/engine/textedit.h b/src/engine/textedit.h new file mode 100644 index 0000000..5ebd3f2 --- /dev/null +++ b/src/engine/textedit.h @@ -0,0 +1,725 @@ + +struct editline +{ + enum { CHUNKSIZE = 256 }; + + char *text; + int len, maxlen; + + editline() : text(NULL), len(0), maxlen(0) {} + editline(const char *init) : text(NULL), len(0), maxlen(0) + { + set(init); + } + + bool empty() { return len <= 1; } + + void clear() + { + DELETEA(text); + len = maxlen = 0; + } + + bool grow(int total, const char *fmt = "", ...) + { + if(total + 1 <= maxlen) return false; + maxlen = (total + CHUNKSIZE) - total%CHUNKSIZE; + char *newtext = new char[maxlen]; + if(fmt) + { + va_list args; + va_start(args, fmt); + _vsnprintf(newtext, maxlen, fmt, args); + va_end(args); + } + DELETEA(text); + text = newtext; + return true; + } + + void set(const char *str, int slen = -1) + { + if(slen < 0) + { + slen = strlen(str); + if(!grow(slen, "%s", str)) memcpy(text, str, slen + 1); + } + else + { + grow(slen); + memcpy(text, str, slen); + text[slen] = '\0'; + } + len = slen; + } + + void prepend(const char *str) + { + int slen = strlen(str); + if(!grow(slen + len, "%s%s", str, text ? text : "")) + { + memmove(&text[slen], text, len + 1); + memcpy(text, str, slen + 1); + } + len += slen; + } + + void append(const char *str) + { + int slen = strlen(str); + if(!grow(len + slen, "%s%s", text ? text : "", str)) memcpy(&text[len], str, slen + 1); + len += slen; + } + + bool read(FILE *f, int chop = -1) + { + if(chop < 0) chop = INT_MAX; else chop++; + set(""); + while(len + 1 < chop && fgets(&text[len], min(maxlen, chop) - len, f)) + { + len += strlen(&text[len]); + if(len > 0 && text[len-1] == '\n') + { + text[--len] = '\0'; + return true; + } + if(len + 1 >= maxlen && len + 1 < chop) grow(len + CHUNKSIZE, "%s", text); + } + if(len + 1 >= chop) + { + char buf[CHUNKSIZE]; + while(fgets(buf, sizeof(buf), f)) + { + int blen = strlen(buf); + if(blen > 0 && buf[blen-1] == '\n') return true; + } + } + return false; + } + + void del(int start, int count) + { + if(!text) return; + if(start < 0) { count += start; start = 0; } + if(count <= 0 || start >= len) return; + if(start + count > len) count = len - start - 1; + memmove(&text[start], &text[start+count], len + 1 - (start + count)); + len -= count; + } + + void chop(int newlen) + { + if(!text) return; + len = clamp(newlen, 0, len); + text[len] = '\0'; + } + + void insert(char *str, int start, int count = 0) + { + if(count <= 0) count = strlen(str); + start = clamp(start, 0, len); + grow(len + count, "%s", text ? text : ""); + memmove(&text[start + count], &text[start], len - start + 1); + memcpy(&text[start], str, count); + len += count; + } + + void combinelines(vector &src) + { + if(src.empty()) set(""); + else loopv(src) + { + if(i) append("\n"); + if(!i) set(src[i].text, src[i].len); + else insert(src[i].text, len, src[i].len); + } + } +}; + +struct editor +{ + int mode; //editor mode - 1= keep while focused, 2= keep while used in gui, 3= keep forever (i.e. until mode changes) + bool active; + const char *name; + const char *filename; + + int cx, cy; // cursor position - ensured to be valid after a region() or currentline() + int mx, my; // selection mark, mx=-1 if following cursor - avoid direct access, instead use region() + int maxx, maxy; // maxy=-1 if unlimited lines, 1 if single line editor + + int scrolly; // vertical scroll offset + + bool linewrap; + int pixelwidth; // required for up/down/hit/draw/bounds + int pixelheight; // -1 for variable sized, i.e. from bounds() + + vector lines; // MUST always contain at least one line! + + editor(const char *name, int mode, const char *initval) : + mode(mode), active(true), name(newstring(name)), filename(NULL), + cx(0), cy(0), mx(-1), maxx(-1), maxy(-1), scrolly(0), linewrap(false), pixelwidth(-1), pixelheight(-1) + { + //printf("editor %08x '%s'\n", this, name); + lines.add().set(initval ? initval : ""); + } + + ~editor() + { + //printf("~editor %08x '%s'\n", this, name); + DELETEA(name); + DELETEA(filename); + clear(NULL); + } + + void clear(const char *init = "") + { + cx = cy = 0; + mark(false); + loopv(lines) lines[i].clear(); + lines.setsize(0); + if(init) lines.add().set(init); + } + + void setfile(const char *fname) + { + DELETEA(filename); + if(fname) filename = newstring(fname); + } + + void load() + { + if(!filename) return; + clear(NULL); + FILE *file = openfile(filename, "r"); + if(file) + { + while(lines.add().read(file, maxx) && (maxy < 0 || lines.length() <= maxy)); + lines.pop().clear(); + fclose(file); + } + if(lines.empty()) lines.add().set(""); + } + + void save() + { + if(!filename) return; + FILE *file = openfile(filename, "w"); + if(!file) return; + loopv(lines) fprintf(file, "%s\n", lines[i].text); + fclose(file); + } + + void mark(bool enable) + { + mx = (enable) ? cx : -1; + my = cy; + } + + void selectall() + { + mx = my = INT_MAX; + cx = cy = 0; + } + + // constrain results to within buffer - s=start, e=end, return true if a selection range + // also ensures that cy is always within lines[] and cx is valid + bool region(int &sx, int &sy, int &ex, int &ey) + { + int n = lines.length(); + assert(n != 0); + if(cy < 0) cy = 0; else if(cy >= n) cy = n-1; + int len = lines[cy].len; + if(cx < 0) cx = 0; else if(cx > len) cx = len; + if(mx >= 0) + { + if(my < 0) my = 0; else if(my >= n) my = n-1; + len = lines[my].len; + if(mx > len) mx = len; + } + sx = (mx >= 0) ? mx : cx; + sy = (mx >= 0) ? my : cy; + ex = cx; + ey = cy; + if(sy > ey) { swap(sy, ey); swap(sx, ex); } + else if(sy==ey && sx > ex) swap(sx, ex); + return (sx != ex) || (sy != ey); + } + + bool region() { int sx, sy, ex, ey; return region(sx, sy, ex, ey); } + + // also ensures that cy is always within lines[] and cx is valid + editline ¤tline() + { + int n = lines.length(); + assert(n != 0); + if(cy < 0) cy = 0; else if(cy >= n) cy = n-1; + if(cx < 0) cx = 0; else if(cx > lines[cy].len) cx = lines[cy].len; + return lines[cy]; + } + + void copyselectionto(editor *b) + { + if(b==this) return; + + b->clear(NULL); + int sx, sy, ex, ey; + region(sx, sy, ex, ey); + loopi(1+ey-sy) + { + if(b->maxy != -1 && b->lines.length() >= b->maxy) break; + int y = sy+i; + char *line = lines[y].text; + int len = lines[y].len; + if(y == sy && y == ey) + { + line += sx; + len = ex - sx; + } + else if(y == sy) line += sx; + else if(y == ey) len = ex; + b->lines.add().set(line, len); + } + if(b->lines.empty()) b->lines.add().set(""); + } + + char *tostring() + { + int len = 0; + loopv(lines) len += lines[i].len + 1; + char *str = newstring(len); + int offset = 0; + loopv(lines) + { + editline &l = lines[i]; + memcpy(&str[offset], l.text, l.len); + offset += l.len; + str[offset++] = '\n'; + } + str[offset] = '\0'; + return str; + } + + char *selectiontostring() + { + vector buf; + int sx, sy, ex, ey; + region(sx, sy, ex, ey); + loopi(1+ey-sy) + { + int y = sy+i; + char *line = lines[y].text; + int len = lines[y].len; + if(y == sy && y == ey) + { + line += sx; + len = ex - sx; + } + else if(y == sy) line += sx; + else if(y == ey) len = ex; + buf.put(line, len); + buf.add('\n'); + } + buf.add('\0'); + return newstring(buf.getbuf(), buf.length()-1); + } + + void removelines(int start, int count) + { + loopi(count) lines[start+i].clear(); + lines.remove(start, count); + } + + void del() // removes the current selection (if any) + { + int sx, sy, ex, ey; + if(!region(sx, sy, ex, ey)) return; + if(sy == ey) + { + if(sx == 0 || ex == lines[ey].len) removelines(sy, 1); + else lines[sy].del(sx, ex - sx); + } + else + { + if(ey > sy+2) { removelines(sy+1, ey-(sy+2)); ey = sy+1; } + if(ex == lines[ey].len) removelines(ey, 1); else lines[ey].del(0, ex); + if(sx == 0) removelines(sy, 1); else lines[sy].del(sx, lines[sy].len - sx); + } + if(lines.empty()) lines.add().set(""); + mark(false); + cx = sx; + cy = sy; + } + + void insert(char ch) + { + del(); + editline ¤t = currentline(); + if(ch == '\n') + { + if(maxy == -1 || cy < maxy-1) + { + editline newline(¤t.text[cx]); + current.chop(cx); + cy = min(lines.length(), cy+1); + lines.insert(cy, newline); + } + else current.chop(cx); + cx = 0; + } + else + { + int len = current.len; + if(maxx >= 0 && len > maxx-1) len = maxx-1; + if(cx <= len) current.insert(&ch, cx++, 1); + } + } + + void insertallfrom(editor *b) + { + if(b==this) return; + + del(); + + if(b->lines.length() == 1 || maxy == 1) + { + editline ¤t = currentline(); + char *str = b->lines[0].text; + int slen = b->lines[0].len; + if(maxx >= 0 && b->lines[0].len + cx > maxx) slen = maxx-cx; + if(slen > 0) + { + int len = current.len; + if(maxx >= 0 && slen + cx + len > maxx) len = max(0, maxx-(cx+slen)); + current.insert(str, cx, slen); + cx += slen; + } + } + else + { + loopv(b->lines) + { + if(!i) + { + lines[cy++].append(b->lines[i].text); + } + else if(i >= b->lines.length()) + { + cx = b->lines[i].len; + lines[cy].prepend(b->lines[i].text); + } + else if(maxy < 0 || lines.length() < maxy) lines.insert(cy++, editline(b->lines[i].text)); + } + } + } + + void key(int code, int cooked) + { + switch(code) + { + case SDLK_UP: + if(linewrap) + { + int x, y; + char *str = currentline().text; + text_pos(str, cx+1, x, y, pixelwidth); + if(y > 0) { cx = text_visible(str, x, y-FONTH, pixelwidth); break; } + } + cy--; + break; + case SDLK_DOWN: + if(linewrap) + { + int x, y, width, height; + char *str = currentline().text; + text_pos(str, cx, x, y, pixelwidth); + text_bounds(str, width, height, pixelwidth); + y += FONTH; + if(y < height) { cx = text_visible(str, x, y, pixelwidth); break; } + } + cy++; + break; + case -4: + cy--; + break; + case -5: + cy++; + break; + case SDLK_PAGEUP: + cy-=pixelheight/FONTH; + break; + case SDLK_PAGEDOWN: + cy+=pixelheight/FONTH; + break; + case SDLK_HOME: + cx = cy = 0; + break; + case SDLK_END: + cx = cy = INT_MAX; + break; + case SDLK_LEFT: + cx--; + break; + case SDLK_RIGHT: + cx++; + break; + case SDLK_DELETE: + { + del(); + editline ¤t = currentline(); + if(cx < current.len) current.del(cx, 1); + else if(cy < lines.length()-1) + { //combine with next line + current.append(lines[cy+1].text); + removelines(cy+1, 1); + } + break; + } + case SDLK_BACKSPACE: + { + del(); + editline ¤t = currentline(); + if(cx > 0) current.del(--cx, 1); + else if(cy > 0) + { //combine with previous line + cx = lines[cy-1].len; + lines[cy-1].append(current.text); + removelines(cy--, 1); + } + break; + } + case SDLK_RETURN: + cooked = '\n'; + // fall through + default: + insert(cooked); + break; + } + } + + void hit(int hitx, int hity, bool dragged) + { + int maxwidth = linewrap?pixelwidth:-1; + int h = 0; + for(int i = scrolly; i < lines.length(); i++) + { + int width, height; + text_bounds(lines[i].text, width, height, maxwidth); + if(h + height > pixelheight) break; + + if(hity >= h && hity <= h+height) + { + int x = text_visible(lines[i].text, hitx, hity-h, maxwidth); + if(dragged) { mx = x; my = i; } else { cx = x; cy = i; }; + break; + } + h+=height; + } + } + + void draw(int x, int y, int color, bool hit) + { + int maxwidth = linewrap?pixelwidth:-1; + + int sx, sy, ex, ey; + bool selection = region(sx, sy, ex, ey); + + // fix scrolly so that is always on screen + if(cy < scrolly) scrolly = cy; + else + { + if(scrolly < 0) scrolly = 0; + int h = 0; + for(int i = cy; i >= scrolly; i--) + { + int width, height; + text_bounds(lines[i].text, width, height, maxwidth); + if(h + height > pixelheight) { scrolly = i+1; break; } + h += height; + } + } + + if(selection) + { + // convert from cursor coords into pixel coords + int psx, psy, pex, pey; + text_pos(lines[sy].text, sx, psx, psy, maxwidth); + text_pos(lines[ey].text, ex, pex, pey, maxwidth); + int maxy = lines.length(); + int h = 0; + for(int i = scrolly; i < maxy; i++) + { + int width, height; + text_bounds(lines[i].text, width, height, maxwidth); + if(h + height > pixelheight) { maxy = i; break; } + if(i == sy) psy += h; + if(i == ey) { pey += h; break; } + h += height; + } + maxy--; + + if(ey >= scrolly && sy <= maxy) + { + // crop top/bottom within window + if(sy < scrolly) { sy = scrolly; psy = 0; psx = 0; } + if(ey > maxy) { ey = maxy; pey = pixelheight - FONTH; pex = pixelwidth; } + + notextureshader->set(); + glDisable(GL_TEXTURE_2D); + glColor3ub(0xA0, 0x80, 0x80); + glBegin(GL_QUADS); + if(psy == pey) + { + glVertex2f(x+psx, y+psy); + glVertex2f(x+pex, y+psy); + glVertex2f(x+pex, y+pey+FONTH); + glVertex2f(x+psx, y+pey+FONTH); + } + else + { glVertex2f(x+psx, y+psy); + glVertex2f(x+psx, y+psy+FONTH); + glVertex2f(x+pixelwidth, y+psy+FONTH); + glVertex2f(x+pixelwidth, y+psy); + if(pey-psy > FONTH) + { + glVertex2f(x, y+psy+FONTH); + glVertex2f(x+pixelwidth, y+psy+FONTH); + glVertex2f(x+pixelwidth, y+pey); + glVertex2f(x, y+pey); + } + glVertex2f(x, y+pey); + glVertex2f(x, y+pey+FONTH); + glVertex2f(x+pex, y+pey+FONTH); + glVertex2f(x+pex, y+pey); + } + glEnd(); + glEnable(GL_TEXTURE_2D); + defaultshader->set(); + } + } + + int h = 0; + for(int i = scrolly; i < lines.length(); i++) + { + int width, height; + text_bounds(lines[i].text, width, height, maxwidth); + if(h + height > pixelheight) break; + + draw_text(lines[i].text, x, y+h, color>>16, (color>>8)&0xFF, color&0xFF, 0xFF, hit&&(cy==i)?cx:-1, maxwidth); + if(linewrap && height > FONTH) // line wrap indicator + { + notextureshader->set(); + glDisable(GL_TEXTURE_2D); + glColor3ub(0x80, 0xA0, 0x80); + glBegin(GL_QUADS); + glVertex2f(x, y+h+FONTH); + glVertex2f(x, y+h+height); + glVertex2f(x-FONTW/2, y+h+height); + glVertex2f(x-FONTW/2, y+h+FONTH); + glEnd(); + glEnable(GL_TEXTURE_2D); + defaultshader->set(); + } + h+=height; + } + } +}; + +// a 'stack' where the last is the current focused editor +static vector editors; + +static editor *currentfocus() { return (editors.length() > 0)?editors.last():NULL; } + +static void readyeditors() +{ + loopv(editors) editors[i]->active = (editors[i]->mode==EDITORFOREVER); +} + +static void flusheditors() +{ + loopvrev(editors) if(!editors[i]->active) + { + editor *e = editors.remove(i); + DELETEP(e); + } +} + +static editor *useeditor(const char *name, int mode, bool focus, const char *initval = NULL) +{ + loopv(editors) if(strcmp(editors[i]->name, name) == 0) + { + editor *e = editors[i]; + if(focus) { editors.add(e); editors.remove(i); } // re-position as last + e->active = true; + return e; + } + editor *e = new editor(name, mode, initval); + if(focus) editors.add(e); else editors.insert(0, e); + return e; +} + + +#define TEXTCOMMAND(f, s, d, body) ICOMMAND(f, s, d,\ + editor *top = currentfocus();\ + if(!top) return;\ + body\ +) + +ICOMMAND(textlist, "", (), // @DEBUG return list of all the editors + string s = ""; + loopv(editors) + { + if(i > 0) s_strcat(s, ", "); + s_strcat(s, editors[i]->name); + } + result(s); +); +TEXTCOMMAND(textshow, "", (), // @DEBUG return the start of the buffer + editline line; + line.combinelines(top->lines); + result(line.text); + line.clear(); +); +ICOMMAND(textfocus, "si", (char *name, int *mode), // focus on a (or create a persistent) specific editor, else returns current name + if(*name) useeditor(name, *mode<=0 ? EDITORFOREVER : *mode, true); + else if(editors.length() > 0) result(editors.last()->name); +); +TEXTCOMMAND(textprev, "", (), editors.insert(0, top); editors.pop();); // return to the previous editor +TEXTCOMMAND(textmode, "i", (int *m), // (1= keep while focused, 2= keep while used in gui, 3= keep forever (i.e. until mode changes)) topmost editor, return current setting if no args + if(*m) top->mode = *m; + else + { + s_sprintfd(s)("%d", top->mode); + result(s); + } +); +TEXTCOMMAND(textsave, "s", (char *file), // saves the topmost (filename is optional) + if(*file) top->setfile(path(file, true)); + top->save(); +); +TEXTCOMMAND(textload, "s", (char *file), // loads into the topmost editor, returns filename if no args + if(*file) + { + top->setfile(path(file, true)); + top->load(); + } + else if(top->filename) result(top->filename); +); + +#define PASTEBUFFER "#pastebuffer" + +TEXTCOMMAND(textcopy, "", (), editor *b = useeditor(PASTEBUFFER, EDITORFOREVER, false); top->copyselectionto(b);); +TEXTCOMMAND(textpaste, "", (), editor *b = useeditor(PASTEBUFFER, EDITORFOREVER, false); top->insertallfrom(b);); +TEXTCOMMAND(textmark, "i", (int *m), // (1=mark, 2=unmark), return current mark setting if no args + if(*m) top->mark(*m==1); + else result(top->region() ? "1" : "2"); +); +TEXTCOMMAND(textselectall, "", (), top->selectall();); +TEXTCOMMAND(textclear, "", (), top->clear();); +TEXTCOMMAND(textcurrentline, "", (), result(top->currentline().text);); + +TEXTCOMMAND(textexec, "i", (int *selected), // execute script commands from the buffer (0=all, 1=selected region only) + char *script = *selected ? top->selectiontostring() : top->tostring(); + execute(script); + delete[] script; +); + diff --git a/src/engine/texture.cpp b/src/engine/texture.cpp new file mode 100644 index 0000000..de76dde --- /dev/null +++ b/src/engine/texture.cpp @@ -0,0 +1,1259 @@ +// texture.cpp: texture slot management + +#include "pch.h" +#include "engine.h" + +static inline void reorienttexture(uchar *src, int sw, int sh, int bpp, uchar *dst, bool flipx, bool flipy, bool swapxy, bool normals = false) +{ + int stridex = bpp, stridey = bpp; + if(swapxy) stridex *= sh; else stridey *= sw; + if(flipx) { dst += (sw-1)*stridex; stridex = -stridex; } + if(flipy) { dst += (sh-1)*stridey; stridey = -stridey; } + loopi(sh) + { + uchar *curdst = dst; + loopj(sw) + { + loopk(bpp) curdst[k] = *src++; + if(normals) + { + if(flipx) curdst[0] = 255-curdst[0]; + if(flipy) curdst[1] = 255-curdst[1]; + if(swapxy) swap(curdst[0], curdst[1]); + } + curdst += stridex; + } + dst += stridey; + } +} + +SDL_Surface *texreorient(SDL_Surface *s, bool flipx, bool flipy, bool swapxy, int type = TEX_DIFFUSE) +{ + SDL_Surface *d = SDL_CreateRGBSurface(SDL_SWSURFACE, swapxy ? s->h : s->w, swapxy ? s->w : s->h, s->format->BitsPerPixel, s->format->Rmask, s->format->Gmask, s->format->Bmask, s->format->Amask); + if(!d) fatal("create surface"); + reorienttexture((uchar *)s->pixels, s->w, s->h, s->format->BytesPerPixel, (uchar *)d->pixels, flipx, flipy, swapxy, type==TEX_NORMAL); + SDL_FreeSurface(s); + return d; +} + +SDL_Surface *texrotate(SDL_Surface *s, int numrots, int type = TEX_DIFFUSE) +{ + // 1..3 rotate through 90..270 degrees, 4 flips X, 5 flips Y + if(numrots<1 || numrots>5) return s; + return texreorient(s, + numrots>=2 && numrots<=4, // flip X on 180/270 degrees + numrots<=2 || numrots==5, // flip Y on 90/180 degrees + (numrots&5)==1, // swap X/Y on 90/270 degrees + type); +} + +SDL_Surface *texoffset(SDL_Surface *s, int xoffset, int yoffset) +{ + xoffset = max(xoffset, 0); + xoffset %= s->w; + yoffset = max(yoffset, 0); + yoffset %= s->h; + if(!xoffset && !yoffset) return s; + SDL_Surface *d = SDL_CreateRGBSurface(SDL_SWSURFACE, s->w, s->h, s->format->BitsPerPixel, s->format->Rmask, s->format->Gmask, s->format->Bmask, s->format->Amask); + if(!d) fatal("create surface"); + int depth = s->format->BytesPerPixel; + uchar *src = (uchar *)s->pixels; + loop(y, s->h) + { + uchar *dst = (uchar *)d->pixels+((y+yoffset)%d->h)*d->pitch; + memcpy(dst+xoffset*depth, src, (s->w-xoffset)*depth); + memcpy(dst, src+(s->w-xoffset)*depth, xoffset*depth); + src += s->pitch; + } + SDL_FreeSurface(s); + return d; +} + +void texmad(SDL_Surface *s, const vec &mul, const vec &add) +{ + int maxk = min(int(s->format->BytesPerPixel), 3); + uchar *src = (uchar *)s->pixels; + loopi(s->h*s->w) + { + loopk(maxk) + { + float val = src[k]*mul[k] + 255*add[k]; + src[k] = uchar(min(max(val, 0.0f), 255.0f)); + } + src += s->format->BytesPerPixel; + } +} + +static SDL_Surface stubsurface; + +SDL_Surface *texffmask(SDL_Surface *s, int minval) +{ + if(renderpath!=R_FIXEDFUNCTION) return s; + if(nomasks || s->format->BytesPerPixel<3) { SDL_FreeSurface(s); return &stubsurface; } + bool glow = false, envmap = true; + uchar *src = (uchar *)s->pixels; + loopi(s->h*s->w) + { + if(src[1]>minval) glow = true; + if(src[2]>minval) { glow = envmap = true; break; } + src += s->format->BytesPerPixel; + } + if(!glow && !envmap) { SDL_FreeSurface(s); return &stubsurface; } + SDL_Surface *m = SDL_CreateRGBSurface(SDL_SWSURFACE, s->w, s->h, envmap ? 16 : 8, 0, 0, 0, 0); + if(!m) fatal("create surface"); + uchar *dst = (uchar *)m->pixels; + src = (uchar *)s->pixels; + loopi(s->h*s->w) + { + *dst++ = src[1]; + if(envmap) *dst++ = src[2]; + src += s->format->BytesPerPixel; + } + SDL_FreeSurface(s); + return m; +} + +void texdup(SDL_Surface *s, int srcchan, int dstchan) +{ + if(srcchan==dstchan || max(srcchan, dstchan) >= s->format->BytesPerPixel) return; + uchar *src = (uchar *)s->pixels; + loopi(s->h*s->w) + { + src[dstchan] = src[srcchan]; + src += s->format->BytesPerPixel; + } +} + +SDL_Surface *texdecal(SDL_Surface *s) +{ + if(renderpath!=R_FIXEDFUNCTION || hasTE) return s; + SDL_Surface *m = SDL_CreateRGBSurface(SDL_SWSURFACE, s->w, s->h, 16, 0, 0, 0, 0); + if(!m) fatal("create surface"); + uchar *dst = (uchar *)m->pixels, *src = (uchar *)s->pixels; + loopi(s->h*s->w) + { + *dst++ = *src; + *dst++ = 255 - *src; + src += s->format->BytesPerPixel; + } + SDL_FreeSurface(s); + return m; +} + +VAR(hwtexsize, 1, 0, 0); +VAR(hwcubetexsize, 1, 0, 0); +VAR(hwmaxaniso, 1, 0, 0); +VARFP(maxtexsize, 0, 0, 1<<12, initwarning("texture quality", INIT_LOAD)); +VARFP(texreduce, 0, 0, 12, initwarning("texture quality", INIT_LOAD)); +VARFP(texcompress, 0, 1<<10, 1<<12, initwarning("texture quality", INIT_LOAD)); +VARFP(trilinear, 0, 1, 1, initwarning("texture filtering", INIT_LOAD)); +VARFP(bilinear, 0, 1, 1, initwarning("texture filtering", INIT_LOAD)); +VARFP(aniso, 0, 0, 16, initwarning("texture filtering", INIT_LOAD)); + +GLenum compressedformat(GLenum format, int w, int h, bool force = false) +{ +#ifdef __APPLE__ +#undef GL_COMPRESSED_RGB_S3TC_DXT1_EXT +#undef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT GL_COMPRESSED_RGB_ARB +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT GL_COMPRESSED_RGBA_ARB +#endif + if(hasTC && texcompress && (force || max(w, h) >= texcompress)) switch(format) + { + case GL_RGB5: + case GL_RGB8: + case GL_RGB: return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; + case GL_RGBA: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; + } + return format; +} + +int formatsize(GLenum format) +{ + switch(format) + { + case GL_LUMINANCE: + case GL_ALPHA: return 1; + case GL_LUMINANCE_ALPHA: return 2; + case GL_RGB: return 3; + case GL_RGBA: return 4; + default: return 4; + } +} + +VARFP(hwmipmap, 0, 0, 1, initwarning("texture filtering", INIT_LOAD)); + +void createtexture(int tnum, int w, int h, void *pixels, int clamp, bool mipit, GLenum component, GLenum subtarget, bool compress, bool filter) +{ + GLenum target = subtarget; + switch(subtarget) + { + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + target = GL_TEXTURE_CUBE_MAP_ARB; + break; + } + if(tnum) + { + glBindTexture(target, tnum); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexParameteri(target, GL_TEXTURE_WRAP_S, clamp&1 ? GL_CLAMP_TO_EDGE : GL_REPEAT); + if(target!=GL_TEXTURE_1D) glTexParameteri(target, GL_TEXTURE_WRAP_T, clamp&2 ? GL_CLAMP_TO_EDGE : GL_REPEAT); + if(target==GL_TEXTURE_2D && hasAF && min(aniso, hwmaxaniso) > 0) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, min(aniso, hwmaxaniso)); + glTexParameteri(target, GL_TEXTURE_MAG_FILTER, filter && bilinear ? GL_LINEAR : GL_NEAREST); + glTexParameteri(target, GL_TEXTURE_MIN_FILTER, + mipit ? + (trilinear ? + (bilinear ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_LINEAR) : + (bilinear ? GL_LINEAR_MIPMAP_NEAREST : GL_NEAREST_MIPMAP_NEAREST)) : + (filter && bilinear ? GL_LINEAR : GL_NEAREST)); + if(hasGM && mipit && pixels) + glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, hwmipmap ? GL_TRUE : GL_FALSE); + } + GLenum format = component, type = GL_UNSIGNED_BYTE; + switch(component) + { + case GL_FLOAT_RG16_NV: + case GL_FLOAT_R32_NV: + case GL_RGB16F_ARB: + case GL_RGB32F_ARB: + format = GL_RGB; + type = GL_FLOAT; + break; + + case GL_RGBA16F_ARB: + case GL_RGBA32F_ARB: + format = GL_RGBA; + type = GL_FLOAT; + break; + + case GL_DEPTH_COMPONENT: + type = GL_FLOAT; + break; + + case GL_RGB5: + case GL_RGB8: + case GL_RGB16: + format = GL_RGB; + break; + + case GL_RGBA8: + case GL_RGBA16: + format = GL_RGBA; + break; + } + uchar *scaled = NULL; + int hwlimit = target==GL_TEXTURE_CUBE_MAP_ARB ? hwcubetexsize : hwtexsize, + sizelimit = mipit && maxtexsize ? min(maxtexsize, hwlimit) : hwlimit; + if(pixels && max(w, h) > sizelimit && (!mipit || sizelimit < hwlimit)) + { + int oldw = w, oldh = h; + while(w > sizelimit || h > sizelimit) { w /= 2; h /= 2; } + scaled = new uchar[w*h*formatsize(format)]; + gluScaleImage(format, oldw, oldh, type, pixels, w, h, type, scaled); + pixels = scaled; + } + if(mipit && pixels) + { + GLenum compressed = compressedformat(component, w, h, compress); + if(target==GL_TEXTURE_1D) + { + if(hasGM && hwmipmap) glTexImage1D(subtarget, 0, compressed, w, 0, format, type, pixels); + else if(gluBuild1DMipmaps(subtarget, compressed, w, format, type, pixels)) + { + if(compressed==component || gluBuild1DMipmaps(subtarget, component, w, format, type, pixels)) conoutf(CON_ERROR, "could not build mipmaps"); + } + } + else if(hasGM && hwmipmap) glTexImage2D(subtarget, 0, compressed, w, h, 0, format, type, pixels); + else if(gluBuild2DMipmaps(subtarget, compressed, w, h, format, type, pixels)) + { + if(compressed==component || gluBuild2DMipmaps(subtarget, component, w, h, format, type, pixels)) conoutf(CON_ERROR, "could not build mipmaps"); + } + } + else if(target==GL_TEXTURE_1D) glTexImage1D(subtarget, 0, component, w, 0, format, type, pixels); + else glTexImage2D(subtarget, 0, component, w, h, 0, format, type, pixels); + if(scaled) delete[] scaled; +} + +hashtable textures; + +Texture *notexture = NULL; // used as default, ensured to be loaded + +static GLenum texformat(int bpp) +{ + switch(bpp) + { + case 8: return GL_LUMINANCE; + case 16: return GL_LUMINANCE_ALPHA; + case 24: return GL_RGB; + case 32: return GL_RGBA; + default: return 0; + } +} + +static void resizetexture(int &w, int &h, bool mipit = true, GLenum format = GL_RGB, GLenum target = GL_TEXTURE_2D) +{ + if(mipit) return; + int hwlimit = target==GL_TEXTURE_CUBE_MAP_ARB ? hwcubetexsize : hwtexsize, + sizelimit = mipit && maxtexsize ? min(maxtexsize, hwlimit) : hwlimit; + int w2 = w, h2 = h; + if(!hasNP2 && (w&(w-1) || h&(h-1))) + { + w2 = h2 = 1; + while(w2 < w) w2 *= 2; + while(h2 < h) h2 *= 2; + if(w2 > sizelimit || (w - w2)/2 < (w2 - w)/2) w2 /= 2; + if(h2 > sizelimit || (h - h2)/2 < (h2 - h)/2) h2 /= 2; + } + while(w2 > sizelimit || h2 > sizelimit) + { + w2 /= 2; + h2 /= 2; + } + w = w2; + h = h2; +} + +static Texture *newtexture(Texture *t, const char *rname, SDL_Surface *s, int clamp = 0, bool mipit = true, bool canreduce = false, bool transient = false, bool compress = false) +{ + if(!t) + { + char *key = newstring(rname); + t = &textures[key]; + t->name = key; + } + + t->clamp = clamp; + t->mipmap = mipit; + t->type = s==&stubsurface ? Texture::STUB : (transient ? Texture::TRANSIENT : Texture::IMAGE); + if(t->type==Texture::STUB) + { + t->w = t->h = t->xs = t->ys = t->bpp = 0; + return t; + } + t->bpp = s->format->BitsPerPixel; + t->w = t->xs = s->w; + t->h = t->ys = s->h; + + glGenTextures(1, &t->id); + if(canreduce) loopi(texreduce) + { + if(t->w > 1) t->w /= 2; + if(t->h > 1) t->h /= 2; + } + GLenum format = texformat(t->bpp); + resizetexture(t->w, t->h, mipit, format); + uchar *pixels = (uchar *)s->pixels; + if(t->w != t->xs || t->h != t->ys) + { + if(t->w*t->h > t->xs*t->ys) pixels = new uchar[formatsize(format)*t->w*t->h]; + gluScaleImage(format, t->xs, t->ys, GL_UNSIGNED_BYTE, s->pixels, t->w, t->h, GL_UNSIGNED_BYTE, pixels); + } + createtexture(t->id, t->w, t->h, pixels, clamp, mipit, format, GL_TEXTURE_2D, compress); + if(pixels!=s->pixels) delete[] pixels; + SDL_FreeSurface(s); + return t; +} + +#if SDL_BYTEORDER == SDL_BIG_ENDIAN +#define RMASK 0xff000000 +#define GMASK 0x00ff0000 +#define BMASK 0x0000ff00 +#define AMASK 0x000000ff +#else +#define RMASK 0x000000ff +#define GMASK 0x0000ff00 +#define BMASK 0x00ff0000 +#define AMASK 0xff000000 +#endif + +SDL_Surface *creatergbasurface(SDL_Surface *os) +{ + SDL_Surface *ns = SDL_CreateRGBSurface(SDL_SWSURFACE, os->w, os->h, 32, RMASK, GMASK, BMASK, AMASK); + if(!ns) fatal("creatergbsurface"); + SDL_BlitSurface(os, NULL, ns, NULL); + SDL_FreeSurface(os); + return ns; +} + +SDL_Surface *scalesurface(SDL_Surface *os, int w, int h) +{ + SDL_Surface *ns = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, os->format->BitsPerPixel, os->format->Rmask, os->format->Gmask, os->format->Bmask, os->format->Amask); + if(!ns) fatal("scalesurface"); + gluScaleImage(texformat(os->format->BitsPerPixel), os->w, os->h, GL_UNSIGNED_BYTE, os->pixels, w, h, GL_UNSIGNED_BYTE, ns->pixels); + SDL_FreeSurface(os); + return ns; +} + +static vec parsevec(const char *arg) +{ + vec v(0, 0, 0); + int i = 0; + for(; arg[0] && (!i || arg[0]=='/') && i<3; arg += strcspn(arg, "/,><"), i++) + { + if(i) arg++; + v[i] = atof(arg); + } + if(i==1) v.y = v.z = v.x; + return v; +} + +static SDL_Surface *texturedata(const char *tname, Slot::Tex *tex = NULL, bool msg = true, bool *compress = NULL) +{ + const char *cmds = NULL, *file = tname; + + if(!tname) + { + if(!tex) return NULL; + if(tex->name[0]=='<') + { + cmds = tex->name; + file = strrchr(tex->name, '>'); + if(!file) { if(msg) conoutf(CON_ERROR, "could not load texture packages/%s", tex->name); return NULL; } + file++; + } + else file = tex->name; + + static string pname; + s_sprintf(pname)("packages/%s", file); + file = path(pname); + } + else if(tname[0]=='<') + { + cmds = tname; + file = strrchr(tname, '>'); + if(!file) { if(msg) conoutf(CON_ERROR, "could not load texture %s", tname); return NULL; } + file++; + } + + if(cmds) + { + if(renderpath==R_FIXEDFUNCTION && !strncmp(cmds, "", 6)) return &stubsurface; + } + + if(msg) show_out_of_renderloop_progress(0, file); + + SDL_Surface *s = IMG_Load(findfile(file, "rb")); + if(!s) { if(msg) conoutf(CON_ERROR, "could not load texture %s", file); return NULL; } + int bpp = s->format->BitsPerPixel; + if(!texformat(bpp)) { SDL_FreeSurface(s); conoutf(CON_ERROR, "texture must be 8, 16, 24, or 32 bpp: %s", file); return NULL; } + + while(cmds) + { + const char *cmd = NULL, *end = NULL, *arg[3] = { NULL, NULL, NULL }; + cmd = &cmds[1]; + end = strchr(cmd, '>'); + if(!end) break; + cmds = strchr(cmd, '<'); + size_t len = strcspn(cmd, ":,><"); + loopi(3) + { + arg[i] = strchr(i ? arg[i-1] : cmd, i ? ',' : ':'); + if(!arg[i] || arg[i] >= end) arg[i] = ""; + else arg[i]++; + } + if(!strncmp(cmd, "mad", len)) texmad(s, parsevec(arg[0]), parsevec(arg[1])); + else if(!strncmp(cmd, "ffcolor", len)) + { + if(renderpath==R_FIXEDFUNCTION) texmad(s, parsevec(arg[0]), parsevec(arg[1])); + } + else if(!strncmp(cmd, "ffmask", len)) + { + s = texffmask(s, atoi(arg[0])); + if(s == &stubsurface) return s; + } + else if(!strncmp(cmd, "dup", len)) texdup(s, atoi(arg[0]), atoi(arg[1])); + else if(!strncmp(cmd, "decal", len)) s = texdecal(s); + else if(!strncmp(cmd, "offset", len)) s = texoffset(s, atoi(arg[0]), atoi(arg[1])); + else if(!strncmp(cmd, "rotate", len)) s = texrotate(s, atoi(arg[0]), tex ? tex->type : 0); + else if(!strncmp(cmd, "reorient", len)) s = texreorient(s, atoi(arg[0])>0, atoi(arg[1])>0, atoi(arg[2])>0, tex ? tex->type : TEX_DIFFUSE); + else if(!strncmp(cmd, "compress", len)) + { + if(compress) *compress = true; + if(!hasTC) + { + int scale = atoi(arg[0]); + if(scale > 1) s = scalesurface(s, s->w/scale, s->h/scale); + } + } + } + + return s; +} + +void loadalphamask(Texture *t) +{ + if(t->alphamask || t->bpp!=32) return; + SDL_Surface *s = texturedata(t->name, NULL, false); + if(!s || !s->format->Amask) { if(s) SDL_FreeSurface(s); return; } + uint alpha = s->format->Amask; + t->alphamask = new uchar[s->h * ((s->w+7)/8)]; + uchar *srcrow = (uchar *)s->pixels, *dst = t->alphamask-1; + loop(y, s->h) + { + uint *src = (uint *)srcrow; + loop(x, s->w) + { + int offset = x%8; + if(!offset) *++dst = 0; + if(*src & alpha) *dst |= 1<pitch; + } + SDL_FreeSurface(s); +} + +Texture *textureload(const char *name, int clamp, bool mipit, bool msg) +{ + string tname; + s_strcpy(tname, name); + Texture *t = textures.access(path(tname)); + if(t) return t; + bool compress = false; + SDL_Surface *s = texturedata(tname, NULL, msg, &compress); + return s ? newtexture(NULL, tname, s, clamp, mipit, false, false, compress) : notexture; +} + +void settexture(const char *name, bool clamp) +{ + glBindTexture(GL_TEXTURE_2D, textureload(name, clamp, true, false)->id); +} + +vector slots; +Slot materialslots[MATF_VOLUME+1]; + +int curtexnum = 0, curmatslot = -1; + +void texturereset() +{ + curtexnum = 0; + slots.setsize(0); +} + +COMMAND(texturereset, ""); + +void materialreset() +{ + loopi(MATF_VOLUME+1) materialslots[i].reset(); +} + +COMMAND(materialreset, ""); + +void texture(char *type, char *name, int *rot, int *xoffset, int *yoffset, float *scale) +{ + if(curtexnum<0 || curtexnum>=0x10000) return; + struct { const char *name; int type; } types[] = + { + {"c", TEX_DIFFUSE}, + {"u", TEX_UNKNOWN}, + {"d", TEX_DECAL}, + {"n", TEX_NORMAL}, + {"g", TEX_GLOW}, + {"s", TEX_SPEC}, + {"z", TEX_DEPTH}, + {"e", TEX_ENVMAP} + }; + int tnum = -1, matslot = findmaterial(type); + loopi(sizeof(types)/sizeof(types[0])) if(!strcmp(types[i].name, type)) { tnum = i; break; } + if(tnum<0) tnum = atoi(type); + if(tnum==TEX_DIFFUSE) + { + if(matslot>=0) curmatslot = matslot; + else { curmatslot = -1; curtexnum++; } + } + else if(curmatslot>=0) matslot=curmatslot; + else if(!curtexnum) return; + Slot &s = matslot>=0 ? materialslots[matslot] : (tnum!=TEX_DIFFUSE ? slots.last() : slots.add()); + s.loaded = false; + s.texmask |= 1<=8) conoutf(CON_WARN, "warning: too many textures in slot %d", curtexnum); + Slot::Tex &st = s.sts.add(); + st.type = tnum; + st.combined = -1; + st.t = NULL; + s_strcpy(st.name, name); + path(st.name); + if(tnum==TEX_DIFFUSE) + { + setslotshader(s); + s.rotation = clamp(*rot, 0, 5); + s.xoffset = max(*xoffset, 0); + s.yoffset = max(*yoffset, 0); + s.scale = *scale <= 0 ? 1 : *scale; + } +} + +COMMAND(texture, "ssiiif"); + +void autograss(char *name) +{ + Slot &s = slots.last(); + DELETEA(s.autograss); + s_sprintfd(pname)("packages/%s", name); + s.autograss = newstring(name[0] ? pname : "packages/textures/grass.png"); +} +COMMAND(autograss, "s"); + +void texscroll(float *scrollS, float *scrollT) +{ + if(slots.empty()) return; + Slot &s = slots.last(); + s.scrollS = *scrollS/1000.0f; + s.scrollT = *scrollT/1000.0f; +} +COMMAND(texscroll, "ff"); + +void texoffset_(int *xoffset, int *yoffset) +{ + if(slots.empty()) return; + Slot &s = slots.last(); + s.xoffset = max(*xoffset, 0); + s.yoffset = max(*yoffset, 0); +} +COMMANDN(texoffset, texoffset_, "ii"); + +void texrotate_(int *rot) +{ + if(slots.empty()) return; + Slot &s = slots.last(); + s.rotation = clamp(*rot, 0, 5); +} +COMMANDN(texrotate, texrotate_, "i"); + +void texscale(float *scale) +{ + if(slots.empty()) return; + Slot &s = slots.last(); + s.scale = *scale <= 0 ? 1 : *scale; +} +COMMAND(texscale, "f"); + +static int findtextype(Slot &s, int type, int last = -1) +{ + for(int i = last+1; ipixels; \ + loop(y, t->h) loop(x, t->w) \ + { \ + body; \ + dst += t->format->BytesPerPixel; \ + } \ + } + +#define sourcetex(s) uchar *src = &((uchar *)s->pixels)[s->format->BytesPerPixel*(y*s->w + x)]; + +static void addbump(SDL_Surface *c, SDL_Surface *n) +{ + writetex(c, + sourcetex(n); + loopk(3) dst[k] = int(dst[k])*(int(src[2])*2-255)/255; + ); +} + +static void addglow(SDL_Surface *c, SDL_Surface *g, const vec &glowcolor) +{ + writetex(c, + sourcetex(g); + loopk(3) dst[k] = clamp(int(dst[k]) + int(src[k]*glowcolor[k]), 0, 255); + ); +} + +static void blenddecal(SDL_Surface *c, SDL_Surface *d) +{ + writetex(c, + sourcetex(d); + uchar a = src[3]; + loopk(3) dst[k] = (int(src[k])*int(a) + int(dst[k])*int(255-a))/255; + ); +} + +static void mergespec(SDL_Surface *c, SDL_Surface *s) +{ + writetex(c, + sourcetex(s); + dst[3] = (int(src[0]) + int(src[1]) + int(src[2]))/3; + ); +} + +static void mergedepth(SDL_Surface *c, SDL_Surface *z) +{ + writetex(c, + sourcetex(z); + dst[3] = src[0]; + ); +} + +static void addname(vector &key, Slot &slot, Slot::Tex &t, bool combined = false, const char *prefix = NULL) +{ + if(combined) key.add('&'); + if(prefix) { while(*prefix) key.add(*prefix++); } + s_sprintfd(tname)("packages/%s", t.name); + for(const char *s = path(tname); *s; key.add(*s++)); +} + +static void texcombine(Slot &s, int index, Slot::Tex &t, bool forceload = false) +{ + if(renderpath==R_FIXEDFUNCTION && t.type!=TEX_DIFFUSE && t.type!=TEX_GLOW && !forceload) { t.t = notexture; return; } + vector key; + addname(key, s, t); + switch(t.type) + { + case TEX_DIFFUSE: + if(renderpath==R_FIXEDFUNCTION) + { + for(int i = -1; (i = findtextype(s, (1<=0;) + { + s.sts[i].combined = index; + addname(key, s, s.sts[i], true); + } + break; + } // fall through to shader case + + case TEX_NORMAL: + { + if(renderpath==R_FIXEDFUNCTION) break; + int i = findtextype(s, t.type==TEX_DIFFUSE ? (1<w!=ts->w || bs->h!=ts->h) bs = scalesurface(bs, ts->w, ts->h); + switch(b.type) + { + case TEX_DECAL: if(bs->format->BitsPerPixel==32) blenddecal(ts, bs); break; + case TEX_NORMAL: addbump(ts, bs); break; + } + SDL_FreeSurface(bs); + } + break; + } // fall through to shader case + + case TEX_NORMAL: + loopv(s.sts) + { + Slot::Tex &a = s.sts[i]; + if(a.combined!=index) continue; + SDL_Surface *as = texturedata(NULL, &a); + if(!as) break; + if(ts->format->BitsPerPixel!=32) ts = creatergbasurface(ts); + if(as->w!=ts->w || as->h!=ts->h) as = scalesurface(as, ts->w, ts->h); + switch(a.type) + { + case TEX_SPEC: mergespec(ts, as); break; + case TEX_DEPTH: mergedepth(ts, as); break; + } + SDL_FreeSurface(as); + break; // only one combination + } + break; + } + t.t = newtexture(NULL, key.getbuf(), ts, 0, true, true, true, compress); +} + +Slot dummyslot; + +Slot &lookuptexture(int slot, bool load) +{ + Slot &s = slot<0 && slot>=-MATF_VOLUME ? materialslots[-slot] : (slots.inrange(slot) ? slots[slot] : (slots.empty() ? dummyslot : slots[0])); + if(s.loaded || !load) return s; + loopv(s.sts) + { + Slot::Tex &t = s.sts[i]; + if(t.combined>=0) continue; + switch(t.type) + { + case TEX_ENVMAP: + if(hasCM && (renderpath!=R_FIXEDFUNCTION || (slot<0 && slot>=-MATF_VOLUME))) t.t = cubemapload(t.name); + break; + + default: + texcombine(s, i, t, slot<0 && slot>=-MATF_VOLUME); + break; + } + } + s.loaded = true; + return s; +} + +Shader *lookupshader(int slot) { return slot<0 && slot>=-MATF_VOLUME ? materialslots[-slot].shader : (slots.inrange(slot) ? slots[slot].shader : defaultshader); } + +Texture *loadthumbnail(Slot &slot) +{ + if(slot.thumbnail) return slot.thumbnail; + vector name; + addname(name, slot, slot.sts[0], false, ""); + int glow = -1; + if(slot.texmask&(1<= 0) + { + s_sprintfd(prefix)("", slot.glowcolor.x, slot.glowcolor.y, slot.glowcolor.z); + addname(name, slot, slot.sts[glow], true, prefix); + } + } + name.add('\0'); + Texture *t = textures.access(path(name.getbuf())); + if(t) slot.thumbnail = t; + else + { + SDL_Surface *s = texturedata(NULL, &slot.sts[0], false), *g = glow >= 0 ? texturedata(NULL, &slot.sts[glow], false) : NULL; + if(!s) slot.thumbnail = notexture; + else + { + int xs = s->w, ys = s->h; + if(s->w > 64 || s->h > 64) s = scalesurface(s, min(s->w, 64), min(s->h, 64)); + if(g) + { + if(g->w != s->w || g->h != s->h) g = scalesurface(g, s->w, s->h); + addglow(s, g, slot.glowcolor); + } + t = newtexture(NULL, name.getbuf(), s, 0, false, false, true); + t->xs = xs; + t->ys = ys; + slot.thumbnail = t; + } + if(g) SDL_FreeSurface(g); + } + return t; +} + +// environment mapped reflections + +cubemapside cubemapsides[6] = +{ + { GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, "lf", true, true, true }, + { GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, "rt", false, false, true }, + { GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, "ft", true, false, false }, + { GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, "bk", false, true, false }, + { GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, "dn", false, false, true }, + { GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, "up", false, false, true }, +}; + +GLuint cubemapfromsky(int size) +{ + extern Texture *sky[6]; + if(!sky[0]) return 0; + + int tsize = 0, cmw, cmh; + GLint tw[6], th[6]; + loopi(6) + { + glBindTexture(GL_TEXTURE_2D, sky[i]->id); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &tw[i]); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &th[i]); + tsize = max(tsize, (int)max(tw[i], th[i])); + } + cmw = cmh = min(tsize, size); + resizetexture(cmw, cmh, true, GL_RGB5, GL_TEXTURE_CUBE_MAP_ARB); + + GLuint tex; + glGenTextures(1, &tex); + int bufsize = 3*max(cmw, tsize)*max(cmh, tsize); + uchar *pixels = new uchar[2*bufsize], + *rpixels = &pixels[bufsize]; + loopi(6) + { + glBindTexture(GL_TEXTURE_2D, sky[i]->id); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels); + if(tw[i]!=cmw || th[i]!=cmh) gluScaleImage(GL_RGB, tw[i], th[i], GL_UNSIGNED_BYTE, pixels, cmw, cmh, GL_UNSIGNED_BYTE, pixels); + cubemapside &side = cubemapsides[i]; + reorienttexture(pixels, cmw, cmh, 3, rpixels, side.flipx, side.flipy, side.swapxy); + createtexture(!i ? tex : 0, cmw, cmh, rpixels, 3, true, GL_RGB5, side.target); + } + delete[] pixels; + return tex; +} + +Texture *cubemaploadwildcard(Texture *t, const char *name, bool mipit, bool msg) +{ + if(!hasCM) return NULL; + string tname; + if(!name) s_strcpy(tname, t->name); + else + { + s_strcpy(tname, name); + t = textures.access(path(tname)); + if(t) return t; + } + char *wildcard = strchr(tname, '*'); + SDL_Surface *surface[6]; + string sname; + if(!wildcard) s_strcpy(sname, tname); + GLenum format = 0; + int tsize = 0; + bool compress = false; + loopi(6) + { + if(wildcard) + { + s_strncpy(sname, tname, wildcard-tname+1); + s_strcat(sname, cubemapsides[i].name); + s_strcat(sname, wildcard+1); + } + surface[i] = texturedata(sname, NULL, msg, &compress); + if(!surface[i]) + { + loopj(i) SDL_FreeSurface(surface[j]); + return NULL; + } + if(!format) format = texformat(surface[i]->format->BitsPerPixel); + else if(texformat(surface[i]->format->BitsPerPixel)!=format) + { + if(surface[i] && msg) conoutf(CON_ERROR, "cubemap texture %s doesn't match other sides' format", sname); + loopj(i) SDL_FreeSurface(surface[j]); + return NULL; + } + tsize = max(tsize, max(surface[i]->w, surface[i]->h)); + } + if(name) + { + char *key = newstring(tname); + t = &textures[key]; + t->name = key; + } + t->bpp = surface[0]->format->BitsPerPixel; + t->mipmap = mipit; + t->clamp = 3; + t->type = Texture::CUBEMAP; + t->w = t->xs = tsize; + t->h = t->ys = tsize; + resizetexture(t->w, t->h, mipit, format, GL_TEXTURE_CUBE_MAP_ARB); + glGenTextures(1, &t->id); + uchar *pixels = NULL; + loopi(6) + { + cubemapside &side = cubemapsides[i]; + SDL_Surface *s = texreorient(surface[i], side.flipx, side.flipy, side.swapxy); + if(s->w != t->w || s->h != t->h) + { + if(!pixels) pixels = new uchar[formatsize(format)*t->w*t->h]; + gluScaleImage(format, s->w, s->h, GL_UNSIGNED_BYTE, s->pixels, t->w, t->h, GL_UNSIGNED_BYTE, pixels); + } + createtexture(!i ? t->id : 0, t->w, t->h, s->w != t->w || s->h != t->h ? pixels : s->pixels, 3, mipit, format, side.target, compress); + SDL_FreeSurface(s); + } + if(pixels) delete[] pixels; + return t; +} + +Texture *cubemapload(const char *name, bool mipit, bool msg) +{ + if(!hasCM) return NULL; + string pname; + s_strcpy(pname, makerelpath("packages", name)); + path(pname); + Texture *t = NULL; + if(!strchr(pname, '*')) + { + s_sprintfd(jpgname)("%s_*.jpg", pname); + t = cubemaploadwildcard(NULL, jpgname, mipit, false); + if(!t) + { + s_sprintfd(pngname)("%s_*.png", pname); + t = cubemaploadwildcard(NULL, pngname, mipit, false); + if(!t && msg) conoutf(CON_ERROR, "could not load envmap %s", name); + } + } + else t = cubemaploadwildcard(NULL, pname, mipit, msg); + return t; +} + +VARFP(envmapsize, 4, 7, 9, setupmaterials()); +VAR(envmapradius, 0, 128, 10000); + +struct envmap +{ + int radius, size; + vec o; + GLuint tex; +}; + +static vector envmaps; +static GLuint skyenvmap = 0; + +void clearenvmaps() +{ + if(skyenvmap) + { + glDeleteTextures(1, &skyenvmap); + skyenvmap = 0; + } + loopv(envmaps) glDeleteTextures(1, &envmaps[i].tex); + envmaps.setsize(0); +} + +VAR(aaenvmap, 0, 2, 4); + +GLuint genenvmap(const vec &o, int envmapsize) +{ + int rendersize = 1<<(envmapsize+aaenvmap), sizelimit = min(hwcubetexsize, min(screen->w, screen->h)); + if(maxtexsize) sizelimit = min(sizelimit, maxtexsize); + while(rendersize > sizelimit) rendersize /= 2; + int texsize = min(rendersize, 1<w, screen->h); + clientkeepalive(); + return tex; +} + +void initenvmaps() +{ + if(!hasCM) return; + clearenvmaps(); + skyenvmap = cubemapfromsky(1< &ents = et->getents(); + loopv(ents) + { + const extentity &ent = *ents[i]; + if(ent.type != ET_ENVMAP) continue; + envmap &em = envmaps.add(); + em.radius = ent.attr1 ? max(0, min(10000, int(ent.attr1))) : envmapradius; + em.size = ent.attr2 ? max(4, min(9, int(ent.attr2))) : 0; + em.o = ent.o; + em.tex = 0; + } +} + +void genenvmaps() +{ + if(envmaps.empty()) return; + show_out_of_renderloop_progress(0, "generating environment maps..."); + loopv(envmaps) + { + envmap &em = envmaps[i]; + em.tex = genenvmap(em.o, em.size ? em.size : envmapsize); + } +} + +ushort closestenvmap(const vec &o) +{ + ushort minemid = EMID_SKY; + float mindist = 1e16f; + loopv(envmaps) + { + envmap &em = envmaps[i]; + float dist = em.o.dist(o); + if(dist < em.radius && dist < mindist) + { + minemid = EMID_RESERVED + i; + mindist = dist; + } + } + return minemid; +} + +ushort closestenvmap(int orient, int x, int y, int z, int size) +{ + vec loc(x, y, z); + int dim = dimension(orient); + if(dimcoord(orient)) loc[dim] += size; + loc[R[dim]] += size/2; + loc[C[dim]] += size/2; + return closestenvmap(loc); +} + +GLuint lookupenvmap(Slot &slot) +{ + loopv(slot.sts) if(slot.sts[i].type==TEX_ENVMAP && slot.sts[i].t) return slot.sts[i].t->id; + return skyenvmap; +} + +GLuint lookupenvmap(ushort emid) +{ + if(emid==EMID_SKY || emid==EMID_CUSTOM) return skyenvmap; + if(emid==EMID_NONE || !envmaps.inrange(emid-EMID_RESERVED)) return 0; + GLuint tex = envmaps[emid-EMID_RESERVED].tex; + return tex ? tex : skyenvmap; +} + +void writetgaheader(FILE *f, SDL_Surface *s, int bits) +{ + fwrite("\0\0\x02\0\0\0\0\0\0\0\0\0", 1, 12, f); + ushort dim[] = { s->w, s->h }; + endianswap(dim, sizeof(ushort), 2); + fwrite(dim, sizeof(short), 2, f); + fputc(bits, f); + fputc(0, f); +} + +void flipnormalmapy(char *destfile, char *normalfile) // RGB (jpg/png) -> BGR (tga) +{ + SDL_Surface *ns = IMG_Load(findfile(path(normalfile), "rb")); + if(!ns) return; + FILE *f = openfile(path(destfile), "wb"); + if(f) + { + writetgaheader(f, ns, 24); + for(int y = ns->h-1; y>=0; y--) loop(x, ns->w) + { + uchar *nd = (uchar *)ns->pixels+(x+y*ns->w)*3; + fputc(nd[2], f); + fputc(255-nd[1], f); + fputc(nd[0], f); + } + fclose(f); + } + if(ns) SDL_FreeSurface(ns); +} + +void mergenormalmaps(char *heightfile, char *normalfile) // BGR (tga) -> BGR (tga) (SDL loads TGA as BGR!) +{ + SDL_Surface *hs = IMG_Load(findfile(path(heightfile), "rb")); + SDL_Surface *ns = IMG_Load(findfile(path(normalfile), "rb")); + if(hs && ns) + { + uchar def_n[] = { 255, 128, 128 }; + FILE *f = openfile(normalfile, "wb"); + if(f) + { + writetgaheader(f, ns, 24); + for(int y = ns->h-1; y>=0; y--) loop(x, ns->w) + { + int off = (x+y*ns->w)*3; + uchar *hd = hs ? (uchar *)hs->pixels+off : def_n; + uchar *nd = ns ? (uchar *)ns->pixels+off : def_n; + #define S(x) x/255.0f*2-1 + vec n(S(nd[0]), S(nd[1]), S(nd[2])); + vec h(S(hd[0]), S(hd[1]), S(hd[2])); + n.mul(2).add(h).normalize().add(1).div(2).mul(255); + uchar o[3] = { (uchar)n.x, (uchar)n.y, (uchar)n.z }; + fwrite(o, 3, 1, f); + #undef S + } + fclose(f); + } + } + if(hs) SDL_FreeSurface(hs); + if(ns) SDL_FreeSurface(ns); +} + +COMMAND(flipnormalmapy, "ss"); +COMMAND(mergenormalmaps, "sss"); + +void cleanuptextures() +{ + clearenvmaps(); + loopv(slots) slots[i].cleanup(); + loopi(MATF_VOLUME+1) materialslots[i].cleanup(); + vector transient; + enumerate(textures, Texture, tex, + DELETEA(tex.alphamask); + if(tex.id) { glDeleteTextures(1, &tex.id); tex.id = 0; } + if(tex.type==Texture::TRANSIENT) transient.add(&tex); + ); + loopv(transient) textures.remove(transient[i]->name); +} + +bool reloadtexture(const char *name) +{ + Texture *t = textures.access(path(name, true)); + if(t) return reloadtexture(*t); + return false; +} + +bool reloadtexture(Texture &tex) +{ + if(tex.id) return true; + switch(tex.type) + { + case Texture::STUB: + case Texture::IMAGE: + { + bool compress = false; + SDL_Surface *s = texturedata(tex.name, NULL, true, &compress); + if(!s || !newtexture(&tex, NULL, s, tex.clamp, tex.mipmap, false, false, compress)) return false; + break; + } + + case Texture::CUBEMAP: + if(!cubemaploadwildcard(&tex, NULL, tex.mipmap, true)) return false; + break; + } + return true; +} + +void reloadtex(char *name) +{ + Texture *t = textures.access(path(name, true)); + if(!t) { conoutf("texture %s is not loaded", name); return; } + if(t->type==Texture::TRANSIENT) { conoutf("can't reload transient texture %s", name); return; } + DELETEA(t->alphamask); + Texture oldtex = *t; + t->id = 0; + if(!reloadtexture(*t)) + { + if(t->id) glDeleteTextures(1, &t->id); + *t = oldtex; + conoutf("failed to reload texture %s", name); + } +} + +COMMAND(reloadtex, "s"); + +void reloadtextures() +{ + enumerate(textures, Texture, tex, reloadtexture(tex)); +} + diff --git a/src/engine/texture.h b/src/engine/texture.h new file mode 100644 index 0000000..9a9d961 --- /dev/null +++ b/src/engine/texture.h @@ -0,0 +1,311 @@ +// GL_ARB_vertex_program, GL_ARB_fragment_program +extern PFNGLGENPROGRAMSARBPROC glGenPrograms_; +extern PFNGLDELETEPROGRAMSARBPROC glDeletePrograms_; +extern PFNGLBINDPROGRAMARBPROC glBindProgram_; +extern PFNGLPROGRAMSTRINGARBPROC glProgramString_; +extern PFNGLGETPROGRAMIVARBPROC glGetProgramiv_; +extern PFNGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4f_; +extern PFNGLPROGRAMENVPARAMETER4FVARBPROC glProgramEnvParameter4fv_; +extern PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArray_; +extern PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArray_; +extern PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointer_; + +// GL_EXT_gpu_program_parameters +#ifndef GL_EXT_gpu_program_parameters +#define GL_EXT_gpu_program_parameters 1 +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +#endif + +extern PFNGLPROGRAMENVPARAMETERS4FVEXTPROC glProgramEnvParameters4fv_; +extern PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC glProgramLocalParameters4fv_; + +// GL_ARB_shading_language_100, GL_ARB_shader_objects, GL_ARB_fragment_shader, GL_ARB_vertex_shader +extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObject_; +extern PFNGLDELETEOBJECTARBPROC glDeleteObject_; +extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObject_; +extern PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObject_; +extern PFNGLSHADERSOURCEARBPROC glShaderSource_; +extern PFNGLCOMPILESHADERARBPROC glCompileShader_; +extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameteriv_; +extern PFNGLATTACHOBJECTARBPROC glAttachObject_; +extern PFNGLGETINFOLOGARBPROC glGetInfoLog_; +extern PFNGLLINKPROGRAMARBPROC glLinkProgram_; +extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocation_; +extern PFNGLUNIFORM4FVARBPROC glUniform4fv_; +extern PFNGLUNIFORM1IARBPROC glUniform1i_; + +extern int renderpath; + +enum { R_FIXEDFUNCTION = 0, R_ASMSHADER, R_GLSLANG }; + +enum { SHPARAM_VERTEX = 0, SHPARAM_PIXEL, SHPARAM_UNIFORM }; + +#define RESERVEDSHADERPARAMS 16 +#define MAXSHADERPARAMS 8 + +struct ShaderParam +{ + const char *name; + int type, index, loc; + float val[4]; +}; + +struct LocalShaderParamState : ShaderParam +{ + float curval[4]; + + LocalShaderParamState() + { + memset(curval, 0, sizeof(curval)); + } + LocalShaderParamState(const ShaderParam &p) : ShaderParam(p) + { + memset(curval, 0, sizeof(curval)); + } +}; + +struct ShaderParamState +{ + enum + { + CLEAN = 0, + INVALID, + DIRTY + }; + + const char *name; + float val[4]; + bool local; + int dirty; + + ShaderParamState() + : name(NULL), local(false), dirty(INVALID) + { + memset(val, 0, sizeof(val)); + } +}; + +enum +{ + SHADER_INVALID = -1, + + SHADER_DEFAULT = 0, + SHADER_NORMALSLMS = 1<<0, + SHADER_ENVMAP = 1<<1, + SHADER_GLSLANG = 1<<2 +}; + +#define MAXSHADERDETAIL 3 +#define MAXVARIANTROWS 5 + +extern int shaderdetail; + +struct Slot; + +struct Shader +{ + static Shader *lastshader; + + char *name, *vsstr, *psstr; + int type; + GLuint vs, ps; + GLhandleARB program, vsobj, psobj; + vector defaultparams; + Shader *variantshader, *altshader, *fastshader[MAXSHADERDETAIL]; + vector variants[MAXVARIANTROWS]; + bool standard, used, native; + Shader *reusevs, *reuseps; + int numextparams; + LocalShaderParamState *extparams; + uchar *extvertparams, *extpixparams; + + + Shader() : name(NULL), vsstr(NULL), psstr(NULL), type(SHADER_DEFAULT), vs(0), ps(0), program(0), vsobj(0), psobj(0), variantshader(NULL), altshader(NULL), standard(false), used(false), native(true), reusevs(NULL), reuseps(NULL), numextparams(0), extparams(NULL), extvertparams(NULL), extpixparams(NULL) + {} + + ~Shader() + { + DELETEA(name); + DELETEA(vsstr); + DELETEA(psstr); + DELETEA(extparams); + DELETEA(extvertparams); + extpixparams = NULL; + } + + void allocenvparams(Slot *slot = NULL); + void flushenvparams(Slot *slot = NULL); + void setslotparams(Slot &slot); + void bindprograms(); + + Shader *hasvariant(int col, int row = 0) + { + if(!this || renderpath==R_FIXEDFUNCTION) return NULL; + Shader *s = shaderdetail < MAXSHADERDETAIL ? fastshader[shaderdetail] : this; + return row>=0 && rowvariants[row].inrange(col) ? s->variants[row][col] : NULL; + } + + Shader *variant(int col, int row = 0) + { + if(!this || renderpath==R_FIXEDFUNCTION) return this; + Shader *s = shaderdetail < MAXSHADERDETAIL ? fastshader[shaderdetail] : this; + return row>=0 && rowvariants[row].inrange(col) ? s->variants[row][col] : s; + } + + void set(Slot *slot = NULL) + { + if(!this || renderpath==R_FIXEDFUNCTION) return; + if(this!=lastshader) + { + if(shaderdetail < MAXSHADERDETAIL) fastshader[shaderdetail]->bindprograms(); + else bindprograms(); + } + lastshader->flushenvparams(slot); + if(slot) lastshader->setslotparams(*slot); + } + + bool compile(); + void cleanup(bool invalid = false); +}; + +#define SETSHADER(name) \ + do { \ + static Shader *name##shader = NULL; \ + if(!name##shader) name##shader = lookupshaderbyname(#name); \ + name##shader->set(); \ + } while(0) + +// management of texture slots +// each texture slot can have multiple texture frames, of which currently only the first is used +// additional frames can be used for various shaders + +struct Texture +{ + enum + { + STUB, + TRANSIENT, + IMAGE, + CUBEMAP + }; + + char *name; + int type, w, h, xs, ys, bpp, clamp; + bool mipmap, canreduce; + GLuint id; + uchar *alphamask; + + Texture() : alphamask(NULL) {} +}; + +enum +{ + TEX_DIFFUSE = 0, + TEX_UNKNOWN, + TEX_DECAL, + TEX_NORMAL, + TEX_GLOW, + TEX_SPEC, + TEX_DEPTH, + TEX_ENVMAP +}; + +struct Slot +{ + struct Tex + { + int type; + Texture *t; + string name; + int combined; + }; + + vector sts; + Shader *shader; + vector params; + float scale; + int rotation, xoffset, yoffset; + float scrollS, scrollT; + vec glowcolor, pulseglowcolor; + float pulseglowspeed; + bool mtglowed, loaded; + uint texmask; + char *autograss; + Texture *grasstex, *thumbnail; + + Slot() : autograss(NULL) { reset(); } + + void reset() + { + sts.setsize(0); + shader = NULL; + params.setsize(0); + scale = 1; + rotation = xoffset = yoffset = 0; + scrollS = scrollT = 0; + glowcolor = vec(1, 1, 1); + pulseglowcolor = vec(0, 0, 0); + pulseglowspeed = 0; + loaded = false; + texmask = 0; + DELETEA(autograss); + grasstex = NULL; + thumbnail = NULL; + } + + void cleanup() + { + loaded = false; + grasstex = NULL; + thumbnail = NULL; + loopv(sts) + { + Tex &t = sts[i]; + t.t = NULL; + t.combined = -1; + } + } +}; + +struct cubemapside +{ + GLenum target; + const char *name; + bool flipx, flipy, swapxy; +}; + +extern cubemapside cubemapsides[6]; +extern Texture *notexture; +extern Shader *defaultshader, *rectshader, *notextureshader, *nocolorshader, *foggedshader, *foggednotextureshader, *stdworldshader; +extern int reservevpparams, maxvpenvparams, maxvplocalparams, maxfpenvparams, maxfplocalparams; + +extern Shader *lookupshaderbyname(const char *name); +extern Texture *loadthumbnail(Slot &slot); +extern void setslotshader(Slot &s); +extern void setenvparamf(const char *name, int type, int index, float x = 0, float y = 0, float z = 0, float w = 0); +extern void setenvparamfv(const char *name, int type, int index, const float *v); +extern void flushenvparamf(const char *name, int type, int index, float x = 0, float y = 0, float z = 0, float w = 0); +extern void flushenvparamfv(const char *name, int type, int index, const float *v); +extern void setlocalparamf(const char *name, int type, int index, float x = 0, float y = 0, float z = 0, float w = 0); +extern void setlocalparamfv(const char *name, int type, int index, const float *v); +extern void invalidateenvparams(int type, int start, int count); +extern ShaderParam *findshaderparam(Slot &s, const char *name, int type, int index); + +extern int maxtmus, nolights, nowater, nomasks; + +extern void inittmus(); +extern void resettmu(int n); +extern void scaletmu(int n, int rgbscale, int alphascale = 0); +extern void colortmu(int n, float r = 0, float g = 0, float b = 0, float a = 0); +extern void setuptmu(int n, const char *rgbfunc = NULL, const char *alphafunc = NULL); + +#define MAXDYNLIGHTS 5 +#define DYNLIGHTBITS 6 +#define DYNLIGHTMASK ((1<numframes]; + memcpy(m.verts, verts, numverts*((vertmeshgroup *)group)->numframes*sizeof(vert)); + m.tcverts = new tcvert[numverts]; + memcpy(m.tcverts, tcverts, numverts*sizeof(tcvert)); + m.numtris = numtris; + m.tris = new tri[numtris]; + memcpy(m.tris, tris, numtris*sizeof(tri)); + if(bumpverts) + { + m.bumpverts = new bumpvert[numverts]; + memcpy(m.bumpverts, bumpverts, numverts*sizeof(bumpvert)); + } + else m.bumpverts = NULL; + return &m; + } + + void scaleverts(const vec &transdiff, float scalediff) + { + loopi(((vertmeshgroup *)group)->numframes*numverts) verts[i].pos.add(transdiff).mul(scalediff); + } + + void calctangents() + { + if(bumpverts) return; + vec *tangent = new vec[2*numverts], *bitangent = tangent+numverts; + memset(tangent, 0, 2*numverts*sizeof(vec)); + bumpverts = new bumpvert[((vertmeshgroup *)group)->numframes*numverts]; + loopk(((vertmeshgroup *)group)->numframes) + { + vert *fverts = &verts[k*numverts]; + loopi(numtris) + { + const tri &t = tris[i]; + const tcvert &tc0 = tcverts[t.vert[0]], + &tc1 = tcverts[t.vert[1]], + &tc2 = tcverts[t.vert[2]]; + + vec v0(fverts[t.vert[0]].pos), + e1(fverts[t.vert[1]].pos), + e2(fverts[t.vert[2]].pos); + e1.sub(v0); + e2.sub(v0); + + float u1 = tc1.u - tc0.u, v1 = tc1.v - tc0.v, + u2 = tc2.u - tc0.u, v2 = tc2.v - tc0.v, + scale = u1*v2 - u2*v1; + if(scale!=0) scale = 1.0f / scale; + vec u(e1), v(e2); + u.mul(v2).sub(vec(e2).mul(v1)).mul(scale); + v.mul(u1).sub(vec(e1).mul(u2)).mul(scale); + + loopj(3) + { + tangent[t.vert[j]].add(u); + bitangent[t.vert[j]].add(v); + } + } + bumpvert *fbumpverts = &bumpverts[k*numverts]; + loopi(numverts) + { + const vec &n = fverts[i].norm, + &t = tangent[i], + &bt = bitangent[i]; + bumpvert &bv = fbumpverts[i]; + (bv.tangent = t).sub(vec(n).mul(n.dot(t))).normalize(); + bv.bitangent = vec().cross(n, t).dot(bt) < 0 ? -1 : 1; + } + } + delete[] tangent; + } + + void calcbb(int frame, vec &bbmin, vec &bbmax, const matrix3x4 &m) + { + vert *fverts = &verts[frame*numverts]; + loopj(numverts) + { + vec v = m.transform(fverts[j].pos); + loopi(3) + { + bbmin[i] = min(bbmin[i], v[i]); + bbmax[i] = max(bbmax[i], v[i]); + } + } + } + + void gentris(int frame, Texture *tex, vector *out, const matrix3x4 &m) + { + vert *fverts = &verts[frame*numverts]; + loopj(numtris) + { + BIH::tri &t = out[noclip ? 1 : 0].add(); + t.tex = tex->bpp==32 ? tex : NULL; + t.a = m.transform(fverts[tris[j].vert[0]].pos); + t.b = m.transform(fverts[tris[j].vert[1]].pos); + t.c = m.transform(fverts[tris[j].vert[2]].pos); + tcvert &av = tcverts[tris[j].vert[0]], + &bv = tcverts[tris[j].vert[1]], + &cv = tcverts[tris[j].vert[2]]; + t.tc[0] = av.u; + t.tc[1] = av.v; + t.tc[2] = bv.u; + t.tc[3] = bv.v; + t.tc[4] = cv.u; + t.tc[5] = cv.v; + } + } + + static inline bool comparevert(vvertff &w, int j, tcvert &tc, vert &v) + { + return tc.u==w.u && tc.v==w.v && v.pos==w.pos; + } + + static inline bool comparevert(vvert &w, int j, tcvert &tc, vert &v) + { + return tc.u==w.u && tc.v==w.v && v.pos==w.pos && v.norm==w.norm; + } + + inline bool comparevert(vvertbump &w, int j, tcvert &tc, vert &v) + { + return tc.u==w.u && tc.v==w.v && v.pos==w.pos && v.norm==w.norm && (!bumpverts || (bumpverts[j].tangent==w.tangent && bumpverts[j].bitangent==w.bitangent)); + } + + static inline void assignvert(vvertff &vv, int j, tcvert &tc, vert &v) + { + vv.pos = v.pos; + vv.u = tc.u; + vv.v = tc.v; + } + + static inline void assignvert(vvert &vv, int j, tcvert &tc, vert &v) + { + vv.pos = v.pos; + vv.norm = v.norm; + vv.u = tc.u; + vv.v = tc.v; + } + + inline void assignvert(vvertbump &vv, int j, tcvert &tc, vert &v) + { + vv.pos = v.pos; + vv.norm = v.norm; + vv.u = tc.u; + vv.v = tc.v; + if(bumpverts) + { + vv.tangent = bumpverts[j].tangent; + vv.bitangent = bumpverts[j].bitangent; + } + } + + template + int genvbo(vector &idxs, int offset, vector &vverts) + { + voffset = offset; + eoffset = idxs.length(); + minvert = 0xFFFF; + loopi(numtris) + { + tri &t = tris[i]; + loopj(3) + { + int index = t.vert[j]; + tcvert &tc = tcverts[index]; + vert &v = verts[index]; + loopvk(vverts) + { + if(comparevert(vverts[k], index, tc, v)) { minvert = min(minvert, (ushort)k); idxs.add((ushort)k); goto found; } + } + idxs.add(vverts.length()); + assignvert(vverts.add(), index, tc, v); + found:; + } + } + minvert = min(minvert, ushort(voffset)); + maxvert = max(minvert, ushort(vverts.length()-1)); + elen = idxs.length()-eoffset; + return vverts.length()-voffset; + } + + int genvbo(vector &idxs, int offset) + { + voffset = offset; + eoffset = idxs.length(); + loopi(numtris) + { + tri &t = tris[i]; + loopj(3) idxs.add(voffset+t.vert[j]); + } + minvert = voffset; + maxvert = voffset + numverts-1; + elen = idxs.length()-eoffset; + return numverts; + } + + void filltc(uchar *vdata, size_t stride) + { + vdata = (uchar *)&((vvertff *)&vdata[voffset*stride])->u; + loopi(numverts) + { + *(tcvert *)vdata = tcverts[i]; + vdata += stride; + } + } + + void interpverts(const animstate &as, bool norms, bool tangents, void *vdata, skin &s) + { + vert *vert1 = &verts[as.cur.fr1 * numverts], + *vert2 = &verts[as.cur.fr2 * numverts], + *pvert1 = as.interp<1 ? &verts[as.prev.fr1 * numverts] : NULL, + *pvert2 = as.interp<1 ? &verts[as.prev.fr2 * numverts] : NULL; + #define ip(p1, p2, t) (p1+t*(p2-p1)) + #define ip_v(p, c, t) ip(p##1[i].c, p##2[i].c, t) + #define ip_v_ai(c) ip(ip_v(pvert, c, as.prev.t), ip_v(vert, c, as.cur.t), as.interp) + #define ip_pos vec(ip_v(vert, pos.x, as.cur.t), ip_v(vert, pos.y, as.cur.t), ip_v(vert, pos.z, as.cur.t)) + #define ip_pos_ai vec(ip_v_ai(pos.x), ip_v_ai(pos.y), ip_v_ai(pos.z)) + #define ip_norm vec(ip_v(vert, norm.x, as.cur.t), ip_v(vert, norm.y, as.cur.t), ip_v(vert, norm.z, as.cur.t)) + #define ip_norm_ai vec(ip_v_ai(norm.x), ip_v_ai(norm.y), ip_v_ai(norm.z)) + #define ip_b_ai(c) ip(ip_v(bpvert, c, as.prev.t), ip_v(bvert, c, as.cur.t), as.interp) + #define ip_tangent vec(ip_v(bvert, tangent.x, as.cur.t), ip_v(bvert, tangent.y, as.cur.t), ip_v(bvert, tangent.z, as.cur.t)) + #define ip_tangent_ai vec(ip_b_ai(tangent.x), ip_b_ai(tangent.y), ip_b_ai(tangent.z)) + #define iploop(type, body) \ + loopi(numverts) \ + { \ + type &v = ((type *)vdata)[i]; \ + body; \ + } + if(tangents) + { + bumpvert *bvert1 = &bumpverts[as.cur.fr1 * numverts], + *bvert2 = &bumpverts[as.cur.fr2 * numverts], + *bpvert1 = as.interp<1 ? &bumpverts[as.prev.fr1 * numverts] : NULL, + *bpvert2 = as.interp<1 ? &bumpverts[as.prev.fr2 * numverts] : NULL; + if(as.interp<1) iploop(vvertbump, { v.pos = ip_pos_ai; v.norm = ip_norm_ai; v.tangent = ip_tangent_ai; v.bitangent = bvert1[i].bitangent; }) + else iploop(vvertbump, { v.pos = ip_pos; v.norm = ip_norm; v.tangent = ip_tangent; v.bitangent = bvert1[i].bitangent; }) + } + else if(norms) + { + if(as.interp<1) iploop(vvert, { v.pos = ip_pos_ai; v.norm = ip_norm_ai; }) + else iploop(vvert, { v.pos = ip_pos; v.norm = ip_norm; }) + } + else if(as.interp<1) iploop(vvertff, v.pos = ip_pos_ai) + else iploop(vvertff, v.pos = ip_pos) + #undef iploop + #undef ip + #undef ip_v + #undef ip_v_ai + #undef ip_pos + #undef ip_pos_ai + #undef ip_norm + #undef ip_norm_ai + #undef ip_b_ai + #undef ip_tangent + #undef ip_tangent_ai + } + + void render(const animstate *as, skin &s, vbocacheentry &vc) + { + s.bind(this, as); + + if(!(as->anim&ANIM_NOSKIN)) + { + if(s.multitextured()) + { + if(!enablemtc || lastmtcbuf!=lastvbuf) + { + glClientActiveTexture_(GL_TEXTURE1_ARB); + if(!enablemtc) glEnableClientState(GL_TEXTURE_COORD_ARRAY); + if(lastmtcbuf!=lastvbuf) + { + vvertff *vverts = hasVBO ? 0 : (vvertff *)vc.vdata; + glTexCoordPointer(2, GL_FLOAT, ((vertmeshgroup *)group)->vertsize, &vverts->u); + } + glClientActiveTexture_(GL_TEXTURE0_ARB); + lastmtcbuf = lastvbuf; + enablemtc = true; + } + } + else if(enablemtc) disablemtc(); + + if(s.tangents()) + { + if(!enabletangents || lastnbuf!=lastvbuf) + { + if(!enabletangents) glEnableVertexAttribArray_(1); + if(lastnbuf!=lastvbuf) + { + vvertbump *vverts = hasVBO ? 0 : (vvertbump *)vc.vdata; + glVertexAttribPointer_(1, 4, GL_FLOAT, GL_FALSE, ((vertmeshgroup *)group)->vertsize, &vverts->tangent.x); + } + lastnbuf = lastvbuf; + enabletangents = true; + } + } + else if(enabletangents) disabletangents(); + + if(renderpath==R_FIXEDFUNCTION && (s.scrollu || s.scrollv)) + { + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glTranslatef(s.scrollu*lastmillis/1000.0f, s.scrollv*lastmillis/1000.0f, 0); + + if(s.multitextured()) + { + glActiveTexture_(GL_TEXTURE1_ARB); + glPushMatrix(); + glTranslatef(s.scrollu*lastmillis/1000.0f, s.scrollv*lastmillis/1000.0f, 0); + } + } + } + + if(hasDRE) glDrawRangeElements_(GL_TRIANGLES, minvert, maxvert, elen, GL_UNSIGNED_SHORT, &((vertmeshgroup *)group)->edata[eoffset]); + else glDrawElements(GL_TRIANGLES, elen, GL_UNSIGNED_SHORT, &((vertmeshgroup *)group)->edata[eoffset]); + glde++; + xtravertsva += numverts; + + if(renderpath==R_FIXEDFUNCTION && !(as->anim&ANIM_NOSKIN) && (s.scrollu || s.scrollv)) + { + if(s.multitextured()) + { + glPopMatrix(); + glActiveTexture_(GL_TEXTURE0_ARB); + } + + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + } + + return; + } + }; + + struct tag + { + char *name; + matrix3x4 transform; + + tag() : name(NULL) {} + ~tag() { DELETEA(name); } + }; + + struct vertmeshgroup : meshgroup + { + int numframes; + tag *tags; + int numtags; + + static const int MAXVBOCACHE = 16; + vbocacheentry vbocache[MAXVBOCACHE]; + + ushort *edata; + GLuint ebuf; + bool vnorms, vtangents; + int vlen, vertsize; + uchar *vdata; + + vertmeshgroup() : numframes(0), tags(NULL), numtags(0), edata(NULL), ebuf(0), vdata(NULL) + { + } + + virtual ~vertmeshgroup() + { + DELETEA(tags); + if(ebuf) glDeleteBuffers_(1, &ebuf); + loopi(MAXVBOCACHE) + { + DELETEA(vbocache[i].vdata); + if(vbocache[i].vbuf) glDeleteBuffers_(1, &vbocache[i].vbuf); + } + DELETEA(vdata); + } + + int findtag(const char *name) + { + loopi(numtags) if(!strcmp(tags[i].name, name)) return i; + return -1; + } + + virtual meshgroup *allocate() { return new vertmeshgroup; } + + meshgroup *copy() + { + vertmeshgroup &group = *(vertmeshgroup *)meshgroup::copy(); + group.numframes = numframes; + group.numtags = numtags; + group.tags = new tag[numframes*numtags]; + memcpy(group.tags, tags, numframes*numtags*sizeof(tag)); + loopi(numframes*numtags) if(group.tags[i].name) group.tags[i].name = newstring(group.tags[i].name); + return &group; + } + + int totalframes() const { return numframes; } + + void scaletags(const vec &transdiff, float scalediff) + { + loopi(numframes*numtags) + { + matrix3x4 &m = tags[i].transform; + m.X.w = (m.X.w+transdiff.x)*scalediff; + m.Y.w = (m.Y.w+transdiff.y)*scalediff; + m.Z.w = (m.Z.w+transdiff.z)*scalediff; + } + } + + void concattagtransform(int frame, int i, const matrix3x4 &m, matrix3x4 &n) + { + n.mul(m, tags[frame*numtags + i].transform); + } + + void calctagmatrix(int i, const animstate &as, GLfloat *matrix) + { + const matrix3x4 &tag1 = tags[as.cur.fr1*numtags + i].transform, + &tag2 = tags[as.cur.fr2*numtags + i].transform; + #define ip(p1, p2, t) (p1+t*(p2-p1)) + #define ip_ai_tag(c) ip( ip( tag1p.c, tag2p.c, as.prev.t), ip( tag1.c, tag2.c, as.cur.t), as.interp) + if(as.interp<1) + { + const matrix3x4 &tag1p = tags[as.prev.fr1*numtags + i].transform, + &tag2p = tags[as.prev.fr2*numtags + i].transform; + loopj(4) + { + matrix[4*j+0] = ip_ai_tag(X[j]); + matrix[4*j+1] = ip_ai_tag(Y[j]); + matrix[4*j+2] = ip_ai_tag(Z[j]); + } + } + else loopj(4) + { + matrix[4*j+0] = ip(tag1.X[j], tag2.X[j], as.cur.t); + matrix[4*j+1] = ip(tag1.Y[j], tag2.Y[j], as.cur.t); + matrix[4*j+2] = ip(tag1.Z[j], tag2.Z[j], as.cur.t); + } + #undef ip_ai_tag + #undef ip + matrix[3] = matrix[7] = matrix[11] = 0.0f; + matrix[15] = 1.0f; + } + + void genvbo(bool norms, bool tangents, vbocacheentry &vc) + { + if(hasVBO) + { + if(!vc.vbuf) glGenBuffers_(1, &vc.vbuf); + if(ebuf) return; + } + else if(edata) + { + #define ALLOCVDATA(vdata) \ + do \ + { \ + DELETEA(vdata); \ + vdata = new uchar[vlen*vertsize]; \ + loopv(meshes) ((vertmesh *)meshes[i])->filltc(vdata, vertsize); \ + } while(0) + if(!vc.vdata) ALLOCVDATA(vc.vdata); + return; + } + + vector idxs; + + vnorms = norms; + vtangents = tangents; + vertsize = tangents ? sizeof(vvertbump) : (norms ? sizeof(vvert) : sizeof(vvertff)); + vlen = 0; + if(numframes>1) + { + loopv(meshes) vlen += ((vertmesh *)meshes[i])->genvbo(idxs, vlen); + DELETEA(vdata); + if(hasVBO) ALLOCVDATA(vdata); + else ALLOCVDATA(vc.vdata); + } + else + { + if(hasVBO) glBindBuffer_(GL_ARRAY_BUFFER_ARB, vc.vbuf); + #define GENVBO(type) \ + do \ + { \ + vector vverts; \ + loopv(meshes) vlen += ((vertmesh *)meshes[i])->genvbo(idxs, vlen, vverts); \ + if(hasVBO) glBufferData_(GL_ARRAY_BUFFER_ARB, vverts.length()*sizeof(type), vverts.getbuf(), GL_STATIC_DRAW_ARB); \ + else \ + { \ + DELETEA(vc.vdata); \ + vc.vdata = new uchar[vverts.length()*sizeof(type)]; \ + memcpy(vc.vdata, vverts.getbuf(), vverts.length()*sizeof(type)); \ + } \ + } while(0) + if(tangents) GENVBO(vvertbump); + else if(norms) GENVBO(vvert); + else GENVBO(vvertff); + } + + if(hasVBO) + { + glGenBuffers_(1, &ebuf); + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, ebuf); + glBufferData_(GL_ELEMENT_ARRAY_BUFFER_ARB, idxs.length()*sizeof(ushort), idxs.getbuf(), GL_STATIC_DRAW_ARB); + } + else + { + edata = new ushort[idxs.length()]; + memcpy(edata, idxs.getbuf(), idxs.length()*sizeof(ushort)); + } + #undef GENVBO + #undef ALLOCVDATA + } + + void bindvbo(const animstate *as, vbocacheentry &vc) + { + vvert *vverts = hasVBO ? 0 : (vvert *)vc.vdata; + if(hasVBO && lastebuf!=ebuf) + { + glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, ebuf); + lastebuf = ebuf; + } + if(lastvbuf != (hasVBO ? (void *)(size_t)vc.vbuf : vc.vdata)) + { + if(hasVBO) glBindBuffer_(GL_ARRAY_BUFFER_ARB, vc.vbuf); + if(!lastvbuf) glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, vertsize, &vverts->pos); + } + lastvbuf = hasVBO ? (void *)(size_t)vc.vbuf : vc.vdata; + if(as->anim&ANIM_NOSKIN) + { + if(enabletc) disabletc(); + } + else if(!enabletc || lasttcbuf!=lastvbuf) + { + if(vnorms || vtangents) + { + if(!enabletc) glEnableClientState(GL_NORMAL_ARRAY); + if(lasttcbuf!=lastvbuf) glNormalPointer(GL_FLOAT, vertsize, &vverts->norm); + } + if(!enabletc) glEnableClientState(GL_TEXTURE_COORD_ARRAY); + if(lasttcbuf!=lastvbuf) glTexCoordPointer(2, GL_FLOAT, vertsize, &vverts->u); + lasttcbuf = lastvbuf; + enabletc = true; + } + } + + void cleanup() + { + loopi(MAXVBOCACHE) + { + vbocacheentry &c = vbocache[i]; + if(c.vbuf) { glDeleteBuffers_(1, &c.vbuf); c.vbuf = 0; } + DELETEA(c.vdata); + c.as.cur.fr1 = -1; + } + if(hasVBO) { if(ebuf) { glDeleteBuffers_(1, &ebuf); ebuf = 0; } } + else DELETEA(vdata); + lastvbuf = lasttcbuf = lastmtcbuf = lastnbuf = NULL; + lastebuf = 0; + } + + void render(const animstate *as, float pitch, const vec &axis, part *p) + { + bool norms = false, tangents = false; + loopv(p->skins) + { + if(p->skins[i].normals()) norms = true; + if(p->skins[i].tangents()) tangents = true; + } + if(norms!=vnorms || tangents!=vtangents) cleanup(); + vbocacheentry *vc = NULL; + if(numframes<=1) vc = vbocache; + else + { + loopi(MAXVBOCACHE) + { + vbocacheentry &c = vbocache[i]; + if(hasVBO ? !c.vbuf : !c.vdata) continue; + if(c.as==*as) { vc = &c; break; } + } + if(!vc) loopi(MAXVBOCACHE) { vc = &vbocache[i]; if((hasVBO ? !vc->vbuf : !vc->vdata) || vc->millis < lastmillis) break; } + } + if(hasVBO ? !vc->vbuf : !vc->vdata) genvbo(norms, tangents, *vc); + if(numframes>1) + { + if(vc->as!=*as) + { + vc->as = *as; + vc->millis = lastmillis; + loopv(meshes) + { + vertmesh &m = *(vertmesh *)meshes[i]; + m.interpverts(*as, norms, tangents, (hasVBO ? vdata : vc->vdata) + m.voffset*vertsize, p->skins[i]); + } + if(hasVBO) + { + glBindBuffer_(GL_ARRAY_BUFFER_ARB, vc->vbuf); + glBufferData_(GL_ARRAY_BUFFER_ARB, vlen*vertsize, vdata, GL_STREAM_DRAW_ARB); + } + } + vc->millis = lastmillis; + } + + bindvbo(as, *vc); + loopv(meshes) ((vertmesh *)meshes[i])->render(as, p->skins[i], *vc); + + loopv(p->links) calctagmatrix(p->links[i].tag, *as, p->links[i].matrix); + } + }; + + vertmodel(const char *name) : animmodel(name) + { + } +}; + diff --git a/src/engine/water.cpp b/src/engine/water.cpp new file mode 100644 index 0000000..42e89dc --- /dev/null +++ b/src/engine/water.cpp @@ -0,0 +1,1273 @@ +#include "pch.h" +#include "engine.h" + +VARFP(waterreflect, 0, 1, 1, cleanreflections()); +VARFP(waterrefract, 0, 1, 1, cleanreflections()); +VARFP(waterenvmap, 0, 1, 1, cleanreflections()); +VARFP(waterfallrefract, 0, 0, 1, cleanreflections()); +VARP(refractfog, 0, 1, 1); + +/* vertex water */ +VARP(watersubdiv, 0, 2, 3); +VARP(waterlod, 0, 1, 3); + +static int wx1, wy1, wx2, wy2, wsize; +float wcol[4]; + +#define VERTW(vertw, body) \ + inline void vertw(float v1, float v2, float v3, float t) \ + { \ + float angle = (v1-wx1)/wsize*(v2-wy1)/wsize*(v1-wx2)*(v2-wy2)*59/23+t; \ + float s = sinf(angle), h = WATER_AMPLITUDE*s-WATER_OFFSET; \ + body; \ + glVertex3f(v1, v2, v3+h); \ + } +#define VERTWN(vertw, body) \ + inline void vertw(float v1, float v2, float v3) \ + { \ + float h = -WATER_OFFSET; \ + body; \ + glVertex3f(v1, v2, v3+h); \ + } +#define VERTWT(vertwt, body) VERTW(vertwt, { float v = cosf(angle); float duv = 0.5f*v; body; }) +VERTW(vertwt, { + glTexCoord2f(v1/8.0f, v2/8.0f); +}) +VERTWN(vertwtn, { + glTexCoord2f(v1/8.0f, v2/8.0f); +}) +VERTW(vertwc, { + glColor4f(wcol[0], wcol[1], wcol[2], wcol[3] + fabs(s)*0.1f); +}) +VERTWN(vertwcn, { + glColor4f(wcol[0], wcol[1], wcol[2], wcol[3]); +}) +VERTWT(vertwtc, { + glColor4f(1, 1, 1, 0.2f + fabs(s)*0.1f); + glTexCoord3f(v1+duv, v2+duv, v3+h); +}) +VERTWN(vertwtcn, { + glColor4f(1, 1, 1, 0.2f); + glTexCoord3f(v1, v2, v3+h); +}) +VERTWT(vertwmtc, { + glColor4f(1, 1, 1, 0.2f + fabs(s)*0.1f); + glMultiTexCoord3f_(GL_TEXTURE0_ARB, v1-duv, v2+duv, v3+h); + glMultiTexCoord3f_(GL_TEXTURE1_ARB, v1+duv, v2+duv, v3+h); +}) +VERTWN(vertwmtcn, { + glColor4f(1, 1, 1, 0.2f); + glMultiTexCoord3f_(GL_TEXTURE0_ARB, v1, v2, v3+h); + glMultiTexCoord3f_(GL_TEXTURE1_ARB, v1, v2, v3+h); +}) +VERTWT(vertwetc, { + glColor4f(1, 1, 1, 0.2f + fabs(s)*0.1f); + glTexCoord3f(v1+duv-camera1->o.x, v2+duv-camera1->o.y, camera1->o.z-(v3+h)); +}) +VERTWN(vertwetcn, { + glColor4f(1, 1, 1, 0.2f); + glTexCoord3f(v1-camera1->o.x, v2-camera1->o.y, camera1->o.z-(v3+h)); +}) +VERTWT(vertwemtc, { + glColor4f(1, 1, 1, 0.2f + fabs(s)*0.1f); + glMultiTexCoord3f_(GL_TEXTURE0_ARB, v1-duv, v2+duv, v3+h); + glMultiTexCoord3f_(GL_TEXTURE1_ARB, v1+duv-camera1->o.x, v2+duv-camera1->o.y, camera1->o.z-(v3+h)); +}) +VERTWN(vertwemtcn, { + glColor4f(1, 1, 1, 0.2f); + glMultiTexCoord3f_(GL_TEXTURE0_ARB, v1, v2, v3+h); + glMultiTexCoord3f_(GL_TEXTURE1_ARB, v1-camera1->o.x, v2-camera1->o.y, camera1->o.z-(v3+h)); +}) + +static float lavaxk = 1.0f, lavayk = 1.0f, lavascroll = 0.0f; + +VERTW(vertl, { + glTexCoord2f(lavaxk*(v1+lavascroll), lavayk*(v2+lavascroll)); +}) +VERTWN(vertln, { + glTexCoord2f(lavaxk*(v1+lavascroll), lavayk*(v2+lavascroll)); +}) + +#define renderwaterstrips(vertw, z, t) \ + for(int x = wx1; xo.z < z-WATER_OFFSET; + if(nowater) { renderwaterstrips(vertwc, z, t); } + else if(waterrefract) + { + if(waterreflect && !below) { renderwaterstrips(vertwmtc, z, t); } + else if(waterenvmap && hasCM && !below) { renderwaterstrips(vertwemtc, z, t); } + else { renderwaterstrips(vertwtc, z, t); } + } + else if(waterreflect && !below) { renderwaterstrips(vertwtc, z, t); } + else if(waterenvmap && hasCM && !below) { renderwaterstrips(vertwetc, z, t); } + else { renderwaterstrips(vertwc, z, t); } + } + break; + } + + case MAT_LAVA: + { + float t = lastmillis/2000.0f; + renderwaterstrips(vertl, z, t); + break; + } + } +} + +uint calcwatersubdiv(int x, int y, int z, uint size) +{ + float dist; + if(camera1->o.x >= x && camera1->o.x < x + size && + camera1->o.y >= y && camera1->o.y < y + size) + dist = fabs(camera1->o.z - float(z)); + else + { + vec t(x + size/2, y + size/2, z + size/2); + dist = t.dist(camera1->o) - size*1.42f/2; + } + uint subdiv = watersubdiv + int(dist) / (32 << waterlod); + if(subdiv >= 8*sizeof(subdiv)) + subdiv = ~0; + else + subdiv = 1 << subdiv; + return subdiv; +} + +uint renderwaterlod(int x, int y, int z, uint size, uchar mat = MAT_WATER) +{ + if(size <= (uint)(32 << waterlod)) + { + uint subdiv = calcwatersubdiv(x, y, z, size); + if(subdiv < size * 2) rendervertwater(min(subdiv, size), x, y, z, size, mat); + return subdiv; + } + else + { + uint subdiv = calcwatersubdiv(x, y, z, size); + if(subdiv >= size) + { + if(subdiv < size * 2) rendervertwater(size, x, y, z, size, mat); + return subdiv; + } + uint childsize = size / 2, + subdiv1 = renderwaterlod(x, y, z, childsize, mat), + subdiv2 = renderwaterlod(x + childsize, y, z, childsize, mat), + subdiv3 = renderwaterlod(x + childsize, y + childsize, z, childsize, mat), + subdiv4 = renderwaterlod(x, y + childsize, z, childsize, mat), + minsubdiv = subdiv1; + minsubdiv = min(minsubdiv, subdiv2); + minsubdiv = min(minsubdiv, subdiv3); + minsubdiv = min(minsubdiv, subdiv4); + if(minsubdiv < size * 2) + { + if(minsubdiv >= size) rendervertwater(size, x, y, z, size, mat); + else + { + if(subdiv1 >= size) rendervertwater(childsize, x, y, z, childsize, mat); + if(subdiv2 >= size) rendervertwater(childsize, x + childsize, y, z, childsize, mat); + if(subdiv3 >= size) rendervertwater(childsize, x + childsize, y + childsize, z, childsize, mat); + if(subdiv4 >= size) rendervertwater(childsize, x, y + childsize, z, childsize, mat); + } + } + return minsubdiv; + } +} + +#define renderwaterquad(vertwn, z) \ + { \ + vertwn(x, y, z); \ + vertwn(x+rsize, y, z); \ + vertwn(x+rsize, y+csize, z); \ + vertwn(x, y+csize, z); \ + xtraverts += 4; \ + } + +void renderflatwater(int x, int y, int z, uint rsize, uint csize, uchar mat = MAT_WATER) +{ + switch(mat) + { + case MAT_WATER: + if(renderpath!=R_FIXEDFUNCTION) { renderwaterquad(vertwtn, z); } + else + { + bool below = camera1->o.z < z-WATER_OFFSET; + if(nowater) { renderwaterquad(vertwcn, z); } + else if(waterrefract) + { + if(waterreflect && !below) { renderwaterquad(vertwmtcn, z); } + else if(waterenvmap && hasCM && !below) { renderwaterquad(vertwemtcn, z); } + else { renderwaterquad(vertwtcn, z); } + } + else if(waterreflect && !below) { renderwaterquad(vertwtcn, z); } + else if(waterenvmap && hasCM && !below) { renderwaterquad(vertwetcn, z); } + else { renderwaterquad(vertwcn, z); } + } + break; + + case MAT_LAVA: + renderwaterquad(vertln, z); + break; + } +} + +VARFP(vertwater, 0, 1, 1, allchanged()); + +void renderlava(materialsurface &m, Texture *tex, float scale) +{ + lavaxk = 8.0f/(tex->xs*scale); + lavayk = 8.0f/(tex->ys*scale); + lavascroll = lastmillis/1000.0f; + if(vertwater) + { + if(renderwaterlod(m.o.x, m.o.y, m.o.z, m.csize, MAT_LAVA) >= (uint)m.csize * 2) + rendervertwater(m.csize, m.o.x, m.o.y, m.o.z, m.csize, MAT_LAVA); + } + else renderflatwater(m.o.x, m.o.y, m.o.z, m.rsize, m.csize, MAT_LAVA); +} + +/* reflective/refractive water */ + +#define MAXREFLECTIONS 16 + +struct Reflection +{ + GLuint tex, refracttex; + int height, depth, lastupdate, lastused; + GLfloat tm[16]; + occludequery *query; + vector matsurfs; + + Reflection() : tex(0), refracttex(0), height(-1), depth(0), lastused(0), query(NULL) + {} +}; +Reflection *findreflection(int height); + +VARP(reflectdist, 0, 2000, 10000); +VARR(waterfog, 0, 150, 10000); + +void getwatercolour(uchar *wcol) +{ + static const uchar defaultwcol[3] = { 20, 70, 80}; + if(hdr.watercolour[0] || hdr.watercolour[1] || hdr.watercolour[2]) memcpy(wcol, hdr.watercolour, 3); + else memcpy(wcol, defaultwcol, 3); +} + +void watercolour(int *r, int *g, int *b) +{ + hdr.watercolour[0] = *r; + hdr.watercolour[1] = *g; + hdr.watercolour[2] = *b; +} + +COMMAND(watercolour, "iii"); + +void getwaterfallcolour(uchar *fcol) +{ + if(hdr.waterfallcolour[0] || hdr.waterfallcolour[1] || hdr.waterfallcolour[2]) memcpy(fcol, hdr.waterfallcolour, 3); + else getwatercolour(fcol); +} + +void waterfallcolour(int *r, int *g, int *b) +{ + hdr.waterfallcolour[0] = *r; + hdr.waterfallcolour[1] = *g; + hdr.waterfallcolour[2] = *b; +} + +COMMAND(waterfallcolour, "iii"); + +VARR(lavafog, 0, 50, 10000); + +void getlavacolour(uchar *lcol) +{ + static const uchar defaultlcol[3] = { 255, 64, 0 }; + if(hdr.lavacolour[0] || hdr.lavacolour[1] || hdr.lavacolour[2]) memcpy(lcol, hdr.lavacolour, 3); + else memcpy(lcol, defaultlcol, 3); +} + +void lavacolour(int *r, int *g, int *b) +{ + hdr.lavacolour[0] = *r; + hdr.lavacolour[1] = *g; + hdr.lavacolour[2] = *b; +} + +COMMAND(lavacolour, "iii"); + +void setprojtexmatrix(Reflection &ref, bool init = true) +{ + if(init && ref.lastupdate==totalmillis) + { + memcpy(ref.tm, mvpmatrix, 16*sizeof(GLfloat)); + loopi(2) loopj(4) ref.tm[i + j*4] = 0.5f*(ref.tm[i + j*4] + ref.tm[3 + j*4]); + } + + glLoadMatrixf(ref.tm); +} + +void setuprefractTMUs() +{ + if(!refractfog) setuptmu(0, "K , T @ Ka"); + + if(waterreflect || (waterenvmap && hasCM)) + { + glActiveTexture_(GL_TEXTURE1_ARB); + glEnable(waterreflect ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP_ARB); + if(!waterreflect) glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, lookupenvmap(lookuptexture(-MAT_WATER))); + + setuptmu(1, "P , T @ C~a"); + + glActiveTexture_(GL_TEXTURE0_ARB); + } +} + +void setupreflectTMUs() +{ + setuptmu(0, "T , K @ Ca", "Ka * P~a"); + + glDepthMask(GL_FALSE); + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_SRC_ALPHA); + + if(!waterreflect) + { + glDisable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_CUBE_MAP_ARB); + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, lookupenvmap(lookuptexture(-MAT_WATER))); + } +} + +void cleanupwaterTMUs(bool refract) +{ + resettmu(0); + + if(refract) + { + if(waterrefract || (waterenvmap && hasCM)) + { + glActiveTexture_(GL_TEXTURE1_ARB); + resettmu(1); + glLoadIdentity(); + glDisable(waterreflect ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP_ARB); + glActiveTexture_(GL_TEXTURE0_ARB); + } + } + else + { + glDisable(GL_BLEND); + glDepthMask(GL_TRUE); + } +} + +VARR(waterspec, 0, 150, 1000); + +Reflection reflections[MAXREFLECTIONS]; +Reflection waterfallrefraction; +GLuint reflectionfb = 0, reflectiondb = 0; + +GLuint getwaterfalltex() { return waterfallrefraction.refracttex ? waterfallrefraction.refracttex : notexture->id; } + +VAR(oqwater, 0, 1, 1); + +extern int oqfrags; + +void renderwaterff() +{ + glDisable(GL_CULL_FACE); + + if(!nowater && (waterreflect || waterrefract || (waterenvmap && hasCM))) + { + if(waterrefract) setuprefractTMUs(); + else setupreflectTMUs(); + + glMatrixMode(GL_TEXTURE); + } + else + { + glDisable(GL_TEXTURE_2D); + glDepthMask(GL_FALSE); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + float offset = -WATER_OFFSET; + + uchar wcolub[3]; + getwatercolour(wcolub); + loopi(3) wcol[i] = wcolub[i]/255.0f; + + bool wasbelow = false; + loopi(MAXREFLECTIONS) + { + Reflection &ref = reflections[i]; + if(ref.height<0 || ref.lastusedo.z < ref.height + offset; + if(!nowater && (waterrefract || waterreflect || (waterenvmap && hasCM))) + { + if(hasOQ && oqfrags && oqwater && ref.query && ref.query->owner==&ref && checkquery(ref.query)) continue; + bool projtex = false; + if(waterreflect || (waterenvmap && hasCM)) + { + bool tmu1 = waterrefract && (!below || !wasbelow); + if(tmu1) glActiveTexture_(GL_TEXTURE1_ARB); + if(!below) + { + if(wasbelow) + { + wasbelow = false; + glEnable(waterreflect ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP_ARB); + if(!waterrefract) glBlendFunc(GL_ONE, GL_SRC_ALPHA); + } + if(waterreflect) + { + glBindTexture(GL_TEXTURE_2D, ref.tex); + setprojtexmatrix(ref); + projtex = true; + } + } + else if(!wasbelow) + { + wasbelow = true; + glDisable(waterreflect ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP_ARB); + if(!waterrefract) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + if(tmu1) glActiveTexture_(GL_TEXTURE0_ARB); + } + if(waterrefract) + { + glBindTexture(GL_TEXTURE_2D, ref.refracttex); + setprojtexmatrix(ref, !projtex); + } + } + + int lastdepth = -1; + bool begin = false; + loopvj(ref.matsurfs) + { + materialsurface &m = *ref.matsurfs[j]; + + if(m.depth!=lastdepth) + { + float depth = !waterfog ? 1.0f : min(0.75f*m.depth/waterfog, 0.95f); + if(nowater || !waterrefract) depth = max(depth, nowater || (!waterreflect && (!waterenvmap || !hasCM)) || below ? 0.6f : 0.3f); + wcol[3] = depth; + if(!nowater && (waterrefract || ((waterreflect || (waterenvmap && hasCM)) && !below))) + { + if(begin) { glEnd(); begin = false; } + float ec[4] = { wcol[0], wcol[1], wcol[2], depth }; + if(!waterrefract) { loopk(3) ec[k] *= depth; ec[3] = 1-ec[3]; } + colortmu(0, ec[0], ec[1], ec[2], ec[3]); + } + lastdepth = m.depth; + } + + if(!vertwater) + { + if(!begin) { glBegin(GL_QUADS); begin = true; } + renderflatwater(m.o.x, m.o.y, m.o.z, m.rsize, m.csize); + } + else if(renderwaterlod(m.o.x, m.o.y, m.o.z, m.csize) >= (uint)m.csize * 2) + rendervertwater(m.csize, m.o.x, m.o.y, m.o.z, m.csize); + } + if(begin) glEnd(); + } + + if(!nowater && (waterrefract || waterreflect || (waterenvmap && hasCM))) + { + if(!waterrefract && (wasbelow || !waterreflect)) + { + if(!waterreflect && !wasbelow) glDisable(GL_TEXTURE_CUBE_MAP_ARB); + glEnable(GL_TEXTURE_2D); + } + cleanupwaterTMUs(waterrefract!=0); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + } + else + { + glEnable(GL_TEXTURE_2D); + glDepthMask(GL_TRUE); + glDisable(GL_BLEND); + } + + glEnable(GL_CULL_FACE); +} + +VARFP(waterfade, 0, 1, 1, cleanreflections()); + +void renderwater() +{ + if(editmode && showmat) return; + if(!rplanes) return; + + if(renderpath==R_FIXEDFUNCTION) { renderwaterff(); return; } + + glDisable(GL_CULL_FACE); + + uchar wcol[3]; + getwatercolour(wcol); + glColor3ubv(wcol); + + Slot &s = lookuptexture(-MAT_WATER); + + glActiveTexture_(GL_TEXTURE1_ARB); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, s.sts.inrange(2) ? s.sts[2].t->id : notexture->id); + glActiveTexture_(GL_TEXTURE2_ARB); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, s.sts.inrange(3) ? s.sts[3].t->id : notexture->id); + + if(!glaring) + { + if(waterrefract) + { + glActiveTexture_(GL_TEXTURE3_ARB); + glEnable(GL_TEXTURE_2D); + if(waterfade && hasFBO) + { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + } + else + { + glDepthMask(GL_FALSE); + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_SRC_ALPHA); + } + } + glActiveTexture_(GL_TEXTURE0_ARB); + + if(!glaring && waterenvmap && !waterreflect && hasCM) + { + glDisable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_CUBE_MAP_ARB); + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, lookupenvmap(s)); + } + + setenvparamf("camera", SHPARAM_VERTEX, 0, camera1->o.x, camera1->o.y, camera1->o.z); + setenvparamf("millis", SHPARAM_VERTEX, 1, lastmillis/1000.0f, lastmillis/1000.0f, lastmillis/1000.0f); + + #define SETWATERSHADER(which, name) \ + do { \ + static Shader *name##shader = NULL; \ + if(!name##shader) name##shader = lookupshaderbyname(#name); \ + which##shader = name##shader; \ + } while(0) + + Shader *aboveshader = NULL; + if(glaring) SETWATERSHADER(above, waterglare); + else if(waterenvmap && !waterreflect && hasCM) + { + if(waterrefract) + { + if(waterfade && hasFBO) SETWATERSHADER(above, waterenvfade); + else SETWATERSHADER(above, waterenvrefract); + } + else SETWATERSHADER(above, waterenv); + } + else if(waterrefract) + { + if(waterfade && hasFBO) SETWATERSHADER(above, waterfade); + else SETWATERSHADER(above, waterrefract); + } + else if(waterreflect) SETWATERSHADER(above, waterreflect); + else SETWATERSHADER(above, water); + + Shader *belowshader = NULL; + if(!glaring) + { + if(waterrefract) + { + if(waterfade && hasFBO) SETWATERSHADER(below, underwaterfade); + else SETWATERSHADER(below, underwaterrefract); + } + else SETWATERSHADER(below, underwater); + + if(waterreflect || waterrefract) glMatrixMode(GL_TEXTURE); + } + + vec ambient(max(hdr.skylight[0], hdr.ambient), max(hdr.skylight[1], hdr.ambient), max(hdr.skylight[2], hdr.ambient)); + float offset = -WATER_OFFSET; + loopi(MAXREFLECTIONS) + { + Reflection &ref = reflections[i]; + if(ref.height<0 || ref.lastusedowner==&ref && checkquery(ref.query)) continue; + + bool below = camera1->o.z < ref.height+offset; + if(below) + { + if(!belowshader) continue; + belowshader->set(); + } + else aboveshader->set(); + + if(!glaring) + { + if(waterreflect || waterrefract) + { + if(waterreflect || !waterenvmap || !hasCM) glBindTexture(GL_TEXTURE_2D, waterreflect ? ref.tex : ref.refracttex); + setprojtexmatrix(ref); + } + + if(waterrefract) + { + glActiveTexture_(GL_TEXTURE3_ARB); + glBindTexture(GL_TEXTURE_2D, ref.refracttex); + glActiveTexture_(GL_TEXTURE0_ARB); + if(waterfade) + { + float fadeheight = ref.height+offset+(below ? -2 : 2); + setlocalparamf("waterheight", SHPARAM_VERTEX, 7, fadeheight, fadeheight, fadeheight); + } + } + } + + entity *lastlight = (entity *)-1; + int lastdepth = -1; + bool begin = false; + loopvj(ref.matsurfs) + { + materialsurface &m = *ref.matsurfs[j]; + + entity *light = (m.light && m.light->type==ET_LIGHT ? m.light : NULL); + if(light!=lastlight) + { + if(begin) { glEnd(); begin = false; } + const vec &lightpos = light ? light->o : vec(hdr.worldsize/2, hdr.worldsize/2, hdr.worldsize); + float lightrad = light && light->attr1 ? light->attr1 : hdr.worldsize*8.0f; + const vec &lightcol = (light ? vec(light->attr2, light->attr3, light->attr4) : vec(ambient)).div(255.0f).mul(waterspec/100.0f); + setlocalparamf("lightpos", SHPARAM_VERTEX, 2, lightpos.x, lightpos.y, lightpos.z); + setlocalparamf("lightcolor", SHPARAM_PIXEL, 3, lightcol.x, lightcol.y, lightcol.z); + setlocalparamf("lightradius", SHPARAM_PIXEL, 4, lightrad, lightrad, lightrad); + lastlight = light; + } + + if(!glaring && !waterrefract && m.depth!=lastdepth) + { + if(begin) { glEnd(); begin = false; } + float depth = !waterfog ? 1.0f : min(0.75f*m.depth/waterfog, 0.95f); + depth = max(depth, !below && (waterreflect || (waterenvmap && hasCM)) ? 0.3f : 0.6f); + setlocalparamf("depth", SHPARAM_PIXEL, 5, depth, 1.0f-depth); + lastdepth = m.depth; + } + + if(!vertwater) + { + if(!begin) { glBegin(GL_QUADS); begin = true; } + renderflatwater(m.o.x, m.o.y, m.o.z, m.rsize, m.csize); + } + else if(renderwaterlod(m.o.x, m.o.y, m.o.z, m.csize) >= (uint)m.csize * 2) + rendervertwater(m.csize, m.o.x, m.o.y, m.o.z, m.csize); + } + if(begin) glEnd(); + } + + if(!glaring) + { + if(waterreflect || waterrefract) + { + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + } + if(waterrefract) + { + glActiveTexture_(GL_TEXTURE3_ARB); + glDisable(GL_TEXTURE_2D); + if(hasFBO && renderpath!=R_FIXEDFUNCTION && waterfade) glDisable(GL_BLEND); + } + else + { + glDepthMask(GL_TRUE); + glDisable(GL_BLEND); + } + } + + loopi(2) + { + glActiveTexture_(GL_TEXTURE1_ARB+i); + glDisable(GL_TEXTURE_2D); + } + glActiveTexture_(GL_TEXTURE0_ARB); + + if(!glaring && waterenvmap && !waterreflect && hasCM) + { + glDisable(GL_TEXTURE_CUBE_MAP_ARB); + glEnable(GL_TEXTURE_2D); + } + + glEnable(GL_CULL_FACE); +} + +void setupwaterfallrefract(GLenum tmu1, GLenum tmu2) +{ + glActiveTexture_(tmu1); + glBindTexture(GL_TEXTURE_2D, waterfallrefraction.refracttex ? waterfallrefraction.refracttex : notexture->id); + glActiveTexture_(tmu2); + glMatrixMode(GL_TEXTURE); + setprojtexmatrix(waterfallrefraction); + glMatrixMode(GL_MODELVIEW); +} + +Reflection *findreflection(int height) +{ + loopi(MAXREFLECTIONS) + { + if(reflections[i].height==height) return &reflections[i]; + } + return NULL; +} + +void cleanreflection(Reflection &ref) +{ + ref.height = -1; + ref.lastupdate = 0; + ref.query = NULL; + if(ref.tex) + { + glDeleteTextures(1, &ref.tex); + ref.tex = 0; + } + if(ref.refracttex) + { + glDeleteTextures(1, &ref.refracttex); + ref.refracttex = 0; + } +} + +void cleanreflections() +{ + loopi(MAXREFLECTIONS) cleanreflection(reflections[i]); + cleanreflection(waterfallrefraction); + if(reflectionfb) + { + glDeleteFramebuffers_(1, &reflectionfb); + reflectionfb = 0; + } + if(reflectiondb) + { + glDeleteRenderbuffers_(1, &reflectiondb); + reflectiondb = 0; + } +} + +VARFP(reflectsize, 6, 8, 10, cleanreflections()); + +void genwatertex(GLuint &tex, GLuint &fb, GLuint &db, bool refract = false) +{ + static const GLenum colorfmts[] = { GL_RGBA, GL_RGBA8, GL_RGB, GL_RGB8, GL_FALSE }, + depthfmts[] = { GL_DEPTH_STENCIL_EXT, GL_DEPTH24_STENCIL8_EXT, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT32, GL_FALSE }; + const int stencilfmts = 2; + static GLenum reflectfmt = GL_FALSE, refractfmt = GL_FALSE, depthfmt = GL_FALSE, stencilfmt = GL_FALSE; + static bool usingalpha = false; + bool needsalpha = refract && hasFBO && renderpath!=R_FIXEDFUNCTION && waterrefract && waterfade; + if(refract && usingalpha!=needsalpha) + { + usingalpha = needsalpha; + refractfmt = GL_FALSE; + } + int size = 1<screen->w || size>screen->h) size /= 2; + while(size>hwtexsize) size /= 2; + + glGenTextures(1, &tex); + char *buf = new char[size*size*4]; + memset(buf, 0, size*size*4); + + GLenum &colorfmt = refract ? refractfmt : reflectfmt; + if(colorfmt && (!hasFBO || (fb && db))) + { + createtexture(tex, size, size, buf, 3, false, colorfmt); + delete[] buf; + return; + } + + if(hasFBO) + { + if(!fb) glGenFramebuffers_(1, &fb); + glBindFramebuffer_(GL_FRAMEBUFFER_EXT, fb); + } + + int find = needsalpha ? 0 : 2; + do + { + createtexture(tex, size, size, buf, 3, false, colorfmt ? colorfmt : colorfmts[find]); + if(!hasFBO) break; + else + { + glFramebufferTexture2D_(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex, 0); + if(glCheckFramebufferStatus_(GL_FRAMEBUFFER_EXT)==GL_FRAMEBUFFER_COMPLETE_EXT) break; + } + } + while(!colorfmt && colorfmts[++find]); + if(!colorfmt) colorfmt = colorfmts[find]; + + delete[] buf; + + if(hasFBO) + { + if(!db) { glGenRenderbuffers_(1, &db); depthfmt = stencilfmt = GL_FALSE; } + if(!depthfmt) glBindRenderbuffer_(GL_RENDERBUFFER_EXT, db); + find = hasstencil && hasDS ? 0 : stencilfmts; + do + { + if(!depthfmt) glRenderbufferStorage_(GL_RENDERBUFFER_EXT, depthfmts[find], size, size); + glFramebufferRenderbuffer_(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, db); + if(depthfmt ? stencilfmt : findlastused) oldest = &r; + } + if(!ref) + { + if(!oldest || oldest->lastused==totalmillis) return; + ref = oldest; + } + if(ref->height!=height) ref->height = height; + rplanes++; + ref->lastused = totalmillis; + ref->matsurfs.setsizenodelete(0); + ref->matsurfs.add(&m); + ref->depth = m.depth; + if(nowater) return; + + if(waterreflect && !ref->tex) genwatertex(ref->tex, reflectionfb, reflectiondb); + if(waterrefract && !ref->refracttex) genwatertex(ref->refracttex, reflectionfb, reflectiondb, true); +} + +extern vtxarray *visibleva; +extern void drawreflection(float z, bool refract, bool clear); + +int rplanes = 0; + +static int lastquery = 0; + +void queryreflection(Reflection &ref, bool init) +{ + if(init) + { + nocolorshader->set(); + glDepthMask(GL_FALSE); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + glDisable(GL_CULL_FACE); + } + startquery(ref.query); + glBegin(GL_QUADS); + loopvj(ref.matsurfs) + { + materialsurface &m = *ref.matsurfs[j]; + float offset = 0.1f; + if(m.orient==O_TOP) + { + offset = WATER_OFFSET + + (vertwater ? WATER_AMPLITUDE*(camera1->pitch > 0 || m.depth < WATER_AMPLITUDE+0.5f ? -1 : 1) : 0); + if(fabs(m.o.z-offset - camera1->o.z) < 0.5f && m.depth > WATER_AMPLITUDE+1.5f) + offset += camera1->pitch > 0 ? -1 : 1; + } + drawmaterial(m.orient, m.o.x, m.o.y, m.o.z, m.csize, m.rsize, offset); + } + glEnd(); + endquery(ref.query); +} + +void queryreflections() +{ + rplanes = 0; + + static int lastsize = 0; + int size = 1<screen->w || size>screen->h) size /= 2; + if(size!=lastsize) { if(lastsize) cleanreflections(); lastsize = size; } + + bool shouldrefract = waterfallrefract && renderpath!=R_FIXEDFUNCTION; + for(vtxarray *va = visibleva; va; va = va->next) + { + if(!va->matsurfs || va->occluded >= OCCLUDE_BB || va->curvfc >= VFC_FOGGED) continue; + loopi(va->matsurfs) + { + materialsurface &m = va->matbuf[i]; + if(m.material==MAT_WATER) + { + if(m.orient==O_TOP) addreflection(m); + else if(m.orient!=O_BOTTOM && shouldrefract) addwaterfallrefraction(m); + } + } + } + + loopi(MAXREFLECTIONS) + { + Reflection &ref = reflections[i]; + if(ref.height>=0 && ref.lastused>=totalmillis && ref.matsurfs.length()) + { + if(waterpvsoccluded(ref.height)) ref.matsurfs.setsizenodelete(0); + } + } + if(renderpath!=R_FIXEDFUNCTION && waterfallrefract) + { + Reflection &ref = waterfallrefraction; + if(ref.height>=0 && ref.lastused>=totalmillis && ref.matsurfs.length()) + { + if(waterpvsoccluded(-1)) ref.matsurfs.setsizenodelete(0); + } + } + + lastquery = totalmillis; + + if((editmode && showmat) || !hasOQ || !oqfrags || !oqwater || nowater) return; + + int refs = 0; + if(waterreflect || waterrefract) loopi(MAXREFLECTIONS) + { + Reflection &ref = reflections[i]; + ref.query = ref.height>=0 && ref.lastused>=totalmillis && ref.matsurfs.length() ? newquery(&ref) : NULL; + if(ref.query) queryreflection(ref, !refs++); + } + if(renderpath!=R_FIXEDFUNCTION && waterfallrefract) + { + Reflection &ref = waterfallrefraction; + ref.query = ref.height>=0 && ref.lastused>=totalmillis && ref.matsurfs.length() ? newquery(&ref) : NULL; + if(ref.query) queryreflection(ref, !refs++); + } + + if(refs) + { + defaultshader->set(); + glDepthMask(GL_TRUE); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glEnable(GL_CULL_FACE); + } +} + +VARP(maxreflect, 1, 1, 8); + +int refracting = 0; +bool reflecting = false, fading = false, fogging = false; +float reflectz = 1e16f; + +VAR(maskreflect, 0, 2, 16); + +void maskreflection(Reflection &ref, float offset, bool reflect) +{ + if(!maskreflect) + { + glClear(GL_DEPTH_BUFFER_BIT | (hasstencil && hasDS ? GL_STENCIL_BUFFER_BIT : 0)); + return; + } + glClearDepth(0); + glClear(GL_DEPTH_BUFFER_BIT | (hasstencil && hasDS ? GL_STENCIL_BUFFER_BIT : 0)); + glClearDepth(1); + glDepthRange(1, 1); + glDepthFunc(GL_ALWAYS); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + glDisable(GL_TEXTURE_2D); + glDisable(GL_CULL_FACE); + nocolorshader->set(); + if(reflect) + { + glPushMatrix(); + glTranslatef(0, 0, 2*(ref.height+offset)); + glScalef(1, 1, -1); + } + int border = maskreflect; + glBegin(GL_QUADS); + loopv(ref.matsurfs) + { + materialsurface &m = *ref.matsurfs[i]; + ivec o(m.o); + o[R[dimension(m.orient)]] -= border; + o[C[dimension(m.orient)]] -= border; + drawmaterial(m.orient, o.x, o.y, o.z, m.csize+2*border, m.rsize+2*border, -offset); + } + glEnd(); + if(reflect) glPopMatrix(); + defaultshader->set(); + glEnable(GL_CULL_FACE); + glEnable(GL_TEXTURE_2D); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glDepthFunc(GL_LESS); + glDepthRange(0, 1); +} + +VAR(reflectscissor, 0, 1, 1); +VAR(reflectvfc, 0, 1, 1); + +static bool calcscissorbox(Reflection &ref, int size, float &minyaw, float &maxyaw, float &minpitch, float &maxpitch, int &sx, int &sy, int &sw, int &sh) +{ + materialsurface &m0 = *ref.matsurfs[0]; + int dim = dimension(m0.orient), r = R[dim], c = C[dim]; + ivec bbmin = m0.o, bbmax = bbmin; + bbmax[r] += m0.rsize; + bbmax[c] += m0.csize; + loopvj(ref.matsurfs) + { + materialsurface &m = *ref.matsurfs[j]; + bbmin[r] = min(bbmin[r], m.o[r]); + bbmin[c] = min(bbmin[c], m.o[c]); + bbmax[r] = max(bbmax[r], m.o[r] + m.rsize); + bbmax[c] = max(bbmax[c], m.o[c] + m.csize); + bbmin[dim] = min(bbmin[dim], m.o[dim]); + bbmax[dim] = max(bbmax[dim], m.o[dim]); + } + + vec4 v[8]; + float sx1 = 1, sy1 = 1, sx2 = -1, sy2 = -1; + loopi(8) + { + ivec p(i&1 ? bbmax.x : bbmin.x, i&2 ? bbmax.y : bbmin.y, i&4 ? bbmax.z : bbmin.z); + float w = p.x*mvpmatrix[3] + p.y*mvpmatrix[7] + p.z*mvpmatrix[11] + mvpmatrix[15], + x = (p.x*mvpmatrix[0] + p.y*mvpmatrix[4] + p.z*mvpmatrix[8] + mvpmatrix[12]), + y = (p.x*mvpmatrix[1] + p.y*mvpmatrix[5] + p.z*mvpmatrix[9] + mvpmatrix[13]), + z = (p.x*mvpmatrix[2] + p.y*mvpmatrix[6] + p.z*mvpmatrix[10] + mvpmatrix[14]); + v[i] = vec4(x, y, z, w); + if(z >= 0) + { + x /= w; + y /= w; + sx1 = min(sx1, x); + sy1 = min(sy1, y); + sx2 = max(sx2, x); + sy2 = max(sy2, y); + } + } + if(sx1 >= sx2 || sy1 >= sy2) return false; + loopi(8) + { + const vec4 &p = v[i]; + if(p.z >= 0) continue; + loopj(3) + { + const vec4 &o = v[i^(1<w-size) + (sx1+1)*0.5f*size)); + sy = int(floor((hasFBO ? 0 : screen->h-size) + (sy1+1)*0.5f*size)); + sw = max(int(ceil((hasFBO ? 0 : screen->w-size) + (sx2+1)*0.5f*size)) - sx, 0); + sh = max(int(ceil((hasFBO ? 0 : screen->h-size) + (sy2+1)*0.5f*size)) - sy, 0); + return sx1 > -1 || sy1 > -1 || sx2 < 1 || sy2 < 1; +} + +void drawreflections() +{ + if((editmode && showmat) || nowater) return; + + extern int nvidia_scissor_bug; + + static int lastdrawn = 0; + int refs = 0, n = lastdrawn; + float offset = -WATER_OFFSET; + int size = 1<screen->w || size>screen->h) size /= 2; + + if(waterreflect || waterrefract) loopi(MAXREFLECTIONS) + { + Reflection &ref = reflections[++n%MAXREFLECTIONS]; + if(ref.height<0 || ref.lastusedowner==&ref && checkquery(ref.query)) continue; + + if(!refs) + { + glViewport(hasFBO ? 0 : screen->w-size, hasFBO ? 0 : screen->h-size, size, size); + if(hasFBO) glBindFramebuffer_(GL_FRAMEBUFFER_EXT, reflectionfb); + } + refs++; + ref.lastupdate = totalmillis; + lastdrawn = n; + + float minyaw = -M_PI, maxyaw = M_PI, minpitch = -M_PI, maxpitch = M_PI; + int sx, sy, sw, sh; + bool scissor = reflectscissor && calcscissorbox(ref, size, minyaw, maxyaw, minpitch, maxpitch, sx, sy, sw, sh); + if(scissor) glScissor(sx, sy, sw, sh); + else + { + sx = hasFBO ? 0 : screen->w-size; + sy = hasFBO ? 0 : screen->h-size; + sw = sh = size; + } + + if(waterreflect && ref.tex && camera1->o.z >= ref.height+offset) + { + if(hasFBO) glFramebufferTexture2D_(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, ref.tex, 0); + if(scissor && !nvidia_scissor_bug) glEnable(GL_SCISSOR_TEST); + maskreflection(ref, offset, true); + if(scissor && nvidia_scissor_bug) glEnable(GL_SCISSOR_TEST); + reflectvfcP(ref.height+offset, minyaw, maxyaw, minpitch, maxpitch); + drawreflection(ref.height+offset, false, false); + restorevfcP(); + if(scissor) glDisable(GL_SCISSOR_TEST); + if(!hasFBO) + { + glBindTexture(GL_TEXTURE_2D, ref.tex); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, sx-(screen->w-size), sy-(screen->h-size), sx, sy, sw, sh); + } + } + + if(waterrefract && ref.refracttex) + { + if(hasFBO) glFramebufferTexture2D_(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, ref.refracttex, 0); + if(scissor && !nvidia_scissor_bug) glEnable(GL_SCISSOR_TEST); + maskreflection(ref, offset, false); + if(scissor && nvidia_scissor_bug) glEnable(GL_SCISSOR_TEST); + reflectvfcP(-1, minyaw, maxyaw, minpitch, maxpitch); + drawreflection(ref.height+offset, true, ref.depth>=10000); + restorevfcP(); + if(scissor) glDisable(GL_SCISSOR_TEST); + if(!hasFBO) + { + glBindTexture(GL_TEXTURE_2D, ref.refracttex); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, sx-(screen->w-size), sy-(screen->h-size), sx, sy, sw, sh); + } + } + + if(refs>=maxreflect) break; + } + + if(renderpath!=R_FIXEDFUNCTION && waterfallrefract && waterfallrefraction.refracttex) + { + Reflection &ref = waterfallrefraction; + + if(ref.height<0 || ref.lastusedowner==&ref && checkquery(ref.query)) goto nowaterfall; + + if(!refs) + { + glViewport(hasFBO ? 0 : screen->w-size, hasFBO ? 0 : screen->h-size, size, size); + if(hasFBO) glBindFramebuffer_(GL_FRAMEBUFFER_EXT, reflectionfb); + } + refs++; + ref.lastupdate = totalmillis; + + float minyaw = -M_PI, maxyaw = M_PI, minpitch = -M_PI, maxpitch = M_PI; + int sx, sy, sw, sh; + bool scissor = reflectscissor && calcscissorbox(ref, size, minyaw, maxyaw, minpitch, maxpitch, sx, sy, sw, sh); + if(scissor) glScissor(sx, sy, sw, sh); + else + { + sx = hasFBO ? 0 : screen->w-size; + sy = hasFBO ? 0 : screen->h-size; + sw = sh = size; + } + + if(hasFBO) glFramebufferTexture2D_(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, ref.refracttex, 0); + if(scissor && !nvidia_scissor_bug) glEnable(GL_SCISSOR_TEST); + maskreflection(ref, -0.1f, false); + if(scissor && nvidia_scissor_bug) glEnable(GL_SCISSOR_TEST); + reflectvfcP(-1, minyaw, maxyaw, minpitch, maxpitch); + drawreflection(-1, true, false); + restorevfcP(); + if(scissor) glDisable(GL_SCISSOR_TEST); + if(!hasFBO) + { + glBindTexture(GL_TEXTURE_2D, ref.refracttex); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, sx-(screen->w-size), sy-(screen->h-size), sx, sy, sw, sh); + } + } +nowaterfall: + + if(!refs) return; + glViewport(0, 0, screen->w, screen->h); + if(hasFBO) glBindFramebuffer_(GL_FRAMEBUFFER_EXT, 0); + + defaultshader->set(); +} + diff --git a/src/engine/world.cpp b/src/engine/world.cpp new file mode 100644 index 0000000..2607c65 --- /dev/null +++ b/src/engine/world.cpp @@ -0,0 +1,1238 @@ +// world.cpp: core map management stuff + +#include "pch.h" +#include "engine.h" + +header hdr; +int worldscale; + +VAR(octaentsize, 0, 128, 1024); +VAR(entselradius, 0, 2, 10); + +bool getentboundingbox(extentity &e, ivec &o, ivec &r) +{ + switch(e.type) + { + case ET_EMPTY: + return false; + case ET_MAPMODEL: + { + model *m = loadmodel(NULL, e.attr2); + if(m) + { + vec center, radius; + m->boundbox(0, center, radius); + rotatebb(center, radius, e.attr1); + + o = e.o; + o.add(center); + r = radius; + r.add(1); + o.sub(r); + r.mul(2); + break; + } + } + // invisible mapmodels use entselradius + default: + o = e.o; + o.sub(entselradius); + r.x = r.y = r.z = entselradius*2; + break; + } + return true; +} + +enum +{ + MODOE_ADD = 1<<0, + MODOE_UPDATEBB = 1<<1 +}; + +void modifyoctaentity(int flags, int id, cube *c, const ivec &cor, int size, const ivec &bo, const ivec &br, int leafsize, vtxarray *lastva = NULL) +{ + loopoctabox(cor, size, bo, br) + { + ivec o(i, cor.x, cor.y, cor.z, size); + vtxarray *va = c[i].ext && c[i].ext->va ? c[i].ext->va : lastva; + if(c[i].children != NULL && size > leafsize) + modifyoctaentity(flags, id, c[i].children, o, size>>1, bo, br, leafsize, va); + else if(flags&MODOE_ADD) + { + if(!c[i].ext || !c[i].ext->ents) ext(c[i]).ents = new octaentities(o, size); + octaentities &oe = *c[i].ext->ents; + switch(et->getents()[id]->type) + { + case ET_MAPMODEL: + if(loadmodel(NULL, et->getents()[id]->attr2)) + { + if(va) + { + va->bbmin.x = -1; + if(oe.mapmodels.empty()) + { + if(!va->mapmodels) va->mapmodels = new vector; + va->mapmodels->add(&oe); + } + } + oe.mapmodels.add(id); + loopk(3) + { + oe.bbmin[k] = min(oe.bbmin[k], max(oe.o[k], bo[k])); + oe.bbmax[k] = max(oe.bbmax[k], min(oe.o[k]+size, bo[k]+br[k])); + } + break; + } + // invisible mapmodel + default: + oe.other.add(id); + break; + } + + } + else if(c[i].ext && c[i].ext->ents) + { + octaentities &oe = *c[i].ext->ents; + switch(et->getents()[id]->type) + { + case ET_MAPMODEL: + if(loadmodel(NULL, et->getents()[id]->attr2)) + { + oe.mapmodels.removeobj(id); + if(va) + { + va->bbmin.x = -1; + if(va->mapmodels && oe.mapmodels.empty()) + { + va->mapmodels->removeobj(&oe); + if(va->mapmodels->empty()) DELETEP(va->mapmodels); + } + } + oe.bbmin = oe.bbmax = oe.o; + oe.bbmin.add(oe.size); + loopvj(oe.mapmodels) + { + extentity &e = *et->getents()[oe.mapmodels[j]]; + ivec eo, er; + if(getentboundingbox(e, eo, er)) loopk(3) + { + oe.bbmin[k] = min(oe.bbmin[k], eo[k]); + oe.bbmax[k] = max(oe.bbmax[k], eo[k]+er[k]); + } + } + loopk(3) + { + oe.bbmin[k] = max(oe.bbmin[k], oe.o[k]); + oe.bbmax[k] = min(oe.bbmax[k], oe.o[k]+size); + } + break; + } + // invisible mapmodel + default: + oe.other.removeobj(id); + break; + } + if(oe.mapmodels.empty() && oe.other.empty()) + freeoctaentities(c[i]); + } + if(c[i].ext && c[i].ext->ents) c[i].ext->ents->query = NULL; + if(va && va!=lastva) + { + if(lastva) + { + if(va->bbmin.x < 0) lastva->bbmin.x = -1; + } + else if(flags&MODOE_UPDATEBB) updatevabb(va); + } + } +} + +static void modifyoctaent(int flags, int id) +{ + vector &ents = et->getents(); + if(!ents.inrange(id)) return; + ivec o, r; + extentity &e = *ents[id]; + if((e.inoctanode!=0)==flags || !getentboundingbox(e, o, r)) return; + + int leafsize = octaentsize, limit = max(r.x, max(r.y, r.z)); + while(leafsize < limit) leafsize *= 2; + int diff = ~(leafsize-1) & ((o.x^(o.x+r.x))|(o.y^(o.y+r.y))|(o.z^(o.z+r.z))); + if(diff && (limit > octaentsize/2 || diff < leafsize*2)) leafsize *= 2; + + e.inoctanode = flags&MODOE_ADD ? 1 : 0; + modifyoctaentity(flags, id, worldroot, ivec(0, 0, 0), hdr.worldsize>>1, o, r, leafsize); + if(e.type == ET_LIGHT) clearlightcache(id); + else if(flags&MODOE_ADD) lightent(e); +} + +static inline void addentity(int id) { modifyoctaent(MODOE_ADD|MODOE_UPDATEBB, id); } +static inline void removeentity(int id) { modifyoctaent(MODOE_UPDATEBB, id); } + +void freeoctaentities(cube &c) +{ + if(!c.ext) return; + if(et->getents().length()) + { + while(c.ext->ents && !c.ext->ents->mapmodels.empty()) removeentity(c.ext->ents->mapmodels.pop()); + while(c.ext->ents && !c.ext->ents->other.empty()) removeentity(c.ext->ents->other.pop()); + } + if(c.ext->ents) + { + delete c.ext->ents; + c.ext->ents = NULL; + } +} + +void entitiesinoctanodes() +{ + loopv(et->getents()) modifyoctaent(MODOE_ADD, i); +} + +char *entname(entity &e) +{ + static string fullentname; + s_strcpy(fullentname, "@"); + s_strcat(fullentname, et->entname(e.type)); + const char *einfo = et->entnameinfo(e); + if(*einfo) + { + s_strcat(fullentname, ": "); + s_strcat(fullentname, einfo); + } + return fullentname; +} + +extern selinfo sel; +extern bool havesel, selectcorners; +int entlooplevel = 0; +int efocus = -1, enthover = -1, entorient = -1, oldhover = -1; +bool undonext = true; + +VAR(entediting, 0, 0, 1); + +bool noentedit() +{ + if(!editmode) { conoutf(CON_ERROR, "operation only allowed in edit mode"); return true; } + return !entediting; +} + +bool pointinsel(selinfo &sel, vec &o) +{ + return(o.x <= sel.o.x+sel.s.x*sel.grid + && o.x >= sel.o.x + && o.y <= sel.o.y+sel.s.y*sel.grid + && o.y >= sel.o.y + && o.z <= sel.o.z+sel.s.z*sel.grid + && o.z >= sel.o.z); +} + +vector entgroup; + +bool haveselent() +{ + return entgroup.length() > 0; +} + +void entcancel() +{ + entgroup.setsize(0); +} + +void entadd(int id) +{ + undonext = true; + entgroup.add(id); +} + +undoblock *newundoent() +{ + int numents = entgroup.length(); + if(numents <= 0) return NULL; + undoblock *u = (undoblock *)new uchar[sizeof(undoblock) + numents*sizeof(undoent)]; + u->numents = numents; + undoent *e = (undoent *)(u + 1); + loopv(entgroup) + { + e->i = entgroup[i]; + e->e = *et->getents()[entgroup[i]]; + e++; + } + return u; +} + +void makeundoent() +{ + if(!undonext) return; + undonext = false; + oldhover = enthover; + undoblock *u = newundoent(); + if(u) addundo(u); +} + +void detachentity(extentity &e) +{ + if(!e.attached) return; + e.attached->attached = NULL; + e.attached = NULL; +} + +VAR(attachradius, 1, 100, 1000); + +void attachentity(extentity &e) +{ + switch(e.type) + { + case ET_SPOTLIGHT: + break; + + default: + if(e.typemayattach(e)) return; + break; + } + + detachentity(e); + + vector &ents = et->getents(); + int closest = -1; + float closedist = 1e10f; + loopv(ents) + { + extentity *a = ents[i]; + if(a->attached) continue; + switch(e.type) + { + case ET_SPOTLIGHT: + if(a->type!=ET_LIGHT) continue; + break; + + default: + if(e.typeattachent(e, *a)) continue; + break; + } + float dist = e.o.dist(a->o); + if(dist < closedist) + { + closest = i; + closedist = dist; + } + } + if(closedist>attachradius) return; + e.attached = ents[closest]; + ents[closest]->attached = &e; +} + +void attachentities() +{ + vector &ents = et->getents(); + loopv(ents) attachentity(*ents[i]); +} + +// convenience macros implicitly define: +// e entity, currently edited ent +// n int, index to currently edited ent +#define addimplicit(f) { if(entgroup.empty() && enthover>=0) { entadd(enthover); undonext = (enthover != oldhover); f; entgroup.drop(); } else f; } +#define entfocus(i, f) { int n = efocus = (i); if(n>=0) { extentity &e = *et->getents()[n]; f; } } +#define entedit(i, f) \ +{ \ + entfocus(i, \ + int oldtype = e.type; \ + removeentity(n); \ + f; \ + if(oldtype!=e.type) detachentity(e); \ + if(e.type!=ET_EMPTY) { addentity(n); if(oldtype!=e.type) attachentity(e); } \ + et->editent(n)); \ +} +#define addgroup(exp) { loopv(et->getents()) entfocus(i, if(exp) entadd(n)); } +#define setgroup(exp) { entcancel(); addgroup(exp); } +#define groupeditloop(f){ entlooplevel++; int _ = efocus; loopv(entgroup) entedit(entgroup[i], f); efocus = _; entlooplevel--; } +#define groupeditpure(f){ if(entlooplevel>0) { entedit(efocus, f); } else groupeditloop(f); } +#define groupeditundo(f){ makeundoent(); groupeditpure(f); } +#define groupedit(f) { addimplicit(groupeditundo(f)); } + +undoblock *copyundoents(undoblock *u) +{ + entcancel(); + undoent *e = u->ents(); + loopi(u->numents) + entadd(e[i].i); + undoblock *c = newundoent(); + loopi(u->numents) if(e[i].e.type==ET_EMPTY) + entgroup.removeobj(e[i].i); + return c; +} + +void pasteundoents(undoblock *u) +{ + undoent *ue = u->ents(); + loopi(u->numents) + entedit(ue[i].i, (entity &)e = ue[i].e); +} + +void entflip() +{ + if(noentedit()) return; + int d = dimension(sel.orient); + float mid = sel.s[d]*sel.grid/2+sel.o[d]; + groupeditundo(e.o[d] -= (e.o[d]-mid)*2); +} + +void entrotate(int *cw) +{ + if(noentedit()) return; + int d = dimension(sel.orient); + int dd = (*cw<0) == dimcoord(sel.orient) ? R[d] : C[d]; + float mid = sel.s[dd]*sel.grid/2+sel.o[dd]; + vec s(sel.o.v); + groupeditundo( + e.o[dd] -= (e.o[dd]-mid)*2; + e.o.sub(s); + swap(e.o[R[d]], e.o[C[d]]); + e.o.add(s); + ); +} + +void entselectionbox(const entity &e, vec &eo, vec &es) +{ + model *m = NULL; + if(e.type == ET_MAPMODEL && (m = loadmodel(NULL, e.attr2))) + { + m->collisionbox(0, eo, es); + rotatebb(eo, es, e.attr1); + if(m->collide) + eo.z -= player->aboveeye; // wacky but true. see physics collide + else + es.div(2); // cause the usual bb is too big... + eo.add(e.o); + } + else + { + es = vec(entselradius); + eo = e.o; + } + eo.sub(es); + es.mul(2); +} + +VAR(entselsnap, 0, 0, 1); +VAR(entmovingshadow, 0, 1, 1); + +extern void boxs(int orient, vec o, const vec &s); +extern void boxs3D(const vec &o, vec s, int g); +extern void editmoveplane(const vec &o, const vec &ray, int d, float off, vec &handle, vec &dest, bool first); + +bool initentdragging = true; + +void entdrag(const vec &ray) +{ + if(noentedit() || !haveselent()) return; + + float r = 0, c = 0; + static vec v, handle; + vec eo, es; + int d = dimension(entorient), + dc= dimcoord(entorient); + + entfocus(entgroup.last(), + entselectionbox(e, eo, es); + + editmoveplane(e.o, ray, d, eo[d] + (dc ? es[d] : 0), handle, v, initentdragging); + + ivec g(v); + int z = g[d]&(~(sel.grid-1)); + g.add(sel.grid/2).mask(~(sel.grid-1)); + g[d] = z; + + r = (entselsnap ? g[R[d]] : v[R[d]]) - e.o[R[d]]; + c = (entselsnap ? g[C[d]] : v[C[d]]) - e.o[C[d]]; + ); + + if(initentdragging) makeundoent(); + groupeditpure(e.o[R[d]] += r; e.o[C[d]] += c); + initentdragging = false; +} + +VAR(showentradius, 0, 1, 1); + +void renderentradius(extentity &e) +{ + if(!showentradius) return; + float radius = 0.0f, angle = 0.0f, ring = 0.0f; + vec dir(0, 0, 0); + float color[3] = {0, 1, 1}; + switch(e.type) + { + case ET_LIGHT: + radius = e.attr1; + color[0] = e.attr2/255.0f; + color[1] = e.attr3/255.0f; + color[2] = e.attr4/255.0f; + break; + + case ET_SPOTLIGHT: + if(e.attached) + { + radius = e.attached->attr1; + if(!radius) radius = 2*e.o.dist(e.attached->o); + dir = vec(e.o).sub(e.attached->o).normalize(); + angle = max(1, min(90, int(e.attr1))); + } + break; + + case ET_SOUND: + radius = e.attr2; + break; + + case ET_ENVMAP: + { + extern int envmapradius; + radius = e.attr1 ? max(0, min(10000, int(e.attr1))) : envmapradius; + break; + } + + case ET_MAPMODEL: + case ET_PLAYERSTART: + radius = 4; + if(e.type==ET_MAPMODEL && e.attr3) ring = checktriggertype(e.attr3, TRIG_COLLIDE) ? 20 : 12; + vecfromyawpitch(e.attr1, 0, 1, 0, dir); + break; + + default: + if(e.type>=ET_GAMESPECIFIC) et->entradius(e, radius, angle, dir); + break; + } + if(radius<=0) return; + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + loopj(2) + { + if(!j) + { + glDepthFunc(GL_GREATER); + glColor3f(0.25f, 0.25f, 0.25f); + } + else + { + glDepthFunc(GL_LESS); + glColor3fv(color); + } + if(e.attached) + { + glBegin(GL_LINES); + glVertex3fv(e.o.v); + glVertex3fv(e.attached->o.v); + glEnd(); + } + if(ring) + { + glBegin(GL_LINE_LOOP); + loopi(16) + { + vec p(e.o); + p.x += ring*cosf(2*M_PI*i/16.0f); + p.y += ring*sinf(2*M_PI*i/16.0f); + glVertex3fv(p.v); + } + glEnd(); + } + if(dir.iszero()) loopk(3) + { + glBegin(GL_LINE_LOOP); + loopi(16) + { + vec p(e.o); + p[k>=2 ? 1 : 0] += radius*cosf(2*M_PI*i/16.0f); + p[k>=1 ? 2 : 1] += radius*sinf(2*M_PI*i/16.0f); + glVertex3fv(p.v); + } + glEnd(); + } + else if(!angle) + { + float arrowsize = min(radius/8, 0.5f); + vec target(vec(dir).mul(radius).add(e.o)), arrowbase(vec(dir).mul(radius - arrowsize).add(e.o)), spoke; + spoke.orthogonal(dir); + spoke.normalize(); + spoke.mul(arrowsize); + glBegin(GL_LINES); + glVertex3fv(e.o.v); + glVertex3fv(target.v); + glEnd(); + glBegin(GL_TRIANGLE_FAN); + glVertex3fv(target.v); + loopi(5) + { + vec p(spoke); + p.rotate(2*M_PI*i/4.0f, dir); + p.add(arrowbase); + glVertex3fv(p.v); + } + glEnd(); + } + else + { + vec spot(vec(dir).mul(radius*cosf(angle*RAD)).add(e.attached->o)), spoke; + spoke.orthogonal(dir); + spoke.normalize(); + spoke.mul(radius*sinf(angle*RAD)); + glBegin(GL_LINES); + loopi(8) + { + vec p(spoke); + p.rotate(2*M_PI*i/8.0f, dir); + p.add(spot); + glVertex3fv(e.attached->o.v); + glVertex3fv(p.v); + } + glEnd(); + glBegin(GL_LINE_LOOP); + loopi(8) + { + vec p(spoke); + p.rotate(2*M_PI*i/8.0f, dir); + p.add(spot); + glVertex3fv(p.v); + } + glEnd(); + } + } + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); +} + +void renderentselection(const vec &o, const vec &ray, bool entmoving) +{ + if(noentedit()) return; + vec eo, es; + + glColor3ub(0, 40, 0); + loopv(entgroup) entfocus(entgroup[i], + entselectionbox(e, eo, es); + boxs3D(eo, es, 1); + ); + + if(enthover >= 0) + { + entfocus(enthover, entselectionbox(e, eo, es)); // also ensures enthover is back in focus + boxs3D(eo, es, 1); + if(entmoving && entmovingshadow==1) + { + vec a, b; + glColor3ub(20, 20, 20); + (a=eo).x=0; (b=es).x=hdr.worldsize; boxs3D(a, b, 1); + (a=eo).y=0; (b=es).y=hdr.worldsize; boxs3D(a, b, 1); + (a=eo).z=0; (b=es).z=hdr.worldsize; boxs3D(a, b, 1); + } + glColor3ub(150,0,0); + glLineWidth(5); + boxs(entorient, eo, es); + glLineWidth(1); + } + + loopv(entgroup) entfocus(entgroup[i], renderentradius(e)); + if(enthover>=0) entfocus(enthover, renderentradius(e)); +} + +bool enttoggle(int id) +{ + undonext = true; + int i = entgroup.find(id); + if(i < 0) + entadd(id); + else + entgroup.remove(i); + return i < 0; +} + +bool hoveringonent(int ent, int orient) +{ + if(noentedit()) return false; + entorient = orient; + if((efocus = enthover = ent) >= 0) + return true; + efocus = entgroup.empty() ? -1 : entgroup.last(); + enthover = -1; + return false; +} + +VAR(entitysurf, 0, 0, 1); +VARF(entmoving, 0, 0, 2, + if(enthover < 0 || noentedit()) + entmoving = 0; + else if(entmoving == 1) + entmoving = enttoggle(enthover); + else if(entmoving == 2 && entgroup.find(enthover) < 0) + entadd(enthover); + if(entmoving > 0) + initentdragging = true; +); + +void entpush(int *dir) +{ + if(noentedit()) return; + int d = dimension(entorient); + int s = dimcoord(entorient) ? -*dir : *dir; + if(entmoving) + { + groupeditpure(e.o[d] += float(s*sel.grid)); // editdrag supplies the undo + } + else + groupedit(e.o[d] += float(s*sel.grid)); + if(entitysurf==1) + player->o[d] += float(s*sel.grid); +} + +VAR(entautoviewdist, 0, 25, 100); +void entautoview(int *dir) +{ + if(!haveselent()) return; + static int s = 0; + vec v(player->o); + v.sub(worldpos); + v.normalize(); + v.mul(entautoviewdist); + int t = s + *dir; + s = abs(t) % entgroup.length(); + if(t<0 && s>0) s = entgroup.length() - s; + entfocus(entgroup[s], + v.add(e.o); + player->o = v; + player->resetinterp(); + ); +} + +COMMAND(entautoview, "i"); +COMMAND(entflip, ""); +COMMAND(entrotate, "i"); +COMMAND(entpush, "i"); + +void delent() +{ + if(noentedit()) return; + groupedit(e.type = ET_EMPTY;); + entcancel(); +} + +int findtype(char *what) +{ + for(int i = 0; *et->entname(i); i++) if(strcmp(what, et->entname(i))==0) return i; + conoutf(CON_ERROR, "unknown entity type \"%s\"", what); + return ET_EMPTY; +} + +VAR(entdrop, 0, 2, 3); + +bool dropentity(entity &e, int drop = -1) +{ + vec radius(4.0f, 4.0f, 4.0f); + if(drop<0) drop = entdrop; + if(e.type == ET_MAPMODEL) + { + model *m = loadmodel(NULL, e.attr2); + if(m) + { + vec center; + m->boundbox(0, center, radius); + rotatebb(center, radius, e.attr1); + radius.x += fabs(center.x); + radius.y += fabs(center.y); + } + radius.z = 0.0f; + } + switch(drop) + { + case 1: + if(e.type != ET_LIGHT && e.type != ET_SPOTLIGHT) + dropenttofloor(&e); + break; + case 2: + case 3: + int cx = 0, cy = 0; + if(sel.cxs == 1 && sel.cys == 1) + { + cx = (sel.cx ? 1 : -1) * sel.grid / 2; + cy = (sel.cy ? 1 : -1) * sel.grid / 2; + } + e.o = sel.o.v; + int d = dimension(sel.orient), dc = dimcoord(sel.orient); + e.o[R[d]] += sel.grid / 2 + cx; + e.o[C[d]] += sel.grid / 2 + cy; + if(!dc) + e.o[D[d]] -= radius[D[d]]; + else + e.o[D[d]] += sel.grid + radius[D[d]]; + + if(drop == 3) + dropenttofloor(&e); + break; + } + return true; +} + +void dropent() +{ + if(noentedit()) return; + groupedit(dropentity(e)); +} + +void attachent() +{ + if(noentedit()) return; + groupedit(attachentity(e)); +} + +COMMAND(attachent, ""); + +extentity *newentity(bool local, const vec &o, int type, int v1, int v2, int v3, int v4) +{ + extentity &e = *et->newentity(); + e.o = o; + e.attr1 = v1; + e.attr2 = v2; + e.attr3 = v3; + e.attr4 = v4; + e.attr5 = 0; + e.type = type; + e.reserved = 0; + e.spawned = false; + e.inoctanode = false; + e.light.color = vec(1, 1, 1); + e.light.dir = vec(0, 0, 1); + if(local) + { + switch(type) + { + case ET_MAPMODEL: + case ET_PLAYERSTART: + e.attr4 = e.attr3; + e.attr3 = e.attr2; + e.attr2 = e.attr1; + e.attr1 = (int)camera1->yaw; + break; + } + et->fixentity(e); + } + return &e; +} + +void newentity(int type, int a1, int a2, int a3, int a4) +{ + extentity *t = newentity(true, player->o, type, a1, a2, a3, a4); + dropentity(*t); + et->getents().add(t); + int i = et->getents().length()-1; + t->type = ET_EMPTY; + enttoggle(i); + makeundoent(); + entedit(i, e.type = type); +} + +void newent(char *what, int *a1, int *a2, int *a3, int *a4) +{ + if(noentedit()) return; + int type = findtype(what); + if(type != ET_EMPTY) + newentity(type, *a1, *a2, *a3, *a4); +} + +int entcopygrid; +vector entcopybuf; + +void entcopy() +{ + if(noentedit()) return; + entcopygrid = sel.grid; + entcopybuf.setsize(0); + loopv(entgroup) + entfocus(entgroup[i], entcopybuf.add(e).o.sub(sel.o.v)); +} + +void entpaste() +{ + if(noentedit()) return; + if(entcopybuf.length()==0) return; + entcancel(); + int last = et->getents().length()-1; + float m = float(sel.grid)/float(entcopygrid); + loopv(entcopybuf) + { + entity &c = entcopybuf[i]; + vec o(c.o); + o.mul(m).add(sel.o.v); + extentity *e = newentity(true, o, ET_EMPTY, c.attr1, c.attr2, c.attr3, c.attr4); + et->getents().add(e); + entadd(++last); + } + int j = 0; + groupeditundo(e.type = entcopybuf[j++].type;); +} + +COMMAND(newent, "siiii"); +COMMAND(delent, ""); +COMMAND(dropent, ""); +COMMAND(entcopy, ""); +COMMAND(entpaste, ""); + +void entset(char *what, int *a1, int *a2, int *a3, int *a4) +{ + if(noentedit()) return; + int type = findtype(what); + groupedit(e.type=type; + e.attr1=*a1; + e.attr2=*a2; + e.attr3=*a3; + e.attr4=*a4;); +} + +ICOMMAND(enthavesel,"", (), addimplicit(intret(entgroup.length()))); +ICOMMAND(entselect, "s", (char *body), if(!noentedit()) addgroup(e.type != ET_EMPTY && entgroup.find(n)<0 && execute(body)>0)); +ICOMMAND(entloop, "s", (char *body), if(!noentedit()) addimplicit(groupeditloop(((void)e, execute(body))))); +ICOMMAND(insel, "", (), entfocus(efocus, intret(pointinsel(sel, e.o)))); +ICOMMAND(entget, "", (), entfocus(efocus, s_sprintfd(s)("%s %d %d %d %d", et->entname(e.type), e.attr1, e.attr2, e.attr3, e.attr4); result(s))); +COMMAND(entset, "siiii"); + +int findentity(int type, int index, int attr1, int attr2) +{ + const vector &ents = et->getents(); + for(int i = index; i0 ? 7 : rnd(10)+1; + loopi(r) spawncycle = findentity(ET_PLAYERSTART, spawncycle+1, -1, tag); + pick = spawncycle; + } + if(pick!=-1) + { + d->pitch = 0; + d->roll = 0; + for(int attempt = pick;;) + { + d->o = et->getents()[attempt]->o; + d->yaw = et->getents()[attempt]->attr1; + if(entinmap(d, true)) break; + attempt = findentity(ET_PLAYERSTART, attempt+1, -1, tag); + if(attempt<0 || attempt==pick) + { + d->o = et->getents()[attempt]->o; + d->yaw = et->getents()[attempt]->attr1; + entinmap(d); + break; + } + } + } + else + { + d->o.x = d->o.y = d->o.z = 0.5f*getworldsize(); + entinmap(d); + } +} + +void splitocta(cube *c, int size) +{ + if(size <= VVEC_INT_MASK+1) return; + loopi(8) + { + if(!c[i].children) c[i].children = newcubes(isempty(c[i]) ? F_EMPTY : F_SOLID); + splitocta(c[i].children, size>>1); + } +} + +void resetmap() +{ + clearoverrides(); + clearmapsounds(); + cleanreflections(); + resetlightmaps(); + clearpvs(); + clearparticles(); + cleardecals(); + clearsleep(); + cancelsel(); + pruneundos(); + + setvar("gamespeed", 100); + setvar("paused", 0); + + et->getents().deletecontentsp(); +} + +void startmap(const char *name) +{ + cl->startmap(name); +} + +bool emptymap(int scale, bool force, const char *mname) // main empty world creation routine +{ + if(!force && !editmode) + { + conoutf(CON_ERROR, "newmap only allowed in edit mode"); + return false; + } + + resetmap(); + + strncpy(hdr.head, "OCTA", 4); + hdr.version = MAPVERSION; + hdr.headersize = sizeof(header); + worldscale = scale<10 ? 10 : (scale>20 ? 20 : scale); + hdr.worldsize = 1< VVEC_INT_MASK+1) splitocta(worldroot, hdr.worldsize>>1); + + clearlights(); + allchanged(); + + overrideidents = true; + execfile("data/default_map_settings.cfg"); + overrideidents = false; + + startmap(mname); + player->o.z += player->eyeheight+1; + + return true; +} + +bool enlargemap(bool force) +{ + if(!force && !editmode) + { + conoutf(CON_ERROR, "mapenlarge only allowed in edit mode"); + return false; + } + if(hdr.worldsize >= 1<<20) return false; + + worldscale++; + hdr.worldsize *= 2; + cube *c = newcubes(F_EMPTY); + c[0].children = worldroot; + loopi(3) solidfaces(c[i+1]); + worldroot = c; + + if(hdr.worldsize > VVEC_INT_MASK+1) splitocta(worldroot, hdr.worldsize>>1); + + allchanged(); + + return true; +} + +void newmap(int *i) { if(emptymap(*i, false)) cl->newmap(max(*i, 0)); } +void mapenlarge() { if(enlargemap(false)) cl->newmap(-1); } +COMMAND(newmap, "i"); +COMMAND(mapenlarge, ""); + +void mapname() +{ + result(cl->getclientmap()); +} + +COMMAND(mapname, ""); + +void mapsize() +{ + int size = 0; + while(1<getents().length()<=i) + { + while(et->getents().length()getents().add(et->newentity())->type = ET_EMPTY; + extentity *e = newentity(local, o, type, attr1, attr2, attr3, attr4); + et->getents().add(e); + addentity(i); + attachentity(*e); + } + else + { + extentity &e = *et->getents()[i]; + removeentity(i); + int oldtype = e.type; + if(oldtype!=type) detachentity(e); + e.type = type; + e.o = o; + e.attr1 = attr1; e.attr2 = attr2; e.attr3 = attr3; e.attr4 = attr4; + addentity(i); + if(oldtype!=type) attachentity(e); + } +} + +int getworldsize() { return hdr.worldsize; } +int getmapversion() { return hdr.version; } + +int triggertypes[NUMTRIGGERTYPES] = +{ + 0, + TRIG_ONCE, + TRIG_RUMBLE, + TRIG_TOGGLE, + TRIG_TOGGLE | TRIG_RUMBLE, + TRIG_MANY, + TRIG_MANY | TRIG_RUMBLE, + TRIG_MANY | TRIG_TOGGLE, + TRIG_MANY | TRIG_TOGGLE | TRIG_RUMBLE, + TRIG_COLLIDE | TRIG_TOGGLE | TRIG_RUMBLE, + TRIG_COLLIDE | TRIG_TOGGLE | TRIG_AUTO_RESET | TRIG_RUMBLE, + TRIG_COLLIDE | TRIG_TOGGLE | TRIG_LOCKED | TRIG_RUMBLE, + TRIG_DISAPPEAR, + TRIG_DISAPPEAR | TRIG_RUMBLE, + TRIG_DISAPPEAR | TRIG_COLLIDE | TRIG_LOCKED, + 0 /* reserved */ +}; + +void resettriggers() +{ + const vector &ents = et->getents(); + loopv(ents) + { + extentity &e = *ents[i]; + if(e.type != ET_MAPMODEL || !e.attr3) continue; + e.triggerstate = TRIGGER_RESET; + e.lasttrigger = 0; + } +} + +void unlocktriggers(int tag, int oldstate = TRIGGER_RESET, int newstate = TRIGGERING) +{ + const vector &ents = et->getents(); + loopv(ents) + { + extentity &e = *ents[i]; + if(e.type != ET_MAPMODEL || !e.attr3) continue; + if(e.attr4 == tag && e.triggerstate == oldstate && checktriggertype(e.attr3, TRIG_LOCKED)) + { + if(newstate == TRIGGER_RESETTING && checktriggertype(e.attr3, TRIG_COLLIDE) && overlapsdynent(e.o, 20)) continue; + e.triggerstate = newstate; + e.lasttrigger = lastmillis; + if(checktriggertype(e.attr3, TRIG_RUMBLE)) et->rumble(e); + } + } +} + +void trigger(int *tag, int *state) +{ + if(*state) unlocktriggers(*tag); + else unlocktriggers(*tag, TRIGGERED, TRIGGER_RESETTING); +} + +COMMAND(trigger, "ii"); + +VAR(triggerstate, -1, 0, 1); + +void doleveltrigger(int trigger, int state) +{ + s_sprintfd(aliasname)("level_trigger_%d", trigger); + if(identexists(aliasname)) + { + triggerstate = state; + execute(aliasname); + } +} + +void checktriggers() +{ + if(player->state != CS_ALIVE) return; + vec o(player->o); + o.z -= player->eyeheight; + const vector &ents = et->getents(); + loopv(ents) + { + extentity &e = *ents[i]; + if(e.type != ET_MAPMODEL || !e.attr3) continue; + switch(e.triggerstate) + { + case TRIGGERING: + case TRIGGER_RESETTING: + if(lastmillis-e.lasttrigger>=1000) + { + if(e.attr4) + { + if(e.triggerstate == TRIGGERING) unlocktriggers(e.attr4); + else unlocktriggers(e.attr4, TRIGGERED, TRIGGER_RESETTING); + } + if(checktriggertype(e.attr3, TRIG_DISAPPEAR)) e.triggerstate = TRIGGER_DISAPPEARED; + else if(e.triggerstate==TRIGGERING && checktriggertype(e.attr3, TRIG_TOGGLE)) e.triggerstate = TRIGGERED; + else e.triggerstate = TRIGGER_RESET; + } + break; + case TRIGGER_RESET: + if(e.lasttrigger) + { + if(checktriggertype(e.attr3, TRIG_AUTO_RESET|TRIG_MANY|TRIG_LOCKED) && e.o.dist(o)-player->radius>=(checktriggertype(e.attr3, TRIG_COLLIDE) ? 20 : 12)) + e.lasttrigger = 0; + break; + } + else if(e.o.dist(o)-player->radius>=(checktriggertype(e.attr3, TRIG_COLLIDE) ? 20 : 12)) break; + else if(checktriggertype(e.attr3, TRIG_LOCKED)) + { + if(!e.attr4) break; + doleveltrigger(e.attr4, -1); + e.lasttrigger = lastmillis; + break; + } + e.triggerstate = TRIGGERING; + e.lasttrigger = lastmillis; + if(checktriggertype(e.attr3, TRIG_RUMBLE)) et->rumble(e); + et->trigger(e); + if(e.attr4) doleveltrigger(e.attr4, 1); + break; + case TRIGGERED: + if(e.o.dist(o)-player->radius<(checktriggertype(e.attr3, TRIG_COLLIDE) ? 20 : 12)) + { + if(e.lasttrigger) break; + } + else if(checktriggertype(e.attr3, TRIG_AUTO_RESET)) + { + if(lastmillis-e.lasttrigger<6000) break; + } + else if(checktriggertype(e.attr3, TRIG_MANY)) + { + e.lasttrigger = 0; + break; + } + else break; + if(checktriggertype(e.attr3, TRIG_COLLIDE) && overlapsdynent(e.o, 20)) break; + e.triggerstate = TRIGGER_RESETTING; + e.lasttrigger = lastmillis; + if(checktriggertype(e.attr3, TRIG_RUMBLE)) et->rumble(e); + et->trigger(e); + if(e.attr4) doleveltrigger(e.attr4, 0); + break; + } + } +} + diff --git a/src/engine/world.h b/src/engine/world.h new file mode 100644 index 0000000..19e3fdf --- /dev/null +++ b/src/engine/world.h @@ -0,0 +1,88 @@ + +enum // hardcoded texture numbers +{ + DEFAULT_SKY = 0, + DEFAULT_LIQUID, + DEFAULT_WALL, + DEFAULT_FLOOR, + DEFAULT_CEIL +}; + +#define MAPVERSION 27 // bump if map format changes, see worldio.cpp + +struct header // map file format header +{ + char head[4]; // "OCTA" + int version; // any >8bit quantity is little endian + int headersize; // sizeof(header) + int worldsize; + int numents; + int numpvs; + int lightmaps; + int mapprec, maple, mapllod; + uchar ambient; + uchar watercolour[3]; + uchar mapwlod; + uchar lerpangle, lerpsubdiv, lerpsubdivsize; + uchar mapbe; + uchar skylight[3]; + uchar lavacolour[3]; + uchar waterfallcolour[3]; + uchar reserved[10]; + char maptitle[128]; +}; + +#define WATER_AMPLITUDE 0.8f +#define WATER_OFFSET 1.1f + +enum +{ + MATSURF_NOT_VISIBLE = 0, + MATSURF_VISIBLE, + MATSURF_EDIT_ONLY +}; + +#define isliquid(mat) ((mat)==MAT_WATER || (mat)==MAT_LAVA) +#define isclipped(mat) ((mat)==MAT_GLASS) +#define isdeadly(mat) ((mat)==MAT_LAVA) + +// VVEC_FRAC must be between 0..3 +#define VVEC_FRAC 3 +#define VVEC_INT (16-VVEC_FRAC) +#define VVEC_BITS (VVEC_INT + VVEC_FRAC) + +#define VVEC_INT_MASK ((1<<(VVEC_INT-1))-1) +#define VVEC_INT_COORD(n) (((n)&VVEC_INT_MASK)<getclientmap(); + if(!*mname) mname = "untitled"; + + string pakname, mapname, cfgname; + getnames(mname, NULL, pakname, mapname, cfgname); + s_sprintfd(mcfname)("packages/%s/%s.cfg", pakname, cfgname); + path(mcfname); + result(mcfname); +} + +COMMAND(mapcfgname, ""); + +ushort readushort(gzFile f) +{ + ushort t; + gzread(f, &t, sizeof(ushort)); + endianswap(&t, sizeof(ushort), 1); + return t; +} + +void writeushort(gzFile f, ushort u) +{ + endianswap(&u, sizeof(ushort), 1); + gzwrite(f, &u, sizeof(ushort)); +} + +enum { OCTSAV_CHILDREN = 0, OCTSAV_EMPTY, OCTSAV_SOLID, OCTSAV_NORMAL, OCTSAV_LODCUBE }; + +void savec(cube *c, gzFile f, bool nolms) +{ + loopi(8) + { + if(c[i].children && (!c[i].ext || !c[i].ext->surfaces)) + { + gzputc(f, OCTSAV_CHILDREN); + savec(c[i].children, f, nolms); + } + else + { + int oflags = 0; + if(c[i].ext && c[i].ext->merged) oflags |= 0x80; + if(c[i].children) gzputc(f, oflags | OCTSAV_LODCUBE); + else if(isempty(c[i])) gzputc(f, oflags | OCTSAV_EMPTY); + else if(isentirelysolid(c[i])) gzputc(f, oflags | OCTSAV_SOLID); + else + { + gzputc(f, oflags | OCTSAV_NORMAL); + gzwrite(f, c[i].edges, 12); + } + loopj(6) writeushort(f, c[i].texture[j]); + uchar mask = 0; + if(c[i].ext) + { + if(c[i].ext->material != MAT_AIR) mask |= 0x80; + if(c[i].ext->normals && !nolms) + { + mask |= 0x40; + loopj(6) if(c[i].ext->normals[j].normals[0] != bvec(128, 128, 128)) mask |= 1 << j; + } + } + // save surface info for lighting + if(!c[i].ext || !c[i].ext->surfaces || nolms) + { + gzputc(f, mask); + if(c[i].ext) + { + if(c[i].ext->material != MAT_AIR) gzputc(f, c[i].ext->material); + if(c[i].ext->normals && !nolms) loopj(6) if(mask & (1 << j)) + { + loopk(sizeof(surfaceinfo)) gzputc(f, 0); + gzwrite(f, &c[i].ext->normals[j], sizeof(surfacenormals)); + } + } + } + else + { + loopj(6) if(c[i].ext->surfaces[j].lmid >= LMID_RESERVED) mask |= 1 << j; + gzputc(f, mask); + if(c[i].ext->material != MAT_AIR) gzputc(f, c[i].ext->material); + loopj(6) if(mask & (1 << j)) + { + surfaceinfo tmp = c[i].ext->surfaces[j]; + endianswap(&tmp.x, sizeof(ushort), 3); + gzwrite(f, &tmp, sizeof(surfaceinfo)); + if(c[i].ext->normals) gzwrite(f, &c[i].ext->normals[j], sizeof(surfacenormals)); + } + } + if(c[i].ext && c[i].ext->merged) + { + gzputc(f, c[i].ext->merged | (c[i].ext->mergeorigin ? 0x80 : 0)); + if(c[i].ext->mergeorigin) + { + gzputc(f, c[i].ext->mergeorigin); + int index = 0; + loopj(6) if(c[i].ext->mergeorigin&(1<merges[index++]; + endianswap(&tmp, sizeof(ushort), 4); + gzwrite(f, &tmp, sizeof(mergeinfo)); + } + } + } + if(c[i].children) savec(c[i].children, f, nolms); + } + } +} + +cube *loadchildren(gzFile f); + +void loadc(gzFile f, cube &c) +{ + bool haschildren = false; + int octsav = gzgetc(f); + switch(octsav&0x7) + { + case OCTSAV_CHILDREN: + c.children = loadchildren(f); + return; + + case OCTSAV_LODCUBE: haschildren = true; break; + case OCTSAV_EMPTY: emptyfaces(c); break; + case OCTSAV_SOLID: solidfaces(c); break; + case OCTSAV_NORMAL: gzread(f, c.edges, 12); break; + + default: + fatal("garbage in map"); + } + loopi(6) c.texture[i] = hdr.version<14 ? gzgetc(f) : readushort(f); + if(hdr.version < 7) loopi(3) gzgetc(f); //gzread(f, c.colour, 3); + else + { + uchar mask = gzgetc(f); + if(mask & 0x80) + { + int mat = gzgetc(f); + if(hdr.version < 27) + { + static uchar matconv[] = { MAT_AIR, MAT_WATER, MAT_CLIP, MAT_GLASS|MAT_CLIP, MAT_NOCLIP, MAT_LAVA|MAT_DEATH, MAT_AICLIP, MAT_DEATH }; + mat = size_t(mat) < sizeof(matconv)/sizeof(matconv[0]) ? matconv[mat] : MAT_AIR; + } + ext(c).material = mat; + } + if(mask & 0x3F) + { + uchar lit = 0, bright = 0; + newsurfaces(c); + if(mask & 0x40) newnormals(c); + loopi(6) + { + if(mask & (1 << i)) + { + gzread(f, &c.ext->surfaces[i], sizeof(surfaceinfo)); + endianswap(&c.ext->surfaces[i].x, sizeof(ushort), 3); + if(hdr.version < 10) ++c.ext->surfaces[i].lmid; + if(hdr.version < 18) + { + if(c.ext->surfaces[i].lmid >= LMID_AMBIENT1) ++c.ext->surfaces[i].lmid; + if(c.ext->surfaces[i].lmid >= LMID_BRIGHT1) ++c.ext->surfaces[i].lmid; + } + if(hdr.version < 19) + { + if(c.ext->surfaces[i].lmid >= LMID_DARK) c.ext->surfaces[i].lmid += 2; + } + if(mask & 0x40) gzread(f, &c.ext->normals[i], sizeof(surfacenormals)); + } + else c.ext->surfaces[i].lmid = LMID_AMBIENT; + if(c.ext->surfaces[i].lmid == LMID_BRIGHT) bright |= 1 << i; + else if(c.ext->surfaces[i].lmid != LMID_AMBIENT) lit |= 1 << i; + } + if(!lit) + { + freesurfaces(c); + if(bright) brightencube(c); + } + } + if(hdr.version >= 20) + { + if(octsav&0x80) + { + int merged = gzgetc(f); + ext(c).merged = merged&0x3F; + if(merged&0x80) + { + c.ext->mergeorigin = gzgetc(f); + int nummerges = 0; + loopi(6) if(c.ext->mergeorigin&(1<merges = new mergeinfo[nummerges]; + loopi(nummerges) + { + mergeinfo *m = &c.ext->merges[i]; + gzread(f, m, sizeof(mergeinfo)); + endianswap(m, sizeof(ushort), 4); + if(hdr.version <= 25) + { + int uorigin = m->u1 & 0xE000, vorigin = m->v1 & 0xE000; + m->u1 = (m->u1 - uorigin) << 2; + m->u2 = (m->u2 - uorigin) << 2; + m->v1 = (m->v1 - vorigin) << 2; + m->v2 = (m->v2 - vorigin) << 2; + } + } + } + } + } + } + } + c.children = (haschildren ? loadchildren(f) : NULL); +} + +cube *loadchildren(gzFile f) +{ + cube *c = newcubes(); + loopi(8) loadc(f, c[i]); + // TODO: remip c from children here + return c; +} + +bool save_world(const char *mname, bool nolms) +{ + if(!*mname) mname = cl->getclientmap(); + setnames(*mname ? mname : "untitled"); + if(savebak) backup(ogzname, bakname); + gzFile f = opengzfile(ogzname, "wb9"); + if(!f) { conoutf(CON_WARN, "could not write map to %s", ogzname); return false; } + hdr.version = MAPVERSION; + hdr.numents = 0; + const vector &ents = et->getents(); + loopv(ents) if(ents[i]->type!=ET_EMPTY || nolms) hdr.numents++; + hdr.numpvs = nolms ? 0 : getnumviewcells(); + hdr.lightmaps = nolms ? 0 : lightmaps.length(); + header tmp = hdr; + endianswap(&tmp.version, sizeof(int), 9); + gzwrite(f, &tmp, sizeof(header)); + + gzputc(f, (int)strlen(cl->gameident())); + gzwrite(f, cl->gameident(), (int)strlen(cl->gameident())+1); + writeushort(f, et->extraentinfosize()); + vector extras; + cl->writegamedata(extras); + writeushort(f, extras.length()); + gzwrite(f, extras.getbuf(), extras.length()); + + + writeushort(f, texmru.length()); + loopv(texmru) writeushort(f, texmru[i]); + char *ebuf = new char[et->extraentinfosize()]; + loopv(ents) + { + if(ents[i]->type!=ET_EMPTY || nolms) + { + entity tmp = *ents[i]; + endianswap(&tmp.o, sizeof(int), 3); + endianswap(&tmp.attr1, sizeof(short), 5); + gzwrite(f, &tmp, sizeof(entity)); + et->writeent(*ents[i], ebuf); + if(et->extraentinfosize()) gzwrite(f, ebuf, et->extraentinfosize()); + } + } + delete[] ebuf; + + savec(worldroot, f, nolms); + if(!nolms) + { + loopv(lightmaps) + { + LightMap &lm = lightmaps[i]; + gzputc(f, lm.type | (lm.unlitx>=0 ? 0x80 : 0)); + if(lm.unlitx>=0) + { + writeushort(f, ushort(lm.unlitx)); + writeushort(f, ushort(lm.unlity)); + } + gzwrite(f, lm.data, sizeof(lm.data)); + } + if(getnumviewcells()>0) savepvs(f); + } + + gzclose(f); + conoutf("wrote map file %s", ogzname); + return true; +} + +static void swapXZ(cube *c) +{ + loopi(8) + { + swap(c[i].faces[0], c[i].faces[2]); + swap(c[i].texture[0], c[i].texture[4]); + swap(c[i].texture[1], c[i].texture[5]); + if(c[i].ext && c[i].ext->surfaces) + { + swap(c[i].ext->surfaces[0], c[i].ext->surfaces[4]); + swap(c[i].ext->surfaces[1], c[i].ext->surfaces[5]); + } + if(c[i].children) swapXZ(c[i].children); + } +} + +static void fixoversizedcubes(cube *c, int size) +{ + if(size <= VVEC_INT_MASK+1) return; + loopi(8) + { + if(!c[i].children) subdividecube(c[i], true, false); + fixoversizedcubes(c[i].children, size>>1); + } +} + +bool load_world(const char *mname, const char *cname) // still supports all map formats that have existed since the earliest cube betas! +{ + int loadingstart = SDL_GetTicks(); + setnames(mname, cname); + gzFile f = opengzfile(ogzname, "rb9"); + if(!f) { conoutf(CON_ERROR, "could not read map %s", ogzname); return false; } + header newhdr; + gzread(f, &newhdr, sizeof(header)); + endianswap(&newhdr.version, sizeof(int), 9); + if(strncmp(newhdr.head, "OCTA", 4)!=0) { conoutf(CON_ERROR, "map %s has malformatted header", ogzname); gzclose(f); return false; } + if(newhdr.version>MAPVERSION) { conoutf(CON_ERROR, "map %s requires a newer version of cube 2", ogzname); gzclose(f); return false; } + hdr = newhdr; + resetmap(); + Texture *mapshot = textureload(picname, 0, true, false); + computescreen("loading...", mapshot!=notexture ? mapshot : NULL, mname); + if(hdr.version<=20) conoutf(CON_WARN, "loading older / less efficient map format, may benefit from \"calclight 2\", then \"savecurrentmap\""); + if(!hdr.ambient) hdr.ambient = 25; + if(!hdr.lerpsubdivsize) + { + if(!hdr.lerpangle) hdr.lerpangle = 44; + hdr.lerpsubdiv = 2; + hdr.lerpsubdivsize = 4; + } + setvar("lightprecision", hdr.mapprec ? hdr.mapprec : 32); + setvar("lighterror", hdr.maple ? hdr.maple : 8); + setvar("bumperror", hdr.mapbe ? hdr.mapbe : 3); + setvar("lightlod", hdr.mapllod); + setvar("lodsize", hdr.mapwlod); + setvar("ambient", hdr.ambient); + setvar("fullbright", 0); + setvar("lerpangle", hdr.lerpangle); + setvar("lerpsubdiv", hdr.lerpsubdiv); + setvar("lerpsubdivsize", hdr.lerpsubdivsize); + + string gametype; + s_strcpy(gametype, "fps"); + bool samegame = true; + int eif = 0; + if(hdr.version>=16) + { + int len = gzgetc(f); + gzread(f, gametype, len+1); + } + if(strcmp(gametype, cl->gameident())!=0) + { + samegame = false; + conoutf(CON_WARN, "WARNING: loading map from %s game, ignoring entities except for lights/mapmodels)", gametype); + } + if(hdr.version>=16) + { + eif = readushort(f); + int extrasize = readushort(f); + vector extras; + loopj(extrasize) extras.add(gzgetc(f)); + if(samegame) cl->readgamedata(extras); + } + + show_out_of_renderloop_progress(0, "clearing world..."); + + texmru.setsize(0); + if(hdr.version<14) + { + uchar oldtl[256]; + gzread(f, oldtl, sizeof(oldtl)); + loopi(256) texmru.add(oldtl[i]); + } + else + { + ushort nummru = readushort(f); + loopi(nummru) texmru.add(readushort(f)); + } + + freeocta(worldroot); + worldroot = NULL; + + show_out_of_renderloop_progress(0, "loading entities..."); + + vector &ents = et->getents(); + char *ebuf = new char[et->extraentinfosize()]; + loopi(hdr.numents) + { + extentity &e = *et->newentity(); + ents.add(&e); + gzread(f, &e, sizeof(entity)); + endianswap(&e.o, sizeof(int), 3); + endianswap(&e.attr1, sizeof(short), 5); + e.spawned = false; + e.inoctanode = false; + if(samegame) + { + if(et->extraentinfosize()) gzread(f, ebuf, et->extraentinfosize()); + et->readent(e, ebuf); + } + else + { + loopj(eif) gzgetc(f); + } + if(hdr.version <= 14 && e.type >= ET_MAPMODEL && e.type <= 16) + { + if(e.type == 16) e.type = ET_MAPMODEL; + else e.type++; + } + if(hdr.version <= 20 && e.type >= ET_ENVMAP) e.type++; + if(hdr.version <= 21 && e.type >= ET_PARTICLES) e.type++; + if(hdr.version <= 22 && e.type >= ET_SOUND) e.type++; + if(hdr.version <= 23 && e.type >= ET_SPOTLIGHT) e.type++; + if(!samegame) + { + if(e.type>=ET_GAMESPECIFIC || hdr.version<=14) + { + ents.pop(); + continue; + } + } + if(!insideworld(e.o)) + { + if(e.type != ET_LIGHT && e.type != ET_SPOTLIGHT) + { + conoutf(CON_WARN, "warning: ent outside of world: enttype[%s] index %d (%f, %f, %f)", et->entname(e.type), i, e.o.x, e.o.y, e.o.z); + } + } + if(hdr.version <= 14 && e.type == ET_MAPMODEL) + { + e.o.z += e.attr3; + if(e.attr4) conoutf(CON_WARN, "warning: mapmodel ent (index %d) uses texture slot %d", i, e.attr4); + e.attr3 = e.attr4 = 0; + } + } + delete[] ebuf; + + show_out_of_renderloop_progress(0, "loading octree..."); + worldroot = loadchildren(f); + + if(hdr.version <= 11) + swapXZ(worldroot); + + if(hdr.version <= 8) + converttovectorworld(); + + if(hdr.version <= 25 && hdr.worldsize > VVEC_INT_MASK+1) + fixoversizedcubes(worldroot, hdr.worldsize>>1); + + show_out_of_renderloop_progress(0, "validating..."); + validatec(worldroot, hdr.worldsize>>1); + + worldscale = 0; + while(1<= 7) loopi(hdr.lightmaps) + { + show_out_of_renderloop_progress(i/(float)hdr.lightmaps, "loading lightmaps..."); + LightMap &lm = lightmaps.add(); + if(hdr.version >= 17) + { + int type = gzgetc(f); + lm.type = type&0xF; + if(hdr.version >= 20 && type&0x80) + { + lm.unlitx = readushort(f); + lm.unlity = readushort(f); + } + } + gzread(f, lm.data, 3 * LM_PACKW * LM_PACKH); + lm.finalize(); + } + + if(hdr.version >= 25 && hdr.numpvs > 0) loadpvs(f); + + gzclose(f); + + conoutf("read map %s (%.1f seconds)", ogzname, (SDL_GetTicks()-loadingstart)/1000.0f); + if(hdr.maptitle[0]) conoutf(CON_ECHO, "%s", hdr.maptitle); + + overrideidents = true; + execfile("data/default_map_settings.cfg"); + execfile(pcfname); + execfile(mcfname); + overrideidents = false; + + extern void fixlightmapnormals(); + if(hdr.version <= 25) fixlightmapnormals(); + + loopv(ents) + { + extentity &e = *ents[i]; + if(e.type==ET_MAPMODEL && e.attr2 >= 0) + { + mapmodelinfo &mmi = getmminfo(e.attr2); + if(!&mmi) conoutf(CON_WARN, "could not find map model: %d", e.attr2); + else if(!loadmodel(NULL, e.attr2, true)) conoutf(CON_WARN, "could not load model: %s", mmi.name); + } + } + + cl->preload(); + + initlights(); + allchanged(true); + + computescreen("loading...", mapshot!=notexture ? mapshot : NULL, mname); + attachentities(); + + startmap(cname ? cname : mname); + return true; +} + +void savecurrentmap() { save_world(cl->getclientmap()); } +void savemap(char *mname) { save_world(mname); } + +COMMAND(savemap, "s"); +COMMAND(savecurrentmap, ""); + +void writeobj(char *name) +{ + s_sprintfd(fname)("%s.obj", name); + FILE *f = openfile(path(fname), "w"); + if(!f) return; + fprintf(f, "# obj file of sauerbraten level\n"); + extern vector valist; + loopv(valist) + { + vtxarray &va = *valist[i]; + ushort *edata = NULL; + uchar *vdata = NULL; + if(!readva(&va, edata, vdata)) continue; + int vtxsize = VTXSIZE; + uchar *vert = vdata; + loopj(va.verts) + { + vec v; + if(floatvtx) (v = *(vec *)vert).div(1<tovec(va.o).add(0x8000>>VVEC_FRAC); + if(v.x != floor(v.x)) fprintf(f, "v %.3f ", v.x); else fprintf(f, "v %d ", int(v.x)); + if(v.y != floor(v.y)) fprintf(f, "%.3f ", v.y); else fprintf(f, "%d ", int(v.y)); + if(v.z != floor(v.z)) fprintf(f, "%.3f\n", v.z); else fprintf(f, "%d\n", int(v.z)); + vert += vtxsize; + } + ushort *tri = edata; + loopi(va.tris) + { + fprintf(f, "f"); + for(int k = 0; k<3; k++) fprintf(f, " %d", tri[k]-va.verts-va.voffset); + tri += 3; + fprintf(f, "\n"); + } + delete[] edata; + delete[] vdata; + } + fclose(f); +} + +COMMAND(writeobj, "s"); + diff --git a/src/fpsgame/CVS/Entries b/src/fpsgame/CVS/Entries new file mode 100644 index 0000000..de4e705 --- /dev/null +++ b/src/fpsgame/CVS/Entries @@ -0,0 +1,15 @@ +/assassin.h/1.11/Tue Jun 17 05:41:02 2008// +/entities.h/1.120/Mon Jun 9 20:17:31 2008// +/extinfo.h/1.5/Sun Jun 15 09:01:46 2008// +/fpsrender.h/1.98/Sun Jun 1 13:53:21 2008// +/game.h/1.117/Mon Jun 9 19:47:44 2008// +/monster.h/1.71/Mon Jun 9 20:17:31 2008// +/movable.h/1.10/Mon Jun 9 20:17:31 2008// +/weapon.h/1.198/Mon Jun 9 20:32:30 2008// +/capture.h/1.125/Sat Jun 21 12:11:27 2008// +/client.h/1.222/Sat Jun 21 12:11:27 2008// +/ctf.h/1.29/Sat Jun 21 12:11:27 2008// +/fps.cpp/1.270/Sat Jun 21 12:11:28 2008// +/fpsserver.h/1.265/Sat Jun 21 12:11:28 2008// +/scoreboard.h/1.92/Sat Jun 21 12:11:28 2008// +D diff --git a/src/fpsgame/CVS/Repository b/src/fpsgame/CVS/Repository new file mode 100644 index 0000000..a8b6d04 --- /dev/null +++ b/src/fpsgame/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/fpsgame diff --git a/src/fpsgame/CVS/Root b/src/fpsgame/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/fpsgame/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/fpsgame/assassin.h b/src/fpsgame/assassin.h new file mode 100644 index 0000000..36415cf --- /dev/null +++ b/src/fpsgame/assassin.h @@ -0,0 +1,218 @@ +#ifdef ASSASSINSERV +struct assassinservmode : servmode +{ + vector targets; + + assassinservmode(fpsserver &sv) : servmode(sv) {} + + void findvalidtargets() + { + targets.setsizenodelete(0); + loopv(sv.clients) + { + clientinfo *ci = sv.clients[i]; + if(ci->state.state!=CS_ALIVE && ci->state.state!=CS_DEAD) continue; + targets.add(ci); + } + } + + clientinfo *choosetarget(clientinfo *exclude1, clientinfo *exclude2 = NULL) + { + if(targets.length() <= (exclude1 ? 1 : 0)) return NULL; + if(exclude2 && targets.length() < 3) exclude2 = NULL; + clientinfo *target = NULL; + do target = targets[rnd(targets.length())]; + while(target==exclude1 || target==exclude2); + return target; + } + + void sendnewtarget(clientinfo *hunter, clientinfo *exclude = NULL) + { + clientinfo *target = choosetarget(hunter, exclude); + if(!target) return; + hunter->targets.add(target); + sendf(hunter->clientnum, 1, "ri2", SV_ADDTARGET, target->clientnum); + sendf(target->clientnum, 1, "ri2", SV_ADDHUNTER, hunter->clientnum); + } + + void leavegame(clientinfo *ci, bool disconnecting = false) + { + loopv(ci->targets) + { + clientinfo *target = ci->targets[i]; + sendf(target->clientnum, 1, "ri2", SV_REMOVEHUNTER, ci->clientnum); + } + ci->targets.setsizenodelete(0); + findvalidtargets(); + targets.removeobj(ci); + loopv(sv.clients) + { + clientinfo *hunter = sv.clients[i]; + if(hunter->state.state!=CS_ALIVE && hunter->state.state!=CS_DEAD) continue; + if(hunter->targets.find(ci)<0) continue; + hunter->targets.removeobj(ci); + sendf(hunter->clientnum, 1, "ri2", SV_REMOVETARGET, ci->clientnum); + if(hunter->targets.empty()) sendnewtarget(hunter); + } + if(!disconnecting) sendf(ci->clientnum, 1, "ri2", SV_CLEARTARGETS, SV_CLEARHUNTERS); + + } + + void checkneedstarget(clientinfo *ci, clientinfo *exclude = NULL) + { + if(ci->targets.empty()) + { + findvalidtargets(); + sendnewtarget(ci, exclude); + } + } + + void sendnewtargets() + { + findvalidtargets(); + loopv(targets) + { + clientinfo *hunter = targets[i]; + if(hunter->targets.empty()) sendnewtarget(hunter); + } + } + + void entergame(clientinfo *ci) + { + sendnewtargets(); + } + + void spawned(clientinfo *ci) + { + sendnewtargets(); + } + + int fragvalue(clientinfo *victim, clientinfo *actor) + { + if(victim==actor) return -1; + if(actor->targets.find(victim)>=0) return 1; + if(victim->targets.find(actor)>=0) return 0; + return -1; + } + + void died(clientinfo *victim, clientinfo *actor) + { + if(!actor || actor==victim) return; + if(actor->targets.find(victim)>=0) + { + actor->targets.removeobj(victim); + checkneedstarget(actor, victim); + } + else if(victim->targets.find(actor)<0) + { + victim->targets.add(actor); + sendf(victim->clientnum, 1, "ri2", SV_ADDTARGET, actor->clientnum); + sendf(actor->clientnum, 1, "ri2", SV_ADDHUNTER, victim->clientnum); + } + } +}; + +#else +struct assassinclient +{ + static const int RESPAWNSECS = 10; + + fpsclient &cl; + vector targets, hunters; + float radarscale; + + assassinclient(fpsclient &cl) : cl(cl), radarscale(0) {} + + void removeplayer(fpsent *d) + { + targets.removeobj(d); + hunters.removeobj(d); + } + + void reset() + { + targets.setsize(0); + hunters.setsize(0); + + vec center(0, 0, 0); + int numents = 0; + loopv(cl.et.ents) + { + extentity *e = cl.et.ents[i]; + if(e->typetype!=ET_PLAYERSTART) continue; + center.add(e->o); + numents++; + } + if(numents) center.div(numents); + radarscale = 0; + loopv(cl.et.ents) + { + extentity *e = cl.et.ents[i]; + if(e->typetype!=ET_PLAYERSTART) continue; + radarscale = max(radarscale, 2*center.dist(e->o)); + } + } + + void drawradar(float x, float y, float s) + { + glTexCoord2f(0.0f, 0.0f); glVertex2f(x, y); + glTexCoord2f(1.0f, 0.0f); glVertex2f(x+s, y); + glTexCoord2f(1.0f, 1.0f); glVertex2f(x+s, y+s); + glTexCoord2f(0.0f, 1.0f); glVertex2f(x, y+s); + } + + void drawblips(vector &blips, float x, float y, float s, float scale) + { + glBegin(GL_QUADS); + loopv(blips) + { + fpsent *d = blips[i]; + vec dir(d->o); + dir.sub(cl.player1->o); + dir.z = 0.0f; + float dist = dir.magnitude(); + if(dist >= scale) dir.mul(scale/dist); + dir.rotate_around_z(-cl.player1->yaw*RAD); + drawradar(x + s*0.5f*0.95f*(1.0f+dir.x/scale), y + s*0.5f*0.95f*(1.0f+dir.y/scale), 0.05f*s); + } + glEnd(); + } + + int respawnwait() + { + return max(0, RESPAWNSECS - (cl.lastmillis - cl.player1->lastpain)/1000); + } + + void drawhud(int w, int h) + { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + float x = 1800*w/h*34/40, y = 1800*1/40, s = 1800*w/h*5/40; + glColor3f(1, 1, 1); + settexture("packages/hud/radar.png"); + glBegin(GL_QUADS); + drawradar(x, y, s); + glEnd(); + float scale = radarscale<=0 || radarscale>cl.maxradarscale() ? cl.maxradarscale() : radarscale; + if(hunters.length()) + { + settexture("packages/hud/blip_grey.png"); + drawblips(hunters, x, y, s, scale); + } + if(targets.length()) + { + settexture("packages/hud/blip_red.png"); + drawblips(targets, x, y, s, scale); + } + if(cl.player1->state == CS_DEAD) + { + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, w*900/h, 900, 0, -1, 1); + int wait = respawnwait(); + draw_textf("%d", int((x+s/2)/2-(wait>=10 ? 28 : 16)), int((y+s/2)/2-32), wait); + glPopMatrix(); + } + } +}; +#endif + diff --git a/src/fpsgame/capture.h b/src/fpsgame/capture.h new file mode 100644 index 0000000..6477d82 --- /dev/null +++ b/src/fpsgame/capture.h @@ -0,0 +1,851 @@ +// capture.h: client and server state for capture gamemode + +struct capturestate +{ + static const int CAPTURERADIUS = 64; + static const int CAPTUREHEIGHT = 24; + static const int OCCUPYPOINTS = 15; + static const int OCCUPYLIMIT = 100; + static const int CAPTURESCORE = 1; + static const int SCORESECS = 10; + static const int AMMOSECS = 15; + static const int REGENSECS = 1; + static const int REGENHEALTH = 10; + static const int REGENARMOUR = 10; + static const int REGENAMMO = 20; + static const int MAXAMMO = 5; + static const int REPAMMODIST = 32; + static const int RESPAWNSECS = 10; + + struct baseinfo + { + vec o; + string owner, enemy; +#ifndef CAPTURESERV + vec ammopos; + string name, info; + extentity *ent; +#endif + int ammogroup, ammotype, ammo, owners, enemies, converted, capturetime; + + baseinfo() { reset(); } + + void noenemy() + { + enemy[0] = '\0'; + enemies = 0; + converted = 0; + } + + void reset() + { + noenemy(); + owner[0] = '\0'; + capturetime = -1; + ammogroup = 0; + ammotype = 0; + ammo = 0; + owners = 0; + } + + bool enter(const char *team) + { + if(!strcmp(owner, team)) + { + owners++; + return false; + } + if(!enemies) + { + if(strcmp(enemy, team)) + { + converted = 0; + s_strcpy(enemy, team); + } + enemies++; + return true; + } + else if(strcmp(enemy, team)) return false; + else enemies++; + return false; + } + + bool steal(const char *team) + { + return !enemies && strcmp(owner, team); + } + + bool leave(const char *team) + { + if(!strcmp(owner, team)) + { + owners--; + return false; + } + if(strcmp(enemy, team)) return false; + enemies--; + return !enemies; + } + + int occupy(const char *team, int units) + { + if(strcmp(enemy, team)) return -1; + converted += units; + if(units<0) + { + if(converted<=0) noenemy(); + return -1; + } + else if(converted<(owner[0] ? 2 : 1)*OCCUPYLIMIT) return -1; + if(owner[0]) { owner[0] = '\0'; converted = 0; s_strcpy(enemy, team); return 0; } + else { s_strcpy(owner, team); ammo = 0; capturetime = 0; owners = enemies; noenemy(); return 1; } + } + + bool addammo(int i) + { + if(ammo>=MAXAMMO) return false; + ammo = min(ammo+i, int(MAXAMMO)); + return true; + } + + bool takeammo(const char *team) + { + if(strcmp(owner, team) || ammo<=0) return false; + ammo--; + return true; + } + }; + + vector bases; + + struct score + { + string team; + int total; + }; + + vector scores; + + int captures; + + capturestate() : captures(0) {} + + void reset() + { + bases.setsize(0); + scores.setsize(0); + captures = 0; + } + + score &findscore(const char *team) + { + loopv(scores) + { + score &cs = scores[i]; + if(!strcmp(cs.team, team)) return cs; + } + score &cs = scores.add(); + s_strcpy(cs.team, team); + cs.total = 0; + return cs; + } + + void addbase(int ammotype, const vec &o) + { + baseinfo &b = bases.add(); + b.ammogroup = min(ammotype, 0); + b.ammotype = ammotype > 0 ? ammotype : rnd(5)+1; + b.o = o; + + if(b.ammogroup) + { + loopv(bases) if(b.ammogroup==bases[i].ammogroup) b.ammotype = bases[i].ammotype; + } + } + + void initbase(int i, int ammotype, const char *owner, const char *enemy, int converted, int ammo) + { + if(!bases.inrange(i)) return; + baseinfo &b = bases[i]; + b.ammotype = ammotype; + s_strcpy(b.owner, owner); + s_strcpy(b.enemy, enemy); + b.converted = converted; + b.ammo = ammo; + } + + bool hasbases(const char *team) + { + loopv(bases) + { + baseinfo &b = bases[i]; + if(b.owner[0] && !strcmp(b.owner, team)) return true; + } + return false; + } + + float disttoenemy(baseinfo &b) + { + float dist = 1e10f; + loopv(bases) + { + baseinfo &e = bases[i]; + if(e.owner[0] && strcmp(b.owner, e.owner)) + dist = min(dist, b.o.dist(e.o)); + } + return dist; + } + + bool insidebase(const baseinfo &b, const vec &o) + { + float dx = (b.o.x-o.x), dy = (b.o.y-o.y), dz = (b.o.z-o.z+14); + return dx*dx + dy*dy <= CAPTURERADIUS*CAPTURERADIUS && fabs(dz) <= CAPTUREHEIGHT; + } +}; + +#ifndef CAPTURESERV + +struct captureclient : capturestate +{ + static const int FIREBALLRADIUS = 5; + + fpsclient &cl; + float radarscale; + int lastrepammo; + + IVARP(capturetether, 0, 1, 1); + IVARP(autorepammo, 0, 1, 1); + + captureclient(fpsclient &cl) : cl(cl), radarscale(0), lastrepammo(-1) + { + CCOMMAND(repammo, "", (captureclient *self), self->replenishammo()); + } + + void replenishammo() + { + int gamemode = cl.gamemode; + if(m_noitems) return; + loopv(bases) + { + baseinfo &b = bases[i]; + if(b.ammotype>0 && b.ammotype<=I_CARTRIDGES-I_SHELLS+1 && insidebase(b, cl.player1->o) && cl.player1->hasmaxammo(b.ammotype-1+I_SHELLS)) return; + } + cl.cc.addmsg(SV_REPAMMO, "r"); + } + + void receiveammo(int type) + { + type += I_SHELLS-1; + if(typeI_CARTRIDGES) return; + cl.et.repammo(cl.player1, type); + } + + void checkbaseammo(fpsent *d) + { + int gamemode = cl.gamemode; + if(m_noitems || !autorepammo() || d!=cl.player1 || d->state!=CS_ALIVE) return; + vec o = d->o; + o.z -= d->eyeheight; + loopv(bases) + { + baseinfo &b = bases[i]; + if(b.ammotype>0 && b.ammotype<=I_CARTRIDGES-I_SHELLS+1 && insidebase(b, d->o) && !strcmp(b.owner, d->team) && b.o.dist(o) < 12) + { + if(lastrepammo!=i) + { + if(b.ammo > 0 && !cl.player1->hasmaxammo(b.ammotype-1+I_SHELLS)) cl.cc.addmsg(SV_REPAMMO, "r"); + lastrepammo = i; + } + return; + } + } + lastrepammo = -1; + } + + void rendertether(fpsent *d) + { + int oldbase = d->lastbase; + d->lastbase = -1; + vec pos(d->o.x, d->o.y, d->o.z + (d->aboveeye - d->eyeheight)/2); + if(d->state==CS_ALIVE) + { + loopv(bases) + { + baseinfo &b = bases[i]; + if(!insidebase(b, d->o) || (strcmp(b.owner, d->team) && strcmp(b.enemy, d->team))) continue; + particle_flare(b.ammopos, pos, 0, strcmp(d->team, cl.player1->team) ? 29 : 30); + if(oldbase < 0) + { + particle_fireball(pos, 4, strcmp(d->team, cl.player1->team) ? 31 : 32, 250); + particle_splash(0, 50, 250, pos); + } + d->lastbase = i; + } + } + if(d->lastbase < 0 && oldbase >= 0) + { + particle_fireball(pos, 4, strcmp(d->team, cl.player1->team) ? 31 : 32, 250); + particle_splash(0, 50, 250, pos); + } + } + + void preloadbases() + { + static const char *basemodels[3] = { "base/neutral", "base/red", "base/blue" }; + loopi(3) loadmodel(basemodels[i], -1, true); + } + + void renderbases() + { + int gamemode = cl.gamemode; + extern bool shadowmapping; + if(capturetether() && !shadowmapping) + { + loopv(cl.players) + { + fpsent *d = cl.players[i]; + if(d) rendertether(d); + } + rendertether(cl.player1); + } + loopv(bases) + { + baseinfo &b = bases[i]; + const char *flagname = b.owner[0] ? (strcmp(b.owner, cl.player1->team) ? "base/red" : "base/blue") : "base/neutral"; + rendermodel(&b.ent->light, flagname, ANIM_MAPMODEL|ANIM_LOOP, b.o, 0, 0, MDL_SHADOW | MDL_CULL_VFC | MDL_CULL_OCCLUDED); + particle_fireball(b.ammopos, 5, b.owner[0] ? (strcmp(b.owner, cl.player1->team) ? 31 : 32) : 33, 0); + + if(!m_noitemsrail && b.ammotype>0 && b.ammotype<=I_CARTRIDGES-I_SHELLS+1) + { + const char *ammoname = cl.et.entmdlname(I_SHELLS+b.ammotype-1); + if(m_noitems) + { + vec height(0, 0, 0); + abovemodel(height, ammoname); + vec ammopos(b.ammopos); + ammopos.z -= height.z/2 + sinf(cl.lastmillis/100.0f)/20; + rendermodel(&b.ent->light, ammoname, ANIM_MAPMODEL|ANIM_LOOP, ammopos, cl.lastmillis/10.0f, 0, MDL_SHADOW | MDL_CULL_VFC | MDL_CULL_OCCLUDED); + } + else loopj(b.ammo) + { + float angle = 2*M_PI*(cl.lastmillis/4000.0f + j/float(MAXAMMO)); + vec ammopos(b.o); + ammopos.x += 10*cosf(angle); + ammopos.y += 10*sinf(angle); + ammopos.z += 4; + rendermodel(&b.ent->light, cl.et.entmdlname(I_SHELLS+b.ammotype-1), ANIM_MAPMODEL|ANIM_LOOP, ammopos, 0, 0, MDL_SHADOW | MDL_CULL_VFC | MDL_CULL_OCCLUDED); + } + } + + int ttype = 11, mtype = -1; + if(b.owner[0]) + { + bool isowner = !strcmp(b.owner, cl.player1->team); +#if 0 + if(b.enemy[0]) + { + s_sprintf(b.info)("\f%d%s \f0vs. \f%d%s", isowner ? 3 : 1, b.enemy, isowner ? 1 : 3, b.owner); + mtype = isowner ? 19 : 20; + } + else { s_sprintf(b.info)("%s", b.owner); ttype = isowner ? 16 : 13; } +#else + if(b.enemy[0]) mtype = isowner ? 19 : 20; + s_sprintf(b.info)("%s", b.owner); ttype = isowner ? 16 : 13; +#endif + } + else if(b.enemy[0]) + { + s_sprintf(b.info)("%s", b.enemy); + if(strcmp(b.enemy, cl.player1->team)) { ttype = 13; mtype = 17; } + else { ttype = 16; mtype = 18; } + } + else b.info[0] = '\0'; + + vec above(b.ammopos); + above.z += FIREBALLRADIUS+1.0f; + particle_text(above, b.info, ttype, 1); + if(mtype>=0) + { + above.z += 3.0f; + particle_meter(above, b.converted/float((b.owner[0] ? 2 : 1) * OCCUPYLIMIT), mtype, 1); + } + } + } + + void drawradar(float x, float y, float s) + { + glTexCoord2f(0.0f, 0.0f); glVertex2f(x, y); + glTexCoord2f(1.0f, 0.0f); glVertex2f(x+s, y); + glTexCoord2f(1.0f, 1.0f); glVertex2f(x+s, y+s); + glTexCoord2f(0.0f, 1.0f); glVertex2f(x, y+s); + } + + void drawblips(fpsent *d, int x, int y, int s, int type, bool skipenemy = false) + { + const char *textures[3] = {"packages/hud/blip_red.png", "packages/hud/blip_grey.png", "packages/hud/blip_blue.png"}; + settexture(textures[max(type+1, 0)]); + glBegin(GL_QUADS); + float scale = radarscale<=0 || radarscale>cl.maxradarscale() ? cl.maxradarscale() : radarscale; + loopv(bases) + { + baseinfo &b = bases[i]; + if(skipenemy && b.enemy[0]) continue; + switch(type) + { + case 1: if(!b.owner[0] || strcmp(b.owner, cl.player1->team)) continue; break; + case 0: if(b.owner[0]) continue; break; + case -1: if(!b.owner[0] || !strcmp(b.owner, cl.player1->team)) continue; break; + case -2: if(!b.enemy[0] || !strcmp(b.enemy, cl.player1->team)) continue; break; + } + vec dir(b.o); + dir.sub(d->o); + dir.z = 0.0f; + float dist = dir.magnitude(); + if(dist >= scale*(1 - 0.05f)) dir.mul(scale*(1 - 0.05f)/dist); + dir.rotate_around_z(-d->yaw*RAD); + drawradar(x + s*0.5f*(1.0f + dir.x/scale - 0.05f), y + s*0.5f*(1.0f + dir.y/scale - 0.05f), 0.05f*s); + } + glEnd(); + } + + int respawnwait(fpsent *d) + { + int gamemode = cl.gamemode; + if(m_regencapture) return -1; + return max(0, (m_noitemsrail ? RESPAWNSECS/2 : RESPAWNSECS)-(cl.lastmillis-d->lastpain)/1000); + } + + void capturehud(fpsent *d, int w, int h) + { + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + int x = 1800*w/h*34/40, y = 1800*1/40, s = 1800*w/h*5/40; + glColor3f(1, 1, 1); + settexture("packages/hud/radar.png"); + glBegin(GL_QUADS); + drawradar(float(x), float(y), float(s)); + glEnd(); + bool showenemies = cl.lastmillis%1000 >= 500; + drawblips(d, x, y, s, 1, showenemies); + drawblips(d, x, y, s, 0, showenemies); + drawblips(d, x, y, s, -1, showenemies); + if(showenemies) drawblips(d, x, y, s, -2); + if(d->state == CS_DEAD) + { + int wait = respawnwait(d); + if(wait>=0) + { + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, w*900/h, 900, 0, -1, 1); + bool flash = wait>0 && d==cl.player1 && cl.lastspawnattempt>=d->lastpain && cl.lastmillis < cl.lastspawnattempt+100; + draw_textf("%s%d", (x+s/2)/2-(wait>=10 ? 28 : 16), (y+s/2)/2-32, flash ? "\f3" : "", wait); + glPopMatrix(); + } + } + } + + void setupbases() + { + reset(); + loopv(cl.et.ents) + { + extentity *e = cl.et.ents[i]; + if(e->type!=BASE) continue; + baseinfo &b = bases.add(); + b.o = e->o; + b.ammopos = b.o; + abovemodel(b.ammopos, "base/neutral"); + b.ammopos.z += FIREBALLRADIUS-2; + b.ammotype = e->attr1; + s_sprintfd(alias)("base_%d", e->attr2); + const char *name = getalias(alias); + if(name[0]) s_strcpy(b.name, name); else s_sprintf(b.name)("base %d", bases.length()); + b.ent = e; + } + vec center(0, 0, 0); + loopv(bases) center.add(bases[i].o); + center.div(bases.length()); + radarscale = 0; + loopv(bases) radarscale = max(radarscale, 2*center.dist(bases[i].o)); + lastrepammo = -1; + } + + void sendbases(ucharbuf &p) + { + putint(p, SV_BASES); + putint(p, bases.length()); + loopv(bases) + { + baseinfo &b = bases[i]; + putint(p, b.ammotype); + putint(p, int(b.o.x*DMF)); + putint(p, int(b.o.y*DMF)); + putint(p, int(b.o.z*DMF)); + } + } + + void updatebase(int i, const char *owner, const char *enemy, int converted, int ammo) + { + if(!bases.inrange(i)) return; + baseinfo &b = bases[i]; + if(owner[0]) + { + if(strcmp(b.owner, owner)) + { + conoutf(CON_GAMEINFO, "\f2%s captured %s", owner, b.name); + if(!strcmp(owner, cl.player1->team)) playsound(S_V_BASECAP); + } + } + else if(b.owner[0]) + { + conoutf(CON_GAMEINFO, "\f2%s lost %s", b.owner, b.name); + if(!strcmp(b.owner, cl.player1->team)) playsound(S_V_BASELOST); + } + if(strcmp(b.owner, owner)) particle_splash(0, 200, 250, b.ammopos); + s_strcpy(b.owner, owner); + s_strcpy(b.enemy, enemy); + b.converted = converted; + if(ammo>b.ammo) playsound(S_ITEMSPAWN, &b.o); + b.ammo = ammo; + } + + void setscore(const char *team, int total) + { + findscore(team).total = total; + if(total>=10000) conoutf(CON_GAMEINFO, "team %s captured all bases", team); + } + + int closesttoenemy(const char *team, bool noattacked = false, bool farthest = false) + { + float bestdist = farthest ? -1e10f : 1e10f; + int best = -1; + int attackers = INT_MAX, attacked = -1; + loopv(bases) + { + baseinfo &b = bases[i]; + if(!b.owner[0] || strcmp(b.owner, team)) continue; + if(noattacked && b.enemy[0]) continue; + float dist = disttoenemy(b); + if(farthest ? dist > bestdist : dist < bestdist) + { + best = i; + bestdist = dist; + } + else if(b.enemy[0] && b.enemies < attackers) + { + attacked = i; + attackers = b.enemies; + } + } + if(best < 0) return attacked; + return best; + } + + int pickspawn(const char *team) + { + int gamemode = cl.gamemode, closest = closesttoenemy(team, true, m_regencapture); + if(!m_regencapture && closest < 0) closest = closesttoenemy(team, false); + if(closest < 0) return -1; + baseinfo &b = bases[closest]; + + float bestdist = 1e10f, altdist = 1e10f; + int best = -1, alt = -1; + loopv(cl.et.ents) + { + extentity *e = cl.et.ents[i]; + if(e->type!=PLAYERSTART || e->attr2) continue; + float dist = e->o.dist(b.o); + if(dist < bestdist) + { + alt = best; + altdist = bestdist; + best = i; + bestdist = dist; + } + else if(dist < altdist) + { + alt = i; + altdist = dist; + } + } + return rnd(2) ? best : alt; + } +}; + +#else + +struct captureservmode : capturestate, servmode +{ + int scoresec; + bool notgotbases; + + captureservmode(fpsserver &sv) : servmode(sv), scoresec(0), notgotbases(false) {} + + void reset(bool empty) + { + capturestate::reset(); + scoresec = 0; + notgotbases = !empty; + } + + void stealbase(int n, const char *team) + { + baseinfo &b = bases[n]; + loopv(sv.clients) + { + fpsserver::clientinfo *ci = sv.clients[i]; + if(!ci->spectator && ci->state.state==CS_ALIVE && ci->team[0] && !strcmp(ci->team, team) && insidebase(b, ci->state.o)) + b.enter(ci->team); + } + sendbaseinfo(n); + } + + void replenishammo(clientinfo *ci) + { + int gamemode = sv.gamemode; + if(m_noitems || notgotbases || ci->state.state!=CS_ALIVE || !ci->team[0]) return; + loopv(bases) + { + baseinfo &b = bases[i]; + if(b.ammotype>0 && b.ammotype<=I_CARTRIDGES-I_SHELLS+1 && insidebase(b, ci->state.o) && !ci->state.hasmaxammo(b.ammotype-1+I_SHELLS) && b.takeammo(ci->team)) + { + sendbaseinfo(i); + sendf(ci->clientnum, 1, "rii", SV_REPAMMO, b.ammotype); + ci->state.addammo(b.ammotype); + break; + } + } + } + + void movebases(const char *team, const vec &oldpos, const vec &newpos) + { + if(!team[0] || sv.minremain<0) return; + loopv(bases) + { + baseinfo &b = bases[i]; + bool leave = insidebase(b, oldpos), + enter = insidebase(b, newpos); + if(leave && !enter && b.leave(team)) sendbaseinfo(i); + else if(enter && !leave && b.enter(team)) sendbaseinfo(i); + else if(leave && enter && b.steal(team)) stealbase(i, team); + } + } + + void leavebases(const char *team, const vec &o) + { + movebases(team, o, vec(-1e10f, -1e10f, -1e10f)); + } + + void enterbases(const char *team, const vec &o) + { + movebases(team, vec(-1e10f, -1e10f, -1e10f), o); + } + + void addscore(const char *team, int n) + { + if(!n) return; + score &cs = findscore(team); + cs.total += n; + sendf(-1, 1, "risi", SV_TEAMSCORE, team, cs.total); + } + + void regenowners(baseinfo &b, int ticks) + { + loopv(sv.clients) + { + fpsserver::clientinfo *ci = sv.clients[i]; + if(!ci->spectator && ci->state.state==CS_ALIVE && ci->team[0] && !strcmp(ci->team, b.owner) && insidebase(b, ci->state.o)) + { + bool notify = false; + if(ci->state.health < ci->state.maxhealth) + { + ci->state.health = min(ci->state.health + ticks*REGENHEALTH, ci->state.maxhealth); + notify = true; + } + if(ci->state.armour < itemstats[I_GREENARMOUR-I_SHELLS].max) + { + ci->state.armour = min(ci->state.armour + ticks*REGENARMOUR, itemstats[I_GREENARMOUR-I_SHELLS].max); + notify = true; + } + if(b.ammotype>0) + { + int ammotype = b.ammotype-1+I_SHELLS; + if(ammotype<=I_CARTRIDGES && !ci->state.hasmaxammo(ammotype)) + { + ci->state.addammo(b.ammotype, ticks*REGENAMMO, 100); + notify = true; + } + } + if(notify) + sendf(ci->clientnum, 1, "ri5", SV_BASEREGEN, ci->state.health, ci->state.armour, b.ammotype, b.ammotype>0 ? ci->state.ammo[b.ammotype] : 0); + } + } + } + + void update() + { + if(sv.minremain<0) return; + endcheck(); + int t = sv.gamemillis/1000 - (sv.gamemillis-sv.curtime)/1000; + if(t<1) return; + int gamemode = sv.gamemode; + loopv(bases) + { + baseinfo &b = bases[i]; + if(b.enemy[0]) + { + if((!b.owners || !b.enemies) && b.occupy(b.enemy, (m_noitemsrail ? OCCUPYPOINTS*2 : OCCUPYPOINTS)*(b.enemies ? b.enemies : -(1+b.owners))*t)==1) addscore(b.owner, CAPTURESCORE); + sendbaseinfo(i); + } + else if(b.owner[0]) + { + b.capturetime += t; + int score = b.capturetime/SCORESECS - (b.capturetime-t)/SCORESECS; + if(score) addscore(b.owner, score); + if(m_noitems) + { + if(!m_noitemsrail) + { + int regen = b.capturetime/REGENSECS - (b.capturetime-t)/REGENSECS; + if(regen) regenowners(b, regen); + } + } + else + { + int ammo = b.capturetime/AMMOSECS - (b.capturetime-t)/AMMOSECS; + if(ammo && b.addammo(ammo)) sendbaseinfo(i); + } + } + } + } + + void sendbaseinfo(int i) + { + baseinfo &b = bases[i]; + sendf(-1, 1, "riissii", SV_BASEINFO, i, b.owner, b.enemy, b.enemy[0] ? b.converted : 0, b.owner[0] ? b.ammo : 0); + } + + void sendbases() + { + ENetPacket *packet = enet_packet_create(NULL, MAXTRANS, ENET_PACKET_FLAG_RELIABLE); + ucharbuf p(packet->data, packet->dataLength); + initclient(NULL, p, false); + enet_packet_resize(packet, p.length()); + sendpacket(-1, 1, packet); + if(!packet->referenceCount) enet_packet_destroy(packet); + } + + void initclient(clientinfo *ci, ucharbuf &p, bool connecting) + { + if(connecting) + { + loopv(scores) + { + score &cs = scores[i]; + putint(p, SV_TEAMSCORE); + sendstring(cs.team, p); + putint(p, cs.total); + } + } + putint(p, SV_BASES); + putint(p, bases.length()); + loopv(bases) + { + baseinfo &b = bases[i]; + putint(p, min(max(b.ammotype, 1), I_CARTRIDGES+1)); + sendstring(b.owner, p); + sendstring(b.enemy, p); + putint(p, b.converted); + putint(p, b.ammo); + } + } + + void endcheck() + { + const char *lastteam = NULL; + + loopv(bases) + { + baseinfo &b = bases[i]; + if(b.owner[0]) + { + if(!lastteam) lastteam = b.owner; + else if(strcmp(lastteam, b.owner)) + { + lastteam = false; + break; + } + } + else + { + lastteam = false; + break; + } + } + + if(!lastteam) return; + findscore(lastteam).total = 10000; + sendf(-1, 1, "risi", SV_TEAMSCORE, lastteam, 10000); + sv.startintermission(); + } + + void entergame(clientinfo *ci) + { + if(notgotbases || ci->state.state!=CS_ALIVE) return; + enterbases(ci->team, ci->state.o); + } + + void spawned(clientinfo *ci) + { + if(notgotbases) return; + enterbases(ci->team, ci->state.o); + } + + void leavegame(clientinfo *ci, bool disconnecting = false) + { + if(notgotbases || ci->state.state!=CS_ALIVE) return; + leavebases(ci->team, ci->state.o); + } + + void died(clientinfo *ci, clientinfo *actor) + { + if(notgotbases) return; + leavebases(ci->team, ci->state.o); + } + + void moved(clientinfo *ci, const vec &oldpos, const vec &newpos) + { + if(notgotbases) return; + movebases(ci->team, oldpos, newpos); + } + + void changeteam(clientinfo *ci, const char *oldteam, const char *newteam) + { + if(notgotbases) return; + leavebases(oldteam, ci->state.o); + enterbases(newteam, ci->state.o); + } + + void parsebases(ucharbuf &p) + { + int numbases = getint(p); + loopi(numbases) + { + int ammotype = getint(p); + vec o; + o.x = getint(p)/DMF; + o.y = getint(p)/DMF; + o.z = getint(p)/DMF; + if(notgotbases) addbase(ammotype>=GUN_SG && ammotype<=GUN_PISTOL ? ammotype : min(ammotype, 0), o); + } + if(notgotbases) + { + notgotbases = false; + sendbases(); + loopv(sv.clients) if(sv.clients[i]->state.state==CS_ALIVE) entergame(sv.clients[i]); + } + } +}; + +#endif + diff --git a/src/fpsgame/client.h b/src/fpsgame/client.h new file mode 100644 index 0000000..1c65752 --- /dev/null +++ b/src/fpsgame/client.h @@ -0,0 +1,1295 @@ +struct clientcom : iclientcom +{ + fpsclient &cl; + + bool c2sinit; // whether we need to tell the other clients our stats + + bool senditemstoserver; // after a map change, since server doesn't have map data + int lastping; + + bool connected, remote, demoplayback; + + bool spectator; + + fpsent *player1; + + clientcom(fpsclient &_cl) : cl(_cl), c2sinit(false), senditemstoserver(false), lastping(0), connected(false), remote(false), demoplayback(false), spectator(false), player1(_cl.player1) + { + CCOMMAND(say, "C", (clientcom *self, char *s), self->toserver(s)); + CCOMMAND(sayteam, "C", (clientcom *self, char *s), self->sayteam(s)); + CCOMMAND(name, "s", (clientcom *self, char *s), self->switchname(s)); + CCOMMAND(team, "s", (clientcom *self, char *s), self->switchteam(s)); + CCOMMAND(map, "s", (clientcom *self, char *s), self->changemap(s)); + CCOMMAND(clearbans, "", (clientcom *self, char *s), self->clearbans()); + CCOMMAND(kick, "s", (clientcom *self, char *s), self->kick(s)); + CCOMMAND(goto, "s", (clientcom *self, char *s), self->gotoplayer(s)); + CCOMMAND(spectator, "is", (clientcom *self, int *val, char *who), self->togglespectator(*val, who)); + CCOMMAND(mastermode, "i", (clientcom *self, int *val), if(self->remote) self->addmsg(SV_MASTERMODE, "ri", *val)); + CCOMMAND(setmaster, "s", (clientcom *self, char *s), self->setmaster(s)); + CCOMMAND(approve, "s", (clientcom *self, char *s), self->approvemaster(s)); + CCOMMAND(setteam, "ss", (clientcom *self, char *who, char *team), self->setteam(who, team)); + CCOMMAND(getmap, "", (clientcom *self), self->getmap()); + CCOMMAND(sendmap, "", (clientcom *self), self->sendmap()); + CCOMMAND(listdemos, "", (clientcom *self), self->listdemos()); + CCOMMAND(getdemo, "i", (clientcom *self, int *val), self->getdemo(*val)); + CCOMMAND(recorddemo, "i", (clientcom *self, int *val), self->recorddemo(*val)); + CCOMMAND(stopdemo, "", (clientcom *self), self->stopdemo()); + CCOMMAND(cleardemos, "i", (clientcom *self, int *val), self->cleardemos(*val)); + + CCOMMAND(getmode, "", (clientcom *self), intret(self->cl.gamemode)); + CCOMMAND(getname, "", (clientcom *self), result(self->player1->name)); + CCOMMAND(getteam, "", (clientcom *self), result(self->player1->team)); + CCOMMAND(getclientfocus, "", (clientcom *self), intret(self->getclientfocus())); + CCOMMAND(getclientname, "i", (clientcom *self, int *cn), result(self->getclientname(*cn))); + CCOMMAND(getclientnum, "s", (clientcom *self, char *name), intret(name[0] ? self->parseplayer(name) : self->player1->clientnum)); + CCOMMAND(listclients, "i", (clientcom *self, int *local), self->listclients(*local!=0)); + } + + void switchname(const char *name) + { + if(name[0]) + { + c2sinit = false; + filtertext(player1->name, name, false, MAXNAMELEN); + if(!player1->name[0]) s_strcpy(player1->name, "unnamed"); + } + else conoutf("your name is: %s", cl.colorname(player1)); + } + + void switchteam(const char *team) + { + if(team[0]) + { + c2sinit = false; + filtertext(player1->team, team, false, MAXTEAMLEN); + } + else conoutf("your team is: %s", player1->team); + } + + int numchannels() { return 3; } + + void mapstart() { if(!spectator || player1->privilege) senditemstoserver = true; } + + void initclientnet() + { + } + + void writeclientinfo(FILE *f) + { + fprintf(f, "name \"%s\"\nteam \"%s\"\n", player1->name, player1->team); + } + + void gameconnect(bool _remote) + { + connected = true; + remote = _remote; + if(editmode) toggleedit(); + } + + void gamedisconnect() + { + if(remote) cl.stopfollowing(); + connected = false; + player1->clientnum = -1; + c2sinit = false; + player1->lifesequence = 0; + player1->privilege = PRIV_NONE; + spectator = false; + loopv(cl.players) if(cl.players[i]) cl.clientdisconnected(i, false); + } + + bool allowedittoggle() + { + bool allow = !connected || !remote || cl.gamemode==1; + if(!allow) conoutf(CON_ERROR, "editing in multiplayer requires coopedit mode (1)"); + if(allow && spectator) return false; + return allow; + } + + void edittoggled(bool on) + { + addmsg(SV_EDITMODE, "ri", on ? 1 : 0); + if(player1->state==CS_DEAD) cl.deathstate(player1, true); + else if(player1->state==CS_EDITING && player1->editstate==CS_DEAD) cl.sb.showscores(false); + setvar("zoom", -1, true); + } + + int getclientfocus() + { + fpsent *d = cl.pointatplayer(); + return d ? d->clientnum : -1; + } + + const char *getclientname(int cn) + { + if(cn == cl.player1->clientnum) return cl.player1->name; + + fpsent *d = cl.getclient(cn); + return d ? d->name : ""; + } + + int parseplayer(const char *arg) + { + char *end; + int n = strtol(arg, &end, 10); + if(*arg && !*end) + { + if(n!=player1->clientnum && !cl.players.inrange(n)) return -1; + return n; + } + // try case sensitive first + loopi(cl.numdynents()) + { + fpsent *o = (fpsent *)cl.iterdynents(i); + if(o && !strcmp(arg, o->name)) return o->clientnum; + } + // nothing found, try case insensitive + loopi(cl.numdynents()) + { + fpsent *o = (fpsent *)cl.iterdynents(i); + if(o && !strcasecmp(arg, o->name)) return o->clientnum; + } + return -1; + } + + void listclients(bool local) + { + vector buf; + string cn; + int numclients = 0; + if(local) + { + s_sprintf(cn)("%d", player1->clientnum); + buf.put(cn, strlen(cn)); + numclients++; + } + loopv(cl.players) if(cl.players[i]) + { + s_sprintf(cn)("%d", cl.players[i]->clientnum); + if(numclients++) buf.add(' '); + buf.put(cn, strlen(cn)); + } + buf.add('\0'); + result(buf.getbuf()); + } + + void clearbans() + { + if(!remote) return; + addmsg(SV_CLEARBANS, "r"); + } + + void kick(const char *arg) + { + if(!remote) return; + int i = parseplayer(arg); + if(i>=0 && i!=player1->clientnum) addmsg(SV_KICK, "ri", i); + } + + void setteam(const char *arg1, const char *arg2) + { + if(!remote) return; + int i = parseplayer(arg1); + if(i>=0 && i!=player1->clientnum) addmsg(SV_SETTEAM, "ris", i, arg2); + } + + void setmaster(const char *arg) + { + if(!remote || !arg[0]) return; + int val = 1; + const char *passwd = ""; + if(!arg[1] && isdigit(arg[0])) val = atoi(arg); + else passwd = arg; + addmsg(SV_SETMASTER, "ris", val, passwd); + } + + void approvemaster(const char *who) + { + if(!remote) return; + int i = parseplayer(who); + if(i>=0) addmsg(SV_APPROVEMASTER, "ri", i); + } + + void togglespectator(int val, const char *who) + { + if(!remote) return; + int i = who[0] ? parseplayer(who) : player1->clientnum; + if(i>=0) addmsg(SV_SPECTATOR, "rii", i, val); + } + + // collect c2s messages conveniently + vector messages; + + void addmsg(int type, const char *fmt = NULL, ...) + { + if(remote && spectator && (!player1->privilege || type>8)|(reliable ? 0x80 : 0)); + loopi(len) messages.add(buf[i]); + } + + void toserver(char *text) { conoutf(CON_CHAT, "%s:\f0 %s", cl.colorname(player1), text); addmsg(SV_TEXT, "rs", text); } + void sayteam(char *text) { conoutf(CON_TEAMCHAT, "%s:\f1 %s", cl.colorname(player1), text); addmsg(SV_SAYTEAM, "rs", text); } + + int sendpacketclient(ucharbuf &p, bool &reliable, dynent *d) + { + if(d->state==CS_ALIVE || d->state==CS_EDITING) + { + // send position updates separately so as to not stall out aiming + ENetPacket *packet = enet_packet_create(NULL, 100, 0); + ucharbuf q(packet->data, packet->dataLength); + putint(q, SV_POS); + putint(q, player1->clientnum); + putuint(q, (int)(d->o.x*DMF)); // quantize coordinates to 1/4th of a cube, between 1 and 3 bytes + putuint(q, (int)(d->o.y*DMF)); + putuint(q, (int)(d->o.z*DMF)); + putuint(q, (int)d->yaw); + putint(q, (int)d->pitch); + putint(q, (int)d->roll); + putint(q, (int)(d->vel.x*DVELF)); // quantize to itself, almost always 1 byte + putint(q, (int)(d->vel.y*DVELF)); + putint(q, (int)(d->vel.z*DVELF)); + putuint(q, d->physstate | (d->falling.x || d->falling.y ? 0x20 : 0) | (d->falling.z ? 0x10 : 0) | ((((fpsent *)d)->lifesequence&1)<<6)); + if(d->falling.x || d->falling.y) + { + putint(q, (int)(d->falling.x*DVELF)); // quantize to itself, almost always 1 byte + putint(q, (int)(d->falling.y*DVELF)); + } + if(d->falling.z) putint(q, (int)(d->falling.z*DVELF)); + // pack rest in almost always 1 byte: strafe:2, move:2, garmour: 1, yarmour: 1, quad: 1 + uint flags = (d->strafe&3) | ((d->move&3)<<2); + putuint(q, flags); + enet_packet_resize(packet, q.length()); + sendpackettoserv(packet, 0); + } + if(senditemstoserver) + { + int gamemode = cl.gamemode; + reliable = !m_noitems || m_capture || m_ctf; + if(!m_noitems) cl.et.putitems(p, gamemode); + if(m_capture) cl.cpc.sendbases(p); + else if(m_ctf) cl.ctf.sendflags(p); + senditemstoserver = false; + } + if(!c2sinit) // tell other clients who I am + { + reliable = true; + c2sinit = true; + putint(p, SV_INITC2S); + sendstring(player1->name, p); + sendstring(player1->team, p); + } + int i = 0; + while(i < messages.length()) // send messages collected during the previous frames + { + int len = messages[i] | ((messages[i+1]&0x7F)<<8); + if(p.remaining() < len) break; + if(messages[i+1]&0x80) reliable = true; + p.put(&messages[i+2], len); + i += 2 + len; + } + messages.remove(0, i); + if(!spectator && p.remaining()>=10 && cl.lastmillis-lastping>250) + { + putint(p, SV_PING); + putint(p, cl.lastmillis); + lastping = cl.lastmillis; + } + return 1; + } + + void updatepos(fpsent *d) + { + // update the position of other clients in the game in our world + // don't care if he's in the scenery or other players, + // just don't overlap with our client + + const float r = player1->radius+d->radius; + const float dx = player1->o.x-d->o.x; + const float dy = player1->o.y-d->o.y; + const float dz = player1->o.z-d->o.z; + const float rz = player1->aboveeye+d->eyeheight; + const float fx = (float)fabs(dx), fy = (float)fabs(dy), fz = (float)fabs(dz); + if(fxstate!=CS_SPECTATOR && d->state!=CS_DEAD) + { + if(fxo.y += dy<0 ? r-fy : -(r-fy); // push aside + else d->o.x += dx<0 ? r-fx : -(r-fx); + } + int lagtime = cl.lastmillis-d->lastupdate; + if(lagtime) + { + if(d->state!=CS_SPAWNING && d->lastupdate) d->plag = (d->plag*5+lagtime)/6; + d->lastupdate = cl.lastmillis; + } + } + + void parsepositions(ucharbuf &p) + { + int type; + while(p.remaining()) switch(type = getint(p)) + { + case SV_POS: // position of another client + { + int cn = getint(p); + vec o, vel, falling; + float yaw, pitch, roll; + int physstate, f; + o.x = getuint(p)/DMF; + o.y = getuint(p)/DMF; + o.z = getuint(p)/DMF; + yaw = (float)getuint(p); + pitch = (float)getint(p); + roll = (float)getint(p); + vel.x = getint(p)/DVELF; + vel.y = getint(p)/DVELF; + vel.z = getint(p)/DVELF; + physstate = getuint(p); + falling = vec(0, 0, 0); + if(physstate&0x20) + { + falling.x = getint(p)/DVELF; + falling.y = getint(p)/DVELF; + } + if(physstate&0x10) falling.z = getint(p)/DVELF; + int seqcolor = (physstate>>6)&1; + f = getuint(p); + fpsent *d = cl.getclient(cn); + if(!d || seqcolor!=(d->lifesequence&1)) continue; + float oldyaw = d->yaw, oldpitch = d->pitch; + d->yaw = yaw; + d->pitch = pitch; + d->roll = roll; + d->strafe = (f&3)==3 ? -1 : f&3; + f >>= 2; + d->move = (f&3)==3 ? -1 : f&3; + vec oldpos(d->o); + if(cl.allowmove(d)) + { + d->o = o; + d->vel = vel; + d->falling = falling; + d->physstate = physstate & 0x0F; + updatephysstate(d); + updatepos(d); + } + if(d->state==CS_DEAD) + { + d->resetinterp(); + d->smoothmillis = 0; + } + else if(cl.smoothmove() && d->smoothmillis>=0 && oldpos.dist(d->o) < cl.smoothdist()) + { + d->newpos = d->o; + d->newyaw = d->yaw; + d->newpitch = d->pitch; + d->o = oldpos; + d->yaw = oldyaw; + d->pitch = oldpitch; + (d->deltapos = oldpos).sub(d->newpos); + d->deltayaw = oldyaw - d->newyaw; + if(d->deltayaw > 180) d->deltayaw -= 360; + else if(d->deltayaw < -180) d->deltayaw += 360; + d->deltapitch = oldpitch - d->newpitch; + d->smoothmillis = cl.lastmillis; + } + else d->smoothmillis = 0; + if(d->state==CS_LAGGED || d->state==CS_SPAWNING) d->state = CS_ALIVE; + break; + } + + default: + neterr("type"); + return; + } + } + + void parsepacketclient(int chan, ucharbuf &p) // processes any updates from the server + { + switch(chan) + { + case 0: + parsepositions(p); + break; + + case 1: + parsemessages(-1, NULL, p); + break; + + case 2: + receivefile(p.buf, p.maxlen); + break; + } + } + + void parsestate(fpsent *d, ucharbuf &p, bool resume = false) + { + if(!d) { static fpsent dummy; d = &dummy; } + if(resume) + { + if(d==cl.player1) getint(p); + else d->state = getint(p); + d->frags = getint(p); + if(d==cl.player1) getint(p); + else d->quadmillis = getint(p); + } + d->lifesequence = getint(p); + d->health = getint(p); + d->maxhealth = getint(p); + d->armour = getint(p); + d->armourtype = getint(p); + if(resume && d==cl.player1) + { + getint(p); + loopi(GUN_PISTOL-GUN_SG+1) getint(p); + } + else + { + d->gunselect = getint(p); + loopi(GUN_PISTOL-GUN_SG+1) d->ammo[GUN_SG+i] = getint(p); + } + } + + void parsemessages(int cn, fpsent *d, ucharbuf &p) + { + int gamemode = cl.gamemode; + static char text[MAXTRANS]; + int type; + bool mapchanged = false; + + while(p.remaining()) switch(type = getint(p)) + { + case SV_INITS2C: // welcome messsage from the server + { + int mycn = getint(p), prot = getint(p), hasmap = getint(p); + if(prot!=PROTOCOL_VERSION) + { + conoutf(CON_ERROR, "you are using a different game protocol (you: %d, server: %d)", PROTOCOL_VERSION, prot); + disconnect(); + return; + } + player1->clientnum = mycn; // we are now fully connected + if(!hasmap && (cl.gamemode==1 || cl.getclientmap()[0])) changemap(cl.getclientmap()); // we are the first client on this server, set map + gamemode = cl.gamemode; + break; + } + + case SV_CLIENT: + { + int cn = getint(p), len = getuint(p); + ucharbuf q = p.subbuf(len); + parsemessages(cn, cl.getclient(cn), q); + break; + } + + case SV_SOUND: + if(!d) return; + playsound(getint(p), &d->o); + break; + + case SV_TEXT: + { + if(!d) return; + getstring(text, p); + filtertext(text, text); + if(d->state!=CS_DEAD && d->state!=CS_SPECTATOR) + { + s_sprintfd(ds)("@%s", &text); + particle_text(d->abovehead(), ds, 9); + } + conoutf(CON_CHAT, "%s:\f0 %s", cl.colorname(d), text); + break; + } + + case SV_SAYTEAM: + { + int tcn = getint(p); + fpsent *t = tcn==cl.player1->clientnum ? cl.player1 : cl.getclient(tcn); + getstring(text, p); + filtertext(text, text); + if(!t) break; + if(t->state!=CS_DEAD && t->state!=CS_SPECTATOR) + { + s_sprintfd(ts)("@%s", &text); + particle_text(t->abovehead(), ts, 34); + } + conoutf(CON_TEAMCHAT, "%s:\f1 %s", cl.colorname(t), text); + break; + } + + case SV_MAPCHANGE: + getstring(text, p); + changemapserv(text, getint(p)); + mapchanged = true; + gamemode = cl.gamemode; + if(getint(p)) cl.et.spawnitems(gamemode); + else senditemstoserver = false; + break; + + case SV_ARENAWIN: + { + int acn = getint(p); + fpsent *alive = acn<0 ? NULL : (acn==player1->clientnum ? player1 : cl.getclient(acn)); + conoutf(CON_GAMEINFO, "arena round is over! next round in 5 seconds..."); + if(!alive) conoutf(CON_GAMEINFO, "everyone died!"); + else if(m_teammode) conoutf(CON_GAMEINFO, "team %s has won the round", alive->team); + else if(alive==player1) conoutf(CON_GAMEINFO, "you are the last man standing!"); + else conoutf(CON_GAMEINFO, "%s is the last man standing", cl.colorname(alive)); + break; + } + + case SV_FORCEDEATH: + { + int cn = getint(p); + fpsent *d = cn==player1->clientnum ? player1 : cl.newclient(cn); + if(!d) break; + if(d==player1) + { + if(editmode) toggleedit(); + cl.stopfollowing(); + cl.sb.showscores(true); + } + else d->resetinterp(); + d->state = CS_DEAD; + break; + } + + case SV_ITEMLIST: + { + int n; + while((n = getint(p))>=0 && !p.overread()) + { + if(mapchanged) cl.et.setspawn(n, true); + getint(p); // type + } + break; + } + + case SV_MAPRELOAD: // server requests next map + { + s_sprintfd(nextmapalias)("nextmap_%s%s", m_capture ? "capture_" : (m_ctf ? "ctf_" : ""), cl.getclientmap()); + const char *map = getalias(nextmapalias); // look up map in the cycle + addmsg(SV_MAPCHANGE, "rsi", *map ? map : cl.getclientmap(), cl.nextmode); + break; + } + + case SV_INITC2S: // another client either connected or changed name/team + { + d = cl.newclient(cn); + if(!d) + { + getstring(text, p); + getstring(text, p); + break; + } + getstring(text, p); + filtertext(text, text, false, MAXNAMELEN); + if(!text[0]) s_strcpy(text, "unnamed"); + if(d->name[0]) // already connected + { + if(strcmp(d->name, text)) + { + string oldname, newname; + s_strcpy(oldname, cl.colorname(d)); + s_strcpy(newname, cl.colorname(d, text)); + conoutf("%s is now known as %s", oldname, newname); + } + } + else // new client + { + c2sinit = false; // send new players my info again + conoutf("connected: %s", cl.colorname(d, text)); + loopv(cl.players) // clear copies since new player doesn't have them + if(cl.players[i]) freeeditinfo(cl.players[i]->edit); + extern editinfo *localedit; + freeeditinfo(localedit); + } + s_strncpy(d->name, text, MAXNAMELEN+1); + getstring(text, p); + filtertext(d->team, text, false, MAXTEAMLEN); + break; + } + + case SV_CDIS: + cl.clientdisconnected(getint(p)); + break; + + case SV_SPAWN: + { + if(d) d->respawn(); + parsestate(d, p); + if(!d) break; + d->state = CS_SPAWNING; + if(cl.player1->state==CS_SPECTATOR && cl.following==d->clientnum) + cl.lasthit = 0; + break; + } + + case SV_SPAWNSTATE: + { + if(editmode) toggleedit(); + cl.stopfollowing(); + player1->respawn(); + parsestate(player1, p); + player1->state = CS_ALIVE; + findplayerspawn(player1, m_capture ? cl.cpc.pickspawn(player1->team) : -1, m_ctf ? ctfteamflag(player1->team) : 0); + cl.sb.showscores(false); + cl.lasthit = 0; + if(m_arena) conoutf(CON_GAMEINFO, "new round starting... fight!"); + else if(m_capture) cl.cpc.lastrepammo = -1; + addmsg(SV_SPAWN, "rii", player1->lifesequence, player1->gunselect); + break; + } + + case SV_SHOTFX: + { + int scn = getint(p), gun = getint(p); + vec from, to; + loopk(3) from[k] = getint(p)/DMF; + loopk(3) to[k] = getint(p)/DMF; + fpsent *s = cl.getclient(scn); + if(!s) break; + if(gun>GUN_FIST && gun<=GUN_PISTOL && s->ammo[gun]) s->ammo[gun]--; + if(gun==GUN_SG) cl.ws.createrays(from, to); + s->gunselect = clamp(gun, (int)GUN_FIST, (int)GUN_PISTOL); + s->gunwait = guns[s->gunselect].attackdelay; + s->lastaction = cl.lastmillis; + s->lastattackgun = s->gunselect; + cl.ws.shootv(gun, from, to, s, false); + break; + } + + case SV_DAMAGE: + { + int tcn = getint(p), + acn = getint(p), + damage = getint(p), + armour = getint(p), + health = getint(p); + fpsent *target = tcn==player1->clientnum ? player1 : cl.getclient(tcn), + *actor = acn==player1->clientnum ? player1 : cl.getclient(acn); + if(!target || !actor) break; + target->armour = armour; + target->health = health; + cl.damaged(damage, target, actor, false); + break; + } + + case SV_HITPUSH: + { + int gun = getint(p), damage = getint(p); + vec dir; + loopk(3) dir[k] = getint(p)/DNF; + player1->hitpush(damage, dir, NULL, gun); + break; + } + + case SV_DIED: + { + int vcn = getint(p), acn = getint(p), frags = getint(p); + fpsent *victim = vcn==player1->clientnum ? player1 : cl.getclient(vcn), + *actor = acn==player1->clientnum ? player1 : cl.getclient(acn); + if(!actor) break; + actor->frags = frags; + if(actor!=player1 && !m_capture && !m_ctf) + { + s_sprintfd(ds)("@%d", actor->frags); + particle_text(actor->abovehead(), ds, 9); + } + if(!victim) break; + cl.killed(victim, actor); + break; + } + + case SV_GUNSELECT: + { + if(!d) return; + int gun = getint(p); + d->gunselect = max(gun, 0); + playsound(S_WEAPLOAD, &d->o); + break; + } + + case SV_TAUNT: + { + if(!d) return; + d->lasttaunt = cl.lastmillis; + break; + } + + case SV_RESUME: + { + for(;;) + { + int cn = getint(p); + if(p.overread() || cn<0) break; + fpsent *d = (cn == player1->clientnum ? player1 : cl.newclient(cn)); + parsestate(d, p, true); + } + break; + } + + case SV_ITEMSPAWN: + { + int i = getint(p); + if(!cl.et.ents.inrange(i)) break; + cl.et.setspawn(i, true); + playsound(S_ITEMSPAWN, &cl.et.ents[i]->o); + const char *name = cl.et.itemname(i); + if(name) particle_text(cl.et.ents[i]->o, name, 9); + break; + } + + case SV_ITEMACC: // server acknowledges that I picked up this item + { + int i = getint(p), cn = getint(p); + fpsent *d = cn==player1->clientnum ? player1 : cl.getclient(cn); + cl.et.pickupeffects(i, d); + break; + } + + case SV_EDITF: // coop editing messages + case SV_EDITT: + case SV_EDITM: + case SV_FLIP: + case SV_COPY: + case SV_PASTE: + case SV_ROTATE: + case SV_REPLACE: + case SV_DELCUBE: + { + if(!d) return; + selinfo sel; + sel.o.x = getint(p); sel.o.y = getint(p); sel.o.z = getint(p); + sel.s.x = getint(p); sel.s.y = getint(p); sel.s.z = getint(p); + sel.grid = getint(p); sel.orient = getint(p); + sel.cx = getint(p); sel.cxs = getint(p); sel.cy = getint(p), sel.cys = getint(p); + sel.corner = getint(p); + int dir, mode, tex, newtex, mat, allfaces; + ivec moveo; + switch(type) + { + case SV_EDITF: dir = getint(p); mode = getint(p); mpeditface(dir, mode, sel, false); break; + case SV_EDITT: tex = getint(p); allfaces = getint(p); mpedittex(tex, allfaces, sel, false); break; + case SV_EDITM: mat = getint(p); mpeditmat(mat, sel, false); break; + case SV_FLIP: mpflip(sel, false); break; + case SV_COPY: if(d) mpcopy(d->edit, sel, false); break; + case SV_PASTE: if(d) mppaste(d->edit, sel, false); break; + case SV_ROTATE: dir = getint(p); mprotate(dir, sel, false); break; + case SV_REPLACE: tex = getint(p); newtex = getint(p); mpreplacetex(tex, newtex, sel, false); break; + case SV_DELCUBE: mpdelcube(sel, false); break; + } + break; + } + case SV_REMIP: + { + if(!d) return; + conoutf("%s remipped", cl.colorname(d)); + mpremip(false); + break; + } + case SV_EDITENT: // coop edit of ent + { + if(!d) return; + int i = getint(p); + float x = getint(p)/DMF, y = getint(p)/DMF, z = getint(p)/DMF; + int type = getint(p); + int attr1 = getint(p), attr2 = getint(p), attr3 = getint(p), attr4 = getint(p); + + mpeditent(i, vec(x, y, z), type, attr1, attr2, attr3, attr4, false); + break; + } + + case SV_PONG: + addmsg(SV_CLIENTPING, "i", player1->ping = (player1->ping*5+cl.lastmillis-getint(p))/6); + break; + + case SV_CLIENTPING: + if(!d) return; + d->ping = getint(p); + break; + + case SV_TIMEUP: + cl.timeupdate(getint(p)); + break; + + case SV_SERVMSG: + getstring(text, p); + conoutf("%s", text); + break; + + case SV_SENDDEMOLIST: + { + int demos = getint(p); + if(!demos) conoutf("no demos available"); + else loopi(demos) + { + getstring(text, p); + conoutf("%d. %s", i+1, text); + } + break; + } + + case SV_DEMOPLAYBACK: + { + int on = getint(p); + if(on) player1->state = CS_SPECTATOR; + else stopdemo(); + demoplayback = on!=0; + const char *alias = on ? "demostart" : "demoend"; + if(identexists(alias)) execute(alias); + break; + } + + case SV_CURRENTMASTER: + { + int mn = getint(p), priv = getint(p); + player1->privilege = PRIV_NONE; + loopv(cl.players) if(cl.players[i]) cl.players[i]->privilege = PRIV_NONE; + if(mn>=0) + { + fpsent *m = mn==player1->clientnum ? player1 : cl.newclient(mn); + m->privilege = priv; + } + break; + } + + case SV_EDITMODE: + { + int val = getint(p); + if(!d) break; + if(val) + { + d->editstate = d->state; + d->state = CS_EDITING; + } + else + { + d->state = d->editstate; + if(d->state==CS_DEAD) cl.deathstate(d, true); + } + break; + } + + case SV_SPECTATOR: + { + int sn = getint(p), val = getint(p); + fpsent *s; + if(sn==player1->clientnum) + { + spectator = val!=0; + s = player1; + } + else s = cl.newclient(sn); + if(!s) return; + if(val) + { + if(s==player1) + { + if(editmode) toggleedit(); + if(s->state==CS_DEAD) cl.sb.showscores(false); + } + s->state = CS_SPECTATOR; + } + else if(s->state==CS_SPECTATOR) + { + s->state = CS_DEAD; + if(s==player1) + { + cl.stopfollowing(); + cl.sb.showscores(true); + } + else s->resetinterp(); + } + break; + } + + case SV_SETTEAM: + { + int wn = getint(p); + getstring(text, p); + fpsent *w = wn==player1->clientnum ? player1 : cl.getclient(wn); + if(!w) return; + filtertext(w->team, text, false, MAXTEAMLEN); + break; + } + + case SV_BASEINFO: + { + int base = getint(p); + string owner, enemy; + getstring(text, p); + s_strcpy(owner, text); + getstring(text, p); + s_strcpy(enemy, text); + int converted = getint(p), ammo = getint(p); + if(m_capture) cl.cpc.updatebase(base, owner, enemy, converted, ammo); + break; + } + + case SV_BASEREGEN: + { + int health = getint(p), armour = getint(p), ammotype = getint(p), ammo = getint(p); + if(m_capture) + { + player1->health = health; + player1->armour = armour; + if(ammotype>=GUN_SG && ammotype<=GUN_PISTOL) player1->ammo[ammotype] = ammo; + } + break; + } + + case SV_BASES: + { + int numbases = getint(p); + loopi(numbases) + { + int ammotype = getint(p); + string owner, enemy; + getstring(text, p); + s_strcpy(owner, text); + getstring(text, p); + s_strcpy(enemy, text); + int converted = getint(p), ammo = getint(p); + cl.cpc.initbase(i, ammotype, owner, enemy, converted, ammo); + } + break; + } + + case SV_TEAMSCORE: + { + getstring(text, p); + int total = getint(p); + if(m_capture) cl.cpc.setscore(text, total); + break; + } + + case SV_REPAMMO: + { + int ammotype = getint(p); + if(m_capture) cl.cpc.receiveammo(ammotype); + break; + } + + case SV_INITFLAGS: + { + cl.ctf.parseflags(p, m_ctf); + break; + } + + case SV_DROPFLAG: + { + int ocn = getint(p), flag = getint(p); + vec droploc; + loopk(3) droploc[k] = getint(p)/DMF; + fpsent *o = ocn==cl.player1->clientnum ? cl.player1 : cl.newclient(ocn); + if(m_ctf) cl.ctf.dropflag(o, flag, droploc); + break; + } + + case SV_SCOREFLAG: + { + int ocn = getint(p), relayflag = getint(p), goalflag = getint(p), score = getint(p); + fpsent *o = ocn==cl.player1->clientnum ? cl.player1 : cl.newclient(ocn); + if(m_ctf) cl.ctf.scoreflag(o, relayflag, goalflag, score); + break; + } + + case SV_RETURNFLAG: + { + int ocn = getint(p), flag = getint(p); + fpsent *o = ocn==cl.player1->clientnum ? cl.player1 : cl.newclient(ocn); + if(m_ctf) cl.ctf.returnflag(o, flag); + break; + } + + case SV_TAKEFLAG: + { + int ocn = getint(p), flag = getint(p); + fpsent *o = ocn==cl.player1->clientnum ? cl.player1 : cl.newclient(ocn); + if(m_ctf) cl.ctf.takeflag(o, flag); + break; + } + + case SV_RESETFLAG: + { + int flag = getint(p); + if(m_ctf) cl.ctf.resetflag(flag); + break; + } + + case SV_ANNOUNCE: + { + int t = getint(p); + if (t==I_QUAD) { playsound(S_V_QUAD10); conoutf(CON_GAMEINFO, "\f2quad damage will spawn in 10 seconds!"); } + else if(t==I_BOOST) { playsound(S_V_BOOST10); conoutf(CON_GAMEINFO, "\f2+10 health will spawn in 10 seconds!"); } + break; + } + + case SV_CLEARTARGETS: + if(m_assassin) cl.asc.targets.setsize(0); + break; + + case SV_CLEARHUNTERS: + if(m_assassin) cl.asc.hunters.setsize(0); + break; + + case SV_ADDTARGET: + { + int tcn = getint(p); + if(m_assassin) + { + fpsent *t = cl.newclient(tcn); + if(cl.asc.targets.find(t)<0) cl.asc.targets.add(t); + } + break; + } + + case SV_REMOVETARGET: + { + int tcn = getint(p); + if(m_assassin) + { + fpsent *t = cl.getclient(tcn); + if(t) cl.asc.targets.removeobj(t); + } + break; + } + + case SV_ADDHUNTER: + { + int hcn = getint(p); + if(m_assassin) + { + fpsent *h = cl.newclient(hcn); + if(cl.asc.hunters.find(h)<0) cl.asc.hunters.add(h); + } + break; + } + + case SV_REMOVEHUNTER: + { + int hcn = getint(p); + if(m_assassin) + { + fpsent *h = cl.getclient(hcn); + if(h) cl.asc.hunters.removeobj(h); + } + break; + } + + case SV_NEWMAP: + { + int size = getint(p); + if(size>=0) emptymap(size, true); + else enlargemap(true); + if(d && d!=player1) + { + int newsize = 0; + while(1<=0 ? "%s started a new map of size %d" : "%s enlarged the map to size %d", cl.colorname(d), newsize); + } + break; + } + + default: + neterr("type"); + return; + } + } + + void changemapserv(const char *name, int gamemode) // forced map change from the server + { + if(remote && !m_mp(gamemode)) gamemode = 0; + cl.gamemode = gamemode; + cl.nextmode = gamemode; + cl.minremain = -1; + if(editmode) toggleedit(); + if(m_demo) { cl.et.resetspawns(); return; } + if((gamemode==1 && !name[0]) || (!load_world(name) && remote)) + { + emptymap(0, true, name); + senditemstoserver = false; + } + if(m_capture) cl.cpc.setupbases(); + else if(m_assassin) cl.asc.reset(); + else if(m_ctf) cl.ctf.setupflags(); + } + + void changemap(const char *name) // request map change, server may ignore + { + if(spectator && !player1->privilege) return; + int nextmode = cl.nextmode; // in case stopdemo clobbers cl.nextmode + if(!remote) stopdemo(); + addmsg(SV_MAPVOTE, "rsi", name, nextmode); + } + + void receivefile(uchar *data, int len) + { + ucharbuf p(data, len); + int type = getint(p); + data += p.length(); + len -= p.length(); + switch(type) + { + case SV_SENDDEMO: + { + s_sprintfd(fname)("%d.dmo", cl.lastmillis); + FILE *demo = openfile(fname, "wb"); + if(!demo) return; + conoutf("received demo \"%s\"", fname); + fwrite(data, 1, len, demo); + fclose(demo); + break; + } + + case SV_SENDMAP: + { + if(cl.gamemode!=1) return; + string oldname; + s_strcpy(oldname, cl.getclientmap()); + s_sprintfd(mname)("getmap_%d", cl.lastmillis); + s_sprintfd(fname)("packages/base/%s.ogz", mname); + const char *file = findfile(fname, "wb"); + FILE *map = fopen(file, "wb"); + if(!map) return; + conoutf("received map"); + fwrite(data, 1, len, map); + fclose(map); + load_world(mname, oldname[0] ? oldname : NULL); + remove(file); + break; + } + } + } + + void getmap() + { + if(cl.gamemode!=1) { conoutf(CON_ERROR, "\"getmap\" only works in coopedit mode"); return; } + conoutf("getting map..."); + addmsg(SV_GETMAP, "r"); + } + + void stopdemo() + { + if(remote) + { + if(player1->privilegeenddemoplayback(); + } + } + + void recorddemo(int val) + { + if(player1->privilegeprivilegeprivilege)) { conoutf(CON_ERROR, "\"sendmap\" only works in coopedit mode"); return; } + conoutf("sending map..."); + s_sprintfd(mname)("sendmap_%d", cl.lastmillis); + save_world(mname, true); + s_sprintfd(fname)("packages/base/%s.ogz", mname); + const char *file = findfile(fname, "rb"); + FILE *map = fopen(file, "rb"); + if(map) + { + fseek(map, 0, SEEK_END); + int len = ftell(map); + if(len > 1024*1024) conoutf(CON_ERROR, "map is too large"); + else if(!len) conoutf(CON_ERROR, "could not read map"); + else sendfile(-1, 2, map); + fclose(map); + } + else conoutf(CON_ERROR, "could not read map"); + remove(file); + } + + void gotoplayer(const char *arg) + { + if(player1->state!=CS_SPECTATOR && player1->state!=CS_EDITING) return; + int i = parseplayer(arg); + if(i>=0 && i!=player1->clientnum) + { + fpsent *d = cl.getclient(i); + if(!d) return; + player1->o = d->o; + vec dir; + vecfromyawpitch(player1->yaw, player1->pitch, 1, 0, dir); + player1->o.add(dir.mul(-32)); + player1->resetinterp(); + } + } +}; diff --git a/src/fpsgame/ctf.h b/src/fpsgame/ctf.h new file mode 100644 index 0000000..2f99f74 --- /dev/null +++ b/src/fpsgame/ctf.h @@ -0,0 +1,563 @@ +#define ctfteamflag(s) (!strcmp(s, "good") ? 1 : (!strcmp(s, "evil") ? 2 : 0)) +#define ctfflagteam(i) (i==1 ? "good" : (i==2 ? "evil" : NULL)) + +struct ctfstate +{ + static const int MAXFLAGS = 100; + static const int FLAGRADIUS = 16; + static const int FLAGLIMIT = 10; + + struct flag + { + vec droploc, spawnloc; + int team, score, droptime; +#ifdef CTFSERV + int owner; +#else + bool pickup; + fpsent *owner; + extentity *ent; + vec interploc; + float interpangle; + int interptime; +#endif + + flag() { reset(); } + + void reset() + { + droploc = spawnloc = vec(0, 0, 0); +#ifdef CTFSERV + owner = -1; +#else + pickup = false; + owner = NULL; + interploc = vec(0, 0, 0); + interpangle = 0; + interptime = 0; +#endif + team = 0; + score = 0; + droptime = 0; + } + }; + vector flags; + + void reset() + { + flags.setsize(0); + } + + void addflag(int i, const vec &o, int team) + { + if(i<0 || i>=MAXFLAGS) return; + while(flags.length()<=i) flags.add(); + flag &f = flags[i]; + f.reset(); + f.team = team; + f.spawnloc = o; + } + +#ifdef CTFSERV + void takeflag(int i, int owner) +#else + void takeflag(int i, fpsent *owner) +#endif + { + flag &f = flags[i]; + f.owner = owner; +#ifndef CTFSERV + f.pickup = false; +#endif + } + + void dropflag(int i, const vec &o, int droptime) + { + flag &f = flags[i]; + f.droploc = o; + f.droptime = droptime; +#ifdef CTFSERV + f.owner = -1; +#else + f.pickup = false; + f.owner = NULL; +#endif + } + + void returnflag(int i) + { + flag &f = flags[i]; + f.droptime = 0; +#ifdef CTFSERV + f.owner = -1; +#else + f.pickup = false; + f.owner = NULL; +#endif + } + + int totalscore(int team) + { + int score = 0; + loopv(flags) if(flags[i].team==team) score += flags[i].score; + return score; + } +}; + +#ifdef CTFSERV +struct ctfservmode : ctfstate, servmode +{ + static const int RESETFLAGTIME = 10000; + + bool notgotflags; + + ctfservmode(fpsserver &sv) : servmode(sv), notgotflags(false) {} + + void reset(bool empty) + { + ctfstate::reset(); + notgotflags = !empty; + } + + void dropflag(clientinfo *ci) + { + if(notgotflags) return; + loopv(flags) if(flags[i].owner==ci->clientnum) + { + ivec o(vec(ci->state.o).mul(DMF)); + sendf(-1, 1, "ri6", SV_DROPFLAG, ci->clientnum, i, o.x, o.y, o.z); + ctfstate::dropflag(i, o.tovec().div(DMF), sv.lastmillis); + } + } + + void leavegame(clientinfo *ci, bool disconnecting = false) + { + dropflag(ci); + } + + void died(clientinfo *ci, clientinfo *actor) + { + dropflag(ci); + } + + bool canchangeteam(clientinfo *ci, const char *oldteam, const char *newteam) + { + return !strcmp(newteam, "good") || !strcmp(newteam, "evil"); + } + + void changeteam(clientinfo *ci, const char *oldteam, const char *newteam) + { + dropflag(ci); + } + + void moved(clientinfo *ci, const vec &oldpos, const vec &newpos) + { + if(notgotflags) return; + static const dynent dummy; + vec o(newpos); + o.z -= dummy.eyeheight; + int relay = -1; + loopv(flags) if(flags[i].owner==ci->clientnum) { relay = i; break; } + if(relay<0) return; + loopv(flags) if(flags[i].team==ctfteamflag(ci->team)) + { + flag &goal = flags[i]; + if(goal.owner<0 && !goal.droptime && o.dist(goal.spawnloc) < FLAGRADIUS) + { + returnflag(relay); + goal.score++; + sendf(-1, 1, "ri5", SV_SCOREFLAG, ci->clientnum, relay, i, goal.score); + if(totalscore(goal.team) >= FLAGLIMIT) sv.startintermission(); + } + } + } + + void takeflag(clientinfo *ci, int i) + { + if(notgotflags || !flags.inrange(i) || ci->state.state!=CS_ALIVE || !ci->team[0]) return; + flag &f = flags[i]; + if(!ctfflagteam(f.team)) return; + if(f.team==ctfteamflag(ci->team)) + { + if(!f.droptime || f.owner>=0) return; + ctfstate::returnflag(i); + sendf(-1, 1, "ri3", SV_RETURNFLAG, ci->clientnum, i); + } + else + { + if(f.owner>=0) return; + loopv(flags) if(flags[i].owner==ci->clientnum) return; + ctfstate::takeflag(i, ci->clientnum); + sendf(-1, 1, "ri3", SV_TAKEFLAG, ci->clientnum, i); + } + } + + void update() + { + if(sv.minremain<0 || notgotflags) return; + loopv(flags) + { + flag &f = flags[i]; + if(f.owner<0 && f.droptime && sv.lastmillis - f.droptime >= RESETFLAGTIME) + { + returnflag(i); + sendf(-1, 1, "ri2", SV_RESETFLAG, i); + } + } + } + + void initclient(clientinfo *ci, ucharbuf &p, bool connecting) + { + putint(p, SV_INITFLAGS); + putint(p, flags.length()); + loopv(flags) + { + flag &f = flags[i]; + putint(p, f.score); + putint(p, f.owner); + if(f.owner<0) + { + putint(p, f.droptime ? 1 : 0); + if(f.droptime) + { + putint(p, int(f.droploc.x*DMF)); + putint(p, int(f.droploc.y*DMF)); + putint(p, int(f.droploc.z*DMF)); + } + } + } + } + + void parseflags(ucharbuf &p) + { + int numflags = getint(p); + loopi(numflags) + { + int team = getint(p); + vec o; + loopk(3) o[k] = getint(p)/DMF; + if(notgotflags) addflag(i, o, team); + } + notgotflags = false; + } +}; +#else +struct ctfclient : ctfstate +{ + static const int RESPAWNSECS = 5; + + fpsclient &cl; + float radarscale; + + ctfclient(fpsclient &cl) : cl(cl), radarscale(0) + { + } + + void preloadflags() + { + static const char *flagmodels[2] = { "flags/red", "flags/blue" }; + loopi(2) loadmodel(flagmodels[i], -1, true); + } + + void drawradar(float x, float y, float s) + { + glTexCoord2f(0.0f, 0.0f); glVertex2f(x, y); + glTexCoord2f(1.0f, 0.0f); glVertex2f(x+s, y); + glTexCoord2f(1.0f, 1.0f); glVertex2f(x+s, y+s); + glTexCoord2f(0.0f, 1.0f); glVertex2f(x, y+s); + } + + void drawblips(fpsent *d, int x, int y, int s, int i, bool flagblip) + { + flag &f = flags[i]; + settexture(f.team==ctfteamflag(cl.player1->team) ? + (flagblip ? "packages/hud/blip_blue_flag.png" : "packages/hud/blip_blue.png") : + (flagblip ? "packages/hud/blip_red_flag.png" : "packages/hud/blip_red.png")); + float scale = radarscale<=0 || radarscale>cl.maxradarscale() ? cl.maxradarscale() : radarscale; + vec dir; + if(flagblip) dir = f.owner ? f.owner->o : (f.droptime ? f.droploc : f.spawnloc); + else dir = f.spawnloc; + dir.sub(d->o); + dir.z = 0.0f; + float size = flagblip ? 0.1f : 0.05f, + xoffset = flagblip ? -2*(3/32.0f)*size : -size, + yoffset = flagblip ? -2*(1 - 3/32.0f)*size : -size, + dist = dir.magnitude(); + if(dist >= scale*(1 - 0.05f)) dir.mul(scale*(1 - 0.05f)/dist); + dir.rotate_around_z(-d->yaw*RAD); + glBegin(GL_QUADS); + drawradar(x + s*0.5f*(1.0f + dir.x/scale + xoffset), y + s*0.5f*(1.0f + dir.y/scale + yoffset), size*s); + glEnd(); + } + + void drawhud(fpsent *d, int w, int h) + { + if(d->state == CS_ALIVE) + { + loopv(flags) if(flags[i].owner == d) + { + cl.drawicon(320, 0, 1820, 1650); + break; + } + } + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + int x = 1800*w/h*34/40, y = 1800*1/40, s = 1800*w/h*5/40; + glColor3f(1, 1, 1); + settexture("packages/hud/radar.png"); + glBegin(GL_QUADS); + drawradar(float(x), float(y), float(s)); + glEnd(); + loopv(flags) + { + flag &f = flags[i]; + if(!ctfflagteam(f.team)) continue; + drawblips(d, x, y, s, i, false); + if(!f.ent) continue; + if(f.owner) + { + if(cl.lastmillis%1000 >= 500) continue; + } + else if(f.droptime && (f.droploc.x < 0 || cl.lastmillis%300 >= 150)) continue; + drawblips(d, x, y, s, i, true); + } + if(d->state == CS_DEAD) + { + int wait = respawnwait(d); + if(wait>=0) + { + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, w*900/h, 900, 0, -1, 1); + bool flash = wait>0 && d==cl.player1 && cl.lastspawnattempt>=d->lastpain && cl.lastmillis < cl.lastspawnattempt+100; + draw_textf("%s%d", (x+s/2)/2-(wait>=10 ? 28 : 16), (y+s/2)/2-32, flash ? "\f3" : "", wait); + glPopMatrix(); + } + } + } + + void removeplayer(fpsent *d) + { + loopv(flags) if(flags[i].owner == d) + { + flag &f = flags[i]; + f.interploc.x = -1; + f.interptime = 0; + ctfstate::dropflag(i, f.owner->o, 1); + } + } + + vec interpflagpos(flag &f, float &angle) + { + vec pos = f.owner ? vec(f.owner->abovehead()).add(vec(0, 0, 1)) : (f.droptime ? f.droploc : f.spawnloc); + angle = f.owner ? f.owner->yaw : (f.ent ? f.ent->attr1 : 0); + if(pos.x < 0) return pos; + if(f.interptime && f.interploc.x >= 0) + { + float t = min((cl.lastmillis - f.interptime)/500.0f, 1.0f); + pos.lerp(f.interploc, pos, t); + angle += (1-t)*(f.interpangle - angle); + } + return pos; + } + + vec interpflagpos(flag &f) { float angle; return interpflagpos(f, angle); } + + void renderflags() + { + loopv(flags) + { + flag &f = flags[i]; + if(!f.ent || (!f.owner && f.droptime && f.droploc.x < 0)) continue; + const char *flagname = f.team==ctfteamflag(cl.player1->team) ? "flags/blue" : "flags/red"; + float angle; + vec pos = interpflagpos(f, angle); + rendermodel(!f.droptime && !f.owner ? &f.ent->light : NULL, flagname, ANIM_MAPMODEL|ANIM_LOOP, + interpflagpos(f), angle, 0, + MDL_DYNSHADOW | MDL_CULL_VFC | MDL_CULL_OCCLUDED | (f.droptime || f.owner ? MDL_LIGHT : 0)); + } + } + + void setupflags() + { + reset(); + loopv(cl.et.ents) + { + extentity *e = cl.et.ents[i]; + if(e->type!=FLAG || e->attr2<1 || e->attr2>2) continue; + int index = flags.length(); + addflag(index, e->o, e->attr2); + flags[index].ent = e; + } + vec center(0, 0, 0); + loopv(flags) center.add(flags[i].spawnloc); + center.div(flags.length()); + radarscale = 0; + loopv(flags) radarscale = max(radarscale, 2*center.dist(flags[i].spawnloc)); + } + + void sendflags(ucharbuf &p) + { + putint(p, SV_INITFLAGS); + putint(p, flags.length()); + loopv(flags) + { + flag &f = flags[i]; + putint(p, f.team); + loopk(3) putint(p, int(f.spawnloc[k]*DMF)); + } + } + + void parseflags(ucharbuf &p, bool commit) + { + int numflags = getint(p); + loopi(numflags) + { + int score = getint(p), owner = getint(p), dropped = 0; + vec droploc(0, 0, 0); + if(owner<0) + { + dropped = getint(p); + if(dropped) loopk(3) droploc[k] = getint(p)/DMF; + } + if(commit && flags.inrange(i)) + { + flag &f = flags[i]; + f.score = score; + f.owner = owner>=0 ? (owner==cl.player1->clientnum ? cl.player1 : cl.newclient(owner)) : NULL; + f.droptime = dropped; + f.droploc = dropped ? droploc : f.spawnloc; + f.interptime = 0; + + if(dropped) + { + f.droploc.z += 4; + if(!droptofloor(f.droploc, 4, 0)) f.droploc = vec(-1, -1, -1); + } + } + } + } + + void dropflag(fpsent *d, int i, const vec &droploc) + { + if(!flags.inrange(i)) return; + flag &f = flags[i]; + f.interploc = interpflagpos(f, f.interpangle); + f.interptime = cl.lastmillis; + ctfstate::dropflag(i, droploc, 1); + f.droploc.z += 4; + if(!droptofloor(f.droploc, 4, 0)) + { + f.droploc = vec(-1, -1, -1); + f.interptime = 0; + } + conoutf(CON_GAMEINFO, "%s dropped %s flag", d==cl.player1 ? "you" : cl.colorname(d), f.team==ctfteamflag(cl.player1->team) ? "your" : "the enemy"); + playsound(S_FLAGDROP); + } + + void flagexplosion(int i, const vec &loc) + { + int ftype; + vec color; + if(flags[i].team==ctfteamflag(cl.player1->team)) { ftype = 36; color = vec(0.25f, 0.25f, 1); } + else { ftype = 35; color = vec(1, 0.25f, 0.25f); } + particle_fireball(loc, 30, ftype); + adddynlight(loc, 35, color, 900, 100); + particle_splash(0, 150, 300, loc); + } + + void flageffect(int i, const vec &from, const vec &to) + { + vec fromexp(from), toexp(to); + if(from.x >= 0) + { + fromexp.z += 8; + flagexplosion(i, fromexp); + } + if(to.x >= 0) + { + toexp.z += 8; + flagexplosion(i, toexp); + } + if(from.x >= 0 && to.x >= 0) + particle_flare(fromexp, toexp, 600, flags[i].team==ctfteamflag(cl.player1->team) ? 30 : 29); + } + + void returnflag(fpsent *d, int i) + { + if(!flags.inrange(i)) return; + flag &f = flags[i]; + flageffect(i, interpflagpos(f), f.spawnloc); + f.interptime = 0; + ctfstate::returnflag(i); + conoutf(CON_GAMEINFO, "%s returned %s flag", d==cl.player1 ? "you" : cl.colorname(d), f.team==ctfteamflag(cl.player1->team) ? "your" : "the enemy"); + playsound(S_FLAGRETURN); + } + + void resetflag(int i) + { + if(!flags.inrange(i)) return; + flag &f = flags[i]; + flageffect(i, interpflagpos(f), f.spawnloc); + f.interptime = 0; + ctfstate::returnflag(i); + conoutf(CON_GAMEINFO, "%s flag reset", f.team==ctfteamflag(cl.player1->team) ? "your" : "the enemy"); + playsound(S_FLAGRESET); + } + + void scoreflag(fpsent *d, int relay, int goal, int score) + { + if(!flags.inrange(goal) || !flags.inrange(relay)) return; + flag &f = flags[goal]; + flageffect(goal, flags[goal].spawnloc, flags[relay].spawnloc); + f.score = score; + f.interptime = 0; + ctfstate::returnflag(relay); + if(d!=cl.player1) + { + s_sprintfd(ds)("@%d", score); + particle_text(d->abovehead(), ds, 9); + } + conoutf(CON_GAMEINFO, "%s scored for %s team", d==cl.player1 ? "you" : cl.colorname(d), f.team==ctfteamflag(cl.player1->team) ? "your" : "the enemy"); + playsound(S_FLAGSCORE); + + int total = totalscore(f.team); + if(total >= FLAGLIMIT) conoutf(CON_GAMEINFO, "%s team captured %d flags", f.team==ctfteamflag(cl.player1->team) ? "your" : "the enemy", total); + } + + void takeflag(fpsent *d, int i) + { + if(!flags.inrange(i)) return; + flag &f = flags[i]; + f.interploc = interpflagpos(f, f.interpangle); + f.interptime = cl.lastmillis; + conoutf(CON_GAMEINFO, "%s %s %s flag", d==cl.player1 ? "you" : cl.colorname(d), f.droptime ? "picked up" : "stole", f.team==ctfteamflag(cl.player1->team) ? "your" : "the enemy"); + ctfstate::takeflag(i, d); + playsound(S_FLAGPICKUP); + } + + void checkflags(fpsent *d) + { + vec o = d->o; + o.z -= d->eyeheight; + loopv(flags) + { + flag &f = flags[i]; + if(!f.ent || !ctfflagteam(f.team) || f.owner || (f.droptime ? f.droploc.x<0 : f.team==ctfteamflag(d->team))) continue; + if(o.dist(f.droptime ? f.droploc : f.spawnloc) < FLAGRADIUS) + { + if(f.pickup) continue; + cl.cc.addmsg(SV_TAKEFLAG, "ri", i); + f.pickup = true; + } + else f.pickup = false; + } + } + + int respawnwait(fpsent *d) + { + return max(0, RESPAWNSECS-(cl.lastmillis-d->lastpain)/1000); + } +}; +#endif + diff --git a/src/fpsgame/entities.h b/src/fpsgame/entities.h new file mode 100644 index 0000000..457c3d9 --- /dev/null +++ b/src/fpsgame/entities.h @@ -0,0 +1,366 @@ + +struct entities : icliententities +{ + fpsclient &cl; + + vector ents; + + entities(fpsclient &_cl) : cl(_cl) + { + } + + vector &getents() { return ents; } + + const char *itemname(int i) + { + int t = ents[i]->type; + if(tI_QUAD) return NULL; + return itemstats[t-I_SHELLS].name; + } + + const char *entmdlname(int type) + { + static const char *entmdlnames[] = + { + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "ammo/shells", "ammo/bullets", "ammo/rockets", "ammo/rrounds", "ammo/grenades", "ammo/cartridges", + "health", "boost", "armor/green", "armor/yellow", "quad", "teleporter", + NULL, NULL, + "carrot", + NULL, NULL, + "checkpoint", + NULL, NULL, + NULL, NULL, + NULL + }; + return entmdlnames[type]; + } + + void preloadentities() + { + loopi(MAXENTTYPES) + { + const char *mdl = entmdlname(i); + if(!mdl) continue; + loadmodel(mdl, -1, true); + } + } + + void renderent(extentity &e, const char *mdlname, float z, float yaw) + { + if(!mdlname) return; + rendermodel(&e.light, mdlname, ANIM_MAPMODEL|ANIM_LOOP, vec(e.o).add(vec(0, 0, z)), yaw, 0, MDL_SHADOW | MDL_CULL_VFC | MDL_CULL_DIST | MDL_CULL_OCCLUDED); + } + + void renderent(extentity &e, int type, float z, float yaw) + { + renderent(e, entmdlname(type), z, yaw); + } + + void renderentities() + { + loopv(ents) + { + extentity &e = *ents[i]; + if(e.type==CARROT || e.type==RESPAWNPOINT) + { + renderent(e, e.type, (float)(1+sin(cl.lastmillis/100.0+e.o.x+e.o.y)/20), cl.lastmillis/(e.attr2 ? 1.0f : 10.0f)); + continue; + } + if(e.type==TELEPORT) + { + if(e.attr2 < 0) continue; + if(e.attr2 > 0) + { + renderent(e, mapmodelname(e.attr2), (float)(1+sin(cl.lastmillis/100.0+e.o.x+e.o.y)/20), cl.lastmillis/10.0f); + continue; + } + } + else + { + if(!e.spawned) continue; + if(e.typeI_QUAD) continue; + } + renderent(e, e.type, (float)(1+sin(cl.lastmillis/100.0+e.o.x+e.o.y)/20), cl.lastmillis/10.0f); + } + } + + void rumble(const extentity &e) + { + playsound(S_RUMBLE, &e.o); + } + + void trigger(extentity &e) + { + switch(e.attr3) + { + case 29: + cl.ms.endsp(false); + break; + } + } + + void addammo(int type, int &v, bool local = true) + { + itemstat &is = itemstats[type-I_SHELLS]; + v += is.add; + if(v>is.max) v = is.max; + if(local) cl.playsoundc(is.sound); + } + + void repammo(fpsent *d, int type) + { + addammo(type, d->ammo[type-I_SHELLS+GUN_SG]); + } + + // these two functions are called when the server acknowledges that you really + // picked up the item (in multiplayer someone may grab it before you). + + void pickupeffects(int n, fpsent *d) + { + if(!ents.inrange(n)) return; + int type = ents[n]->type; + if(typeI_QUAD) return; + ents[n]->spawned = false; + if(!d) return; + itemstat &is = itemstats[type-I_SHELLS]; + if(d!=cl.player1 || isthirdperson()) particle_text(d->abovehead(), is.name, 15); + playsound(itemstats[type-I_SHELLS].sound, d!=cl.player1 ? &d->o : NULL); + d->pickup(type); + if(d==cl.player1) switch(type) + { + case I_BOOST: + conoutf(CON_GAMEINFO, "\f2you have a permanent +10 health bonus! (%d)", d->maxhealth); + playsound(S_V_BOOST); + break; + + case I_QUAD: + conoutf(CON_GAMEINFO, "\f2you got the quad!"); + playsound(S_V_QUAD); + break; + } + } + + // these functions are called when the client touches the item + + void teleport(int n, fpsent *d) // also used by monsters + { + int e = -1, tag = ents[n]->attr1, beenhere = -1; + for(;;) + { + e = findentity(TELEDEST, e+1); + if(e==beenhere || e<0) { conoutf(CON_WARN, "no teleport destination for tag %d", tag); return; } + if(beenhere<0) beenhere = e; + if(ents[e]->attr2==tag) + { + d->o = ents[e]->o; + d->yaw = ents[e]->attr1; + d->pitch = 0; + d->vel = vec(0, 0, 0);//vec(cosf(RAD*(d->yaw-90)), sinf(RAD*(d->yaw-90)), 0); + entinmap(d); + updatedynentcache(d); + cl.playsoundc(S_TELEPORT, d); + break; + } + } + } + + void trypickup(int n, fpsent *d) + { + switch(ents[n]->type) + { + default: + if(d->canpickup(ents[n]->type)) + { + cl.cc.addmsg(SV_ITEMPICKUP, "ri", n); + ents[n]->spawned = false; // even if someone else gets it first + } + break; + + case TELEPORT: + { + if(d->lastpickup==ents[n]->type && cl.lastmillis-d->lastpickupmillis<500) break; + d->lastpickup = ents[n]->type; + d->lastpickupmillis = cl.lastmillis; + teleport(n, d); + break; + } + + case RESPAWNPOINT: + if(d!=cl.player1) break; + if(n==cl.respawnent) break; + cl.respawnent = n; + conoutf(CON_GAMEINFO, "\f2respawn point set!"); + playsound(S_V_RESPAWNPOINT); + break; + + case JUMPPAD: + { + if(d->lastpickup==ents[n]->type && cl.lastmillis-d->lastpickupmillis<300) break; + d->lastpickup = ents[n]->type; + d->lastpickupmillis = cl.lastmillis; + vec v((int)(char)ents[n]->attr3*10.0f, (int)(char)ents[n]->attr2*10.0f, ents[n]->attr1*12.5f); + d->timeinair = 0; + d->falling = vec(0, 0, 0); + d->vel = v; +// d->vel.z = 0; +// d->vel.add(v); + cl.playsoundc(S_JUMPPAD, d); + break; + } + } + } + + void checkitems(fpsent *d) + { + if(d==cl.player1 && (editmode || cl.cc.spectator)) return; + vec o = d->o; + o.z -= d->eyeheight; + loopv(ents) + { + extentity &e = *ents[i]; + if(e.type==NOTUSED) continue; + if(!e.spawned && e.type!=TELEPORT && e.type!=JUMPPAD && e.type!=RESPAWNPOINT) continue; + float dist = e.o.dist(o); + if(dist<(e.type==TELEPORT ? 16 : 12)) trypickup(i, d); + } + } + + void checkquad(int time, fpsent *d) + { + if(d->quadmillis && (d->quadmillis -= time)<=0) + { + d->quadmillis = 0; + playsound(S_PUPOUT, d==cl.player1 ? NULL : &d->o); + if(d==cl.player1) conoutf(CON_GAMEINFO, "\f2quad damage is over"); + } + } + + void putitems(ucharbuf &p, int gamemode) // puts items in network stream and also spawns them locally + { + putint(p, SV_ITEMLIST); + loopv(ents) if(ents[i]->type>=I_SHELLS && ents[i]->type<=I_QUAD && (!m_capture || ents[i]->typetype>I_CARTRIDGES)) + { + putint(p, i); + putint(p, ents[i]->type); + } + putint(p, -1); + } + + void resetspawns() { loopv(ents) ents[i]->spawned = false; } + + void spawnitems(int gamemode) + { + if(m_noitems) return; + loopv(ents) if(ents[i]->type>=I_SHELLS && ents[i]->type<=I_QUAD && (!m_capture || ents[i]->typetype>I_CARTRIDGES)) + { + ents[i]->spawned = (m_sp || (ents[i]->type!=I_QUAD && ents[i]->type!=I_BOOST)); + } + } + + void setspawn(int i, bool on) { if(ents.inrange(i)) ents[i]->spawned = on; } + + extentity *newentity() { return new fpsentity(); } + + void fixentity(extentity &e) + { + switch(e.type) + { + case FLAG: + case BOX: + case BARREL: + case PLATFORM: + case ELEVATOR: + e.attr4 = e.attr3; + e.attr3 = e.attr2; + case MONSTER: + case TELEDEST: + e.attr2 = e.attr1; + case RESPAWNPOINT: + e.attr1 = (int)cl.player1->yaw; + } + } + + void entradius(extentity &e, float &radius, float &angle, vec &dir) + { + switch(e.type) + { + case TELEPORT: + loopv(ents) if(ents[i]->type == TELEDEST && e.attr1==ents[i]->attr2) + { + radius = e.o.dist(ents[i]->o); + dir = vec(ents[i]->o).sub(e.o).normalize(); + break; + } + break; + + case JUMPPAD: + radius = 4; + dir = vec((int)(char)e.attr3*10.0f, (int)(char)e.attr2*10.0f, e.attr1*12.5f).normalize(); + break; + + case FLAG: + case MONSTER: + case TELEDEST: + case MAPMODEL: + case RESPAWNPOINT: + case BOX: + case BARREL: + case PLATFORM: + case ELEVATOR: + radius = 4; + vecfromyawpitch(e.attr1, 0, 1, 0, dir); + break; + } + } + + const char *entnameinfo(entity &e) { return ""; } + const char *entname(int i) + { + static const char *entnames[] = + { + "none?", "light", "mapmodel", "playerstart", "envmap", "particles", "sound", "spotlight", + "shells", "bullets", "rockets", "riflerounds", "grenades", "cartridges", + "health", "healthboost", "greenarmour", "yellowarmour", "quaddamage", + "teleport", "teledest", + "monster", "carrot", "jumppad", + "base", "respawnpoint", + "box", "barrel", + "platform", "elevator", + "flag", + "", "", "", "", + }; + return i>=0 && size_t(i)= 7) e.type++; + } + if(ver <= 12) + { + if(e.type >= 8) e.type++; + } + } + + void editent(int i) + { + extentity &e = *ents[i]; + cl.cc.addmsg(SV_EDITENT, "ri9", i, (int)(e.o.x*DMF), (int)(e.o.y*DMF), (int)(e.o.z*DMF), e.type, e.attr1, e.attr2, e.attr3, e.attr4); + } + + float dropheight(entity &e) + { + if(e.type==MAPMODEL || e.type==BASE || e.type==FLAG) return 0.0f; + return 4.0f; + } +}; diff --git a/src/fpsgame/extinfo.h b/src/fpsgame/extinfo.h new file mode 100644 index 0000000..dcb8f23 --- /dev/null +++ b/src/fpsgame/extinfo.h @@ -0,0 +1,180 @@ + +#define EXT_ACK -1 +#define EXT_VERSION 103 +#define EXT_NO_ERROR 0 +#define EXT_ERROR 1 +#define EXT_PLAYERSTATS_RESP_IDS -10 +#define EXT_PLAYERSTATS_RESP_STATS -11 +#define EXT_UPTIME 0 +#define EXT_PLAYERSTATS 1 +#define EXT_TEAMSCORE 2 + +/* + Client: + ----- + A: 0 EXT_UPTIME + B: 0 EXT_PLAYERSTATS cn #a client number or -1 for all players# + C: 0 EXT_TEAMSCORE + + Server: + -------- + A: 0 EXT_UPTIME EXT_ACK EXT_VERSION uptime #in seconds# + B: 0 EXT_PLAYERSTATS cn #send by client# EXT_ACK EXT_VERSION 0 or 1 #error, if cn was > -1 and client does not exist# ... + EXT_PLAYERSTATS_RESP_IDS pid(s) #1 packet# + EXT_PLAYERSTATS_RESP_STATS pid playerdata #1 packet for each player# + C: 0 EXT_TEAMSCORE EXT_ACK EXT_VERSION 0 or 1 #error, no teammode# remaining_time gamemode loop(teamdata [numbases bases] or -1) + + Errors: + -------------- + B:C:default: 0 command EXT_ACK EXT_VERSION EXT_ERROR +*/ + + void extinfoplayer(ucharbuf &p, clientinfo *ci) + { + ucharbuf q = p; + putint(q, EXT_PLAYERSTATS_RESP_STATS); // send player stats following + putint(q, ci->clientnum); //add player id + sendstring(ci->name, q); + sendstring(ci->team, q); + putint(q, ci->state.frags); + putint(q, ci->state.deaths); + putint(q, ci->state.teamkills); + putint(q, ci->state.damage*100/max(ci->state.shotdamage,1)); + putint(q, ci->state.health); + putint(q, ci->state.armour); + putint(q, ci->state.gunselect); + putint(q, ci->privilege); + putint(q, ci->state.state); + uint ip = getclientip(ci->clientnum); + q.put((uchar*)&ip, 3); + sendserverinforeply(q); + } + + struct teamscore + { + const char *name; + int score; + + teamscore(const char *name, int score) : name(name), score(score) {} + }; + + void extinfoteams(ucharbuf &p) + { + putint(p, m_teammode ? 0 : 1); + putint(p, gamemode); + putint(p, minremain); + if(!m_teammode) return; + + vector scores; + + //most taken from scoreboard.h + if(m_capture) + { + loopv(capturemode.scores) scores.add(teamscore(capturemode.scores[i].team, capturemode.scores[i].total)); + loopv(clients) if(clients[i]->team[0]) //check all teams available, since capturemode.scores contains only teams with scores + { + teamscore *ts = NULL; + loopvj(scores) if(!strcmp(scores[j].name, clients[i]->team)) { ts = &scores[i]; break; } + if(!ts) scores.add(teamscore(clients[i]->team, 0)); + } + } + else if(m_ctf) + { + loopv(ctfmode.flags) + { + const char *team = ctfflagteam(ctfmode.flags[i].team); + if(!team) continue; + teamscore *ts = NULL; + loopvj(scores) if(!strcmp(scores[j].name, team)) { ts = &scores[i]; break; } + if(!ts) scores.add(teamscore(team, ctfmode.flags[i].score)); + else ts->score += ctfmode.flags[i].score; + } + } + else + { + loopv(clients) if(clients[i]->team[0]) + { + clientinfo *ci = clients[i]; + teamscore *ts = NULL; + loopvj(scores) if(!strcmp(scores[j].name, ci->team)) { ts = &scores[i]; break; } + if(!ts) scores.add(teamscore(ci->team, ci->state.frags)); + else ts->score += ci->state.frags; + } + } + + loopv(scores) + { + sendstring(scores[i].name, p); + putint(p, scores[i].score); + + if(m_capture) + { + int bases = 0; + loopvj(capturemode.bases) if(!strcmp(capturemode.bases[j].owner, scores[i].name)) bases++; + putint(p, bases); + loopvj(capturemode.bases) if(!strcmp(capturemode.bases[j].owner, scores[i].name)) putint(p, j); + } + else putint(p,-1); //no bases follow + } + } + + void extserverinforeply(ucharbuf &req, ucharbuf &p) + { + int extcmd = getint(req); // extended commands + + //Build a new packet + putint(p, EXT_ACK); //send ack + putint(p, EXT_VERSION); //send version of extended info + + switch(extcmd) + { + case EXT_UPTIME: + { + putint(p, uint(totalmillis)/1000); //in seconds + break; + } + + case EXT_PLAYERSTATS: + { + int cn = getint(req); //a special player, -1 for all + + clientinfo *ci = NULL; + if(cn >= 0) + { + loopv(clients) if(clients[i]->clientnum == cn) { ci = clients[i]; break; } + if(!ci) + { + putint(p, EXT_ERROR); //client requested by id was not found + sendserverinforeply(p); + return; + } + } + + putint(p, EXT_NO_ERROR); //so far no error can happen anymore + + ucharbuf q = p; //remember buffer position + putint(q, EXT_PLAYERSTATS_RESP_IDS); //send player ids following + if(ci) putint(q, ci->clientnum); + else loopv(clients) putint(q, clients[i]->clientnum); + sendserverinforeply(q); + + if(ci) extinfoplayer(p, ci); + else loopv(clients) extinfoplayer(p, clients[i]); + return; + } + + case EXT_TEAMSCORE: + { + extinfoteams(p); + break; + } + + default: + { + putint(p, EXT_ERROR); + break; + } + } + sendserverinforeply(p); + } + diff --git a/src/fpsgame/fps.cpp b/src/fpsgame/fps.cpp new file mode 100644 index 0000000..592a4cf --- /dev/null +++ b/src/fpsgame/fps.cpp @@ -0,0 +1,1096 @@ +#include "pch.h" + +#include "cube.h" + +#include "iengine.h" +#include "igame.h" + +#include "game.h" + +#include "fpsserver.h" + +#ifndef STANDALONE + +struct fpsclient : igameclient +{ + // these define classes local to fpsclient + #include "weapon.h" + #include "monster.h" + #include "movable.h" + #include "scoreboard.h" + #include "fpsrender.h" + #include "entities.h" + #include "client.h" + #include "capture.h" + #include "assassin.h" + #include "ctf.h" + + int nextmode, gamemode; // nextmode becomes gamemode after next map load + bool intermission; + int lastmillis; + string clientmap; + int maptime, minremain; + int respawnent; + int swaymillis; + vec swaydir; + int respawned, suicided; + int lastslowmohealth, slowmorealtimestart; + int lasthit, lastspawnattempt; + + int following, followdir; + + bool openmainmenu; + + fpsent *player1; // our client + vector players; // other clients + fpsent lastplayerstate; + + weaponstate ws; + monsterset ms; + movableset mo; + scoreboard sb; + fpsrender fr; + entities et; + clientcom cc; + + IVARP(maxradarscale, 0, 1024, 10000); + + captureclient cpc; + assassinclient asc; + ctfclient ctf; + + fpsclient() + : nextmode(0), gamemode(0), intermission(false), lastmillis(0), + maptime(0), minremain(0), respawnent(-1), + swaymillis(0), swaydir(0, 0, 0), + respawned(-1), suicided(-1), + lasthit(0), lastspawnattempt(0), + following(-1), followdir(0), openmainmenu(true), + player1(spawnstate(new fpsent())), + ws(*this), ms(*this), mo(*this), sb(*this), fr(*this), et(*this), cc(*this), + cpc(*this), asc(*this), ctf(*this) + { + CCOMMAND(mode, "i", (fpsclient *self, int *val), { self->setmode(*val); }); + CCOMMAND(kill, "", (fpsclient *self), { self->suicide(self->player1); }); + CCOMMAND(taunt, "", (fpsclient *self), { self->taunt(); }); + CCOMMAND(follow, "s", (fpsclient *self, char *s), { self->follow(s); }); + CCOMMAND(nextfollow, "i", (fpsclient *self, int *dir), { self->nextfollow(*dir < 0 ? -1 : 1); }); + } + + iclientcom *getcom() { return &cc; } + icliententities *getents() { return &et; } + + void setmode(int mode) + { + if(multiplayer(false) && !m_mp(mode)) { conoutf(CON_ERROR, "mode %d not supported in multiplayer", mode); return; } + nextmode = mode; + } + + void taunt() + { + if(player1->state!=CS_ALIVE || player1->physstatelasttaunt<1000) return; + player1->lasttaunt = lastmillis; + cc.addmsg(SV_TAUNT, "r"); + } + + void follow(char *arg) + { + if(arg[0] ? player1->state==CS_SPECTATOR : following>=0) + { + following = arg[0] ? cc.parseplayer(arg) : -1; + if(following==player1->clientnum) following = -1; + followdir = 0; + conoutf("follow %s", following>=0 ? "on" : "off"); + } + } + + void nextfollow(int dir) + { + if(player1->state!=CS_SPECTATOR || players.empty()) + { + stopfollowing(); + return; + } + int cur = following >= 0 ? following : (dir < 0 ? players.length() - 1 : 0); + loopv(players) + { + cur = (cur + dir + players.length()) % players.length(); + if(players[cur]) + { + if(following<0) conoutf("follow on"); + following = cur; + followdir = dir; + return; + } + } + stopfollowing(); + } + + char *getclientmap() { return clientmap; } + + void adddynlights() { ws.adddynlights(); } + + void rendergame() { fr.rendergame(gamemode); } + + void resetgamestate() + { + if(m_classicsp) + { + mo.clear(gamemode); + ms.monsterclear(gamemode); // all monsters back at their spawns for editing + resettriggers(); + } + ws.projreset(); + } + + fpsent *spawnstate(fpsent *d) // reset player state not persistent accross spawns + { + d->respawn(); + d->spawnstate(gamemode); + return d; + } + + void respawnself() + { + if(m_mp(gamemode)) + { + if(respawned!=player1->lifesequence) + { + cc.addmsg(SV_TRYSPAWN, "r"); + respawned = player1->lifesequence; + } + } + else + { + spawnplayer(player1); + sb.showscores(false); + lasthit = 0; + if(m_capture) cpc.lastrepammo = -1; + } + } + + fpsent *pointatplayer() + { + loopv(players) + { + fpsent *o = players[i]; + if(!o) continue; + if(intersect(o, player1->o, worldpos)) return o; + } + return NULL; + } + + void stopfollowing() + { + if(following<0) return; + following = -1; + followdir = 0; + conoutf("follow off"); + } + + fpsent *followingplayer() + { + if(player1->state!=CS_SPECTATOR || following<0) return NULL; + fpsent *target = getclient(following); + if(target && target->state!=CS_SPECTATOR) return target; + return NULL; + } + + fpsent *hudplayer() + { + extern int thirdperson; + if(thirdperson) return player1; + fpsent *target = followingplayer(); + return target ? target : player1; + } + + void setupcamera() + { + fpsent *target = followingplayer(); + if(target) + { + player1->yaw = target->yaw; + player1->pitch = target->state==CS_DEAD ? 0 : target->pitch; + player1->o = target->o; + player1->resetinterp(); + } + } + + bool detachcamera() + { + fpsent *d = hudplayer(); + return d->state==CS_DEAD; + } + + IVARP(smoothmove, 0, 75, 100); + IVARP(smoothdist, 0, 32, 64); + + void otherplayers(int curtime) + { + loopv(players) if(players[i]) + { + fpsent *d = players[i]; + + if(d->state==CS_ALIVE) + { + if(lastmillis - d->lastaction >= d->gunwait) d->gunwait = 0; + if(d->quadmillis) et.checkquad(curtime, d); + } + + const int lagtime = lastmillis-d->lastupdate; + if(!lagtime || intermission) continue; + else if(lagtime>1000 && d->state==CS_ALIVE) + { + d->state = CS_LAGGED; + continue; + } + if(d->state==CS_ALIVE || d->state==CS_EDITING) + { + if(smoothmove() && d->smoothmillis>0) + { + d->o = d->newpos; + d->yaw = d->newyaw; + d->pitch = d->newpitch; + moveplayer(d, 1, false); + d->newpos = d->o; + float k = 1.0f - float(lastmillis - d->smoothmillis)/smoothmove(); + if(k>0) + { + d->o.add(vec(d->deltapos).mul(k)); + d->yaw += d->deltayaw*k; + if(d->yaw<0) d->yaw += 360; + else if(d->yaw>=360) d->yaw -= 360; + d->pitch += d->deltapitch*k; + } + } + else moveplayer(d, 1, false); + } + else if(d->state==CS_DEAD && lastmillis-d->lastpain<2000) moveplayer(d, 1, true); + } + } + + void addsway(int curtime) + { + fpsent *d = hudplayer(); + if(d->state!=CS_SPECTATOR) + { + if(d->physstate>=PHYS_SLOPE) swaymillis += curtime; + float k = pow(0.7f, curtime/10.0f); + swaydir.mul(k); + vec vel(d->vel); + vel.add(d->falling); + swaydir.add(vec(vel).mul((1-k)/(15*max(vel.magnitude(), d->maxspeed)))); + } + } + + void updateworld(vec &pos, int curtime, int lm) // main game update loop + { + if(!maptime) + { + maptime = lm + curtime; + extern int totalmillis; + slowmorealtimestart = totalmillis; + return; + } + lastmillis = lm; + + if(m_slowmo) + { + setvar("gamespeed", intermission ? 100 : player1->health); + if(player1->healthmaxhealth && lastmillis-lastslowmohealth>player1->health*player1->health/2) + { + lastslowmohealth = lastmillis; + player1->health++; + } + } + + if(!curtime) return; + + physicsframe(); + et.checkquad(curtime, player1); + ws.moveprojectiles(curtime); + if(player1->clientnum>=0 && player1->state==CS_ALIVE) ws.shoot(player1, pos); // only shoot when connected to server + ws.bounceupdate(curtime); // need to do this after the player shoots so grenades don't end up inside player's BB next frame + otherplayers(curtime); + gets2c(); + mo.update(curtime); + ms.monsterthink(curtime, gamemode); + if(player1->state==CS_DEAD) + { + if(lastmillis-player1->lastpain<2000) + { + player1->move = player1->strafe = 0; + moveplayer(player1, 10, false); + } + if(m_assassin && asc.respawnwait()<=0) respawnself(); + } + else if(!intermission) + { + moveplayer(player1, 10, true); + addsway(curtime); + et.checkitems(player1); + if(m_classicsp) checktriggers(); + else if(m_capture) cpc.checkbaseammo(player1); + else if(m_ctf) ctf.checkflags(player1); + } + if(player1->clientnum>=0) c2sinfo(player1); // do this last, to reduce the effective frame lag + } + + void spawnplayer(fpsent *d) // place at random spawn. also used by monsters! + { + findplayerspawn(d, m_capture ? cpc.pickspawn(d->team) : (respawnent>=0 ? respawnent : -1), m_ctf ? ctfteamflag(player1->team) : 0); + spawnstate(d); + d->state = cc.spectator ? CS_SPECTATOR : (d==player1 && editmode ? CS_EDITING : CS_ALIVE); + } + + void respawn() + { + if(player1->state==CS_DEAD) + { + player1->attacking = false; + if(m_capture || m_ctf) + { + int wait = m_capture ? cpc.respawnwait(player1) : ctf.respawnwait(player1); + if(wait>0) + { + lastspawnattempt = lastmillis; + //conoutf(CON_GAMEINFO, "\f2you must wait %d second%s before respawn!", wait, wait!=1 ? "s" : ""); + return; + } + } + if(m_arena) { conoutf(CON_GAMEINFO, "\f2waiting for new round to start..."); return; } + if(m_dmsp) { nextmode = gamemode; cc.changemap(clientmap); return; } // if we die in SP we try the same map again + if(m_classicsp) + { + respawnself(); + conoutf(CON_GAMEINFO, "\f2You wasted another life! The monsters stole your armour and some ammo..."); + loopi(NUMGUNS) if(i!=GUN_PISTOL && (player1->ammo[i] = lastplayerstate.ammo[i])>5) player1->ammo[i] = max(player1->ammo[i]/3, 5); + return; + } + respawnself(); + } + } + + // inputs + + void doattack(bool on) + { + if(intermission) return; + if((player1->attacking = on)) respawn(); + } + + bool canjump() + { + if(!intermission) respawn(); + return player1->state!=CS_DEAD && !intermission; + } + + bool allowmove(physent *d) + { + if(d->type!=ENT_PLAYER) return true; + return !((fpsent *)d)->lasttaunt || lastmillis-((fpsent *)d)->lasttaunt>=1000; + } + + void damaged(int damage, fpsent *d, fpsent *actor, bool local = true) + { + if(d->state!=CS_ALIVE || intermission) return; + + fpsent *h = local ? player1 : hudplayer(); + if(actor==h && d!=actor) lasthit = lastmillis; + + if(local) damage = d->dodamage(damage); + else if(actor==player1) return; + + if(d==h) + { + damageblend(damage); + damagecompass(damage, actor->o); + d->damageroll(damage); + if(m_slowmo && player1->health<1) player1->health = 1; + } + ws.damageeffect(damage, d, d!=h); + + if(d->health<=0) { if(local) killed(d, actor); } + else if(d==player1) playsound(S_PAIN6); + else playsound(S_PAIN1+rnd(5), &d->o); + } + + void deathstate(fpsent *d, bool restore = false) + { + d->state = CS_DEAD; + d->lastpain = lastmillis; + d->superdamage = restore ? 0 : max(-d->health, 0); + if(d==player1) + { + sb.showscores(true); + setvar("zoom", -1, true); + if(!restore) lastplayerstate = *player1; + d->attacking = false; + if(!restore) d->deaths++; + d->pitch = 0; + d->roll = 0; + playsound(S_DIE1+rnd(2)); + } + else + { + d->move = d->strafe = 0; + d->resetinterp(); + playsound(S_DIE1+rnd(2), &d->o); + if(!restore) ws.superdamageeffect(d->vel, d); + } + } + + void killed(fpsent *d, fpsent *actor) + { + if(d->state==CS_EDITING) + { + d->editstate = CS_DEAD; + if(d==player1) d->deaths++; + else d->resetinterp(); + return; + } + else if(d->state!=CS_ALIVE || intermission) return; + + fpsent *h = followingplayer(); + if(!h) h = player1; + int contype = d==h || actor==h ? CON_FRAG_SELF : CON_FRAG_OTHER; + string dname, aname; + s_strcpy(dname, d==player1 ? "you" : colorname(d)); + s_strcpy(aname, actor==player1 ? "you" : (actor->type!=ENT_INANIMATE ? colorname(actor) : "")); + if(actor->type==ENT_AI) + conoutf(contype, "\f2%s got killed by %s!", dname, aname); + else if(d==actor || actor->type==ENT_INANIMATE) + conoutf(contype, "\f2%s suicided%s", dname, d==player1 ? "!" : ""); + else if(isteam(d->team, actor->team)) + { + if(d==player1) conoutf(contype, "\f2you got fragged by a teammate (%s)", aname); + else conoutf(contype, "\f2%s fragged a teammate (%s)", aname, dname); + } + else if(m_assassin && (d==player1 || actor==player1)) + { + if(d==player1) + { + conoutf(contype, "\f2you got fragged by %s (%s)", aname, asc.hunters.find(actor)>=0 ? "assassin" : (asc.targets.find(actor)>=0 ? "target" : "friend")); + if(asc.hunters.find(actor)>=0) asc.hunters.removeobj(actor); + } + else + { + conoutf(contype, "\f2you fragged %s (%s)", dname, asc.targets.find(d)>=0 ? "target +1" : (asc.hunters.find(d)>=0 ? "assassin +0" : "friend -1")); + if(asc.targets.find(d)>=0) asc.targets.removeobj(d); + } + } + else + { + if(d==player1) conoutf(contype, "\f2you got fragged by %s", aname); + else conoutf(contype, "\f2%s fragged %s", aname, dname); + } + + deathstate(d); + } + + void timeupdate(int timeremain) + { + minremain = timeremain; + if(!timeremain) + { + intermission = true; + player1->attacking = false; + conoutf(CON_GAMEINFO, "\f2intermission:"); + conoutf(CON_GAMEINFO, "\f2game has ended!"); + conoutf(CON_GAMEINFO, "\f2player frags: %d, deaths: %d", player1->frags, player1->deaths); + int accuracy = player1->totaldamage*100/max(player1->totalshots, 1); + conoutf(CON_GAMEINFO, "\f2player total damage dealt: %d, damage wasted: %d, accuracy(%%): %d", player1->totaldamage, player1->totalshots-player1->totaldamage, accuracy); + if(m_sp) + { + conoutf(CON_GAMEINFO, "\f2--- single player time score: ---"); + int pen, score = 0; + extern int totalmillis; + pen = (totalmillis-slowmorealtimestart)/1000; score += pen; if(pen) conoutf(CON_GAMEINFO, "\f2time taken: %d seconds (%d simulated seconds)", pen, (lastmillis-maptime)/1000); + pen = player1->deaths*60; score += pen; if(pen) conoutf(CON_GAMEINFO, "\f2time penalty for %d deaths (1 minute each): %d seconds", player1->deaths, pen); + pen = ms.remain*10; score += pen; if(pen) conoutf(CON_GAMEINFO, "\f2time penalty for %d monsters remaining (10 seconds each): %d seconds", ms.remain, pen); + pen = (10-ms.skill())*20; score += pen; if(pen) conoutf(CON_GAMEINFO, "\f2time penalty for lower skill level (20 seconds each): %d seconds", pen); + pen = 100-accuracy; score += pen; if(pen) conoutf(CON_GAMEINFO, "\f2time penalty for missed shots (1 second each %%): %d seconds", pen); + s_sprintfd(aname)("bestscore_%s", getclientmap()); + const char *bestsc = getalias(aname); + int bestscore = *bestsc ? atoi(bestsc) : score; + if(score 0) + { + conoutf(CON_GAMEINFO, "\f2time remaining: %d %s", timeremain, timeremain==1 ? "minute" : "minutes"); + } + } + + fpsent *newclient(int cn) // ensure valid entity + { + if(cn<0 || cn>=MAXCLIENTS) + { + neterr("clientnum"); + return NULL; + } + while(cn>=players.length()) players.add(NULL); + if(!players[cn]) + { + fpsent *d = new fpsent(); + d->clientnum = cn; + players[cn] = d; + } + return players[cn]; + } + + fpsent *getclient(int cn) // ensure valid entity + { + return players.inrange(cn) ? players[cn] : NULL; + } + + void clientdisconnected(int cn, bool notify = true) + { + if(!players.inrange(cn)) return; + if(following==cn) + { + if(followdir) nextfollow(followdir); + else stopfollowing(); + } + fpsent *d = players[cn]; + if(!d) return; + if(notify && d->name[0]) conoutf("player %s disconnected", colorname(d)); + ws.removebouncers(d); + ws.removeprojectiles(d); + removetrackedparticles(d); + if(m_assassin) asc.removeplayer(d); + else if(m_ctf) ctf.removeplayer(d); + DELETEP(players[cn]); + cleardynentcache(); + } + + void initclient() + { + clientmap[0] = 0; + cc.initclientnet(); + } + + void preloadweapons() + { + loopi(NUMGUNS) + { + const char *file = guns[i].file; + if(!file) continue; + s_sprintfd(mdl)("hudguns/%s", file); + loadmodel(mdl, -1, true); + s_sprintf(mdl)("hudguns/%s/blue", file); + loadmodel(mdl, -1, true); + s_sprintf(mdl)("vwep/%s", file); + loadmodel(mdl, -1, true); + } + } + + void preloadbouncers() + { + const char *mdls[] = + { + "gibc", "gibh", + "projectiles/grenade", "projectiles/rocket", + "debris/debris01", "debris/debris02", "debris/debris03", "debris/debris04", + "barreldebris/debris01", "barreldebris/debris02", "barreldebris/debris03", "barreldebris/debris04" + }; + loopi(sizeof(mdls)/sizeof(mdls[0])) + { + loadmodel(mdls[i], -1, true); + } + } + + void preload() + { + preloadweapons(); + preloadbouncers(); + fr.preloadplayermodel(); + et.preloadentities(); + if(m_sp) ms.preloadmonsters(); + else if(m_capture) cpc.preloadbases(); + else if(m_ctf) ctf.preloadflags(); + } + + IVARP(startmenu, 0, 1, 1); + + void startmap(const char *name) // called just after a map load + { + respawned = suicided = -1; + respawnent = -1; + lasthit = 0; + if(multiplayer(false) && m_sp) { gamemode = 0; conoutf(CON_ERROR, "coop sp not supported yet"); } + cc.mapstart(); + mo.clear(gamemode); + ms.monsterclear(gamemode); + ws.projreset(); + + // reset perma-state + player1->frags = 0; + player1->deaths = 0; + player1->totaldamage = 0; + player1->totalshots = 0; + player1->maxhealth = 100; + loopv(players) if(players[i]) + { + players[i]->frags = 0; + players[i]->deaths = 0; + players[i]->totaldamage = 0; + players[i]->totalshots = 0; + players[i]->maxhealth = 100; + } + + if(!m_mp(gamemode)) spawnplayer(player1); + else findplayerspawn(player1, -1); + et.resetspawns(); + s_strcpy(clientmap, name); + sb.showscores(false); + setvar("zoom", -1, true); + intermission = false; + maptime = 0; + if(*name) conoutf(CON_GAMEINFO, "\f2game mode is %s", fpsserver::modestr(gamemode)); + if(m_sp) + { + s_sprintfd(aname)("bestscore_%s", getclientmap()); + const char *best = getalias(aname); + if(*best) conoutf(CON_GAMEINFO, "\f2try to beat your best score so far: %s", best); + lastslowmohealth = lastmillis; + } + + if(*name && openmainmenu && startmenu()) + { + showgui("main"); + openmainmenu = false; + } + + if(identexists("mapstart")) execute("mapstart"); + } + + void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material) + { + if(d->type==ENT_INANIMATE) return; + if (waterlevel>0) { if(material!=MAT_LAVA) playsound(S_SPLASH1, d==player1 ? NULL : &d->o); } + else if(waterlevel<0) playsound(material==MAT_LAVA ? S_BURN : S_SPLASH2, d==player1 ? NULL : &d->o); + if (floorlevel>0) { if(d==player1 || d->type!=ENT_PLAYER) playsoundc(S_JUMP, (fpsent *)d); } + else if(floorlevel<0) { if(d==player1 || d->type!=ENT_PLAYER) playsoundc(S_LAND, (fpsent *)d); } + } + + void playsoundc(int n, fpsent *d = NULL) + { + if(!d || d==player1) + { + cc.addmsg(SV_SOUND, "i", n); + playsound(n); + } + else playsound(n, &d->o); + } + + int numdynents() { return 1+players.length()+ms.monsters.length()+mo.movables.length(); } + + dynent *iterdynents(int i) + { + if(!i) return player1; + i--; + if(iname; + if(d!=player1 && !strcmp(name, player1->name)) return true; + loopv(players) if(players[i] && d!=players[i] && !strcmp(name, players[i]->name)) return true; + return false; + } + + char *colorname(fpsent *d, char *name = NULL, const char *prefix = "") + { + if(!name) name = d->name; + if(name[0] && !duplicatename(d, name)) return name; + static string cname; + s_sprintf(cname)("%s%s \fs\f5(%d)\fr", prefix, name, d->clientnum); + return cname; + } + + void suicide(physent *d) + { + if(d==player1) + { + if(d->state!=CS_ALIVE) return; + if(!m_mp(gamemode)) killed(player1, player1); + else if(suicided!=player1->lifesequence) + { + cc.addmsg(SV_SUICIDE, "r"); + suicided = player1->lifesequence; + } + } + else if(d->type==ENT_AI) ((monsterset::monster *)d)->monsterpain(400, player1); + else if(d->type==ENT_INANIMATE) ((movableset::movable *)d)->suicide(); + } + + IVARP(hudgun, 0, 1, 1); + IVARP(hudgunsway, 0, 1, 1); + IVARP(teamhudguns, 0, 1, 1); + + void drawhudmodel(fpsent *d, int anim, float speed = 0, int base = 0) + { + if(d->gunselect>GUN_PISTOL) return; + + vec sway; + vecfromyawpitch(d->yaw, d->pitch, 1, 0, sway); + float swayspeed = sqrtf(d->vel.x*d->vel.x + d->vel.y*d->vel.y); + swayspeed = min(4.0f, swayspeed); + sway.mul(swayspeed); + float swayxy = sinf(swaymillis/115.0f)/100.0f, + swayz = cosf(swaymillis/115.0f)/100.0f; + swap(sway.x, sway.y); + sway.x *= -swayxy; + sway.y *= swayxy; + sway.z = -fabs(swayspeed*swayz); + sway.add(swaydir).add(d->o); + if(!hudgunsway()) sway = d->o; + +#if 0 + if(player1->state!=CS_DEAD && player1->quadmillis) + { + float t = 0.5f + 0.5f*sinf(2*M_PI*lastmillis/1000.0f); + color.y = color.y*(1-t) + t; + } +#endif + + s_sprintfd(gunname)("hudguns/%s", guns[d->gunselect].file); + if((m_teamskins || fr.teamskins()) && teamhudguns()) + s_strcat(gunname, d==player1 || isteam(d->team, player1->team) ? "/blue" : "/red"); + rendermodel(NULL, gunname, anim, sway, d->yaw+90, d->pitch, MDL_LIGHT, NULL, NULL, base, speed); + } + + void drawhudgun() + { + if(!hudgun() || editmode) return; + + fpsent *d = hudplayer(); + if(d->state==CS_SPECTATOR || d->state==CS_EDITING) return; + + int rtime = ws.reloadtime(d->gunselect); + if(d->lastaction && d->lastattackgun==d->gunselect && lastmillis-d->lastactionlastaction); + } + else + { + drawhudmodel(d, ANIM_GUNIDLE|ANIM_LOOP); + } + } + + void drawicon(float tx, float ty, int x, int y) + { + settexture("packages/hud/items.png"); + glBegin(GL_QUADS); + tx /= 384; + ty /= 128; + int s = 120; + glTexCoord2f(tx, ty); glVertex2f(x, y); + glTexCoord2f(tx+1/6.0f, ty); glVertex2f(x+s, y); + glTexCoord2f(tx+1/6.0f, ty+1/2.0f); glVertex2f(x+s, y+s); + glTexCoord2f(tx, ty+1/2.0f); glVertex2f(x, y+s); + glEnd(); + } + + float abovegameplayhud() + { + return 1650.0f/1800.0f; + } + + void gameplayhud(int w, int h) + { + if(player1->state==CS_SPECTATOR) + { + glLoadIdentity(); + glOrtho(0, w*1800/h, 1800, 0, -1, 1); + + int pw, ph, tw, th, fw, fh; + text_bounds(" ", pw, ph); + text_bounds("SPECTATOR", tw, th); + th = max(th, ph); + fpsent *f = followingplayer(); + text_bounds(f ? colorname(f) : " ", fw, fh); + fh = max(fh, ph); + draw_text("SPECTATOR", w*1800/h - tw - pw, 1650 - th - fh); + if(f) draw_text(colorname(f), w*1800/h - fw - pw, 1650 - fh); + } + + fpsent *d = hudplayer(); + if(d->state==CS_EDITING) return; + + if(d->state==CS_SPECTATOR) + { + if(m_capture || m_ctf) + { + glLoadIdentity(); + glOrtho(0, w*1800/h, 1800, 0, -1, 1); + if(m_capture) cpc.capturehud(d, w, h); + else if(m_ctf) ctf.drawhud(d, w, h); + } + return; + } + + glLoadIdentity(); + glOrtho(0, w*900/h, 900, 0, -1, 1); + + draw_textf("%d", 90, 822, d->state==CS_DEAD ? 0 : d->health); + if(d->state!=CS_DEAD) + { + if(d->armour) draw_textf("%d", 390, 822, d->armour); + draw_textf("%d", 690, 822, d->ammo[d->gunselect]); + } + + glLoadIdentity(); + glOrtho(0, w*1800/h, 1800, 0, -1, 1); + + glDisable(GL_BLEND); + + drawicon(192, 0, 20, 1650); + if(d->state!=CS_DEAD) + { + if(d->armour) drawicon((float)(d->armourtype*64), 0, 620, 1650); + int g = d->gunselect, r = 64; + if(g==GUN_PISTOL) { g = 4; r = 0; } + drawicon((float)(g*64), (float)r, 1220, 1650); + } + + glEnable(GL_BLEND); + + if(m_capture) cpc.capturehud(d, w, h); + else if(m_ctf) ctf.drawhud(d, w, h); + else if(m_assassin && d==player1) asc.drawhud(w, h); + } + + IVARP(teamcrosshair, 0, 1, 1); + IVARP(hitcrosshair, 0, 425, 1000); + + const char *defaultcrosshair(int index) + { + switch(index) + { + case 2: return "data/hit.png"; + case 1: return "data/teammate.png"; + default: return "data/crosshair.png"; + } + } + + int selectcrosshair(float &r, float &g, float &b) + { + fpsent *d = hudplayer(); + if(d->state==CS_SPECTATOR || d->state==CS_DEAD) return -1; + + if(d->state!=CS_ALIVE) return 0; + + int crosshair = 0; + if(lasthit && lastmillis - lasthit < hitcrosshair()) crosshair = 2; + else if(teamcrosshair()) + { + dynent *o = ws.intersectclosest(d->o, worldpos, d); + if(o && o->type==ENT_PLAYER && isteam(((fpsent *)o)->team, d->team)) + { + crosshair = 1; + r = g = 0; + } + } + + if(d->gunwait) { r *= 0.5f; g *= 0.5f; b *= 0.5f; } + else if(!crosshair && r && g && b && !editmode && !m_noitemsrail) + { + if(d->health<=25) { r = 1.0f; g = b = 0; } + else if(d->health<=50) { r = 1.0f; g = 0.5f; b = 0; } + } + return crosshair; + } + + void lighteffects(dynent *e, vec &color, vec &dir) + { +#if 0 + fpsent *d = (fpsent *)e; + if(d->state!=CS_DEAD && d->quadmillis) + { + float t = 0.5f + 0.5f*sinf(2*M_PI*lastmillis/1000.0f); + color.y = color.y*(1-t) + t; + } +#endif + } + + void particletrack(physent *owner, vec &o, vec &d) + { + if(owner->type!=ENT_PLAYER && owner->type!=ENT_AI) return; + float dist = o.dist(d); + vecfromyawpitch(owner->yaw, owner->pitch, 1, 0, d); + float newdist = raycube(owner->o, d, dist, RAY_CLIPMAT|RAY_ALPHAPOLY); + d.mul(min(newdist, dist)).add(owner->o); + o = ws.hudgunorigin(GUN_PISTOL, owner->o, d, (fpsent *)owner); + } + + void newmap(int size) + { + cc.addmsg(SV_NEWMAP, "ri", size); + } + + void edittrigger(const selinfo &sel, int op, int arg1, int arg2, int arg3) + { + if(gamemode==1) switch(op) + { + case EDIT_FLIP: + case EDIT_COPY: + case EDIT_PASTE: + case EDIT_DELCUBE: + { + cc.addmsg(SV_EDITF + op, "ri9i4", + sel.o.x, sel.o.y, sel.o.z, sel.s.x, sel.s.y, sel.s.z, sel.grid, sel.orient, + sel.cx, sel.cxs, sel.cy, sel.cys, sel.corner); + break; + } + case EDIT_MAT: + case EDIT_ROTATE: + { + cc.addmsg(SV_EDITF + op, "ri9i5", + sel.o.x, sel.o.y, sel.o.z, sel.s.x, sel.s.y, sel.s.z, sel.grid, sel.orient, + sel.cx, sel.cxs, sel.cy, sel.cys, sel.corner, + arg1); + break; + } + case EDIT_FACE: + case EDIT_TEX: + case EDIT_REPLACE: + { + cc.addmsg(SV_EDITF + op, "ri9i6", + sel.o.x, sel.o.y, sel.o.z, sel.s.x, sel.s.y, sel.s.z, sel.grid, sel.orient, + sel.cx, sel.cxs, sel.cy, sel.cys, sel.corner, + arg1, arg2); + break; + } + case EDIT_REMIP: + { + cc.addmsg(SV_EDITF + op, "r"); + break; + } + } + } + + bool serverinfostartcolumn(g3d_gui *g, int i) + { + static const char *names[] = { "ping ", "players ", "map ", "mode ", "master ", "host ", "description " }; + if(size_t(i) >= sizeof(names)/sizeof(names[0])) return false; + g->pushlist(); + g->text(names[i], 0xFFFF80, !i ? "server" : NULL); + g->mergehits(true); + return true; + } + + void serverinfoendcolumn(g3d_gui *g, int i) + { + g->mergehits(false); + g->poplist(); + } + + bool serverinfoentry(g3d_gui *g, int i, const char *name, const char *sdesc, const char *map, int ping, const vector &attr, int np) + { + if(ping < 0 || attr.empty() || attr[0]!=PROTOCOL_VERSION) + { + switch(i) + { + case 0: + if(g->button(" ", 0xFFFFDD, "server")&G3D_UP) return true; + break; + + case 1: + case 2: + case 3: + case 4: + if(g->button(" ", 0xFFFFDD)&G3D_UP) return true; + break; + + case 5: + if(g->buttonf("%s ", 0xFFFFDD, NULL, name)&G3D_UP) return true; + break; + + case 6: + if(ping < 0) + { + if(g->button(sdesc, 0xFFFFDD)&G3D_UP) return true; + } + else if(g->buttonf("[%s protocol] ", 0xFFFFDD, NULL, attr.empty() ? "unknown" : (attr[0] < PROTOCOL_VERSION ? "older" : "newer"))&G3D_UP) return true; + break; + } + return false; + } + + switch(i) + { + case 0: + if(g->buttonf("%d ", 0xFFFFDD, "server", ping)&G3D_UP) return true; + break; + + case 1: + if(attr.length()>=4) + { + if(g->buttonf("%d/%d ", 0xFFFFDD, NULL, np, attr[3])&G3D_UP) return true; + } + else if(g->buttonf("%d ", 0xFFFFDD, NULL, np)&G3D_UP) return true; + break; + + case 2: + if(g->buttonf("%.25s ", 0xFFFFDD, NULL, map)&G3D_UP) return true; + break; + + case 3: + if(g->buttonf("%s ", 0xFFFFDD, NULL, attr.length()>=2 ? fpsserver::modestr(attr[1], "") : "")&G3D_UP) return true; + break; + + case 4: + if(g->buttonf("%s ", 0xFFFFDD, NULL, attr.length()>=5 ? fpsserver::mastermodestr(attr[4], "") : "")&G3D_UP) return true; + break; + + case 5: + if(g->buttonf("%s ", 0xFFFFDD, NULL, name)&G3D_UP) return true; + break; + + case 6: + { + if(g->buttonf("%.25s", 0xFFFFDD, NULL, sdesc)&G3D_UP) return true; + break; + } + } + return false; + } + + void g3d_gamemenus() { sb.show(); } + + // any data written into this vector will get saved with the map data. Must take care to do own versioning, and endianess if applicable. Will not get called when loading maps from other games, so provide defaults. + void writegamedata(vector &extras) {} + void readgamedata(vector &extras) {} + + const char *gameident() { return "fps"; } + const char *defaultmap() { return "menu"; } + const char *savedconfig() { return "config.cfg"; } + const char *defaultconfig() { return "data/defaults.cfg"; } + const char *autoexec() { return "autoexec.cfg"; } + const char *savedservers() { return "servers.cfg"; } +}; + +REGISTERGAME(fpsgame, "fps", new fpsclient(), new fpsserver()); + +#else + +REGISTERGAME(fpsgame, "fps", NULL, new fpsserver()); + +#endif + + + diff --git a/src/fpsgame/fpsrender.h b/src/fpsgame/fpsrender.h new file mode 100644 index 0000000..28fa438 --- /dev/null +++ b/src/fpsgame/fpsrender.h @@ -0,0 +1,151 @@ +struct playermodelinfo +{ + const char *ffa, *blueteam, *redteam, + *vwep, *quad, *armour[3], + *ffaicon, *blueicon, *redicon; +}; + +struct fpsrender +{ + fpsclient &cl; + + fpsrender(fpsclient &_cl) : cl(_cl) {} + + vector bestplayers; + vector bestteams; + + IVARP(playermodel, 0, 0, 2); + + const playermodelinfo &getplayermodelinfo() + { + static const playermodelinfo playermodels[3] = + { + { "mrfixit", "mrfixit/blue", "mrfixit/red", NULL, "mrfixit/horns", { "mrfixit/armor/blue", "mrfixit/armor/green", "mrfixit/armor/yellow" }, "mrfixit", "mrfixit_blue", "mrfixit_red" }, + { "ironsnout", "ironsnout/blue", "ironsnout/red", NULL, "quadspheres", { "shield/blue", "shield/green", "shield/yellow" }, "ironsnout", "ironsnout_blue", "ironsnout_red" }, + { "monster/ogro", "monster/ogro/blue", "monster/ogro/red", "monster/ogro/vwep", NULL, { NULL, NULL, NULL }, "ogro", "ogro", "ogro" } + }; + return playermodels[playermodel()]; + } + + void preloadplayermodel() + { + const playermodelinfo &mdl = getplayermodelinfo(); + loadmodel(mdl.ffa, -1, true); + loadmodel(mdl.blueteam, -1, true); + loadmodel(mdl.redteam, -1, true); + loadmodel(mdl.vwep, -1, true); + loadmodel(mdl.quad, -1, true); + loopi(3) loadmodel(mdl.armour[i], -1, true); + } + + IVAR(testquad, 0, 0, 1); + IVAR(testarmour, 0, 0, 1); + + void renderplayer(fpsent *d, const playermodelinfo &mdl, int team) + { + int lastaction = d->lastaction, attack = d->gunselect==GUN_FIST ? ANIM_PUNCH : ANIM_SHOOT, delay = mdl.vwep ? 300 : cl.ws.reloadtime(d->gunselect)+50; + if(cl.intermission && d->state!=CS_DEAD) + { + lastaction = cl.lastmillis; + attack = ANIM_LOSE|ANIM_LOOP; + delay = 1000; + int gamemode = cl.gamemode; + if(m_teammode) loopv(bestteams) { if(!strcmp(bestteams[i], d->team)) { attack = ANIM_WIN|ANIM_LOOP; break; } } + else if(bestplayers.find(d)>=0) attack = ANIM_WIN|ANIM_LOOP; + } + else if(d->state==CS_ALIVE && d->lasttaunt && cl.lastmillis-d->lasttaunt<1000 && cl.lastmillis-d->lastaction>delay) + { + lastaction = d->lasttaunt; + attack = ANIM_TAUNT; + delay = 1000; + } + modelattach a[4] = { { NULL }, { NULL }, { NULL }, { NULL } }; + static const char *vweps[] = {"vwep/fist", "vwep/shotg", "vwep/chaing", "vwep/rocket", "vwep/rifle", "vwep/gl", "vwep/pistol"}; + int ai = 0; + if((!mdl.vwep || d->gunselect!=GUN_FIST) && d->gunselect<=GUN_PISTOL) + { + a[ai].name = mdl.vwep ? mdl.vwep : vweps[d->gunselect]; + a[ai].tag = "tag_weapon"; + a[ai].anim = ANIM_VWEP|ANIM_LOOP; + a[ai].basetime = 0; + ai++; + } + if(d->state==CS_ALIVE) + { + if((testquad() || d->quadmillis) && mdl.quad) + { + a[ai].name = mdl.quad; + a[ai].tag = "tag_powerup"; + a[ai].anim = ANIM_POWERUP|ANIM_LOOP; + a[ai].basetime = 0; + ai++; + } + if(testarmour() || d->armour) + { + int type = clamp(d->armourtype, (int)A_BLUE, (int)A_YELLOW); + if(mdl.armour[type]) + { + a[ai].name = mdl.armour[type]; + a[ai].tag = "tag_shield"; + a[ai].anim = ANIM_SHIELD|ANIM_LOOP; + a[ai].basetime = 0; + ai++; + } + } + } + const char *mdlname = mdl.ffa; + switch(team) + { + case 1: mdlname = mdl.blueteam; break; + case 2: mdlname = mdl.redteam; break; + } + renderclient(d, mdlname, a[0].name ? a : NULL, attack, delay, lastaction, cl.intermission ? 0 : d->lastpain); +#if 0 + if(d->state!=CS_DEAD && d->quadmillis) + { + vec color(1, 1, 1), dir(0, 0, 1); + rendermodel(color, dir, "quadrings", ANIM_MAPMODEL|ANIM_LOOP, vec(d->o).sub(vec(0, 0, d->eyeheight/2)), 360*cl.lastmillis/1000.0f, 0, MDL_DYNSHADOW | MDL_CULL_VFC | MDL_CULL_DIST); + } +#endif + } + + IVARP(teamskins, 0, 0, 1); + + void rendergame(int gamemode) + { + if(cl.intermission) + { + if(m_teammode) { bestteams.setsize(0); cl.sb.bestteams(bestteams); } + else { bestplayers.setsize(0); cl.sb.bestplayers(bestplayers); } + } + + startmodelbatches(); + + const playermodelinfo &mdl = getplayermodelinfo(); + + fpsent *exclude = NULL; + if(cl.player1->state==CS_SPECTATOR && cl.following>=0 && !isthirdperson()) + exclude = cl.getclient(cl.following); + + fpsent *d; + loopv(cl.players) if((d = cl.players[i]) && d->state!=CS_SPECTATOR && d->state!=CS_SPAWNING && d!=exclude) + { + int team = 0; + if(m_assassin) team = cl.asc.targets.find(d)>=0 ? 2 : (cl.asc.hunters.find(d)>=0 ? 0 : 1); + else if(teamskins() || m_teammode) team = isteam(cl.player1->team, d->team) ? 1 : 2; + if(d->state!=CS_DEAD || d->superdamage<50) renderplayer(d, mdl, team); + s_strcpy(d->info, cl.colorname(d, NULL, "@")); + if(d->maxhealth>100) { s_sprintfd(sn)(" +%d", d->maxhealth-100); s_strcat(d->info, sn); } + if(d->state!=CS_DEAD) particle_text(d->abovehead(), d->info, team ? (team==1 ? 16 : 13) : 11, 1); + } + if(isthirdperson() && !cl.followingplayer()) renderplayer(cl.player1, mdl, teamskins() || m_teamskins ? 1 : 0); + cl.ms.monsterrender(); + cl.mo.render(); + cl.et.renderentities(); + cl.ws.renderprojectiles(); + if(m_capture) cl.cpc.renderbases(); + else if(m_ctf) cl.ctf.renderflags(); + + endmodelbatches(); + } +}; diff --git a/src/fpsgame/fpsserver.h b/src/fpsgame/fpsserver.h new file mode 100644 index 0000000..5e7e6ac --- /dev/null +++ b/src/fpsgame/fpsserver.h @@ -0,0 +1,2099 @@ +#ifdef WIN32 +#include +#else +#include +#define _dup dup +#define _fileno fileno +#endif + +struct fpsserver : igameserver +{ + struct server_entity // server side version of "entity" type + { + int type; + int spawntime; + char spawned; + }; + + static const int DEATHMILLIS = 300; + + enum { GE_NONE = 0, GE_SHOT, GE_EXPLODE, GE_HIT, GE_SUICIDE, GE_PICKUP }; + + struct shotevent + { + int type; + int millis, id; + int gun; + float from[3], to[3]; + }; + + struct explodeevent + { + int type; + int millis, id; + int gun; + }; + + struct hitevent + { + int type; + int target; + int lifesequence; + union + { + int rays; + float dist; + }; + float dir[3]; + }; + + struct suicideevent + { + int type; + }; + + struct pickupevent + { + int type; + int ent; + }; + + union gameevent + { + int type; + shotevent shot; + explodeevent explode; + hitevent hit; + suicideevent suicide; + pickupevent pickup; + }; + + template + struct projectilestate + { + int projs[N]; + int numprojs; + + projectilestate() : numprojs(0) {} + + void reset() { numprojs = 0; } + + void add(int val) + { + if(numprojs>=N) numprojs = 0; + projs[numprojs++] = val; + } + + bool remove(int val) + { + loopi(numprojs) if(projs[i]==val) + { + projs[i] = projs[--numprojs]; + return true; + } + return false; + } + }; + + struct gamestate : fpsstate + { + vec o; + int state, editstate; + int lastdeath, lastspawn, lifesequence; + int lastshot; + projectilestate<8> rockets, grenades; + int frags, deaths, teamkills, shotdamage, damage; + int lasttimeplayed, timeplayed; + float effectiveness; + + gamestate() : state(CS_DEAD), editstate(CS_DEAD) {} + + bool isalive(int gamemillis) + { + return state==CS_ALIVE || (state==CS_DEAD && gamemillis - lastdeath <= DEATHMILLIS); + } + + bool waitexpired(int gamemillis) + { + return gamemillis - lastshot >= gunwait; + } + + void reset() + { + if(state!=CS_SPECTATOR) state = editstate = CS_DEAD; + lifesequence = 0; + maxhealth = 100; + rockets.reset(); + grenades.reset(); + + timeplayed = 0; + effectiveness = 0; + frags = deaths = teamkills = shotdamage = damage = 0; + + respawn(); + } + + void respawn() + { + fpsstate::respawn(); + o = vec(-1e10f, -1e10f, -1e10f); + lastdeath = 0; + lastspawn = -1; + lastshot = 0; + } + }; + + struct savedscore + { + uint ip; + string name; + int maxhealth, frags, deaths, teamkills, shotdamage, damage; + int timeplayed; + float effectiveness; + + void save(gamestate &gs) + { + maxhealth = gs.maxhealth; + frags = gs.frags; + deaths = gs.deaths; + teamkills = gs.teamkills; + shotdamage = gs.shotdamage; + damage = gs.damage; + timeplayed = gs.timeplayed; + effectiveness = gs.effectiveness; + } + + void restore(gamestate &gs) + { + if(gs.health==gs.maxhealth) gs.health = maxhealth; + gs.maxhealth = maxhealth; + gs.frags = frags; + gs.deaths = deaths; + gs.teamkills = teamkills; + gs.shotdamage = shotdamage; + gs.damage = damage; + gs.timeplayed = timeplayed; + gs.effectiveness = effectiveness; + } + }; + + struct clientinfo + { + int clientnum; + string name, team, mapvote; + int modevote; + int privilege; + bool spectator, local, timesync, wantsmaster; + int gameoffset, lastevent; + gamestate state; + vector events; + vector position, messages; + vector targets; + + clientinfo() { reset(); } + + gameevent &addevent() + { + static gameevent dummy; + if(state.state==CS_SPECTATOR || events.length()>100) return dummy; + return events.add(); + } + + void mapchange() + { + mapvote[0] = 0; + state.reset(); + events.setsizenodelete(0); + targets.setsizenodelete(0); + timesync = false; + lastevent = 0; + } + + void reset() + { + name[0] = team[0] = 0; + privilege = PRIV_NONE; + spectator = local = wantsmaster = false; + position.setsizenodelete(0); + messages.setsizenodelete(0); + mapchange(); + } + }; + + struct worldstate + { + int uses; + vector positions, messages; + }; + + struct ban + { + int time; + uint ip; + }; + + #define MM_MODE 0xF + #define MM_AUTOAPPROVE 0x1000 + #define MM_DEFAULT (MM_MODE | MM_AUTOAPPROVE) + + enum { MM_OPEN = 0, MM_VETO, MM_LOCKED, MM_PRIVATE }; + + bool notgotitems, notgotbases; // true when map has changed and waiting for clients to send item + int gamemode; + int gamemillis, gamelimit; + + string serverdesc; + string smapname; + int lastmillis, totalmillis, curtime; + int interm, minremain; + bool mapreload; + enet_uint32 lastsend; + int mastermode, mastermask; + int currentmaster; + bool masterupdate; + string masterpass; + FILE *mapdata; + + vector allowedips; + vector bannedips; + vector clients; + vector worldstates; + bool reliablemessages; + + struct demofile + { + string info; + uchar *data; + int len; + }; + + #define MAXDEMOS 5 + vector demos; + + bool demonextmatch; + FILE *demotmp; + gzFile demorecord, demoplayback; + int nextplayback; + + struct servmode + { + fpsserver &sv; + + servmode(fpsserver &sv) : sv(sv) {} + virtual ~servmode() {} + + virtual void entergame(clientinfo *ci) {} + virtual void leavegame(clientinfo *ci, bool disconnecting = false) {} + + virtual void moved(clientinfo *ci, const vec &oldpos, const vec &newpos) {} + virtual bool canspawn(clientinfo *ci, bool connecting = false) { return true; } + virtual void spawned(clientinfo *ci) {} + virtual int fragvalue(clientinfo *victim, clientinfo *actor) + { + int gamemode = sv.gamemode; + if(victim==actor || isteam(victim->team, actor->team)) return -1; + return 1; + } + virtual void died(clientinfo *victim, clientinfo *actor) {} + virtual bool canchangeteam(clientinfo *ci, const char *oldteam, const char *newteam) { return true; } + virtual void changeteam(clientinfo *ci, const char *oldteam, const char *newteam) {} + virtual void initclient(clientinfo *ci, ucharbuf &p, bool connecting) {} + virtual void update() {} + virtual void reset(bool empty) {} + virtual void intermission() {} + }; + + struct arenaservmode : servmode + { + int arenaround; + + arenaservmode(fpsserver &sv) : servmode(sv), arenaround(0) {} + + bool canspawn(clientinfo *ci, bool connecting = false) + { + if(connecting && sv.nonspectators(ci->clientnum)<=1) return true; + return false; + } + + void reset(bool empty) + { + arenaround = 0; + } + + void update() + { + if(sv.interm || sv.gamemillisstate.state==CS_DEAD || sv.clients[i]->state.state==CS_ALIVE) + { + sv.clients[i]->state.respawn(); + sv.sendspawn(sv.clients[i]); + } + return; + } + + int gamemode = sv.gamemode; + clientinfo *alive = NULL; + bool dead = false; + loopv(sv.clients) + { + clientinfo *ci = sv.clients[i]; + if(ci->state.state==CS_ALIVE || (ci->state.state==CS_DEAD && ci->state.lastspawn>=0)) + { + if(!alive) alive = ci; + else if(!m_teammode || strcmp(alive->team, ci->team)) return; + } + else if(ci->state.state==CS_DEAD) dead = true; + } + if(!dead) return; + sendf(-1, 1, "ri2", SV_ARENAWIN, !alive ? -1 : alive->clientnum); + arenaround = sv.gamemillis+5000; + } + }; + + #define CAPTURESERV 1 + #include "capture.h" + #undef CAPTURESERV + + #define ASSASSINSERV 1 + #include "assassin.h" + #undef ASSASSINSERV + + #define CTFSERV 1 + #include "ctf.h" + #undef CTFSERV + + arenaservmode arenamode; + captureservmode capturemode; + assassinservmode assassinmode; + ctfservmode ctfmode; + servmode *smode; + + fpsserver() : notgotitems(true), notgotbases(false), gamemode(0), interm(0), minremain(0), mapreload(false), lastsend(0), mastermode(MM_OPEN), mastermask(MM_DEFAULT), currentmaster(-1), masterupdate(false), mapdata(NULL), reliablemessages(false), demonextmatch(false), demotmp(NULL), demorecord(NULL), demoplayback(NULL), nextplayback(0), arenamode(*this), capturemode(*this), assassinmode(*this), ctfmode(*this), smode(NULL) + { + serverdesc[0] = '\0'; + masterpass[0] = '\0'; + } + + void *newinfo() { return new clientinfo; } + void deleteinfo(void *ci) { delete (clientinfo *)ci; } + + vector sents; + vector scores; + + static const char *modestr(int n, const char *unknown = "unknown") + { + static const char *modenames[] = + { + "slowmo SP", "slowmo DMSP", "demo", "SP", "DMSP", "ffa/default", "coopedit", "ffa/duel", "teamplay", + "instagib", "instagib team", "efficiency", "efficiency team", + "insta arena", "insta clan arena", "tactics arena", "tactics clan arena", + "capture", "insta capture", "regen capture", "assassin", "insta assassin", + "ctf", "insta ctf" + }; + return (n>=-5 && size_t(n+5)=0 && size_t(n)4 ? 2 : 3); // spawn times are dependent on number of players + int sec = 0; + switch(type) + { + case I_SHELLS: + case I_BULLETS: + case I_ROCKETS: + case I_ROUNDS: + case I_GRENADES: + case I_CARTRIDGES: sec = np*4; break; + case I_HEALTH: sec = np*5; break; + case I_GREENARMOUR: + case I_YELLOWARMOUR: sec = 20; break; + case I_BOOST: + case I_QUAD: sec = 40+rnd(40); break; + } + return sec*1000; + } + + bool pickup(int i, int sender) // server side item pickup, acknowledge first client that gets it + { + if(minremain<=0 || !sents.inrange(i) || !sents[i].spawned) return false; + clientinfo *ci = (clientinfo *)getinfo(sender); + if(!ci || (!ci->local && !ci->state.canpickup(sents[i].type))) return false; + sents[i].spawned = false; + sents[i].spawntime = spawntime(sents[i].type); + sendf(-1, 1, "ri3", SV_ITEMACC, i, sender); + ci->state.pickup(sents[i].type); + return true; + } + + void vote(char *map, int reqmode, int sender) + { + clientinfo *ci = (clientinfo *)getinfo(sender); + if(!ci || (ci->state.state==CS_SPECTATOR && !ci->privilege)) return; + s_strcpy(ci->mapvote, map); + ci->modevote = reqmode; + if(!ci->mapvote[0]) return; + if(ci->local || mapreload || (ci->privilege && mastermode>=MM_VETO)) + { + if(demorecord) enddemorecord(); + if(!ci->local && !mapreload) + { + s_sprintfd(msg)("%s forced %s on map %s", privname(ci->privilege), modestr(reqmode), map); + sendservmsg(msg); + } + sendf(-1, 1, "risii", SV_MAPCHANGE, ci->mapvote, ci->modevote, 1); + changemap(ci->mapvote, ci->modevote); + } + else + { + s_sprintfd(msg)("%s suggests %s on map %s (select map to vote)", colorname(ci), modestr(reqmode), map); + sendservmsg(msg); + checkvotes(); + } + } + + clientinfo *choosebestclient(float &bestrank) + { + clientinfo *best = NULL; + bestrank = -1; + loopv(clients) + { + clientinfo *ci = clients[i]; + if(ci->state.timeplayed<0) continue; + float rank = ci->state.state!=CS_SPECTATOR ? ci->state.effectiveness/max(ci->state.timeplayed, 1) : -1; + if(!best || rank > bestrank) { best = ci; bestrank = rank; } + } + return best; + } + + void autoteam() + { + static const char *teamnames[2] = {"good", "evil"}; + vector team[2]; + float teamrank[2] = {0, 0}; + for(int round = 0, remaining = clients.length(); remaining>=0; round++) + { + int first = round&1, second = (round+1)&1, selected = 0; + while(teamrank[first] <= teamrank[second]) + { + float rank; + clientinfo *ci = choosebestclient(rank); + if(!ci) break; + if(m_capture || m_ctf) rank = 1; + else if(selected && rank<=0) break; + ci->state.timeplayed = -1; + team[first].add(ci); + if(rank>0) teamrank[first] += rank; + selected++; + if(rank<=0) break; + } + if(!selected) break; + remaining -= selected; + } + loopi(sizeof(team)/sizeof(team[0])) + { + loopvj(team[i]) + { + clientinfo *ci = team[i][j]; + if(!strcmp(ci->team, teamnames[i])) continue; + s_strncpy(ci->team, teamnames[i], MAXTEAMLEN+1); + sendf(-1, 1, "riis", SV_SETTEAM, ci->clientnum, teamnames[i]); + } + } + } + + struct teamrank + { + const char *name; + float rank; + int clients; + + teamrank(const char *name) : name(name), rank(0), clients(0) {} + }; + + const char *chooseworstteam(const char *suggest = NULL, clientinfo *exclude = NULL) + { + teamrank teamranks[2] = { teamrank("good"), teamrank("evil") }; + const int numteams = sizeof(teamranks)/sizeof(teamranks[0]); + loopv(clients) + { + clientinfo *ci = clients[i]; + if(ci==exclude || ci->state.state==CS_SPECTATOR || !ci->team[0]) continue; + ci->state.timeplayed += lastmillis - ci->state.lasttimeplayed; + ci->state.lasttimeplayed = lastmillis; + + loopj(numteams) if(!strcmp(ci->team, teamranks[j].name)) + { + teamrank &ts = teamranks[j]; + ts.rank += ci->state.effectiveness/max(ci->state.timeplayed, 1); + ts.clients++; + break; + } + } + teamrank *worst = &teamranks[numteams-1]; + loopi(numteams-1) + { + teamrank &ts = teamranks[i]; + if(m_capture || m_ctf) + { + if(ts.clients < worst->clients || (ts.clients == worst->clients && ts.rank < worst->rank)) worst = &ts; + } + else if(ts.rank < worst->rank || (ts.rank == worst->rank && ts.clients < worst->clients)) worst = &ts; + } + return worst->name; + } + + void writedemo(int chan, void *data, int len) + { + if(!demorecord) return; + int stamp[3] = { gamemillis, chan, len }; + endianswap(stamp, sizeof(int), 3); + gzwrite(demorecord, stamp, sizeof(stamp)); + gzwrite(demorecord, data, len); + } + + void recordpacket(int chan, void *data, int len) + { + writedemo(chan, data, len); + } + + void enddemorecord() + { + if(!demorecord) return; + + gzclose(demorecord); + demorecord = NULL; + +#ifdef WIN32 + demotmp = fopen("demorecord", "rb"); +#endif + if(!demotmp) return; + + fseek(demotmp, 0, SEEK_END); + int len = ftell(demotmp); + rewind(demotmp); + if(demos.length()>=MAXDEMOS) + { + delete[] demos[0].data; + demos.remove(0); + } + demofile &d = demos.add(); + time_t t = time(NULL); + char *timestr = ctime(&t), *trim = timestr + strlen(timestr); + while(trim>timestr && isspace(*--trim)) *trim = '\0'; + s_sprintf(d.info)("%s: %s, %s, %.2f%s", timestr, modestr(gamemode), smapname, len > 1024*1024 ? len/(1024*1024.f) : len/1024.0f, len > 1024*1024 ? "MB" : "kB"); + s_sprintfd(msg)("demo \"%s\" recorded", d.info); + sendservmsg(msg); + d.data = new uchar[len]; + d.len = len; + fread(d.data, 1, len, demotmp); + fclose(demotmp); + demotmp = NULL; + } + + void setupdemorecord() + { + if(haslocalclients() || !m_mp(gamemode) || gamemode==1) return; + +#ifdef WIN32 + gzFile f = gzopen("demorecord", "wb9"); + if(!f) return; +#else + demotmp = tmpfile(); + if(!demotmp) return; + setvbuf(demotmp, NULL, _IONBF, 0); + + gzFile f = gzdopen(_dup(_fileno(demotmp)), "wb9"); + if(!f) + { + fclose(demotmp); + demotmp = NULL; + return; + } +#endif + + sendservmsg("recording demo"); + + demorecord = f; + + demoheader hdr; + memcpy(hdr.magic, DEMO_MAGIC, sizeof(hdr.magic)); + hdr.version = DEMO_VERSION; + hdr.protocol = PROTOCOL_VERSION; + endianswap(&hdr.version, sizeof(int), 1); + endianswap(&hdr.protocol, sizeof(int), 1); + gzwrite(demorecord, &hdr, sizeof(demoheader)); + + ENetPacket *packet = enet_packet_create(NULL, MAXTRANS, 0); + ucharbuf p(packet->data, packet->dataLength); + welcomepacket(p, -1, packet); + writedemo(1, p.buf, p.len); + enet_packet_destroy(packet); + + uchar buf[MAXTRANS]; + loopv(clients) + { + clientinfo *ci = clients[i]; + uchar header[16]; + ucharbuf q(&buf[sizeof(header)], sizeof(buf)-sizeof(header)); + putint(q, SV_INITC2S); + sendstring(ci->name, q); + sendstring(ci->team, q); + + ucharbuf h(header, sizeof(header)); + putint(h, SV_CLIENT); + putint(h, ci->clientnum); + putuint(h, q.len); + + memcpy(&buf[sizeof(header)-h.len], header, h.len); + + writedemo(1, &buf[sizeof(header)-h.len], h.len+q.len); + } + } + + void listdemos(int cn) + { + ENetPacket *packet = enet_packet_create(NULL, MAXTRANS, ENET_PACKET_FLAG_RELIABLE); + if(!packet) return; + ucharbuf p(packet->data, packet->dataLength); + putint(p, SV_SENDDEMOLIST); + putint(p, demos.length()); + loopv(demos) sendstring(demos[i].info, p); + enet_packet_resize(packet, p.length()); + sendpacket(cn, 1, packet); + if(!packet->referenceCount) enet_packet_destroy(packet); + } + + void cleardemos(int n) + { + if(!n) + { + loopv(demos) delete[] demos[i].data; + demos.setsize(0); + sendservmsg("cleared all demos"); + } + else if(demos.inrange(n-1)) + { + delete[] demos[n-1].data; + demos.remove(n-1); + s_sprintfd(msg)("cleared demo %d", n); + sendservmsg(msg); + } + } + + void senddemo(int cn, int num) + { + if(!num) num = demos.length(); + if(!demos.inrange(num-1)) return; + demofile &d = demos[num-1]; + sendf(cn, 2, "rim", SV_SENDDEMO, d.len, d.data); + } + + void setupdemoplayback() + { + demoheader hdr; + string msg; + msg[0] = '\0'; + s_sprintfd(file)("%s.dmo", smapname); + demoplayback = opengzfile(file, "rb9"); + if(!demoplayback) s_sprintf(msg)("could not read demo \"%s\"", file); + else if(gzread(demoplayback, &hdr, sizeof(demoheader))!=sizeof(demoheader) || memcmp(hdr.magic, DEMO_MAGIC, sizeof(hdr.magic))) + s_sprintf(msg)("\"%s\" is not a demo file", file); + else + { + endianswap(&hdr.version, sizeof(int), 1); + endianswap(&hdr.protocol, sizeof(int), 1); + if(hdr.version!=DEMO_VERSION) s_sprintf(msg)("demo \"%s\" requires an %s version of Sauerbraten", file, hdr.versiondata, packet->dataLength); + welcomepacket(p, clients[i]->clientnum, packet); + enet_packet_resize(packet, p.length()); + sendpacket(clients[i]->clientnum, 1, packet); + if(!packet->referenceCount) enet_packet_destroy(packet); + } + } + + void readdemo() + { + if(!demoplayback) return; + while(gamemillis>=nextplayback) + { + int chan, len; + if(gzread(demoplayback, &chan, sizeof(chan))!=sizeof(chan) || + gzread(demoplayback, &len, sizeof(len))!=sizeof(len)) + { + enddemoplayback(); + return; + } + endianswap(&chan, sizeof(chan), 1); + endianswap(&len, sizeof(len), 1); + ENetPacket *packet = enet_packet_create(NULL, len, 0); + if(!packet || gzread(demoplayback, packet->data, len)!=len) + { + if(packet) enet_packet_destroy(packet); + enddemoplayback(); + return; + } + sendpacket(-1, chan, packet); + if(!packet->referenceCount) enet_packet_destroy(packet); + if(gzread(demoplayback, &nextplayback, sizeof(nextplayback))!=sizeof(nextplayback)) + { + enddemoplayback(); + return; + } + endianswap(&nextplayback, sizeof(nextplayback), 1); + } + } + + void changemap(const char *s, int mode) + { + if(m_demo) enddemoplayback(); + else enddemorecord(); + + mapreload = false; + gamemode = mode; + gamemillis = 0; + minremain = m_teammode && !m_ctf ? 15 : 10; + gamelimit = minremain*60000; + interm = 0; + s_strcpy(smapname, s); + resetitems(); + notgotitems = true; + scores.setsize(0); + loopv(clients) + { + clientinfo *ci = clients[i]; + ci->state.timeplayed += lastmillis - ci->state.lasttimeplayed; + } + if(m_teammode) autoteam(); + + if(m_arena) smode = &arenamode; + else if(m_capture) smode = &capturemode; + else if(m_assassin) smode = &assassinmode; + else if(m_ctf) smode = &ctfmode; + else smode = NULL; + if(smode) smode->reset(false); + + if(gamemode>1 || (gamemode==0 && hasnonlocalclients())) sendf(-1, 1, "ri2", SV_TIMEUP, minremain); + loopv(clients) + { + clientinfo *ci = clients[i]; + ci->mapchange(); + ci->state.lasttimeplayed = lastmillis; + if(m_mp(gamemode) && ci->state.state!=CS_SPECTATOR) sendspawn(ci); + } + + if(m_demo) setupdemoplayback(); + else if(demonextmatch) + { + demonextmatch = false; + setupdemorecord(); + } + } + + savedscore &findscore(clientinfo *ci, bool insert) + { + uint ip = getclientip(ci->clientnum); + if(!ip) return *(savedscore *)0; + if(!insert) + { + loopv(clients) + { + clientinfo *oi = clients[i]; + if(oi->clientnum != ci->clientnum && getclientip(oi->clientnum) == ip && !strcmp(oi->name, ci->name)) + { + oi->state.timeplayed += lastmillis - oi->state.lasttimeplayed; + oi->state.lasttimeplayed = lastmillis; + static savedscore curscore; + curscore.save(oi->state); + return curscore; + } + } + } + loopv(scores) + { + savedscore &sc = scores[i]; + if(sc.ip == ip && !strcmp(sc.name, ci->name)) return sc; + } + if(!insert) return *(savedscore *)0; + savedscore &sc = scores.add(); + sc.ip = ip; + s_strcpy(sc.name, ci->name); + return sc; + } + + void savescore(clientinfo *ci) + { + savedscore &sc = findscore(ci, true); + if(&sc) sc.save(ci->state); + } + + struct votecount + { + char *map; + int mode, count; + votecount() {} + votecount(char *s, int n) : map(s), mode(n), count(0) {} + }; + + void checkvotes(bool force = false) + { + vector votes; + int maxvotes = 0; + loopv(clients) + { + clientinfo *oi = clients[i]; + if(oi->state.state==CS_SPECTATOR && !oi->privilege) continue; + maxvotes++; + if(!oi->mapvote[0]) continue; + votecount *vc = NULL; + loopvj(votes) if(!strcmp(oi->mapvote, votes[j].map) && oi->modevote==votes[j].mode) + { + vc = &votes[j]; + break; + } + if(!vc) vc = &votes.add(votecount(oi->mapvote, oi->modevote)); + vc->count++; + } + votecount *best = NULL; + loopv(votes) if(!best || votes[i].count > best->count || (votes[i].count == best->count && rnd(2))) best = &votes[i]; + if(force || (best && best->count > maxvotes/2)) + { + if(demorecord) enddemorecord(); + if(best && (best->count > (force ? 1 : maxvotes/2))) + { + sendservmsg(force ? "vote passed by default" : "vote passed by majority"); + sendf(-1, 1, "risii", SV_MAPCHANGE, best->map, best->mode, 1); + changemap(best->map, best->mode); + } + else + { + mapreload = true; + if(clients.length()) sendf(-1, 1, "ri", SV_MAPRELOAD); + } + } + } + + int nonspectators(int exclude = -1) + { + int n = 0; + loopv(clients) if(i!=exclude && clients[i]->state.state!=CS_SPECTATOR) n++; + return n; + } + + int checktype(int type, clientinfo *ci) + { + if(ci && ci->local) return type; +#if 0 + // other message types can get sent by accident if a master forces spectator on someone, so disabling this case for now and checking for spectator state in message handlers + // spectators can only connect and talk + static int spectypes[] = { SV_INITC2S, SV_POS, SV_TEXT, SV_PING, SV_CLIENTPING, SV_GETMAP, SV_SETMASTER }; + if(ci && ci->state.state==CS_SPECTATOR && !ci->privilege) + { + loopi(sizeof(spectypes)/sizeof(int)) if(type == spectypes[i]) return type; + return -1; + } +#endif + // only allow edit messages in coop-edit mode + if(type>=SV_EDITENT && type<=SV_GETMAP && gamemode!=1) return -1; + // server only messages + static int servtypes[] = { SV_INITS2C, SV_MAPRELOAD, SV_SERVMSG, SV_DAMAGE, SV_HITPUSH, SV_SHOTFX, SV_DIED, SV_SPAWNSTATE, SV_FORCEDEATH, SV_ARENAWIN, SV_ITEMACC, SV_ITEMSPAWN, SV_TIMEUP, SV_CDIS, SV_CURRENTMASTER, SV_PONG, SV_RESUME, SV_TEAMSCORE, SV_BASEINFO, SV_BASEREGEN, SV_ANNOUNCE, SV_CLEARTARGETS, SV_CLEARHUNTERS, SV_ADDTARGET, SV_REMOVETARGET, SV_ADDHUNTER, SV_REMOVEHUNTER, SV_SENDDEMOLIST, SV_SENDDEMO, SV_DEMOPLAYBACK, SV_SENDMAP, SV_DROPFLAG, SV_SCOREFLAG, SV_RETURNFLAG, SV_CLIENT }; + if(ci) loopi(sizeof(servtypes)/sizeof(int)) if(type == servtypes[i]) return -1; + return type; + } + + static void freecallback(ENetPacket *packet) + { + extern igameserver *sv; + ((fpsserver *)sv)->cleanworldstate(packet); + } + + void cleanworldstate(ENetPacket *packet) + { + loopv(worldstates) + { + worldstate *ws = worldstates[i]; + if(packet->data >= ws->positions.getbuf() && packet->data <= &ws->positions.last()) ws->uses--; + else if(packet->data >= ws->messages.getbuf() && packet->data <= &ws->messages.last()) ws->uses--; + else continue; + if(!ws->uses) + { + delete ws; + worldstates.remove(i); + } + break; + } + } + + bool buildworldstate() + { + static struct { int posoff, msgoff, msglen; } pkt[MAXCLIENTS]; + worldstate &ws = *new worldstate; + loopv(clients) + { + clientinfo &ci = *clients[i]; + if(ci.position.empty()) pkt[i].posoff = -1; + else + { + pkt[i].posoff = ws.positions.length(); + loopvj(ci.position) ws.positions.add(ci.position[j]); + } + if(ci.messages.empty()) pkt[i].msgoff = -1; + else + { + pkt[i].msgoff = ws.messages.length(); + ucharbuf p = ws.messages.reserve(16); + putint(p, SV_CLIENT); + putint(p, ci.clientnum); + putuint(p, ci.messages.length()); + ws.messages.addbuf(p); + loopvj(ci.messages) ws.messages.add(ci.messages[j]); + pkt[i].msglen = ws.messages.length() - pkt[i].msgoff; + } + } + int psize = ws.positions.length(), msize = ws.messages.length(); + if(psize) recordpacket(0, ws.positions.getbuf(), psize); + if(msize) recordpacket(1, ws.messages.getbuf(), msize); + loopi(psize) { uchar c = ws.positions[i]; ws.positions.add(c); } + loopi(msize) { uchar c = ws.messages[i]; ws.messages.add(c); } + ws.uses = 0; + loopv(clients) + { + clientinfo &ci = *clients[i]; + ENetPacket *packet; + if(psize && (pkt[i].posoff<0 || psize-ci.position.length()>0)) + { + packet = enet_packet_create(&ws.positions[pkt[i].posoff<0 ? 0 : pkt[i].posoff+ci.position.length()], + pkt[i].posoff<0 ? psize : psize-ci.position.length(), + ENET_PACKET_FLAG_NO_ALLOCATE); + sendpacket(ci.clientnum, 0, packet); + if(!packet->referenceCount) enet_packet_destroy(packet); + else { ++ws.uses; packet->freeCallback = freecallback; } + } + ci.position.setsizenodelete(0); + + if(msize && (pkt[i].msgoff<0 || msize-pkt[i].msglen>0)) + { + packet = enet_packet_create(&ws.messages[pkt[i].msgoff<0 ? 0 : pkt[i].msgoff+pkt[i].msglen], + pkt[i].msgoff<0 ? msize : msize-pkt[i].msglen, + (reliablemessages ? ENET_PACKET_FLAG_RELIABLE : 0) | ENET_PACKET_FLAG_NO_ALLOCATE); + sendpacket(ci.clientnum, 1, packet); + if(!packet->referenceCount) enet_packet_destroy(packet); + else { ++ws.uses; packet->freeCallback = freecallback; } + } + ci.messages.setsizenodelete(0); + } + reliablemessages = false; + if(!ws.uses) + { + delete &ws; + return false; + } + else + { + worldstates.add(&ws); + return true; + } + } + + bool sendpackets() + { + if(clients.empty()) return false; + enet_uint32 curtime = enet_time_get()-lastsend; + if(curtime<33) return false; + bool flush = buildworldstate(); + lastsend += curtime - (curtime%33); + return flush; + } + + void parsepacket(int sender, int chan, bool reliable, ucharbuf &p) // has to parse exactly each byte of the packet + { + if(sender<0) return; + if(chan==2) + { + receivefile(sender, p.buf, p.maxlen); + return; + } + if(reliable) reliablemessages = true; + char text[MAXTRANS]; + int cn = -1, type; + clientinfo *ci = sender>=0 ? (clientinfo *)getinfo(sender) : NULL; + #define QUEUE_MSG { if(!ci->local) while(curmsgmessages.add(p.buf[curmsg++]); } + #define QUEUE_BUF(size, body) { \ + if(!ci->local) \ + { \ + curmsg = p.length(); \ + ucharbuf buf = ci->messages.reserve(size); \ + { body; } \ + ci->messages.addbuf(buf); \ + } \ + } + #define QUEUE_INT(n) QUEUE_BUF(5, putint(buf, n)) + #define QUEUE_UINT(n) QUEUE_BUF(4, putuint(buf, n)) + #define QUEUE_STR(text) QUEUE_BUF(2*strlen(text)+1, sendstring(text, buf)) + int curmsg; + while((curmsg = p.length()) < p.maxlen) switch(type = checktype(getint(p), ci)) + { + case SV_POS: + { + cn = getint(p); + if(cn<0 || cn>=getnumclients() || cn!=sender) + { + disconnect_client(sender, DISC_CN); + return; + } + vec oldpos(ci->state.o); + loopi(3) ci->state.o[i] = getuint(p)/DMF; + getuint(p); + loopi(5) getint(p); + int physstate = getuint(p); + if(physstate&0x20) loopi(2) getint(p); + if(physstate&0x10) getint(p); + getuint(p); + if(!ci->local && (ci->state.state==CS_ALIVE || ci->state.state==CS_EDITING)) + { + ci->position.setsizenodelete(0); + while(curmsgposition.add(p.buf[curmsg++]); + } + if(smode && ci->state.state==CS_ALIVE) smode->moved(ci, oldpos, ci->state.o); + break; + } + + case SV_EDITMODE: + { + int val = getint(p); + if(!ci->local && gamemode!=1) break; + if(val ? ci->state.state!=CS_ALIVE && ci->state.state!=CS_DEAD : ci->state.state!=CS_EDITING) break; + if(smode) + { + if(val) smode->leavegame(ci); + else smode->entergame(ci); + } + if(val) + { + ci->state.editstate = ci->state.state; + ci->state.state = CS_EDITING; + } + else ci->state.state = ci->state.editstate; + if(val) + { + ci->events.setsizenodelete(0); + ci->state.rockets.reset(); + ci->state.grenades.reset(); + } + QUEUE_MSG; + break; + } + + case SV_TRYSPAWN: + if(ci->state.state!=CS_DEAD || ci->state.lastspawn>=0 || (smode && !smode->canspawn(ci))) break; + if(ci->state.lastdeath) ci->state.respawn(); + sendspawn(ci); + break; + + case SV_GUNSELECT: + { + int gunselect = getint(p); + if(ci->state.state!=CS_ALIVE) break; + ci->state.gunselect = gunselect; + QUEUE_MSG; + break; + } + + case SV_SPAWN: + { + int ls = getint(p), gunselect = getint(p); + if((ci->state.state!=CS_ALIVE && ci->state.state!=CS_DEAD) || ls!=ci->state.lifesequence || ci->state.lastspawn<0) break; + ci->state.lastspawn = -1; + ci->state.state = CS_ALIVE; + ci->state.gunselect = gunselect; + if(smode) smode->spawned(ci); + QUEUE_BUF(100, + { + putint(buf, SV_SPAWN); + sendstate(ci->state, buf); + }); + break; + } + + case SV_SUICIDE: + { + gameevent &suicide = ci->addevent(); + suicide.type = GE_SUICIDE; + break; + } + + case SV_SHOOT: + { + gameevent &shot = ci->addevent(); + shot.type = GE_SHOT; + #define seteventmillis(event) \ + { \ + event.id = getint(p); \ + if(!ci->timesync || (ci->events.length()==1 && ci->state.waitexpired(gamemillis))) \ + { \ + ci->timesync = true; \ + ci->gameoffset = gamemillis - event.id; \ + event.millis = gamemillis; \ + } \ + else event.millis = ci->gameoffset + event.id; \ + } + seteventmillis(shot.shot); + shot.shot.gun = getint(p); + loopk(3) shot.shot.from[k] = getint(p)/DMF; + loopk(3) shot.shot.to[k] = getint(p)/DMF; + int hits = getint(p); + loopk(hits) + { + gameevent &hit = ci->addevent(); + hit.type = GE_HIT; + hit.hit.target = getint(p); + hit.hit.lifesequence = getint(p); + hit.hit.rays = getint(p); + loopk(3) hit.hit.dir[k] = getint(p)/DNF; + } + break; + } + + case SV_EXPLODE: + { + gameevent &exp = ci->addevent(); + exp.type = GE_EXPLODE; + seteventmillis(exp.explode); + exp.explode.gun = getint(p); + exp.explode.id = getint(p); + int hits = getint(p); + loopk(hits) + { + gameevent &hit = ci->addevent(); + hit.type = GE_HIT; + hit.hit.target = getint(p); + hit.hit.lifesequence = getint(p); + hit.hit.dist = getint(p)/DMF; + loopk(3) hit.hit.dir[k] = getint(p)/DNF; + } + break; + } + + case SV_ITEMPICKUP: + { + int n = getint(p); + gameevent &pickup = ci->addevent(); + pickup.type = GE_PICKUP; + pickup.pickup.ent = n; + break; + } + + case SV_TEXT: + QUEUE_MSG; + getstring(text, p); + filtertext(text, text); + QUEUE_STR(text); + break; + + case SV_SAYTEAM: + { + getstring(text, p); + if(ci->state.state==CS_SPECTATOR || !m_teammode || !ci->team[0]) break; + loopv(clients) + { + clientinfo *t = clients[i]; + if(t==ci || t->state.state==CS_SPECTATOR || strcmp(ci->team, t->team)) continue; + sendf(t->clientnum, 1, "riis", SV_SAYTEAM, ci->clientnum, text); + } + break; + } + + case SV_INITC2S: + { + QUEUE_MSG; + bool connected = !ci->name[0]; + getstring(text, p); + filtertext(text, text, false, MAXNAMELEN); + if(!text[0]) s_strcpy(text, "unnamed"); + QUEUE_STR(text); + s_strncpy(ci->name, text, MAXNAMELEN+1); + if(!ci->local && connected) + { + savedscore &sc = findscore(ci, false); + if(&sc) + { + sc.restore(ci->state); + gamestate &gs = ci->state; + sendf(-1, 1, "ri2i9vi", SV_RESUME, sender, + gs.state, gs.frags, gs.quadmillis, + gs.lifesequence, + gs.health, gs.maxhealth, + gs.armour, gs.armourtype, + gs.gunselect, GUN_PISTOL-GUN_SG+1, &gs.ammo[GUN_SG], -1); + } + } + getstring(text, p); + filtertext(text, text, false, MAXTEAMLEN); + if(!ci->local && (smode && !smode->canchangeteam(ci, ci->team, text)) && m_teammode) + { + const char *worst = chooseworstteam(text, ci); + if(worst) + { + s_strcpy(text, worst); + sendf(sender, 1, "riis", SV_SETTEAM, sender, worst); + QUEUE_STR(worst); + } + else QUEUE_STR(text); + } + else QUEUE_STR(text); + if(smode && ci->state.state==CS_ALIVE && strcmp(ci->team, text)) smode->changeteam(ci, ci->team, text); + s_strncpy(ci->team, text, MAXTEAMLEN+1); + QUEUE_MSG; + break; + } + + case SV_MAPVOTE: + case SV_MAPCHANGE: + { + getstring(text, p); + filtertext(text, text); + int reqmode = getint(p); + if(type!=SV_MAPVOTE && !mapreload) break; + if(!ci->local && !m_mp(reqmode)) reqmode = 0; + vote(text, reqmode, sender); + break; + } + + case SV_ITEMLIST: + { + if((ci->state.state==CS_SPECTATOR && !ci->privilege) || !notgotitems) { while(getint(p)>=0 && !p.overread()) getint(p); break; } + int n; + while((n = getint(p))>=0 && !p.overread()) + { + server_entity se = { getint(p), false, 0 }; + while(sents.length()<=n) sents.add(se); + if(gamemode>=0 && (sents[n].type==I_QUAD || sents[n].type==I_BOOST)) sents[n].spawntime = spawntime(sents[n].type); + else sents[n].spawned = true; + } + notgotitems = false; + break; + } + + case SV_TEAMSCORE: + getstring(text, p); + getint(p); + QUEUE_MSG; + break; + + case SV_BASEINFO: + getint(p); + getstring(text, p); + getstring(text, p); + getint(p); + QUEUE_MSG; + break; + + case SV_BASES: + if((ci->state.state!=CS_SPECTATOR || ci->privilege) && smode==&capturemode) capturemode.parsebases(p); + break; + + case SV_REPAMMO: + if(ci->state.state!=CS_SPECTATOR && smode==&capturemode) capturemode.replenishammo(ci); + break; + + case SV_TAKEFLAG: + { + int flag = getint(p); + if(ci->state.state!=CS_SPECTATOR && smode==&ctfmode) ctfmode.takeflag(ci, flag); + break; + } + + case SV_INITFLAGS: + if((ci->state.state!=CS_SPECTATOR || ci->privilege) && smode==&ctfmode) ctfmode.parseflags(p); + break; + + case SV_PING: + sendf(sender, 1, "i2", SV_PONG, getint(p)); + break; + + case SV_CLIENTPING: + getint(p); + QUEUE_MSG; + break; + + case SV_MASTERMODE: + { + int mm = getint(p); + if(ci->privilege && mm>=MM_OPEN && mm<=MM_PRIVATE) + { + if(ci->privilege>=PRIV_ADMIN || (mastermask&(1<=MM_PRIVATE) + { + loopv(clients) allowedips.add(getclientip(clients[i]->clientnum)); + } + s_sprintfd(s)("mastermode is now %s (%d)", mastermodestr(mastermode), mastermode); + sendservmsg(s); + } + else + { + s_sprintfd(s)("mastermode %d is disabled on this server", mm); + sendf(sender, 1, "ris", SV_SERVMSG, s); + } + } + break; + } + + case SV_CLEARBANS: + { + if(ci->privilege) + { + bannedips.setsize(0); + sendservmsg("cleared all bans"); + } + break; + } + + case SV_KICK: + { + int victim = getint(p); + if(ci->privilege && victim>=0 && victimclientnum!=victim && getinfo(victim)) + { + ban &b = bannedips.add(); + b.time = totalmillis; + b.ip = getclientip(victim); + allowedips.removeobj(b.ip); + disconnect_client(victim, DISC_KICK); + } + break; + } + + case SV_SPECTATOR: + { + int spectator = getint(p), val = getint(p); + if(!ci->privilege && (ci->state.state==CS_SPECTATOR || spectator!=sender)) break; + clientinfo *spinfo = (clientinfo *)getinfo(spectator); + if(!spinfo) break; + + sendf(-1, 1, "ri3", SV_SPECTATOR, spectator, val); + + if(spinfo->state.state!=CS_SPECTATOR && val) + { + if(smode) smode->leavegame(spinfo); + spinfo->state.state = CS_SPECTATOR; + spinfo->state.timeplayed += lastmillis - spinfo->state.lasttimeplayed; + } + else if(spinfo->state.state==CS_SPECTATOR && !val) + { + spinfo->state.state = CS_DEAD; + spinfo->state.respawn(); + if(!smode || smode->canspawn(spinfo)) sendspawn(spinfo); + spinfo->state.lasttimeplayed = lastmillis; + } + break; + } + + case SV_SETTEAM: + { + int who = getint(p); + getstring(text, p); + filtertext(text, text, false, MAXTEAMLEN); + if(!ci->privilege || who<0 || who>=getnumclients()) break; + clientinfo *wi = (clientinfo *)getinfo(who); + if(!wi) break; + if(!smode || smode->canchangeteam(wi, wi->team, text)) + { + if(smode && wi->state.state==CS_ALIVE && strcmp(wi->team, text)) + smode->changeteam(wi, wi->team, text); + s_strncpy(wi->team, text, MAXTEAMLEN+1); + } + sendf(sender, 1, "riis", SV_SETTEAM, who, wi->team); + QUEUE_INT(SV_SETTEAM); + QUEUE_INT(who); + QUEUE_STR(wi->team); + break; + } + + case SV_FORCEINTERMISSION: + if(m_sp) startintermission(); + break; + + case SV_RECORDDEMO: + { + int val = getint(p); + if(ci->privilegelocal && ci->privilegeprivilegeprivilege && ci->state.state==CS_SPECTATOR) break; + listdemos(sender); + break; + + case SV_GETDEMO: + { + int n = getint(p); + if(!ci->privilege && ci->state.state==CS_SPECTATOR) break; + senddemo(sender, n); + break; + } + + case SV_GETMAP: + if(mapdata) + { + sendf(sender, 1, "ris", SV_SERVMSG, "server sending map..."); + sendfile(sender, 2, mapdata, "ri", SV_SENDMAP); + } + else sendf(sender, 1, "ris", SV_SERVMSG, "no map to send"); + break; + + case SV_NEWMAP: + { + int size = getint(p); + if(!ci->privilege && ci->state.state==CS_SPECTATOR) break; + if(size>=0) + { + smapname[0] = '\0'; + resetitems(); + notgotitems = false; + if(smode) smode->reset(true); + } + QUEUE_MSG; + break; + } + + case SV_SETMASTER: + { + int val = getint(p); + getstring(text, p); + setmaster(ci, val!=0, text); + // don't broadcast the master password + break; + } + + case SV_APPROVEMASTER: + { + int mn = getint(p); + if(mastermask&MM_AUTOAPPROVE || ci->state.state==CS_SPECTATOR) break; + clientinfo *candidate = (clientinfo *)getinfo(mn); + if(!candidate || !candidate->wantsmaster || mn==sender || getclientip(mn)==getclientip(sender)) break; + setmaster(candidate, true, "", true); + break; + } + + default: + { + int size = msgsizelookup(type); + if(size==-1) { disconnect_client(sender, DISC_TAGT); return; } + if(size>0) loopi(size-1) getint(p); + if(ci && ci->state.state!=CS_SPECTATOR) QUEUE_MSG; + break; + } + } + } + + void sendstate(gamestate &gs, ucharbuf &p) + { + putint(p, gs.lifesequence); + putint(p, gs.health); + putint(p, gs.maxhealth); + putint(p, gs.armour); + putint(p, gs.armourtype); + putint(p, gs.gunselect); + loopi(GUN_PISTOL-GUN_SG+1) putint(p, gs.ammo[GUN_SG+i]); + } + + int welcomepacket(ucharbuf &p, int n, ENetPacket *packet) + { + clientinfo *ci = (clientinfo *)getinfo(n); + int hasmap = (gamemode==1 && clients.length()>1) || (smapname[0] && (minremain>0 || (ci && ci->state.state==CS_SPECTATOR) || nonspectators(n))); + putint(p, SV_INITS2C); + putint(p, n); + putint(p, PROTOCOL_VERSION); + putint(p, hasmap); + if(hasmap) + { + putint(p, SV_MAPCHANGE); + sendstring(smapname, p); + putint(p, gamemode); + putint(p, notgotitems ? 1 : 0); + if(!ci || gamemode>1 || (gamemode==0 && hasnonlocalclients())) + { + putint(p, SV_TIMEUP); + putint(p, minremain); + } + if(!notgotitems) + { + putint(p, SV_ITEMLIST); + loopv(sents) if(sents[i].spawned) + { + putint(p, i); + putint(p, sents[i].type); + if(p.remaining() < 256) + { + enet_packet_resize(packet, packet->dataLength + MAXTRANS); + p.buf = packet->data; + } + } + putint(p, -1); + } + } + if(ci && !ci->local && m_teammode) + { + const char *worst = chooseworstteam(); + if(worst) + { + putint(p, SV_SETTEAM); + putint(p, ci->clientnum); + sendstring(worst, p); + } + } + if(ci && (m_demo || m_mp(gamemode)) && ci->state.state!=CS_SPECTATOR) + { + if(smode && !smode->canspawn(ci, true)) + { + ci->state.state = CS_DEAD; + putint(p, SV_FORCEDEATH); + putint(p, n); + sendf(-1, 1, "ri2x", SV_FORCEDEATH, n, n); + } + else + { + gamestate &gs = ci->state; + spawnstate(ci); + putint(p, SV_SPAWNSTATE); + sendstate(gs, p); + gs.lastspawn = gamemillis; + } + } + if(ci && ci->state.state==CS_SPECTATOR) + { + putint(p, SV_SPECTATOR); + putint(p, n); + putint(p, 1); + sendf(-1, 1, "ri3x", SV_SPECTATOR, n, 1, n); + } + if(clients.length()>1) + { + putint(p, SV_RESUME); + loopv(clients) + { + clientinfo *oi = clients[i]; + if(oi->clientnum==n) continue; + if(p.remaining() < 256) + { + enet_packet_resize(packet, packet->dataLength + MAXTRANS); + p.buf = packet->data; + } + putint(p, oi->clientnum); + putint(p, oi->state.state); + putint(p, oi->state.frags); + putint(p, oi->state.quadmillis); + sendstate(oi->state, p); + } + putint(p, -1); + } + if(smode) + { + enet_packet_resize(packet, packet->dataLength + MAXTRANS); + p.buf = packet->data; + smode->initclient(ci, p, true); + } + return 1; + } + + void checkintermission() + { + if(minremain>0) + { + minremain = gamemillis>=gamelimit ? 0 : (gamelimit - gamemillis + 60000 - 1)/60000; + sendf(-1, 1, "ri2", SV_TIMEUP, minremain); + if(!minremain && smode) smode->intermission(); + } + if(!interm && minremain<=0) interm = gamemillis+10000; + } + + void startintermission() { gamelimit = min(gamelimit, gamemillis); checkintermission(); } + + void clearevent(clientinfo *ci) + { + int n = 1; + while(nevents.length() && ci->events[n].type==GE_HIT) n++; + ci->events.remove(0, n); + } + + void spawnstate(clientinfo *ci) + { + gamestate &gs = ci->state; + gs.spawnstate(gamemode); + gs.lifesequence++; + } + + void sendspawn(clientinfo *ci) + { + gamestate &gs = ci->state; + spawnstate(ci); + sendf(ci->clientnum, 1, "ri7v", SV_SPAWNSTATE, gs.lifesequence, + gs.health, gs.maxhealth, + gs.armour, gs.armourtype, + gs.gunselect, GUN_PISTOL-GUN_SG+1, &gs.ammo[GUN_SG]); + gs.lastspawn = gamemillis; + } + + void dodamage(clientinfo *target, clientinfo *actor, int damage, int gun, const vec &hitpush = vec(0, 0, 0)) + { + gamestate &ts = target->state; + ts.dodamage(damage); + actor->state.damage += damage; + sendf(-1, 1, "ri6", SV_DAMAGE, target->clientnum, actor->clientnum, damage, ts.armour, ts.health); + if(target!=actor && !hitpush.iszero()) + { + vec v(hitpush); + if(!v.iszero()) v.normalize(); + sendf(target->clientnum, 1, "ri6", SV_HITPUSH, gun, damage, + int(v.x*DNF), int(v.y*DNF), int(v.z*DNF)); + } + if(ts.health<=0) + { + target->state.deaths++; + if(actor!=target && isteam(actor->team, target->team)) actor->state.teamkills++; + int fragvalue = smode ? smode->fragvalue(target, actor) : (target==actor || isteam(target->team, actor->team) ? -1 : 1); + actor->state.frags += fragvalue; + if(fragvalue>0) + { + int friends = 0, enemies = 0; // note: friends also includes the fragger + if(m_teammode) loopv(clients) if(strcmp(clients[i]->team, actor->team)) enemies++; else friends++; + else { friends = 1; enemies = clients.length()-1; } + actor->state.effectiveness += fragvalue*friends/float(max(enemies, 1)); + } + sendf(-1, 1, "ri4", SV_DIED, target->clientnum, actor->clientnum, actor->state.frags); + target->position.setsizenodelete(0); + if(smode) smode->died(target, actor); + ts.state = CS_DEAD; + ts.lastdeath = gamemillis; + // don't issue respawn yet until DEATHMILLIS has elapsed + // ts.respawn(); + } + } + + void processevent(clientinfo *ci, suicideevent &e) + { + gamestate &gs = ci->state; + if(gs.state!=CS_ALIVE) return; + ci->state.frags += smode ? smode->fragvalue(ci, ci) : -1; + ci->state.deaths++; + sendf(-1, 1, "ri4", SV_DIED, ci->clientnum, ci->clientnum, gs.frags); + ci->position.setsizenodelete(0); + if(smode) smode->died(ci, NULL); + gs.state = CS_DEAD; + gs.respawn(); + } + + void processevent(clientinfo *ci, explodeevent &e) + { + gamestate &gs = ci->state; + switch(e.gun) + { + case GUN_RL: + if(!gs.rockets.remove(e.id)) return; + break; + + case GUN_GL: + if(!gs.grenades.remove(e.id)) return; + break; + + default: + return; + } + for(int i = 1; ievents.length() && ci->events[i].type==GE_HIT; i++) + { + hitevent &h = ci->events[i].hit; + clientinfo *target = (clientinfo *)getinfo(h.target); + if(!target || target->state.state!=CS_ALIVE || h.lifesequence!=target->state.lifesequence || h.dist<0 || h.dist>RL_DAMRAD) continue; + + int j = 1; + for(j = 1; jevents[j].hit.target==h.target) break; + if(jstate; + int wait = e.millis - gs.lastshot; + if(!gs.isalive(gamemillis) || + waitGUN_PISTOL || + gs.ammo[e.gun]<=0) + return; + if(e.gun!=GUN_FIST) gs.ammo[e.gun]--; + gs.lastshot = e.millis; + gs.gunwait = guns[e.gun].attackdelay; + sendf(-1, 1, "ri9x", SV_SHOTFX, ci->clientnum, e.gun, + int(e.from[0]*DMF), int(e.from[1]*DMF), int(e.from[2]*DMF), + int(e.to[0]*DMF), int(e.to[1]*DMF), int(e.to[2]*DMF), + ci->clientnum); + gs.shotdamage += guns[e.gun].damage*(gs.quadmillis ? 4 : 1)*(e.gun==GUN_SG ? SGRAYS : 1); + switch(e.gun) + { + case GUN_RL: gs.rockets.add(e.id); break; + case GUN_GL: gs.grenades.add(e.id); break; + default: + { + int totalrays = 0, maxrays = e.gun==GUN_SG ? SGRAYS : 1; + for(int i = 1; ievents.length() && ci->events[i].type==GE_HIT; i++) + { + hitevent &h = ci->events[i].hit; + clientinfo *target = (clientinfo *)getinfo(h.target); + if(!target || target->state.state!=CS_ALIVE || h.lifesequence!=target->state.lifesequence || h.rays<1) continue; + + totalrays += h.rays; + if(totalrays>maxrays) continue; + int damage = h.rays*guns[e.gun].damage; + if(gs.quadmillis) damage *= 4; + dodamage(target, ci, damage, e.gun, h.dir); + } + break; + } + } + } + + void processevent(clientinfo *ci, pickupevent &e) + { + gamestate &gs = ci->state; + if(m_mp(gamemode) && !gs.isalive(gamemillis)) return; + pickup(e.ent, ci->clientnum); + } + + void processevents() + { + loopv(clients) + { + clientinfo *ci = clients[i]; + if(curtime>0 && ci->state.quadmillis) ci->state.quadmillis = max(ci->state.quadmillis-curtime, 0); + while(ci->events.length()) + { + gameevent &e = ci->events[0]; + if(e.typegamemillis) break; + if(e.shot.millislastevent) { clearevent(ci); continue; } + ci->lastevent = e.shot.millis; + } + switch(e.type) + { + case GE_SHOT: processevent(ci, e.shot); break; + case GE_EXPLODE: processevent(ci, e.explode); break; + // untimed events + case GE_SUICIDE: processevent(ci, e.suicide); break; + case GE_PICKUP: processevent(ci, e.pickup); break; + } + clearevent(ci); + } + } + } + + void serverupdate(int _lastmillis, int _totalmillis) + { + curtime = _lastmillis - lastmillis; + gamemillis += curtime; + lastmillis = _lastmillis; + totalmillis = _totalmillis; + + if(m_demo) readdemo(); + else if(minremain>0) + { + processevents(); + if(curtime) + { + loopv(sents) if(sents[i].spawntime) // spawn entities when timer reached + { + int oldtime = sents[i].spawntime; + sents[i].spawntime -= curtime; + if(sents[i].spawntime<=0) + { + sents[i].spawntime = 0; + sents[i].spawned = true; + sendf(-1, 1, "ri2", SV_ITEMSPAWN, i); + } + else if(sents[i].spawntime<=10000 && oldtime>10000 && (sents[i].type==I_QUAD || sents[i].type==I_BOOST)) + { + sendf(-1, 1, "ri2", SV_ANNOUNCE, sents[i].type); + } + } + } + if(smode) smode->update(); + } + + while(bannedips.length() && bannedips[0].time-totalmillis>4*60*60000) bannedips.remove(0); + + if(masterupdate) + { + clientinfo *m = currentmaster>=0 ? (clientinfo *)getinfo(currentmaster) : NULL; + sendf(-1, 1, "ri3", SV_CURRENTMASTER, currentmaster, m ? m->privilege : 0); + masterupdate = false; + } + + if((gamemode>1 || (gamemode==0 && hasnonlocalclients())) && gamemillis-curtime>0 && gamemillis/60000!=(gamemillis-curtime)/60000) checkintermission(); + if(interm && gamemillis>interm) + { + if(demorecord) enddemorecord(); + interm = 0; + checkvotes(true); + } + } + + bool serveroption(char *arg) + { + if(arg[0]=='-') switch(arg[1]) + { + case 'n': s_strcpy(serverdesc, &arg[2]); return true; + case 'p': s_strcpy(masterpass, &arg[2]); return true; + case 'o': if(atoi(&arg[2])) mastermask = (1<wantsmaster)) return; + const char *name = ""; + if(val) + { + if(ci->privilege) + { + if(!masterpass[0] || !pass[0]==(ci->privilege!=PRIV_ADMIN)) return; + } + else if(ci->state.state==CS_SPECTATOR && (!masterpass[0] || strcmp(masterpass, pass))) return; + loopv(clients) if(ci!=clients[i] && clients[i]->privilege) + { + if(masterpass[0] && !strcmp(masterpass, pass)) clients[i]->privilege = PRIV_NONE; + else return; + } + if(masterpass[0] && !strcmp(masterpass, pass)) ci->privilege = PRIV_ADMIN; + else if(!approved && !(mastermask&MM_AUTOAPPROVE) && !ci->privilege) + { + ci->wantsmaster = true; + s_sprintfd(msg)("%s wants master. Type \"/approve %d\" to approve.", colorname(ci), ci->clientnum); + sendservmsg(msg); + return; + } + else ci->privilege = PRIV_MASTER; + name = privname(ci->privilege); + } + else + { + if(!ci->privilege) return; + name = privname(ci->privilege); + ci->privilege = 0; + } + mastermode = MM_OPEN; + allowedips.setsize(0); + s_sprintfd(msg)("%s %s %s", colorname(ci), val ? (approved ? "approved for" : "claimed") : "relinquished", name); + sendservmsg(msg); + currentmaster = val ? ci->clientnum : -1; + masterupdate = true; + loopv(clients) clients[i]->wantsmaster = false; + } + + void localconnect(int n) + { + clientinfo *ci = (clientinfo *)getinfo(n); + ci->clientnum = n; + ci->local = true; + clients.add(ci); + } + + void localdisconnect(int n) + { + clientinfo *ci = (clientinfo *)getinfo(n); + if(smode) smode->leavegame(ci, true); + clients.removeobj(ci); + } + + int clientconnect(int n, uint ip) + { + clientinfo *ci = (clientinfo *)getinfo(n); + ci->clientnum = n; + clients.add(ci); + loopv(bannedips) if(bannedips[i].ip==ip) return DISC_IPBAN; + if(mastermode>=MM_PRIVATE) + { + if(allowedips.find(ip)<0) return DISC_PRIVATE; + } + if(mastermode>=MM_LOCKED) ci->state.state = CS_SPECTATOR; + if(currentmaster>=0) masterupdate = true; + ci->state.lasttimeplayed = lastmillis; + return DISC_NONE; + } + + void clientdisconnect(int n) + { + clientinfo *ci = (clientinfo *)getinfo(n); + if(ci->privilege) setmaster(ci, false); + if(smode) smode->leavegame(ci, true); + ci->state.timeplayed += lastmillis - ci->state.lasttimeplayed; + savescore(ci); + sendf(-1, 1, "ri2", SV_CDIS, n); + clients.removeobj(ci); + if(clients.empty()) bannedips.setsize(0); // bans clear when server empties + } + + const char *servername() { return "sauerbratenserver"; } + int serverinfoport() { return SAUERBRATEN_SERVINFO_PORT; } + int serverport() { return SAUERBRATEN_SERVER_PORT; } + const char *getdefaultmaster() { return "sauerbraten.org/masterserver/"; } + + #include "extinfo.h" + + void serverinforeply(ucharbuf &req, ucharbuf &p) + { + if(!getint(req)) + { + extserverinforeply(req, p); + return; + } + + putint(p, clients.length()); + putint(p, 5); // number of attrs following + putint(p, PROTOCOL_VERSION); // a // generic attributes, passed back below + putint(p, gamemode); // b + putint(p, minremain); // c + putint(p, maxclients); + putint(p, mastermode); + sendstring(smapname, p); + sendstring(serverdesc, p); + sendserverinforeply(p); + } + + bool servercompatible(char *name, char *sdec, char *map, int ping, const vector &attr, int np) + { + return attr.length() && attr[0]==PROTOCOL_VERSION; + } + + void receivefile(int sender, uchar *data, int len) + { + if(gamemode != 1 || len > 1024*1024) return; + clientinfo *ci = (clientinfo *)getinfo(sender); + if(ci->state.state==CS_SPECTATOR && !ci->privilege) return; + if(mapdata) { fclose(mapdata); mapdata = NULL; } + if(!len) return; + mapdata = tmpfile(); + if(!mapdata) { sendf(sender, 1, "ris", SV_SERVMSG, "failed to open temporary file for map"); return; } + fwrite(data, 1, len, mapdata); + s_sprintfd(msg)("[%s uploaded map to server, \"/getmap\" to receive it]", colorname(ci)); + sendservmsg(msg); + } + + bool duplicatename(clientinfo *ci, char *name) + { + if(!name) name = ci->name; + loopv(clients) if(clients[i]!=ci && !strcmp(name, clients[i]->name)) return true; + return false; + } + + char *colorname(clientinfo *ci, char *name = NULL) + { + if(!name) name = ci->name; + if(name[0] && !duplicatename(ci, name)) return name; + static string cname; + s_sprintf(cname)("%s \fs\f5(%d)\fr", name, ci->clientnum); + return cname; + } +}; diff --git a/src/fpsgame/game.h b/src/fpsgame/game.h new file mode 100644 index 0000000..e943192 --- /dev/null +++ b/src/fpsgame/game.h @@ -0,0 +1,419 @@ +// console message types + +enum +{ + CON_CHAT = 1<<8, + CON_TEAMCHAT = 1<<9, + CON_GAMEINFO = 1<<10, + CON_FRAG_SELF = 1<<11, + CON_FRAG_OTHER = 1<<12 +}; + +// network quantization scale +#define DMF 16.0f // for world locations +#define DNF 100.0f // for normalized vectors +#define DVELF 1.0f // for playerspeed based velocity vectors + +enum // static entity types +{ + NOTUSED = ET_EMPTY, // entity slot not in use in map + LIGHT = ET_LIGHT, // lightsource, attr1 = radius, attr2 = intensity + MAPMODEL = ET_MAPMODEL, // attr1 = angle, attr2 = idx + PLAYERSTART, // attr1 = angle, attr2 = team + ENVMAP = ET_ENVMAP, // attr1 = radius + PARTICLES = ET_PARTICLES, + MAPSOUND = ET_SOUND, + SPOTLIGHT = ET_SPOTLIGHT, + I_SHELLS, I_BULLETS, I_ROCKETS, I_ROUNDS, I_GRENADES, I_CARTRIDGES, + I_HEALTH, I_BOOST, + I_GREENARMOUR, I_YELLOWARMOUR, + I_QUAD, + TELEPORT, // attr1 = idx + TELEDEST, // attr1 = angle, attr2 = idx + MONSTER, // attr1 = angle, attr2 = monstertype + CARROT, // attr1 = tag, attr2 = type + JUMPPAD, // attr1 = zpush, attr2 = ypush, attr3 = xpush + BASE, + RESPAWNPOINT, + BOX, // attr1 = angle, attr2 = idx, attr3 = weight + BARREL, // attr1 = angle, attr2 = idx, attr3 = weight, attr4 = health + PLATFORM, // attr1 = angle, attr2 = idx, attr3 = tag, attr4 = speed + ELEVATOR, // attr1 = angle, attr2 = idx, attr3 = tag, attr4 = speed + FLAG, // attr1 = angle, attr2 = team + MAXENTTYPES +}; + +struct fpsentity : extentity +{ + // extend with additional fields if needed... +}; + +enum { GUN_FIST = 0, GUN_SG, GUN_CG, GUN_RL, GUN_RIFLE, GUN_GL, GUN_PISTOL, GUN_FIREBALL, GUN_ICEBALL, GUN_SLIMEBALL, GUN_BITE, GUN_BARREL, NUMGUNS }; +enum { A_BLUE, A_GREEN, A_YELLOW }; // armour types... take 20/40/60 % off +enum { M_NONE = 0, M_SEARCH, M_HOME, M_ATTACKING, M_PAIN, M_SLEEP, M_AIMING }; // monster states + +#define m_noitems ((gamemode>=4 && gamemode<=11) || gamemode==13 || gamemode==14 || gamemode==16 || gamemode==18 || gamemode==-3) +#define m_noitemsrail ((gamemode>=4 && gamemode<=5) || (gamemode>=8 && gamemode<=9) || gamemode==13 || gamemode==16 || gamemode==18) +#define m_arena (gamemode>=8 && gamemode<=11) +#define m_tarena (gamemode>=10 && gamemode<=11) +#define m_capture (gamemode>=12 && gamemode<=14) +#define m_regencapture (gamemode==14) +#define m_assassin (gamemode>=15 && gamemode<=16) +#define m_ctf (gamemode>=17 && gamemode<=18) +#define m_teammode ((gamemode>2 && gamemode<12 && gamemode&1) || m_capture || m_ctf) +#define m_teamskins (m_teammode || m_assassin) +#define m_sp (m_dmsp || m_classicsp) +#define m_dmsp (gamemode==-1 || gamemode==-4) +#define m_classicsp (gamemode==-2 || gamemode==-5) +#define m_slowmo (gamemode==-4 || gamemode==-5) +#define m_demo (gamemode==-3) +#define isteam(a,b) (m_teammode && strcmp(a, b)==0) + +#define m_mp(mode) (mode>=0 && mode<=18) + +// hardcoded sounds, defined in sounds.cfg +enum +{ + S_JUMP = 0, S_LAND, S_RIFLE, S_PUNCH1, S_SG, S_CG, + S_RLFIRE, S_RLHIT, S_WEAPLOAD, S_ITEMAMMO, S_ITEMHEALTH, + S_ITEMARMOUR, S_ITEMPUP, S_ITEMSPAWN, S_TELEPORT, S_NOAMMO, S_PUPOUT, + S_PAIN1, S_PAIN2, S_PAIN3, S_PAIN4, S_PAIN5, S_PAIN6, + S_DIE1, S_DIE2, + S_FLAUNCH, S_FEXPLODE, + S_SPLASH1, S_SPLASH2, + S_GRUNT1, S_GRUNT2, S_RUMBLE, + S_PAINO, + S_PAINR, S_DEATHR, + S_PAINE, S_DEATHE, + S_PAINS, S_DEATHS, + S_PAINB, S_DEATHB, + S_PAINP, S_PIGGR2, + S_PAINH, S_DEATHH, + S_PAIND, S_DEATHD, + S_PIGR1, S_ICEBALL, S_SLIMEBALL, + S_JUMPPAD, S_PISTOL, + + S_V_BASECAP, S_V_BASELOST, + S_V_FIGHT, + S_V_BOOST, S_V_BOOST10, + S_V_QUAD, S_V_QUAD10, + S_V_RESPAWNPOINT, + + S_FLAGPICKUP, + S_FLAGDROP, + S_FLAGRETURN, + S_FLAGSCORE, + S_FLAGRESET, + + S_BURN +}; + +// network messages codes, c2s, c2c, s2c + +enum { PRIV_NONE = 0, PRIV_MASTER, PRIV_ADMIN }; + +enum +{ + SV_INITS2C = 0, SV_INITC2S, SV_POS, SV_TEXT, SV_SOUND, SV_CDIS, + SV_SHOOT, SV_EXPLODE, SV_SUICIDE, + SV_DIED, SV_DAMAGE, SV_HITPUSH, SV_SHOTFX, + SV_TRYSPAWN, SV_SPAWNSTATE, SV_SPAWN, SV_FORCEDEATH, SV_ARENAWIN, + SV_GUNSELECT, SV_TAUNT, + SV_MAPCHANGE, SV_MAPVOTE, SV_ITEMSPAWN, SV_ITEMPICKUP, SV_DENIED, + SV_PING, SV_PONG, SV_CLIENTPING, + SV_TIMEUP, SV_MAPRELOAD, SV_ITEMACC, + SV_SERVMSG, SV_ITEMLIST, SV_RESUME, + SV_EDITMODE, SV_EDITENT, SV_EDITF, SV_EDITT, SV_EDITM, SV_FLIP, SV_COPY, SV_PASTE, SV_ROTATE, SV_REPLACE, SV_DELCUBE, SV_REMIP, SV_NEWMAP, SV_GETMAP, SV_SENDMAP, + SV_MASTERMODE, SV_KICK, SV_CLEARBANS, SV_CURRENTMASTER, SV_SPECTATOR, SV_SETMASTER, SV_SETTEAM, SV_APPROVEMASTER, + SV_BASES, SV_BASEINFO, SV_TEAMSCORE, SV_REPAMMO, SV_BASEREGEN, SV_FORCEINTERMISSION, SV_ANNOUNCE, + SV_CLEARTARGETS, SV_CLEARHUNTERS, SV_ADDTARGET, SV_REMOVETARGET, SV_ADDHUNTER, SV_REMOVEHUNTER, + SV_LISTDEMOS, SV_SENDDEMOLIST, SV_GETDEMO, SV_SENDDEMO, + SV_DEMOPLAYBACK, SV_RECORDDEMO, SV_STOPDEMO, SV_CLEARDEMOS, + SV_TAKEFLAG, SV_RETURNFLAG, SV_RESETFLAG, SV_DROPFLAG, SV_SCOREFLAG, SV_INITFLAGS, + SV_SAYTEAM, + SV_CLIENT, +}; + +static char msgsizelookup(int msg) +{ + static char msgsizesl[] = // size inclusive message token, 0 for variable or not-checked sizes + { + SV_INITS2C, 4, SV_INITC2S, 0, SV_POS, 0, SV_TEXT, 0, SV_SOUND, 2, SV_CDIS, 2, + SV_SHOOT, 0, SV_EXPLODE, 0, SV_SUICIDE, 1, + SV_DIED, 4, SV_DAMAGE, 6, SV_HITPUSH, 6, SV_SHOTFX, 9, + SV_TRYSPAWN, 1, SV_SPAWNSTATE, 13, SV_SPAWN, 3, SV_FORCEDEATH, 2, SV_ARENAWIN, 2, + SV_GUNSELECT, 2, SV_TAUNT, 1, + SV_MAPCHANGE, 0, SV_MAPVOTE, 0, SV_ITEMSPAWN, 2, SV_ITEMPICKUP, 2, SV_DENIED, 2, + SV_PING, 2, SV_PONG, 2, SV_CLIENTPING, 2, + SV_TIMEUP, 2, SV_MAPRELOAD, 1, SV_ITEMACC, 3, + SV_SERVMSG, 0, SV_ITEMLIST, 0, SV_RESUME, 0, + SV_EDITMODE, 2, SV_EDITENT, 10, SV_EDITF, 16, SV_EDITT, 16, SV_EDITM, 15, SV_FLIP, 14, SV_COPY, 14, SV_PASTE, 14, SV_ROTATE, 15, SV_REPLACE, 16, SV_DELCUBE, 14, SV_REMIP, 1, SV_NEWMAP, 2, SV_GETMAP, 1, SV_SENDMAP, 0, + SV_MASTERMODE, 2, SV_KICK, 2, SV_CLEARBANS, 1, SV_CURRENTMASTER, 3, SV_SPECTATOR, 3, SV_SETMASTER, 0, SV_SETTEAM, 0, SV_APPROVEMASTER, 2, + SV_BASES, 0, SV_BASEINFO, 0, SV_TEAMSCORE, 0, SV_REPAMMO, 1, SV_BASEREGEN, 5, SV_FORCEINTERMISSION, 1, SV_ANNOUNCE, 2, + SV_CLEARTARGETS, 1, SV_CLEARHUNTERS, 1, SV_ADDTARGET, 2, SV_REMOVETARGET, 2, SV_ADDHUNTER, 2, SV_REMOVEHUNTER, 2, + SV_LISTDEMOS, 1, SV_SENDDEMOLIST, 0, SV_GETDEMO, 2, SV_SENDDEMO, 0, + SV_DEMOPLAYBACK, 2, SV_RECORDDEMO, 2, SV_STOPDEMO, 1, SV_CLEARDEMOS, 2, + SV_DROPFLAG, 6, SV_SCOREFLAG, 5, SV_RETURNFLAG, 3, SV_TAKEFLAG, 2, SV_RESETFLAG, 2, SV_INITFLAGS, 6, + SV_SAYTEAM, 0, + SV_CLIENT, 0, + -1 + }; + for(char *p = msgsizesl; *p>=0; p += 2) if(*p==msg) return p[1]; + return -1; +} + +#define SAUERBRATEN_SERVER_PORT 28785 +#define SAUERBRATEN_SERVINFO_PORT 28786 +#define PROTOCOL_VERSION 256 // bump when protocol changes +#define DEMO_VERSION 1 // bump when demo format changes +#define DEMO_MAGIC "SAUERBRATEN_DEMO" + +struct demoheader +{ + char magic[16]; + int version, protocol; +}; + +#define MAXNAMELEN 15 +#define MAXTEAMLEN 4 + +static struct itemstat { int add, max, sound; const char *name; int info; } itemstats[] = +{ + {15, 60, S_ITEMAMMO, "SG", GUN_SG}, + {20, 60, S_ITEMAMMO, "CG", GUN_CG}, + {5, 15, S_ITEMAMMO, "RL", GUN_RL}, + {5, 15, S_ITEMAMMO, "RI", GUN_RIFLE}, + {10, 30, S_ITEMAMMO, "GL", GUN_GL}, + {30, 120, S_ITEMAMMO, "PI", GUN_PISTOL}, + {25, 100, S_ITEMHEALTH, "H"}, + {10, 1000, S_ITEMHEALTH, "MH"}, + {100, 100, S_ITEMARMOUR, "GA", A_GREEN}, + {200, 200, S_ITEMARMOUR, "YA", A_YELLOW}, + {20000, 30000, S_ITEMPUP, "Q"}, +}; + +#define SGRAYS 20 +#define SGSPREAD 4 +#define RL_DAMRAD 40 +#define RL_SELFDAMDIV 2 +#define RL_DISTSCALE 1.5f + +static struct guninfo { short sound, attackdelay, damage, projspeed, part, kickamount, range; const char *name, *file; } guns[NUMGUNS] = +{ + { S_PUNCH1, 250, 50, 0, 0, 1, 12, "fist", "fist" }, + { S_SG, 1400, 10, 0, 0, 20, 1024, "shotgun", "shotg" }, // *SGRAYS + { S_CG, 100, 30, 0, 0, 7, 1024, "chaingun", "chaing"}, + { S_RLFIRE, 800, 120, 80, 0, 10, 1024, "rocketlauncher", "rocket"}, + { S_RIFLE, 1500, 100, 0, 0, 30, 2048, "rifle", "rifle" }, + { S_FLAUNCH, 500, 75, 80, 0, 10, 1024, "grenadelauncher", "gl" }, + { S_PISTOL, 500, 25, 0, 0, 7, 1024, "pistol", "pistol" }, + { S_FLAUNCH, 200, 20, 50, 4, 1, 1024, "fireball", NULL }, + { S_ICEBALL, 200, 40, 30, 6, 1, 1024, "iceball", NULL }, + { S_SLIMEBALL, 200, 30, 160, 7, 1, 1024, "slimeball", NULL }, + { S_PIGR1, 250, 50, 0, 0, 1, 12, "bite", NULL }, + { -1, 0, 120, 0, 0, 0, 0, "barrel", NULL } +}; + +// inherited by fpsent and server clients +struct fpsstate +{ + int health, maxhealth; + int armour, armourtype; + int quadmillis; + int gunselect, gunwait; + int ammo[NUMGUNS]; + + fpsstate() : maxhealth(100) {} + + void baseammo(int gun, int k = 2, int scale = 1) + { + ammo[gun] = (itemstats[gun-GUN_SG].add*k)/scale; + } + + void addammo(int gun, int k = 1, int scale = 1) + { + itemstat &is = itemstats[gun-GUN_SG]; + ammo[gun] = min(ammo[gun] + (is.add*k)/scale, is.max); + } + + bool hasmaxammo(int type) + { + const itemstat &is = itemstats[type-I_SHELLS]; + return ammo[type-I_SHELLS+GUN_SG]>=is.max; + } + + bool canpickup(int type) + { + if(typeI_QUAD) return false; + itemstat &is = itemstats[type-I_SHELLS]; + switch(type) + { + case I_BOOST: return maxhealth=100) return false; + case I_YELLOWARMOUR: return !armourtype || armourI_QUAD) return; + itemstat &is = itemstats[type-I_SHELLS]; + switch(type) + { + case I_BOOST: + maxhealth = min(maxhealth+is.add, is.max); + case I_HEALTH: // boost also adds to health + health = min(health+is.add, maxhealth); + break; + case I_GREENARMOUR: + case I_YELLOWARMOUR: + armour = min(armour+is.add, is.max); + armourtype = is.info; + break; + case I_QUAD: + quadmillis = min(quadmillis+is.add, is.max); + break; + default: + ammo[is.info] = min(ammo[is.info]+is.add, is.max); + break; + } + } + + void respawn() + { + health = maxhealth; + armour = 0; + armourtype = A_BLUE; + quadmillis = 0; + gunselect = GUN_PISTOL; + gunwait = 0; + loopi(NUMGUNS) ammo[i] = 0; + ammo[GUN_FIST] = 1; + } + + void spawnstate(int gamemode) + { + if(m_demo) + { + gunselect = GUN_FIST; + } + else if(m_noitems || m_capture) + { + armour = 0; + if(m_noitemsrail) + { + health = 1; + gunselect = GUN_RIFLE; + ammo[GUN_RIFLE] = 100; + } + else if(m_regencapture) + { + armourtype = A_GREEN; + gunselect = GUN_PISTOL; + ammo[GUN_PISTOL] = 40; + ammo[GUN_GL] = 1; + } + else + { + armourtype = A_GREEN; + armour = 100; + if(m_tarena || m_capture) + { + ammo[GUN_PISTOL] = 80; + int spawngun1 = rnd(5)+1, spawngun2; + gunselect = spawngun1; + baseammo(spawngun1, m_capture ? 1 : 2); + do spawngun2 = rnd(5)+1; while(spawngun1==spawngun2); + baseammo(spawngun2, m_capture ? 1 : 2); + if(!m_capture) ammo[GUN_GL] += 1; + } + else // efficiency + { + loopi(5) baseammo(i+1); + gunselect = GUN_CG; + ammo[GUN_CG] /= 2; + } + } + } + else if(m_ctf) + { + armourtype = A_BLUE; + armour = 50; + ammo[GUN_PISTOL] = 40; + ammo[GUN_GL] = 1; + } + else + { + ammo[GUN_PISTOL] = m_sp ? 80 : 40; + ammo[GUN_GL] = 1; + } + } + + // just subtract damage here, can set death, etc. later in code calling this + int dodamage(int damage) + { + int ad = damage*(armourtype+1)*25/100; // let armour absorb when possible + if(ad>armour) ad = armour; + armour -= ad; + damage -= ad; + health -= damage; + return damage; + } +}; + +struct fpsent : dynent, fpsstate +{ + int weight; // affects the effectiveness of hitpush + int clientnum, privilege, lastupdate, plag, ping; + int lifesequence; // sequence id for each respawn, used in damage test + int lastpain; + int lastaction, lastattackgun; + bool attacking; + int lasttaunt; + int lastpickup, lastpickupmillis, lastbase; + int superdamage; + int frags, deaths, totaldamage, totalshots; + editinfo *edit; + float deltayaw, deltapitch, newyaw, newpitch; + int smoothmillis; + + string name, team, info; + + fpsent() : weight(100), clientnum(-1), privilege(PRIV_NONE), lastupdate(0), plag(0), ping(0), lifesequence(0), lastpain(0), frags(0), deaths(0), totaldamage(0), totalshots(0), edit(NULL), smoothmillis(-1) + { name[0] = team[0] = info[0] = 0; respawn(); } + ~fpsent() { freeeditinfo(edit); } + + void damageroll(float damage) + { + float damroll = 2.0f*damage; + roll += roll>0 ? damroll : (roll<0 ? -damroll : (rnd(2) ? damroll : -damroll)); // give player a kick + } + + void hitpush(int damage, const vec &dir, fpsent *actor, int gun) + { + vec push(dir); + push.mul(80*damage/weight); + if(gun==GUN_RL || gun==GUN_GL) push.mul(actor==this ? 5 : (type==ENT_AI ? 3 : 2)); + vel.add(push); + } + + void respawn() + { + dynent::reset(); + fpsstate::respawn(); + lastaction = 0; + lastattackgun = gunselect; + attacking = false; + lasttaunt = 0; + lastpickup = -1; + lastpickupmillis = 0; + lastbase = -1; + superdamage = 0; + } +}; + diff --git a/src/fpsgame/monster.h b/src/fpsgame/monster.h new file mode 100644 index 0000000..9fd9de1 --- /dev/null +++ b/src/fpsgame/monster.h @@ -0,0 +1,378 @@ +// monster.h: implements AI for single player monsters, currently client only + +struct monsterset +{ + fpsclient &cl; + vector &ents; + vector teleports; + + static const int TOTMFREQ = 14; + static const int NUMMONSTERTYPES = 9; + + IVAR(killsendsp, 0, 1, 1); + + struct monstertype // see docs for how these values modify behaviour + { + short gun, speed, health, freq, lag, rate, pain, loyalty, bscale, weight; + short painsound, diesound; + const char *name, *mdlname, *vwepname; + }; + + struct monster : fpsent + { + fpsclient &cl; + + monstertype *monstertypes; + monsterset *ms; + + int monsterstate; // one of M_*, M_NONE means human + + int mtype; // see monstertypes table + fpsent *enemy; // monster wants to kill this entity + float targetyaw; // monster wants to look in this direction + int trigger; // millis at which transition to another monsterstate takes place + vec attacktarget; // delayed attacks + int anger; // how many times already hit by fellow monster + + monster(int _type, int _yaw, int _state, int _trigger, int _move, monsterset *_ms) : cl(_ms->cl), monstertypes(_ms->monstertypes), ms(_ms), monsterstate(_state) + { + type = ENT_AI; + respawn(); + if(_type>=NUMMONSTERTYPES || _type < 0) + { + conoutf(CON_WARN, "warning: unknown monster in spawn: %d", _type); + _type = 0; + } + monstertype *t = monstertypes+(mtype = _type); + eyeheight = 8.0f; + aboveeye = 7.0f; + radius *= t->bscale/10.0f; + xradius = yradius = radius; + eyeheight *= t->bscale/10.0f; + aboveeye *= t->bscale/10.0f; + weight = t->weight; + if(_state!=M_SLEEP) cl.spawnplayer(this); + trigger = cl.lastmillis+_trigger; + targetyaw = yaw = (float)_yaw; + move = _move; + enemy = cl.player1; + gunselect = t->gun; + maxspeed = (float)t->speed*4; + health = t->health; + armour = 0; + loopi(NUMGUNS) ammo[i] = 10000; + pitch = 0; + roll = 0; + state = CS_ALIVE; + anger = 0; + s_strcpy(name, t->name); + } + + // monster AI is sequenced using transitions: they are in a particular state where + // they execute a particular behaviour until the trigger time is hit, and then they + // reevaluate their situation based on the current state, the environment etc., and + // transition to the next state. Transition timeframes are parametrized by difficulty + // level (skill), faster transitions means quicker decision making means tougher AI. + + void transition(int _state, int _moving, int n, int r) // n = at skill 0, n/2 = at skill 10, r = added random factor + { + monsterstate = _state; + move = _moving; + n = n*130/100; + trigger = cl.lastmillis+n-ms->skill()*(n/16)+rnd(r+1); + } + + void monsteraction(int curtime) // main AI thinking routine, called every frame for every monster + { + if(enemy->state==CS_DEAD) { enemy = cl.player1; anger = 0; } + normalize_yaw(targetyaw); + if(targetyaw>yaw) // slowly turn monster towards his target + { + yaw += curtime*0.5f; + if(targetyawyaw) yaw = targetyaw; + } + float dist = enemy->o.dist(o); + if(monsterstate!=M_SLEEP) pitch = asin((enemy->o.z - o.z) / dist) / RAD; + + if(blocked) // special case: if we run into scenery + { + blocked = false; + if(!rnd(20000/monstertypes[mtype].speed)) // try to jump over obstackle (rare) + { + jumpnext = true; + } + else if(triggero.x - o.x, enemy->o.y - o.y)/RAD+180; + + switch(monsterstate) + { + case M_PAIN: + case M_ATTACKING: + case M_SEARCH: + if(triggermonsterhurt && o.dist(ms->monsterhurtpos)<128)) + { + vec target; + if(raycubelos(o, enemy->o, target)) + { + transition(M_HOME, 1, 500, 200); + playsound(S_GRUNT1+rnd(2), &o); + } + } + break; + } + + case M_AIMING: // this state is the delay between wanting to shoot and actually firing + if(triggero, target)) // no visual contact anymore, let monster get as close as possible then search for player + { + transition(M_HOME, 1, 800, 500); + } + else + { + bool melee = false, longrange = false; + switch(monstertypes[mtype].gun) + { + case GUN_BITE: + case GUN_FIST: melee = true; break; + case GUN_RIFLE: longrange = true; break; + } + // the closer the monster is the more likely he wants to shoot, + if((!melee || dist<20) && !rnd(longrange ? (int)dist/12+1 : min((int)dist/12+1,6)) && enemy->state==CS_ALIVE) // get ready to fire + { + attacktarget = target; + transition(M_AIMING, 0, monstertypes[mtype].lag, 10); + } + else // track player some more + { + transition(M_HOME, 1, monstertypes[mtype].rate, 0); + } + } + } + break; + + } + + if(move || moving || (onplayer && (onplayer->state!=CS_ALIVE || lastmoveattempt <= onplayer->lastmove))) + { + vec pos(o); + pos.sub(eyeheight); + loopv(ms->teleports) // equivalent of player entity touch, but only teleports are used + { + entity &e = *ms->ents[ms->teleports[i]]; + float dist = e.o.dist(pos); + if(dist<16) cl.et.teleport(ms->teleports[i], this); + } + + moveplayer(this, 1, true); // use physics to move monster + } + } + + void monsterpain(int damage, fpsent *d) + { + if(d->type==ENT_AI) // a monster hit us + { + if(this!=d) // guard for RL guys shooting themselves :) + { + anger++; // don't attack straight away, first get angry + int _anger = d->type==ENT_AI && mtype==((monster *)d)->mtype ? anger/2 : anger; + if(_anger>=monstertypes[mtype].loyalty) enemy = d; // monster infight if very angry + } + } + else if(d->type==ENT_PLAYER) // player hit us + { + anger = 0; + enemy = d; + ms->monsterhurt = true; + ms->monsterhurtpos = o; + } + cl.ws.damageeffect(damage, this); + if((health -= damage)<=0) + { + state = CS_DEAD; + lastpain = cl.lastmillis; + playsound(monstertypes[mtype].diesound, &o); + ms->monsterkilled(); + superdamage = -health; + cl.ws.superdamageeffect(vel, this); + } + else + { + transition(M_PAIN, 0, monstertypes[mtype].pain, 200); // in this state monster won't attack + playsound(monstertypes[mtype].painsound, &o); + } + } + }; + + monstertype *monstertypes; + + monsterset(fpsclient &_cl) : cl(_cl), ents(_cl.et.ents) + { + static monstertype _monstertypes[NUMMONSTERTYPES] = + { + { GUN_FIREBALL, 15, 100, 3, 0, 100, 800, 1, 10, 90, S_PAINO, S_DIE1, "an ogro", "monster/ogro", "monster/ogro/vwep"}, + { GUN_CG, 18, 70, 2, 70, 10, 400, 2, 10, 50, S_PAINR, S_DEATHR, "a rhino", "monster/rhino", NULL}, + { GUN_SG, 13, 120, 1, 100, 300, 400, 4, 14, 115, S_PAINE, S_DEATHE, "ratamahatta", "monster/rat", "monster/rat/vwep"}, + { GUN_RIFLE, 14, 200, 1, 80, 400, 300, 4, 18, 145, S_PAINS, S_DEATHS, "a slith", "monster/slith", "monster/slith/vwep"}, + { GUN_RL, 12, 500, 1, 0, 200, 200, 6, 24, 210, S_PAINB, S_DEATHB, "bauul", "monster/bauul", "monster/bauul/vwep"}, + { GUN_BITE, 24, 50, 3, 0, 100, 400, 1, 15, 75, S_PAINP, S_PIGGR2, "a hellpig", "monster/hellpig", NULL}, + { GUN_ICEBALL, 11, 250, 1, 0, 10, 400, 6, 18, 160, S_PAINH, S_DEATHH, "a knight", "monster/knight", "monster/knight/vwep"}, + { GUN_SLIMEBALL, 15, 100, 1, 0, 200, 400, 2, 10, 60, S_PAIND, S_DEATHD, "a goblin", "monster/goblin", "monster/goblin/vwep"}, + { GUN_GL, 22, 50, 1, 0, 200, 400, 1, 10, 40, S_PAIND, S_DEATHD, "a spider", "monster/spider", NULL }, + }; + monstertypes = _monstertypes; + + CCOMMAND(endsp, "", (monsterset *self), self->endsp(false)); + } + + void preloadmonsters() + { + loopi(NUMMONSTERTYPES) loadmodel(monstertypes[i].mdlname, -1, true); + } + + vector monsters; + + int nextmonster, spawnremain, numkilled, monstertotal, mtimestart, remain; + + bool monsterhurt; + vec monsterhurtpos; + + IVAR(skill, 1, 3, 10); + + void spawnmonster() // spawn a random monster according to freq distribution in DMSP + { + int n = rnd(TOTMFREQ), type; + for(int i = 0; ; i++) if((n -= monstertypes[i].freq)<0) { type = i; break; } + monsters.add(new monster(type, rnd(360), M_SEARCH, 1000, 1, this)); + } + + void monsterclear(int gamemode) // called after map start or when toggling edit mode to reset/spawn all monsters to initial state + { + removetrackedparticles(); + loopv(monsters) delete monsters[i]; + cleardynentcache(); + monsters.setsize(0); + numkilled = 0; + monstertotal = 0; + spawnremain = 0; + remain = 0; + monsterhurt = false; + if(m_dmsp) + { + nextmonster = mtimestart = cl.lastmillis+10000; + monstertotal = spawnremain = gamemode<0 ? skill()*10 : 0; + } + else if(m_classicsp) + { + mtimestart = cl.lastmillis; + loopv(ents) if(ents[i]->type==MONSTER) + { + monster *m = new monster(ents[i]->attr2, ents[i]->attr1, M_SLEEP, 100, 0, this); + monsters.add(m); + m->o = ents[i]->o; + entinmap(m); + updatedynentcache(m); + monstertotal++; + } + } + teleports.setsizenodelete(0); + if(m_dmsp || m_classicsp) + { + loopv(ents) if(ents[i]->type==TELEPORT) teleports.add(i); + } + } + + void endsp(bool allkilled) + { + conoutf(CON_GAMEINFO, allkilled ? "\f2you have cleared the map!" : "\f2you reached the exit!"); + monstertotal = 0; + cl.cc.addmsg(SV_FORCEINTERMISSION, "r"); + } + + void monsterkilled() + { + numkilled++; + cl.player1->frags = numkilled; + remain = monstertotal-numkilled; + if(remain>0 && remain<=5) conoutf(CON_GAMEINFO, "\f2only %d monster(s) remaining", remain); + } + + void monsterthink(int curtime, int gamemode) + { + if(m_dmsp && spawnremain && cl.lastmillis>nextmonster) + { + if(spawnremain--==monstertotal) { conoutf(CON_GAMEINFO, "\f2The invasion has begun!"); playsound(S_V_FIGHT); } + nextmonster = cl.lastmillis+1000; + spawnmonster(); + } + + if(killsendsp() && monstertotal && !spawnremain && numkilled==monstertotal) endsp(true); + + bool monsterwashurt = monsterhurt; + + loopv(monsters) + { + if(monsters[i]->state==CS_ALIVE) monsters[i]->monsteraction(curtime); + else if(monsters[i]->state==CS_DEAD) + { + if(cl.lastmillis-monsters[i]->lastpain<2000) + { + //monsters[i]->move = 0; + monsters[i]->move = monsters[i]->strafe = 0; + moveplayer(monsters[i], 1, true); + } + } + } + + if(monsterwashurt) monsterhurt = false; + } + + void monsterrender() + { + loopv(monsters) + { + monster &m = *monsters[i]; + if(m.state!=CS_DEAD || m.superdamage<50) + { + modelattach vwep[] = { { monstertypes[m.mtype].vwepname, "tag_weapon", ANIM_VWEP|ANIM_LOOP, 0 }, { NULL } }; + renderclient(&m, monstertypes[m.mtype].mdlname, vwep, m.monsterstate==M_ATTACKING ? -ANIM_SHOOT : 0, 300, m.lastaction, m.lastpain); + } + } + } +}; diff --git a/src/fpsgame/movable.h b/src/fpsgame/movable.h new file mode 100644 index 0000000..fb8d4f5 --- /dev/null +++ b/src/fpsgame/movable.h @@ -0,0 +1,168 @@ +// movable.h: implements physics for inanimate models + +struct movableset +{ + fpsclient &cl; + + enum + { + BOXWEIGHT = 25, + BARRELHEALTH = 50, + BARRELWEIGHT = 25, + PLATFORMWEIGHT = 1000, + PLATFORMSPEED = 8, + EXPLODEDELAY = 200 + }; + + struct movable : dynent + { + int etype, mapmodel, health, weight, explode, tag, dir; + movableset *ms; + + movable(const entity &e, movableset *ms) : + etype(e.type), + mapmodel(e.attr2), + health(e.type==BARREL ? (e.attr4 ? e.attr4 : BARRELHEALTH) : 0), + weight(e.type==PLATFORM || e.type==ELEVATOR ? PLATFORMWEIGHT : (e.type==e.attr3 ? e.attr3 : (e.type==BARREL ? BARRELWEIGHT : BOXWEIGHT))), + explode(0), + tag(e.type==PLATFORM || e.type==ELEVATOR ? e.attr3 : 0), + dir(e.type==PLATFORM || e.type==ELEVATOR ? (e.attr4 < 0 ? -1 : 1) : 0), + ms(ms) + { + state = CS_ALIVE; + type = ENT_INANIMATE; + yaw = float((e.attr1+7)-(e.attr1+7)%15); + if(e.type==PLATFORM || e.type==ELEVATOR) + { + maxspeed = e.attr4 ? fabs(float(e.attr4)) : PLATFORMSPEED; + if(tag) vel = vec(0, 0, 0); + else if(e.type==PLATFORM) { vecfromyawpitch(yaw, 0, 1, 0, vel); vel.mul(dir*maxspeed); } + else vel = vec(0, 0, dir*maxspeed); + } + + const char *mdlname = mapmodelname(e.attr2); + if(mdlname) setbbfrommodel(this, mdlname); + } + + void hitpush(int damage, const vec &dir, fpsent *actor, int gun) + { + if(etype!=BOX && etype!=BARREL) return; + vec push(dir); + push.mul(80*damage/weight); + vel.add(push); + moving = true; + } + + void damaged(int damage, fpsent *at, int gun = -1) + { + if(etype!=BARREL || state!=CS_ALIVE || explode) return; + health -= damage; + if(health>0) return; + if(gun==GUN_BARREL) explode = ms->cl.lastmillis + EXPLODEDELAY; + else + { + state = CS_DEAD; + ms->cl.ws.explode(true, at, o, this, guns[GUN_BARREL].damage, GUN_BARREL); + } + } + + void suicide() + { + state = CS_DEAD; + if(etype==BARREL) ms->cl.ws.explode(true, ms->cl.player1, o, this, guns[GUN_BARREL].damage, GUN_BARREL); + } + }; + + movableset(fpsclient &cl) : cl(cl) + { + CCOMMAND(platform, "ii", (movableset *self, int *tag, int *newdir), self->triggerplatform(*tag, *newdir)); + } + + vector movables; + + void clear(int gamemode) + { + if(movables.length()) + { + cleardynentcache(); + movables.deletecontentsp(); + } + if(!m_dmsp && !m_classicsp) return; + loopv(cl.et.ents) + { + const entity &e = *cl.et.ents[i]; + if(e.type!=BOX && e.type!=BARREL && e.type!=PLATFORM && e.type!=ELEVATOR) continue; + movable *m = new movable(e, this); + movables.add(m); + m->o = e.o; + entinmap(m); + updatedynentcache(m); + } + } + + void triggerplatform(int tag, int newdir) + { + newdir = max(-1, min(1, newdir)); + loopv(movables) + { + movable *m = movables[i]; + if(m->state!=CS_ALIVE || (m->etype!=PLATFORM && m->etype!=ELEVATOR) || m->tag!=tag) continue; + if(!newdir) + { + if(m->tag) m->vel = vec(0, 0, 0); + else m->vel.neg(); + } + else + { + if(m->etype==PLATFORM) { vecfromyawpitch(m->yaw, 0, 1, 0, m->vel); m->vel.mul(newdir*m->dir*m->maxspeed); } + else m->vel = vec(0, 0, newdir*m->dir*m->maxspeed); + } + } + } + + void update(int curtime) + { + if(!curtime) return; + loopv(movables) + { + movable *m = movables[i]; + if(m->state!=CS_ALIVE) continue; + if(m->etype==PLATFORM || m->etype==ELEVATOR) + { + if(m->vel.iszero()) continue; + for(int remaining = curtime; remaining>0;) + { + int step = min(remaining, 20); + remaining -= step; + if(!moveplatform(m, vec(m->vel).mul(step/1000.0f))) + { + if(m->tag) { m->vel = vec(0, 0, 0); break; } + else m->vel.neg(); + } + } + } + else if(m->explode && cl.lastmillis >= m->explode) + { + m->state = CS_DEAD; + m->explode = 0; + cl.ws.explode(true, (fpsent *)m, m->o, m, guns[GUN_BARREL].damage, GUN_BARREL); + adddecal(DECAL_SCORCH, m->o, vec(0, 0, 1), RL_DAMRAD/2); + } + else if(m->moving || (m->onplayer && (m->onplayer->state!=CS_ALIVE || m->lastmoveattempt <= m->onplayer->lastmove))) moveplayer(m, 1, true); + } + } + + void render() + { + loopv(movables) + { + movable &m = *movables[i]; + if(m.state!=CS_ALIVE) continue; + vec o(m.o); + o.z -= m.eyeheight; + const char *mdlname = mapmodelname(m.mapmodel); + if(!mdlname) continue; + rendermodel(NULL, mdlname, ANIM_MAPMODEL|ANIM_LOOP, o, m.yaw, 0, MDL_LIGHT | MDL_SHADOW | MDL_CULL_VFC | MDL_CULL_DIST | MDL_CULL_OCCLUDED, &m); + } + } +}; diff --git a/src/fpsgame/scoreboard.h b/src/fpsgame/scoreboard.h new file mode 100644 index 0000000..15e03be --- /dev/null +++ b/src/fpsgame/scoreboard.h @@ -0,0 +1,385 @@ +// creation of scoreboard + +struct scoreboard : g3d_callback +{ + bool scoreson; + vec menupos; + int menustart; + fpsclient &cl; + + IVARP(scoreboard2d, 0, 1, 1); + IVARP(showclientnum, 0, 0, 1); + IVARP(showpj, 0, 1, 1); + IVARP(showping, 0, 1, 1); + IVARP(showspectators, 0, 1, 1); + IVARP(highlightscore, 0, 1, 1); + IVARP(showconnecting, 0, 0, 1); + + scoreboard(fpsclient &_cl) : scoreson(false), cl(_cl) + { + CCOMMAND(showscores, "D", (scoreboard *self, int *down), self->showscores(*down!=0)); + } + + void showscores(bool on) + { + if(!scoreson && on) + { + menupos = menuinfrontofplayer(); + menustart = starttime(); + } + scoreson = on; + } + + struct sline { string s; }; + + struct teamscore + { + const char *team; + int score; + teamscore() {} + teamscore(const char *s, int n) : team(s), score(n) {} + }; + + static int teamscorecmp(const teamscore *x, const teamscore *y) + { + if(x->score > y->score) return -1; + if(x->score < y->score) return 1; + return strcmp(x->team, y->team); + } + + static int playersort(const fpsent **a, const fpsent **b) + { + if((*a)->state==CS_SPECTATOR) + { + if((*b)->state==CS_SPECTATOR) return strcmp((*a)->name, (*b)->name); + else return 1; + } + else if((*b)->state==CS_SPECTATOR) return -1; + if((*a)->frags > (*b)->frags) return -1; + if((*a)->frags < (*b)->frags) return 1; + return strcmp((*a)->name, (*b)->name); + } + + void bestplayers(vector &best) + { + loopi(cl.numdynents()) + { + fpsent *o = (fpsent *)cl.iterdynents(i); + if(o && o->type==ENT_PLAYER && o->state!=CS_SPECTATOR) best.add(o); + } + best.sort(playersort); + while(best.length()>1 && best.last()->frags < best[0]->frags) best.drop(); + } + + void sortteams(vector &teamscores) + { + int gamemode = cl.gamemode; + if(m_capture) + { + loopv(cl.cpc.scores) teamscores.add(teamscore(cl.cpc.scores[i].team, cl.cpc.scores[i].total)); + } + else if(m_ctf) + { + loopv(cl.ctf.flags) if(cl.ctf.flags[i].score) + { + const char *team = ctfflagteam(cl.ctf.flags[i].team); + if(!team) continue; + teamscore *ts = NULL; + loopv(teamscores) if(!strcmp(teamscores[i].team, team)) { ts = &teamscores[i]; break; } + if(!ts) teamscores.add(teamscore(team, cl.ctf.flags[i].score)); + else ts->score += cl.ctf.flags[i].score; + } + } + + loopi(cl.numdynents()) + { + fpsent *o = (fpsent *)cl.iterdynents(i); + if(o && o->type==ENT_PLAYER) + { + teamscore *ts = NULL; + loopv(teamscores) if(!strcmp(teamscores[i].team, o->team)) { ts = &teamscores[i]; break; } + if(!ts) teamscores.add(teamscore(o->team, m_capture || m_ctf ? 0 : o->frags)); + else if(!m_capture && !m_ctf) ts->score += o->frags; + } + } + teamscores.sort(teamscorecmp); + } + + void bestteams(vector &best) + { + vector teamscores; + sortteams(teamscores); + while(teamscores.length()>1 && teamscores.last().score < teamscores[0].score) teamscores.drop(); + loopv(teamscores) best.add(teamscores[i].team); + } + + struct scoregroup : teamscore + { + vector players; + }; + vector groups; + vector spectators; + + static int scoregroupcmp(const scoregroup **x, const scoregroup **y) + { + if(!(*x)->team) + { + if((*y)->team) return 1; + } + else if(!(*y)->team) return -1; + if((*x)->score > (*y)->score) return -1; + if((*x)->score < (*y)->score) return 1; + if((*x)->players.length() > (*y)->players.length()) return -1; + if((*x)->players.length() < (*y)->players.length()) return 1; + return (*x)->team && (*y)->team ? strcmp((*x)->team, (*y)->team) : 0; + } + + int groupplayers() + { + int gamemode = cl.gamemode, numgroups = 0; + spectators.setsize(0); + loopi(cl.numdynents()) + { + fpsent *o = (fpsent *)cl.iterdynents(i); + if(!o || o->type!=ENT_PLAYER || (!showconnecting() && !o->name[0])) continue; + if(o->state==CS_SPECTATOR) { spectators.add(o); continue; } + const char *team = m_teammode && o->team[0] ? o->team : NULL; + bool found = false; + loopj(numgroups) + { + scoregroup &g = *groups[j]; + if(team!=g.team && (!team || !g.team || strcmp(team, g.team))) continue; + if(team && !m_capture && !m_ctf) g.score += o->frags; + g.players.add(o); + found = true; + } + if(found) continue; + if(numgroups>=groups.length()) groups.add(new scoregroup); + scoregroup &g = *groups[numgroups++]; + g.team = team; + if(!team) g.score = 0; + else if(m_capture) g.score = cl.cpc.findscore(o->team).total; + else if(m_ctf) + { + g.score = 0; + loopv(cl.ctf.flags) if(cl.ctf.flags[i].team==ctfteamflag(o->team)) g.score += cl.ctf.flags[i].score; + } + else g.score = o->frags; + g.players.setsize(0); + g.players.add(o); + } + loopi(numgroups) groups[i]->players.sort(playersort); + spectators.sort(playersort); + groups.sort(scoregroupcmp, 0, numgroups); + return numgroups; + } + + void gui(g3d_gui &g, bool firstpass) + { + g.start(menustart, 0.03f, NULL, false); + + int gamemode = cl.gamemode; + s_sprintfd(modemapstr)("%s: %s", fpsserver::modestr(gamemode), cl.getclientmap()[0] ? cl.getclientmap() : "[new map]"); + if((gamemode>1 || (gamemode==0 && (multiplayer(false) || cl.cc.demoplayback))) && cl.minremain >= 0) + { + if(!cl.minremain) s_strcat(modemapstr, ", intermission"); + else + { + s_sprintfd(timestr)(", %d %s remaining", cl.minremain, cl.minremain==1 ? "minute" : "minutes"); + s_strcat(modemapstr, timestr); + } + } + g.text(modemapstr, 0xFFFF80, "server"); + + const playermodelinfo &mdl = cl.fr.getplayermodelinfo(); + int numgroups = groupplayers(); + loopk(numgroups) + { + if((k%2)==0) g.pushlist(); // horizontal + + scoregroup &sg = *groups[k]; + const char *icon = sg.team && m_teammode ? (isteam(cl.player1->team, sg.team) ? mdl.blueicon : mdl.redicon) : mdl.ffaicon; + int bgcolor = sg.team && m_teammode ? (isteam(cl.player1->team, sg.team) ? 0x3030C0 : 0xC03030) : 0, + fgcolor = 0xFFFF80; + + g.pushlist(); // vertical + g.pushlist(); // horizontal + + #define loopscoregroup(o, b) \ + loopv(sg.players) \ + { \ + fpsent *o = sg.players[i]; \ + b; \ + } + + g.pushlist(); + if(sg.team && m_teammode) + { + g.pushlist(); + g.background(bgcolor, numgroups>1 ? 3 : 5); + g.strut(1); + g.poplist(); + } + g.text("", 0, "server"); + loopscoregroup(o, + { + if(o==cl.player1 && highlightscore() && (multiplayer(false) || cl.cc.demoplayback)) + { + g.pushlist(); + g.background(0x808080, numgroups>1 ? 3 : 5); + } + const char *oicon = icon; + if(m_assassin) + { + if(cl.asc.targets.find(o)>=0) oicon = mdl.redicon; + else if(cl.asc.hunters.find(o)>=0) oicon = mdl.ffaicon; + else oicon = mdl.blueicon; + } + g.text("", 0, oicon); + if(o==cl.player1 && highlightscore() && (multiplayer(false) || cl.cc.demoplayback)) g.poplist(); + }); + g.poplist(); + + if(sg.team && m_teammode) + { + g.pushlist(); // vertical + + if(m_capture && sg.score>=10000) g.textf("%s: WIN", fgcolor, NULL, sg.team); + else g.textf("%s: %d", fgcolor, NULL, sg.team, sg.score); + + g.pushlist(); // horizontal + } + + if(!m_capture && !m_ctf) + { + g.pushlist(); + g.strut(7); + g.text("frags", fgcolor); + loopscoregroup(o, g.textf("%d", 0xFFFFDD, NULL, o->frags)); + g.poplist(); + } + + if(multiplayer(false) || cl.cc.demoplayback) + { + if(showpj()) + { + g.pushlist(); + g.strut(6); + g.text("pj", fgcolor); + loopscoregroup(o, + { + if(o->state==CS_LAGGED) g.text("LAG", 0xFFFFDD); + else g.textf("%d", 0xFFFFDD, NULL, o->plag); + }); + g.poplist(); + } + + if(showping()) + { + g.pushlist(); + g.text("ping", fgcolor); + g.strut(6); + loopscoregroup(o, g.textf("%d", 0xFFFFDD, NULL, o->ping)); + g.poplist(); + } + } + + g.pushlist(); + g.text("name", fgcolor); + loopscoregroup(o, + { + int status = 0xFFFFDD; + if(o->privilege) status = o->privilege>=PRIV_ADMIN ? 0xFF8000 : 0x40FF80; + else if(o->state==CS_DEAD) status = 0x606060; + g.text(cl.colorname(o), status); + }); + g.poplist(); + + if(showclientnum() || cl.player1->privilege>=PRIV_MASTER) + { + g.space(1); + g.pushlist(); + g.text("cn", fgcolor); + loopscoregroup(o, g.textf("%d", 0xFFFFDD, NULL, o->clientnum)); + g.poplist(); + } + + if(sg.team && m_teammode) + { + g.poplist(); // horizontal + g.poplist(); // vertical + } + + g.poplist(); // horizontal + g.poplist(); // vertical + + if(k+1privilege>=PRIV_MASTER) + { + g.pushlist(); + + g.pushlist(); + g.text("spectator", 0xFFFF80, "server"); + loopv(spectators) + { + fpsent *o = spectators[i]; + if(o==cl.player1 && highlightscore()) + { + g.pushlist(); + g.background(0x808080, 3); + } + g.text(cl.colorname(o), 0xFFFFDD, mdl.ffaicon); + if(o==cl.player1 && highlightscore()) g.poplist(); + } + g.poplist(); + + g.space(1); + g.pushlist(); + g.text("cn", 0xFFFF80); + loopv(spectators) g.textf("%d", 0xFFFFDD, NULL, spectators[i]->clientnum); + g.poplist(); + + g.poplist(); + } + else + { + g.textf("%d spectator%s", 0xFFFF80, "server", spectators.length(), spectators.length()!=1 ? "s" : ""); + loopv(spectators) + { + if((i%3)==0) + { + g.pushlist(); + g.text("", 0xFFFFDD, mdl.ffaicon); + } + fpsent *o = spectators[i]; + int status = 0xFFFFDD; + if(o->privilege) status = o->privilege>=PRIV_ADMIN ? 0xFF8000 : 0x40FF80; + if(o==cl.player1 && highlightscore()) + { + g.pushlist(); + g.background(0x808080); + } + g.text(cl.colorname(o), status); + if(o==cl.player1 && highlightscore()) g.poplist(); + if(i+1player1->gunselect)); + CCOMMAND(nextweapon, "ii", (weaponstate *self, int *dir, int *force), self->nextweapon(*dir, *force!=0)); + CCOMMAND(setweapon, "ii", (weaponstate *self, int *gun, int *force), self->setweapon(*gun, *force!=0)); + CCOMMAND(cycleweapon, "sssss", (weaponstate *self, char *w1, char *w2, char *w3, char *w4, char *w5), + { + int numguns = 0; + int guns[5]; + if(w1[0]) guns[numguns++] = atoi(w1); + if(w2[0]) guns[numguns++] = atoi(w2); + if(w3[0]) guns[numguns++] = atoi(w3); + if(w4[0]) guns[numguns++] = atoi(w4); + if(w5[0]) guns[numguns++] = atoi(w5); + + self->cycleweapon(numguns, guns); + }); + CCOMMAND(weapon, "sss", (weaponstate *self, char *w1, char *w2, char *w3), + { + self->weaponswitch(w1[0] ? atoi(w1) : -1, + w2[0] ? atoi(w2) : -1, + w3[0] ? atoi(w3) : -1); + + }); + } + + void gunselect(int gun) + { + if(gun!=player1->gunselect) + { + cl.cc.addmsg(SV_GUNSELECT, "ri", gun); + playsound(S_WEAPLOAD, &player1->o); + } + player1->gunselect = gun; + } + + void nextweapon(int dir, bool force = false) + { + if(player1->state!=CS_ALIVE) return; + dir = (dir < 0 ? NUMGUNS-1 : 1); + int gun = player1->gunselect; + loopi(NUMGUNS) + { + gun = (gun + dir)%NUMGUNS; + if(force || player1->ammo[gun]) break; + } + if(gun != player1->gunselect) gunselect(gun); + else playsound(S_NOAMMO); + } + + void setweapon(int gun, bool force = false) + { + if(player1->state!=CS_ALIVE || gunGUN_PISTOL) return; + if(force || player1->ammo[gun]) gunselect(gun); + else playsound(S_NOAMMO); + } + + void cycleweapon(int numguns, int *guns, bool force = false) + { + if(numguns<=0 || player1->state!=CS_ALIVE) return; + int offset = 0; + loopi(numguns) if(guns[i] == player1->gunselect) { offset = i+1; break; } + loopi(numguns) + { + int gun = guns[(i+offset)%numguns]; + if(gun>=0 && gunammo[gun])) + { + gunselect(gun); + return; + } + } + playsound(S_NOAMMO); + } + + void weaponswitch(int a = -1, int b = -1, int c = -1) + { + if(player1->state!=CS_ALIVE || a<-1 || b<-1 || c<-1 || a>=NUMGUNS || b>=NUMGUNS || c>=NUMGUNS) return; + int *ammo = player1->ammo; + int s = player1->gunselect; + + if (a>=0 && s!=a && ammo[a]) s = a; + else if(b>=0 && s!=b && ammo[b]) s = b; + else if(c>=0 && s!=c && ammo[c]) s = c; + else if(s!=GUN_CG && ammo[GUN_CG]) s = GUN_CG; + else if(s!=GUN_RL && ammo[GUN_RL]) s = GUN_RL; + else if(s!=GUN_SG && ammo[GUN_SG]) s = GUN_SG; + else if(s!=GUN_RIFLE && ammo[GUN_RIFLE]) s = GUN_RIFLE; + else if(s!=GUN_GL && ammo[GUN_GL]) s = GUN_GL; + else if(s!=GUN_PISTOL && ammo[GUN_PISTOL]) s = GUN_PISTOL; + else s = GUN_FIST; + + gunselect(s); + } + + int reloadtime(int gun) { return guns[gun].attackdelay; } + + void offsetray(vec &from, vec &to, int spread, vec &dest) + { + float f = to.dist(from)*spread/1000; + for(;;) + { + #define RNDD rnd(101)-50 + vec v(RNDD, RNDD, RNDD); + if(v.magnitude()>50) continue; + v.mul(f); + v.z /= 2; + dest = to; + dest.add(v); + vec dir = dest; + dir.sub(from); + dir.normalize(); + raycubepos(from, dir, dest, 0, RAY_CLIPMAT|RAY_ALPHAPOLY); + return; + } + } + + void createrays(vec &from, vec &to) // create random spread of rays for the shotgun + { + loopi(SGRAYS) offsetray(from, to, SGSPREAD, sg[i]); + } + + enum { BNC_GRENADE, BNC_GIBS, BNC_DEBRIS, BNC_BARRELDEBRIS }; + + struct bouncent : physent + { + int lifetime; + float lastyaw, roll; + bool local; + fpsent *owner; + int bouncetype; + vec offset; + int offsetmillis; + int id; + entitylight light; + }; + + vector bouncers; + + void newbouncer(const vec &from, const vec &to, bool local, fpsent *owner, int type, int lifetime, int speed, entitylight *light = NULL) + { + bouncent &bnc = *(bouncers.add(new bouncent)); + bnc.reset(); + bnc.type = ENT_BOUNCE; + bnc.o = from; + bnc.radius = type==BNC_DEBRIS ? 0.5f : 1.5f; + bnc.eyeheight = bnc.radius; + bnc.aboveeye = bnc.radius; + bnc.lifetime = lifetime; + bnc.roll = 0; + bnc.local = local; + bnc.owner = owner; + bnc.bouncetype = type; + bnc.id = cl.lastmillis; + if(light) bnc.light = *light; + + vec dir(to); + dir.sub(from).normalize(); + bnc.vel = dir; + bnc.vel.mul(speed); + + avoidcollision(&bnc, dir, owner, 0.1f); + + bnc.offset = hudgunorigin(type==BNC_GRENADE ? GUN_GL : -1, from, to, owner); + bnc.offset.sub(bnc.o); + bnc.offsetmillis = OFFSETMILLIS; + + bnc.resetinterp(); + } + + void bounceupdate(int time) + { + loopv(bouncers) + { + bouncent &bnc = *(bouncers[i]); + if(bnc.bouncetype==BNC_GRENADE && bnc.vel.magnitude() > 50.0f) + { + vec pos(bnc.o); + pos.add(vec(bnc.offset).mul(bnc.offsetmillis/float(OFFSETMILLIS))); + regular_particle_splash(5, 1, 150, pos); + } + vec old(bnc.o); + bool stopped = false; + if(bnc.bouncetype==BNC_GRENADE) stopped = bounce(&bnc, 0.6f, 0.5f) || (bnc.lifetime -= time)<0; + else + { + // cheaper variable rate physics for debris, gibs, etc. + for(int rtime = time; rtime > 0;) + { + int qtime = min(30, rtime); + rtime -= qtime; + if((bnc.lifetime -= qtime)<0 || bounce(&bnc, qtime/1000.0f, 0.6f, 0.5f)) { stopped = true; break; } + } + } + if(stopped) + { + if(bnc.bouncetype==BNC_GRENADE) + { + int qdam = guns[GUN_GL].damage*(bnc.owner->quadmillis ? 4 : 1); + if(bnc.owner->type==ENT_AI) qdam /= MONSTERDAMAGEFACTOR; + hits.setsizenodelete(0); + explode(bnc.local, bnc.owner, bnc.o, NULL, qdam, GUN_GL); + adddecal(DECAL_SCORCH, bnc.o, vec(0, 0, 1), RL_DAMRAD/2); + if(bnc.local) + cl.cc.addmsg(SV_EXPLODE, "ri3iv", cl.lastmillis-cl.maptime, GUN_GL, bnc.id-cl.maptime, + hits.length(), hits.length()*sizeof(hitmsg)/sizeof(int), hits.getbuf()); + } + delete &bnc; + bouncers.remove(i--); + } + else + { + bnc.roll += old.sub(bnc.o).magnitude()/(4*RAD); + bnc.offsetmillis = max(bnc.offsetmillis-time, 0); + } + } + } + + void removebouncers(fpsent *owner) + { + loopv(bouncers) if(bouncers[i]->owner==owner) { delete bouncers[i]; bouncers.remove(i--); } + } + + struct projectile + { + vec dir, o, to, offset; + float speed; + fpsent *owner; + int gun; + bool local; + int offsetmillis; + int id; + entitylight light; + }; + vector projs; + + void projreset() { projs.setsize(0); bouncers.deletecontentsp(); bouncers.setsize(0); } + + void newprojectile(const vec &from, const vec &to, float speed, bool local, fpsent *owner, int gun) + { + projectile &p = projs.add(); + p.dir = vec(to).sub(from).normalize(); + p.o = from; + p.to = to; + p.offset = hudgunorigin(gun, from, to, owner); + p.offset.sub(from); + p.speed = speed; + p.local = local; + p.owner = owner; + p.gun = gun; + p.offsetmillis = OFFSETMILLIS; + p.id = cl.lastmillis; + } + + void removeprojectiles(fpsent *owner) + { + loopv(projs) if(projs[i].owner==owner) projs.remove(i--); + } + + IVARP(blood, 0, 1, 1); + + void damageeffect(int damage, fpsent *d, bool thirdperson = true) + { + vec p = d->o; + p.z += 0.6f*(d->eyeheight + d->aboveeye) - d->eyeheight; + if(blood()) particle_splash(3, damage/10, 1000, p); + if(thirdperson) + { + s_sprintfd(ds)("@%d", damage); + particle_text(d->abovehead(), ds, 8); + } + } + + void spawnbouncer(vec &p, vec &vel, fpsent *d, int type, entitylight *light = NULL) + { + vec to(rnd(100)-50, rnd(100)-50, rnd(100)-50); + to.normalize(); + to.add(p); + newbouncer(p, to, true, d, type, rnd(1000)+1000, rnd(100)+20, light); + } + + void superdamageeffect(vec &vel, fpsent *d) + { + if(!d->superdamage) return; + vec from = d->abovehead(); + from.y -= 16; + loopi(min(d->superdamage/25, 40)+1) spawnbouncer(from, vel, d, BNC_GIBS); + } + + struct hitmsg + { + int target, lifesequence, info; + ivec dir; + }; + vector hits; + + void hit(int damage, dynent *d, fpsent *at, const vec &vel, int gun, int info = 1) + { + if(at==player1 && d!=player1) cl.lasthit = cl.lastmillis; + + if(d->type==ENT_INANIMATE) + { + movableset::movable *m = (movableset::movable *)d; + m->hitpush(damage, vel, at, gun); + m->damaged(damage, at, gun); + return; + } + + fpsent *f = (fpsent *)d; + + f->lastpain = cl.lastmillis; + if(at->type==ENT_PLAYER) at->totaldamage += damage; + f->superdamage = 0; + + if(f->type==ENT_AI || !m_mp(cl.gamemode) || f==player1) f->hitpush(damage, vel, at, gun); + + if(f->type==ENT_AI) ((monsterset::monster *)f)->monsterpain(damage, at); + else if(!m_mp(cl.gamemode)) cl.damaged(damage, f, at); + else + { + hitmsg &h = hits.add(); + h.target = f->clientnum; + h.lifesequence = f->lifesequence; + h.info = info; + damageeffect(damage, f); + if(f==player1) + { + h.dir = ivec(0, 0, 0); + f->damageroll(damage); + damageblend(damage); + damagecompass(damage, at ? at->o : f->o); + playsound(S_PAIN6); + } + else + { + h.dir = ivec(int(vel.x*DNF), int(vel.y*DNF), int(vel.z*DNF)); + playsound(S_PAIN1+rnd(5), &f->o); + } + } + } + + void hitpush(int damage, dynent *d, fpsent *at, vec &from, vec &to, int gun, int rays) + { + vec v(to); + v.sub(from); + v.normalize(); + hit(damage, d, at, v, gun, rays); + } + + void radialeffect(dynent *o, vec &v, int qdam, fpsent *at, int gun) + { + if(o->state!=CS_ALIVE) return; + vec dir; + float dist = rocketdist(o, dir, v); + if(disto; + middle.z += (o->aboveeye-o->eyeheight)/2; + float dist = middle.dist(v, dir); + dir.div(dist); + if(dist<0) dist = 0; + return dist; + } + + void explode(bool local, fpsent *owner, vec &v, dynent *notthis, int qdam, int gun) + { + particle_splash(0, 200, 300, v); + playsound(S_RLHIT, &v); + particle_fireball(v, RL_DAMRAD, gun==GUN_RL || gun==GUN_BARREL ? 22 : 23); + if(gun==GUN_RL) adddynlight(v, 1.15f*RL_DAMRAD, vec(2, 1.5f, 1), 900, 100, 0, RL_DAMRAD/2, vec(1, 0.75f, 0.5f)); + else if(gun==GUN_GL) adddynlight(v, 1.15f*RL_DAMRAD, vec(2, 1.5f, 1), 900, 100, 0, 8, vec(0.25f, 1, 1)); + else adddynlight(v, 1.15f*RL_DAMRAD, vec(2, 1.5f, 1), 900, 100); + int numdebris = gun==GUN_BARREL ? rnd(max(maxbarreldebris()-5, 1))+5 : rnd(maxdebris()-5)+5; + vec debrisvel = owner->o==v ? vec(0, 0, 0) : vec(owner->o).sub(v).normalize(), debrisorigin(v); + if(gun==GUN_RL) debrisorigin.add(vec(debrisvel).mul(8)); + if(numdebris) + { + entitylight light; + lightreaching(debrisorigin, light.color, light.dir); + loopi(numdebris) + spawnbouncer(debrisorigin, debrisvel, owner, gun==GUN_BARREL ? BNC_BARRELDEBRIS : BNC_DEBRIS, &light); + } + if(!local) return; + loopi(cl.numdynents()) + { + dynent *o = cl.iterdynents(i); + if(!o || o==notthis) continue; + radialeffect(o, v, qdam, owner, gun); + } + } + + void splash(projectile &p, vec &v, dynent *notthis, int qdam) + { + if(guns[p.gun].part) + { + particle_splash(0, 100, 200, v); + playsound(S_FEXPLODE, &v); + // no push? + } + else + { + explode(p.local, p.owner, v, notthis, qdam, GUN_RL); + adddecal(DECAL_SCORCH, v, vec(p.dir).neg(), RL_DAMRAD/2); + } + } + + bool projdamage(dynent *o, projectile &p, vec &v, int qdam) + { + if(o->state!=CS_ALIVE) return false; + if(!intersect(o, p.o, v)) return false; + splash(p, v, o, qdam); + vec dir; + if(guns[p.gun].part) { dir = v; dir.normalize(); } + else rocketdist(o, dir, v); + hit(qdam, o, p.owner, dir, p.gun, 0); + return true; + } + + void moveprojectiles(int time) + { + loopv(projs) + { + projectile &p = projs[i]; + p.offsetmillis = max(p.offsetmillis-time, 0); + int qdam = guns[p.gun].damage*(p.owner->quadmillis ? 4 : 1); + if(p.owner->type==ENT_AI) qdam /= MONSTERDAMAGEFACTOR; + vec v; + float dist = p.to.dist(p.o, v); + float dtime = dist*1000/p.speed; + if(time > dtime) dtime = time; + v.mul(time/dtime); + v.add(p.o); + bool exploded = false; + hits.setsizenodelete(0); + if(p.local) + { + loopj(cl.numdynents()) + { + dynent *o = cl.iterdynents(j); + if(!o || p.owner==o || o->o.reject(v, 10.0f)) continue; + if(projdamage(o, p, v, qdam)) { exploded = true; break; } + } + } + if(!exploded) + { + if(dist<4) + { + if(p.o!=p.to) // if original target was moving, reevaluate endpoint + { + if(raycubepos(p.o, p.dir, p.to, 0, RAY_CLIPMAT|RAY_ALPHAPOLY)>=4) continue; + } + splash(p, v, NULL, qdam); + exploded = true; + } + else + { + vec pos(v); + pos.add(vec(p.offset).mul(p.offsetmillis/float(OFFSETMILLIS))); + if(guns[p.gun].part) + { + regular_particle_splash(1, 2, 300, pos); + particle_splash(guns[p.gun].part, 1, 1, pos); + } + else + { + regular_particle_splash(5, 2, 300, pos); + } + } + } + if(exploded) + { + if(p.local) + cl.cc.addmsg(SV_EXPLODE, "ri3iv", cl.lastmillis-cl.maptime, p.gun, p.id-cl.maptime, + hits.length(), hits.length()*sizeof(hitmsg)/sizeof(int), hits.getbuf()); + projs.remove(i--); + } + else p.o = v; + } + } + + vec hudgunorigin(int gun, const vec &from, const vec &to, fpsent *d) + { + vec offset(from); + if(d!=cl.hudplayer() || isthirdperson()) + { + vec front, right; + vecfromyawpitch(d->yaw, d->pitch, 1, 0, front); + offset.add(front.mul(d->radius)); + if(d->type!=ENT_AI) + { + offset.z += (d->aboveeye + d->eyeheight)*0.75f - d->eyeheight; + vecfromyawpitch(d->yaw, 0, 0, -1, right); + offset.add(right.mul(0.5f*d->radius)); + offset.add(front); + } + return offset; + } + offset.add(vec(to).sub(from).normalize().mul(2)); + if(cl.hudgun()) + { + offset.sub(vec(camup).mul(1.0f)); + offset.add(vec(camright).mul(0.8f)); + } + return offset; + } + + void shootv(int gun, vec &from, vec &to, fpsent *d, bool local) // create visual effect from a shot + { + playsound(guns[gun].sound, d==player1 ? NULL : &d->o); + int pspeed = 25; + switch(gun) + { + case GUN_FIST: + break; + + case GUN_SG: + { + loopi(SGRAYS) + { + particle_splash(0, 20, 250, sg[i]); + particle_flare(hudgunorigin(gun, from, sg[i], d), sg[i], 300, 10); + if(!local) adddecal(DECAL_BULLET, sg[i], vec(from).sub(sg[i]).normalize(), 2.0f); + } + break; + } + + case GUN_CG: + case GUN_PISTOL: + { + particle_splash(0, 200, 250, to); + //particle_trail(1, 10, from, to); + particle_flare(hudgunorigin(gun, from, to, d), to, 600, 10); + if(!local) adddecal(DECAL_BULLET, to, vec(from).sub(to).normalize(), 2.0f); + //if(gun==GUN_CG) adddynlight(hudgunorigin(gun, d->o, to, d), 30, vec(1, 0.75f, 0.5f), 50, 0, DL_FLASH); + break; + } + + case GUN_RL: + case GUN_FIREBALL: + case GUN_ICEBALL: + case GUN_SLIMEBALL: + pspeed = guns[gun].projspeed*4; + if(d->type==ENT_AI) pspeed /= 2; + newprojectile(from, to, (float)pspeed, local, d, gun); + break; + + case GUN_GL: + { + float dist = from.dist(to); + vec up = to; + up.z += dist/8; + newbouncer(from, up, local, d, BNC_GRENADE, 2000, 200); + break; + } + + case GUN_RIFLE: + particle_splash(0, 200, 250, to); + particle_trail(21, 500, hudgunorigin(gun, from, to, d), to); + if(!local) adddecal(DECAL_BULLET, to, vec(from).sub(to).normalize(), 3.0f); + break; + } + } + + dynent *intersectclosest(vec &from, vec &to, fpsent *at) + { + dynent *best = NULL; + float bestdist = 1e16f; + loopi(cl.numdynents()) + { + dynent *o = cl.iterdynents(i); + if(!o || o==at || o->state!=CS_ALIVE) continue; + if(!intersect(o, from, to)) continue; + float dist = at->o.dist(o->o); + if(distgunselect].damage; + if(d->quadmillis) qdam *= 4; + if(d->type==ENT_AI) qdam /= MONSTERDAMAGEFACTOR; + dynent *o, *cl; + if(d->gunselect==GUN_SG) + { + bool done[SGRAYS]; + loopj(SGRAYS) done[j] = false; + for(;;) + { + bool raysleft = false; + int hitrays = 0; + o = NULL; + loop(r, SGRAYS) if(!done[r] && (cl = intersectclosest(from, sg[r], d))) + { + if((!o || o==cl) /*&& (damagehealth+cl->armour || cl->type!=ENT_AI)*/) + { + hitrays++; + o = cl; + done[r] = true; + shorten(from, o->o, sg[r]); + } + else raysleft = true; + } + if(hitrays) hitpush(hitrays*qdam, o, d, from, to, d->gunselect, hitrays); + if(!raysleft) break; + } + loopj(SGRAYS) if(!done[j]) adddecal(DECAL_BULLET, sg[j], vec(from).sub(sg[j]).normalize(), 2.0f); + } + else if((o = intersectclosest(from, to, d))) + { + hitpush(qdam, o, d, from, to, d->gunselect, 1); + shorten(from, o->o, to); + } + else if(d->gunselect!=GUN_FIST && d->gunselect!=GUN_BITE) adddecal(DECAL_BULLET, to, vec(from).sub(to).normalize(), d->gunselect==GUN_RIFLE ? 3.0f : 2.0f); + } + + void shoot(fpsent *d, vec &targ) + { + int attacktime = cl.lastmillis-d->lastaction; + if(attacktimegunwait) return; + d->gunwait = 0; + if(d==player1 && !d->attacking) return; + d->lastaction = cl.lastmillis; + d->lastattackgun = d->gunselect; + if(!d->ammo[d->gunselect]) + { + if(d==player1) + { + cl.playsoundc(S_NOAMMO, d); + d->gunwait = 600; + d->lastattackgun = -1; + weaponswitch(); + } + return; + } + if(d->gunselect) d->ammo[d->gunselect]--; + vec from = d->o; + vec to = targ; + + vec unitv; + float dist = to.dist(from, unitv); + unitv.div(dist); + vec kickback(unitv); + kickback.mul(guns[d->gunselect].kickamount*-2.5f); + d->vel.add(kickback); + if(d->pitch<80.0f) d->pitch += guns[d->gunselect].kickamount*0.05f; + float shorten = 0; + if(guns[d->gunselect].range && dist > guns[d->gunselect].range) + shorten = guns[d->gunselect].range; + float barrier = raycube(d->o, unitv, dist, RAY_CLIPMAT|RAY_ALPHAPOLY); + if(barrier < dist && (!shorten || barrier < shorten)) + shorten = barrier; + if(shorten) + { + to = unitv; + to.mul(shorten); + to.add(from); + } + + if(d->gunselect==GUN_SG) createrays(from, to); + else if(d->gunselect==GUN_CG) offsetray(from, to, 1, to); + + if(d->quadmillis && attacktime>200) cl.playsoundc(S_ITEMPUP, d); + + hits.setsizenodelete(0); + + if(!guns[d->gunselect].projspeed) raydamage(from, to, d); + + shootv(d->gunselect, from, to, d, true); + + if(d==player1) + { + cl.cc.addmsg(SV_SHOOT, "ri2i6iv", cl.lastmillis-cl.maptime, d->gunselect, + (int)(from.x*DMF), (int)(from.y*DMF), (int)(from.z*DMF), + (int)(to.x*DMF), (int)(to.y*DMF), (int)(to.z*DMF), + hits.length(), hits.length()*sizeof(hitmsg)/sizeof(int), hits.getbuf()); + } + + d->gunwait = guns[d->gunselect].attackdelay; + + d->totalshots += guns[d->gunselect].damage*(d->quadmillis ? 4 : 1)*(d->gunselect==GUN_SG ? SGRAYS : 1); + } + + void adddynlights() + { + loopv(projs) + { + projectile &p = projs[i]; + if(p.gun!=GUN_RL) continue; + vec pos(p.o); + pos.add(vec(p.offset).mul(p.offsetmillis/float(OFFSETMILLIS))); + adddynlight(pos, RL_DAMRAD/2, vec(1, 0.75f, 0.5f)); + } + loopv(bouncers) + { + bouncent &bnc = *bouncers[i]; + if(bnc.bouncetype!=BNC_GRENADE) continue; + vec pos(bnc.o); + pos.add(vec(bnc.offset).mul(bnc.offsetmillis/float(OFFSETMILLIS))); + adddynlight(pos, 8, vec(0.25f, 1, 1)); + } + } + + void renderprojectiles() + { + float yaw, pitch; + loopv(bouncers) + { + bouncent &bnc = *(bouncers[i]); + vec pos(bnc.o); + pos.add(vec(bnc.offset).mul(bnc.offsetmillis/float(OFFSETMILLIS))); + vec vel(bnc.vel); + if(vel.magnitude() <= 25.0f) yaw = bnc.lastyaw; + else + { + vectoyawpitch(vel, yaw, pitch); + yaw += 90; + bnc.lastyaw = yaw; + } + pitch = -bnc.roll; + const char *mdl = "projectiles/grenade"; + string debrisname; + int cull = MDL_CULL_VFC|MDL_CULL_DIST|MDL_CULL_OCCLUDED; + if(bnc.bouncetype==BNC_GIBS) { mdl = ((int)(size_t)&bnc)&0x40 ? "gibc" : "gibh"; cull |= MDL_LIGHT|MDL_DYNSHADOW; } + else if(bnc.bouncetype==BNC_DEBRIS) { s_sprintf(debrisname)("debris/debris0%d", ((((int)(size_t)&bnc)&0xC0)>>6)+1); mdl = debrisname; } + else if(bnc.bouncetype==BNC_BARRELDEBRIS) { s_sprintf(debrisname)("barreldebris/debris0%d", ((((int)(size_t)&bnc)&0xC0)>>6)+1); mdl = debrisname; } + else { cull |= MDL_LIGHT|MDL_DYNSHADOW; cull &= ~MDL_CULL_DIST; } + rendermodel(&bnc.light, mdl, ANIM_MAPMODEL|ANIM_LOOP, pos, yaw, pitch, cull); + } + loopv(projs) + { + projectile &p = projs[i]; + if(p.gun!=GUN_RL) continue; + vec pos(p.o); + pos.add(vec(p.offset).mul(p.offsetmillis/float(OFFSETMILLIS))); + if(p.to==pos) continue; + vec v(p.to); + v.sub(pos); + v.normalize(); + // the amount of distance in front of the smoke trail needs to change if the model does + vectoyawpitch(v, yaw, pitch); + yaw += 90; + v.mul(3); + v.add(pos); + rendermodel(&p.light, "projectiles/rocket", ANIM_MAPMODEL|ANIM_LOOP, v, yaw, pitch, MDL_CULL_VFC|MDL_CULL_OCCLUDED|MDL_LIGHT); + } + } +}; diff --git a/src/include/CVS/Entries b/src/include/CVS/Entries new file mode 100644 index 0000000..cb725db --- /dev/null +++ b/src/include/CVS/Entries @@ -0,0 +1,41 @@ +/SDL.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_active.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_audio.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_byteorder.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_cdrom.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_config.h/1.2/Sun Aug 12 09:32:55 2007// +/SDL_config_macosx.h/1.2/Sun Aug 12 09:32:55 2007// +/SDL_config_win32.h/1.2/Sun Aug 12 09:32:55 2007// +/SDL_copying.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_cpuinfo.h/1.1/Fri Jul 7 17:44:10 2006// +/SDL_endian.h/1.3/Sun Aug 12 09:32:55 2007// +/SDL_error.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_events.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_getenv.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_image.h/1.3/Sun Aug 12 09:34:17 2007// +/SDL_joystick.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_keyboard.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_keysym.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_loadso.h/1.1/Fri Jul 7 17:44:10 2006// +/SDL_main.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_mixer.h/1.2/Sun Aug 12 09:32:55 2007// +/SDL_mouse.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_mutex.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_name.h/1.1/Tue Mar 7 06:02:11 2006// +/SDL_opengl.h/1.4/Wed Jan 16 14:22:21 2008// +/SDL_platform.h/1.2/Sun Aug 12 09:32:56 2007// +/SDL_quit.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_rwops.h/1.3/Sun Aug 12 09:32:56 2007// +/SDL_stdinc.h/1.2/Sun Aug 12 09:32:56 2007// +/SDL_syswm.h/1.3/Sun Aug 12 09:32:56 2007// +/SDL_thread.h/1.3/Sun Aug 12 09:32:56 2007// +/SDL_timer.h/1.2/Fri Jul 7 17:44:09 2006// +/SDL_types.h/1.2/Fri Jul 7 17:44:10 2006// +/SDL_version.h/1.3/Sun Aug 12 09:32:56 2007// +/SDL_video.h/1.3/Sun Aug 12 09:32:56 2007// +/begin_code.h/1.3/Sun Aug 12 09:32:56 2007// +/close_code.h/1.2/Fri Jul 7 17:44:10 2006// +/wincompat.h/1.1/Tue Mar 7 06:02:11 2006// +/zconf.h/1.2/Mon Sep 11 19:19:13 2006// +/zlib.h/1.2/Mon Sep 11 19:19:13 2006// +D/GL//// diff --git a/src/include/CVS/Repository b/src/include/CVS/Repository new file mode 100644 index 0000000..964db42 --- /dev/null +++ b/src/include/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/include diff --git a/src/include/CVS/Root b/src/include/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/include/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/include/GL/CVS/Entries b/src/include/GL/CVS/Entries new file mode 100644 index 0000000..1366518 --- /dev/null +++ b/src/include/GL/CVS/Entries @@ -0,0 +1,2 @@ +/glext.h/1.3/Wed May 31 04:35:03 2006// +D diff --git a/src/include/GL/CVS/Repository b/src/include/GL/CVS/Repository new file mode 100644 index 0000000..d9588ce --- /dev/null +++ b/src/include/GL/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/include/GL diff --git a/src/include/GL/CVS/Root b/src/include/GL/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/include/GL/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/include/GL/glext.h b/src/include/GL/glext.h new file mode 100644 index 0000000..7bb8e6e --- /dev/null +++ b/src/include/GL/glext.h @@ -0,0 +1,6495 @@ +#ifndef __glext_h_ +#define __glext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glext.h last updated 2005/06/20 */ +/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ +#define GL_GLEXT_VERSION 29 + +#ifndef GL_VERSION_1_2 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_RESCALE_NORMAL 0x803A +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#endif + +#ifndef GL_ARB_imaging +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#endif + +#ifndef GL_VERSION_1_3 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#endif + +#ifndef GL_VERSION_1_4 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#endif + +#ifndef GL_VERSION_1_5 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE +#define GL_FOG_COORD GL_FOG_COORDINATE +#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE +#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE +#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE +#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER +#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING +#define GL_SRC0_RGB GL_SOURCE0_RGB +#define GL_SRC1_RGB GL_SOURCE1_RGB +#define GL_SRC2_RGB GL_SOURCE2_RGB +#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA +#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA +#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA +#endif + +#ifndef GL_VERSION_2_0 +#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#endif + +#ifndef GL_ARB_multitexture +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +#endif + +#ifndef GL_ARB_multisample +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#endif + +#ifndef GL_ARB_texture_env_add +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif + +#ifndef GL_ARB_texture_compression +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif + +#ifndef GL_ARB_point_parameters +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#endif + +#ifndef GL_ARB_shadow +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#endif + +#ifndef GL_ARB_window_pos +#endif + +#ifndef GL_ARB_vertex_program +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +#endif + +#ifndef GL_ARB_fragment_program +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 +#endif + +#ifndef GL_ARB_shader_objects +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#endif + +#ifndef GL_ARB_point_sprite +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_HALF_FLOAT_ARB 0x140B +#endif + +#ifndef GL_ARB_texture_float +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#endif + +#ifndef GL_EXT_abgr +#define GL_ABGR_EXT 0x8000 +#endif + +#ifndef GL_EXT_blend_color +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif + +#ifndef GL_EXT_texture +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif + +#ifndef GL_EXT_texture3D +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif + +#ifndef GL_EXT_subtexture +#endif + +#ifndef GL_EXT_copy_texture +#endif + +#ifndef GL_EXT_histogram +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif + +#ifndef GL_EXT_convolution +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif + +#ifndef GL_SGI_color_matrix +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif + +#ifndef GL_SGI_color_table +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif + +#ifndef GL_SGIS_texture4D +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif + +#ifndef GL_EXT_cmyka +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif + +#ifndef GL_EXT_texture_object +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif + +#ifndef GL_SGIS_multisample +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif + +#ifndef GL_EXT_vertex_array +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif + +#ifndef GL_EXT_misc_attribute +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif + +#ifndef GL_SGIX_shadow +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif + +#ifndef GL_EXT_blend_logic_op +#endif + +#ifndef GL_SGIX_interlace +#define GL_INTERLACE_SGIX 0x8094 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif + +#ifndef GL_SGIS_texture_select +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif + +#ifndef GL_EXT_point_parameters +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif + +#ifndef GL_SGIX_instruments +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif + +#ifndef GL_SGIX_framezoom +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#endif + +#ifndef GL_FfdMaskSGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif + +#ifndef GL_SGIX_flush_raster +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif + +#ifndef GL_HP_image_transform +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif + +#ifndef GL_INGR_palette_buffer +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif + +#ifndef GL_EXT_color_subtable +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif + +#ifndef GL_EXT_index_texture +#endif + +#ifndef GL_EXT_index_material +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#endif + +#ifndef GL_EXT_index_func +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#endif + +#ifndef GL_WIN_phong_shading +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif + +#ifndef GL_WIN_specular_fog +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif + +#ifndef GL_EXT_light_texture +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +/* reuse GL_FRAGMENT_DEPTH_EXT */ +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif + +#ifndef GL_SGIX_impact_pixel_texture +#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 +#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 +#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 +#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 +#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 +#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 +#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A +#endif + +#ifndef GL_EXT_bgra +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif + +#ifndef GL_SGIX_async +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif + +#ifndef GL_INTEL_texture_scissor +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#endif + +#ifndef GL_HP_occlusion_test +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif + +#ifndef GL_EXT_secondary_color +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#endif + +#ifndef GL_EXT_multi_draw_arrays +#endif + +#ifndef GL_EXT_fog_coord +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_FOG_SCALE_SGIX 0x81FC +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#endif + +#ifndef GL_SUNX_constant_data +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#endif + +#ifndef GL_SUN_global_alpha +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#endif + +#ifndef GL_SUN_triangle_list +#define GL_RESTART_SUN 0x0001 +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#define GL_REPLACE_OLDEST_SUN 0x0003 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +#endif + +#ifndef GL_SUN_vertex +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +#endif + +#ifndef GL_INGR_color_clamp +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INTERLACE_READ_INGR 0x8568 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif + +#ifndef GL_EXT_texture_cube_map +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif + +#ifndef GL_EXT_texture_env_add +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT GL_MODELVIEW +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +#endif + +#ifndef GL_NV_register_combiners +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +/* reuse GL_TEXTURE0_ARB */ +/* reuse GL_TEXTURE1_ARB */ +/* reuse GL_ZERO */ +/* reuse GL_NONE */ +/* reuse GL_FOG */ +#endif + +#ifndef GL_NV_fog_distance +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +/* reuse GL_EYE_PLANE */ +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif + +#ifndef GL_NV_blend_square +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif + +#ifndef GL_MESA_resize_buffers +#endif + +#ifndef GL_MESA_window_pos +#endif + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_CULL_VERTEX_IBM 103050 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +#endif + +#ifndef GL_SGIX_subsample +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif + +#ifndef GL_SGI_depth_pass_instrument +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif + +#ifndef GL_3DFX_tbuffer +#endif + +#ifndef GL_EXT_multisample +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif + +#ifndef GL_SGIX_resample +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#endif + +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif + +#ifndef GL_NV_evaluators +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +#endif + +#ifndef GL_NV_texture_compression_vtc +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif + +#ifndef GL_NV_texture_shader +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV +#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV +#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#endif + +#ifndef GL_NV_vertex_program +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#endif + +#ifndef GL_OML_interlace +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 +#endif + +#ifndef GL_OML_subsample +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#endif + +#ifndef GL_OML_resample +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_REG_6_ATI 0x8927 +#define GL_REG_7_ATI 0x8928 +#define GL_REG_8_ATI 0x8929 +#define GL_REG_9_ATI 0x892A +#define GL_REG_10_ATI 0x892B +#define GL_REG_11_ATI 0x892C +#define GL_REG_12_ATI 0x892D +#define GL_REG_13_ATI 0x892E +#define GL_REG_14_ATI 0x892F +#define GL_REG_15_ATI 0x8930 +#define GL_REG_16_ATI 0x8931 +#define GL_REG_17_ATI 0x8932 +#define GL_REG_18_ATI 0x8933 +#define GL_REG_19_ATI 0x8934 +#define GL_REG_20_ATI 0x8935 +#define GL_REG_21_ATI 0x8936 +#define GL_REG_22_ATI 0x8937 +#define GL_REG_23_ATI 0x8938 +#define GL_REG_24_ATI 0x8939 +#define GL_REG_25_ATI 0x893A +#define GL_REG_26_ATI 0x893B +#define GL_REG_27_ATI 0x893C +#define GL_REG_28_ATI 0x893D +#define GL_REG_29_ATI 0x893E +#define GL_REG_30_ATI 0x893F +#define GL_REG_31_ATI 0x8940 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_CON_8_ATI 0x8949 +#define GL_CON_9_ATI 0x894A +#define GL_CON_10_ATI 0x894B +#define GL_CON_11_ATI 0x894C +#define GL_CON_12_ATI 0x894D +#define GL_CON_13_ATI 0x894E +#define GL_CON_14_ATI 0x894F +#define GL_CON_15_ATI 0x8950 +#define GL_CON_16_ATI 0x8951 +#define GL_CON_17_ATI 0x8952 +#define GL_CON_18_ATI 0x8953 +#define GL_CON_19_ATI 0x8954 +#define GL_CON_20_ATI 0x8955 +#define GL_CON_21_ATI 0x8956 +#define GL_CON_22_ATI 0x8957 +#define GL_CON_23_ATI 0x8958 +#define GL_CON_24_ATI 0x8959 +#define GL_CON_25_ATI 0x895A +#define GL_CON_26_ATI 0x895B +#define GL_CON_27_ATI 0x895C +#define GL_CON_28_ATI 0x895D +#define GL_CON_29_ATI 0x895E +#define GL_CON_30_ATI 0x895F +#define GL_CON_31_ATI 0x8960 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#define GL_RED_BIT_ATI 0x00000001 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_STREAM0_ATI 0x876C +#define GL_VERTEX_STREAM1_ATI 0x876D +#define GL_VERTEX_STREAM2_ATI 0x876E +#define GL_VERTEX_STREAM3_ATI 0x876F +#define GL_VERTEX_STREAM4_ATI 0x8770 +#define GL_VERTEX_STREAM5_ATI 0x8771 +#define GL_VERTEX_STREAM6_ATI 0x8772 +#define GL_VERTEX_STREAM7_ATI 0x8773 +#define GL_VERTEX_SOURCE_ATI 0x8774 +#endif + +#ifndef GL_ATI_element_array +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +#endif + +#ifndef GL_SUN_mesh_array +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SLICE_ACCUM_SUN 0x85CC +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_DEPTH_CLAMP_NV 0x864F +#endif + +#ifndef GL_NV_occlusion_query +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +#endif + +#ifndef GL_NV_point_sprite +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#endif + +#ifndef GL_NV_vertex_program1_1 +#endif + +#ifndef GL_EXT_shadow_funcs +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#endif + +#ifndef GL_APPLE_element_array +#define GL_ELEMENT_ARRAY_APPLE 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A +#endif + +#ifndef GL_APPLE_fence +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_YCBCR_422_APPLE 0x85B9 +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +#ifndef GL_S3_s3tc +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#endif + +#ifndef GL_ATI_texture_float +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif + +#ifndef GL_NV_float_buffer +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif + +#ifndef GL_NV_fragment_program +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +#endif + +#ifndef GL_NV_half_float +#define GL_HALF_FLOAT_NV 0x140B +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +#endif + +#ifndef GL_NV_primitive_restart +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#endif + +#ifndef GL_NV_vertex_program2 +#endif + +#ifndef GL_ATI_map_object_buffer +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#endif + +#ifndef GL_OES_read_format +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +#endif + +#ifndef GL_MESA_pack_invert +#define GL_PACK_INVERT_MESA 0x8758 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#endif + +#ifndef GL_NV_fragment_program_option +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#endif + +#ifndef GL_NV_vertex_program2_option +/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ +/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ +#endif + +#ifndef GL_NV_vertex_program3 +/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#endif + +#ifndef GL_GREMEDY_string_marker +#endif + + +/*************************************************************/ + +#include +#ifndef GL_VERSION_2_0 +/* GL type for program/shader text */ +typedef char GLchar; /* native character */ +#endif + +#ifndef GL_VERSION_1_5 +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +#endif + +#ifndef GL_ARB_vertex_buffer_object +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +#endif + +#ifndef GL_ARB_shader_objects +/* GL types for handling shader object handles and program/shader text */ +typedef char GLcharARB; /* native character */ +typedef unsigned int GLhandleARB; /* shader object handle */ +#endif + +/* GL types for "half" precision (s10e5) float data in host memory */ +#ifndef GL_ARB_half_float_pixel +typedef unsigned short GLhalfARB; +#endif + +#ifndef GL_NV_half_float +typedef unsigned short GLhalfNV; +#endif + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); +GLAPI void APIENTRY glBlendEquation (GLenum); +GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); +GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogram (GLenum); +GLAPI void APIENTRY glResetMinmax (GLenum); +GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum); +GLAPI void APIENTRY glClientActiveTexture (GLenum); +GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); +GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glFogCoordf (GLfloat); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *); +GLAPI void APIENTRY glFogCoordd (GLdouble); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); +GLAPI void APIENTRY glPointParameteri (GLenum, GLint); +GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); +GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); +GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos2i (GLint, GLint); +GLAPI void APIENTRY glWindowPos2iv (const GLint *); +GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2sv (const GLshort *); +GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3iv (const GLint *); +GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3sv (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); +#endif + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQuery (GLuint); +GLAPI void APIENTRY glBeginQuery (GLenum, GLuint); +GLAPI void APIENTRY glEndQuery (GLenum); +GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *); +GLAPI void APIENTRY glBindBuffer (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint); +GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum); +GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *); +GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint); +GLAPI void APIENTRY glAttachShader (GLuint, GLuint); +GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *); +GLAPI void APIENTRY glCompileShader (GLuint); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum); +GLAPI void APIENTRY glDeleteProgram (GLuint); +GLAPI void APIENTRY glDeleteShader (GLuint); +GLAPI void APIENTRY glDetachShader (GLuint, GLuint); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint); +GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgram (GLuint); +GLAPI GLboolean APIENTRY glIsShader (GLuint); +GLAPI void APIENTRY glLinkProgram (GLuint); +GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *); +GLAPI void APIENTRY glUseProgram (GLuint); +GLAPI void APIENTRY glUniform1f (GLint, GLfloat); +GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1i (GLint, GLint); +GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glValidateProgram (GLuint); +GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTextureARB (GLenum); +GLAPI void APIENTRY glClientActiveTextureARB (GLenum); +GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#endif + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); +#endif + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#endif + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 +#endif + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); +GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); +GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); +GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); +GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); +GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexBlendARB (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); +typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); +typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); +typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); +typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); +typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); +typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); +GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 +#endif + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 +#endif + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); +GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); +#endif + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); +GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); +#endif + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 +/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBufferARB (GLuint); +GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum); +GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQueryARB (GLuint); +GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint); +GLAPI void APIENTRY glEndQueryARB (GLenum); +GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum); +GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum); +GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); +GLAPI void APIENTRY glCompileShaderARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); +GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB); +GLAPI void APIENTRY glLinkProgramARB (GLhandleARB); +GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB); +GLAPI void APIENTRY glValidateProgramARB (GLhandleARB); +GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat); +GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1iARB (GLint, GLint); +GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *); +GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); +GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *); +GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *); +GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); +typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); +GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 +#endif + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClampColorARB (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 +#endif + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 +#endif + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#endif + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#endif + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#endif + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogramEXT (GLenum); +GLAPI void APIENTRY glResetMinmaxEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); +#endif + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +#endif + +#ifndef GL_EXT_color_matrix +#define GL_EXT_color_matrix 1 +#endif + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); +GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); +GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); +GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#endif + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#endif + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); +GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#endif + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternSGIS (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#endif + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glArrayElementEXT (GLint); +GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); +GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); +GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); +typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#endif + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#endif + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#endif + +#ifndef GL_SGIX_texture_select +#define GL_SGIX_texture_select 1 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); +GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#endif + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_SGIS_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); +GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); +GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); +GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); +GLAPI void APIENTRY glStartInstrumentsSGIX (void); +GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#endif + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameZoomSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTagSampleBufferSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); +GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); +GLAPI void APIENTRY glDeformSGIX (GLbitfield); +GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#endif + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushRasterSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#endif + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); +GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#endif + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glHintPGI (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); +GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); +GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); +GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#endif + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); +GLAPI void APIENTRY glUnlockArraysEXT (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); +GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); +GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); +GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); +GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +#endif + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#endif + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#endif + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyTextureEXT (GLenum); +GLAPI void APIENTRY glTextureLightEXT (GLenum); +GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#endif + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#endif + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); +GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); +GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); +GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); +GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); +GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); +GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +#endif + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#endif + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); +GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureNormalEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordfEXT (GLfloat); +GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); +GLAPI void APIENTRY glFogCoorddEXT (GLdouble); +GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); +GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); +GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); +GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glTangent3ivEXT (const GLint *); +GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glTangent3svEXT (const GLshort *); +GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); +GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); +GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); +GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); +GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); +GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_SGIX_fog_scale 1 +#endif + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFinishTextureSUNX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); +#endif + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); +GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); +GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); +GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); +GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); +GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); +GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); +GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#endif + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); +GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); +GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); +GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); +GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); +GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); +GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); +#endif + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_blend_func_separate +#define GL_INGR_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#endif + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); +GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); +GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); +#endif + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); +GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); +GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); +GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); +GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#endif + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#endif + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#endif + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glResizeBuffersMESA (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); +#endif + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint); +GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); +GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +#endif + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#endif + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTbufferMask3DFX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#endif + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#endif + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif + +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 +#endif + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); +GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); +GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFinishFenceNV (GLuint); +GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); +GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); +GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); +typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 +#endif + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 +#endif + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); +GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); +GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); +GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); +GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); +GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); +GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); +typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); +typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); +typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SGIX_scalebias_hint 1 +#endif + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 +#endif + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 +#endif + +#ifndef GL_OML_resample +#define GL_OML_resample 1 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); +GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); +GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); +GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); +GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); +GLAPI void APIENTRY glBeginFragmentShaderATI (void); +GLAPI void APIENTRY glEndFragmentShaderATI (void); +GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); +GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); +GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); +GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); +GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFreeObjectBufferATI (GLuint); +GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); +typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVertexShaderEXT (void); +GLAPI void APIENTRY glEndVertexShaderEXT (void); +GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); +GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); +GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); +GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); +GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); +GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); +GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); +GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); +GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); +GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); +GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *); +GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); +GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); +GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); +GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); +GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); +GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); +typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); +typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); +typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); +typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); +typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); +typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); +typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); +typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); +typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); +typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); +GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); +GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); +GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); +GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); +GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); +GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); +GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); +GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +#endif + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 +#endif + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glEndOcclusionQueryNV (void); +GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 +#endif + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 +#endif + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 +#endif + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei); +GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#endif + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glSetFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint); +GLAPI void APIENTRY glFinishFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint); +GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); +typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); +typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint); +GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 +#endif + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_ATI_pixel_format_float 1 +/* This is really a WGL extension, but defines some associated GL enums. + * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. + */ +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 +#endif + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 +#endif + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 +#endif + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 +/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *); +GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *); +GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#endif + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV); +GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glFogCoordhNV (GLhalfNV); +GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *); +GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV); +GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); +typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); +typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +#endif + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveRestartNV (void); +GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 +#endif + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 +#endif + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint); +GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); +#endif + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); +#endif + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 +#endif + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 +#endif + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 +#endif + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint); +GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *); +GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *); +GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint); +GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *); +GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum); +GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGenerateMipmapEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +#endif + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/SDL.h b/src/include/SDL.h new file mode 100644 index 0000000..60ac26c --- /dev/null +++ b/src/include/SDL.h @@ -0,0 +1,94 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Main include header for the SDL library */ + +#ifndef _SDL_H +#define _SDL_H + +#include "SDL_main.h" +#include "SDL_stdinc.h" +#include "SDL_audio.h" +#include "SDL_cdrom.h" +#include "SDL_cpuinfo.h" +#include "SDL_endian.h" +#include "SDL_error.h" +#include "SDL_events.h" +#include "SDL_loadso.h" +#include "SDL_mutex.h" +#include "SDL_rwops.h" +#include "SDL_thread.h" +#include "SDL_timer.h" +#include "SDL_video.h" +#include "SDL_version.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* As of version 0.5, SDL is loaded dynamically into the application */ + +/* These are the flags which may be passed to SDL_Init() -- you should + specify the subsystems which you will be using in your application. +*/ +#define SDL_INIT_TIMER 0x00000001 +#define SDL_INIT_AUDIO 0x00000010 +#define SDL_INIT_VIDEO 0x00000020 +#define SDL_INIT_CDROM 0x00000100 +#define SDL_INIT_JOYSTICK 0x00000200 +#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */ +#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */ +#define SDL_INIT_EVERYTHING 0x0000FFFF + +/* This function loads the SDL dynamically linked library and initializes + * the subsystems specified by 'flags' (and those satisfying dependencies) + * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup + * signal handlers for some commonly ignored fatal signals (like SIGSEGV) + */ +extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); + +/* This function initializes specific SDL subsystems */ +extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); + +/* This function cleans up specific SDL subsystems */ +extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); + +/* This function returns mask of the specified subsystems which have + been initialized. + If 'flags' is 0, it returns a mask of all initialized subsystems. +*/ +extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); + +/* This function cleans up all initialized subsystems and unloads the + * dynamically linked library. You should call it upon all exit conditions. + */ +extern DECLSPEC void SDLCALL SDL_Quit(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_H */ diff --git a/src/include/SDL_active.h b/src/include/SDL_active.h new file mode 100644 index 0000000..2cf474c --- /dev/null +++ b/src/include/SDL_active.h @@ -0,0 +1,58 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Include file for SDL application focus event handling */ + +#ifndef _SDL_active_h +#define _SDL_active_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The available application states */ +#define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */ +#define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */ +#define SDL_APPACTIVE 0x04 /* The application is active */ + +/* Function prototypes */ +/* + * This function returns the current state of the application, which is a + * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and + * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to + * see your application, otherwise it has been iconified or disabled. + */ +extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_active_h */ diff --git a/src/include/SDL_audio.h b/src/include/SDL_audio.h new file mode 100644 index 0000000..68ec475 --- /dev/null +++ b/src/include/SDL_audio.h @@ -0,0 +1,253 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Access to the raw audio mixing buffer for the SDL library */ + +#ifndef _SDL_audio_h +#define _SDL_audio_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_endian.h" +#include "SDL_mutex.h" +#include "SDL_thread.h" +#include "SDL_rwops.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The calculated values in this structure are calculated by SDL_OpenAudio() */ +typedef struct SDL_AudioSpec { + int freq; /* DSP frequency -- samples per second */ + Uint16 format; /* Audio data format */ + Uint8 channels; /* Number of channels: 1 mono, 2 stereo */ + Uint8 silence; /* Audio buffer silence value (calculated) */ + Uint16 samples; /* Audio buffer size in samples (power of 2) */ + Uint16 padding; /* Necessary for some compile environments */ + Uint32 size; /* Audio buffer size in bytes (calculated) */ + /* This function is called when the audio device needs more data. + 'stream' is a pointer to the audio data buffer + 'len' is the length of that buffer in bytes. + Once the callback returns, the buffer will no longer be valid. + Stereo samples are stored in a LRLRLR ordering. + */ + void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len); + void *userdata; +} SDL_AudioSpec; + +/* Audio format flags (defaults to LSB byte order) */ +#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */ +#define AUDIO_S8 0x8008 /* Signed 8-bit samples */ +#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */ +#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */ +#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */ +#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */ +#define AUDIO_U16 AUDIO_U16LSB +#define AUDIO_S16 AUDIO_S16LSB + +/* Native audio byte ordering */ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define AUDIO_U16SYS AUDIO_U16LSB +#define AUDIO_S16SYS AUDIO_S16LSB +#else +#define AUDIO_U16SYS AUDIO_U16MSB +#define AUDIO_S16SYS AUDIO_S16MSB +#endif + + +/* A structure to hold a set of audio conversion filters and buffers */ +typedef struct SDL_AudioCVT { + int needed; /* Set to 1 if conversion possible */ + Uint16 src_format; /* Source audio format */ + Uint16 dst_format; /* Target audio format */ + double rate_incr; /* Rate conversion increment */ + Uint8 *buf; /* Buffer to hold entire audio data */ + int len; /* Length of original audio buffer */ + int len_cvt; /* Length of converted audio buffer */ + int len_mult; /* buffer must be len*len_mult big */ + double len_ratio; /* Given len, final size is len*len_ratio */ + void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format); + int filter_index; /* Current audio conversion function */ +} SDL_AudioCVT; + + +/* Function prototypes */ + +/* These functions are used internally, and should not be used unless you + * have a specific need to specify the audio driver you want to use. + * You should normally use SDL_Init() or SDL_InitSubSystem(). + */ +extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); +extern DECLSPEC void SDLCALL SDL_AudioQuit(void); + +/* This function fills the given character buffer with the name of the + * current audio driver, and returns a pointer to it if the audio driver has + * been initialized. It returns NULL if no driver has been initialized. + */ +extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen); + +/* + * This function opens the audio device with the desired parameters, and + * returns 0 if successful, placing the actual hardware parameters in the + * structure pointed to by 'obtained'. If 'obtained' is NULL, the audio + * data passed to the callback function will be guaranteed to be in the + * requested format, and will be automatically converted to the hardware + * audio format if necessary. This function returns -1 if it failed + * to open the audio device, or couldn't set up the audio thread. + * + * When filling in the desired audio spec structure, + * 'desired->freq' should be the desired audio frequency in samples-per-second. + * 'desired->format' should be the desired audio format. + * 'desired->samples' is the desired size of the audio buffer, in samples. + * This number should be a power of two, and may be adjusted by the audio + * driver to a value more suitable for the hardware. Good values seem to + * range between 512 and 8096 inclusive, depending on the application and + * CPU speed. Smaller values yield faster response time, but can lead + * to underflow if the application is doing heavy processing and cannot + * fill the audio buffer in time. A stereo sample consists of both right + * and left channels in LR ordering. + * Note that the number of samples is directly related to time by the + * following formula: ms = (samples*1000)/freq + * 'desired->size' is the size in bytes of the audio buffer, and is + * calculated by SDL_OpenAudio(). + * 'desired->silence' is the value used to set the buffer to silence, + * and is calculated by SDL_OpenAudio(). + * 'desired->callback' should be set to a function that will be called + * when the audio device is ready for more data. It is passed a pointer + * to the audio buffer, and the length in bytes of the audio buffer. + * This function usually runs in a separate thread, and so you should + * protect data structures that it accesses by calling SDL_LockAudio() + * and SDL_UnlockAudio() in your code. + * 'desired->userdata' is passed as the first parameter to your callback + * function. + * + * The audio device starts out playing silence when it's opened, and should + * be enabled for playing by calling SDL_PauseAudio(0) when you are ready + * for your audio callback function to be called. Since the audio driver + * may modify the requested size of the audio buffer, you should allocate + * any local mixing buffers after you open the audio device. + */ +extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained); + +/* + * Get the current audio state: + */ +typedef enum { + SDL_AUDIO_STOPPED = 0, + SDL_AUDIO_PLAYING, + SDL_AUDIO_PAUSED +} SDL_audiostatus; +extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void); + +/* + * This function pauses and unpauses the audio callback processing. + * It should be called with a parameter of 0 after opening the audio + * device to start playing sound. This is so you can safely initialize + * data for your callback function after opening the audio device. + * Silence will be written to the audio device during the pause. + */ +extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); + +/* + * This function loads a WAVE from the data source, automatically freeing + * that source if 'freesrc' is non-zero. For example, to load a WAVE file, + * you could do: + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + * + * If this function succeeds, it returns the given SDL_AudioSpec, + * filled with the audio data format of the wave data, and sets + * 'audio_buf' to a malloc()'d buffer containing the audio data, + * and sets 'audio_len' to the length of that audio buffer, in bytes. + * You need to free the audio buffer with SDL_FreeWAV() when you are + * done with it. + * + * This function returns NULL and sets the SDL error message if the + * wave file cannot be opened, uses an unknown data format, or is + * corrupt. Currently raw and MS-ADPCM WAVE files are supported. + */ +extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); + +/* Compatibility convenience function -- loads a WAV from a file */ +#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ + SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) + +/* + * This function frees data previously allocated with SDL_LoadWAV_RW() + */ +extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf); + +/* + * This function takes a source format and rate and a destination format + * and rate, and initializes the 'cvt' structure with information needed + * by SDL_ConvertAudio() to convert a buffer of audio data from one format + * to the other. + * This function returns 0, or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt, + Uint16 src_format, Uint8 src_channels, int src_rate, + Uint16 dst_format, Uint8 dst_channels, int dst_rate); + +/* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), + * created an audio buffer cvt->buf, and filled it with cvt->len bytes of + * audio data in the source format, this function will convert it in-place + * to the desired format. + * The data conversion may expand the size of the audio data, so the buffer + * cvt->buf should be allocated after the cvt structure is initialized by + * SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. + */ +extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt); + +/* + * This takes two audio buffers of the playing audio format and mixes + * them, performing addition, volume adjustment, and overflow clipping. + * The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME + * for full audio volume. Note this does not change hardware volume. + * This is provided for convenience -- you can mix your own audio data. + */ +#define SDL_MIX_MAXVOLUME 128 +extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume); + +/* + * The lock manipulated by these functions protects the callback function. + * During a LockAudio/UnlockAudio pair, you can be guaranteed that the + * callback function is not running. Do not call these from the callback + * function or you will cause deadlock. + */ +extern DECLSPEC void SDLCALL SDL_LockAudio(void); +extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); + +/* + * This function shuts down audio processing and closes the audio device. + */ +extern DECLSPEC void SDLCALL SDL_CloseAudio(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_audio_h */ diff --git a/src/include/SDL_byteorder.h b/src/include/SDL_byteorder.h new file mode 100644 index 0000000..3871cfe --- /dev/null +++ b/src/include/SDL_byteorder.h @@ -0,0 +1,24 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* DEPRECATED */ +#include "SDL_endian.h" diff --git a/src/include/SDL_cdrom.h b/src/include/SDL_cdrom.h new file mode 100644 index 0000000..5f8f0c6 --- /dev/null +++ b/src/include/SDL_cdrom.h @@ -0,0 +1,171 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* This is the CD-audio control API for Simple DirectMedia Layer */ + +#ifndef _SDL_cdrom_h +#define _SDL_cdrom_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* In order to use these functions, SDL_Init() must have been called + with the SDL_INIT_CDROM flag. This causes SDL to scan the system + for CD-ROM drives, and load appropriate drivers. +*/ + +/* The maximum number of CD-ROM tracks on a disk */ +#define SDL_MAX_TRACKS 99 + +/* The types of CD-ROM track possible */ +#define SDL_AUDIO_TRACK 0x00 +#define SDL_DATA_TRACK 0x04 + +/* The possible states which a CD-ROM drive can be in. */ +typedef enum { + CD_TRAYEMPTY, + CD_STOPPED, + CD_PLAYING, + CD_PAUSED, + CD_ERROR = -1 +} CDstatus; + +/* Given a status, returns true if there's a disk in the drive */ +#define CD_INDRIVE(status) ((int)(status) > 0) + +typedef struct SDL_CDtrack { + Uint8 id; /* Track number */ + Uint8 type; /* Data or audio track */ + Uint16 unused; + Uint32 length; /* Length, in frames, of this track */ + Uint32 offset; /* Offset, in frames, from start of disk */ +} SDL_CDtrack; + +/* This structure is only current as of the last call to SDL_CDStatus() */ +typedef struct SDL_CD { + int id; /* Private drive identifier */ + CDstatus status; /* Current drive status */ + + /* The rest of this structure is only valid if there's a CD in drive */ + int numtracks; /* Number of tracks on disk */ + int cur_track; /* Current track position */ + int cur_frame; /* Current frame offset within current track */ + SDL_CDtrack track[SDL_MAX_TRACKS+1]; +} SDL_CD; + +/* Conversion functions from frames to Minute/Second/Frames and vice versa */ +#define CD_FPS 75 +#define FRAMES_TO_MSF(f, M,S,F) { \ + int value = f; \ + *(F) = value%CD_FPS; \ + value /= CD_FPS; \ + *(S) = value%60; \ + value /= 60; \ + *(M) = value; \ +} +#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F)) + +/* CD-audio API functions: */ + +/* Returns the number of CD-ROM drives on the system, or -1 if + SDL_Init() has not been called with the SDL_INIT_CDROM flag. + */ +extern DECLSPEC int SDLCALL SDL_CDNumDrives(void); + +/* Returns a human-readable, system-dependent identifier for the CD-ROM. + Example: + "/dev/cdrom" + "E:" + "/dev/disk/ide/1/master" +*/ +extern DECLSPEC const char * SDLCALL SDL_CDName(int drive); + +/* Opens a CD-ROM drive for access. It returns a drive handle on success, + or NULL if the drive was invalid or busy. This newly opened CD-ROM + becomes the default CD used when other CD functions are passed a NULL + CD-ROM handle. + Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. +*/ +extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive); + +/* This function returns the current status of the given drive. + If the drive has a CD in it, the table of contents of the CD and current + play position of the CD will be stored in the SDL_CD structure. +*/ +extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom); + +/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' + tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play + until the end of the CD. This function will skip data tracks. + This function should only be called after calling SDL_CDStatus() to + get track information about the CD. + For example: + // Play entire CD: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) + SDL_CDPlayTracks(cdrom, 0, 0, 0, 0); + // Play last track: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { + SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0); + } + // Play first and second track and 10 seconds of third track: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) + SDL_CDPlayTracks(cdrom, 0, 0, 2, 10); + + This function returns 0, or -1 if there was an error. +*/ +extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom, + int start_track, int start_frame, int ntracks, int nframes); + +/* Play the given CD starting at 'start' frame for 'length' frames. + It returns 0, or -1 if there was an error. +*/ +extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length); + +/* Pause play -- returns 0, or -1 on error */ +extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom); + +/* Resume play -- returns 0, or -1 on error */ +extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom); + +/* Stop play -- returns 0, or -1 on error */ +extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom); + +/* Eject CD-ROM -- returns 0, or -1 on error */ +extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom); + +/* Closes the handle for the CD-ROM drive */ +extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_video_h */ diff --git a/src/include/SDL_config.h b/src/include/SDL_config.h new file mode 100644 index 0000000..c82f42a --- /dev/null +++ b/src/include/SDL_config.h @@ -0,0 +1,45 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef _SDL_config_h +#define _SDL_config_h + +#include "SDL_platform.h" + +/* Add any platform that doesn't build using the configure system */ +#if defined(__DREAMCAST__) +#include "SDL_config_dreamcast.h" +#elif defined(__MACOS__) +#include "SDL_config_macos.h" +#elif defined(__MACOSX__) +#include "SDL_config_macosx.h" +#elif defined(__SYMBIAN32__) +#include "SDL_config_symbian.h" /* must be before win32! */ +#elif defined(__WIN32__) +#include "SDL_config_win32.h" +#elif defined(__OS2__) +#include "SDL_config_os2.h" +#else +#include "SDL_config_minimal.h" +#endif /* platform config */ + +#endif /* _SDL_config_h */ diff --git a/src/include/SDL_config_macosx.h b/src/include/SDL_config_macosx.h new file mode 100644 index 0000000..481c22e --- /dev/null +++ b/src/include/SDL_config_macosx.h @@ -0,0 +1,135 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef _SDL_config_macosx_h +#define _SDL_config_macosx_h + +#include "SDL_platform.h" + +/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ +#include + +/* This is a set of defines to configure the SDL features */ + +#define SDL_HAS_64BIT_TYPE 1 + +/* Useful headers */ +/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */ +#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) ) +#define HAVE_ALLOCA_H 1 +#endif +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_SSCANF 1 +#define HAVE_SNPRINTF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_COREAUDIO 1 +#define SDL_AUDIO_DRIVER_SNDMGR 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various cdrom drivers */ +#define SDL_CDROM_MACOSX 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_IOKIT 1 + +/* Enable various shared object loading systems */ +#ifdef __ppc__ +/* For Mac OS X 10.2 compatibility */ +#define SDL_LOADSO_DLCOMPAT 1 +#else +#define SDL_LOADSO_DLOPEN 1 +#endif + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_DUMMY 1 +#if ((defined TARGET_API_MAC_CARBON) && (TARGET_API_MAC_CARBON)) +#define SDL_VIDEO_DRIVER_TOOLBOX 1 +#else +#define SDL_VIDEO_DRIVER_QUARTZ 1 +#endif + +/* Enable OpenGL support */ +#define SDL_VIDEO_OPENGL 1 + +/* Enable assembly routines */ +#define SDL_ASSEMBLY_ROUTINES 1 +#ifdef __ppc__ +#define SDL_ALTIVEC_BLITTERS 1 +#endif + +#endif /* _SDL_config_macosx_h */ diff --git a/src/include/SDL_config_win32.h b/src/include/SDL_config_win32.h new file mode 100644 index 0000000..cfb44d2 --- /dev/null +++ b/src/include/SDL_config_win32.h @@ -0,0 +1,180 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef _SDL_config_win32_h +#define _SDL_config_win32_h + +#include "SDL_platform.h" + +/* This is a set of defines to configure the SDL features */ + +#if defined(__GNUC__) || defined(__DMC__) +#define HAVE_STDINT_H 1 +#elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned int uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ +#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) +#define DWORD_PTR DWORD +#endif +#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) +#define LONG_PTR LONG +#endif +#else /* !__GNUC__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +#endif +typedef unsigned int uintptr_t; +#endif /* __GNUC__ || _MSC_VER */ +#define SDL_HAS_64BIT_TYPE 1 + +/* Enabled for SDL 1.2 (binary compatibility) */ +#define HAVE_LIBC 1 +#ifdef HAVE_LIBC +/* Useful headers */ +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#ifndef _WIN32_WCE +#define HAVE_SIGNAL_H 1 +#endif + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE__STRREV 1 +#define HAVE__STRUPR 1 +#define HAVE__STRLWR 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_ITOA 1 +#define HAVE__LTOA 1 +#define HAVE__ULTOA 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE__STRICMP 1 +#define HAVE__STRNICMP 1 +#define HAVE_SSCANF 1 +#else +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#endif + +/* Enable various audio drivers */ +#ifndef _WIN32_WCE +#define SDL_AUDIO_DRIVER_DSOUND 1 +#endif +#define SDL_AUDIO_DRIVER_WAVEOUT 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various cdrom drivers */ +#ifdef _WIN32_WCE +#define SDL_CDROM_DISABLED 1 +#else +#define SDL_CDROM_WIN32 1 +#endif + +/* Enable various input drivers */ +#ifdef _WIN32_WCE +#define SDL_JOYSTICK_DISABLED 1 +#else +#define SDL_JOYSTICK_WINMM 1 +#endif + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_WIN32 1 + +/* Enable various threading systems */ +#define SDL_THREAD_WIN32 1 + +/* Enable various timer systems */ +#ifdef _WIN32_WCE +#define SDL_TIMER_WINCE 1 +#else +#define SDL_TIMER_WIN32 1 +#endif + +/* Enable various video drivers */ +#ifdef _WIN32_WCE +#define SDL_VIDEO_DRIVER_GAPI 1 +#endif +#ifndef _WIN32_WCE +#define SDL_VIDEO_DRIVER_DDRAW 1 +#endif +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDIB 1 + +/* Enable OpenGL support */ +#ifndef _WIN32_WCE +#define SDL_VIDEO_OPENGL 1 +#define SDL_VIDEO_OPENGL_WGL 1 +#endif + +/* Enable assembly routines (Win64 doesn't have inline asm) */ +#ifndef _WIN64 +#define SDL_ASSEMBLY_ROUTINES 1 +#endif + +#endif /* _SDL_config_win32_h */ diff --git a/src/include/SDL_copying.h b/src/include/SDL_copying.h new file mode 100644 index 0000000..39e122d --- /dev/null +++ b/src/include/SDL_copying.h @@ -0,0 +1,22 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + diff --git a/src/include/SDL_cpuinfo.h b/src/include/SDL_cpuinfo.h new file mode 100644 index 0000000..72acbdd --- /dev/null +++ b/src/include/SDL_cpuinfo.h @@ -0,0 +1,75 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* CPU feature detection for SDL */ + +#ifndef _SDL_cpuinfo_h +#define _SDL_cpuinfo_h + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* This function returns true if the CPU has the RDTSC instruction + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); + +/* This function returns true if the CPU has MMX features + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); + +/* This function returns true if the CPU has MMX Ext. features + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void); + +/* This function returns true if the CPU has 3DNow features + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); + +/* This function returns true if the CPU has 3DNow! Ext. features + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void); + +/* This function returns true if the CPU has SSE features + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); + +/* This function returns true if the CPU has SSE2 features + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); + +/* This function returns true if the CPU has AltiVec features + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_cpuinfo_h */ diff --git a/src/include/SDL_endian.h b/src/include/SDL_endian.h new file mode 100644 index 0000000..8f8db4c --- /dev/null +++ b/src/include/SDL_endian.h @@ -0,0 +1,194 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Functions for reading and writing endian-specific values */ + +#ifndef _SDL_endian_h +#define _SDL_endian_h + +#include "SDL_stdinc.h" + +/* The two types of endianness */ +#define SDL_LIL_ENDIAN 1234 +#define SDL_BIG_ENDIAN 4321 + +#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ +#if defined(__hppa__) || \ + defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ + (defined(__MIPS__) && defined(__MISPEB__)) || \ + defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ + defined(__sparc__) +#define SDL_BYTEORDER SDL_BIG_ENDIAN +#else +#define SDL_BYTEORDER SDL_LIL_ENDIAN +#endif +#endif /* !SDL_BYTEORDER */ + + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Use inline functions for compilers that support them, and static + functions for those that do not. Because these functions become + static for compilers that do not support inline functions, this + header should only be included in files that actually use them. +*/ +#if defined(__GNUC__) && defined(__i386__) && \ + !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) +static __inline__ Uint16 SDL_Swap16(Uint16 x) +{ + __asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x)); + return x; +} +#elif defined(__GNUC__) && defined(__x86_64__) +static __inline__ Uint16 SDL_Swap16(Uint16 x) +{ + __asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x)); + return x; +} +#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) +static __inline__ Uint16 SDL_Swap16(Uint16 x) +{ + Uint16 result; + + __asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x)); + return result; +} +#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) +static __inline__ Uint16 SDL_Swap16(Uint16 x) +{ + __asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc"); + return x; +} +#else +static __inline__ Uint16 SDL_Swap16(Uint16 x) { + return((x<<8)|(x>>8)); +} +#endif + +#if defined(__GNUC__) && defined(__i386__) && \ + !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) +static __inline__ Uint32 SDL_Swap32(Uint32 x) +{ + __asm__("bswap %0" : "=r" (x) : "0" (x)); + return x; +} +#elif defined(__GNUC__) && defined(__x86_64__) +static __inline__ Uint32 SDL_Swap32(Uint32 x) +{ + __asm__("bswapl %0" : "=r" (x) : "0" (x)); + return x; +} +#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) +static __inline__ Uint32 SDL_Swap32(Uint32 x) +{ + Uint32 result; + + __asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x)); + __asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x)); + __asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x)); + return result; +} +#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) +static __inline__ Uint32 SDL_Swap32(Uint32 x) +{ + __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc"); + return x; +} +#else +static __inline__ Uint32 SDL_Swap32(Uint32 x) { + return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24)); +} +#endif + +#ifdef SDL_HAS_64BIT_TYPE +#if defined(__GNUC__) && defined(__i386__) && \ + !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) +static __inline__ Uint64 SDL_Swap64(Uint64 x) +{ + union { + struct { Uint32 a,b; } s; + Uint64 u; + } v; + v.u = x; + __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1" + : "=r" (v.s.a), "=r" (v.s.b) + : "0" (v.s.a), "1" (v.s.b)); + return v.u; +} +#elif defined(__GNUC__) && defined(__x86_64__) +static __inline__ Uint64 SDL_Swap64(Uint64 x) +{ + __asm__("bswapq %0" : "=r" (x) : "0" (x)); + return x; +} +#else +static __inline__ Uint64 SDL_Swap64(Uint64 x) +{ + Uint32 hi, lo; + + /* Separate into high and low 32-bit values and swap them */ + lo = (Uint32)(x&0xFFFFFFFF); + x >>= 32; + hi = (Uint32)(x&0xFFFFFFFF); + x = SDL_Swap32(lo); + x <<= 32; + x |= SDL_Swap32(hi); + return(x); +} +#endif +#else +/* This is mainly to keep compilers from complaining in SDL code. + If there is no real 64-bit datatype, then compilers will complain about + the fake 64-bit datatype that SDL provides when it compiles user code. +*/ +#define SDL_Swap64(X) (X) +#endif /* SDL_HAS_64BIT_TYPE */ + + +/* Byteswap item from the specified endianness to the native endianness */ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define SDL_SwapLE16(X) (X) +#define SDL_SwapLE32(X) (X) +#define SDL_SwapLE64(X) (X) +#define SDL_SwapBE16(X) SDL_Swap16(X) +#define SDL_SwapBE32(X) SDL_Swap32(X) +#define SDL_SwapBE64(X) SDL_Swap64(X) +#else +#define SDL_SwapLE16(X) SDL_Swap16(X) +#define SDL_SwapLE32(X) SDL_Swap32(X) +#define SDL_SwapLE64(X) SDL_Swap64(X) +#define SDL_SwapBE16(X) (X) +#define SDL_SwapBE32(X) (X) +#define SDL_SwapBE64(X) (X) +#endif + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_endian_h */ diff --git a/src/include/SDL_error.h b/src/include/SDL_error.h new file mode 100644 index 0000000..26d6bfa --- /dev/null +++ b/src/include/SDL_error.h @@ -0,0 +1,61 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Simple error message routines for SDL */ + +#ifndef _SDL_error_h +#define _SDL_error_h + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Public functions */ +extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); +extern DECLSPEC char * SDLCALL SDL_GetError(void); +extern DECLSPEC void SDLCALL SDL_ClearError(void); + +/* Private error message function - used internally */ +#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) +#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) +typedef enum { + SDL_ENOMEM, + SDL_EFREAD, + SDL_EFWRITE, + SDL_EFSEEK, + SDL_UNSUPPORTED, + SDL_LASTERROR +} SDL_errorcode; +extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_error_h */ diff --git a/src/include/SDL_events.h b/src/include/SDL_events.h new file mode 100644 index 0000000..9fe918c --- /dev/null +++ b/src/include/SDL_events.h @@ -0,0 +1,337 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Include file for SDL event handling */ + +#ifndef _SDL_events_h +#define _SDL_events_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_active.h" +#include "SDL_keyboard.h" +#include "SDL_mouse.h" +#include "SDL_joystick.h" +#include "SDL_quit.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* General keyboard/mouse state definitions */ +#define SDL_RELEASED 0 +#define SDL_PRESSED 1 + +/* Event enumerations */ +typedef enum { + SDL_NOEVENT = 0, /* Unused (do not remove) */ + SDL_ACTIVEEVENT, /* Application loses/gains visibility */ + SDL_KEYDOWN, /* Keys pressed */ + SDL_KEYUP, /* Keys released */ + SDL_MOUSEMOTION, /* Mouse moved */ + SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */ + SDL_MOUSEBUTTONUP, /* Mouse button released */ + SDL_JOYAXISMOTION, /* Joystick axis motion */ + SDL_JOYBALLMOTION, /* Joystick trackball motion */ + SDL_JOYHATMOTION, /* Joystick hat position change */ + SDL_JOYBUTTONDOWN, /* Joystick button pressed */ + SDL_JOYBUTTONUP, /* Joystick button released */ + SDL_QUIT, /* User-requested quit */ + SDL_SYSWMEVENT, /* System specific event */ + SDL_EVENT_RESERVEDA, /* Reserved for future use.. */ + SDL_EVENT_RESERVEDB, /* Reserved for future use.. */ + SDL_VIDEORESIZE, /* User resized video mode */ + SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */ + SDL_EVENT_RESERVED2, /* Reserved for future use.. */ + SDL_EVENT_RESERVED3, /* Reserved for future use.. */ + SDL_EVENT_RESERVED4, /* Reserved for future use.. */ + SDL_EVENT_RESERVED5, /* Reserved for future use.. */ + SDL_EVENT_RESERVED6, /* Reserved for future use.. */ + SDL_EVENT_RESERVED7, /* Reserved for future use.. */ + /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */ + SDL_USEREVENT = 24, + /* This last event is only for bounding internal arrays + It is the number of bits in the event mask datatype -- Uint32 + */ + SDL_NUMEVENTS = 32 +} SDL_EventType; + +/* Predefined event masks */ +#define SDL_EVENTMASK(X) (1<<(X)) +typedef enum { + SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT), + SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN), + SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP), + SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)| + SDL_EVENTMASK(SDL_KEYUP), + SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION), + SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN), + SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP), + SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)| + SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)| + SDL_EVENTMASK(SDL_MOUSEBUTTONUP), + SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION), + SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION), + SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION), + SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN), + SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP), + SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)| + SDL_EVENTMASK(SDL_JOYBALLMOTION)| + SDL_EVENTMASK(SDL_JOYHATMOTION)| + SDL_EVENTMASK(SDL_JOYBUTTONDOWN)| + SDL_EVENTMASK(SDL_JOYBUTTONUP), + SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE), + SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE), + SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT), + SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT) +} SDL_EventMask ; +#define SDL_ALLEVENTS 0xFFFFFFFF + +/* Application visibility event structure */ +typedef struct SDL_ActiveEvent { + Uint8 type; /* SDL_ACTIVEEVENT */ + Uint8 gain; /* Whether given states were gained or lost (1/0) */ + Uint8 state; /* A mask of the focus states */ +} SDL_ActiveEvent; + +/* Keyboard event structure */ +typedef struct SDL_KeyboardEvent { + Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */ + Uint8 which; /* The keyboard device index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ + SDL_keysym keysym; +} SDL_KeyboardEvent; + +/* Mouse motion event structure */ +typedef struct SDL_MouseMotionEvent { + Uint8 type; /* SDL_MOUSEMOTION */ + Uint8 which; /* The mouse device index */ + Uint8 state; /* The current button state */ + Uint16 x, y; /* The X/Y coordinates of the mouse */ + Sint16 xrel; /* The relative motion in the X direction */ + Sint16 yrel; /* The relative motion in the Y direction */ +} SDL_MouseMotionEvent; + +/* Mouse button event structure */ +typedef struct SDL_MouseButtonEvent { + Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ + Uint8 which; /* The mouse device index */ + Uint8 button; /* The mouse button index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ + Uint16 x, y; /* The X/Y coordinates of the mouse at press time */ +} SDL_MouseButtonEvent; + +/* Joystick axis motion event structure */ +typedef struct SDL_JoyAxisEvent { + Uint8 type; /* SDL_JOYAXISMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 axis; /* The joystick axis index */ + Sint16 value; /* The axis value (range: -32768 to 32767) */ +} SDL_JoyAxisEvent; + +/* Joystick trackball motion event structure */ +typedef struct SDL_JoyBallEvent { + Uint8 type; /* SDL_JOYBALLMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 ball; /* The joystick trackball index */ + Sint16 xrel; /* The relative motion in the X direction */ + Sint16 yrel; /* The relative motion in the Y direction */ +} SDL_JoyBallEvent; + +/* Joystick hat position change event structure */ +typedef struct SDL_JoyHatEvent { + Uint8 type; /* SDL_JOYHATMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 hat; /* The joystick hat index */ + Uint8 value; /* The hat position value: + SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP + SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT + SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN + Note that zero means the POV is centered. + */ +} SDL_JoyHatEvent; + +/* Joystick button event structure */ +typedef struct SDL_JoyButtonEvent { + Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ + Uint8 which; /* The joystick device index */ + Uint8 button; /* The joystick button index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ +} SDL_JoyButtonEvent; + +/* The "window resized" event + When you get this event, you are responsible for setting a new video + mode with the new width and height. + */ +typedef struct SDL_ResizeEvent { + Uint8 type; /* SDL_VIDEORESIZE */ + int w; /* New width */ + int h; /* New height */ +} SDL_ResizeEvent; + +/* The "screen redraw" event */ +typedef struct SDL_ExposeEvent { + Uint8 type; /* SDL_VIDEOEXPOSE */ +} SDL_ExposeEvent; + +/* The "quit requested" event */ +typedef struct SDL_QuitEvent { + Uint8 type; /* SDL_QUIT */ +} SDL_QuitEvent; + +/* A user-defined event type */ +typedef struct SDL_UserEvent { + Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */ + int code; /* User defined event code */ + void *data1; /* User defined data pointer */ + void *data2; /* User defined data pointer */ +} SDL_UserEvent; + +/* If you want to use this event, you should include SDL_syswm.h */ +struct SDL_SysWMmsg; +typedef struct SDL_SysWMmsg SDL_SysWMmsg; +typedef struct SDL_SysWMEvent { + Uint8 type; + SDL_SysWMmsg *msg; +} SDL_SysWMEvent; + +/* General event structure */ +typedef union SDL_Event { + Uint8 type; + SDL_ActiveEvent active; + SDL_KeyboardEvent key; + SDL_MouseMotionEvent motion; + SDL_MouseButtonEvent button; + SDL_JoyAxisEvent jaxis; + SDL_JoyBallEvent jball; + SDL_JoyHatEvent jhat; + SDL_JoyButtonEvent jbutton; + SDL_ResizeEvent resize; + SDL_ExposeEvent expose; + SDL_QuitEvent quit; + SDL_UserEvent user; + SDL_SysWMEvent syswm; +} SDL_Event; + + +/* Function prototypes */ + +/* Pumps the event loop, gathering events from the input devices. + This function updates the event queue and internal input device state. + This should only be run in the thread that sets the video mode. +*/ +extern DECLSPEC void SDLCALL SDL_PumpEvents(void); + +/* Checks the event queue for messages and optionally returns them. + If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to + the back of the event queue. + If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will not + be removed from the queue. + If 'action' is SDL_GETEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will be + removed from the queue. + This function returns the number of events actually stored, or -1 + if there was an error. This function is thread-safe. +*/ +typedef enum { + SDL_ADDEVENT, + SDL_PEEKEVENT, + SDL_GETEVENT +} SDL_eventaction; +/* */ +extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, + SDL_eventaction action, Uint32 mask); + +/* Polls for currently pending events, and returns 1 if there are any pending + events, or 0 if there are none available. If 'event' is not NULL, the next + event is removed from the queue and stored in that area. + */ +extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event); + +/* Waits indefinitely for the next available event, returning 1, or 0 if there + was an error while waiting for events. If 'event' is not NULL, the next + event is removed from the queue and stored in that area. + */ +extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event); + +/* Add an event to the event queue. + This function returns 0 on success, or -1 if the event queue was full + or there was some other error. + */ +extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); + +/* + This function sets up a filter to process all events before they + change internal state and are posted to the internal event queue. + + The filter is protypted as: +*/ +typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event); +/* + If the filter returns 1, then the event will be added to the internal queue. + If it returns 0, then the event will be dropped from the queue, but the + internal state will still be updated. This allows selective filtering of + dynamically arriving events. + + WARNING: Be very careful of what you do in the event filter function, as + it may run in a different thread! + + There is one caveat when dealing with the SDL_QUITEVENT event type. The + event filter is only called when the window manager desires to close the + application window. If the event filter returns 1, then the window will + be closed, otherwise the window will remain open if possible. + If the quit event is generated by an interrupt signal, it will bypass the + internal queue and be delivered to the application at the next event poll. +*/ +extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter); + +/* + Return the current event filter - can be used to "chain" filters. + If there is no event filter set, this function returns NULL. +*/ +extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void); + +/* + This function allows you to set the state of processing certain events. + If 'state' is set to SDL_IGNORE, that event will be automatically dropped + from the event queue and will not event be filtered. + If 'state' is set to SDL_ENABLE, that event will be processed normally. + If 'state' is set to SDL_QUERY, SDL_EventState() will return the + current processing state of the specified event. +*/ +#define SDL_QUERY -1 +#define SDL_IGNORE 0 +#define SDL_DISABLE 0 +#define SDL_ENABLE 1 +extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_events_h */ diff --git a/src/include/SDL_getenv.h b/src/include/SDL_getenv.h new file mode 100644 index 0000000..853b9ce --- /dev/null +++ b/src/include/SDL_getenv.h @@ -0,0 +1,24 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* DEPRECATED */ +#include "SDL_stdinc.h" diff --git a/src/include/SDL_image.h b/src/include/SDL_image.h new file mode 100644 index 0000000..7bc332c --- /dev/null +++ b/src/include/SDL_image.h @@ -0,0 +1,116 @@ +/* + SDL_image: An example image loading library for use with SDL + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* A simple library to load images of various formats as SDL surfaces */ + +#ifndef _SDL_IMAGE_H +#define _SDL_IMAGE_H + +#include "SDL.h" +#include "SDL_version.h" +#include "begin_code.h" + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_IMAGE_MAJOR_VERSION 1 +#define SDL_IMAGE_MINOR_VERSION 2 +#define SDL_IMAGE_PATCHLEVEL 6 + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL_image library. + */ +#define SDL_IMAGE_VERSION(X) \ +{ \ + (X)->major = SDL_IMAGE_MAJOR_VERSION; \ + (X)->minor = SDL_IMAGE_MINOR_VERSION; \ + (X)->patch = SDL_IMAGE_PATCHLEVEL; \ +} + +/* This function gets the version of the dynamically linked SDL_image library. + it should NOT be used to fill a version structure, instead you should + use the SDL_IMAGE_VERSION() macro. + */ +extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void); + +/* Load an image from an SDL data source. + The 'type' may be one of: "BMP", "GIF", "PNG", etc. + + If the image format supports a transparent pixel, SDL will set the + colorkey for the surface. You can enable RLE acceleration on the + surface afterwards by calling: + SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey); + */ +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type); +/* Convenience functions */ +extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file); +extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc); + +/* Invert the alpha of a surface for use with OpenGL + This function is now a no-op, and only provided for backwards compatibility. +*/ +extern DECLSPEC int SDLCALL IMG_InvertAlpha(int on); + +/* Functions to detect a file type, given a seekable source */ +extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src); +extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src); +extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src); +extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src); +extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src); +extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src); +extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src); +extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src); +extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src); +extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src); +extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src); + +/* Individual loading functions */ +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src); +extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src); + +extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm); + +/* We'll use SDL for reporting errors */ +#define IMG_SetError SDL_SetError +#define IMG_GetError SDL_GetError + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_IMAGE_H */ diff --git a/src/include/SDL_joystick.h b/src/include/SDL_joystick.h new file mode 100644 index 0000000..e4f72f1 --- /dev/null +++ b/src/include/SDL_joystick.h @@ -0,0 +1,167 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Include file for SDL joystick event handling */ + +#ifndef _SDL_joystick_h +#define _SDL_joystick_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* In order to use these functions, SDL_Init() must have been called + with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system + for joysticks, and load appropriate drivers. +*/ + +/* The joystick structure used to identify an SDL joystick */ +struct _SDL_Joystick; +typedef struct _SDL_Joystick SDL_Joystick; + + +/* Function prototypes */ +/* + * Count the number of joysticks attached to the system + */ +extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); + +/* + * Get the implementation dependent name of a joystick. + * This can be called before any joysticks are opened. + * If no name can be found, this function returns NULL. + */ +extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index); + +/* + * Open a joystick for use - the index passed as an argument refers to + * the N'th joystick on the system. This index is the value which will + * identify this joystick in future joystick events. + * + * This function returns a joystick identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index); + +/* + * Returns 1 if the joystick has been opened, or 0 if it has not. + */ +extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index); + +/* + * Get the device index of an opened joystick. + */ +extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick); + +/* + * Get the number of general axis controls on a joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick); + +/* + * Get the number of trackballs on a joystick + * Joystick trackballs have only relative motion events associated + * with them and their state cannot be polled. + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick); + +/* + * Get the number of POV hats on a joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick); + +/* + * Get the number of buttons on a joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick); + +/* + * Update the current state of the open joysticks. + * This is called automatically by the event loop if any joystick + * events are enabled. + */ +extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); + +/* + * Enable/disable joystick event polling. + * If joystick events are disabled, you must call SDL_JoystickUpdate() + * yourself and check the state of the joystick when you want joystick + * information. + * The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. + */ +extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); + +/* + * Get the current state of an axis control on a joystick + * The state is a value ranging from -32768 to 32767. + * The axis indices start at index 0. + */ +extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); + +/* + * Get the current state of a POV hat on a joystick + * The return value is one of the following positions: + */ +#define SDL_HAT_CENTERED 0x00 +#define SDL_HAT_UP 0x01 +#define SDL_HAT_RIGHT 0x02 +#define SDL_HAT_DOWN 0x04 +#define SDL_HAT_LEFT 0x08 +#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) +#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) +#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) +#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) +/* + * The hat indices start at index 0. + */ +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat); + +/* + * Get the ball axis change since the last poll + * This returns 0, or -1 if you passed it invalid parameters. + * The ball indices start at index 0. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); + +/* + * Get the current state of a button on a joystick + * The button indices start at index 0. + */ +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button); + +/* + * Close a joystick previously opened with SDL_JoystickOpen() + */ +extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_joystick_h */ diff --git a/src/include/SDL_keyboard.h b/src/include/SDL_keyboard.h new file mode 100644 index 0000000..1ad7dca --- /dev/null +++ b/src/include/SDL_keyboard.h @@ -0,0 +1,121 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Include file for SDL keyboard event handling */ + +#ifndef _SDL_keyboard_h +#define _SDL_keyboard_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_keysym.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Keysym structure + - The scancode is hardware dependent, and should not be used by general + applications. If no hardware scancode is available, it will be 0. + + - The 'unicode' translated character is only available when character + translation is enabled by the SDL_EnableUNICODE() API. If non-zero, + this is a UNICODE character corresponding to the keypress. If the + high 9 bits of the character are 0, then this maps to the equivalent + ASCII character: + char ch; + if ( (keysym.unicode & 0xFF80) == 0 ) { + ch = keysym.unicode & 0x7F; + } else { + An international character.. + } + */ +typedef struct SDL_keysym { + Uint8 scancode; /* hardware specific scancode */ + SDLKey sym; /* SDL virtual keysym */ + SDLMod mod; /* current key modifiers */ + Uint16 unicode; /* translated character */ +} SDL_keysym; + +/* This is the mask which refers to all hotkey bindings */ +#define SDL_ALL_HOTKEYS 0xFFFFFFFF + +/* Function prototypes */ +/* + * Enable/Disable UNICODE translation of keyboard input. + * This translation has some overhead, so translation defaults off. + * If 'enable' is 1, translation is enabled. + * If 'enable' is 0, translation is disabled. + * If 'enable' is -1, the translation state is not changed. + * It returns the previous state of keyboard translation. + */ +extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); + +/* + * Enable/Disable keyboard repeat. Keyboard repeat defaults to off. + * 'delay' is the initial delay in ms between the time when a key is + * pressed, and keyboard repeat begins. + * 'interval' is the time in ms between keyboard repeat events. + */ +#define SDL_DEFAULT_REPEAT_DELAY 500 +#define SDL_DEFAULT_REPEAT_INTERVAL 30 +/* + * If 'delay' is set to 0, keyboard repeat is disabled. + */ +extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval); +extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval); + +/* + * Get a snapshot of the current state of the keyboard. + * Returns an array of keystates, indexed by the SDLK_* syms. + * Used: + * Uint8 *keystate = SDL_GetKeyState(NULL); + * if ( keystate[SDLK_RETURN] ) ... is pressed. + */ +extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys); + +/* + * Get the current key modifier state + */ +extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void); + +/* + * Set the current key modifier state + * This does not change the keyboard state, only the key modifier flags. + */ +extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate); + +/* + * Get the name of an SDL virtual keysym + */ +extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_keyboard_h */ diff --git a/src/include/SDL_keysym.h b/src/include/SDL_keysym.h new file mode 100644 index 0000000..ff44a03 --- /dev/null +++ b/src/include/SDL_keysym.h @@ -0,0 +1,311 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef _SDL_keysym_h +#define _SDL_keysym_h + +/* What we really want is a mapping of every raw key on the keyboard. + To support international keyboards, we use the range 0xA1 - 0xFF + as international virtual keycodes. We'll follow in the footsteps of X11... + The names of the keys + */ + +typedef enum { + /* The keyboard syms have been cleverly chosen to map to ASCII */ + SDLK_UNKNOWN = 0, + SDLK_FIRST = 0, + SDLK_BACKSPACE = 8, + SDLK_TAB = 9, + SDLK_CLEAR = 12, + SDLK_RETURN = 13, + SDLK_PAUSE = 19, + SDLK_ESCAPE = 27, + SDLK_SPACE = 32, + SDLK_EXCLAIM = 33, + SDLK_QUOTEDBL = 34, + SDLK_HASH = 35, + SDLK_DOLLAR = 36, + SDLK_AMPERSAND = 38, + SDLK_QUOTE = 39, + SDLK_LEFTPAREN = 40, + SDLK_RIGHTPAREN = 41, + SDLK_ASTERISK = 42, + SDLK_PLUS = 43, + SDLK_COMMA = 44, + SDLK_MINUS = 45, + SDLK_PERIOD = 46, + SDLK_SLASH = 47, + SDLK_0 = 48, + SDLK_1 = 49, + SDLK_2 = 50, + SDLK_3 = 51, + SDLK_4 = 52, + SDLK_5 = 53, + SDLK_6 = 54, + SDLK_7 = 55, + SDLK_8 = 56, + SDLK_9 = 57, + SDLK_COLON = 58, + SDLK_SEMICOLON = 59, + SDLK_LESS = 60, + SDLK_EQUALS = 61, + SDLK_GREATER = 62, + SDLK_QUESTION = 63, + SDLK_AT = 64, + /* + Skip uppercase letters + */ + SDLK_LEFTBRACKET = 91, + SDLK_BACKSLASH = 92, + SDLK_RIGHTBRACKET = 93, + SDLK_CARET = 94, + SDLK_UNDERSCORE = 95, + SDLK_BACKQUOTE = 96, + SDLK_a = 97, + SDLK_b = 98, + SDLK_c = 99, + SDLK_d = 100, + SDLK_e = 101, + SDLK_f = 102, + SDLK_g = 103, + SDLK_h = 104, + SDLK_i = 105, + SDLK_j = 106, + SDLK_k = 107, + SDLK_l = 108, + SDLK_m = 109, + SDLK_n = 110, + SDLK_o = 111, + SDLK_p = 112, + SDLK_q = 113, + SDLK_r = 114, + SDLK_s = 115, + SDLK_t = 116, + SDLK_u = 117, + SDLK_v = 118, + SDLK_w = 119, + SDLK_x = 120, + SDLK_y = 121, + SDLK_z = 122, + SDLK_DELETE = 127, + /* End of ASCII mapped keysyms */ + + /* International keyboard syms */ + SDLK_WORLD_0 = 160, /* 0xA0 */ + SDLK_WORLD_1 = 161, + SDLK_WORLD_2 = 162, + SDLK_WORLD_3 = 163, + SDLK_WORLD_4 = 164, + SDLK_WORLD_5 = 165, + SDLK_WORLD_6 = 166, + SDLK_WORLD_7 = 167, + SDLK_WORLD_8 = 168, + SDLK_WORLD_9 = 169, + SDLK_WORLD_10 = 170, + SDLK_WORLD_11 = 171, + SDLK_WORLD_12 = 172, + SDLK_WORLD_13 = 173, + SDLK_WORLD_14 = 174, + SDLK_WORLD_15 = 175, + SDLK_WORLD_16 = 176, + SDLK_WORLD_17 = 177, + SDLK_WORLD_18 = 178, + SDLK_WORLD_19 = 179, + SDLK_WORLD_20 = 180, + SDLK_WORLD_21 = 181, + SDLK_WORLD_22 = 182, + SDLK_WORLD_23 = 183, + SDLK_WORLD_24 = 184, + SDLK_WORLD_25 = 185, + SDLK_WORLD_26 = 186, + SDLK_WORLD_27 = 187, + SDLK_WORLD_28 = 188, + SDLK_WORLD_29 = 189, + SDLK_WORLD_30 = 190, + SDLK_WORLD_31 = 191, + SDLK_WORLD_32 = 192, + SDLK_WORLD_33 = 193, + SDLK_WORLD_34 = 194, + SDLK_WORLD_35 = 195, + SDLK_WORLD_36 = 196, + SDLK_WORLD_37 = 197, + SDLK_WORLD_38 = 198, + SDLK_WORLD_39 = 199, + SDLK_WORLD_40 = 200, + SDLK_WORLD_41 = 201, + SDLK_WORLD_42 = 202, + SDLK_WORLD_43 = 203, + SDLK_WORLD_44 = 204, + SDLK_WORLD_45 = 205, + SDLK_WORLD_46 = 206, + SDLK_WORLD_47 = 207, + SDLK_WORLD_48 = 208, + SDLK_WORLD_49 = 209, + SDLK_WORLD_50 = 210, + SDLK_WORLD_51 = 211, + SDLK_WORLD_52 = 212, + SDLK_WORLD_53 = 213, + SDLK_WORLD_54 = 214, + SDLK_WORLD_55 = 215, + SDLK_WORLD_56 = 216, + SDLK_WORLD_57 = 217, + SDLK_WORLD_58 = 218, + SDLK_WORLD_59 = 219, + SDLK_WORLD_60 = 220, + SDLK_WORLD_61 = 221, + SDLK_WORLD_62 = 222, + SDLK_WORLD_63 = 223, + SDLK_WORLD_64 = 224, + SDLK_WORLD_65 = 225, + SDLK_WORLD_66 = 226, + SDLK_WORLD_67 = 227, + SDLK_WORLD_68 = 228, + SDLK_WORLD_69 = 229, + SDLK_WORLD_70 = 230, + SDLK_WORLD_71 = 231, + SDLK_WORLD_72 = 232, + SDLK_WORLD_73 = 233, + SDLK_WORLD_74 = 234, + SDLK_WORLD_75 = 235, + SDLK_WORLD_76 = 236, + SDLK_WORLD_77 = 237, + SDLK_WORLD_78 = 238, + SDLK_WORLD_79 = 239, + SDLK_WORLD_80 = 240, + SDLK_WORLD_81 = 241, + SDLK_WORLD_82 = 242, + SDLK_WORLD_83 = 243, + SDLK_WORLD_84 = 244, + SDLK_WORLD_85 = 245, + SDLK_WORLD_86 = 246, + SDLK_WORLD_87 = 247, + SDLK_WORLD_88 = 248, + SDLK_WORLD_89 = 249, + SDLK_WORLD_90 = 250, + SDLK_WORLD_91 = 251, + SDLK_WORLD_92 = 252, + SDLK_WORLD_93 = 253, + SDLK_WORLD_94 = 254, + SDLK_WORLD_95 = 255, /* 0xFF */ + + /* Numeric keypad */ + SDLK_KP0 = 256, + SDLK_KP1 = 257, + SDLK_KP2 = 258, + SDLK_KP3 = 259, + SDLK_KP4 = 260, + SDLK_KP5 = 261, + SDLK_KP6 = 262, + SDLK_KP7 = 263, + SDLK_KP8 = 264, + SDLK_KP9 = 265, + SDLK_KP_PERIOD = 266, + SDLK_KP_DIVIDE = 267, + SDLK_KP_MULTIPLY = 268, + SDLK_KP_MINUS = 269, + SDLK_KP_PLUS = 270, + SDLK_KP_ENTER = 271, + SDLK_KP_EQUALS = 272, + + /* Arrows + Home/End pad */ + SDLK_UP = 273, + SDLK_DOWN = 274, + SDLK_RIGHT = 275, + SDLK_LEFT = 276, + SDLK_INSERT = 277, + SDLK_HOME = 278, + SDLK_END = 279, + SDLK_PAGEUP = 280, + SDLK_PAGEDOWN = 281, + + /* Function keys */ + SDLK_F1 = 282, + SDLK_F2 = 283, + SDLK_F3 = 284, + SDLK_F4 = 285, + SDLK_F5 = 286, + SDLK_F6 = 287, + SDLK_F7 = 288, + SDLK_F8 = 289, + SDLK_F9 = 290, + SDLK_F10 = 291, + SDLK_F11 = 292, + SDLK_F12 = 293, + SDLK_F13 = 294, + SDLK_F14 = 295, + SDLK_F15 = 296, + + /* Key state modifier keys */ + SDLK_NUMLOCK = 300, + SDLK_CAPSLOCK = 301, + SDLK_SCROLLOCK = 302, + SDLK_RSHIFT = 303, + SDLK_LSHIFT = 304, + SDLK_RCTRL = 305, + SDLK_LCTRL = 306, + SDLK_RALT = 307, + SDLK_LALT = 308, + SDLK_RMETA = 309, + SDLK_LMETA = 310, + SDLK_LSUPER = 311, /* Left "Windows" key */ + SDLK_RSUPER = 312, /* Right "Windows" key */ + SDLK_MODE = 313, /* "Alt Gr" key */ + SDLK_COMPOSE = 314, /* Multi-key compose key */ + + /* Miscellaneous function keys */ + SDLK_HELP = 315, + SDLK_PRINT = 316, + SDLK_SYSREQ = 317, + SDLK_BREAK = 318, + SDLK_MENU = 319, + SDLK_POWER = 320, /* Power Macintosh power key */ + SDLK_EURO = 321, /* Some european keyboards */ + SDLK_UNDO = 322, /* Atari keyboard has Undo */ + + /* Add any other keys here */ + + SDLK_LAST +} SDLKey; + +/* Enumeration of valid key mods (possibly OR'd together) */ +typedef enum { + KMOD_NONE = 0x0000, + KMOD_LSHIFT= 0x0001, + KMOD_RSHIFT= 0x0002, + KMOD_LCTRL = 0x0040, + KMOD_RCTRL = 0x0080, + KMOD_LALT = 0x0100, + KMOD_RALT = 0x0200, + KMOD_LMETA = 0x0400, + KMOD_RMETA = 0x0800, + KMOD_NUM = 0x1000, + KMOD_CAPS = 0x2000, + KMOD_MODE = 0x4000, + KMOD_RESERVED = 0x8000 +} SDLMod; + +#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) +#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) +#define KMOD_ALT (KMOD_LALT|KMOD_RALT) +#define KMOD_META (KMOD_LMETA|KMOD_RMETA) + +#endif /* _SDL_keysym_h */ diff --git a/src/include/SDL_loadso.h b/src/include/SDL_loadso.h new file mode 100644 index 0000000..ce96449 --- /dev/null +++ b/src/include/SDL_loadso.h @@ -0,0 +1,74 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* System dependent library loading routines */ + +/* Some things to keep in mind: + - These functions only work on C function names. Other languages may + have name mangling and intrinsic language support that varies from + compiler to compiler. + - Make sure you declare your function pointers with the same calling + convention as the actual library function. Your code will crash + mysteriously if you do not do this. + - Avoid namespace collisions. If you load a symbol from the library, + it is not defined whether or not it goes into the global symbol + namespace for the application. If it does and it conflicts with + symbols in your code or other shared libraries, you will not get + the results you expect. :) +*/ + + +#ifndef _SDL_loadso_h +#define _SDL_loadso_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* This function dynamically loads a shared object and returns a pointer + * to the object handle (or NULL if there was an error). + * The 'sofile' parameter is a system dependent name of the object file. + */ +extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile); + +/* Given an object handle, this function looks up the address of the + * named function in the shared object and returns it. This address + * is no longer valid after calling SDL_UnloadObject(). + */ +extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name); + +/* Unload a shared object from memory */ +extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_loadso_h */ diff --git a/src/include/SDL_main.h b/src/include/SDL_main.h new file mode 100644 index 0000000..cf8b728 --- /dev/null +++ b/src/include/SDL_main.h @@ -0,0 +1,98 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef _SDL_main_h +#define _SDL_main_h + +#include "SDL_stdinc.h" + +/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */ + +#if defined(__WIN32__) || \ + (defined(__MWERKS__) && !defined(__BEOS__)) || \ + defined(__MACOS__) || defined(__MACOSX__) || \ + defined(__SYMBIAN32__) || defined(QWS) + +#ifdef __cplusplus +#define C_LINKAGE "C" +#else +#define C_LINKAGE +#endif /* __cplusplus */ + +/* The application's main() function must be called with C linkage, + and should be declared like this: +#ifdef __cplusplus +extern "C" +#endif + int main(int argc, char *argv[]) + { + } + */ +#define main SDL_main + +/* The prototype for the application's main() function */ +extern C_LINKAGE int SDL_main(int argc, char *argv[]); + + +/* From the SDL library code -- needed for registering the app on Win32 */ +#ifdef __WIN32__ + +#include "begin_code.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* This should be called from your WinMain() function, if any */ +extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst); +/* This can also be called, but is no longer necessary */ +extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); +/* This can also be called, but is no longer necessary (SDL_Quit calls it) */ +extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); +#ifdef __cplusplus +} +#endif +#include "close_code.h" +#endif + +/* From the SDL library code -- needed for registering QuickDraw on MacOS */ +#if defined(__MACOS__) + +#include "begin_code.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declaration so we don't need to include QuickDraw.h */ +struct QDGlobals; + +/* This should be called from your main() function, if any */ +extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); + +#ifdef __cplusplus +} +#endif +#include "close_code.h" +#endif + +#endif /* Need to redefine main()? */ + +#endif /* _SDL_main_h */ diff --git a/src/include/SDL_mixer.h b/src/include/SDL_mixer.h new file mode 100644 index 0000000..cf0a095 --- /dev/null +++ b/src/include/SDL_mixer.h @@ -0,0 +1,583 @@ +/* + SDL_mixer: An audio mixer library based on the SDL library + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* $Id: SDL_mixer.h,v 1.2 2007/08/12 09:32:55 eihrul Exp $ */ + +#ifndef _SDL_MIXER_H +#define _SDL_MIXER_H + +#include "SDL_types.h" +#include "SDL_rwops.h" +#include "SDL_audio.h" +#include "SDL_endian.h" +#include "SDL_version.h" +#include "begin_code.h" + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_MIXER_MAJOR_VERSION 1 +#define SDL_MIXER_MINOR_VERSION 2 +#define SDL_MIXER_PATCHLEVEL 8 + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL_mixer library. + */ +#define SDL_MIXER_VERSION(X) \ +{ \ + (X)->major = SDL_MIXER_MAJOR_VERSION; \ + (X)->minor = SDL_MIXER_MINOR_VERSION; \ + (X)->patch = SDL_MIXER_PATCHLEVEL; \ +} + +/* Backwards compatibility */ +#define MIX_MAJOR_VERSION SDL_MIXER_MAJOR_VERSION +#define MIX_MINOR_VERSION SDL_MIXER_MINOR_VERSION +#define MIX_PATCHLEVEL SDL_MIXER_PATCHLEVEL +#define MIX_VERSION(X) SDL_MIXER_VERSION(X) + +/* This function gets the version of the dynamically linked SDL_mixer library. + it should NOT be used to fill a version structure, instead you should + use the SDL_MIXER_VERSION() macro. + */ +extern DECLSPEC const SDL_version * SDLCALL Mix_Linked_Version(void); + + +/* The default mixer has 8 simultaneous mixing channels */ +#ifndef MIX_CHANNELS +#define MIX_CHANNELS 8 +#endif + +/* Good default values for a PC soundcard */ +#define MIX_DEFAULT_FREQUENCY 22050 +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define MIX_DEFAULT_FORMAT AUDIO_S16LSB +#else +#define MIX_DEFAULT_FORMAT AUDIO_S16MSB +#endif +#define MIX_DEFAULT_CHANNELS 2 +#define MIX_MAX_VOLUME 128 /* Volume of a chunk */ + +/* The internal format for an audio chunk */ +typedef struct Mix_Chunk { + int allocated; + Uint8 *abuf; + Uint32 alen; + Uint8 volume; /* Per-sample volume, 0-128 */ +} Mix_Chunk; + +/* The different fading types supported */ +typedef enum { + MIX_NO_FADING, + MIX_FADING_OUT, + MIX_FADING_IN +} Mix_Fading; + +typedef enum { + MUS_NONE, + MUS_CMD, + MUS_WAV, + MUS_MOD, + MUS_MID, + MUS_OGG, + MUS_MP3, + MUS_MP3_MAD +} Mix_MusicType; + +/* The internal format for a music chunk interpreted via mikmod */ +typedef struct _Mix_Music Mix_Music; + +/* Open the mixer with a certain audio format */ +extern DECLSPEC int SDLCALL Mix_OpenAudio(int frequency, Uint16 format, int channels, + int chunksize); + +/* Dynamically change the number of channels managed by the mixer. + If decreasing the number of channels, the upper channels are + stopped. + This function returns the new number of allocated channels. + */ +extern DECLSPEC int SDLCALL Mix_AllocateChannels(int numchans); + +/* Find out what the actual audio device parameters are. + This function returns 1 if the audio has been opened, 0 otherwise. + */ +extern DECLSPEC int SDLCALL Mix_QuerySpec(int *frequency,Uint16 *format,int *channels); + +/* Load a wave file or a music (.mod .s3m .it .xm) file */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_LoadWAV_RW(SDL_RWops *src, int freesrc); +#define Mix_LoadWAV(file) Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1) +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS(const char *file); + +/* Load a music file from an SDL_RWop object (Ogg and MikMod specific currently) + Matt Campbell (matt@campbellhome.dhs.org) April 2000 */ +extern DECLSPEC Mix_Music * SDLCALL Mix_LoadMUS_RW(SDL_RWops *rw); + +/* Load a wave file of the mixer format from a memory buffer */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_WAV(Uint8 *mem); + +/* Load raw audio data of the mixer format from a memory buffer */ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_QuickLoad_RAW(Uint8 *mem, Uint32 len); + +/* Free an audio chunk previously loaded */ +extern DECLSPEC void SDLCALL Mix_FreeChunk(Mix_Chunk *chunk); +extern DECLSPEC void SDLCALL Mix_FreeMusic(Mix_Music *music); + +/* Find out the music format of a mixer music, or the currently playing + music, if 'music' is NULL. +*/ +extern DECLSPEC Mix_MusicType SDLCALL Mix_GetMusicType(const Mix_Music *music); + +/* Set a function that is called after all mixing is performed. + This can be used to provide real-time visual display of the audio stream + or add a custom mixer filter for the stream data. +*/ +extern DECLSPEC void SDLCALL Mix_SetPostMix(void (*mix_func) + (void *udata, Uint8 *stream, int len), void *arg); + +/* Add your own music player or additional mixer function. + If 'mix_func' is NULL, the default music player is re-enabled. + */ +extern DECLSPEC void SDLCALL Mix_HookMusic(void (*mix_func) + (void *udata, Uint8 *stream, int len), void *arg); + +/* Add your own callback when the music has finished playing. + This callback is only called if the music finishes naturally. + */ +extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (*music_finished)(void)); + +/* Get a pointer to the user data for the current music hook */ +extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void); + +/* + * Add your own callback when a channel has finished playing. NULL + * to disable callback. The callback may be called from the mixer's audio + * callback or it could be called as a result of Mix_HaltChannel(), etc. + * do not call SDL_LockAudio() from this callback; you will either be + * inside the audio callback, or SDL_mixer will explicitly lock the audio + * before calling your callback. + */ +extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (*channel_finished)(int channel)); + + +/* Special Effects API by ryan c. gordon. (icculus@icculus.org) */ + +#define MIX_CHANNEL_POST -2 + +/* This is the format of a special effect callback: + * + * myeffect(int chan, void *stream, int len, void *udata); + * + * (chan) is the channel number that your effect is affecting. (stream) is + * the buffer of data to work upon. (len) is the size of (stream), and + * (udata) is a user-defined bit of data, which you pass as the last arg of + * Mix_RegisterEffect(), and is passed back unmolested to your callback. + * Your effect changes the contents of (stream) based on whatever parameters + * are significant, or just leaves it be, if you prefer. You can do whatever + * you like to the buffer, though, and it will continue in its changed state + * down the mixing pipeline, through any other effect functions, then finally + * to be mixed with the rest of the channels and music for the final output + * stream. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + */ +typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata); + +/* + * This is a callback that signifies that a channel has finished all its + * loops and has completed playback. This gets called if the buffer + * plays out normally, or if you call Mix_HaltChannel(), implicitly stop + * a channel via Mix_AllocateChannels(), or unregister a callback while + * it's still playing. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + */ +typedef void (*Mix_EffectDone_t)(int chan, void *udata); + + +/* Register a special effect function. At mixing time, the channel data is + * copied into a buffer and passed through each registered effect function. + * After it passes through all the functions, it is mixed into the final + * output stream. The copy to buffer is performed once, then each effect + * function performs on the output of the previous effect. Understand that + * this extra copy to a buffer is not performed if there are no effects + * registered for a given chunk, which saves CPU cycles, and any given + * effect will be extra cycles, too, so it is crucial that your code run + * fast. Also note that the data that your function is given is in the + * format of the sound device, and not the format you gave to Mix_OpenAudio(), + * although they may in reality be the same. This is an unfortunate but + * necessary speed concern. Use Mix_QuerySpec() to determine if you can + * handle the data before you register your effect, and take appropriate + * actions. + * You may also specify a callback (Mix_EffectDone_t) that is called when + * the channel finishes playing. This gives you a more fine-grained control + * than Mix_ChannelFinished(), in case you need to free effect-specific + * resources, etc. If you don't need this, you can specify NULL. + * You may set the callbacks before or after calling Mix_PlayChannel(). + * Things like Mix_SetPanning() are just internal special effect functions, + * so if you are using that, you've already incurred the overhead of a copy + * to a separate buffer, and that these effects will be in the queue with + * any functions you've registered. The list of registered effects for a + * channel is reset when a chunk finishes playing, so you need to explicitly + * set them with each call to Mix_PlayChannel*(). + * You may also register a special effect function that is to be run after + * final mixing occurs. The rules for these callbacks are identical to those + * in Mix_RegisterEffect, but they are run after all the channels and the + * music have been mixed into a single stream, whereas channel-specific + * effects run on a given channel before any other mixing occurs. These + * global effect callbacks are call "posteffects". Posteffects only have + * their Mix_EffectDone_t function called when they are unregistered (since + * the main output stream is never "done" in the same sense as a channel). + * You must unregister them manually when you've had enough. Your callback + * will be told that the channel being mixed is (MIX_CHANNEL_POST) if the + * processing is considered a posteffect. + * + * After all these effects have finished processing, the callback registered + * through Mix_SetPostMix() runs, and then the stream goes to the audio + * device. + * + * DO NOT EVER call SDL_LockAudio() from your callback function! + * + * returns zero if error (no such channel), nonzero if added. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_RegisterEffect(int chan, Mix_EffectFunc_t f, + Mix_EffectDone_t d, void *arg); + + +/* You may not need to call this explicitly, unless you need to stop an + * effect from processing in the middle of a chunk's playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel or effect), nonzero if removed. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_UnregisterEffect(int channel, Mix_EffectFunc_t f); + + +/* You may not need to call this explicitly, unless you need to stop all + * effects from processing in the middle of a chunk's playback. Note that + * this will also shut off some internal effect processing, since + * Mix_SetPanning() and others may use this API under the hood. This is + * called internally when a channel completes playback. + * Posteffects are never implicitly unregistered as they are for channels, + * but they may be explicitly unregistered through this function by + * specifying MIX_CHANNEL_POST for a channel. + * returns zero if error (no such channel), nonzero if all effects removed. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_UnregisterAllEffects(int channel); + + +#define MIX_EFFECTSMAXSPEED "MIX_EFFECTSMAXSPEED" + +/* + * These are the internally-defined mixing effects. They use the same API that + * effects defined in the application use, but are provided here as a + * convenience. Some effects can reduce their quality or use more memory in + * the name of speed; to enable this, make sure the environment variable + * MIX_EFFECTSMAXSPEED (see above) is defined before you call + * Mix_OpenAudio(). + */ + + +/* Set the panning of a channel. The left and right channels are specified + * as integers between 0 and 255, quietest to loudest, respectively. + * + * Technically, this is just individual volume control for a sample with + * two (stereo) channels, so it can be used for more than just panning. + * If you want real panning, call it like this: + * + * Mix_SetPanning(channel, left, 255 - left); + * + * ...which isn't so hard. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the panning will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect() API internally, and returns without + * registering the effect function if the audio device is not configured + * for stereo output. Setting both (left) and (right) to 255 causes this + * effect to be unregistered, since that is the data's normal state. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if panning effect enabled. Note that an audio device in mono + * mode is a no-op, but this call will return successful in that case. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetPanning(int channel, Uint8 left, Uint8 right); + + +/* Set the position of a channel. (angle) is an integer from 0 to 360, that + * specifies the location of the sound in relation to the listener. (angle) + * will be reduced as neccesary (540 becomes 180 degrees, -100 becomes 260). + * Angle 0 is due north, and rotates clockwise as the value increases. + * For efficiency, the precision of this effect may be limited (angles 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc). + * (distance) is an integer between 0 and 255 that specifies the space + * between the sound and the listener. The larger the number, the further + * away the sound is. Using 255 does not guarantee that the channel will be + * culled from the mixing process or be completely silent. For efficiency, + * the precision of this effect may be limited (distance 0 through 5 might + * all produce the same effect, 6 through 10 are equal, etc). Setting (angle) + * and (distance) to 0 unregisters this effect, since the data would be + * unchanged. + * + * If you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer. This is only meant to be a + * basic effect for simple "3D" games. + * + * If the audio device is configured for mono output, then you won't get + * any effectiveness from the angle; however, distance attenuation on the + * channel will still occur. While this effect will function with stereo + * voices, it makes more sense to use voices with only one channel of sound, + * so when they are mixed through this effect, the positioning will sound + * correct. You can convert them to mono through SDL before giving them to + * the mixer in the first place if you like. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the positioning will be done to the final mixed stream before passing it + * on to the audio device. + * + * This is a convenience wrapper over Mix_SetDistance() and Mix_SetPanning(). + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetPosition(int channel, Sint16 angle, Uint8 distance); + + +/* Set the "distance" of a channel. (distance) is an integer from 0 to 255 + * that specifies the location of the sound in relation to the listener. + * Distance 0 is overlapping the listener, and 255 is as far away as possible + * A distance of 255 does not guarantee silence; in such a case, you might + * want to try changing the chunk's volume, or just cull the sample from the + * mixing process with Mix_HaltChannel(). + * For efficiency, the precision of this effect may be limited (distances 1 + * through 7 might all produce the same effect, 8 through 15 are equal, etc). + * (distance) is an integer between 0 and 255 that specifies the space + * between the sound and the listener. The larger the number, the further + * away the sound is. + * Setting (distance) to 0 unregisters this effect, since the data would be + * unchanged. + * If you need more precise positional audio, consider using OpenAL for + * spatialized effects instead of SDL_mixer. This is only meant to be a + * basic effect for simple "3D" games. + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the distance attenuation will be done to the final mixed stream before + * passing it on to the audio device. + * + * This uses the Mix_RegisterEffect() API internally. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if position effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetDistance(int channel, Uint8 distance); + + +/* + * !!! FIXME : Haven't implemented, since the effect goes past the + * end of the sound buffer. Will have to think about this. + * --ryan. + */ +#if 0 +/* Causes an echo effect to be mixed into a sound. (echo) is the amount + * of echo to mix. 0 is no echo, 255 is infinite (and probably not + * what you want). + * + * Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and + * the reverbing will be done to the final mixed stream before passing it on + * to the audio device. + * + * This uses the Mix_RegisterEffect() API internally. If you specify an echo + * of zero, the effect is unregistered, as the data is already in that state. + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if reversing effect is enabled. + * Error messages can be retrieved from Mix_GetError(). + */ +extern no_parse_DECLSPEC int SDLCALL Mix_SetReverb(int channel, Uint8 echo); +#endif + +/* Causes a channel to reverse its stereo. This is handy if the user has his + * speakers hooked up backwards, or you would like to have a minor bit of + * psychedelia in your sound code. :) Calling this function with (flip) + * set to non-zero reverses the chunks's usual channels. If (flip) is zero, + * the effect is unregistered. + * + * This uses the Mix_RegisterEffect() API internally, and thus is probably + * more CPU intensive than having the user just plug in his speakers + * correctly. Mix_SetReverseStereo() returns without registering the effect + * function if the audio device is not configured for stereo output. + * + * If you specify MIX_CHANNEL_POST for (channel), then this the effect is used + * on the final mixed stream before sending it on to the audio device (a + * posteffect). + * + * returns zero if error (no such channel or Mix_RegisterEffect() fails), + * nonzero if reversing effect is enabled. Note that an audio device in mono + * mode is a no-op, but this call will return successful in that case. + * Error messages can be retrieved from Mix_GetError(). + */ +extern DECLSPEC int SDLCALL Mix_SetReverseStereo(int channel, int flip); + +/* end of effects API. --ryan. */ + + +/* Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate + them dynamically to the next sample if requested with a -1 value below. + Returns the number of reserved channels. + */ +extern DECLSPEC int SDLCALL Mix_ReserveChannels(int num); + +/* Channel grouping functions */ + +/* Attach a tag to a channel. A tag can be assigned to several mixer + channels, to form groups of channels. + If 'tag' is -1, the tag is removed (actually -1 is the tag used to + represent the group of all the channels). + Returns true if everything was OK. + */ +extern DECLSPEC int SDLCALL Mix_GroupChannel(int which, int tag); +/* Assign several consecutive channels to a group */ +extern DECLSPEC int SDLCALL Mix_GroupChannels(int from, int to, int tag); +/* Finds the first available channel in a group of channels, + returning -1 if none are available. + */ +extern DECLSPEC int SDLCALL Mix_GroupAvailable(int tag); +/* Returns the number of channels in a group. This is also a subtle + way to get the total number of channels when 'tag' is -1 + */ +extern DECLSPEC int SDLCALL Mix_GroupCount(int tag); +/* Finds the "oldest" sample playing in a group of channels */ +extern DECLSPEC int SDLCALL Mix_GroupOldest(int tag); +/* Finds the "most recent" (i.e. last) sample playing in a group of channels */ +extern DECLSPEC int SDLCALL Mix_GroupNewer(int tag); + +/* Play an audio chunk on a specific channel. + If the specified channel is -1, play on the first free channel. + If 'loops' is greater than zero, loop the sound that many times. + If 'loops' is -1, loop inifinitely (~65000 times). + Returns which channel was used to play the sound. +*/ +#define Mix_PlayChannel(channel,chunk,loops) Mix_PlayChannelTimed(channel,chunk,loops,-1) +/* The same as above, but the sound is played at most 'ticks' milliseconds */ +extern DECLSPEC int SDLCALL Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks); +extern DECLSPEC int SDLCALL Mix_PlayMusic(Mix_Music *music, int loops); + +/* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */ +extern DECLSPEC int SDLCALL Mix_FadeInMusic(Mix_Music *music, int loops, int ms); +extern DECLSPEC int SDLCALL Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position); +#define Mix_FadeInChannel(channel,chunk,loops,ms) Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1) +extern DECLSPEC int SDLCALL Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks); + +/* Set the volume in the range of 0-128 of a specific channel or chunk. + If the specified channel is -1, set volume for all channels. + Returns the original volume. + If the specified volume is -1, just return the current volume. +*/ +extern DECLSPEC int SDLCALL Mix_Volume(int channel, int volume); +extern DECLSPEC int SDLCALL Mix_VolumeChunk(Mix_Chunk *chunk, int volume); +extern DECLSPEC int SDLCALL Mix_VolumeMusic(int volume); + +/* Halt playing of a particular channel */ +extern DECLSPEC int SDLCALL Mix_HaltChannel(int channel); +extern DECLSPEC int SDLCALL Mix_HaltGroup(int tag); +extern DECLSPEC int SDLCALL Mix_HaltMusic(void); + +/* Change the expiration delay for a particular channel. + The sample will stop playing after the 'ticks' milliseconds have elapsed, + or remove the expiration if 'ticks' is -1 +*/ +extern DECLSPEC int SDLCALL Mix_ExpireChannel(int channel, int ticks); + +/* Halt a channel, fading it out progressively till it's silent + The ms parameter indicates the number of milliseconds the fading + will take. + */ +extern DECLSPEC int SDLCALL Mix_FadeOutChannel(int which, int ms); +extern DECLSPEC int SDLCALL Mix_FadeOutGroup(int tag, int ms); +extern DECLSPEC int SDLCALL Mix_FadeOutMusic(int ms); + +/* Query the fading status of a channel */ +extern DECLSPEC Mix_Fading SDLCALL Mix_FadingMusic(void); +extern DECLSPEC Mix_Fading SDLCALL Mix_FadingChannel(int which); + +/* Pause/Resume a particular channel */ +extern DECLSPEC void SDLCALL Mix_Pause(int channel); +extern DECLSPEC void SDLCALL Mix_Resume(int channel); +extern DECLSPEC int SDLCALL Mix_Paused(int channel); + +/* Pause/Resume the music stream */ +extern DECLSPEC void SDLCALL Mix_PauseMusic(void); +extern DECLSPEC void SDLCALL Mix_ResumeMusic(void); +extern DECLSPEC void SDLCALL Mix_RewindMusic(void); +extern DECLSPEC int SDLCALL Mix_PausedMusic(void); + +/* Set the current position in the music stream. + This returns 0 if successful, or -1 if it failed or isn't implemented. + This function is only implemented for MOD music formats (set pattern + order number) and for OGG music (set position in seconds), at the + moment. +*/ +extern DECLSPEC int SDLCALL Mix_SetMusicPosition(double position); + +/* Check the status of a specific channel. + If the specified channel is -1, check all channels. +*/ +extern DECLSPEC int SDLCALL Mix_Playing(int channel); +extern DECLSPEC int SDLCALL Mix_PlayingMusic(void); + +/* Stop music and set external music playback command */ +extern DECLSPEC int SDLCALL Mix_SetMusicCMD(const char *command); + +/* Synchro value is set by MikMod from modules while playing */ +extern DECLSPEC int SDLCALL Mix_SetSynchroValue(int value); +extern DECLSPEC int SDLCALL Mix_GetSynchroValue(void); + +/* Get the Mix_Chunk currently associated with a mixer channel + Returns NULL if it's an invalid channel, or there's no chunk associated. +*/ +extern DECLSPEC Mix_Chunk * SDLCALL Mix_GetChunk(int channel); + +/* Close the mixer, halting all playing audio */ +extern DECLSPEC void SDLCALL Mix_CloseAudio(void); + +/* We'll use SDL for reporting errors */ +#define Mix_SetError SDL_SetError +#define Mix_GetError SDL_GetError + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_MIXER_H */ diff --git a/src/include/SDL_mouse.h b/src/include/SDL_mouse.h new file mode 100644 index 0000000..c2364d8 --- /dev/null +++ b/src/include/SDL_mouse.h @@ -0,0 +1,136 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Include file for SDL mouse event handling */ + +#ifndef _SDL_mouse_h +#define _SDL_mouse_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct WMcursor WMcursor; /* Implementation dependent */ +typedef struct SDL_Cursor { + SDL_Rect area; /* The area of the mouse cursor */ + Sint16 hot_x, hot_y; /* The "tip" of the cursor */ + Uint8 *data; /* B/W cursor data */ + Uint8 *mask; /* B/W cursor mask */ + Uint8 *save[2]; /* Place to save cursor area */ + WMcursor *wm_cursor; /* Window-manager cursor */ +} SDL_Cursor; + +/* Function prototypes */ +/* + * Retrieve the current state of the mouse. + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * current mouse cursor position. You can pass NULL for either x or y. + */ +extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y); + +/* + * Retrieve the current state of the mouse. + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * mouse deltas since the last call to SDL_GetRelativeMouseState(). + */ +extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); + +/* + * Set the position of the mouse cursor (generates a mouse motion event) + */ +extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y); + +/* + * Create a cursor using the specified data and mask (in MSB format). + * The cursor width must be a multiple of 8 bits. + * + * The cursor is created in black and white according to the following: + * data mask resulting pixel on screen + * 0 1 White + * 1 1 Black + * 0 0 Transparent + * 1 0 Inverted color if possible, black if not. + * + * Cursors created with this function must be freed with SDL_FreeCursor(). + */ +extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor + (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y); + +/* + * Set the currently active cursor to the specified one. + * If the cursor is currently visible, the change will be immediately + * represented on the display. + */ +extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor); + +/* + * Returns the currently active cursor. + */ +extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void); + +/* + * Deallocates a cursor created with SDL_CreateCursor(). + */ +extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor); + +/* + * Toggle whether or not the cursor is shown on the screen. + * The cursor start off displayed, but can be turned off. + * SDL_ShowCursor() returns 1 if the cursor was being displayed + * before the call, or 0 if it was not. You can query the current + * state by passing a 'toggle' value of -1. + */ +extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); + +/* Used as a mask when testing buttons in buttonstate + Button 1: Left mouse button + Button 2: Middle mouse button + Button 3: Right mouse button + Button 4: Mouse wheel up (may also be a real button) + Button 5: Mouse wheel down (may also be a real button) + */ +#define SDL_BUTTON(X) (1 << ((X)-1)) +#define SDL_BUTTON_LEFT 1 +#define SDL_BUTTON_MIDDLE 2 +#define SDL_BUTTON_RIGHT 3 +#define SDL_BUTTON_WHEELUP 4 +#define SDL_BUTTON_WHEELDOWN 5 +#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) +#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) +#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_mouse_h */ diff --git a/src/include/SDL_mutex.h b/src/include/SDL_mutex.h new file mode 100644 index 0000000..0016528 --- /dev/null +++ b/src/include/SDL_mutex.h @@ -0,0 +1,162 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef _SDL_mutex_h +#define _SDL_mutex_h + +/* Functions to provide thread synchronization primitives + + These are independent of the other SDL routines. +*/ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Synchronization functions which can time out return this value + if they time out. +*/ +#define SDL_MUTEX_TIMEDOUT 1 + +/* This is the timeout value which corresponds to never time out */ +#define SDL_MUTEX_MAXWAIT (~(Uint32)0) + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* Mutex functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* The SDL mutex structure, defined in SDL_mutex.c */ +struct SDL_mutex; +typedef struct SDL_mutex SDL_mutex; + +/* Create a mutex, initialized unlocked */ +extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void); + +/* Lock the mutex (Returns 0, or -1 on error) */ +#define SDL_LockMutex(m) SDL_mutexP(m) +extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex); + +/* Unlock the mutex (Returns 0, or -1 on error) + It is an error to unlock a mutex that has not been locked by + the current thread, and doing so results in undefined behavior. + */ +#define SDL_UnlockMutex(m) SDL_mutexV(m) +extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex); + +/* Destroy a mutex */ +extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* Semaphore functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* The SDL semaphore structure, defined in SDL_sem.c */ +struct SDL_semaphore; +typedef struct SDL_semaphore SDL_sem; + +/* Create a semaphore, initialized with value, returns NULL on failure. */ +extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value); + +/* Destroy a semaphore */ +extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem); + +/* This function suspends the calling thread until the semaphore pointed + * to by sem has a positive count. It then atomically decreases the semaphore + * count. + */ +extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem); + +/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds, + SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error. +*/ +extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem); + +/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if + the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in + the allotted time, and -1 on error. + On some platforms this function is implemented by looping with a delay + of 1 ms, and so should be avoided if possible. +*/ +extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms); + +/* Atomically increases the semaphore's count (not blocking), returns 0, + or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem); + +/* Returns the current count of the semaphore */ +extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* Condition variable functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* The SDL condition variable structure, defined in SDL_cond.c */ +struct SDL_cond; +typedef struct SDL_cond SDL_cond; + +/* Create a condition variable */ +extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void); + +/* Destroy a condition variable */ +extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond); + +/* Restart one of the threads that are waiting on the condition variable, + returns 0 or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond); + +/* Restart all threads that are waiting on the condition variable, + returns 0 or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond); + +/* Wait on the condition variable, unlocking the provided mutex. + The mutex must be locked before entering this function! + The mutex is re-locked once the condition variable is signaled. + Returns 0 when it is signaled, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut); + +/* Waits for at most 'ms' milliseconds, and returns 0 if the condition + variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not + signaled in the allotted time, and -1 on error. + On some platforms this function is implemented by looping with a delay + of 1 ms, and so should be avoided if possible. +*/ +extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_mutex_h */ diff --git a/src/include/SDL_name.h b/src/include/SDL_name.h new file mode 100644 index 0000000..511619a --- /dev/null +++ b/src/include/SDL_name.h @@ -0,0 +1,11 @@ + +#ifndef _SDLname_h_ +#define _SDLname_h_ + +#if defined(__STDC__) || defined(__cplusplus) +#define NeedFunctionPrototypes 1 +#endif + +#define SDL_NAME(X) SDL_##X + +#endif /* _SDLname_h_ */ diff --git a/src/include/SDL_opengl.h b/src/include/SDL_opengl.h new file mode 100644 index 0000000..1d1bf5f --- /dev/null +++ b/src/include/SDL_opengl.h @@ -0,0 +1,6550 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* This is a simple file to encapsulate the OpenGL API headers */ + +#include "SDL_config.h" + +#ifdef __WIN32__ +#define WIN32_LEAN_AND_MEAN +#ifndef NOMINMAX +#define NOMINMAX /* Don't defined min() and max() */ +#endif +#include +#endif +#ifndef NO_SDL_GLEXT +#define __glext_h_ /* Don't let gl.h include glext.h */ +#endif +#if defined(__MACOSX__) +#include /* Header File For The OpenGL Library */ +#include /* Header File For The GLU Library */ +#elif defined(__MACOS__) +#include /* Header File For The OpenGL Library */ +#include /* Header File For The GLU Library */ +#else +#include /* Header File For The OpenGL Library */ +#include /* Header File For The GLU Library */ +#endif +#ifndef NO_SDL_GLEXT +#undef __glext_h_ +#endif + +/* This file taken from "GLext.h" from the Jeff Molofee OpenGL tutorials. + It is included here because glext.h is not available on some systems. + If you don't want this version included, simply define "NO_SDL_GLEXT" + */ +#ifndef NO_SDL_GLEXT +#if !defined(__glext_h_) && !defined(GL_GLEXT_LEGACY) +#define __glext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: This software was created using the +** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has +** not been independently verified as being compliant with the OpenGL(R) +** version 1.2.1 Specification. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glext.h last updated 2005/06/20 */ +/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ +#define GL_GLEXT_VERSION 29 + +#ifndef GL_VERSION_1_2 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_RESCALE_NORMAL 0x803A +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#endif + +#ifndef GL_ARB_imaging +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#endif + +#ifndef GL_VERSION_1_3 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#endif + +#ifndef GL_VERSION_1_4 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#endif + +#ifndef GL_VERSION_1_5 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE +#define GL_FOG_COORD GL_FOG_COORDINATE +#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE +#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE +#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE +#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER +#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING +#define GL_SRC0_RGB GL_SOURCE0_RGB +#define GL_SRC1_RGB GL_SOURCE1_RGB +#define GL_SRC2_RGB GL_SOURCE2_RGB +#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA +#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA +#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA +#endif + +#ifndef GL_VERSION_2_0 +#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#endif + +#ifndef GL_ARB_multitexture +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +#endif + +#ifndef GL_ARB_multisample +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#endif + +#ifndef GL_ARB_texture_env_add +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif + +#ifndef GL_ARB_texture_compression +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif + +#ifndef GL_ARB_point_parameters +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#endif + +#ifndef GL_ARB_shadow +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#endif + +#ifndef GL_ARB_window_pos +#endif + +#ifndef GL_ARB_vertex_program +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +#endif + +#ifndef GL_ARB_fragment_program +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 +#endif + +#ifndef GL_ARB_shader_objects +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#endif + +#ifndef GL_ARB_point_sprite +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_HALF_FLOAT_ARB 0x140B +#endif + +#ifndef GL_ARB_texture_float +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#endif + +#ifndef GL_EXT_abgr +#define GL_ABGR_EXT 0x8000 +#endif + +#ifndef GL_EXT_blend_color +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif + +#ifndef GL_EXT_texture +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif + +#ifndef GL_EXT_texture3D +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif + +#ifndef GL_EXT_subtexture +#endif + +#ifndef GL_EXT_copy_texture +#endif + +#ifndef GL_EXT_histogram +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif + +#ifndef GL_EXT_convolution +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif + +#ifndef GL_SGI_color_matrix +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif + +#ifndef GL_SGI_color_table +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif + +#ifndef GL_SGIS_texture4D +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif + +#ifndef GL_EXT_cmyka +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif + +#ifndef GL_EXT_texture_object +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif + +#ifndef GL_SGIS_multisample +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif + +#ifndef GL_EXT_vertex_array +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif + +#ifndef GL_EXT_misc_attribute +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif + +#ifndef GL_SGIX_shadow +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif + +#ifndef GL_EXT_blend_logic_op +#endif + +#ifndef GL_SGIX_interlace +#define GL_INTERLACE_SGIX 0x8094 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif + +#ifndef GL_SGIS_texture_select +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif + +#ifndef GL_EXT_point_parameters +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif + +#ifndef GL_SGIX_instruments +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif + +#ifndef GL_SGIX_framezoom +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#endif + +#ifndef GL_FfdMaskSGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif + +#ifndef GL_SGIX_flush_raster +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif + +#ifndef GL_HP_image_transform +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif + +#ifndef GL_INGR_palette_buffer +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif + +#ifndef GL_EXT_color_subtable +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif + +#ifndef GL_EXT_index_texture +#endif + +#ifndef GL_EXT_index_material +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#endif + +#ifndef GL_EXT_index_func +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#endif + +#ifndef GL_WIN_phong_shading +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif + +#ifndef GL_WIN_specular_fog +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif + +#ifndef GL_EXT_light_texture +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +/* reuse GL_FRAGMENT_DEPTH_EXT */ +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif + +#ifndef GL_SGIX_impact_pixel_texture +#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 +#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 +#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 +#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 +#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 +#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 +#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A +#endif + +#ifndef GL_EXT_bgra +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif + +#ifndef GL_SGIX_async +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif + +#ifndef GL_INTEL_texture_scissor +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#endif + +#ifndef GL_HP_occlusion_test +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif + +#ifndef GL_EXT_secondary_color +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#endif + +#ifndef GL_EXT_multi_draw_arrays +#endif + +#ifndef GL_EXT_fog_coord +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_FOG_SCALE_SGIX 0x81FC +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#endif + +#ifndef GL_SUNX_constant_data +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#endif + +#ifndef GL_SUN_global_alpha +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#endif + +#ifndef GL_SUN_triangle_list +#define GL_RESTART_SUN 0x0001 +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#define GL_REPLACE_OLDEST_SUN 0x0003 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +#endif + +#ifndef GL_SUN_vertex +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +#endif + +#ifndef GL_INGR_color_clamp +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INTERLACE_READ_INGR 0x8568 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif + +#ifndef GL_EXT_texture_cube_map +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif + +#ifndef GL_EXT_texture_env_add +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT GL_MODELVIEW +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +#endif + +#ifndef GL_NV_register_combiners +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +/* reuse GL_TEXTURE0_ARB */ +/* reuse GL_TEXTURE1_ARB */ +/* reuse GL_ZERO */ +/* reuse GL_NONE */ +/* reuse GL_FOG */ +#endif + +#ifndef GL_NV_fog_distance +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +/* reuse GL_EYE_PLANE */ +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif + +#ifndef GL_NV_blend_square +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif + +#ifndef GL_MESA_resize_buffers +#endif + +#ifndef GL_MESA_window_pos +#endif + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_CULL_VERTEX_IBM 103050 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +#endif + +#ifndef GL_SGIX_subsample +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif + +#ifndef GL_SGI_depth_pass_instrument +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif + +#ifndef GL_3DFX_tbuffer +#endif + +#ifndef GL_EXT_multisample +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif + +#ifndef GL_SGIX_resample +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#endif + +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif + +#ifndef GL_NV_evaluators +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +#endif + +#ifndef GL_NV_texture_compression_vtc +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif + +#ifndef GL_NV_texture_shader +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV +#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV +#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#endif + +#ifndef GL_NV_vertex_program +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#endif + +#ifndef GL_OML_interlace +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 +#endif + +#ifndef GL_OML_subsample +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#endif + +#ifndef GL_OML_resample +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_REG_6_ATI 0x8927 +#define GL_REG_7_ATI 0x8928 +#define GL_REG_8_ATI 0x8929 +#define GL_REG_9_ATI 0x892A +#define GL_REG_10_ATI 0x892B +#define GL_REG_11_ATI 0x892C +#define GL_REG_12_ATI 0x892D +#define GL_REG_13_ATI 0x892E +#define GL_REG_14_ATI 0x892F +#define GL_REG_15_ATI 0x8930 +#define GL_REG_16_ATI 0x8931 +#define GL_REG_17_ATI 0x8932 +#define GL_REG_18_ATI 0x8933 +#define GL_REG_19_ATI 0x8934 +#define GL_REG_20_ATI 0x8935 +#define GL_REG_21_ATI 0x8936 +#define GL_REG_22_ATI 0x8937 +#define GL_REG_23_ATI 0x8938 +#define GL_REG_24_ATI 0x8939 +#define GL_REG_25_ATI 0x893A +#define GL_REG_26_ATI 0x893B +#define GL_REG_27_ATI 0x893C +#define GL_REG_28_ATI 0x893D +#define GL_REG_29_ATI 0x893E +#define GL_REG_30_ATI 0x893F +#define GL_REG_31_ATI 0x8940 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_CON_8_ATI 0x8949 +#define GL_CON_9_ATI 0x894A +#define GL_CON_10_ATI 0x894B +#define GL_CON_11_ATI 0x894C +#define GL_CON_12_ATI 0x894D +#define GL_CON_13_ATI 0x894E +#define GL_CON_14_ATI 0x894F +#define GL_CON_15_ATI 0x8950 +#define GL_CON_16_ATI 0x8951 +#define GL_CON_17_ATI 0x8952 +#define GL_CON_18_ATI 0x8953 +#define GL_CON_19_ATI 0x8954 +#define GL_CON_20_ATI 0x8955 +#define GL_CON_21_ATI 0x8956 +#define GL_CON_22_ATI 0x8957 +#define GL_CON_23_ATI 0x8958 +#define GL_CON_24_ATI 0x8959 +#define GL_CON_25_ATI 0x895A +#define GL_CON_26_ATI 0x895B +#define GL_CON_27_ATI 0x895C +#define GL_CON_28_ATI 0x895D +#define GL_CON_29_ATI 0x895E +#define GL_CON_30_ATI 0x895F +#define GL_CON_31_ATI 0x8960 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#define GL_RED_BIT_ATI 0x00000001 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_STREAM0_ATI 0x876C +#define GL_VERTEX_STREAM1_ATI 0x876D +#define GL_VERTEX_STREAM2_ATI 0x876E +#define GL_VERTEX_STREAM3_ATI 0x876F +#define GL_VERTEX_STREAM4_ATI 0x8770 +#define GL_VERTEX_STREAM5_ATI 0x8771 +#define GL_VERTEX_STREAM6_ATI 0x8772 +#define GL_VERTEX_STREAM7_ATI 0x8773 +#define GL_VERTEX_SOURCE_ATI 0x8774 +#endif + +#ifndef GL_ATI_element_array +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +#endif + +#ifndef GL_SUN_mesh_array +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SLICE_ACCUM_SUN 0x85CC +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_DEPTH_CLAMP_NV 0x864F +#endif + +#ifndef GL_NV_occlusion_query +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +#endif + +#ifndef GL_NV_point_sprite +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#endif + +#ifndef GL_NV_vertex_program1_1 +#endif + +#ifndef GL_EXT_shadow_funcs +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#endif + +#ifndef GL_APPLE_element_array +#define GL_ELEMENT_ARRAY_APPLE 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A +#endif + +#ifndef GL_APPLE_fence +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_YCBCR_422_APPLE 0x85B9 +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +#ifndef GL_S3_s3tc +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#endif + +#ifndef GL_ATI_texture_float +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif + +#ifndef GL_NV_float_buffer +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif + +#ifndef GL_NV_fragment_program +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +#endif + +#ifndef GL_NV_half_float +#define GL_HALF_FLOAT_NV 0x140B +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +#endif + +#ifndef GL_NV_primitive_restart +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#endif + +#ifndef GL_NV_vertex_program2 +#endif + +#ifndef GL_ATI_map_object_buffer +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#endif + +#ifndef GL_OES_read_format +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +#endif + +#ifndef GL_MESA_pack_invert +#define GL_PACK_INVERT_MESA 0x8758 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#endif + +#ifndef GL_NV_fragment_program_option +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#endif + +#ifndef GL_NV_vertex_program2_option +/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ +/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ +#endif + +#ifndef GL_NV_vertex_program3 +/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#endif + +#ifndef GL_GREMEDY_string_marker +#endif + + +/*************************************************************/ + +#include +#ifndef GL_VERSION_2_0 +/* GL type for program/shader text */ +typedef char GLchar; /* native character */ +#endif + +#ifndef GL_VERSION_1_5 +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +#endif + +#ifndef GL_ARB_vertex_buffer_object +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +#endif + +#ifndef GL_ARB_shader_objects +/* GL types for handling shader object handles and program/shader text */ +typedef char GLcharARB; /* native character */ +typedef unsigned int GLhandleARB; /* shader object handle */ +#endif + +/* GL types for "half" precision (s10e5) float data in host memory */ +#ifndef GL_ARB_half_float_pixel +typedef unsigned short GLhalfARB; +#endif + +#ifndef GL_NV_half_float +typedef unsigned short GLhalfNV; +#endif + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); +GLAPI void APIENTRY glBlendEquation (GLenum); +GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); +GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogram (GLenum); +GLAPI void APIENTRY glResetMinmax (GLenum); +GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum); +GLAPI void APIENTRY glClientActiveTexture (GLenum); +GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); +GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glFogCoordf (GLfloat); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *); +GLAPI void APIENTRY glFogCoordd (GLdouble); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); +GLAPI void APIENTRY glPointParameteri (GLenum, GLint); +GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); +GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); +GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos2i (GLint, GLint); +GLAPI void APIENTRY glWindowPos2iv (const GLint *); +GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2sv (const GLshort *); +GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3iv (const GLint *); +GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3sv (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); +#endif + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQuery (GLuint); +GLAPI void APIENTRY glBeginQuery (GLenum, GLuint); +GLAPI void APIENTRY glEndQuery (GLenum); +GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *); +GLAPI void APIENTRY glBindBuffer (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint); +GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum); +GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *); +GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint); +GLAPI void APIENTRY glAttachShader (GLuint, GLuint); +GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *); +GLAPI void APIENTRY glCompileShader (GLuint); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum); +GLAPI void APIENTRY glDeleteProgram (GLuint); +GLAPI void APIENTRY glDeleteShader (GLuint); +GLAPI void APIENTRY glDetachShader (GLuint, GLuint); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint); +GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgram (GLuint); +GLAPI GLboolean APIENTRY glIsShader (GLuint); +GLAPI void APIENTRY glLinkProgram (GLuint); +GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *); +GLAPI void APIENTRY glUseProgram (GLuint); +GLAPI void APIENTRY glUniform1f (GLint, GLfloat); +GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1i (GLint, GLint); +GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glValidateProgram (GLuint); +GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTextureARB (GLenum); +GLAPI void APIENTRY glClientActiveTextureARB (GLenum); +GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#endif + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); +#endif + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#endif + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 +#endif + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); +GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); +GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); +GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); +GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); +GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexBlendARB (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); +typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); +typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); +typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); +typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); +typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); +typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); +GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 +#endif + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 +#endif + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); +GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); +#endif + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); +GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); +#endif + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 +/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBufferARB (GLuint); +GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum); +GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQueryARB (GLuint); +GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint); +GLAPI void APIENTRY glEndQueryARB (GLenum); +GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum); +GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum); +GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); +GLAPI void APIENTRY glCompileShaderARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); +GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB); +GLAPI void APIENTRY glLinkProgramARB (GLhandleARB); +GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB); +GLAPI void APIENTRY glValidateProgramARB (GLhandleARB); +GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat); +GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1iARB (GLint, GLint); +GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *); +GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); +GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *); +GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *); +GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); +typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); +GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 +#endif + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClampColorARB (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 +#endif + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 +#endif + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#endif + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#endif + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#endif + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogramEXT (GLenum); +GLAPI void APIENTRY glResetMinmaxEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); +#endif + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +#endif + +#ifndef GL_EXT_color_matrix +#define GL_EXT_color_matrix 1 +#endif + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); +GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); +GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); +GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#endif + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#endif + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); +GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#endif + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternSGIS (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#endif + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glArrayElementEXT (GLint); +GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); +GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); +GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); +typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#endif + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#endif + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#endif + +#ifndef GL_SGIX_texture_select +#define GL_SGIX_texture_select 1 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); +GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#endif + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_SGIS_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); +GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); +GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); +GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); +GLAPI void APIENTRY glStartInstrumentsSGIX (void); +GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#endif + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameZoomSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTagSampleBufferSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); +GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); +GLAPI void APIENTRY glDeformSGIX (GLbitfield); +GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#endif + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushRasterSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#endif + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); +GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#endif + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glHintPGI (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); +GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); +GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); +GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#endif + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); +GLAPI void APIENTRY glUnlockArraysEXT (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); +GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); +GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); +GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); +GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +#endif + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#endif + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#endif + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyTextureEXT (GLenum); +GLAPI void APIENTRY glTextureLightEXT (GLenum); +GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#endif + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#endif + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); +GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); +GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); +GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); +GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); +GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); +GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +#endif + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#endif + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); +GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureNormalEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordfEXT (GLfloat); +GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); +GLAPI void APIENTRY glFogCoorddEXT (GLdouble); +GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); +GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); +GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); +GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glTangent3ivEXT (const GLint *); +GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glTangent3svEXT (const GLshort *); +GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); +GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); +GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); +GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); +GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); +GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_SGIX_fog_scale 1 +#endif + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFinishTextureSUNX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); +#endif + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); +GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); +GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); +GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); +GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); +GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); +GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); +GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#endif + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); +GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); +GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); +GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); +GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); +GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); +GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); +#endif + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_blend_func_separate +#define GL_INGR_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#endif + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); +GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); +GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); +#endif + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); +GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); +GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); +GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); +GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#endif + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#endif + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#endif + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glResizeBuffersMESA (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); +#endif + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint); +GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); +GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +#endif + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#endif + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTbufferMask3DFX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#endif + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#endif + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif + +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 +#endif + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); +GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); +GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFinishFenceNV (GLuint); +GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); +GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); +GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); +typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 +#endif + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 +#endif + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); +GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); +GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); +GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); +GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); +GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); +GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); +typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); +typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); +typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SGIX_scalebias_hint 1 +#endif + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 +#endif + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 +#endif + +#ifndef GL_OML_resample +#define GL_OML_resample 1 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); +GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); +GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); +GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); +GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); +GLAPI void APIENTRY glBeginFragmentShaderATI (void); +GLAPI void APIENTRY glEndFragmentShaderATI (void); +GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); +GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); +GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); +GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); +GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFreeObjectBufferATI (GLuint); +GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); +typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVertexShaderEXT (void); +GLAPI void APIENTRY glEndVertexShaderEXT (void); +GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); +GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); +GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); +GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); +GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); +GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); +GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); +GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); +GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); +GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); +GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *); +GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); +GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); +GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); +GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); +GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); +GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); +typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); +typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); +typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); +typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); +typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); +typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); +typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); +typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); +typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); +typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); +GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); +GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); +GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); +GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); +GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); +GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); +GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); +GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +#endif + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 +#endif + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glEndOcclusionQueryNV (void); +GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 +#endif + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 +#endif + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 +#endif + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei); +GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#endif + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glSetFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint); +GLAPI void APIENTRY glFinishFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint); +GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); +typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); +typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint); +GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 +#endif + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_ATI_pixel_format_float 1 +/* This is really a WGL extension, but defines some associated GL enums. + * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. + */ +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 +#endif + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 +#endif + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 +#endif + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 +/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *); +GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *); +GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#endif + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV); +GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glFogCoordhNV (GLhalfNV); +GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *); +GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV); +GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); +typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); +typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +#endif + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveRestartNV (void); +GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 +#endif + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 +#endif + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint); +GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); +#endif + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); +#endif + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 +#endif + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 +#endif + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 +#endif + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint); +GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *); +GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *); +GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint); +GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *); +GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum); +GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGenerateMipmapEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +#endif + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif /* NO_SDL_GLEXT */ diff --git a/src/include/SDL_platform.h b/src/include/SDL_platform.h new file mode 100644 index 0000000..1bfee29 --- /dev/null +++ b/src/include/SDL_platform.h @@ -0,0 +1,100 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Try to get a standard set of platform defines */ + +#ifndef _SDL_platform_h +#define _SDL_platform_h + +#if defined(_AIX) +#undef __AIX__ +#define __AIX__ 1 +#endif +#if defined(__BEOS__) +#undef __BEOS__ +#define __BEOS__ 1 +#endif +#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) +#undef __BSDI__ +#define __BSDI__ 1 +#endif +#if defined(_arch_dreamcast) +#undef __DREAMCAST__ +#define __DREAMCAST__ 1 +#endif +#if defined(__FreeBSD__) || defined(__DragonFly__) +#undef __FREEBSD__ +#define __FREEBSD__ 1 +#endif +#if defined(hpux) || defined(__hpux) || defined(__hpux__) +#undef __HPUX__ +#define __HPUX__ 1 +#endif +#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) +#undef __IRIX__ +#define __IRIX__ 1 +#endif +#if defined(linux) || defined(__linux) || defined(__linux__) +#undef __LINUX__ +#define __LINUX__ 1 +#endif +#if defined(__APPLE__) +#undef __MACOSX__ +#define __MACOSX__ 1 +#elif defined(macintosh) +#undef __MACOS__ +#define __MACOS__ 1 +#endif +#if defined(__NetBSD__) +#undef __NETBSD__ +#define __NETBSD__ 1 +#endif +#if defined(__OpenBSD__) +#undef __OPENBSD__ +#define __OPENBSD__ 1 +#endif +#if defined(__OS2__) +#undef __OS2__ +#define __OS2__ 1 +#endif +#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) +#undef __OSF__ +#define __OSF__ 1 +#endif +#if defined(__QNXNTO__) +#undef __QNXNTO__ +#define __QNXNTO__ 1 +#endif +#if defined(riscos) || defined(__riscos) || defined(__riscos__) +#undef __RISCOS__ +#define __RISCOS__ 1 +#endif +#if defined(__SVR4) +#undef __SOLARIS__ +#define __SOLARIS__ 1 +#endif +#if defined(WIN32) || defined(_WIN32) +#undef __WIN32__ +#define __WIN32__ 1 +#endif + +#endif /* _SDL_platform_h */ diff --git a/src/include/SDL_quit.h b/src/include/SDL_quit.h new file mode 100644 index 0000000..fcf40fb --- /dev/null +++ b/src/include/SDL_quit.h @@ -0,0 +1,50 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Include file for SDL quit event handling */ + +#ifndef _SDL_quit_h +#define _SDL_quit_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +/* + An SDL_QUITEVENT is generated when the user tries to close the application + window. If it is ignored or filtered out, the window will remain open. + If it is not ignored or filtered, it is queued normally and the window + is allowed to close. When the window is closed, screen updates will + complete, but have no effect. + + SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) + and SIGTERM (system termination request), if handlers do not already + exist, that generate SDL_QUITEVENT events as well. There is no way + to determine the cause of an SDL_QUITEVENT, but setting a signal + handler in your application will override the default generation of + quit events for that signal. +*/ + +/* There are no functions directly affecting the quit event */ +#define SDL_QuitRequested() \ + (SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK)) + +#endif /* _SDL_quit_h */ diff --git a/src/include/SDL_rwops.h b/src/include/SDL_rwops.h new file mode 100644 index 0000000..8c17701 --- /dev/null +++ b/src/include/SDL_rwops.h @@ -0,0 +1,144 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* This file provides a general interface for SDL to read and write + data sources. It can easily be extended to files, memory, etc. +*/ + +#ifndef _SDL_rwops_h +#define _SDL_rwops_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* This is the read/write operation structure -- very basic */ + +typedef struct SDL_RWops { + /* Seek to 'offset' relative to whence, one of stdio's whence values: + SEEK_SET, SEEK_CUR, SEEK_END + Returns the final offset in the data source. + */ + int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence); + + /* Read up to 'num' objects each of size 'objsize' from the data + source to the area pointed at by 'ptr'. + Returns the number of objects read, or -1 if the read failed. + */ + int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum); + + /* Write exactly 'num' objects each of size 'objsize' from the area + pointed at by 'ptr' to data source. + Returns 'num', or -1 if the write failed. + */ + int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num); + + /* Close and free an allocated SDL_FSops structure */ + int (SDLCALL *close)(struct SDL_RWops *context); + + Uint32 type; + union { +#if defined(__WIN32__) && !defined(__SYMBIAN32__) + struct { + int append; + void *h; + struct { + void *data; + int size; + int left; + } buffer; + } win32io; +#endif +#ifdef HAVE_STDIO_H + struct { + int autoclose; + FILE *fp; + } stdio; +#endif + struct { + Uint8 *base; + Uint8 *here; + Uint8 *stop; + } mem; + struct { + void *data1; + } unknown; + } hidden; + +} SDL_RWops; + + +/* Functions to create SDL_RWops structures from various data sources */ + +extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode); + +#ifdef HAVE_STDIO_H +extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose); +#endif + +extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size); +extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size); + +extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void); +extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area); + +#define RW_SEEK_SET 0 /* Seek from the beginning of data */ +#define RW_SEEK_CUR 1 /* Seek relative to current read point */ +#define RW_SEEK_END 2 /* Seek relative to the end of data */ + +/* Macros to easily read and write from an SDL_RWops structure */ +#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) +#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) +#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) +#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) +#define SDL_RWclose(ctx) (ctx)->close(ctx) + + +/* Read an item of the specified endianness and return in native format */ +extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src); +extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src); +extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src); +extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src); +extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src); +extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src); + +/* Write an item of native format to the specified endianness */ +extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value); +extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value); +extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value); +extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value); +extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value); +extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_rwops_h */ diff --git a/src/include/SDL_stdinc.h b/src/include/SDL_stdinc.h new file mode 100644 index 0000000..891a9ac --- /dev/null +++ b/src/include/SDL_stdinc.h @@ -0,0 +1,594 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* This is a general header that includes C language support */ + +#ifndef _SDL_stdinc_h +#define _SDL_stdinc_h + +#include "SDL_config.h" + + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDIO_H +#include +#endif +#if defined(STDC_HEADERS) +# include +# include +# include +#else +# if defined(HAVE_STDLIB_H) +# include +# elif defined(HAVE_MALLOC_H) +# include +# endif +# if defined(HAVE_STDDEF_H) +# include +# endif +# if defined(HAVE_STDARG_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 +#if defined(HAVE_INTTYPES_H) +# include +#elif defined(HAVE_STDINT_H) +# include +#endif +#ifdef HAVE_CTYPE_H +# include +#endif +#ifdef HAVE_ICONV_H +# include +#endif + +/* The number of elements in an array */ +#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) +#define SDL_TABLESIZE(table) SDL_arraysize(table) + +/* Basic data types */ +typedef enum SDL_bool { + SDL_FALSE = 0, + SDL_TRUE = 1 +} SDL_bool; + +typedef int8_t Sint8; +typedef uint8_t Uint8; +typedef int16_t Sint16; +typedef uint16_t Uint16; +typedef int32_t Sint32; +typedef uint32_t Uint32; + +#ifdef SDL_HAS_64BIT_TYPE +typedef int64_t Sint64; +#ifndef SYMBIAN32_GCCE +typedef uint64_t Uint64; +#endif +#else +/* This is really just a hack to prevent the compiler from complaining */ +typedef struct { + Uint32 hi; + Uint32 lo; +} Uint64, Sint64; +#endif + +/* Make sure the types really have the right sizes */ +#define SDL_COMPILE_TIME_ASSERT(name, x) \ + typedef int SDL_dummy_ ## name[(x) * 2 - 1] + +SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); +SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); +SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); +SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); +SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); +SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); +SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); +SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); + +/* Check to make sure enums are the size of ints, for structure packing. + For both Watcom C/C++ and Borland C/C++ the compiler option that makes + enums having the size of an int must be enabled. + This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). +*/ +/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ +#ifdef __MWERKS__ +#pragma enumsalwaysint on +#endif + +typedef enum { + DUMMY_ENUM_VALUE +} SDL_DUMMY_ENUM; + +#ifndef __NDS__ +SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); +#endif + + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_MALLOC +#define SDL_malloc malloc +#else +extern DECLSPEC void * SDLCALL SDL_malloc(size_t size); +#endif + +#ifdef HAVE_CALLOC +#define SDL_calloc calloc +#else +extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size); +#endif + +#ifdef HAVE_REALLOC +#define SDL_realloc realloc +#else +extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); +#endif + +#ifdef HAVE_FREE +#define SDL_free free +#else +extern DECLSPEC void SDLCALL SDL_free(void *mem); +#endif + +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) + #pragma alloca +# elif defined(__MRC__) + void *alloca (unsigned); +# else + char *alloca (); +# endif +#endif +#ifdef HAVE_ALLOCA +#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) +#define SDL_stack_free(data) +#else +#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) +#define SDL_stack_free(data) SDL_free(data) +#endif + +#ifdef HAVE_GETENV +#define SDL_getenv getenv +#else +extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); +#endif + +#ifdef HAVE_PUTENV +#define SDL_putenv putenv +#else +extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); +#endif + +#ifdef HAVE_QSORT +#define SDL_qsort qsort +#else +extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, + int (*compare)(const void *, const void *)); +#endif + +#ifdef HAVE_ABS +#define SDL_abs abs +#else +#define SDL_abs(X) ((X) < 0 ? -(X) : (X)) +#endif + +#define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) +#define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) + +#ifdef HAVE_CTYPE_H +#define SDL_isdigit(X) isdigit(X) +#define SDL_isspace(X) isspace(X) +#define SDL_toupper(X) toupper(X) +#define SDL_tolower(X) tolower(X) +#else +#define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9')) +#define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n')) +#define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X)) +#define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X)) +#endif + +#ifdef HAVE_MEMSET +#define SDL_memset memset +#else +extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len); +#endif + +#if defined(__GNUC__) && defined(i386) +#define SDL_memset4(dst, val, len) \ +do { \ + int u0, u1, u2; \ + __asm__ __volatile__ ( \ + "cld\n\t" \ + "rep ; stosl\n\t" \ + : "=&D" (u0), "=&a" (u1), "=&c" (u2) \ + : "0" (dst), "1" (val), "2" ((Uint32)(len)) \ + : "memory" ); \ +} while(0) +#endif +#ifndef SDL_memset4 +#define SDL_memset4(dst, val, len) \ +do { \ + unsigned _count = (len); \ + unsigned _n = (_count + 3) / 4; \ + Uint32 *_p = (Uint32 *)(dst); \ + Uint32 _val = (val); \ + switch (_count % 4) { \ + case 0: do { *_p++ = _val; \ + case 3: *_p++ = _val; \ + case 2: *_p++ = _val; \ + case 1: *_p++ = _val; \ + } while ( --_n ); \ + } \ +} while(0) +#endif + +/* We can count on memcpy existing on Mac OS X and being well-tuned. */ +#if defined(__MACH__) && defined(__APPLE__) +#define SDL_memcpy(dst, src, len) memcpy(dst, src, len) +#elif defined(__GNUC__) && defined(i386) +#define SDL_memcpy(dst, src, len) \ +do { \ + int u0, u1, u2; \ + __asm__ __volatile__ ( \ + "cld\n\t" \ + "rep ; movsl\n\t" \ + "testb $2,%b4\n\t" \ + "je 1f\n\t" \ + "movsw\n" \ + "1:\ttestb $1,%b4\n\t" \ + "je 2f\n\t" \ + "movsb\n" \ + "2:" \ + : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ + : "0" ((unsigned)(len)/4), "q" (len), "1" (dst),"2" (src) \ + : "memory" ); \ +} while(0) +#endif +#ifndef SDL_memcpy +#ifdef HAVE_MEMCPY +#define SDL_memcpy memcpy +#elif defined(HAVE_BCOPY) +#define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) +#else +extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); +#endif +#endif + +/* We can count on memcpy existing on Mac OS X and being well-tuned. */ +#if defined(__MACH__) && defined(__APPLE__) +#define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4) +#elif defined(__GNUC__) && defined(i386) +#define SDL_memcpy4(dst, src, len) \ +do { \ + int ecx, edi, esi; \ + __asm__ __volatile__ ( \ + "cld\n\t" \ + "rep ; movsl" \ + : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \ + : "0" ((unsigned)(len)), "1" (dst), "2" (src) \ + : "memory" ); \ +} while(0) +#endif +#ifndef SDL_memcpy4 +#define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2) +#endif + +#if defined(__GNUC__) && defined(i386) +#define SDL_revcpy(dst, src, len) \ +do { \ + int u0, u1, u2; \ + char *dstp = (char *)(dst); \ + char *srcp = (char *)(src); \ + int n = (len); \ + if ( n >= 4 ) { \ + __asm__ __volatile__ ( \ + "std\n\t" \ + "rep ; movsl\n\t" \ + : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ + : "0" (n >> 2), \ + "1" (dstp+(n-4)), "2" (srcp+(n-4)) \ + : "memory" ); \ + } \ + switch (n & 3) { \ + case 3: dstp[2] = srcp[2]; \ + case 2: dstp[1] = srcp[1]; \ + case 1: dstp[0] = srcp[0]; \ + break; \ + default: \ + break; \ + } \ +} while(0) +#endif +#ifndef SDL_revcpy +extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len); +#endif + +#ifdef HAVE_MEMMOVE +#define SDL_memmove memmove +#elif defined(HAVE_BCOPY) +#define SDL_memmove(d, s, n) bcopy((s), (d), (n)) +#else +#define SDL_memmove(dst, src, len) \ +do { \ + if ( dst < src ) { \ + SDL_memcpy(dst, src, len); \ + } else { \ + SDL_revcpy(dst, src, len); \ + } \ +} while(0) +#endif + +#ifdef HAVE_MEMCMP +#define SDL_memcmp memcmp +#else +extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); +#endif + +#ifdef HAVE_STRLEN +#define SDL_strlen strlen +#else +extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); +#endif + +#ifdef HAVE_STRLCPY +#define SDL_strlcpy strlcpy +#else +extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); +#endif + +#ifdef HAVE_STRLCAT +#define SDL_strlcat strlcat +#else +extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); +#endif + +#ifdef HAVE_STRDUP +#define SDL_strdup strdup +#else +extern DECLSPEC char * SDLCALL SDL_strdup(const char *string); +#endif + +#ifdef HAVE__STRREV +#define SDL_strrev _strrev +#else +extern DECLSPEC char * SDLCALL SDL_strrev(char *string); +#endif + +#ifdef HAVE__STRUPR +#define SDL_strupr _strupr +#else +extern DECLSPEC char * SDLCALL SDL_strupr(char *string); +#endif + +#ifdef HAVE__STRLWR +#define SDL_strlwr _strlwr +#else +extern DECLSPEC char * SDLCALL SDL_strlwr(char *string); +#endif + +#ifdef HAVE_STRCHR +#define SDL_strchr strchr +#elif defined(HAVE_INDEX) +#define SDL_strchr index +#else +extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c); +#endif + +#ifdef HAVE_STRRCHR +#define SDL_strrchr strrchr +#elif defined(HAVE_RINDEX) +#define SDL_strrchr rindex +#else +extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c); +#endif + +#ifdef HAVE_STRSTR +#define SDL_strstr strstr +#else +extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle); +#endif + +#ifdef HAVE_ITOA +#define SDL_itoa itoa +#else +#define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix) +#endif + +#ifdef HAVE__LTOA +#define SDL_ltoa _ltoa +#else +extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix); +#endif + +#ifdef HAVE__UITOA +#define SDL_uitoa _uitoa +#else +#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix) +#endif + +#ifdef HAVE__ULTOA +#define SDL_ultoa _ultoa +#else +extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix); +#endif + +#ifdef HAVE_STRTOL +#define SDL_strtol strtol +#else +extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base); +#endif + +#ifdef HAVE_STRTOUL +#define SDL_strtoul strtoul +#else +extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base); +#endif + +#ifdef SDL_HAS_64BIT_TYPE + +#ifdef HAVE__I64TOA +#define SDL_lltoa _i64toa +#else +extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix); +#endif + +#ifdef HAVE__UI64TOA +#define SDL_ulltoa _ui64toa +#else +extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix); +#endif + +#ifdef HAVE_STRTOLL +#define SDL_strtoll strtoll +#else +extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base); +#endif + +#ifdef HAVE_STRTOULL +#define SDL_strtoull strtoull +#else +extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base); +#endif + +#endif /* SDL_HAS_64BIT_TYPE */ + +#ifdef HAVE_STRTOD +#define SDL_strtod strtod +#else +extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp); +#endif + +#ifdef HAVE_ATOI +#define SDL_atoi atoi +#else +#define SDL_atoi(X) SDL_strtol(X, NULL, 0) +#endif + +#ifdef HAVE_ATOF +#define SDL_atof atof +#else +#define SDL_atof(X) SDL_strtod(X, NULL) +#endif + +#ifdef HAVE_STRCMP +#define SDL_strcmp strcmp +#else +extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); +#endif + +#ifdef HAVE_STRNCMP +#define SDL_strncmp strncmp +#else +extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); +#endif + +#ifdef HAVE_STRCASECMP +#define SDL_strcasecmp strcasecmp +#elif defined(HAVE__STRICMP) +#define SDL_strcasecmp _stricmp +#else +extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); +#endif + +#ifdef HAVE_STRNCASECMP +#define SDL_strncasecmp strncasecmp +#elif defined(HAVE__STRNICMP) +#define SDL_strncasecmp _strnicmp +#else +extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen); +#endif + +#ifdef HAVE_SSCANF +#define SDL_sscanf sscanf +#else +extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); +#endif + +#ifdef HAVE_SNPRINTF +#define SDL_snprintf snprintf +#else +extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); +#endif + +#ifdef HAVE_VSNPRINTF +#define SDL_vsnprintf vsnprintf +#else +extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); +#endif + +/* The SDL implementation of iconv() returns these error codes */ +#define SDL_ICONV_ERROR (size_t)-1 +#define SDL_ICONV_E2BIG (size_t)-2 +#define SDL_ICONV_EILSEQ (size_t)-3 +#define SDL_ICONV_EINVAL (size_t)-4 + +#ifdef HAVE_ICONV +#define SDL_iconv_t iconv_t +#define SDL_iconv_open iconv_open +#define SDL_iconv_close iconv_close +#else +typedef struct _SDL_iconv_t *SDL_iconv_t; +extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); +extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); +#endif +extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); +/* This function converts a string between encodings in one pass, returning a + string that must be freed with SDL_free() or NULL on error. +*/ +extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft); +#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_stdinc_h */ diff --git a/src/include/SDL_syswm.h b/src/include/SDL_syswm.h new file mode 100644 index 0000000..010dd1b --- /dev/null +++ b/src/include/SDL_syswm.h @@ -0,0 +1,214 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Include file for SDL custom system window manager hooks */ + +#ifndef _SDL_syswm_h +#define _SDL_syswm_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_version.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Your application has access to a special type of event 'SDL_SYSWMEVENT', + which contains window-manager specific information and arrives whenever + an unhandled window event occurs. This event is ignored by default, but + you can enable it with SDL_EventState() +*/ +#ifdef SDL_PROTOTYPES_ONLY +struct SDL_SysWMinfo; +typedef struct SDL_SysWMinfo SDL_SysWMinfo; +#else + +/* This is the structure for custom window manager events */ +#if defined(SDL_VIDEO_DRIVER_X11) +#if defined(__APPLE__) && defined(__MACH__) +/* conflicts with Quickdraw.h */ +#define Cursor X11Cursor +#endif + +#include +#include + +#if defined(__APPLE__) && defined(__MACH__) +/* matches the re-define above */ +#undef Cursor +#endif + +/* These are the various supported subsystems under UNIX */ +typedef enum { + SDL_SYSWM_X11 +} SDL_SYSWM_TYPE; + +/* The UNIX custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + SDL_SYSWM_TYPE subsystem; + union { + XEvent xevent; + } event; +}; + +/* The UNIX custom window manager information structure. + When this structure is returned, it holds information about which + low level system it is using, and will be one of SDL_SYSWM_TYPE. + */ +typedef struct SDL_SysWMinfo { + SDL_version version; + SDL_SYSWM_TYPE subsystem; + union { + struct { + Display *display; /* The X11 display */ + Window window; /* The X11 display window */ + /* These locking functions should be called around + any X11 functions using the display variable, + but not the gfxdisplay variable. + They lock the event thread, so should not be + called around event functions or from event filters. + */ + void (*lock_func)(void); + void (*unlock_func)(void); + + /* Introduced in SDL 1.0.2 */ + Window fswindow; /* The X11 fullscreen window */ + Window wmwindow; /* The X11 managed input window */ + + /* Introduced in SDL 1.2.12 */ + Display *gfxdisplay; /* The X11 display to which rendering is done */ + } x11; + } info; +} SDL_SysWMinfo; + +#elif defined(SDL_VIDEO_DRIVER_NANOX) +#include + +/* The generic custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + int data; +}; + +/* The windows custom window manager information structure */ +typedef struct SDL_SysWMinfo { + SDL_version version ; + GR_WINDOW_ID window ; /* The display window */ +} SDL_SysWMinfo; + +#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI) +#define WIN32_LEAN_AND_MEAN +#include + +/* The windows custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + HWND hwnd; /* The window for the message */ + UINT msg; /* The type of message */ + WPARAM wParam; /* WORD message parameter */ + LPARAM lParam; /* LONG message parameter */ +}; + +/* The windows custom window manager information structure */ +typedef struct SDL_SysWMinfo { + SDL_version version; + HWND window; /* The Win32 display window */ + HGLRC hglrc; /* The OpenGL context, if any */ +} SDL_SysWMinfo; + +#elif defined(SDL_VIDEO_DRIVER_RISCOS) + +/* RISC OS custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + int eventCode; /* The window for the message */ + int pollBlock[64]; +}; + +/* The RISC OS custom window manager information structure */ +typedef struct SDL_SysWMinfo { + SDL_version version; + int wimpVersion; /* Wimp version running under */ + int taskHandle; /* The RISC OS task handle */ + int window; /* The RISC OS display window */ +} SDL_SysWMinfo; + +#elif defined(SDL_VIDEO_DRIVER_PHOTON) +#include +#include + +/* The QNX custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + int data; +}; + +/* The QNX custom window manager information structure */ +typedef struct SDL_SysWMinfo { + SDL_version version; + int data; +} SDL_SysWMinfo; + +#else + +/* The generic custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + int data; +}; + +/* The generic custom window manager information structure */ +typedef struct SDL_SysWMinfo { + SDL_version version; + int data; +} SDL_SysWMinfo; + +#endif /* video driver type */ + +#endif /* SDL_PROTOTYPES_ONLY */ + +/* Function prototypes */ +/* + * This function gives you custom hooks into the window manager information. + * It fills the structure pointed to by 'info' with custom information and + * returns 1 if the function is implemented. If it's not implemented, or + * the version member of the 'info' structure is invalid, it returns 0. + * + * You typically use this function like this: + * SDL_SysWMInfo info; + * SDL_VERSION(&info.version); + * if ( SDL_GetWMInfo(&info) ) { ... } + */ +extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_syswm_h */ diff --git a/src/include/SDL_thread.h b/src/include/SDL_thread.h new file mode 100644 index 0000000..403ee46 --- /dev/null +++ b/src/include/SDL_thread.h @@ -0,0 +1,119 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef _SDL_thread_h +#define _SDL_thread_h + +/* Header for the SDL thread management routines + + These are independent of the other SDL routines. +*/ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +/* Thread synchronization primitives */ +#include "SDL_mutex.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The SDL thread structure, defined in SDL_thread.c */ +struct SDL_Thread; +typedef struct SDL_Thread SDL_Thread; + +/* Create a thread */ +#if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__) +/* + We compile SDL into a DLL on OS/2. This means, that it's the DLL which + creates a new thread for the calling process with the SDL_CreateThread() + API. There is a problem with this, that only the RTL of the SDL.DLL will + be initialized for those threads, and not the RTL of the calling application! + To solve this, we make a little hack here. + We'll always use the caller's _beginthread() and _endthread() APIs to + start a new thread. This way, if it's the SDL.DLL which uses this API, + then the RTL of SDL.DLL will be used to create the new thread, and if it's + the application, then the RTL of the application will be used. + So, in short: + Always use the _beginthread() and _endthread() of the calling runtime library! +*/ +#define SDL_PASSED_BEGINTHREAD_ENDTHREAD +#ifndef _WIN32_WCE +#include /* This has _beginthread() and _endthread() defined! */ +#endif + +#ifdef __OS2__ +typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg); +typedef void (*pfnSDL_CurrentEndThread)(void); +#elif __GNUC__ +typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, + unsigned (__stdcall *func)(void *), void *arg, + unsigned, unsigned *threadID); +typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); +#else +typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, + unsigned (__stdcall *func)(void *), void *arg, + unsigned, unsigned *threadID); +typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); +#endif + +extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); + +#ifdef __OS2__ +#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread) +#elif defined(_WIN32_WCE) +#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL) +#else +#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex) +#endif +#else +extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data); +#endif + +/* Get the 32-bit thread identifier for the current thread */ +extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void); + +/* Get the 32-bit thread identifier for the specified thread, + equivalent to SDL_ThreadID() if the specified thread is NULL. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread); + +/* Wait for a thread to finish. + The return code for the thread function is placed in the area + pointed to by 'status', if 'status' is not NULL. + */ +extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status); + +/* Forcefully kill a thread without worrying about its state */ +extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_thread_h */ diff --git a/src/include/SDL_timer.h b/src/include/SDL_timer.h new file mode 100644 index 0000000..d21159f --- /dev/null +++ b/src/include/SDL_timer.h @@ -0,0 +1,115 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef _SDL_timer_h +#define _SDL_timer_h + +/* Header for the SDL time management routines */ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* This is the OS scheduler timeslice, in milliseconds */ +#define SDL_TIMESLICE 10 + +/* This is the maximum resolution of the SDL timer on all platforms */ +#define TIMER_RESOLUTION 10 /* Experimentally determined */ + +/* Get the number of milliseconds since the SDL library initialization. + * Note that this value wraps if the program runs for more than ~49 days. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); + +/* Wait a specified number of milliseconds before returning */ +extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); + +/* Function prototype for the timer callback function */ +typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval); + +/* Set a callback to run after the specified number of milliseconds has + * elapsed. The callback function is passed the current timer interval + * and returns the next timer interval. If the returned value is the + * same as the one passed in, the periodic alarm continues, otherwise a + * new alarm is scheduled. If the callback returns 0, the periodic alarm + * is cancelled. + * + * To cancel a currently running timer, call SDL_SetTimer(0, NULL); + * + * The timer callback function may run in a different thread than your + * main code, and so shouldn't call any functions from within itself. + * + * The maximum resolution of this timer is 10 ms, which means that if + * you request a 16 ms timer, your callback will run approximately 20 ms + * later on an unloaded system. If you wanted to set a flag signaling + * a frame update at 30 frames per second (every 33 ms), you might set a + * timer for 30 ms: + * SDL_SetTimer((33/10)*10, flag_update); + * + * If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init(). + * + * Under UNIX, you should not use raise or use SIGALRM and this function + * in the same program, as it is implemented using setitimer(). You also + * should not use this function in multi-threaded applications as signals + * to multi-threaded apps have undefined behavior in some implementations. + * + * This function returns 0 if successful, or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback); + +/* New timer API, supports multiple timers + * Written by Stephane Peter + */ + +/* Function prototype for the new timer callback function. + * The callback function is passed the current timer interval and returns + * the next timer interval. If the returned value is the same as the one + * passed in, the periodic alarm continues, otherwise a new alarm is + * scheduled. If the callback returns 0, the periodic alarm is cancelled. + */ +typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param); + +/* Definition of the timer ID type */ +typedef struct _SDL_TimerID *SDL_TimerID; + +/* Add a new timer to the pool of timers already running. + Returns a timer ID, or NULL when an error occurs. + */ +extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param); + +/* Remove one of the multiple timers knowing its ID. + * Returns a boolean value indicating success. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_timer_h */ diff --git a/src/include/SDL_types.h b/src/include/SDL_types.h new file mode 100644 index 0000000..853b9ce --- /dev/null +++ b/src/include/SDL_types.h @@ -0,0 +1,24 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* DEPRECATED */ +#include "SDL_stdinc.h" diff --git a/src/include/SDL_version.h b/src/include/SDL_version.h new file mode 100644 index 0000000..610ffe6 --- /dev/null +++ b/src/include/SDL_version.h @@ -0,0 +1,85 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* This header defines the current SDL version */ + +#ifndef _SDL_version_h +#define _SDL_version_h + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_MAJOR_VERSION 1 +#define SDL_MINOR_VERSION 2 +#define SDL_PATCHLEVEL 12 + +typedef struct SDL_version { + Uint8 major; + Uint8 minor; + Uint8 patch; +} SDL_version; + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL library. + */ +#define SDL_VERSION(X) \ +{ \ + (X)->major = SDL_MAJOR_VERSION; \ + (X)->minor = SDL_MINOR_VERSION; \ + (X)->patch = SDL_PATCHLEVEL; \ +} + +/* This macro turns the version numbers into a numeric value: + (1,2,3) -> (1203) + This assumes that there will never be more than 100 patchlevels +*/ +#define SDL_VERSIONNUM(X, Y, Z) \ + ((X)*1000 + (Y)*100 + (Z)) + +/* This is the version number macro for the current SDL version */ +#define SDL_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) + +/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */ +#define SDL_VERSION_ATLEAST(X, Y, Z) \ + (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +/* This function gets the version of the dynamically linked SDL library. + it should NOT be used to fill a version structure, instead you should + use the SDL_Version() macro. + */ +extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_version_h */ diff --git a/src/include/SDL_video.h b/src/include/SDL_video.h new file mode 100644 index 0000000..f6bacce --- /dev/null +++ b/src/include/SDL_video.h @@ -0,0 +1,891 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2006 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* Header file for access to the SDL raw framebuffer window */ + +#ifndef _SDL_video_h +#define _SDL_video_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_rwops.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Transparency definitions: These define alpha as the opacity of a surface */ +#define SDL_ALPHA_OPAQUE 255 +#define SDL_ALPHA_TRANSPARENT 0 + +/* Useful data types */ +typedef struct SDL_Rect { + Sint16 x, y; + Uint16 w, h; +} SDL_Rect; + +typedef struct SDL_Color { + Uint8 r; + Uint8 g; + Uint8 b; + Uint8 unused; +} SDL_Color; +#define SDL_Colour SDL_Color + +typedef struct SDL_Palette { + int ncolors; + SDL_Color *colors; +} SDL_Palette; + +/* Everything in the pixel format structure is read-only */ +typedef struct SDL_PixelFormat { + SDL_Palette *palette; + Uint8 BitsPerPixel; + Uint8 BytesPerPixel; + Uint8 Rloss; + Uint8 Gloss; + Uint8 Bloss; + Uint8 Aloss; + Uint8 Rshift; + Uint8 Gshift; + Uint8 Bshift; + Uint8 Ashift; + Uint32 Rmask; + Uint32 Gmask; + Uint32 Bmask; + Uint32 Amask; + + /* RGB color key information */ + Uint32 colorkey; + /* Alpha value information (per-surface alpha) */ + Uint8 alpha; +} SDL_PixelFormat; + +/* This structure should be treated as read-only, except for 'pixels', + which, if not NULL, contains the raw pixel data for the surface. +*/ +typedef struct SDL_Surface { + Uint32 flags; /* Read-only */ + SDL_PixelFormat *format; /* Read-only */ + int w, h; /* Read-only */ + Uint16 pitch; /* Read-only */ + void *pixels; /* Read-write */ + int offset; /* Private */ + + /* Hardware-specific surface info */ + struct private_hwdata *hwdata; + + /* clipping information */ + SDL_Rect clip_rect; /* Read-only */ + Uint32 unused1; /* for binary compatibility */ + + /* Allow recursive locks */ + Uint32 locked; /* Private */ + + /* info for fast blit mapping to other surfaces */ + struct SDL_BlitMap *map; /* Private */ + + /* format version, bumped at every change to invalidate blit maps */ + unsigned int format_version; /* Private */ + + /* Reference count -- used when freeing surface */ + int refcount; /* Read-mostly */ +} SDL_Surface; + +/* These are the currently supported flags for the SDL_surface */ +/* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */ +#define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */ +#define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */ +#define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */ +/* Available for SDL_SetVideoMode() */ +#define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */ +#define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */ +#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */ +#define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */ +#define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */ +#define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */ +#define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */ +#define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */ +/* Used internally (read-only) */ +#define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */ +#define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */ +#define SDL_RLEACCELOK 0x00002000 /* Private flag */ +#define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */ +#define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */ +#define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */ + +/* Evaluates to true if the surface needs to be locked before access */ +#define SDL_MUSTLOCK(surface) \ + (surface->offset || \ + ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0)) + +/* typedef for private surface blitting functions */ +typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect, + struct SDL_Surface *dst, SDL_Rect *dstrect); + + +/* Useful for determining the video hardware capabilities */ +typedef struct SDL_VideoInfo { + Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */ + Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */ + Uint32 UnusedBits1 :6; + Uint32 UnusedBits2 :1; + Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */ + Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */ + Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */ + Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */ + Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */ + Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */ + Uint32 blit_fill :1; /* Flag: Accelerated color fill */ + Uint32 UnusedBits3 :16; + Uint32 video_mem; /* The total amount of video memory (in K) */ + SDL_PixelFormat *vfmt; /* Value: The format of the video surface */ + int current_w; /* Value: The current video mode width */ + int current_h; /* Value: The current video mode height */ +} SDL_VideoInfo; + + +/* The most common video overlay formats. + For an explanation of these pixel formats, see: + http://www.webartz.com/fourcc/indexyuv.htm + + For information on the relationship between color spaces, see: + http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html + */ +#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */ +#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */ +#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */ +#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */ +#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */ + +/* The YUV hardware video overlay */ +typedef struct SDL_Overlay { + Uint32 format; /* Read-only */ + int w, h; /* Read-only */ + int planes; /* Read-only */ + Uint16 *pitches; /* Read-only */ + Uint8 **pixels; /* Read-write */ + + /* Hardware-specific surface info */ + struct private_yuvhwfuncs *hwfuncs; + struct private_yuvhwdata *hwdata; + + /* Special flags */ + Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */ + Uint32 UnusedBits :31; +} SDL_Overlay; + + +/* Public enumeration for setting the OpenGL window attributes. */ +typedef enum { + SDL_GL_RED_SIZE, + SDL_GL_GREEN_SIZE, + SDL_GL_BLUE_SIZE, + SDL_GL_ALPHA_SIZE, + SDL_GL_BUFFER_SIZE, + SDL_GL_DOUBLEBUFFER, + SDL_GL_DEPTH_SIZE, + SDL_GL_STENCIL_SIZE, + SDL_GL_ACCUM_RED_SIZE, + SDL_GL_ACCUM_GREEN_SIZE, + SDL_GL_ACCUM_BLUE_SIZE, + SDL_GL_ACCUM_ALPHA_SIZE, + SDL_GL_STEREO, + SDL_GL_MULTISAMPLEBUFFERS, + SDL_GL_MULTISAMPLESAMPLES, + SDL_GL_ACCELERATED_VISUAL, + SDL_GL_SWAP_CONTROL +} SDL_GLattr; + +/* flags for SDL_SetPalette() */ +#define SDL_LOGPAL 0x01 +#define SDL_PHYSPAL 0x02 + +/* Function prototypes */ + +/* These functions are used internally, and should not be used unless you + * have a specific need to specify the video driver you want to use. + * You should normally use SDL_Init() or SDL_InitSubSystem(). + * + * SDL_VideoInit() initializes the video subsystem -- sets up a connection + * to the window manager, etc, and determines the current video mode and + * pixel format, but does not initialize a window or graphics mode. + * Note that event handling is activated by this routine. + * + * If you use both sound and video in your application, you need to call + * SDL_Init() before opening the sound device, otherwise under Win32 DirectX, + * you won't be able to set full-screen display modes. + */ +extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags); +extern DECLSPEC void SDLCALL SDL_VideoQuit(void); + +/* This function fills the given character buffer with the name of the + * video driver, and returns a pointer to it if the video driver has + * been initialized. It returns NULL if no driver has been initialized. + */ +extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen); + +/* + * This function returns a pointer to the current display surface. + * If SDL is doing format conversion on the display surface, this + * function returns the publicly visible surface, not the real video + * surface. + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void); + +/* + * This function returns a read-only pointer to information about the + * video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' + * member of the returned structure will contain the pixel format of the + * "best" video mode. + */ +extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void); + +/* + * Check to see if a particular video mode is supported. + * It returns 0 if the requested mode is not supported under any bit depth, + * or returns the bits-per-pixel of the closest available mode with the + * given width and height. If this bits-per-pixel is different from the + * one used when setting the video mode, SDL_SetVideoMode() will succeed, + * but will emulate the requested bits-per-pixel with a shadow surface. + * + * The arguments to SDL_VideoModeOK() are the same ones you would pass to + * SDL_SetVideoMode() + */ +extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); + +/* + * Return a pointer to an array of available screen dimensions for the + * given format and video flags, sorted largest to smallest. Returns + * NULL if there are no dimensions available for a particular format, + * or (SDL_Rect **)-1 if any dimension is okay for the given format. + * + * If 'format' is NULL, the mode list will be for the format given + * by SDL_GetVideoInfo()->vfmt + */ +extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags); + +/* + * Set up a video mode with the specified width, height and bits-per-pixel. + * + * If 'bpp' is 0, it is treated as the current display bits per pixel. + * + * If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the + * requested bits-per-pixel, but will return whatever video pixel format is + * available. The default is to emulate the requested pixel format if it + * is not natively available. + * + * If SDL_HWSURFACE is set in 'flags', the video surface will be placed in + * video memory, if possible, and you may have to call SDL_LockSurface() + * in order to access the raw framebuffer. Otherwise, the video surface + * will be created in system memory. + * + * If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle + * updates asynchronously, but you must always lock before accessing pixels. + * SDL will wait for updates to complete before returning from the lock. + * + * If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee + * that the colors set by SDL_SetColors() will be the colors you get. + * Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all + * of the colors exactly the way they are requested, and you should look + * at the video surface structure to determine the actual palette. + * If SDL cannot guarantee that the colors you request can be set, + * i.e. if the colormap is shared, then the video surface may be created + * under emulation in system memory, overriding the SDL_HWSURFACE flag. + * + * If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set + * a fullscreen video mode. The default is to create a windowed mode + * if the current graphics system has a window manager. + * If the SDL library is able to set a fullscreen video mode, this flag + * will be set in the surface that is returned. + * + * If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up + * two surfaces in video memory and swap between them when you call + * SDL_Flip(). This is usually slower than the normal single-buffering + * scheme, but prevents "tearing" artifacts caused by modifying video + * memory while the monitor is refreshing. It should only be used by + * applications that redraw the entire screen on every update. + * + * If SDL_RESIZABLE is set in 'flags', the SDL library will allow the + * window manager, if any, to resize the window at runtime. When this + * occurs, SDL will send a SDL_VIDEORESIZE event to you application, + * and you must respond to the event by re-calling SDL_SetVideoMode() + * with the requested size (or another size that suits the application). + * + * If SDL_NOFRAME is set in 'flags', the SDL library will create a window + * without any title bar or frame decoration. Fullscreen video modes have + * this flag set automatically. + * + * This function returns the video framebuffer surface, or NULL if it fails. + * + * If you rely on functionality provided by certain video flags, check the + * flags of the returned surface to make sure that functionality is available. + * SDL will fall back to reduced functionality if the exact flags you wanted + * are not available. + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode + (int width, int height, int bpp, Uint32 flags); + +/* + * Makes sure the given list of rectangles is updated on the given screen. + * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire + * screen. + * These functions should not be called while 'screen' is locked. + */ +extern DECLSPEC void SDLCALL SDL_UpdateRects + (SDL_Surface *screen, int numrects, SDL_Rect *rects); +extern DECLSPEC void SDLCALL SDL_UpdateRect + (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h); + +/* + * On hardware that supports double-buffering, this function sets up a flip + * and returns. The hardware will wait for vertical retrace, and then swap + * video buffers before the next video surface blit or lock will return. + * On hardware that doesn not support double-buffering, this is equivalent + * to calling SDL_UpdateRect(screen, 0, 0, 0, 0); + * The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when + * setting the video mode for this function to perform hardware flipping. + * This function returns 0 if successful, or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen); + +/* + * Set the gamma correction for each of the color channels. + * The gamma values range (approximately) between 0.1 and 10.0 + * + * If this function isn't supported directly by the hardware, it will + * be emulated using gamma ramps, if available. If successful, this + * function returns 0, otherwise it returns -1. + */ +extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); + +/* + * Set the gamma translation table for the red, green, and blue channels + * of the video hardware. Each table is an array of 256 16-bit quantities, + * representing a mapping between the input and output for that channel. + * The input is the index into the array, and the output is the 16-bit + * gamma value at that index, scaled to the output color precision. + * + * You may pass NULL for any of the channels to leave it unchanged. + * If the call succeeds, it will return 0. If the display driver or + * hardware does not support gamma translation, or otherwise fails, + * this function will return -1. + */ +extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue); + +/* + * Retrieve the current values of the gamma translation tables. + * + * You must pass in valid pointers to arrays of 256 16-bit quantities. + * Any of the pointers may be NULL to ignore that channel. + * If the call succeeds, it will return 0. If the display driver or + * hardware does not support gamma translation, or otherwise fails, + * this function will return -1. + */ +extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); + +/* + * Sets a portion of the colormap for the given 8-bit surface. If 'surface' + * is not a palettized surface, this function does nothing, returning 0. + * If all of the colors were set as passed to SDL_SetColors(), it will + * return 1. If not all the color entries were set exactly as given, + * it will return 0, and you should look at the surface palette to + * determine the actual color palette. + * + * When 'surface' is the surface associated with the current display, the + * display colormap will be updated with the requested colors. If + * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors() + * will always return 1, and the palette is guaranteed to be set the way + * you desire, even if the window colormap has to be warped or run under + * emulation. + */ +extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface, + SDL_Color *colors, int firstcolor, int ncolors); + +/* + * Sets a portion of the colormap for a given 8-bit surface. + * 'flags' is one or both of: + * SDL_LOGPAL -- set logical palette, which controls how blits are mapped + * to/from the surface, + * SDL_PHYSPAL -- set physical palette, which controls how pixels look on + * the screen + * Only screens have physical palettes. Separate change of physical/logical + * palettes is only possible if the screen has SDL_HWPALETTE set. + * + * The return value is 1 if all colours could be set as requested, and 0 + * otherwise. + * + * SDL_SetColors() is equivalent to calling this function with + * flags = (SDL_LOGPAL|SDL_PHYSPAL). + */ +extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags, + SDL_Color *colors, int firstcolor, + int ncolors); + +/* + * Maps an RGB triple to an opaque pixel value for a given pixel format + */ +extern DECLSPEC Uint32 SDLCALL SDL_MapRGB +(const SDL_PixelFormat * const format, + const Uint8 r, const Uint8 g, const Uint8 b); + +/* + * Maps an RGBA quadruple to a pixel value for a given pixel format + */ +extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA +(const SDL_PixelFormat * const format, + const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a); + +/* + * Maps a pixel value into the RGB components for a given pixel format + */ +extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, + Uint8 *r, Uint8 *g, Uint8 *b); + +/* + * Maps a pixel value into the RGBA components for a given pixel format + */ +extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, + Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); + +/* + * Allocate and free an RGB surface (must be called after SDL_SetVideoMode) + * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. + * If the depth is greater than 8 bits, the pixel format is set using the + * flags '[RGB]mask'. + * If the function runs out of memory, it will return NULL. + * + * The 'flags' tell what kind of surface to create. + * SDL_SWSURFACE means that the surface should be created in system memory. + * SDL_HWSURFACE means that the surface should be created in video memory, + * with the same format as the display surface. This is useful for surfaces + * that will not change much, to take advantage of hardware acceleration + * when being blitted to the display surface. + * SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with + * this surface, but you must always lock it before accessing the pixels. + * SDL will wait for current blits to finish before returning from the lock. + * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits. + * If the hardware supports acceleration of colorkey blits between + * two surfaces in video memory, SDL will try to place the surface in + * video memory. If this isn't possible or if there is no hardware + * acceleration available, the surface will be placed in system memory. + * SDL_SRCALPHA means that the surface will be used for alpha blits and + * if the hardware supports hardware acceleration of alpha blits between + * two surfaces in video memory, to place the surface in video memory + * if possible, otherwise it will be placed in system memory. + * If the surface is created in video memory, blits will be _much_ faster, + * but the surface format must be identical to the video surface format, + * and the only way to access the pixels member of the surface is to use + * the SDL_LockSurface() and SDL_UnlockSurface() calls. + * If the requested surface actually resides in video memory, SDL_HWSURFACE + * will be set in the flags member of the returned surface. If for some + * reason the surface could not be placed in video memory, it will not have + * the SDL_HWSURFACE flag set, and will be created in system memory instead. + */ +#define SDL_AllocSurface SDL_CreateRGBSurface +extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface + (Uint32 flags, int width, int height, int depth, + Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, + int width, int height, int depth, int pitch, + Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface); + +/* + * SDL_LockSurface() sets up a surface for directly accessing the pixels. + * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write + * to and read from 'surface->pixels', using the pixel format stored in + * 'surface->format'. Once you are done accessing the surface, you should + * use SDL_UnlockSurface() to release it. + * + * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates + * to 0, then you can read and write to the surface at any time, and the + * pixel format of the surface will not change. In particular, if the + * SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you + * will not need to lock the display surface before accessing it. + * + * No operating system or library calls should be made between lock/unlock + * pairs, as critical system locks may be held during this time. + * + * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. + */ +extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface); +extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); + +/* + * Load a surface from a seekable SDL data source (memory or file.) + * If 'freesrc' is non-zero, the source will be closed after being read. + * Returns the new surface, or NULL if there was an error. + * The new surface should be freed with SDL_FreeSurface(). + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); + +/* Convenience macro -- load a surface from a file */ +#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) + +/* + * Save a surface to a seekable SDL data source (memory or file.) + * If 'freedst' is non-zero, the source will be closed after being written. + * Returns 0 if successful or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_SaveBMP_RW + (SDL_Surface *surface, SDL_RWops *dst, int freedst); + +/* Convenience macro -- save a surface to a file */ +#define SDL_SaveBMP(surface, file) \ + SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) + +/* + * Sets the color key (transparent pixel) in a blittable surface. + * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), + * 'key' will be the transparent pixel in the source image of a blit. + * SDL_RLEACCEL requests RLE acceleration for the surface if present, + * and removes RLE acceleration if absent. + * If 'flag' is 0, this function clears any current color key. + * This function returns 0, or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_SetColorKey + (SDL_Surface *surface, Uint32 flag, Uint32 key); + +/* + * This function sets the alpha value for the entire surface, as opposed to + * using the alpha component of each pixel. This value measures the range + * of transparency of the surface, 0 being completely transparent to 255 + * being completely opaque. An 'alpha' value of 255 causes blits to be + * opaque, the source pixels copied to the destination (the default). Note + * that per-surface alpha can be combined with colorkey transparency. + * + * If 'flag' is 0, alpha blending is disabled for the surface. + * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface. + * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the + * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. + * + * The 'alpha' parameter is ignored for surfaces that have an alpha channel. + */ +extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha); + +/* + * Sets the clipping rectangle for the destination surface in a blit. + * + * If the clip rectangle is NULL, clipping will be disabled. + * If the clip rectangle doesn't intersect the surface, the function will + * return SDL_FALSE and blits will be completely clipped. Otherwise the + * function returns SDL_TRUE and blits to the surface will be clipped to + * the intersection of the surface area and the clipping rectangle. + * + * Note that blits are automatically clipped to the edges of the source + * and destination surfaces. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect); + +/* + * Gets the clipping rectangle for the destination surface in a blit. + * 'rect' must be a pointer to a valid rectangle which will be filled + * with the correct values. + */ +extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); + +/* + * Creates a new surface of the specified format, and then copies and maps + * the given surface to it so the blit of the converted surface will be as + * fast as possible. If this function fails, it returns NULL. + * + * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those + * semantics. You can also pass SDL_RLEACCEL in the flags parameter and + * SDL will try to RLE accelerate colorkey and alpha blits in the resulting + * surface. + * + * This function is used internally by SDL_DisplayFormat(). + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface + (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags); + +/* + * This performs a fast blit from the source surface to the destination + * surface. It assumes that the source and destination rectangles are + * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire + * surface (src or dst) is copied. The final blit rectangles are saved + * in 'srcrect' and 'dstrect' after all clipping is performed. + * If the blit is successful, it returns 0, otherwise it returns -1. + * + * The blit function should not be called on a locked surface. + * + * The blit semantics for surfaces with and without alpha and colorkey + * are defined as follows: + * + * RGBA->RGB: + * SDL_SRCALPHA set: + * alpha-blend (using alpha-channel). + * SDL_SRCCOLORKEY ignored. + * SDL_SRCALPHA not set: + * copy RGB. + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * RGB values of the source colour key, ignoring alpha in the + * comparison. + * + * RGB->RGBA: + * SDL_SRCALPHA set: + * alpha-blend (using the source per-surface alpha value); + * set destination alpha to opaque. + * SDL_SRCALPHA not set: + * copy RGB, set destination alpha to source per-surface alpha value. + * both: + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * source colour key. + * + * RGBA->RGBA: + * SDL_SRCALPHA set: + * alpha-blend (using the source alpha channel) the RGB values; + * leave destination alpha untouched. [Note: is this correct?] + * SDL_SRCCOLORKEY ignored. + * SDL_SRCALPHA not set: + * copy all of RGBA to the destination. + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * RGB values of the source colour key, ignoring alpha in the + * comparison. + * + * RGB->RGB: + * SDL_SRCALPHA set: + * alpha-blend (using the source per-surface alpha value). + * SDL_SRCALPHA not set: + * copy RGB. + * both: + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * source colour key. + * + * If either of the surfaces were in video memory, and the blit returns -2, + * the video memory was lost, so it should be reloaded with artwork and + * re-blitted: + while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { + while ( SDL_LockSurface(image) < 0 ) + Sleep(10); + -- Write image pixels to image->pixels -- + SDL_UnlockSurface(image); + } + * This happens under DirectX 5.0 when the system switches away from your + * fullscreen application. The lock will also fail until you have access + * to the video memory again. + */ +/* You should call SDL_BlitSurface() unless you know exactly how SDL + blitting works internally and how to use the other blit functions. +*/ +#define SDL_BlitSurface SDL_UpperBlit + +/* This is the public blit function, SDL_BlitSurface(), and it performs + rectangle validation and clipping before passing it to SDL_LowerBlit() +*/ +extern DECLSPEC int SDLCALL SDL_UpperBlit + (SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dst, SDL_Rect *dstrect); +/* This is a semi-private blit function and it performs low-level surface + blitting only. +*/ +extern DECLSPEC int SDLCALL SDL_LowerBlit + (SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dst, SDL_Rect *dstrect); + +/* + * This function performs a fast fill of the given rectangle with 'color' + * The given rectangle is clipped to the destination surface clip area + * and the final fill rectangle is saved in the passed in pointer. + * If 'dstrect' is NULL, the whole surface will be filled with 'color' + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * This function returns 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_FillRect + (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); + +/* + * This function takes a surface and copies it to a new surface of the + * pixel format and colors of the video framebuffer, suitable for fast + * blitting onto the display surface. It calls SDL_ConvertSurface() + * + * If you want to take advantage of hardware colorkey or alpha blit + * acceleration, you should set the colorkey and alpha value before + * calling this function. + * + * If the conversion fails or runs out of memory, it returns NULL + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface); + +/* + * This function takes a surface and copies it to a new surface of the + * pixel format and colors of the video framebuffer (if possible), + * suitable for fast alpha blitting onto the display surface. + * The new surface will always have an alpha channel. + * + * If you want to take advantage of hardware colorkey or alpha blit + * acceleration, you should set the colorkey and alpha value before + * calling this function. + * + * If the conversion fails or runs out of memory, it returns NULL + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* YUV video surface overlay functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* This function creates a video output overlay + Calling the returned surface an overlay is something of a misnomer because + the contents of the display surface underneath the area where the overlay + is shown is undefined - it may be overwritten with the converted YUV data. +*/ +extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height, + Uint32 format, SDL_Surface *display); + +/* Lock an overlay for direct access, and unlock it when you are done */ +extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay); +extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay); + +/* Blit a video overlay to the display surface. + The contents of the video surface underneath the blit destination are + not defined. + The width and height of the destination rectangle may be different from + that of the overlay, but currently only 2x scaling is supported. +*/ +extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect); + +/* Free a video overlay */ +extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* OpenGL support functions. */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Dynamically load an OpenGL library, or the default one if path is NULL + * + * If you do this, you need to retrieve all of the GL functions used in + * your program from the dynamic library using SDL_GL_GetProcAddress(). + */ +extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); + +/* + * Get the address of a GL function + */ +extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc); + +/* + * Set an attribute of the OpenGL subsystem before intialization. + */ +extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); + +/* + * Get an attribute of the OpenGL subsystem from the windowing + * interface, such as glX. This is of course different from getting + * the values from SDL's internal OpenGL subsystem, which only + * stores the values you request before initialization. + * + * Developers should track the values they pass into SDL_GL_SetAttribute + * themselves if they want to retrieve these values. + */ +extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value); + +/* + * Swap the OpenGL buffers, if double-buffering is supported. + */ +extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); + +/* + * Internal functions that should not be called unless you have read + * and understood the source code for these functions. + */ +extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects); +extern DECLSPEC void SDLCALL SDL_GL_Lock(void); +extern DECLSPEC void SDLCALL SDL_GL_Unlock(void); + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* These functions allow interaction with the window manager, if any. */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Sets/Gets the title and icon text of the display window (UTF-8 encoded) + */ +extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon); +extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon); + +/* + * Sets the icon for the display window. + * This function must be called before the first call to SDL_SetVideoMode(). + * It takes an icon surface, and a mask in MSB format. + * If 'mask' is NULL, the entire icon surface will be used as the icon. + */ +extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); + +/* + * This function iconifies the window, and returns 1 if it succeeded. + * If the function succeeds, it generates an SDL_APPACTIVE loss event. + * This function is a noop and returns 0 in non-windowed environments. + */ +extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); + +/* + * Toggle fullscreen mode without changing the contents of the screen. + * If the display surface does not require locking before accessing + * the pixel information, then the memory pointers will not change. + * + * If this function was able to toggle fullscreen mode (change from + * running in a window to fullscreen, or vice-versa), it will return 1. + * If it is not implemented, or fails, it returns 0. + * + * The next call to SDL_SetVideoMode() will set the mode fullscreen + * attribute based on the flags parameter - if SDL_FULLSCREEN is not + * set, then the display will be windowed by default where supported. + * + * This is currently only implemented in the X11 video driver. + */ +extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface); + +/* + * This function allows you to set and query the input grab state of + * the application. It returns the new input grab state. + */ +typedef enum { + SDL_GRAB_QUERY = -1, + SDL_GRAB_OFF = 0, + SDL_GRAB_ON = 1, + SDL_GRAB_FULLSCREEN /* Used internally */ +} SDL_GrabMode; +/* + * Grabbing means that the mouse is confined to the application window, + * and nearly all keyboard input is passed directly to the application, + * and not interpreted by a window manager, if any. + */ +extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode); + +/* Not in public API at the moment - do not use! */ +extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dst, SDL_Rect *dstrect); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_video_h */ diff --git a/src/include/begin_code.h b/src/include/begin_code.h new file mode 100644 index 0000000..b03787f --- /dev/null +++ b/src/include/begin_code.h @@ -0,0 +1,156 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* This file sets things up for C dynamic library function definitions, + static inlined functions, and structures aligned at 4-byte alignment. + If you don't like ugly C preprocessor code, don't look at this file. :) +*/ + +/* This shouldn't be nested -- included it around code only. */ +#ifdef _begin_code_h +#error Nested inclusion of begin_code.h +#endif +#define _begin_code_h + +/* Some compilers use a special export keyword */ +#ifndef DECLSPEC +# if defined(__BEOS__) +# if defined(__GNUC__) +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC __declspec(export) +# endif +# elif defined(__WIN32__) +# ifdef __BORLANDC__ +# ifdef BUILD_SDL +# define DECLSPEC +# else +# define DECLSPEC __declspec(dllimport) +# endif +# else +# define DECLSPEC __declspec(dllexport) +# endif +# elif defined(__OS2__) +# ifdef __WATCOMC__ +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif +# else +# define DECLSPEC +# endif +# else +# if defined(__GNUC__) && __GNUC__ >= 4 +# define DECLSPEC __attribute__ ((visibility("default"))) +# else +# define DECLSPEC +# endif +# endif +#endif + +/* By default SDL uses the C calling convention */ +#ifndef SDLCALL +#if defined(__WIN32__) && !defined(__GNUC__) +#define SDLCALL __cdecl +#else +#ifdef __OS2__ +/* But on OS/2, we use the _System calling convention */ +/* to be compatible with every compiler */ +#define SDLCALL _System +#else +#define SDLCALL +#endif +#endif +#endif /* SDLCALL */ + +#ifdef __SYMBIAN32__ +#ifndef EKA2 +#undef DECLSPEC +#define DECLSPEC +#elif !defined(__WINS__) +#undef DECLSPEC +#define DECLSPEC __declspec(dllexport) +#endif //EKA2 +#endif //__SYMBIAN32__ + +/* Force structure packing at 4 byte alignment. + This is necessary if the header is included in code which has structure + packing set to an alternate value, say for loading structures from disk. + The packing is reset to the previous value in close_code.h + */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef _MSC_VER +#pragma warning(disable: 4103) +#endif +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#pragma pack(push,4) +#elif (defined(__MWERKS__) && defined(__MACOS__)) +#pragma options align=mac68k4byte +#pragma enumsalwaysint on +#endif /* Compiler needs structure packing set */ + +/* Set up compiler-specific options for inlining functions */ +#ifndef SDL_INLINE_OKAY +#ifdef __GNUC__ +#define SDL_INLINE_OKAY +#else +/* Add any special compiler-specific cases here */ +#if defined(_MSC_VER) || defined(__BORLANDC__) || \ + defined(__DMC__) || defined(__SC__) || \ + defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__DECC) || defined(__EABI__) +#ifndef __inline__ +#define __inline__ __inline +#endif +#define SDL_INLINE_OKAY +#else +#if !defined(__MRC__) && !defined(_SGI_SOURCE) +#ifndef __inline__ +#define __inline__ inline +#endif +#define SDL_INLINE_OKAY +#endif /* Not a funky compiler */ +#endif /* Visual C++ */ +#endif /* GNU C */ +#endif /* SDL_INLINE_OKAY */ + +/* If inlining isn't supported, remove "__inline__", turning static + inlined functions into static functions (resulting in code bloat + in all files which include the offending header files) +*/ +#ifndef SDL_INLINE_OKAY +#define __inline__ +#endif + +/* Apparently this is needed by several Windows compilers */ +#if !defined(__MACH__) +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif /* NULL */ +#endif /* ! Mac OS X - breaks precompiled headers */ diff --git a/src/include/close_code.h b/src/include/close_code.h new file mode 100644 index 0000000..afbb650 --- /dev/null +++ b/src/include/close_code.h @@ -0,0 +1,41 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2004 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/* This file reverses the effects of begin_code.h and should be included + after you finish any function and structure declarations in your headers +*/ + +#undef _begin_code_h + +/* Reset structure packing at previous byte alignment */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#if (defined(__MWERKS__) && defined(__MACOS__)) +#pragma options align=reset +#pragma enumsalwaysint reset +#else +#pragma pack(pop) +#endif +#endif /* Compiler needs structure packing set */ + diff --git a/src/include/wincompat.h b/src/include/wincompat.h new file mode 100644 index 0000000..3bdbc4f --- /dev/null +++ b/src/include/wincompat.h @@ -0,0 +1,81 @@ +#if !defined(WINCOMPAT_INCLUDED) && !defined(PLATFORM_WINDOWS) && !defined(WIN32) && !defined(WINDOWS) && !defined(__WIN32__) +#define WINCOMPAT_INCLUDED + +/** + * + * Author: Magnus Naeslund (mag@fbab.net, mag@bahnhof.se) + * (c) 2000 Magnus Naeslund, all rights reserved + * + */ + +#include +#include +#include +#include +#include +#include + +#ifndef TRUE + #define TRUE 1 +#endif +#ifndef FALSE + #define FALSE 0 +#endif + +#define _kbhit kbhit +#define stricmp strcasecmp +#define strnicmp strncasecmp + +#define Sleep(x) usleep((x)*1000) + +static int inited=0; +static struct termios ori; + +static void tcatexit(){ + tcsetattr(0,0,&ori); +} + +static void init_terminal(){ + struct termios t; + tcgetattr(0,&t); + tcgetattr(0,&ori); + t.c_lflag &= ~(ICANON); + tcsetattr(0,0,&t); + atexit(tcatexit); +} + +static inline int kbhit(){ + fd_set rfds; + struct timeval tv; + + if (!inited){ + inited=1; + init_terminal(); + } + + FD_ZERO(&rfds); + FD_SET(0, &rfds); + tv.tv_sec = 0; + tv.tv_usec = 10*1000; + return select(1, &rfds, NULL, NULL, &tv)>0; +} + +static inline int getch(){ + fd_set rfds; + + if (!inited){ + inited=1; + init_terminal(); + } + + FD_ZERO(&rfds); + FD_SET(0, &rfds); + if (select(1, &rfds, NULL, NULL, NULL)>0) + return getchar(); + else{ + printf("wincompat.h: select() on fd 0 failed\n"); + return 0xDeadBeef; + } +} + +#endif diff --git a/src/include/zconf.h b/src/include/zconf.h new file mode 100644 index 0000000..e13acd1 --- /dev/null +++ b/src/include/zconf.h @@ -0,0 +1,332 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: zconf.h,v 1.2 2006/09/11 19:19:13 aardappel Exp $ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define deflateBound z_deflateBound +# define deflatePrime z_deflatePrime +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateCopy z_inflateCopy +# define inflateReset z_inflateReset +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table +# define zError z_zError + +# define alloc_func z_alloc_func +# define free_func z_free_func +# define in_func z_in_func +# define out_func z_out_func +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +# ifdef FAR +# undef FAR +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(deflateBound,"DEBND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(compressBound,"CMBND") +# pragma map(inflate_table,"INTABL") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/src/include/zlib.h b/src/include/zlib.h new file mode 100644 index 0000000..0228179 --- /dev/null +++ b/src/include/zlib.h @@ -0,0 +1,1357 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.3, July 18th, 2005 + + Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.3" +#define ZLIB_VERNUM 0x1230 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms will be added later and will have the same + stream interface. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never + crash even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce some + output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumualte before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In particular + avail_in is zero after the call if enough output space has been provided + before the call.) Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + the value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the exact + value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller. msg is set to null if there is no error + message. inflateInit does not perform any decompression apart from reading + the zlib header if present: this will be done by inflate(). (So next_in and + avail_in may be modified, but next_out and avail_out are unchanged.) +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, + Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() stop + if and when it gets to the next deflate block boundary. When decoding the + zlib or gzip format, this will cause inflate() to return immediately after + the header and before the first block. When doing a raw inflate, inflate() + will go ahead and process the first block, and will return when it gets to + the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 + if inflate() is currently decoding the last block in the deflate stream, + plus 128 if inflate() returned immediately after decoding an end-of-block + code or decoding the complete header up to just before the first byte of the + deflate stream. The end-of-block will not be indicated until all of the + uncompressed data from that block has been written to strm->next_out. The + number of unused bits may in general be greater than seven, except when + bit 7 of data_type is set, in which case the number of unused bits will be + less than eight. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster approach + may be used for the single inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() will decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically. Any information + contained in the gzip header is not retained, so applications that need that + information should instead use raw inflate, see inflateInit2() below, or + inflateBack() and perform their own processing of the gzip header and + trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may then + call inflateSync() to look for a good compression block if a partial recovery + of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), + no header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as + Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy + parameter only affects the compression ratio but not the correctness of the + compressed output even if it is not set appropriately. Z_FIXED prevents the + use of dynamic Huffman codes, allowing for a simpler decoder for special + applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid + method). msg is set to null if there is no error message. deflateInit2 does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any + call of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size in + deflate or deflate2. Thus the strings most likely to be useful should be + put at the end of the dictionary, not at the front. In addition, the + current implementation of deflate will use at most the window size minus + 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different + strategy. If the compression level is changed, the input available so far + is compressed with the old level (and may be flushed); the new level will + take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() + or deflateInit2(). This would be used to allocate an output buffer + for deflation in a single pass, and so would be called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the + bits leftover from a previous deflate stream when appending to it. As such, + this function can only be used for raw deflate, and must be used before the + first deflate() call after a deflateInit2() or deflateReset(). bits must be + less than or equal to 16, and that many of the least significant bits of + value will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is + a crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg + is set to null if there is no error message. inflateInit2 does not perform + any decompression apart from reading the zlib header if present: this will + be done by inflate(). (So next_in and avail_in may be modified, but next_out + and avail_out are unchanged.) +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been found, + or Z_STREAM_ERROR if the stream structure was inconsistent. In the success + case, the application may save the current current value of total_in which + indicates where valid compressed data was found. In the error case, the + application may repeatedly call inflateSync, providing more input each time, + until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. + The stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK can be used to + force inflate() to return immediately after header processing is complete + and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When + any of extra, name, or comment are not Z_NULL and the respective field is + not present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not + be allocated, or Z_VERSION_ERROR if the version of the library does not + match the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free + the allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects + only the raw deflate stream to decompress. This is different from the + normal behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format + error in the deflate stream (in which case strm->msg is set to indicate the + nature of the error), or Z_STREAM_ERROR if the stream was not properly + initialized. In the case of Z_BUF_ERROR, an input or output error can be + distinguished using strm->next_in which will be Z_NULL only if in() returned + an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to + out() returning non-zero. (in() will always be called before out(), so + strm->next_in is assured to be defined if out() returns non-zero.) Note + that inflateBack() cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the + basic stream-oriented functions. To simplify the interface, some + default options are assumed (compression level and memory usage, + standard memory allocation functions). The source code of these + utility functions can easily be modified if you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be at least the value returned + by compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + This function can be used to compress a whole file at once if the + input file is mmap'ed. + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before + a compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + +typedef voidp gzFile; + +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +/* + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb") but can also include a compression level + ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for + Huffman only compression as in "wb1h", or 'R' for run-length encoding + as in "wb1R". (See the description of deflateInit2 for more information + about the strategy parameter.) + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). */ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen() associates a gzFile with the file descriptor fd. File + descriptors are obtained from calls like open, dup, creat, pipe or + fileno (in the file has been previously opened with fopen). + The mode parameter is as in gzopen. + The next call of gzclose on the returned gzFile will also close the + file descriptor fd, just like fclose(fdopen(fd), mode) closes the file + descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). + gzdopen returns NULL if there was insufficient memory to allocate + the (de)compression state. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. + If the input file was not in gzip format, gzread copies the given number + of bytes into the buffer. + gzread returns the number of uncompressed bytes actually read (0 for + end of file, -1 for error). */ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes actually written + (0 in case of error). +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). The number of + uncompressed bytes written is limited to 4095. The caller should assure that + this limit is not exceeded. If it is exceeded, then gzprintf() will return + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or + a newline character is read and transferred to buf, or an end-of-file + condition is encountered. The string is then terminated with a null + character. + gzgets returns buf, or Z_NULL in case of error. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read again later. + Only one character of push-back is allowed. gzungetc() returns the + character pushed, or -1 on failure. gzungetc() will fail if a + character has been pushed but not read yet, or if c is -1. The pushed + character will be discarded if the stream is repositioned with gzseek() + or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. The return value is the zlib + error number (see function gzerror below). gzflush returns Z_OK if + the flush parameter is Z_FINISH and all output could be flushed. + gzflush should be called only when strictly necessary because it can + degrade compression. +*/ + +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the + given compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +/* + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns 1 if file is being read directly without decompression, otherwise + zero. +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. The return value is the zlib + error number (see function gzerror below). +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the + given compressed file. errnum is set to zlib error number. If an + error occurred in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the + compression library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is NULL, this function returns + the required initial value for the checksum. + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); +/* + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is NULL, this function returns the required initial + value for the for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + +/* + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + + +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; /* hack for buggy compilers */ +#endif + +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/src/lib/CVS/Entries b/src/lib/CVS/Entries new file mode 100644 index 0000000..d56506b --- /dev/null +++ b/src/lib/CVS/Entries @@ -0,0 +1,6 @@ +/SDL.lib/1.3/Sun Aug 12 09:37:32 2007/-kb/ +/SDL_image.lib/1.3/Sun Aug 12 09:37:33 2007/-kb/ +/SDL_mixer.lib/1.2/Sun Aug 12 09:37:33 2007/-kb/ +/SDLmain.lib/1.3/Sun Aug 12 09:37:33 2007/-kb/ +/zdll.lib/1.1/Mon Sep 11 19:19:14 2006/-kb/ +D diff --git a/src/lib/CVS/Repository b/src/lib/CVS/Repository new file mode 100644 index 0000000..8058997 --- /dev/null +++ b/src/lib/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/lib diff --git a/src/lib/CVS/Root b/src/lib/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/lib/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/lib/SDL.lib b/src/lib/SDL.lib new file mode 100644 index 0000000000000000000000000000000000000000..993fd2ba7e6ef8795d6ff8262b66f7f9c635f271 GIT binary patch literal 42702 zcwX&XZ*UdW*?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cC$&gTU- w&A?Bi49DPaCC2Y2+C&Vg572J4BP?=UgwKd+ahcd6!ibR0Dni4QAOFSZKazUXbpQYW literal 0 HcwPel00001 diff --git a/src/lib/zdll.lib b/src/lib/zdll.lib new file mode 100644 index 0000000000000000000000000000000000000000..01f4e10e6ef05b1198d2e5b3410437611826e61a GIT binary patch literal 10590 zcwW6(O>Yx97=BvHQbJiuOTWL;Qrhs-SeL|%1iMYsKjsVC4&GSG@8EAbB#6A+*KM*=&grQf2 z;Wvct2ZWAigzh+@>oTF^BBARAVdS>JJHqfa!bm$|=OKZIgxDQI+a-bLg!UL=^f{sb z9-;RzVQ_{J?IsMZ68hg02A&f7#|Q%pgua)Ap(aA#G9mg_;1*%8^FLoWeKI+F^!!ogpIuo^@|PE^Vkuk5LoZN$##+p!$`;&= zWnFtSYg$5q=HsIZJxn#W8k zeHD7aSFetkQ+6ZhSYc%~o3nn(rItzvu#jh(*@{+)mED|P6Nj4B>qLipisZAFcfY9S zsdnjRVbx+0EmLXDNOMNFvo2Z{0iYFRebGu~;H1)ey_mHF-N{J%YB8HHFG9&VHEU%~ zL8-JZS!AVD@lC@?72h$5H(>WUjy^cR1j2kXP;LPpw*nv8ZuEie*0E0D)e!Jz7=m+M+Z7FhK<;Y2)@Gv#?gfDu?3qkjeXdI9_+?m?7~hA zq8kGkLKJ-%#Rz&4!!Y`>39ZsC!GtMWZyBXmn%eXI#xU0!?o z&AU-~c6gx<94RI>gp>!4Vo{_{$(3@NymBQ{$(3iSjB#a-BJiY^aaEIuUng=a>13}c z);D)en5(VO{v-bz8a~WS1&W7ANmdWMDzfLJ64jqU}r7%~w z0e}DT*Gyv_*xtmSy0MIPWo>Er9K>^k;Wy~d5j4+?WizRAYB(-!Yy$^7isP*)Z{U6t z&xGFr>1SVG{G<4R`$eDCv$UD*s`j(lX;ciY&6~v6>}L~ue`8b2scgDfC>0jV(b)X% z=-i3ZClT~Ci8nX#QUlL1VZ?TGJLiz#h&>kUhi+{81z)~Mwg&N)dJfs%BTP8imSw0d z+rS|#3EKy%&$Mf?pMJPcJ^y=9vz%sstI!1BC_>_iACw5G=MnPM`K7@Tl7apx5i%uh zc7*)y^P8y2$bZd*h$vjEBRH)H<8PS)*N&b#qJx zbF}duYg9Etn3l-k^RRUBF>dtAj}S~#2ZNcm^Jr+4$|ekhVdOX33{o_O;7BBbIoQ#Y zo$_1`Z+ESm$Fb`?9emEYJY0Z;X-_E%+zpkmC!_ zVi5OY)pMBE!6D+H8@Dh$W#HIpbI8lQ5FDmaA67W{Jz*Fgd70+n>1I5;JUk(_cZK-s zWlSR;rqHU`(0ii_S1nI1F@+~&&l!~CZiS_`r zewEL@R1Y&whPgE6;i3Eb5N$HV__)ob{3oD#7SrxCVY7(;F;vfB>a$7Ckn{ZaA_SKq O4&sta{$E6igMR_D<)%ph literal 0 HcwPel00001 diff --git a/src/mingw/CVS/Entries b/src/mingw/CVS/Entries new file mode 100644 index 0000000..885f699 --- /dev/null +++ b/src/mingw/CVS/Entries @@ -0,0 +1,4 @@ +/Makefile.mingw/1.27/Mon Mar 24 00:55:29 2008// +/make.mingw.bat/1.1/Wed Mar 8 03:26:36 2006// +/sauerbraten.cbp/1.13/Sun May 18 17:54:48 2008// +D/lib//// diff --git a/src/mingw/CVS/Repository b/src/mingw/CVS/Repository new file mode 100644 index 0000000..e883e33 --- /dev/null +++ b/src/mingw/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/mingw diff --git a/src/mingw/CVS/Root b/src/mingw/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/mingw/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/mingw/Makefile.mingw b/src/mingw/Makefile.mingw new file mode 100644 index 0000000..2512eb2 --- /dev/null +++ b/src/mingw/Makefile.mingw @@ -0,0 +1,63 @@ +CXX=g++ +CXXOPTFLAGS=-O3 -fomit-frame-pointer +CXXFLAGS= $(CXXOPTFLAGS) -Wall -fsigned-char -Ienet/include -Iinclude -Ishared -Iengine -Ifpsgame + +CLIENT_LIBS=-Lenet -Lmingw/lib -lstdc++ -lenet -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_mixer -mwindows -lz -lopengl32 -lglu32 -lws2_32 -lwinmm +CLIENT_OBJS= \ + shared/tools.o \ + shared/geom.o \ + engine/3dgui.o \ + engine/bih.o \ + engine/client.o \ + engine/command.o \ + engine/console.o \ + engine/cubeloader.o \ + engine/decal.o \ + engine/dynlight.o \ + engine/glare.o \ + engine/grass.o \ + engine/lightmap.o \ + engine/main.o \ + engine/material.o \ + engine/menus.o \ + engine/normal.o \ + engine/octa.o \ + engine/octaedit.o \ + engine/octarender.o \ + engine/physics.o \ + engine/pvs.o \ + engine/rendergl.o \ + engine/rendermodel.o \ + engine/renderparticles.o \ + engine/rendersky.o \ + engine/rendertext.o \ + engine/renderva.o \ + engine/server.o \ + engine/serverbrowser.o \ + engine/shader.o \ + engine/shadowmap.o \ + engine/sound.o \ + engine/texture.o \ + engine/water.o \ + engine/world.o \ + engine/worldio.o \ + fpsgame/fps.o \ + rpggame/rpg.o + +default: all + +all: client + +enet/Makefile: + cd enet; ./configure + +libenet: enet/Makefile + $(MAKE) -C enet/ all + +clean: + -$(RM) $(CLIENT_OBJS) + $(MAKE) -C enet/ clean + +client: $(CLIENT_OBJS) + $(CXX) $(CXXFLAGS) -o ../bin/sauerbraten.exe $(CLIENT_OBJS) $(CLIENT_LIBS) + strip ../bin/sauerbraten.exe diff --git a/src/mingw/lib/CVS/Entries b/src/mingw/lib/CVS/Entries new file mode 100644 index 0000000..8132f26 --- /dev/null +++ b/src/mingw/lib/CVS/Entries @@ -0,0 +1,7 @@ +/libSDL.dll.a/1.1/Wed Mar 8 03:29:50 2006/-kb/ +/libSDL_image.dll.a/1.1/Wed Mar 8 03:29:50 2006/-kb/ +/libSDL_mixer.dll.a/1.1/Wed Mar 8 03:29:50 2006/-kb/ +/libSDLmain.a/1.1/Wed Mar 8 03:29:50 2006/-kb/ +/libenet.a/1.15/Sat Dec 15 20:36:50 2007/-kb/ +/libz.a/1.1/Wed Mar 8 03:29:50 2006/-kb/ +D diff --git a/src/mingw/lib/CVS/Repository b/src/mingw/lib/CVS/Repository new file mode 100644 index 0000000..8493a77 --- /dev/null +++ b/src/mingw/lib/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/mingw/lib diff --git a/src/mingw/lib/CVS/Root b/src/mingw/lib/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/mingw/lib/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/mingw/lib/libSDL.dll.a b/src/mingw/lib/libSDL.dll.a new file mode 100644 index 0000000000000000000000000000000000000000..ba5102c92ef478d45f28be330aa46f8ed8f8ee41 GIT binary patch literal 116756 zcwX(DdypJQeaG8pVLOU20%S=DVT2II2w~ry?oJXI<9p~%XWdEX+tZzJz~|BJNLp!j zXEQr1-GO;Ij$;f26NKY9ig}s0afstMUK(>u`9zqhxiciXn^ zOcDRxwryYczySPo^IAeKcsn64e~^$JKP2Reo58NU9c2k0yPl0{q z7O<~92=?`-!Jb$L_RS%%Zv|lAJ_q)lN5TH~$6$ZA1MKgQg8jp7VE_0C*gyRQ?5WGa zelP|0^etdNd=%_QKLh*conZfR66{~^1N*lhfc@f1uxCzz{rhLZ{^Mz||J)4r-?L!< zdoS3pzMt6zU0cA`RKYGf4|d6uU~8WNd+rvn=UoT({8L~ryc_JY$G|rI9Bj*Wu&ond zmoI{C`y$x(pM$+(GuSI9z+QD8?A1?zz2>K2-P^%>XTkdJ1RHn^Z0|E*uj>YT{f%I6 zxE*ZpQLy1>!A5t19XJJc{oP;_Pl6rZ0CvMQV3oIk9r-HQ+%Lgyyawz|Rj`}x0lWFD zV8?y|=3feSVlP88z&`XduzPla-8&0*{tmGF9tZo#GhiRz0rrXO z!9Ep(eda!}&piqD`Tqj@!gj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J_L3FD+h zl-6NRE~1=dw@EsK6L3Z1gh?1D=5bn=?=(Lr<7B8^3#!@8wBcEMM=Hj5nq_wcV$=eR zn=(;bch4_flW~(>${X4>d)pV|^Gmra0xzP7v0@&#b(xh5IV58uIiFXj#Py4vl_=$63Wj7z)ui_3)xXAwsK=U?q#lsyyOzb hNr^bF!*`tta8j+NOW`eks?qqabMA@=3fE*({trTPuQC7t literal 0 HcwPel00001 diff --git a/src/mingw/lib/libSDL_image.dll.a b/src/mingw/lib/libSDL_image.dll.a new file mode 100644 index 0000000000000000000000000000000000000000..af279363517a3c271107e02a6d90bec480e9d3b8 GIT binary patch literal 17148 zcwX(BKWtk?9LInDlQ=aYO@kZU0L3jKs;bEGe>+uGni%EDkf5kk5FsREh(#>&Pi}-L z0|OHSLkA`%h7O$>m?MN38JHOu7*K@}0|Nt6xx3%pyL<1Q&le`^J^!Sid-uIx{qEg; za<+f(?#j(h|AW0->6M(HaC22RKVihmamNoSloWY_nu4;MaSRfxNXfH zUmF#$xVi3oPbOgTwQb*fG69Q@zn_lm=la&Rw~Yz3c!!J^8HkPk(ZO23-?^`b1>2~) zc|=C|&f99BD~SsEUz!l1y7lIUE{dz7e)s-yS9d|FyGl#Y$%Jd7gevNeb|f6%NDv4#Q9>1Ue>-pK9ezZH|E+HS zUhnA86XR>4TI=xRZvSL$|9G#XhN|*zfmo@LKUy)bceM&GbEGvV*1OGE0;oMCo@Av7 z$oFXqZF!mg3v zF760xakxZYwQFCRjbNc*J%Z(OB`|_N0v$WND(_8+Umh}mBlt+^4-6Q=Zy;c&x*2(> ziA#dl{B=53DVXLhDK--^R#JOBWQ){tNMcd7bt;2k@((QF>Ru5uc37I2bTvzZ0L;$9ZP#58?~@ zxSEKgbMqGj?DWaY^q&WwKd%L#D*=8Q(~+k>$y!p}#XQTBIv$>RW_RwHXLgSX@Xvfw zRan0#U@!~kxsq^|97u};y+~W$M(|sPjvV}ZE!D=9cuh;mB|!=KUKR#QwBI)klvKx* zcuh-5mQzB%p@)DH{Vxv#C6zHHUei+YET@G2Rto_o`rn`iO3GtOyr!jO-lfC|2PL{} zgn^RMm=dpPDY+;pY3_uA5^Y|}KuK{-iPyB0WH==>lNSO?^chM6CH6UqC{ywbr-bHo zLqLf>S3Q`L;_8?ZuW2cnH4~YGI(nK0_R3N-l6p=yRSBP@;c+WuU}9_gXEL z1C$gjD49}bD`%i&&XSVnEh$+VLP-|vDVb%I1RnE^EHMjQk;J&S&6L*x{?AiQ14n1b z&aT!299^^E2$cEE88}K?a+I;;=<*Pb=u;J2j?OcV#8coWBg@YPu1J0sL0TME0fs;0 zHqc_9rL7i%v@BcDlC-2{#*&t-B`sHn(2@arT4r2Y_=W%&-4!Rp6-mr>kQRqmKq1Dw z>%qW{ecm?8+&nG0!7U;X7H*9DU<};YXL74Wb+<&cxS4jjakmVOEI0F9k=*1#S{$07 za5H>olz|=l{BD%joTnr^tx&Bw=Dl(TZtOF@QRXHsxxtNv5EgEXyC)6Y*yn(w%*{EM z8@|;PLc)!CKkZ;{3iesyD04HVaN~rF8`BPJ12^`0;wW>IlHA~SbO;MK#y$52ZqAT7 zjxaZqE;syu0)&Jc^C=7iH};w0D04I6a>I|TKuEYTpUW|DGtL?NOv_Eu<;Dru?{M=; zEdw{>oUzZe+$3CX_^~z!2{-1mdj@XobHw725E69gTjlS z6eA;N$PE{Rdu*bzdm@I6c#pfn=<<@~isZ#T+Q}3L1TWTSdkqYoB~Kh=C@P;%z!*}` YL60s!7r7$&Sq5owSOc&=?X4&0KO6-_^8f$< literal 0 HcwPel00001 diff --git a/src/mingw/lib/libSDL_mixer.dll.a b/src/mingw/lib/libSDL_mixer.dll.a new file mode 100644 index 0000000000000000000000000000000000000000..7d3e4b7ee14ff6f08017845166b8440ef83c45ad GIT binary patch literal 42456 zcwX(D+izS)9mjv(TnTQPrmk~s>V`CgG$Pf zpKfdcfOi0%Xaj8h6~MMrXxqPmHuPJx;g8XF718#*f%feCXwQ9uw*M5`f%|9&e}{JH z6SNnLXfL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$)2X%s-QLhl=P*Arq_p0o^CigZL*xJ5e6L)PY4!brQ zM160O&U*Texf&^YYyC}PK7t1_zUJP-J@qJGUE>?_RuE5pj!4HEIsgIJ(q)rdH&S=w z4fkvj^}>#_C@A?!dsmZtD{GjK;O!^4Yh#mpOM5qKpfMZ|kuMjx<24>wrL=K(eZygv zwl?rys2l~R_Y_&Z3ya;Rze5i(js+Eb%sc8f@-XZ*Id!{z+4P42}=%_~jh$c5D45!QmOAPSYMztB>0!vvzrAe~x#Xb*e@|av%#>eMNF+k z{vAr-#>Nir-S{=vmVIcIsFB9ss<*WrXYP7y{dTQc@!Bm7ef}GeD0elE*_RVo@4uc> zsoe&CX+j&ffFD%u0{4X~!G2p1y8UBbyNbK&8xJwli|n2D581CpmDN(U3iQw^=_PBg z!A;dFYxu0cP-5J@ajFbF<}`EDJ$TA_<|3D73+7UYS}4?;T0St65^hDMD5u#lW{uDm z5|#CP+EhebcP*K^ZY=*FafN6|Y-d49>_uSyJi+EfhKL*{a$V}lFavg?_;wK$uy;(le7n%P69p2Jw&!CvZ*6 zM>dfs`l73NOh?FM>-iPlW{RLs8)&AM=0d3^xGO5>wM4dBB1uBhI`%X7u9kO`n5!3( z`*iz>5_~a6W_3uYQekCj^4h4H5}GAF#P$c9%^-J9Z5PWo)qIsUSzlmc5mK%+*3yEjEyOA5sPsvVBO-sM?MEBeD6(fsHvG}3VK16A?20|3 jko*1f4)mkYrG~$zN4sP)sCT#MVg61%8qJu*kH7yPd2`WZ literal 0 HcwPel00001 diff --git a/src/mingw/make.mingw.bat b/src/mingw/make.mingw.bat new file mode 100644 index 0000000..86d0c49 --- /dev/null +++ b/src/mingw/make.mingw.bat @@ -0,0 +1,3 @@ +cd src +mingw32-make all -fMakefile.mingw +PAUSE diff --git a/src/mingw/sauerbraten.cbp b/src/mingw/sauerbraten.cbp new file mode 100644 index 0000000..f511fde --- /dev/null +++ b/src/mingw/sauerbraten.cbp @@ -0,0 +1,825 @@ + + + + + + + diff --git a/src/mingw/sauerbraten.layout b/src/mingw/sauerbraten.layout new file mode 100644 index 0000000..a61d517 --- /dev/null +++ b/src/mingw/sauerbraten.layout @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/newgame/gclient.cpp b/src/newgame/gclient.cpp new file mode 100644 index 0000000..e223204 --- /dev/null +++ b/src/newgame/gclient.cpp @@ -0,0 +1,76 @@ +// Engine +#include "pch.h" +#include "cube.h" +#include "iengine.h" +#include "igame.h" + +// Game +struct game_entities; + +#include "gcommunicator.h" +#include "gserver.h" +#include "gclient.h" +#include "gentities.h" + +#ifndef STANDALONE // If we are building standalone... + +game_client::~game_client() {} + +const char *game_client::gameident() { return ""; } +const char *game_client::defaultmap() { return ""; } +const char *game_client::savedconfig() { return ""; } +const char *game_client::defaultconfig() { return ""; } +const char *game_client::autoexec() { return ""; } +const char *game_client::savedservers() { return NULL; } + +icliententities *game_client::getents() { return &gents; } // Segfault TODO: Fix it so it returns an entities class, for reference look at entities.h in fps/rpg game. +iclientcom *game_client::getcom() { return &gcom; } + +bool game_client::clientoption(char *arg) { return false; } +void game_client::updateworld(vec &pos, int curtime, int lm) { } +void game_client::initclient() { } +void game_client::physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material) { } +void game_client::edittrigger(const selinfo &sel, int op, int arg1, int arg2, int arg3) { } +char *game_client::getclientmap() { return ""; } +void game_client::resetgamestate() { } +void game_client::suicide(physent *d) { } +void game_client::newmap(int size) { } +void game_client::startmap(const char *name) { } +void game_client::preload() {} +float game_client::abovegameplayhud() { return 1.0f; } +void game_client::gameplayhud(int w, int h) { } +void game_client::drawhudgun() { } +bool game_client::canjump() { return true; } +bool game_client::allowmove(physent *d) { return true; } +void game_client::doattack(bool on) { } +dynent *game_client::iterdynents(int i) { return NULL; } +int game_client::numdynents() { return 0; } +void game_client::rendergame() {} +void game_client::writegamedata(vector &extras) {} +void game_client::readgamedata(vector &extras) {} +void game_client::g3d_gamemenus() { } +const char *game_client::defaultcrosshair(int index) { return NULL; } +int game_client::selectcrosshair(float &r, float &g, float &b) { return 0; } +void game_client::lighteffects(dynent *d, vec &color, vec &dir) {} +void game_client::setupcamera() {} +bool game_client::detachcamera() { return false; } +void game_client::adddynlights() {} +void game_client::particletrack(physent *owner, vec &o, vec &d) {} +bool game_client::serverinfostartcolumn(g3d_gui *g, int i) { return false; } +void game_client::serverinfoendcolumn(g3d_gui *g, int i) {} +bool game_client::serverinfoentry(g3d_gui *g, int i, const char *name, const char *desc, const char *map, int ping, const vector &attr, int np) { return false; }; + +// Register the game. +// Argument meanings: +// 1: Name of the game's new struct. +// 2: Name of the game. +// 3: A pointer to the game's client class. +// 4: A pointer to the game's server class. + +REGISTERGAME(modgame, "mod", new game_client(), new game_server()); + +#else + +REGISTERGAME(modgame, "mod", NULL, new game_server()); + +#endif diff --git a/src/newgame/gclient.h b/src/newgame/gclient.h new file mode 100644 index 0000000..101e978 --- /dev/null +++ b/src/newgame/gclient.h @@ -0,0 +1,60 @@ +#ifndef GCLIENT_H +#define GCLIENT_H + +#ifndef STANDALONE +struct game_client : public igameclient +{ +public: + ~game_client(); + + const char *gameident(); + const char *defaultmap(); + const char *savedconfig(); + const char *defaultconfig(); + const char *autoexec(); + const char *savedservers(); + + icliententities *getents(); // Segfault TODO: Fix it so it returns an entities class, for reference look at entities.h in fps/rpg game. + iclientcom *getcom(); + + bool clientoption(char *arg); + void updateworld(vec &pos, int curtime, int lm); + void initclient(); + void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material = 0); + void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0); + char *getclientmap(); + void resetgamestate(); + void suicide(physent *d); + void newmap(int size); + void startmap(const char *name); + void preload(); + float abovegameplayhud(); + void gameplayhud(int w, int h); + void drawhudgun(); + bool canjump(); + bool allowmove(physent *d); + void doattack(bool on); + dynent *iterdynents(int i); + int numdynents(); + void rendergame(); + void writegamedata(vector &extras); + void readgamedata(vector &extras); + void g3d_gamemenus(); + const char *defaultcrosshair(int index); + int selectcrosshair(float &r, float &g, float &b); + void lighteffects(dynent *d, vec &color, vec &dir); + void setupcamera(); + bool detachcamera(); + void adddynlights(); + void particletrack(physent *owner, vec &o, vec &d); + bool serverinfostartcolumn(g3d_gui *g, int i); + void serverinfoendcolumn(g3d_gui *g, int i); + bool serverinfoentry(g3d_gui *g, int i, const char *name, const char *desc, const char *map, int ping, const vector &attr, int np); + +private: + game_communicator gcom; + game_entities gents; +}; +#endif + +#endif diff --git a/src/newgame/gcommunicator.cpp b/src/newgame/gcommunicator.cpp new file mode 100644 index 0000000..6a3b8b7 --- /dev/null +++ b/src/newgame/gcommunicator.cpp @@ -0,0 +1,41 @@ +// Engine +#include "pch.h" +#include "cube.h" +#include "iengine.h" +#include "igame.h" + +// Game +#include "gcommunicator.h" + +game_communicator::~game_communicator() +{ +} + +void game_communicator::gamedisconnect() +{ +} +void game_communicator::parsepacketclient(int chan, ucharbuf &p) +{ +} +int game_communicator::sendpacketclient(ucharbuf &p, bool &reliable, dynent *d) +{ +return -1; +} +void game_communicator::gameconnect(bool _remote) +{ +} +bool game_communicator::allowedittoggle() +{ +return true; +} +void game_communicator::writeclientinfo(FILE *f) +{ +} +void game_communicator::toserver(char *text) +{ +} +void game_communicator::changemap(const char *name) +{ + load_world(name); +} + diff --git a/src/newgame/gcommunicator.h b/src/newgame/gcommunicator.h new file mode 100644 index 0000000..e78b132 --- /dev/null +++ b/src/newgame/gcommunicator.h @@ -0,0 +1,18 @@ +#ifndef GAMECOMMUNICATOR_H +#define GAMECOMMUNICATOR_H + +struct game_communicator : iclientcom +{ + ~game_communicator(); + + void gamedisconnect(); + void parsepacketclient(int chan, ucharbuf &p); + int sendpacketclient(ucharbuf &p, bool &reliable, dynent *d); + void gameconnect(bool _remote); + bool allowedittoggle(); + void writeclientinfo(FILE *f); + void toserver(char *text); + void changemap(const char *name); +}; + +#endif diff --git a/src/newgame/gentities.cpp b/src/newgame/gentities.cpp new file mode 100644 index 0000000..e397425 --- /dev/null +++ b/src/newgame/gentities.cpp @@ -0,0 +1,415 @@ +// Engine +#include "pch.h" +#include "cube.h" +#include "iengine.h" +#include "igame.h" + +// Game +extern struct game_client; + +#include "gcommunicator.h" +#include "gserver.h" +#include "gameclient.h" +#include "gentities.h" + +game_entities::game_entities(game_client &_cl) : cl(_cl) +{ +} + +vector &game_entities::getents() +{ + return ents; +} +const char *game_entities::itemname(int i) +{ + int t = ents[i]->type; + if(tI_QUAD) return NULL; + return itemstats[t-I_SHELLS].name; +} +const char *game_entities::entmdlname(int type) +{ + static const char *entmdlnames[] = + { + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "ammo/shells", "ammo/bullets", "ammo/rockets", "ammo/rrounds", "ammo/grenades", "ammo/cartridges", + "health", "boost", "armor/green", "armor/yellow", "quad", "teleporter", + NULL, NULL, + "carrot", + NULL, NULL, + "checkpoint", + NULL, NULL, + NULL, NULL, + NULL + }; + + return entmdlnames[type]; +} +void game_entities::preloadentities() +{ + loopi(MAXENTTYPES) + { + const char *mdl = entmdlname(i); + if(!mdl) continue; + loadmodel(mdl, -1, true); + } +} +void game_entities::renderent(extentity &e, const char *mdlname, float z, float yaw) +{ + if(!mdlname) return; + rendermodel(&e.light, mdlname, ANIM_MAPMODEL|ANIM_LOOP, vec(e.o).add(vec(0, 0, z)), yaw, 0, MDL_SHADOW | MDL_CULL_VFC | MDL_CULL_DIST | MDL_CULL_OCCLUDED); +} +void game_entities::renderent(extentity &e, int type, float z, float yaw) +{ + renderent(e, entmdlname(type), z, yaw); +} + +void game_entities::renderentities() +{ + loopv(ents) + { + extentity &e = *ents[i]; + + if(e.type==CARROT || e.type==RESPAWNPOINT) + { + renderent(e, e.type, (float)(1+sin(cl.lastmillis/100.0+e.o.x+e.o.y)/20), cl.lastmillis/(e.attr2 ? 1.0f : 10.0f)); + continue; + } + if(e.type==TELEPORT) + { + if(e.attr2 < 0) continue; + if(e.attr2 > 0) + { + renderent(e, mapmodelname(e.attr2), (float)(1+sin(cl.lastmillis/100.0+e.o.x+e.o.y)/20), cl.lastmillis/10.0f); + continue; + } + } + else + { + if(!e.spawned) continue; + if(e.typeI_QUAD) continue; + } + + renderent(e, e.type, (float)(1+sin(cl.lastmillis/100.0+e.o.x+e.o.y)/20), cl.lastmillis/10.0f); + } +} + +void game_entities::rumble(const extentity &e) +{ + playsound(S_RUMBLE, &e.o); +} + +void game_entities::trigger(extentity &e) +{ + switch(e.attr3) + { + case 29: + cl.ms.endsp(false); + break; + } +} + +void game_entities::addammo(int type, int &v, bool local = true) +{ + itemstat &is = itemstats[type-I_SHELLS]; + v += is.add; + + if(v>is.max) + v = is.max; + if(local) + cl.playsoundc(is.sound); +} + +void game_entities::repammo(fpsent *d, int type) +{ + addammo(type, d->ammo[type-I_SHELLS+GUN_SG]); +} + +// these two functions are called when the server acknowledges that you really +// picked up the item (in multiplayer someone may grab it before you). + +void game_entities::pickupeffects(int n, fpsent *d) +{ + if(!ents.inrange(n)) return; + + int type = ents[n]->type; + + if(typeI_QUAD) return; + ents[n]->spawned = false; + + if(!d) return; + itemstat &is = itemstats[type-I_SHELLS]; + + if(d!=cl.player1 || isthirdperson()) particle_text(d->abovehead(), is.name, 15); + + playsound(itemstats[type-I_SHELLS].sound, d!=cl.player1 ? &d->o : NULL); + d->pickup(type); + + if(d==cl.player1) switch(type) + { + case I_BOOST: + conoutf(CON_GAMEINFO, "\f2you have a permanent +10 health bonus! (%d)", d->maxhealth); + playsound(S_V_BOOST); + break; + case I_QUAD: + conoutf(CON_GAMEINFO, "\f2you got the quad!"); + playsound(S_V_QUAD); + break; + } +} + +// these functions are called when the client touches the item +void game_entities::teleport(int n, fpsent *d) // also used by monsters +{ + int e = -1, tag = ents[n]->attr1, beenhere = -1; + + for(;;) + { + e = findentity(TELEDEST, e+1); + + if(e==beenhere || e<0) + { + conoutf(CON_WARN, "no teleport destination for tag %d", tag); + return; + } + + if(beenhere<0) + beenhere = e; + + if(ents[e]->attr2==tag) + { + d->o = ents[e]->o; + d->yaw = ents[e]->attr1; + d->pitch = 0; + d->vel = vec(0, 0, 0);//vec(cosf(RAD*(d->yaw-90)), sinf(RAD*(d->yaw-90)), 0); + entinmap(d); + updatedynentcache(d); + cl.playsoundc(S_TELEPORT, d); + break; + } + } +} + +void game_entities::trypickup(int n, fpsent *d) +{ + switch(ents[n]->type) + { + default: + if(d->canpickup(ents[n]->type)) + { + cl.cc.addmsg(SV_ITEMPICKUP, "ri", n); + ents[n]->spawned = false; // even if someone else gets it first + } + break; + + case TELEPORT: + { + if(d->lastpickup==ents[n]->type && cl.lastmillis-d->lastpickupmillis<500) break; + + d->lastpickup = ents[n]->type; + d->lastpickupmillis = cl.lastmillis; + + teleport(n, d); + break; + } + + case RESPAWNPOINT: + if(d!=cl.player1) break; + if(n==cl.respawnent) break; + + cl.respawnent = n; + conoutf(CON_GAMEINFO, "\f2respawn point set!"); + + playsound(S_V_RESPAWNPOINT); + break; + + case JUMPPAD: + { + if(d->lastpickup==ents[n]->type && cl.lastmillis-d->lastpickupmillis<300) break; + d->lastpickup = ents[n]->type; + d->lastpickupmillis = cl.lastmillis; + vec v((int)(char)ents[n]->attr3*10.0f, (int)(char)ents[n]->attr2*10.0f, ents[n]->attr1*12.5f); + d->timeinair = 0; + d->falling = vec(0, 0, 0); + d->vel = v; +// d->vel.z = 0; +// d->vel.add(v); + cl.playsoundc(S_JUMPPAD, d); + break; + } + } +} + +void game_entities::checkitems(fpsent *d) +{ + if(d==cl.player1 && (editmode || cl.cc.spectator)) return; + + vec o = d->o; + o.z -= d->eyeheight; + + loopv(ents) + { + extentity &e = *ents[i]; + if(e.type==NOTUSED) continue; + if(!e.spawned && e.type!=TELEPORT && e.type!=JUMPPAD && e.type!=RESPAWNPOINT) continue; + + float dist = e.o.dist(o); + if(dist<(e.type==TELEPORT ? 16 : 12)) + trypickup(i, d); + } +} + +void game_entities::checkquad(int time, fpsent *d) +{ + if(d->quadmillis && (d->quadmillis -= time)<=0) + { + d->quadmillis = 0; + playsound(S_PUPOUT, d==cl.player1 ? NULL : &d->o); + if(d==cl.player1) + conoutf(CON_GAMEINFO, "\f2quad damage is over"); + } +} + +void game_entities::putitems(ucharbuf &p, int gamemode) // puts items in network stream and also spawns them locally +{ + putint(p, SV_ITEMLIST); + loopv(ents) if(ents[i]->type>=I_SHELLS && ents[i]->type<=I_QUAD && (!m_capture || ents[i]->typetype>I_CARTRIDGES)) + { + putint(p, i); + putint(p, ents[i]->type); + } + putint(p, -1); +} + +void game_entities::resetspawns() +{ + loopv(ents) + ents[i]->spawned = false; +} + +void game_entities::spawnitems(int gamemode) +{ + if(m_noitems) return; + loopv(ents) if(ents[i]->type>=I_SHELLS && ents[i]->type<=I_QUAD && (!m_capture || ents[i]->typetype>I_CARTRIDGES)) + { + ents[i]->spawned = (m_sp || (ents[i]->type!=I_QUAD && ents[i]->type!=I_BOOST)); + } +} + +void game_entities::setspawn(int i, bool on) +{ + if(ents.inrange(i)) + ents[i]->spawned = on; +} + +extentity *game_entities::newentity() +{ + return new fpsentity(); +} + +void game_entities::fixentity(extentity &e) +{ + switch(e.type) + { + case FLAG: + case BOX: + case BARREL: + case PLATFORM: + case ELEVATOR: + e.attr4 = e.attr3; + e.attr3 = e.attr2; + case MONSTER: + case TELEDEST: + e.attr2 = e.attr1; + case RESPAWNPOINT: + e.attr1 = (int)cl.player1->yaw; + } +} + +void game_entities::entradius(extentity &e, float &radius, float &angle, vec &dir) +{ + switch(e.type) + { + case TELEPORT: + loopv(ents) if(ents[i]->type == TELEDEST && e.attr1==ents[i]->attr2) + { + radius = e.o.dist(ents[i]->o); + dir = vec(ents[i]->o).sub(e.o).normalize(); + break; + } + break; + + case JUMPPAD: + radius = 4; + dir = vec((int)(char)e.attr3*10.0f, (int)(char)e.attr2*10.0f, e.attr1*12.5f).normalize(); + break; + + case FLAG: + case MONSTER: + case TELEDEST: + case MAPMODEL: + case RESPAWNPOINT: + case BOX: + case BARREL: + case PLATFORM: + case ELEVATOR: + radius = 4; + vecfromyawpitch(e.attr1, 0, 1, 0, dir); + break; + } +} + +const char *game_entities::entnameinfo(entity &e) +{ + return ""; +} +const char *game_entities::entname(int i) +{ + static const char *entnames[] = + { + "none?", "light", "mapmodel", "playerstart", "envmap", "particles", "sound", "spotlight", + "shells", "bullets", "rockets", "riflerounds", "grenades", "cartridges", + "health", "healthboost", "greenarmour", "yellowarmour", "quaddamage", + "teleport", "teledest", + "monster", "carrot", "jumppad", + "base", "respawnpoint", + "box", "barrel", + "platform", "elevator", + "flag", + "", "", "", "", + }; + + return i>=0 && size_t(i)= 7) e.type++; + } + if(ver <= 12) + { + if(e.type >= 8) e.type++; + } +} + +void game_entities::editent(int i) +{ + extentity &e = *ents[i]; + cl.cc.addmsg(SV_EDITENT, "ri9", i, (int)(e.o.x*DMF), (int)(e.o.y*DMF), (int)(e.o.z*DMF), e.type, e.attr1, e.attr2, e.attr3, e.attr4); +} +float game_entities::dropheight(entity &e) +{ + if(e.type==MAPMODEL || e.type==BASE || e.type==FLAG) return 0.0f; + return 4.0f; +} diff --git a/src/newgame/gentities.h b/src/newgame/gentities.h new file mode 100644 index 0000000..9e0de46 --- /dev/null +++ b/src/newgame/gentities.h @@ -0,0 +1,44 @@ +#ifndef GENTITIES_H +#define GENTITIES_H + +struct game_client; + +struct game_entities : icliententities +{ + entities(game_client &_cl); + vector &getents(); + const char *itemname(int i); + const char *entmdlname(int type); + void preloadentities(); + void renderent(extentity &e, const char *mdlname, float z, float yaw); + void renderent(extentity &e, int type, float z, float yaw); + void renderentities(); + void rumble(const extentity &e); + void trigger(extentity &e); + void addammo(int type, int &v, bool local = true); + void repammo(fpsent *d, int type); + void pickupeffects(int n, fpsent *d); + void teleport(int n, fpsent *d); + void trypickup(int n, fpsent *d); + void checkitems(fpsent *d); + void checkquad(int time, fpsent *d); + void putitems(ucharbuf &p, int gamemode); + void resetspawns(); + void spawnitems(int gamemode); + void setspawn(int i, bool on); + extentity *newentity(); + void fixentity(extentity &e); + void entradius(extentity &e, float &radius, float &angle, vec &dir); + const char *entnameinfo(entity &e); + const char *entname(int i); + int extraentinfosize(); + void writeent(entity &e, char *buf); + void readent(entity &e, char *buf); + void editent(int i); + float dropheight(entity &e); + + game_client &cl; + vector ents; +}; + +#endif diff --git a/src/newgame/gserver.cpp b/src/newgame/gserver.cpp new file mode 100644 index 0000000..80e480b --- /dev/null +++ b/src/newgame/gserver.cpp @@ -0,0 +1,32 @@ +// Engine +#include "pch.h" +#include "cube.h" +#include "iengine.h" +#include "igame.h" + +// Game +#include "gserver.h" + +game_server::~game_server() +{ +} + +void *game_server::newinfo() { return NULL; } +void game_server::deleteinfo(void *ci) {} +void game_server::serverinit() {} +void game_server::clientdisconnect(int n) {} +int game_server::clientconnect(int n, uint ip) { return DISC_NONE; } +void game_server::localdisconnect(int n) {} +void game_server::localconnect(int n) {} +const char *game_server::servername() { return "foo"; } +void game_server::parsepacket(int sender, int chan, bool reliable, ucharbuf &p) {} +bool game_server::sendpackets() { return false; } +int game_server::welcomepacket(ucharbuf &p, int n, ENetPacket *packet) { return -1; } +void game_server::serverinforeply(ucharbuf &q, ucharbuf &p) {} +void game_server::serverupdate(int lastmillis, int totalmillis) {} +bool game_server::servercompatible(char *name, char *sdec, char *map, int ping, const vector &attr, int np) { return false; } +void game_server::serverinfostr(char *buf, const char *name, const char *desc, const char *map, int ping, const vector &attr, int np) {} +int game_server::serverinfoport() { return 0; } +int game_server::serverport() { return 0; } +const char *game_server::getdefaultmaster() { return "localhost"; } +void game_server::sendservmsg(const char *s) {} diff --git a/src/newgame/gserver.h b/src/newgame/gserver.h new file mode 100644 index 0000000..5d3da44 --- /dev/null +++ b/src/newgame/gserver.h @@ -0,0 +1,29 @@ +#ifndef AGAMESERVER_H +#define AGAMESERVER_H + +struct game_server : igameserver +{ + ~game_server(); + + void *newinfo(); + void deleteinfo(void *ci); + void serverinit(); + void clientdisconnect(int n); + int clientconnect(int n, uint ip); + void localdisconnect(int n); + void localconnect(int n); + const char *servername(); + void parsepacket(int sender, int chan, bool reliable, ucharbuf &p); + bool sendpackets(); + int welcomepacket(ucharbuf &p, int n, ENetPacket *packet); + void serverinforeply(ucharbuf &q, ucharbuf &p); + void serverupdate(int lastmillis, int totalmillis); + bool servercompatible(char *name, char *sdec, char *map, int ping, const vector &attr, int np); + void serverinfostr(char *buf, const char *name, const char *desc, const char *map, int ping, const vector &attr, int np); + int serverinfoport(); + int serverport(); + const char *getdefaultmaster(); + void sendservmsg(const char *s); +}; + +#endif diff --git a/src/readme_source.txt b/src/readme_source.txt new file mode 100644 index 0000000..fd2e912 --- /dev/null +++ b/src/readme_source.txt @@ -0,0 +1,83 @@ +Sauerbraten source code license, usage, and documentation. + +You may use the sauerbraten source code if you abide by the ZLIB license +http://www.opensource.org/licenses/zlib-license.php +(very similar to the BSD license): + + +LICENSE +======= + +Sauerbraten game engine source code, any release. + +Copyright (C) 2001-2006 Wouter van Oortmerssen. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + + +LICENSE NOTES +============= +The license covers the source code found in the "src" directory of this +archive, the included enet network library which sauerbraten uses is covered by +an MIT-style license, which is however compatible with the above license for all +practical purposes. + +Game media included in the game (maps, textures, sounds, models etc.) +are NOT covered by this license, and may have individual copyrights and +distribution restrictions (see individual readmes). + + +USAGE +===== +Compiling the sources should be straight forward. + +Unix users need to make sure to have the development version of all libs +installed (OpenGL, SDL, SDL_Mixer, SDL_Image, zlib, libpng). The included +makefiles can be used to build. + +Windows users can use the included visual studio .net project files, which +references the lib/include directories for the external libraries and should +thus be self contained. Release mode builds will place executables in the bin dir +ready for testing and distribution. Do not come ask me for help in compiling +or modifying the sources, if you can't figure out how to do this yourself +you probably shouldn't be touching the files anyway. + +An alternative to visual studio for Windows is MinGW. In order to compile +using MinGW, copy Makefile.mingw from the mingw directory to the src directory. +You can also optionally copy make.mingw.bat to the sauerbraten directory for an +easy way to compile. + +The sauerbraten sources are very small, compact, and non redundant, so anyone +wishing to modify the source code should be able to gain an overview of +sauerbraten's inner workings by simply reading through the source code in its +entirety. Small amounts of comments should guide you through the more +tricky sections. + +When reading the source code and trying to understand sauerbaten's internal design, +keep in mind the goal of cube: minimalism. I wanted to create a very complete +game / game engine with absolutely minimal means, and made a sport out of it +keeping the implementation small and simple. Sauerbraten is not a commercial product, +it is merely the author's idea of a fun little programming project. + + +AUTHOR +====== +Wouter van Oortmerssen aka Aardappel +wvo at gmx dot net +http://strlen.com + +For additional authors/contributors, see the sauerbraten binary distribution readme. diff --git a/src/rpggame/CVS/Entries b/src/rpggame/CVS/Entries new file mode 100644 index 0000000..5041335 --- /dev/null +++ b/src/rpggame/CVS/Entries @@ -0,0 +1,9 @@ +/entities.h/1.15/Thu Oct 4 12:19:50 2007// +/rpg.cpp/1.69/Sat Jun 14 21:51:50 2008// +/rpg_plan.txt/1.5/Fri Dec 21 20:32:35 2007// +/rpgent.h/1.20/Sun Dec 30 01:17:53 2007// +/rpgobj.h/1.50/Fri Jan 18 21:45:52 2008// +/rpgobjset.h/1.37/Sun Dec 30 01:17:53 2007// +/stats.h/1.14/Thu Dec 20 15:27:11 2007// +/stubs.h/1.14/Thu May 29 14:09:02 2008// +D diff --git a/src/rpggame/CVS/Repository b/src/rpggame/CVS/Repository new file mode 100644 index 0000000..a2bb553 --- /dev/null +++ b/src/rpggame/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/rpggame diff --git a/src/rpggame/CVS/Root b/src/rpggame/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/rpggame/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/rpggame/entities.h b/src/rpggame/entities.h new file mode 100644 index 0000000..1b5c80a --- /dev/null +++ b/src/rpggame/entities.h @@ -0,0 +1,68 @@ + +enum { ETR_SPAWN = ET_GAMESPECIFIC, }; + +static const int SPAWNNAMELEN = 64; + +struct rpgentity : extentity +{ + char name[SPAWNNAMELEN]; + + rpgentity() { memset(name, 0, SPAWNNAMELEN); } +}; + +struct rpgentities : icliententities +{ + rpgclient &cl; + vector ents; + rpgentity *lastcreated; + + ~rpgentities() {} + rpgentities(rpgclient &_cl) : cl(_cl), lastcreated(NULL) + { + CCOMMAND(spawnname, "s", (rpgentities *self, char *s), { if(self->lastcreated) { s_strncpy(self->lastcreated->name, s, SPAWNNAMELEN); self->spawnfroment(*self->lastcreated); } }); + } + + vector &getents() { return (vector &)ents; } + + void editent(int i) {} + + const char *entnameinfo(entity &e) { return ((rpgentity &)e).name; } + const char *entname(int i) + { + static const char *entnames[] = { "none?", "light", "mapmodel", "playerstart", "envmap", "particles", "sound", "spotlight", "spawn" }; + return i>=0 && size_t(i)type==ETR_SPAWN) spawnfroment(*ents[i]); + } +}; diff --git a/src/rpggame/rpg.cpp b/src/rpggame/rpg.cpp new file mode 100644 index 0000000..8d7f5c7 --- /dev/null +++ b/src/rpggame/rpg.cpp @@ -0,0 +1,194 @@ + +#include "pch.h" +#include "cube.h" +#include "iengine.h" +#include "igame.h" +#include "stubs.h" + + +struct rpgclient : igameclient, g3d_callback +{ + struct rpgent; + + #include "entities.h" + #include "stats.h" + #include "rpgobj.h" + #include "rpgobjset.h" + #include "rpgent.h" + + rpgentities et; + rpgdummycom cc; + rpgobjset os; + + rpgent player1; + + int lastmillis, maptime; + string mapname; + + int menutime, menutab, menuwhich; + vec menupos; + + rpgclient() : et(*this), os(*this), player1(os.playerobj, *this, vec(0, 0, 0), 0, 100, ENT_PLAYER), lastmillis(0), maptime(0), menutime(0), menutab(1), menuwhich(0) + { + CCOMMAND(map, "s", (rpgclient *self, char *s), load_world(s)); + CCOMMAND(showplayergui, "i", (rpgclient *self, int *which), self->showplayergui(*which)); + } + ~rpgclient() {} + + icliententities *getents() { return &et; } + iclientcom *getcom() { return &cc; } + + void updateworld(vec &pos, int curtime, int lm) + { + if(!maptime) { maptime = lm + curtime; return; } + lastmillis = lm; + if(!curtime) return; + physicsframe(); + os.update(curtime); + player1.updateplayer(curtime, pos); + checktriggers(); + } + + void showplayergui(int which) + { + if((menutime && which==menuwhich) || !which) + { + menutime = 0; + } + else + { + menutime = starttime(); + menupos = menuinfrontofplayer(); + menuwhich = which; + } + } + + void gui(g3d_gui &g, bool firstpass) + { + g.start(menutime, 0.03f, &menutab); + switch(menuwhich) + { + default: + case 1: + g.tab("inventory", 0xFFFFF); + os.playerobj->invgui(g); + break; + + case 2: + g.tab("stats", 0xFFFFF); + os.playerobj->st_show(g); + break; + + case 3: + g.tab("active quests", 0xFFFFF); + os.listquests(false, g); + g.tab("completed quests", 0xFFFFF); + os.listquests(true, g); + } + g.end(); + } + + void initclient() {} + + void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material) + { + if (waterlevel>0) playsoundname("free/splash1", d==&player1 ? NULL : &d->o); + else if(waterlevel<0) playsoundname("free/splash2", d==&player1 ? NULL : &d->o); + if (floorlevel>0) { if(local) playsoundname("aard/jump"); else if(d->type==ENT_AI) playsoundname("aard/jump", &d->o); } + else if(floorlevel<0) { if(local) playsoundname("aard/land"); else if(d->type==ENT_AI) playsoundname("aard/land", &d->o); } + } + + void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0) {} + char *getclientmap() { return mapname; } + void resetgamestate() {} + void suicide(physent *d) {} + void newmap(int size) {} + + void startmap(const char *name) + { + os.clearworld(); + s_strcpy(mapname, name); + maptime = 0; + findplayerspawn(&player1); + if(*name) os.playerobj->st_init(); + et.startmap(); + } + + void quad(int x, int y, int xs, int ys) + { + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(x, y); + glTexCoord2f(1, 0); glVertex2i(x+xs, y); + glTexCoord2f(1, 1); glVertex2i(x+xs, y+ys); + glTexCoord2f(0, 1); glVertex2i(x, y+ys); + glEnd(); + } + + void gameplayhud(int w, int h) + { + glLoadIdentity(); + glOrtho(0, w*2, h*2, 0, -1, 1); + draw_textf("using: %s", 636*2, h*2-256+149, os.selected ? os.selected->name : "(none)"); // temp + + glLoadIdentity(); + glOrtho(0, w, h, 0, -1, 1); + settexture("packages/hud/hud_rpg.png", true); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + quad(0, h-128, 768, 128); + settexture("packages/hud/hbar.png", true); + glColor4f(1, 0, 0, 0.5f); + quad(130, h-128+57, 193*os.playerobj->s_hp/os.playerobj->eff_maxhp(), 17); + glColor4f(0, 0, 1, 0.5f); + quad(130, h-128+87, 193*os.playerobj->s_mana/os.playerobj->eff_maxmana(), 17); + } + + void drawhudmodel(int anim, float speed = 0, int base = 0) + { + rendermodel(NULL, "hudguns/fist", anim, player1.o, player1.yaw+90, player1.pitch, MDL_LIGHT, NULL, NULL, base, speed); + } + + void drawhudgun() + { + if(editmode) return; + + int rtime = 250; + if(lastmillis-player1.lastactionent : &player1; } + int numdynents() { return os.set.length()+1; } + + void rendergame() + { + if(isthirdperson()) renderclient(&player1, "monster/ogro", NULL, ANIM_PUNCH, 300, player1.lastaction, player1.lastpain); + os.render(); + } + + void g3d_gamemenus() { os.g3d_npcmenus(); if(menutime) g3d_addgui(this, menupos, GUI_2D); } + + void writegamedata(vector &extras) {} + void readgamedata (vector &extras) {} + + const char *gameident() { return "rpg"; } + const char *defaultmap() { return "rpg_01"; } + const char *savedconfig() { return "rpg_config.cfg"; } + const char *defaultconfig() { return "data/defaults.cfg"; } + const char *autoexec() { return "rpg_autoexec.cfg"; } +}; + +#define N(n) int rpgclient::stats::pointscale_##n, rpgclient::stats::percentscale_##n; +RPGSTATNAMES +#undef N + +REGISTERGAME(rpggame, "rpg", new rpgclient(), new rpgdummyserver()); + diff --git a/src/rpggame/rpg_plan.txt b/src/rpggame/rpg_plan.txt new file mode 100644 index 0000000..8abfb64 --- /dev/null +++ b/src/rpggame/rpg_plan.txt @@ -0,0 +1,39 @@ +implementation plan (roughly in order of importance to make the game playable): + +- wolves sometimes don't do damage when attacking? +- pain & attack sounds +- add icons for most items - show current item & quick bar on hud +- make mousewheel select between weapons in inventory +- implement npcs getting hostile if you pick up anything in the world within N range, or M sightrange + the more worth the item, the longer they will be hostile. if they knock you out, they'll take the item back. +- move more stuff from c++ to script +- hud weapons? +- make some game messages into centerprints? +- implement attackspeed/movespeed/jumpheight and other stats +- enemies can sometimes just run in circles around you +- game loading/saving +- work on animations (attack etc) +- make generic box that can take icons to replace generic bag +- add many more standard items, maybe some temp more monsters from the fps +- show body when dead +- tweak all stats +- improved grid layout inventory screens +- horse riding (maybe at first as teleport, later as fast transport) +- FIXME's in code +- utilize all hud items (radar etc) +- do world pickups differently (not with gui window), show worth stat while hovering over + maybe generally do system with different crosshairs depending on what you point at (take, attack) +- need a confirmation of wether you want to take on a quest or not? +- r_take should take a list of items + +art list: +- hud with health mana stat bars + * health and mana + * current weapon icon + * 12 slots for quick use items + * small radar + * info line for mouse over? +- icons: + * buy + * sell +- hud weapons: fist / sword (maybe axe and others) / bow or crossbow / shotgun? / spell casting hands diff --git a/src/rpggame/rpgent.h b/src/rpggame/rpgent.h new file mode 100644 index 0000000..7f24ba8 --- /dev/null +++ b/src/rpggame/rpgent.h @@ -0,0 +1,274 @@ +struct rpgent : dynent +{ + rpgobj *ro; + rpgclient &cl; + + int lastaction, lastpain; + bool attacking; + + bool magicprojectile; + vec mppos, mpdir; + rpgobj *mpweapon; + float mpdist; + + rpgent *enemy; + + enum { R_STARE, R_ROAM, R_SEEK, R_ATTACK, R_BLOCKED, R_BACKHOME }; + int npcstate; + + int trigger; + + float sink; + + vec home; + + enum { ROTSPEED = 200 }; + + rpgent(rpgobj *_ro, rpgclient &_cl, const vec &_pos, float _yaw, int _maxspeed = 40, int _type = ENT_AI) : ro(_ro), cl(_cl), lastaction(0), lastpain(0), attacking(false), magicprojectile(false), enemy(NULL), npcstate(R_STARE), trigger(0), sink(0) + { + o = _pos; + home = _pos; + yaw = _yaw; + maxspeed = _maxspeed; + type = _type; + enemy = &cl.player1; + } + + float vecyaw(vec &t) { return -(float)atan2(t.x-o.x, t.y-o.y)/RAD+180; } + + static const int ATTACKSAMPLES = 32; + + void tryattackobj(rpgobj &eo, rpgobj &weapon) + { + if(!eo.s_ai || (eo.s_ai==ro->s_ai && eo.ent!=enemy)) return; + + rpgent &e = *eo.ent; + if(e.state!=CS_ALIVE) return; + + vec d = e.o; + d.sub(o); + d.z = 0; + if(d.magnitude()>e.radius+weapon.s_maxrange) return; + + if(o.z+aboveeye<=e.o.z-e.eyeheight || o.z-eyeheight>=e.o.z+e.aboveeye) return; + + vec p(0, 0, 0), closep; + float closedist = 1e10f; + loopj(ATTACKSAMPLES) + { + p.x = e.xradius * cosf(2*M_PI*j/ATTACKSAMPLES); + p.y = e.yradius * sinf(2*M_PI*j/ATTACKSAMPLES); + p.rotate_around_z((e.yaw+90)*RAD); + + p.x += e.o.x; + p.y += e.o.y; + float tyaw = vecyaw(p); + normalize_yaw(tyaw); + if(fabs(tyaw-yaw)>weapon.s_maxangle) continue; + + float dx = p.x-o.x, dy = p.y-o.y, dist = dx*dx + dy*dy; + if(distweapon.s_maxrange*weapon.s_maxrange) return; + + weapon.useaction(eo, *this, true); + } + + #define loopallrpgobjsexcept(ro) loop(i, cl.os.set.length()+1) for(rpgobj *eo = i ? cl.os.set[i-1] : cl.os.playerobj; eo; eo = NULL) if((ro)!=eo) + + void tryattack(vec &lookatpos, rpgobj &weapon) + { + if(cl.lastmillis-lastactionent->state!=CS_ALIVE) continue; + if(!intersect(eo->ent, o, lookatpos)) continue; + float dist = o.dist(eo->ent->o); + if(distusemana(weapon)) return; + + magicprojectile = true; + mpweapon = &weapon; + mppos = o; + //mpdir = vec(yaw*RAD, pitch*RAD); + float worlddist = lookatpos.dist(o, mpdir); + mpdir.normalize(); + mpdist = min(float(weapon.s_maxrange), worlddist); + } + else + { + weapon.useaction(*ro, *this, true); // cast on self + } + break; + } + + } + + void updateprojectile(int curtime) + { + if(!magicprojectile) return; + + regular_particle_splash(1, 2, 300, mppos); + particle_splash(mpweapon->s_effect, 1, 1, mppos); + + float dist = curtime/5.0f; + if((mpdist -= dist)<0) { magicprojectile = false; return; }; + + vec mpto = vec(mpdir).mul(dist).add(mppos); + + loopallrpgobjsexcept(ro) // FIXME: make fast "give me all rpgobs in range R that are not X" function + { + if(eo->ent->o.dist(mppos)<32 && intersect(eo->ent, mppos, mpto)) // quick reject, for now + { + magicprojectile = false; + mpweapon->useaction(*eo, *this, false); // cast on target + } + } + + mppos = mpto; + } + + void transition(int _state, int _moving, int n) + { + npcstate = _state; + move = _moving; + trigger = cl.lastmillis+n; + } + + void gotoyaw(float yaw, int s, int m, int t) + { + targetyaw = yaw; + rotspeed = ROTSPEED; + transition(s, m, t); + } + + void gotopos(vec &pos, int s, int m, int t) { gotoyaw(vecyaw(pos), s, m, t); } + + void goroam() + { + if(home.dist(o)>128 && npcstate!=R_BACKHOME) gotopos(home, R_ROAM, 1, 1000); + else gotoyaw(targetyaw+90+rnd(180), R_ROAM, 1, 1000); + } + + void stareorroam() + { + if(rnd(10)) transition(R_STARE, 0, 500); + else goroam(); + } + + void update(int curtime, float playerdist) + { + updateprojectile(curtime); + + if(state==CS_DEAD) { stopmoving(); return; }; + + if(blocked && npcstate!=R_BLOCKED && npcstate!=R_SEEK) + { + blocked = false; + gotoyaw(targetyaw+90+rnd(180), R_BLOCKED, 1, 1000); + } + + if(ro->s_hpeff_maxhp() && npcstate!=R_SEEK) gotopos(enemy->o, R_SEEK, 1, 200); + + #define ifnextstate if(triggers_ai==2) { gotopos(cl.player1.o, R_SEEK, 1, 200); enemy = &cl.player1; } + else { gotopos(cl.player1.o, R_STARE, 0, 500); } + } + else ifnextstate stareorroam(); + break; + + case R_ROAM: + ifplayerclose transition(R_STARE, 0, 500); + else ifnextstate stareorroam(); + break; + + case R_SEEK: + ifnextstate + { + vec target; + if(raycubelos(o, enemy->o, target)) + { + rpgobj &weapon = ro->selectedweapon(); + if(target.dist(o)o.dist(o)>256) goroam(); + else gotopos(enemy->o, R_SEEK, 1, 100); + } + } + + #undef ifnextstate + #undef ifplayerclose + } + + void updateplayer(int curtime, vec &lookatpos) // alternative version of update() if this ent is the main player + { + updateprojectile(curtime); + + if(state==CS_DEAD) + { + //lastaction = lastmillis; + if(cl.lastmillis-lastaction>5000) + { + conoutf("\f2you were found unconscious, and have been carried back home"); + + findplayerspawn(this); + state = CS_ALIVE; + ro->st_respawn(); + attacking = false; + particle_splash(2, 1000, 500, o); + } + } + else + { + moveplayer(this, 20, true); + ro->st_update(cl.lastmillis); + if(attacking) tryattack(lookatpos, ro->selectedweapon()); + } + } +}; diff --git a/src/rpggame/rpgobj.h b/src/rpggame/rpgobj.h new file mode 100644 index 0000000..ff9b1b8 --- /dev/null +++ b/src/rpggame/rpgobj.h @@ -0,0 +1,394 @@ +struct rpgobjset; + +struct rpgquest +{ + rpgquest *next; + const char *npc; + const char *questline; + bool completed; + + rpgquest(rpgquest *_n, const char *_npc, const char *_ql) : next(_n), npc(_npc), questline(_ql), completed(false) {} +}; + +struct rpgaction +{ + rpgaction *next; + char *initiate, *script; + rpgquest *q; + bool used; + + rpgaction(char *_i = NULL, char *_s = NULL, rpgaction *_n = NULL) : next(_n), initiate(_i), script(_s), q(NULL), used(false) {} + + ~rpgaction() { DELETEP(next); } + + void exec(rpgobj *obj, rpgobj *target, rpgobj *user, rpgobjset &os) + { + if(!*script) return; + os.pushobj(user); + os.pushobj(target); + os.pushobj(obj); + execute(script); + used = true; + } +}; + +struct rpgobj : g3d_callback, stats +{ + rpgobj *parent; // container object, if not top level + rpgobj *inventory; // contained objects, if any + rpgobj *sibling; // used for linking, if contained + + rpgent *ent; // representation in the world, if top level + + const char *name; // name it was spawned as + const char *model; // what to display it as + + enum + { + IF_INVENTORY = 1, // parent owns this object, will contribute to parent stats + IF_LOOT = 2, // if parent dies, this object should drop to the ground + IF_TRADE = 4, // parent has this item available for trade, for player, all currently unused weapons etc are of this type + }; + + enum + { + MENU_DEFAULT, + MENU_BUY, + MENU_SELL + }; + + int itemflags; + + rpgaction *actions, action_use; + char *abovetext; + + int menutime, menutab, menuwhich; + + rpgobjset &os; + + #define loopinventory() for(rpgobj *o = inventory; o; o = o->sibling) + #define loopinventorytype(T) loopinventory() if(o->itemflags&(T)) + + rpgobj(const char *_name, rpgobjset &_os) : parent(NULL), inventory(NULL), sibling(NULL), ent(NULL), name(_name), model(NULL), itemflags(IF_INVENTORY), + actions(NULL), abovetext(NULL), menutime(0), menutab(1), menuwhich(MENU_DEFAULT), os(_os) {} + + ~rpgobj() + { + DELETEP(inventory); + DELETEP(sibling); + DELETEP(ent); + DELETEP(actions); + } + + void scriptinit() + { + DELETEP(inventory); + s_sprintfd(aliasname)("spawn_%s", name); + execute(aliasname); + } + + void decontain() + { + if(parent) parent->remove(this); + } + + void add(rpgobj *o, int itemflags) + { + o->sibling = inventory; + o->parent = this; + inventory = o; + o->itemflags = itemflags; + + if(itemflags&IF_INVENTORY) recalcstats(); + } + + void remove(rpgobj *o) + { + for(rpgobj **l = &inventory; *l; ) + if(*l==o) + { + *l = o->sibling; + o->sibling = o->parent = NULL; + } + else l = &(*l)->sibling; + + if(o->itemflags&IF_INVENTORY) recalcstats(); + } + + void recalcstats() + { + st_reset(); + loopinventorytype(IF_INVENTORY) st_accumulate(*o); + } + + rpgobj &selectedweapon() + { + if(this==os.playerobj) return os.selected ? *os.selected : *this; + else { loopinventorytype(IF_INVENTORY) if(o->s_usetype) return *o; }; + return *this; + } + + void placeinworld(rpgent *_ent) + { + if(!model) model = "tentus/moneybag"; + ent = _ent; + setbbfrommodel(ent, model); + entinmap(ent); + //ASSERT(!(ent->o.x<0 || ent->o.y<0 || ent->o.z<0 || ent->o.x>4096 || ent->o.y>4096 || ent->o.z>4096)); + st_init(); + } + + void render() + { + if(s_ai) + { + float sink = 0; + if(ent->physstate>=PHYS_SLIDE) + sink = raycube(ent->o, vec(0, 0, -1), 2*ent->eyeheight)-ent->eyeheight; + ent->sink = ent->sink*0.8 + sink*0.2; + //if(ent->blocked) particle_splash(0, 100, 100, ent->o); + renderclient(ent, model, NULL, ANIM_PUNCH, 300, ent->lastaction, 0, ent->sink); + if(s_hpstate==CS_ALIVE) particle_meter(ent->abovehead(), s_hp/(float)eff_maxhp(), 17); + + } + else + { + rendermodel(NULL, model, ANIM_MAPMODEL|ANIM_LOOP, vec(ent->o).sub(vec(0, 0, ent->eyeheight)), ent->yaw+90, 0, MDL_CULL_VFC | MDL_CULL_DIST | MDL_CULL_OCCLUDED | MDL_LIGHT, ent); + } + } + + void update(int curtime) + { + float dist = ent->o.dist(os.cl.player1.o); + if(s_ai) { ent->update(curtime, dist); st_update(ent->cl.lastmillis); }; + moveplayer(ent, 10, false, curtime); // 10 or above gets blocked less, because physics accuracy doesn't need extra tests + //ASSERT(!(ent->o.x<0 || ent->o.y<0 || ent->o.z<0 || ent->o.x>4096 || ent->o.y>4096 || ent->o.z>4096)); + if(!menutime && dist<(s_ai ? 40 : 24) && ent->state==CS_ALIVE && s_ai<2) { menutime = starttime(); menuwhich = MENU_DEFAULT; } + else if(dist>(s_ai ? 96 : 48)) menutime = 0; + } + + void addaction(char *initiate, char *script, bool startquest) + { + for(rpgaction *a = actions; a; a = a->next) if(strcmp(a->initiate, initiate)==0) return; + actions = new rpgaction(initiate, script, actions); + if(startquest) os.addquest(actions, abovetext, name); + } + + void droploot() + { + loopinventorytype(IF_LOOT) + { + o->decontain(); + os.pushobj(o); + os.placeinworld(ent->o, rnd(360)); + droploot(); + return; + } + } + + rpgobj *take(char *name) + { + loopinventory() if(strcmp(o->name, name)==0) + { + o->decontain(); + return o; + } + return NULL; + } + + void takedamage(int damage, rpgobj &attacker) + { + ent->enemy = attacker.ent; + + particle_splash(3, damage*5, 1000, ent->o); + s_sprintfd(ds)("@%d", damage); + particle_text(ent->o, ds, 8); + + if((s_hp -= damage)<=0) + { + s_hp = 0; + ent->state = CS_DEAD; + ent->attacking = false; + ent->lastaction = os.cl.lastmillis; + menutime = 0; + conoutf("%s killed: %s", attacker.name, name); + droploot(); + } + } + + void usesound(rpgent *user) + { + if(s_usesound) playsound(s_usesound, &user->o); + } + + bool usemana(rpgobj &o) + { + if(o.s_manacost>s_mana) { if(this==os.playerobj) conoutf("\f2not enough mana"); return false; }; + s_mana -= o.s_manacost; + o.usesound(ent); + return true; + } + + void useaction(rpgobj &target, rpgent &initiator, bool chargemana) + { + if(action_use.script && (!chargemana || initiator.ro->usemana(*this))) + { + action_use.exec(this, &target, initiator.ro, os); + if(s_useamount && !--s_useamount) os.removefromsystem(this); + } + } + + void selectuse() + { + if(s_usetype) + { + conoutf("\f2using: %s", name); + os.selected = this; + } + else + { + useaction(*os.playerobj, *os.playerobj->ent, true); + } + } + + void guiaction(g3d_gui &g, rpgaction *a) + { + if(!a) return; + guiaction(g, a->next); + if(g.button(a->initiate, a->used ? 0xAAAAAA : 0xFFFFFF, "chat")&G3D_UP) + { + os.currentquest = a->q; + a->exec(this, os.playerobj, os.playerobj, os); + os.currentquest = NULL; + } + } + + void gui(g3d_gui &g, bool firstpass) + { + g.start(menutime, 0.015f, &menutab); + switch(menuwhich) + { + case MENU_DEFAULT: + { + g.tab(name, 0xFFFFFF); + if(abovetext) g.text(abovetext, 0xDDFFDD); + + guiaction(g, actions); + + if(s_ai) + { + bool trader = false; + loopinventorytype(IF_TRADE) trader = true; + if(trader) + { + if(g.button("buy", 0xFFFFFF, "coins")&G3D_UP) menuwhich = MENU_BUY; + if(g.button("sell", 0xFFFFFF, "coins")&G3D_UP) menuwhich = MENU_SELL; + } + } + else + { + s_sprintfd(wtext)("worth %d", s_worth); + g.text(wtext, 0xAAAAAA, "coins"); + if(g.button("take", 0xFFFFFF, "hand")&G3D_UP) + { + conoutf("\f2you take a %s (worth %d gold)", name, s_worth); + os.take(this, os.playerobj); + } + if(!s_usetype && g.button("use", 0xFFFFFF, "hand")&G3D_UP) + { + selectuse(); + } + } + break; + } + + case MENU_BUY: + { + s_sprintfd(info)("buying from: %s", name); + g.tab(info, 0xFFFFFF); + loopinventorytype(IF_TRADE) + { + int price = o->s_worth; + s_sprintfd(info)("%s (%d)", o->name, price); + int ret = g.button(info, 0xFFFFFF, "coins"); + if(ret&G3D_UP) + { + if(os.playerobj->s_gold>=price) + { + conoutf("\f2you bought %s for %d gold", o->name, price); + os.playerobj->s_gold -= price; + s_gold += price; + o->decontain(); + os.playerobj->add(o, IF_INVENTORY); + } + else + { + conoutf("\f2you cannot afford this item!"); + } + } + } + s_sprintf(info)("you have %d gold", os.playerobj->s_gold); + g.text(info, 0xAAAAAA, "info"); + if(g.button("done buying", 0xFFFFFF, "coins")&G3D_UP) menuwhich = MENU_DEFAULT; + break; + } + + case MENU_SELL: + { + s_sprintfd(info)("selling to: %s", name); + g.tab(info, 0xFFFFFF); + os.playerobj->invgui(g, this); + if(g.button("done selling", 0xFFFFFF, "coins")&G3D_UP) menuwhich = MENU_DEFAULT; + break; + } + } + g.end(); + } + + void invgui(g3d_gui &g, rpgobj *buyer = NULL) + { + loopinventory() + { + int price = o->s_worth/2; + s_sprintfd(info)("%s (%d)", o->name, price); + int ret = g.button(info, 0xFFFFFF, "coins"); + if(ret&G3D_UP) + { + if(buyer) + { + if(price>buyer->s_gold) + { + conoutf("\f2%s cannot afford to buy %s from you!", buyer->name, o->name); + } + else + { + if(price) + { + conoutf("\f2you sold %s for %d gold", o->name, price); + s_gold += price; + buyer->s_gold -= price; + o->decontain(); + buyer->add(o, IF_TRADE); + } + else + { + conoutf("\f2you cannot sell %s", o->name); + } + } + } + else // player wants to use this item + { + o->selectuse(); + } + } + } + s_sprintfd(info)("you have %d gold", os.playerobj->s_gold); + g.text(info, 0xAAAAAA, "info"); + } + + void g3d_menu() + { + if(!menutime) return; + g3d_addgui(this, vec(ent->o).add(vec(0, 0, 2))); + } +}; diff --git a/src/rpggame/rpgobjset.h b/src/rpggame/rpgobjset.h new file mode 100644 index 0000000..63e4975 --- /dev/null +++ b/src/rpggame/rpgobjset.h @@ -0,0 +1,169 @@ +struct rpgobjset +{ + rpgclient &cl; + + vector set, stack; + hashtable names; + + rpgobj *pointingat; + rpgobj *playerobj; + rpgobj *selected; + + rpgquest *quests; + rpgquest *currentquest; + + rpgobjset(rpgclient &_cl) : cl(_cl), pointingat(NULL), playerobj(NULL), selected(NULL), quests(NULL), currentquest(NULL) + { + #define N(n) CCOMMAND(r_##n, "i", (rpgobjset *self, int *val), { self->stack[0]->s_##n = *val; }); \ + CCOMMAND(r_get_##n, "", (rpgobjset *self), { intret(self->stack[0]->s_##n); }); + + RPGNAMES + #undef N + #define N(n) CCOMMAND(r_def_##n, "ii", (rpgobjset *self, int *i1, int *i2), { stats::def_##n(*i1, *i2); }); \ + CCOMMAND(r_eff_##n, "", (rpgobjset *self), { intret(self->stack[0]->eff_##n()); }); + RPGSTATNAMES + #undef N + + CCOMMAND(r_model, "s", (rpgobjset *self, char *s), { self->stack[0]->model = self->stringpool(s); }); + CCOMMAND(r_spawn, "s", (rpgobjset *self, char *s), { self->spawn(self->stringpool(s)); }); + CCOMMAND(r_contain, "s", (rpgobjset *self, char *s), { self->stack[0]->decontain(); self->stack[1]->add(self->stack[0], atoi(s)); }); + CCOMMAND(r_pop, "", (rpgobjset *self), { self->popobj(); }); + CCOMMAND(r_swap, "", (rpgobjset *self), { swap(self->stack[0], self->stack[1]); }); + CCOMMAND(r_say, "s", (rpgobjset *self, char *s), { self->stack[0]->abovetext = self->stringpool(s); }); + CCOMMAND(r_quest, "ss", (rpgobjset *self, char *s, char *a), { self->stack[0]->addaction(self->stringpool(s), self->stringpool(a), true); }); + CCOMMAND(r_action, "ss", (rpgobjset *self, char *s, char *a), { self->stack[0]->addaction(self->stringpool(s), self->stringpool(a), false); }); + CCOMMAND(r_action_use, "s", (rpgobjset *self, char *s), { self->stack[0]->action_use.script = self->stringpool(s); }); + CCOMMAND(r_take, "sss", (rpgobjset *self, char *name, char *ok, char *notok), { self->takefromplayer(name, ok, notok); }); + CCOMMAND(r_give, "s", (rpgobjset *self, char *s), { self->givetoplayer(s); }); + CCOMMAND(r_use, "", (rpgobjset *self), { self->stack[0]->selectuse(); }); + CCOMMAND(r_applydamage, "i", (rpgobjset *self, int *d), { self->stack[0]->takedamage(*d, *self->stack[1]); }); + clearworld(); + } + + void resetstack() + { + stack.setsize(0); + loopi(10) stack.add(playerobj); // determines the stack depth + } + + void clearworld() + { + if(playerobj) { playerobj->ent = NULL; delete playerobj; } + playerobj = new rpgobj("player", *this); + playerobj->ent = &cl.player1; + cl.player1.ro = playerobj; + + pointingat = NULL; + set.deletecontentsp(); + resetstack(); + + playerobj->scriptinit(); // will fail when this is called from emptymap(), which is ok + } + + void removefromsystem(rpgobj *o) + { + removefromworld(o); + o->decontain(); + if(pointingat==o) pointingat = NULL; + if(selected==o) selected = NULL; + resetstack(); + DELETEP(o); + } + + void update(int curtime) + { + extern vec worldpos; + pointingat = NULL; + loopv(set) + { + set[i]->update(curtime); + + float dist = cl.player1.o.dist(set[i]->ent->o); + if(dist<50 && intersect(set[i]->ent, cl.player1.o, worldpos) && (!pointingat || cl.player1.o.dist(pointingat->ent->o)>dist)) + { + pointingat = set[i]; + } + } + } + + void spawn(char *name) + { + rpgobj *o = new rpgobj(name, *this); + pushobj(o); + o->scriptinit(); + } + + void placeinworld(vec &pos, float yaw) + { + stack[0]->placeinworld(new rpgent(stack[0], cl, pos, yaw)); + set.add(stack[0]); + } + + void pushobj(rpgobj *o) { stack.pop(); stack.insert(0, o); } // never overflows, just removes bottom + void popobj() { stack.add(stack.remove(0)); } // never underflows, just puts it at the bottom + + void removefromworld(rpgobj *worldobj) + { + set.removeobj(worldobj); + DELETEP(worldobj->ent); + } + + void take(rpgobj *worldobj, rpgobj *newowner) + { + removefromworld(worldobj); + newowner->add(worldobj, false); + } + + void takefromplayer(char *name, char *ok, char *notok) + { + rpgobj *o = playerobj->take(name); + if(o) + { + stack[0]->add(o, false); + conoutf("\f2you hand over a %s", o->name); + if(currentquest) + { + conoutf("\f2you finish a quest for %s", currentquest->npc); + currentquest->completed = true; + } + } + execute(o ? ok : notok); + } + + void givetoplayer(char *name) + { + rpgobj *o = stack[0]->take(name); + if(o) + { + conoutf("\f2you receive a %s", o->name); + playerobj->add(o, false); + } + } + + void addquest(rpgaction *a, const char *questline, const char *npc) + { + a->q = quests = new rpgquest(quests, npc, questline); + conoutf("\f2you have accepted a quest for %s", npc); + } + + void listquests(bool completed, g3d_gui &g) + { + for(rpgquest *q = quests; q; q = q->next) if(q->completed==completed) + { + s_sprintfd(info)("%s: %s", q->npc, q->questline); + g.text(info, 0xAAAAAA, "info"); + } + } + + char *stringpool(char *name) + { + char **n = names.access(name); + if(n) return *n; + name = newstring(name); + names[name] = name; + return name; + } + + void render() { loopv(set) set[i]->render(); } + void g3d_npcmenus() { loopv(set) set[i]->g3d_menu(); } +}; diff --git a/src/rpggame/stats.h b/src/rpggame/stats.h new file mode 100644 index 0000000..53646df --- /dev/null +++ b/src/rpggame/stats.h @@ -0,0 +1,131 @@ + +// all of these stats are the total "points" an object has +// points are converted into efficiency = log(points/pointscale+1)*percentscale+100 +// efficiency is by default 100% and rises logarithmically from that, according to the two scale vars, which are set in script +// efficiency is used with a base value, i.e. a sword that does 10 damage used by a player with 150% melee efficiency does 15 damage + +// with this define, we can uses these names to define vars, strings, functions etc + +// see rpg.html for detailed explanation as to their meaning + +#define RPGSTATNAMES \ + N(melee) \ + N(ranged) \ + N(magic) \ + \ + N(hpregen) \ + N(manaregen) \ + \ + N(maxhp) \ + N(maxmana) \ + \ + N(attackspeed) \ + N(movespeed) \ + N(jumpheight) \ + N(tradeskill) \ + N(feared) \ + N(stealth) \ + N(hostility) \ + \ + N(stata) \ + N(statb) \ + N(statc) \ + + +#define RPGATTRNAMES \ + N(ai) \ + N(hp) \ + N(mana) \ + N(gold) \ + N(worth) \ + N(useamount) \ + N(usetype) \ + N(damage) \ + N(maxrange) \ + N(maxangle) \ + N(attackrate) \ + N(manacost) \ + N(effect) \ + \ + N(attra) \ + N(attrb) \ + N(attrc) \ + \ + N(usesound) + + +#define RPGNAMES RPGSTATNAMES RPGATTRNAMES + +struct rpgobj; + +struct stats +{ + #define N(n) static int pointscale_##n, percentscale_##n; \ + static void def_##n(int a, int b) { pointscale_##n = a; percentscale_##n = b; } \ + int eff_##n() { return int(logf(s_##n/pointscale_##n+1)*percentscale_##n)+100; } + RPGSTATNAMES + #undef N + #define N(n) int s_##n; + RPGNAMES + #undef N + + int statupdatetime; + + stats() : statupdatetime(0) + { + st_reset(); + #define N(n) s_##n = 0; + RPGATTRNAMES + #undef N + } + + void st_reset() + { + #define N(n) s_##n = 0; + RPGSTATNAMES + #undef N + } + + void st_accumulate(rpgobj &o) + { + #define N(n) s_##n += o.s_##n; + RPGSTATNAMES + #undef N + } + + void st_show(g3d_gui &g) + { + #define N(n) if(s_##n) { s_sprintfd(s)(#n ": %d => %d%%", s_##n, eff_##n()); g.text(s, 0xFFFFFF, "info"); } + RPGSTATNAMES + #undef N + #define N(n) if(s_##n) { s_sprintfd(s)(#n ": %d", s_##n); g.text(s, 0xFFAAAA, "info"); } + RPGATTRNAMES + #undef N + } + + void st_init() + { + s_hp = eff_maxhp(); + s_mana = eff_maxmana(); + } + + void st_respawn() // player only + { + s_hp = 10; + } + + void st_update(int lastmillis) + { + if(lastmillis-statupdatetime>1000) + { + statupdatetime += 1000; + const int base_hp_regen_rate = 2, base_mana_regen_rate = 3; // in script? + s_hp += eff_hpregen() *base_hp_regen_rate /100; + s_mana += eff_manaregen()*base_mana_regen_rate/100; + if(s_hp >eff_maxhp()) s_hp = eff_maxhp(); + if(s_mana>eff_maxmana()) s_mana = eff_maxmana(); + } + } +}; + + diff --git a/src/rpggame/stubs.h b/src/rpggame/stubs.h new file mode 100644 index 0000000..a926896 --- /dev/null +++ b/src/rpggame/stubs.h @@ -0,0 +1,38 @@ +struct rpgdummycom : iclientcom +{ + ~rpgdummycom() {} + + void gamedisconnect() {} + void parsepacketclient(int chan, ucharbuf &p) {} + int sendpacketclient(ucharbuf &p, bool &reliable, dynent *d) { return -1; } + void gameconnect(bool _remote) {} + bool allowedittoggle() { return true; } + void writeclientinfo(FILE *f) {} + void toserver(char *text) {} + void changemap(const char *name) { load_world(name); } +}; + +struct rpgdummyserver : igameserver +{ + ~rpgdummyserver() {} + + void *newinfo() { return NULL; } + void deleteinfo(void *ci) {} + void serverinit() {} + void clientdisconnect(int n) {} + int clientconnect(int n, uint ip) { return DISC_NONE; } + void localdisconnect(int n) {} + void localconnect(int n) {} + const char *servername() { return "foo"; } + void parsepacket(int sender, int chan, bool reliable, ucharbuf &p) {} + bool sendpackets() { return false; } + int welcomepacket(ucharbuf &p, int n, ENetPacket *packet) { return -1; } + void serverinforeply(ucharbuf &q, ucharbuf &p) {} + void serverupdate(int lastmillis, int totalmillis) {} + bool servercompatible(char *name, char *sdec, char *map, int ping, const vector &attr, int np) { return false; } + void serverinfostr(char *buf, const char *name, const char *desc, const char *map, int ping, const vector &attr, int np) {} + int serverinfoport() { return 0; } + int serverport() { return 0; } + const char *getdefaultmaster() { return "localhost"; } + void sendservmsg(const char *s) {} +}; diff --git a/src/shared/CVS/Entries b/src/shared/CVS/Entries new file mode 100644 index 0000000..53f8a2f --- /dev/null +++ b/src/shared/CVS/Entries @@ -0,0 +1,14 @@ +/command.h/1.32/Wed Jun 11 02:44:06 2008// +/cube.h/1.20/Sat Oct 28 19:14:41 2006// +/ents.h/1.99/Mon Jun 9 19:47:44 2008// +/geom.cpp/1.7/Fri Apr 11 09:08:16 2008// +/geom.h/1.95/Fri Jun 6 10:24:49 2008// +/iengine.h/1.261/Mon Jun 16 23:49:58 2008// +/igame.h/1.78/Thu May 29 13:52:42 2008// +/pch.cpp/1.1/Sun Aug 7 13:05:12 2005// +/pch.h/1.14/Fri May 2 13:17:08 2008// +/sbtrace.d/1.1/Thu Nov 22 03:15:19 2007// +/sbtrace.h/1.2/Tue Dec 11 01:59:46 2007// +/tools.cpp/1.23/Wed May 14 04:03:06 2008// +/tools.h/1.78/Sat May 17 00:08:10 2008// +D diff --git a/src/shared/CVS/Repository b/src/shared/CVS/Repository new file mode 100644 index 0000000..060d45f --- /dev/null +++ b/src/shared/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/shared diff --git a/src/shared/CVS/Root b/src/shared/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/shared/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/shared/command.h b/src/shared/command.h new file mode 100644 index 0000000..6baeacd --- /dev/null +++ b/src/shared/command.h @@ -0,0 +1,160 @@ +// script binding functionality + + +enum { ID_VAR, ID_FVAR, ID_SVAR, ID_COMMAND, ID_CCOMMAND, ID_ALIAS }; + +enum { NO_OVERRIDE = INT_MAX, OVERRIDDEN = 0 }; + +enum { IDF_PERSIST = 1<<0, IDF_OVERRIDE = 1<<1 }; + +struct identstack +{ + char *action; + identstack *next; +}; + +union identval +{ + int i; // ID_VAR + float f; // ID_FVAR + char *s; // ID_SVAR +}; + +union identvalptr +{ + int *i; // ID_VAR + float *f; // ID_FVAR + char **s; // ID_SVAR +}; + +struct ident +{ + int type; // one of ID_* above + const char *name; + int minval, maxval; // ID_VAR + int override; // either NO_OVERRIDE, OVERRIDDEN, or value + union + { + void (__cdecl *fun)(); // ID_VAR, ID_COMMAND, ID_CCOMMAND + identstack *stack; // ID_ALIAS + }; + union + { + const char *narg; // ID_COMMAND, ID_CCOMMAND + char *action; // ID_ALIAS + identval val; // ID_VAR, ID_FVAR, ID_SVAR + }; + union + { + void *self; // ID_COMMAND, ID_CCOMMAND + char *isexecuting; // ID_ALIAS + identval overrideval; // ID_VAR, ID_FVAR, ID_SVAR + }; + identvalptr storage; // ID_VAR, ID_FVAR, ID_SVAR + int flags; + + ident() {} + // ID_VAR + ident(int t, const char *n, int m, int c, int x, int *s, void *f = NULL, int flags = 0) + : type(t), name(n), minval(m), maxval(x), override(NO_OVERRIDE), fun((void (__cdecl *)())f), flags(flags) + { val.i = c; storage.i = s; } + // ID_FVAR + ident(int t, const char *n, float c, float *s, void *f = NULL, int flags = 0) + : type(t), name(n), override(NO_OVERRIDE), fun((void (__cdecl *)())f), flags(flags) + { val.f = c; storage.f = s; } + // ID_SVAR + ident(int t, const char *n, char *c, char **s, void *f = NULL, int flags = 0) + : type(t), name(n), override(NO_OVERRIDE), fun((void (__cdecl *)())f), flags(flags) + { val.s = c; storage.s = s; } + // ID_ALIAS + ident(int t, const char *n, char *a, int flags) + : type(t), name(n), override(NO_OVERRIDE), stack(NULL), action(a), flags(flags) {} + // ID_COMMAND, ID_CCOMMAND + ident(int t, const char *n, const char *narg, void *f = NULL, void *s = NULL, int flags = 0) + : type(t), name(n), fun((void (__cdecl *)(void))f), narg(narg), self(s), flags(flags) {} + + virtual ~ident() {} + + ident &operator=(const ident &o) { memcpy(this, &o, sizeof(ident)); return *this; } // force vtable copy, ugh + + virtual void changed() { if(fun) fun(); } +}; + +extern void addident(const char *name, ident *id); +extern void intret(int v); +extern void result(const char *s); + +// nasty macros for registering script functions, abuses globals to avoid excessive infrastructure +#define COMMANDN(name, fun, nargs) static bool __dummy_##fun = addcommand(#name, (void (*)())fun, nargs) +#define COMMAND(name, nargs) COMMANDN(name, name, nargs) + +#define _VAR(name, global, min, cur, max, persist) int global = variable(#name, min, cur, max, &global, NULL, persist) +#define VARN(name, global, min, cur, max) _VAR(name, global, min, cur, max, 0) +#define VARNP(name, global, min, cur, max) _VAR(name, global, min, cur, max, IDF_PERSIST) +#define VARNR(name, global, min, cur, max) _VAR(name, global, min, cur, max, IDF_OVERRIDE) +#define VAR(name, min, cur, max) _VAR(name, name, min, cur, max, 0) +#define VARP(name, min, cur, max) _VAR(name, name, min, cur, max, IDF_PERSIST) +#define VARR(name, min, cur, max) _VAR(name, name, min, cur, max, IDF_OVERRIDE) +#define _VARF(name, global, min, cur, max, body, persist) void var_##name(); int global = variable(#name, min, cur, max, &global, var_##name, persist); void var_##name() { body; } +#define VARFN(name, global, min, cur, max, body) _VARF(name, global, min, cur, max, body, 0) +#define VARF(name, min, cur, max, body) _VARF(name, name, min, cur, max, body, 0) +#define VARFP(name, min, cur, max, body) _VARF(name, name, min, cur, max, body, IDF_PERSIST) +#define VARFR(name, min, cur, max, body) _VARF(name, name, min, cur, max, body, IDF_OVERRIDE) + +#define _FVAR(name, global, cur, persist) float global = fvariable(#name, cur, &global, NULL, persist) +#define FVARN(name, global, cur) _FVAR(name, global, cur, 0) +#define FVARNP(name, global, cur) _FVAR(name, global, cur, IDF_PERSIST) +#define FVARNR(name, global, cur) _FVAR(name, global, cur, IDF_OVERRIDE) +#define FVAR(name, cur) _FVAR(name, name, cur, 0) +#define FVARP(name, cur) _FVAR(name, name, cur, IDF_PERSIST) +#define FVARR(name, cur) _FVAR(name, name, cur, IDF_OVERRIDE) +#define _FVARF(name, global, cur, body, persist) void var_##name(); float global = fvariable(#name, cur, &global, var_##name, persist); void var_##name() { body; } +#define FVARFN(name, global, cur, body) _FVARF(name, global, cur, body, 0) +#define FVARF(name, cur, body) _FVARF(name, name, cur, body, 0) +#define FVARFP(name, cur, body) _FVARF(name, name, cur, body, IDF_PERSIST) +#define FVARFR(name, cur, body) _FVARF(name, name, cur, body, IDF_OVERRIDE) + +#define _SVAR(name, global, cur, persist) char *global = svariable(#name, cur, &global, NULL, persist) +#define SVARN(name, global, cur) _SVAR(name, global, cur, 0) +#define SVARNP(name, global, cur) _SVAR(name, global, cur, IDF_PERSIST) +#define SVARNR(name, global, cur) _SVAR(name, global, cur, IDF_OVERRIDE) +#define SVAR(name, cur) _SVAR(name, name, cur, 0) +#define SVARP(name, cur) _SVAR(name, name, cur, IDF_PERSIST) +#define SVARR(name, cur) _SVAR(name, name, cur, IDF_OVERRIDE) +#define _SVARF(name, global, cur, body, persist) void var_##name(); char *global = svariable(#name, cur, &global, var_##name, persist); void var_##name() { body; } +#define SVARFN(name, global, cur, body) _SVARF(name, global, cur, body, 0) +#define SVARF(name, cur, body) _SVARF(name, name, cur, body, 0) +#define SVARFP(name, cur, body) _SVARF(name, name, cur, body, IDF_PERSIST) +#define SVARFR(name, cur, body) _SVARF(name, name, cur, body, IDF_OVERRIDE) + +// new style macros, have the body inline, and allow binds to happen anywhere, even inside class constructors, and access the surrounding class +#define _COMMAND(idtype, tv, n, g, proto, b) \ + struct cmd_##n : ident \ + { \ + cmd_##n(void *self = NULL) : ident(idtype, #n, g, (void *)run, self) \ + { \ + addident(name, this); \ + } \ + static void run proto { b; } \ + } icom_##n tv +#define ICOMMAND(n, g, proto, b) _COMMAND(ID_COMMAND, , n, g, proto, b) +#define CCOMMAND(n, g, proto, b) _COMMAND(ID_CCOMMAND, (this), n, g, proto, b) + +#define _IVAR(n, m, c, x, b, p) \ + struct var_##n : ident \ + { \ + var_##n() : ident(ID_VAR, #n, m, c, x, &val.i, NULL, p) \ + { \ + addident(name, this); \ + } \ + int operator()() { return val.i; } \ + b \ + } n +#define IVAR(n, m, c, x) _IVAR(n, m, c, x, , 0) +#define IVARF(n, m, c, x, b) _IVAR(n, m, c, x, void changed() { b; }, 0) +#define IVARP(n, m, c, x) _IVAR(n, m, c, x, , IDF_PERSIST) +#define IVARR(n, m, c, x) _IVAR(n, m, c, x, , IDF_OVERRIDE) +#define IVARFP(n, m, c, x, b) _IVAR(n, m, c, x, void changed() { b; }, IDF_PERSIST) +#define IVARFR(n, m, c, x, b) _IVAR(n, m, c, x, void changed() { b; }, IDF_OVERRIDE) +//#define ICALL(n, a) { char *args[] = a; icom_##n.run(args); } +// diff --git a/src/shared/cube.h b/src/shared/cube.h new file mode 100644 index 0000000..35e5471 --- /dev/null +++ b/src/shared/cube.h @@ -0,0 +1,5 @@ +#include "tools.h" +#include "geom.h" +#include "ents.h" +#include "command.h" + diff --git a/src/shared/ents.h b/src/shared/ents.h new file mode 100644 index 0000000..a640103 --- /dev/null +++ b/src/shared/ents.h @@ -0,0 +1,194 @@ +// this file defines static map entities ("entity") and dynamic entities (players/monsters, "dynent") +// the gamecode extends these types to add game specific functionality + +// ET_*: the only static entity types dictated by the engine... rest are gamecode dependent + +enum { ET_EMPTY=0, ET_LIGHT, ET_MAPMODEL, ET_PLAYERSTART, ET_ENVMAP, ET_PARTICLES, ET_SOUND, ET_SPOTLIGHT, ET_GAMESPECIFIC }; + +struct entity // persistent map entity +{ + vec o; // position + short attr1, attr2, attr3, attr4, attr5; + uchar type; // type is one of the above + uchar reserved; +}; + +enum +{ + TRIGGER_RESET = 0, + TRIGGERING, + TRIGGERED, + TRIGGER_RESETTING, + TRIGGER_DISAPPEARED +}; + +struct entitylight +{ + vec color, dir; + int millis; + + entitylight() : color(1, 1, 1), dir(0, 0, 1), millis(-1) {} +}; + +struct extentity : entity // part of the entity that doesn't get saved to disk +{ + uchar spawned, inoctanode, visible, triggerstate; // the only dynamic state of a map entity + entitylight light; + int lasttrigger; + extentity *attached; + + extentity() : visible(false), triggerstate(TRIGGER_RESET), lasttrigger(0), attached(NULL) {} +}; + +//extern vector ents; // map entities + +enum { CS_ALIVE = 0, CS_DEAD, CS_SPAWNING, CS_LAGGED, CS_EDITING, CS_SPECTATOR }; + +enum { PHYS_FLOAT = 0, PHYS_FALL, PHYS_SLIDE, PHYS_SLOPE, PHYS_FLOOR, PHYS_STEP_UP, PHYS_STEP_DOWN, PHYS_BOUNCE }; + +enum { ENT_PLAYER = 0, ENT_AI, ENT_INANIMATE, ENT_CAMERA, ENT_BOUNCE }; + +enum { COLLIDE_AABB = 0, COLLIDE_ELLIPSE }; + +struct physent // base entity type, can be affected by physics +{ + vec o, vel, falling; // origin, velocity + vec deltapos, newpos; // movement interpolation + float yaw, pitch, roll; + float maxspeed; // cubes per second, 100 for player + int timeinair; + float radius, eyeheight, aboveeye; // bounding box size + float xradius, yradius, zmargin; + vec floor; // the normal of floor the dynent is on + + int inwater; + bool jumpnext; + bool blocked, moving; // used by physics to signal ai + physent *onplayer; + int lastmove, lastmoveattempt, collisions, stacks; + + char move, strafe; + + uchar physstate; // one of PHYS_* above + uchar state, editstate; // one of CS_* above + uchar type; // one of ENT_* above + uchar collidetype; // one of COLLIDE_* above + + physent() : o(0, 0, 0), deltapos(0, 0, 0), newpos(0, 0, 0), yaw(270), pitch(0), roll(0), maxspeed(100), + radius(4.1f), eyeheight(14), aboveeye(1), xradius(4.1f), yradius(4.1f), zmargin(0), + blocked(false), moving(true), + onplayer(NULL), lastmove(0), lastmoveattempt(0), collisions(0), stacks(0), + state(CS_ALIVE), editstate(CS_ALIVE), type(ENT_PLAYER), + collidetype(COLLIDE_ELLIPSE) + { reset(); } + + void resetinterp() + { + newpos = o; + deltapos = vec(0, 0, 0); + } + + void reset() + { + inwater = 0; + timeinair = 0; + strafe = move = 0; + physstate = PHYS_FALL; + vel = falling = vec(0, 0, 0); + floor = vec(0, 0, 1); + } +}; + +enum +{ + ANIM_DEAD = 0, ANIM_DYING, ANIM_IDLE, + ANIM_FORWARD, ANIM_BACKWARD, ANIM_LEFT, ANIM_RIGHT, + ANIM_PUNCH, ANIM_SHOOT, ANIM_PAIN, + ANIM_JUMP, ANIM_SINK, ANIM_SWIM, + ANIM_EDIT, ANIM_LAG, ANIM_TAUNT, ANIM_WIN, ANIM_LOSE, + ANIM_GUNSHOOT, ANIM_GUNIDLE, + ANIM_VWEP, ANIM_SHIELD, ANIM_POWERUP, + ANIM_MAPMODEL, ANIM_TRIGGER, + NUMANIMS +}; + +#define ANIM_ALL 0xFF +#define ANIM_INDEX 0xFF +#define ANIM_LOOP (1<<8) +#define ANIM_START (1<<9) +#define ANIM_END (1<<10) +#define ANIM_REVERSE (1<<11) +#define ANIM_DIR 0xF00 +#define ANIM_SECONDARY 12 +#define ANIM_NOSKIN (1<<24) +#define ANIM_ENVMAP (1<<25) +#define ANIM_TRANSLUCENT (1<<26) +#define ANIM_SHADOW (1<<27) +#define ANIM_SETTIME (1<<28) +#define ANIM_FULLBRIGHT (1<<29) +#define ANIM_REUSE (1<<30) +#define ANIM_FLAGS (0x7F<<24) + +struct animinfo // description of a character's animation +{ + int anim, frame, range, basetime; + float speed; + uint varseed; + + animinfo() : anim(0), frame(0), range(0), basetime(0), speed(100.0f), varseed(0) { } + + bool operator==(const animinfo &o) const { return frame==o.frame && range==o.range && (anim&(ANIM_SETTIME|ANIM_DIR))==(o.anim&(ANIM_SETTIME|ANIM_DIR)) && (anim&ANIM_SETTIME || basetime==o.basetime) && speed==o.speed; } + bool operator!=(const animinfo &o) const { return frame!=o.frame || range!=o.range || (anim&(ANIM_SETTIME|ANIM_DIR))!=(o.anim&(ANIM_SETTIME|ANIM_DIR)) || (!(anim&ANIM_SETTIME) && basetime!=o.basetime) || speed!=o.speed; } +}; + +struct animinterpinfo // used for animation blending of animated characters +{ + animinfo prev, cur; + int lastswitch; + void *lastmodel; + + animinterpinfo() : lastswitch(-1), lastmodel(NULL) {} +}; + +#define MAXANIMPARTS 2 + +struct occludequery; + +struct dynent : physent // animated characters, or characters that can receive input +{ + bool k_left, k_right, k_up, k_down; // see input code + float targetyaw, rotspeed; // AI rotation + + entitylight light; + animinterpinfo animinterp[MAXANIMPARTS]; + occludequery *query; + int occluded, lastrendered; + + dynent() : query(NULL), occluded(0), lastrendered(0) + { + reset(); + } + + void stopmoving() + { + k_left = k_right = k_up = k_down = jumpnext = false; + move = strafe = 0; + targetyaw = rotspeed = 0; + } + + void reset() + { + physent::reset(); + stopmoving(); + } + + vec abovehead() { return vec(o).add(vec(0, 0, aboveeye+4)); } + + void normalize_yaw(float angle) + { + while(yawangle+180.0f) yaw -= 360.0f; + } +}; + + diff --git a/src/shared/geom.cpp b/src/shared/geom.cpp new file mode 100644 index 0000000..c6638c2 --- /dev/null +++ b/src/shared/geom.cpp @@ -0,0 +1,51 @@ + +#include "pch.h" +#include "tools.h" +#include "geom.h" + +bool raysphereintersect(vec c, float radius, const vec &o, const vec &ray, float &dist) +{ + c.sub(o); + float v = c.dot(ray), + inside = radius*radius - c.squaredlen(), + d = inside + v*v; + if(inside<0 && d<0) return false; + dist += v - sqrt(d); + return true; +} + +bool rayrectintersect(const vec &b, const vec &s, const vec &o, const vec &ray, float &dist, int &orient) +{ + loopi(6) + { + int d = i>>1, dc = i&1; orient = i; + if(dc == (ray[d]>0)) continue; + float t = 0; + plane pl(d, b[D[d]]+s[D[d]]*dc); + if(pl.rayintersect(o, ray, t)) + { + vec v(ray); + v.mul(t); + v.add(o); + if(v[R[d]] >= b[R[d]] && v[R[d]] <= b[R[d]]+s[R[d]] + && v[C[d]] >= b[C[d]] && v[C[d]] <= b[C[d]]+s[C[d]]) + { + dist += t; + return true; + } + } + } + return false; +} + +int intersect_plane_line(vec &linestart, vec &linestop, vec &planeorig, vec &planenormal, vec &intersectionpoint) +{ + vec u = linestop; u.sub(linestart); + vec w = linestart; w.sub(planeorig); + float d = planenormal.dot(u); + float n = -planenormal.dot(w); + if(fabs(d)<0.000001) return n==0 ? INTERSECT_OVERLAP : INTERSECT_NONE; + float si = n/d; + intersectionpoint = u.mul(si).add(linestart); + return si<0 ? INTERSECT_BEFORESTART : (si>1 ? INTERSECT_AFTEREND : INTERSECT_MIDDLE); +} diff --git a/src/shared/geom.h b/src/shared/geom.h new file mode 100644 index 0000000..b7f337a --- /dev/null +++ b/src/shared/geom.h @@ -0,0 +1,659 @@ +struct vec4; + +struct vec +{ + union + { + struct { float x, y, z; }; + float v[3]; + }; + + vec() {} + explicit vec(int a) : x(a), y(a), z(a) {} + explicit vec(float a) : x(a), y(a), z(a) {} + vec(float a, float b, float c) : x(a), y(b), z(c) {} + vec(int v[3]) : x(v[0]), y(v[1]), z(v[2]) {} + vec(float *v) : x(v[0]), y(v[1]), z(v[2]) {} + explicit vec(const vec4 &v); + + vec(float yaw, float pitch) : x(sinf(yaw)*cosf(pitch)), y(-cosf(yaw)*cosf(pitch)), z(sinf(pitch)) {} + + float &operator[](int i) { return v[i]; } + float operator[](int i) const { return v[i]; } + + vec &set(int i, float f) { v[i] = f; return *this; } + + bool operator==(const vec &o) const { return x == o.x && y == o.y && z == o.z; } + bool operator!=(const vec &o) const { return x != o.x || y != o.y || z != o.z; } + + bool iszero() const { return x==0 && y==0 && z==0; } + float squaredlen() const { return x*x + y*y + z*z; } + float dot(const vec &o) const { return x*o.x + y*o.y + z*o.z; } + vec &mul(float f) { x *= f; y *= f; z *= f; return *this; } + vec &div(float f) { x /= f; y /= f; z /= f; return *this; } + vec &add(const vec &o) { x += o.x; y += o.y; z += o.z; return *this; } + vec &add(float f) { x += f; y += f; z += f; return *this; } + vec &sub(const vec &o) { x -= o.x; y -= o.y; z -= o.z; return *this; } + vec &sub(float f) { x -= f; y -= f; z -= f; return *this; } + vec &neg() { return mul(-1); } + float magnitude() const { return sqrtf(squaredlen()); } + vec &normalize() { div(magnitude()); return *this; } + bool isnormalized() const { float m = squaredlen(); return (m>0.99f && m<1.01f); } + float dist(const vec &e) const { vec t; return dist(e, t); } + float dist(const vec &e, vec &t) const { t = *this; t.sub(e); return t.magnitude(); } + bool reject(const vec &o, float max) { return x>o.x+max || xo.y+max || y 1e-6f) mul(k / mag); + } + + void rotate_around_z(float angle) { *this = vec(cosf(angle)*x-sinf(angle)*y, cosf(angle)*y+sinf(angle)*x, z); } + void rotate_around_x(float angle) { *this = vec(x, cosf(angle)*y-sinf(angle)*z, cosf(angle)*z+sinf(angle)*y); } + void rotate_around_y(float angle) { *this = vec(cosf(angle)*x-sinf(angle)*z, y, cosf(angle)*z+sinf(angle)*x); } + + void rotate(float angle, const vec &d) + { + float c = cosf(angle), s = sinf(angle); + rotate(c, s, d); + } + + void rotate(float c, float s, const vec &d) + { + *this = vec(x*(d.x*d.x*(1-c)+c) + y*(d.x*d.y*(1-c)-d.z*s) + z*(d.x*d.z*(1-c)+d.y*s), + x*(d.y*d.x*(1-c)+d.z*s) + y*(d.y*d.y*(1-c)+c) + z*(d.y*d.z*(1-c)-d.x*s), + x*(d.x*d.z*(1-c)-d.y*s) + y*(d.y*d.z*(1-c)+d.x*s) + z*(d.z*d.z*(1-c)+c)); + } + + void orthogonal(const vec &d) + { + int i = fabs(d.x) > fabs(d.y) ? (fabs(d.x) > fabs(d.z) ? 0 : 2) : (fabs(d.y) > fabs(d.z) ? 1 : 2); + v[i] = d[(i+1)%3]; + v[(i+1)%3] = -d[i]; + v[(i+2)%3] = 0; + } + + void orthonormalize(vec &s, vec &t) const + { + s.sub(vec(*this).mul(dot(s))); + t.sub(vec(*this).mul(dot(t))) + .sub(vec(s).mul(s.dot(t))); + } + + template float dist_to_bb(const T &min, const T &max) const + { + float sqrdist = 0; + loopi(3) + { + if (v[i] < min[i]) { float delta = v[i]-min[i]; sqrdist += delta*delta; } + else if(v[i] > max[i]) { float delta = max[i]-v[i]; sqrdist += delta*delta; } + } + return sqrtf(sqrdist); + } + + template float dist_to_bb(const T &o, S size) const + { + return dist_to_bb(o, T(o).add(size)); + } +}; + +struct vec4 +{ + union + { + struct { float x, y, z, w; }; + float v[4]; + }; + + vec4() {} + explicit vec4(const vec &p, float w = 0) : x(p.x), y(p.y), z(p.z), w(w) {} + vec4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {} + + float &operator[](int i) { return v[i]; } + float operator[](int i) const { return v[i]; } + + float dot3(const vec4 &o) const { return x*o.x + y*o.y + z*o.z; } + float dot3(const vec &o) const { return x*o.x + y*o.y + z*o.z; } + float dot(const vec4 &o) const { return dot3(o) + w*o.w; } + float dot(const vec &o) const { return x*o.x + y*o.y + z*o.z + w; } + float squaredlen() const { return dot(*this); } + float magnitude() const { return sqrtf(squaredlen()); } + float magnitude3() const { return sqrtf(dot3(*this)); } + vec4 &normalize() { mul(1/magnitude()); return *this; } + + void lerp(const vec4 &a, const vec4 &b, float t) + { + x = a.x*(1-t)+b.x*t; + y = a.y*(1-t)+b.y*t; + z = a.z*(1-t)+b.z*t; + w = a.w*(1-t)+b.w*t; + } + + vec4 &mul3(float f) { x *= f; y *= f; z *= f; return *this; } + vec4 &mul(float f) { mul3(f); w *= f; return *this; } + vec4 &add(const vec4 &o) { x += o.x; y += o.y; z += o.z; w += o.w; return *this; } + vec4 &neg3() { x = -x; y = -y; z = -z; return *this; } + vec4 &neg() { neg3(); w = -w; return *this; } +}; + +inline vec::vec(const vec4 &v) : x(v.x), y(v.y), z(v.z) {} + +struct quat : vec4 +{ + quat() {} + quat(float x, float y, float z, float w) : vec4(x, y, z, w) {} + quat(const vec &axis, float angle) + { + w = cosf(angle/2); + float s = sinf(angle/2); + x = s*axis.x; + y = s*axis.y; + z = s*axis.z; + } + + void restorew() { w = 1.0f-x*x-y*y-z*z; w = w<0 ? 0 : -sqrtf(w); } + + void add(const vec4 &o) { vec4::add(o); } + void mul(float k) { vec4::mul(k); } + + void mul(const quat &p, const quat &o) + { + x = p.w*o.x + p.x*o.w + p.y*o.z - p.z*o.y; + y = p.w*o.y - p.x*o.z + p.y*o.w + p.z*o.x; + z = p.w*o.z + p.x*o.y - p.y*o.x + p.z*o.w; + w = p.w*o.w - p.x*o.x - p.y*o.y - p.z*o.z; + } + void mul(const quat &o) { mul(quat(*this), o); } + + void mul(const quat &p, const vec &o) + { + x = p.w*o.x + p.y*o.z - p.z*o.y; + y = p.w*o.y - p.x*o.z + p.z*o.x; + z = p.w*o.z + p.x*o.y - p.y*o.x; + w = -p.x*o.x - p.y*o.y - p.z*o.z; + } + void mul(const vec &o) { mul(quat(*this), o); } + + quat &invert() { neg3(); return *this; } + + void slerp(const quat &from, const quat &to, float t) + { + float cosomega = from.dot(to), fromk, tok = 1; + if(cosomega<0) { cosomega = -cosomega; tok = -1; } + + if(cosomega > 1 - 1e-6) { fromk = 1-t; tok *= t; } + else + { + float omega = acosf(cosomega), recipsinomega = 1/sinf(omega); + fromk = sinf((1-t)*omega)*recipsinomega; + tok *= sinf(t*omega)*recipsinomega; + } + + loopi(4) v[i] = from[i]*fromk + to[i]*tok; + } + + vec rotate(const vec &v) const + { + vec t1, t2; + t1.cross(vec(*this), v); + t2.cross(vec(*this), t1); + t1.mul(w).add(t2).mul(2).add(v); + return t1; +#if 0 + quat inv(*this); + inv.invert(); + inv.normalize(); + quat tmp; + tmp.mul(*this, v); + tmp.mul(inv); + return vec(tmp.x, tmp.y, tmp.z); +#endif + } +}; + +struct dualquat +{ + quat real, dual; + + dualquat() {} + dualquat(const quat &q, const vec &p) : real(q) + { + dual.x = 0.5f*( p.x*q.w + p.y*q.z - p.z*q.y); + dual.y = 0.5f*(-p.x*q.z + p.y*q.w + p.z*q.x); + dual.z = 0.5f*( p.x*q.y - p.y*q.x + p.z*q.w); + dual.w = -0.5f*( p.x*q.x + p.y*q.y + p.z*q.z); + } + explicit dualquat(const quat &q) : real(q), dual(0, 0, 0, 0) {} + + dualquat &mul(float k) { real.mul(k); dual.mul(k); return *this; } + dualquat &add(const dualquat &d) { real.add(d.real); dual.add(d.dual); return *this; } + + void lerp(const dualquat &from, const dualquat &to, float t) + { + float a = 1-t, b = from.real.dot(to.real)<0 ? -t : t; + loopi(4) + { + real[i] = from.real[i]*a + to.real[i]*b; + dual[i] = from.dual[i]*a + to.dual[i]*b; + } + } + + dualquat &invert() + { + float rr = real.squaredlen(); + if(rr > 0) + { + float invrr = 1/rr, + invrd = -2*real.dot(dual)*invrr*invrr; + + dual.mul3(-invrr); + dual.w *= invrr; + quat tmp(real); + tmp.mul3(-invrd); + tmp.w *= invrd; + dual.add(tmp); + + real.mul3(-invrr); + real.w *= invrr; + } + else { real = dual = quat(0, 0, 0, 0); } + return *this; + } + + void mul(const dualquat &p, const dualquat &o) + { + real.mul(p.real, o.real); + dual.mul(p.real, o.dual); + quat tmp; + tmp.mul(p.dual, o.real); + dual.add(tmp); + } + void mul(const dualquat &o) { mul(dualquat(*this), o); } + + void normalize() + { + float invlen = 1/real.magnitude(); + real.mul(invlen); + dual.mul(invlen); + } + + void translate(const vec &p) + { + dual.x += 0.5f*( p.x*real.w + p.y*real.z - p.z*real.y); + dual.y += 0.5f*(-p.x*real.z + p.y*real.w + p.z*real.x); + dual.z += 0.5f*( p.x*real.y - p.y*real.x + p.z*real.w); + dual.w += -0.5f*( p.x*real.x + p.y*real.y + p.z*real.z); + } + + void scale(float k) + { + dual.mul(k); + } + + void fixantipodal(const dualquat &d) + { + if(real.dot(d.real) < 0) + { + real.neg(); + dual.neg(); + } + } + + void accumulate(const dualquat &d, float k) + { + real.add(vec4(d.real).mul(k)); + dual.add(vec4(d.dual).mul(k)); + } + + vec transform(const vec &v) const + { + vec t1, t2; + t1.cross(vec(real), v); + t1.add(vec(v).mul(real.w)); + t2.cross(vec(real), t1); + + vec t3; + t3.cross(vec(real), vec(dual)); + t3.add(vec(dual).mul(real.w)); + t3.sub(vec(real).mul(dual.w)); + + t2.add(t3).mul(2).add(v); + + return t2; + } +}; + +struct matrix3x4 +{ + vec4 X, Y, Z; + + matrix3x4() {} + matrix3x4(const vec4 &x, const vec4 &y, const vec4 &z) : X(x), Y(y), Z(z) {} + matrix3x4(const dualquat &d) + { + float x = d.real.x, y = d.real.y, z = d.real.z, w = d.real.w, + ww = w*w, xx = x*x, yy = y*y, zz = z*z, + xy = x*y, xz = x*z, yz = y*z, + wx = w*x, wy = w*y, wz = w*z; + X = vec4(ww + xx - yy - zz, 2*(xy - wz), 2*(xz + wy), + -2*(d.dual.w*x - d.dual.x*w + d.dual.y*z - d.dual.z*y)); + Y = vec4(2*(xy + wz), ww + yy - xx - zz, 2*(yz - wx), + -2*(d.dual.w*y - d.dual.x*z - d.dual.y*w + d.dual.z*x)); + Z = vec4(2*(xz - wy), 2*(yz + wx), ww + zz - xx - yy, + -2*(d.dual.w*z + d.dual.x*y - d.dual.y*x - d.dual.z*w)); + + float invrr = 1/d.real.dot(d.real); + X.mul(invrr); + Y.mul(invrr); + Z.mul(invrr); + } + + void scale(float k) + { + X.mul(k); + Y.mul(k); + Z.mul(k); + } + + void translate(const vec &p) + { + X.w += p.x; + Y.w += p.y; + Z.w += p.z; + } + + void accumulate(const matrix3x4 &m, float k) + { + X.add(vec4(m.X).mul(k)); + Y.add(vec4(m.Y).mul(k)); + Z.add(vec4(m.Z).mul(k)); + } + + void normalize() + { + X.mul3(1/X.magnitude3()); + Y.mul3(1/Y.magnitude3()); + Z.mul3(1/Z.magnitude3()); + } + + void lerp(const matrix3x4 &from, const matrix3x4 &to, float t) + { + loopi(4) + { + X[i] += to.X[i]*t + from.X[i]*(1-t); + Y[i] += to.Y[i]*t + from.Y[i]*(1-t); + Z[i] += to.Z[i]*t + from.Z[i]*(1-t); + } + } + + void identity() + { + X = vec4(1, 0, 0, 0); + Y = vec4(0, 1, 0, 0); + Z = vec4(0, 0, 1, 0); + } + + void mul(const matrix3x4 &m, const matrix3x4 &n) + { + X = vec4(m.X.dot3(vec(n.X.x, n.Y.x, n.Z.x)), + m.X.dot3(vec(n.X.y, n.Y.y, n.Z.y)), + m.X.dot3(vec(n.X.z, n.Y.z, n.Z.z)), + m.X.dot(vec(n.X.w, n.Y.w, n.Z.w))); + Y = vec4(m.Y.dot3(vec(n.X.x, n.Y.x, n.Z.x)), + m.Y.dot3(vec(n.X.y, n.Y.y, n.Z.y)), + m.Y.dot3(vec(n.X.z, n.Y.z, n.Z.z)), + m.Y.dot(vec(n.X.w, n.Y.w, n.Z.w))); + Z = vec4(m.Z.dot3(vec(n.X.x, n.Y.x, n.Z.x)), + m.Z.dot3(vec(n.X.y, n.Y.y, n.Z.y)), + m.Z.dot3(vec(n.X.z, n.Y.z, n.Z.z)), + m.Z.dot(vec(n.X.w, n.Y.w, n.Z.w))); + } + void mul(const matrix3x4 &n) { mul(matrix3x4(*this), n); } + + void rotate(float angle, const vec &d) + { + float c = cosf(angle), s = sinf(angle); + rotate(c, s, d); + } + + void rotate(float c, float s, const vec &d) + { + X = vec4(d.x*d.x*(1-c)+c, d.x*d.y*(1-c)-d.z*s, d.x*d.z*(1-c)+d.y*s, 0); + Y = vec4(d.y*d.x*(1-c)+d.z*s, d.y*d.y*(1-c)+c, d.y*d.z*(1-c)-d.x*s, 0); + Z = vec4(d.x*d.z*(1-c)-d.y*s, d.y*d.z*(1-c)+d.x*s, d.z*d.z*(1-c)+c, 0); + } + + vec transform(const vec &o) const { return vec(X.dot(o), Y.dot(o), Z.dot(o)); } + vec transformnormal(const vec &o) const { return vec(X.dot3(o), Y.dot3(o), Z.dot3(o)); } + vec transposedtransformnormal(const vec &o) const + { + return vec(X.x*o.x + Y.x*o.y + Z.x*o.z, + X.y*o.x + Y.y*o.y + Z.y*o.z, + X.z*o.x + Y.z*o.y + Z.z*o.z); + } +}; + +struct plane : vec +{ + float offset; + + float dist(const vec &p) const { return dot(p)+offset; } + bool operator==(const plane &p) const { return x==p.x && y==p.y && z==p.z && offset==p.offset; } + bool operator!=(const plane &p) const { return x!=p.x || y!=p.y || z!=p.z || offset!=p.offset; } + + plane() {} + plane(vec &c, float off) : vec(c), offset(off) {} + plane(int d, float off) + { + x = y = z = 0.0f; + v[d] = 1.0f; + offset = -off; + } + plane(float a, float b, float c, float d) : vec(a, b, c), offset(d) {} + + void toplane(const vec &n, const vec &p) + { + x = n.x; y = n.y; z = n.z; + offset = -dot(p); + } + + bool toplane(const vec &a, const vec &b, const vec &c) + { + cross(vec(b).sub(a), vec(c).sub(a)); + float mag = magnitude(); + if(!mag) return false; + div(mag); + offset = -dot(a); + return true; + } + + bool rayintersect(const vec &o, const vec &ray, float &dist) + { + float cosalpha = dot(ray); + if(cosalpha==0) return false; + float deltac = offset+dot(o); + dist -= deltac/cosalpha; + return true; + } + + float zintersect(const vec &p) const { return -(x*p.x+y*p.y+offset)/z; } + float zdist(const vec &p) const { return p.z-zintersect(p); } +}; + +struct triangle +{ + vec a, b, c; + + triangle(const vec &a, const vec &b, const vec &c) : a(a), b(b), c(c) {} + triangle() {} + + triangle &add(const vec &o) { a.add(o); b.add(o); c.add(o); return *this; } + triangle &sub(const vec &o) { a.sub(o); b.sub(o); c.sub(o); return *this; } + + bool operator==(const triangle &t) const { return a == t.a && b == t.b && c == t.c; } +}; + +/** + +Sauerbraten uses 3 different linear coordinate systems +which are oriented around each of the axis dimensions. + +So any point within the game can be defined by four coordinates: (d, x, y, z) + +d is the reference axis dimension +x is the coordinate of the ROW dimension +y is the coordinate of the COL dimension +z is the coordinate of the reference dimension (DEPTH) + +typically, if d is not used, then it is implicitly the Z dimension. +ie: d=z => x=x, y=y, z=z + +**/ + +// DIM: X=0 Y=1 Z=2. +const int R[3] = {1, 2, 0}; // row +const int C[3] = {2, 0, 1}; // col +const int D[3] = {0, 1, 2}; // depth + +struct ivec +{ + union + { + struct { int x, y, z; }; + int v[3]; + }; + + ivec() {} + ivec(const vec &v) : x(int(v.x)), y(int(v.y)), z(int(v.z)) {} + ivec(int i) + { + x = ((i&1)>>0); + y = ((i&2)>>1); + z = ((i&4)>>2); + } + ivec(int a, int b, int c) : x(a), y(b), z(c) {} + ivec(int d, int row, int col, int depth) + { + v[R[d]] = row; + v[C[d]] = col; + v[D[d]] = depth; + } + ivec(int i, int cx, int cy, int cz, int size) + { + x = cx+((i&1)>>0)*size; + y = cy+((i&2)>>1)*size; + z = cz+((i&4)>>2)*size; + } + vec tovec() const { return vec(x, y, z); } + int toint() const { return (x>0?1:0) + (y>0?2:0) + (z>0?4:0); } + + int &operator[](int i) { return v[i]; } + int operator[](int i) const { return v[i]; } + + //int idx(int i) { return v[i]; } + bool operator==(const ivec &v) const { return x==v.x && y==v.y && z==v.z; } + bool operator!=(const ivec &v) const { return x!=v.x || y!=v.y || z!=v.z; } + bool iszero() const { return x==0 && y==0 && z==0; } + ivec &shl(int n) { x<<= n; y<<= n; z<<= n; return *this; } + ivec &shr(int n) { x>>= n; y>>= n; z>>= n; return *this; } + ivec &mul(int n) { x *= n; y *= n; z *= n; return *this; } + ivec &div(int n) { x /= n; y /= n; z /= n; return *this; } + ivec &add(int n) { x += n; y += n; z += n; return *this; } + ivec &sub(int n) { x -= n; y -= n; z -= n; return *this; } + ivec &add(const ivec &v) { x += v.x; y += v.y; z += v.z; return *this; } + ivec &sub(const ivec &v) { x -= v.x; y -= v.y; z -= v.z; return *this; } + ivec &mask(int n) { x &= n; y &= n; z &= n; return *this; } + ivec &neg() { return mul(-1); } + ivec &cross(const ivec &a, const ivec &b) { x = a.y*b.z-a.z*b.y; y = a.z*b.x-a.x*b.z; z = a.x*b.y-a.y*b.x; return *this; } + int dot(const ivec &o) const { return x*o.x + y*o.y + z*o.z; } + float dist(const plane &p) const { return x*p.x + y*p.y + z*p.z + p.offset; } +}; + +static inline bool htcmp(const ivec &x, const ivec &y) +{ + return x == y; +} + +static inline uint hthash(const ivec &k) +{ + return k.x^k.y^k.z; +} + +struct svec +{ + union + { + struct { ushort x, y, z; }; + ushort v[3]; + }; + + svec() {} + svec(ushort x, ushort y, ushort z) : x(x), y(y), z(z) {} + + ushort &operator[](int i) { return v[i]; } + ushort operator[](int i) const { return v[i]; } + + bool operator==(const svec &v) const { return x==v.x && y==v.y && z==v.z; } + bool operator!=(const svec &v) const { return x!=v.x || y!=v.y || z!=v.z; } + + svec &add(const svec &o) { x += o.x; y += o.y; z += o.z; return *this; } + svec &add(const ivec &o) { x += o.x; y += o.y; z += o.z; return *this; } + svec &add(int n) { x += n; y += n; z += n; return *this; } + svec &sub(const svec &o) { x -= o.x; y -= o.y; z -= o.z; return *this; } + svec &sub(const ivec &o) { x -= o.x; y -= o.y; z -= o.z; return *this; } + svec &sub(int n) { x -= n; y -= n; z -= n; return *this; } + svec &mul(int f) { x *= f; y *= f; z *= f; return *this; } + svec &div(int f) { x /= f; y /= f; z /= f; return *this; } + + bool iszero() const { return x==0 && y==0 && z==0; } +}; + +struct bvec +{ + union + { + struct { uchar x, y, z; }; + uchar v[3]; + }; + + bvec() {} + bvec(uchar x, uchar y, uchar z) : x(x), y(y), z(z) {} + bvec(const vec &v) : x((uchar)((v.x+1)*255/2)), y((uchar)((v.y+1)*255/2)), z((uchar)((v.z+1)*255/2)) {} + + uchar &operator[](int i) { return v[i]; } + uchar operator[](int i) const { return v[i]; } + + bool operator==(const bvec &v) const { return x==v.x && y==v.y && z==v.z; } + bool operator!=(const bvec &v) const { return x!=v.x || y!=v.y || z!=v.z; } + + bool iszero() const { return x==0 && y==0 && z==0; } + + vec tovec() const { return vec(x*(2.0f/255.0f)-1.0f, y*(2.0f/255.0f)-1.0f, z*(2.0f/255.0f)-1.0f); } +}; + +extern bool raysphereintersect(vec c, float radius, const vec &o, const vec &ray, float &dist); +extern bool rayrectintersect(const vec &b, const vec &s, const vec &o, const vec &ray, float &dist, int &orient); + +enum { INTERSECT_NONE, INTERSECT_OVERLAP, INTERSECT_BEFORESTART, INTERSECT_MIDDLE, INTERSECT_AFTEREND }; +extern int intersect_plane_line(vec &linestart, vec &linestop, vec &planeorig, vec &planenormal, vec &intersectionpoint); + diff --git a/src/shared/iengine.h b/src/shared/iengine.h new file mode 100644 index 0000000..938824c --- /dev/null +++ b/src/shared/iengine.h @@ -0,0 +1,346 @@ +// the interface the game uses to access the engine + +enum +{ + MATF_VOLUME_SHIFT = 0, + MATF_CLIP_SHIFT = 3, + MATF_FLAG_SHIFT = 5, + + MATF_VOLUME = 7 << MATF_VOLUME_SHIFT, + MATF_CLIP = 3 << MATF_CLIP_SHIFT, + MATF_FLAGS = 7 << MATF_FLAG_SHIFT +}; + +enum // cube empty-space materials +{ + MAT_AIR = 0, // the default, fill the empty space with air + MAT_WATER = 1 << MATF_VOLUME_SHIFT, // fill with water, showing waves at the surface + MAT_LAVA = 2 << MATF_VOLUME_SHIFT, // fill with lava + MAT_GLASS = 3 << MATF_VOLUME_SHIFT, // behaves like clip but is blended blueish + + MAT_NOCLIP = 1 << MATF_CLIP_SHIFT, // collisions always treat cube as empty + MAT_CLIP = 2 << MATF_CLIP_SHIFT, // collisions always treat cube as solid + MAT_AICLIP = 3 << MATF_CLIP_SHIFT, // clip monsters only + + MAT_DEATH = 1 << MATF_FLAG_SHIFT, // force player suicide + MAT_EDIT = 4 << MATF_FLAG_SHIFT // edit-only surfaces +}; + +extern void lightent(extentity &e, float height = 8.0f); +extern void lightreaching(const vec &target, vec &color, vec &dir, extentity *e = 0, float ambient = 0.4f); +extern entity *brightestlight(const vec &target, const vec &dir); + +enum { RAY_BB = 1, RAY_POLY = 3, RAY_ALPHAPOLY = 7, RAY_ENTS = 9, RAY_CLIPMAT = 16, RAY_SKIPFIRST = 32, RAY_EDITMAT = 64, RAY_SHADOW = 128, RAY_PASS = 256 }; + +extern float raycube (const vec &o, const vec &ray, float radius = 0, int mode = RAY_CLIPMAT, int size = 0, extentity *t = 0); +extern float raycubepos(const vec &o, const vec &ray, vec &hit, float radius = 0, int mode = RAY_CLIPMAT, int size = 0); +extern float rayfloor (const vec &o, vec &floor, int mode = 0, float radius = 0); +extern bool raycubelos(const vec &o, const vec &dest, vec &hitpos); + +extern bool isthirdperson(); + +extern void settexture(const char *name, bool clamp = false); + +// octaedit + +enum { EDIT_FACE = 0, EDIT_TEX, EDIT_MAT, EDIT_FLIP, EDIT_COPY, EDIT_PASTE, EDIT_ROTATE, EDIT_REPLACE, EDIT_DELCUBE, EDIT_REMIP }; + +struct selinfo +{ + int corner; + int cx, cxs, cy, cys; + ivec o, s; + int grid, orient; + int size() const { return s.x*s.y*s.z; } + int us(int d) const { return s[d]*grid; } + bool operator==(const selinfo &sel) const { return o==sel.o && s==sel.s && grid==sel.grid && orient==sel.orient; } +}; + +struct editinfo; + +extern bool editmode; + +extern void freeeditinfo(editinfo *&e); +extern void cursorupdate(); +extern void pruneundos(int maxremain = 0); +extern bool noedit(bool view = false); +extern void toggleedit(bool force = true); +extern void mpeditface(int dir, int mode, selinfo &sel, bool local); +extern void mpedittex(int tex, int allfaces, selinfo &sel, bool local); +extern void mpeditmat(int matid, selinfo &sel, bool local); +extern void mpflip(selinfo &sel, bool local); +extern void mpcopy(editinfo *&e, selinfo &sel, bool local); +extern void mppaste(editinfo *&e, selinfo &sel, bool local); +extern void mprotate(int cw, selinfo &sel, bool local); +extern void mpreplacetex(int oldtex, int newtex, selinfo &sel, bool local); +extern void mpdelcube(selinfo &sel, bool local); +extern void mpremip(bool local); + +// command +extern int variable(const char *name, int min, int cur, int max, int *storage, void (*fun)(), int flags); +extern float fvariable(const char *name, float cur, float *storage, void (*fun)(), int flags); +extern char *svariable(const char *name, const char *cur, char **storage, void (*fun)(), int flags); +extern void setvar(const char *name, int i, bool dofunc = false); +extern void setfvar(const char *name, float f, bool dofunc = false); +extern void setsvar(const char *name, const char *str, bool dofunc = false); +extern void touchvar(const char *name); +extern int getvar(const char *name); +extern int getvarmin(const char *name); +extern int getvarmax(const char *name); +extern bool identexists(const char *name); +extern ident *getident(const char *name); +extern bool addcommand(const char *name, void (*fun)(), const char *narg); +extern int execute(const char *p); +extern char *executeret(const char *p); +extern void exec(const char *cfgfile); +extern bool execfile(const char *cfgfile); +extern void alias(const char *name, const char *action); +extern const char *getalias(const char *name); + +// console + +enum +{ + CON_INFO = 1<<0, + CON_WARN = 1<<1, + CON_ERROR = 1<<2, + CON_DEBUG = 1<<3, + CON_INIT = 1<<4, + CON_ECHO = 1<<5 +}; + +extern void keypress(int code, bool isdown, int cooked); +extern int rendercommand(int x, int y, int w); +extern int renderconsole(int w, int h); +extern void conoutf(const char *s, ...); +extern void conoutf(int type, const char *s, ...); +extern void resetcomplete(); +extern void complete(char *s); + +// menus +extern vec menuinfrontofplayer(); +extern void newgui(char *name, char *contents, char *header = NULL); +extern void showgui(const char *name); + +// world +extern bool emptymap(int factor, bool force, const char *mname = ""); +extern bool enlargemap(bool force); +extern int findentity(int type, int index = 0, int attr1 = -1, int attr2 = -1); +extern void mpeditent(int i, const vec &o, int type, int attr1, int attr2, int attr3, int attr4, bool local); +extern int getworldsize(); +extern int getmapversion(); +extern void resettriggers(); +extern void checktriggers(); + +// main +struct igame; + +extern void fatal(const char *s, ...); +extern void keyrepeat(bool on); +extern void registergame(const char *name, igame *ig); + +#define REGISTERGAME(t, n, c, s) struct t : igame { t() { registergame(n, this); } igameclient *newclient() { return c; } igameserver *newserver() { return s; } } reg_##t + +// rendertext +extern bool setfont(const char *name); +extern void gettextres(int &w, int &h); +extern void draw_text(const char *str, int left, int top, int r = 255, int g = 255, int b = 255, int a = 255, int cursor = -1, int maxwidth = -1); +extern void draw_textf(const char *fstr, int left, int top, ...); +extern int text_width(const char *str); +extern void text_bounds(const char *str, int &width, int &height, int maxwidth = -1); +extern int text_visible(const char *str, int hitx, int hity, int maxwidth); +extern void text_pos(const char *str, int cursor, int &cx, int &cy, int maxwidth); + +// renderva +enum +{ + DL_SHRINK = 1<<0, + DL_EXPAND = 1<<1, + DL_FLASH = 1<<2 +}; + +extern void adddynlight(const vec &o, float radius, const vec &color, int fade = 0, int peak = 0, int flags = 0, float initradius = 0, const vec &initcolor = vec(0, 0, 0)); +extern void dynlightreaching(const vec &target, vec &color, vec &dir); + +// rendergl +extern vec worldpos, camdir, camright, camup; +extern void damageblend(int n); +extern void damagecompass(int n, const vec &loc); + +// renderparticles +extern void render_particles(int time); +extern void regular_particle_splash(int type, int num, int fade, const vec &p, int delay = 0); +extern void particle_splash(int type, int num, int fade, const vec &p); +extern void particle_trail(int type, int fade, const vec &from, const vec &to); +extern void particle_text(const vec &s, const char *t, int type, int fade = 2000); +extern void particle_meter(const vec &s, float val, int type, int fade = 1); +extern void particle_flare(const vec &p, const vec &dest, int fade, int type = 10, physent *owner = NULL); +extern void particle_fireball(const vec &dest, float max, int type, int fade = -1); +extern void removetrackedparticles(physent *owner = NULL); + +// decal +enum +{ + DECAL_SCORCH = 0, + DECAL_BLOOD, + DECAL_BULLET +}; + +extern void adddecal(int type, const vec ¢er, const vec &surface, float radius, const bvec &color = bvec(0xFF, 0xFF, 0xFF), int info = 0); + +// worldio +extern bool load_world(const char *mname, const char *cname = NULL); +extern bool save_world(const char *mname, bool nolms = false); + +// physics +extern void moveplayer(physent *pl, int moveres, bool local); +extern bool moveplayer(physent *pl, int moveres, bool local, int curtime); +extern bool collide(physent *d, const vec &dir = vec(0, 0, 0), float cutoff = 0.0f, bool playercol = true); +extern bool bounce(physent *d, float secs, float elasticity, float waterfric); +extern bool bounce(physent *d, float elasticity, float waterfric); +extern void avoidcollision(physent *d, const vec &dir, physent *obstacle, float space); +extern void physicsframe(); +extern void dropenttofloor(entity *e); +extern bool droptofloor(vec &o, float radius, float height); + +extern void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m); +extern void vectoyawpitch(const vec &v, float &yaw, float &pitch); +extern bool intersect(physent *d, vec &from, vec &to); +extern bool moveplatform(physent *p, const vec &dir); +extern void updatephysstate(physent *d); +extern void cleardynentcache(); +extern void updatedynentcache(physent *d); +extern bool entinmap(dynent *d, bool avoidplayers = false); +extern void findplayerspawn(dynent *d, int forceent = -1, int tag = 0); + +// sound +extern void playsound (int n, const vec *loc = NULL, extentity *ent = NULL); +extern void playsoundname(const char *s, const vec *loc = NULL, int vol = 0); +extern void initsound(); + + +// rendermodel +enum { MDL_CULL_VFC = 1<<0, MDL_CULL_DIST = 1<<1, MDL_CULL_OCCLUDED = 1<<2, MDL_CULL_QUERY = 1<<3, MDL_SHADOW = 1<<4, MDL_DYNSHADOW = 1<<5, MDL_LIGHT = 1<<6, MDL_DYNLIGHT = 1<<7, MDL_TRANSLUCENT = 1<<8, MDL_FULLBRIGHT = 1<<9 }; + +struct model; +struct modelattach +{ + const char *name, *tag; + int anim, basetime; + model *m; +}; + +extern void startmodelbatches(); +extern void endmodelbatches(); +extern void rendermodel(entitylight *light, const char *mdl, int anim, const vec &o, float yaw = 0, float pitch = 0, int cull = MDL_CULL_VFC | MDL_CULL_DIST | MDL_CULL_OCCLUDED | MDL_LIGHT, dynent *d = NULL, modelattach *a = NULL, int basetime = 0, float speed = 0); +extern void abovemodel(vec &o, const char *mdl); +extern void rendershadow(dynent *d); +extern void renderclient(dynent *d, const char *mdlname, modelattach *attachments, int attack, int attackdelay, int lastaction, int lastpain, float sink = 0); +extern void interpolateorientation(dynent *d, float &interpyaw, float &interppitch); +extern void setbbfrommodel(dynent *d, const char *mdl); +extern const char *mapmodelname(int i); +extern model *loadmodel(const char *name, int i = -1, bool msg = false); + +// server +#define MAXCLIENTS 256 // in a multiplayer game, can be arbitrarily changed +#define MAXTRANS 5000 // max amount of data to swallow in 1 go + +extern int maxclients; + +enum { DISC_NONE = 0, DISC_EOP, DISC_CN, DISC_KICK, DISC_TAGT, DISC_IPBAN, DISC_PRIVATE, DISC_MAXCLIENTS, DISC_NUM }; + +extern void *getinfo(int i); +extern void sendf(int cn, int chan, const char *format, ...); +extern void sendfile(int cn, int chan, FILE *file, const char *format = "", ...); +extern void sendpacket(int cn, int chan, ENetPacket *packet, int exclude = -1); +extern int getnumclients(); +extern uint getclientip(int n); +extern void putint(ucharbuf &p, int n); +extern int getint(ucharbuf &p); +extern void putuint(ucharbuf &p, int n); +extern int getuint(ucharbuf &p); +extern void sendstring(const char *t, ucharbuf &p); +extern void getstring(char *t, ucharbuf &p, int len = MAXTRANS); +extern void filtertext(char *dst, const char *src, bool whitespace = true, int len = sizeof(string)-1); +extern void disconnect_client(int n, int reason); +extern bool hasnonlocalclients(); +extern bool haslocalclients(); +extern void sendserverinforeply(ucharbuf &p); + +// client +extern void c2sinfo(dynent *d, int rate = 33); +extern void sendpackettoserv(ENetPacket *packet, int chan); +extern void disconnect(int onlyclean = 0, int async = 0); +extern bool isconnected(); +extern bool multiplayer(bool msg = true); +extern void neterr(const char *s); +extern void gets2c(); + +// 3dgui +struct Texture; + +enum { G3D_DOWN = 1, G3D_UP = 2, G3D_PRESSED = 4, G3D_ROLLOVER = 8, G3D_DRAGGED = 16 }; + +enum { EDITORFOCUSED = 1, EDITORUSED, EDITORFOREVER }; + +struct g3d_gui +{ + virtual ~g3d_gui() {} + + virtual void start(int starttime, float basescale, int *tab = NULL, bool allowinput = true) = 0; + virtual void end() = 0; + + virtual int text(const char *text, int color, const char *icon = NULL) = 0; + int textf(const char *fmt, int color, const char *icon = NULL, ...) + { + s_sprintfdlv(str, icon, fmt); + return text(str, color, icon); + } + virtual int button(const char *text, int color, const char *icon = NULL) = 0; + int buttonf(const char *fmt, int color, const char *icon = NULL, ...) + { + s_sprintfdlv(str, icon, fmt); + return button(str, color, icon); + } + virtual void background(int color, int parentw = 0, int parenth = 0) = 0; + + virtual void pushlist() {} + virtual void poplist() {} + + virtual void allowautotab(bool on) = 0; + virtual bool shouldtab() { return false; } + virtual void tab(const char *name = NULL, int color = 0) = 0; + virtual int title(const char *text, int color, const char *icon = NULL) = 0; + virtual int image(Texture *t, float scale, bool overlaid = false) = 0; + virtual int texture(Texture *t, float scale, int rotate = 0, int xoff = 0, int yoff = 0, Texture *glowtex = NULL, const vec &glowcolor = vec(1, 1, 1)) = 0; + virtual void slider(int &val, int vmin, int vmax, int color, char *label = NULL) = 0; + virtual void separator() = 0; + virtual void progress(float percent) = 0; + virtual void strut(int size) = 0; + virtual void space(int size) = 0; + virtual char *field(const char *name, int color, int length, int height = 0, const char *initval = NULL, int initmode = EDITORFOCUSED) = 0; + virtual void mergehits(bool on) = 0; +}; + +struct g3d_callback +{ + virtual ~g3d_callback() {} + + int starttime() { extern int totalmillis; return totalmillis; } + + virtual void gui(g3d_gui &g, bool firstpass) = 0; +}; + +enum +{ + GUI_2D = 1<<0, + GUI_FOLLOW = 1<<1, + GUI_FORCE_2D = 1<<2 +}; + +extern void g3d_addgui(g3d_callback *cb, vec &origin, int flags = 0); +extern bool g3d_movecursor(int dx, int dy); +extern void g3d_cursorpos(float &x, float &y); +extern void g3d_resetcursor(); +extern void g3d_limitscale(float scale); + diff --git a/src/shared/igame.h b/src/shared/igame.h new file mode 100644 index 0000000..0ce936d --- /dev/null +++ b/src/shared/igame.h @@ -0,0 +1,121 @@ +// the interface the engine uses to run the gameplay module + +struct icliententities +{ + virtual ~icliententities() {} + + virtual void editent(int i) = 0; + virtual const char *entnameinfo(entity &e) = 0; + virtual const char *entname(int i) = 0; + virtual int extraentinfosize() = 0; + virtual void writeent(entity &e, char *buf) = 0; + virtual void readent(entity &e, char *buf) = 0; + virtual float dropheight(entity &e) = 0; + virtual void rumble(const extentity &e) = 0; + virtual void trigger(extentity &e) = 0; + virtual void fixentity(extentity &e) = 0; + virtual void entradius(extentity &e, float &radius, float &angle, vec &dir) {} + virtual bool mayattach(extentity &e) { return false; } + virtual bool attachent(extentity &e, extentity &a) { return false; } + virtual extentity *newentity() = 0; + virtual vector &getents() = 0; +}; + +struct iclientcom +{ + virtual ~iclientcom() {} + + virtual void gamedisconnect() = 0; + virtual void parsepacketclient(int chan, ucharbuf &p) = 0; + virtual int sendpacketclient(ucharbuf &p, bool &reliable, dynent *d) = 0; + virtual void gameconnect(bool _remote) = 0; + virtual bool allowedittoggle() = 0; + virtual void edittoggled(bool on) {} + virtual void writeclientinfo(FILE *f) = 0; + virtual void toserver(char *text) = 0; + virtual void changemap(const char *name) = 0; + virtual int numchannels() { return 1; } +}; + +struct igameclient +{ + virtual ~igameclient() {} + + virtual const char *gameident() = 0; + virtual const char *defaultmap() = 0; + virtual const char *savedconfig() = 0; + virtual const char *defaultconfig() = 0; + virtual const char *autoexec() = 0; + virtual const char *savedservers() { return NULL; } + + virtual icliententities *getents() = 0; + virtual iclientcom *getcom() = 0; + + virtual bool clientoption(char *arg) { return false; } + virtual void updateworld(vec &pos, int curtime, int lm) = 0; + virtual void initclient() = 0; + virtual void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material = 0) = 0; + virtual void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0) = 0; + virtual char *getclientmap() = 0; + virtual void resetgamestate() = 0; + virtual void suicide(physent *d) = 0; + virtual void newmap(int size) = 0; + virtual void startmap(const char *name) = 0; + virtual void preload() {} + virtual float abovegameplayhud() { return 1.0f; } + virtual void gameplayhud(int w, int h) = 0; + virtual void drawhudgun() = 0; + virtual bool canjump() = 0; + virtual bool allowmove(physent *d) { return true; } + virtual void doattack(bool on) = 0; + virtual dynent *iterdynents(int i) = 0; + virtual int numdynents() = 0; + virtual void rendergame() = 0; + virtual void writegamedata(vector &extras) = 0; + virtual void readgamedata(vector &extras) = 0; + virtual void g3d_gamemenus() = 0; + virtual const char *defaultcrosshair(int index) { return NULL; } + virtual int selectcrosshair(float &r, float &g, float &b) { return 0; } + virtual void lighteffects(dynent *d, vec &color, vec &dir) {} + virtual void setupcamera() {} + virtual bool detachcamera() { return false; } + virtual void adddynlights() {} + virtual void particletrack(physent *owner, vec &o, vec &d) {} + virtual bool serverinfostartcolumn(g3d_gui *g, int i) { return false; } + virtual void serverinfoendcolumn(g3d_gui *g, int i) {} + virtual bool serverinfoentry(g3d_gui *g, int i, const char *name, const char *desc, const char *map, int ping, const vector &attr, int np) { return false; }; +}; + +struct igameserver +{ + virtual ~igameserver() {} + + virtual bool serveroption(char *arg) { return false; } + virtual void *newinfo() = 0; + virtual void deleteinfo(void *ci) = 0; + virtual void serverinit() = 0; + virtual void clientdisconnect(int n) = 0; + virtual int clientconnect(int n, uint ip) = 0; + virtual void localdisconnect(int n) = 0; + virtual void localconnect(int n) = 0; + virtual const char *servername() = 0; + virtual void recordpacket(int chan, void *data, int len) {} + virtual void parsepacket(int sender, int chan, bool reliable, ucharbuf &p) = 0; + virtual bool sendpackets() = 0; + virtual int welcomepacket(ucharbuf &p, int n, ENetPacket *packet) = 0; + virtual void serverinforeply(ucharbuf &req, ucharbuf &p) = 0; + virtual void serverupdate(int lastmillis, int totalmillis) = 0; + virtual bool servercompatible(char *name, char *sdec, char *map, int ping, const vector &attr, int np) = 0; + virtual int serverinfoport() = 0; + virtual int serverport() = 0; + virtual const char *getdefaultmaster() = 0; + virtual void sendservmsg(const char *s) = 0; +}; + +struct igame +{ + virtual ~igame() {} + + virtual igameclient *newclient() = 0; + virtual igameserver *newserver() = 0; +}; diff --git a/src/shared/pch.cpp b/src/shared/pch.cpp new file mode 100644 index 0000000..1d9f38c --- /dev/null +++ b/src/shared/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/src/shared/pch.h b/src/shared/pch.h new file mode 100644 index 0000000..7330680 --- /dev/null +++ b/src/shared/pch.h @@ -0,0 +1,58 @@ +#ifdef __GNUC__ +#define gamma __gamma +#endif + +#include + +#ifdef __GNUC__ +#undef gamma +#endif + +#include +#include +#include +#include +#include +#include +#include +#ifdef __GNUC__ +#include +#else +#include +#endif +#include + +#ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#include "windows.h" +#endif + +#ifndef STANDALONE +#include +#include + +#define GL_GLEXT_LEGACY +#define __glext_h__ +#define NO_SDL_GLEXT +#include +#undef __glext_h__ +#include "GL/glext.h" +#endif + +#include + +#ifdef WIN32 + #define _WINDOWS + #ifndef __GNUC__ + #define ZLIB_DLL + #include + #include + #endif +#endif +#include + +#ifdef __sun__ +#undef sun +#undef MAXNAMELEN +#endif + diff --git a/src/shared/sbtrace.d b/src/shared/sbtrace.d new file mode 100644 index 0000000..228219a --- /dev/null +++ b/src/shared/sbtrace.d @@ -0,0 +1,21 @@ + +/* + * DTrace Sauerbraten provider + */ +/* +#pragma D attributes Evolving/Evolving/Common provider myserv provider +#pragma D attributes Evolving/Evolving/Common provider myserv module +#pragma D attributes Evolving/Evolving/Common provider myserv function +#pragma D attributes Evolving/Evolving/Common provider myserv name +#pragma D attributes Evolving/Evolving/Common provider myserv args +*/ + +provider sauerbraten { + probe command__entry(char *, char *, char *, char *); + probe command__return(char *); + probe var__entry(char *, char *); + probe var__return(char *, int); + probe alias__entry(char *, char *, char *, char *); + probe alias__return(char *); +}; + diff --git a/src/shared/sbtrace.h b/src/shared/sbtrace.h new file mode 100644 index 0000000..44e2e24 --- /dev/null +++ b/src/shared/sbtrace.h @@ -0,0 +1,79 @@ +/* + * Generated by dtrace(1M). + */ + +#ifndef _SBTRACE_H +#define _SBTRACE_H + +#ifndef WIN32 +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if _DTRACE_VERSION + +#define SAUERBRATEN_ALIAS_ENTRY(arg0, arg1, arg2, arg3) \ + __dtrace_sauerbraten___alias__entry(arg0, arg1, arg2, arg3) +#define SAUERBRATEN_ALIAS_ENTRY_ENABLED() \ + __dtraceenabled_sauerbraten___alias__entry() +#define SAUERBRATEN_ALIAS_RETURN(arg0) \ + __dtrace_sauerbraten___alias__return(arg0) +#define SAUERBRATEN_ALIAS_RETURN_ENABLED() \ + __dtraceenabled_sauerbraten___alias__return() +#define SAUERBRATEN_COMMAND_ENTRY(arg0, arg1, arg2, arg3) \ + __dtrace_sauerbraten___command__entry(arg0, arg1, arg2, arg3) +#define SAUERBRATEN_COMMAND_ENTRY_ENABLED() \ + __dtraceenabled_sauerbraten___command__entry() +#define SAUERBRATEN_COMMAND_RETURN(arg0) \ + __dtrace_sauerbraten___command__return(arg0) +#define SAUERBRATEN_COMMAND_RETURN_ENABLED() \ + __dtraceenabled_sauerbraten___command__return() +#define SAUERBRATEN_VAR_ENTRY(arg0, arg1) \ + __dtrace_sauerbraten___var__entry(arg0, arg1) +#define SAUERBRATEN_VAR_ENTRY_ENABLED() \ + __dtraceenabled_sauerbraten___var__entry() +#define SAUERBRATEN_VAR_RETURN(arg0, arg1) \ + __dtrace_sauerbraten___var__return(arg0, arg1) +#define SAUERBRATEN_VAR_RETURN_ENABLED() \ + __dtraceenabled_sauerbraten___var__return() + + +extern void __dtrace_sauerbraten___alias__entry(char *, char *, char *, char *); +extern int __dtraceenabled_sauerbraten___alias__entry(void); +extern void __dtrace_sauerbraten___alias__return(char *); +extern int __dtraceenabled_sauerbraten___alias__return(void); +extern void __dtrace_sauerbraten___command__entry(char *, char *, char *, char *); +extern int __dtraceenabled_sauerbraten___command__entry(void); +extern void __dtrace_sauerbraten___command__return(char *); +extern int __dtraceenabled_sauerbraten___command__return(void); +extern void __dtrace_sauerbraten___var__entry(char *, char *); +extern int __dtraceenabled_sauerbraten___var__entry(void); +extern void __dtrace_sauerbraten___var__return(char *, int); +extern int __dtraceenabled_sauerbraten___var__return(void); + +#else + +#define SAUERBRATEN_ALIAS_ENTRY(arg0, arg1, arg2, arg3) +#define SAUERBRATEN_ALIAS_ENTRY_ENABLED() (0) +#define SAUERBRATEN_ALIAS_RETURN(arg0) +#define SAUERBRATEN_ALIAS_RETURN_ENABLED() (0) +#define SAUERBRATEN_COMMAND_ENTRY(arg0, arg1, arg2, arg3) +#define SAUERBRATEN_COMMAND_ENTRY_ENABLED() (0) +#define SAUERBRATEN_COMMAND_RETURN(arg0) +#define SAUERBRATEN_COMMAND_RETURN_ENABLED() (0) +#define SAUERBRATEN_VAR_ENTRY(arg0, arg1) +#define SAUERBRATEN_VAR_ENTRY_ENABLED() (0) +#define SAUERBRATEN_VAR_RETURN(arg0, arg1) +#define SAUERBRATEN_VAR_RETURN_ENABLED() (0) + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _SBTRACE_H */ diff --git a/src/shared/tools.cpp b/src/shared/tools.cpp new file mode 100644 index 0000000..f451b21 --- /dev/null +++ b/src/shared/tools.cpp @@ -0,0 +1,328 @@ +// implementation of generic tools + +#include "pch.h" +#include "tools.h" + +///////////////////////// file system /////////////////////// + +#ifndef WIN32 +#include +#include +#include +#include +#endif + +string homedir = ""; +vector packagedirs; + +char *makerelpath(const char *dir, const char *file, const char *prefix) +{ + static string tmp; + if(prefix) s_strcpy(tmp, prefix); + else tmp[0] = '\0'; + if(file[0]=='<') + { + const char *end = strrchr(file, '>'); + if(end) + { + size_t len = strlen(tmp); + s_strncpy(&tmp[len], file, min(sizeof(tmp)-len, size_t(end+2-file))); + file = end+1; + } + } + s_sprintfd(pname)("%s/%s", dir, file); + s_strcat(tmp, pname); + return tmp; +} + +char *path(char *s) +{ + for(char *curpart = s;;) + { + char *endpart = strchr(curpart, '&'); + if(endpart) *endpart = '\0'; + if(curpart[0]=='<') + { + char *file = strrchr(curpart, '>'); + if(!file) return s; + curpart = file+1; + } + for(char *t = curpart; (t = strpbrk(t, "/\\")); *t++ = PATHDIV); + for(char *prevdir = NULL, *curdir = s;;) + { + prevdir = curdir[0]==PATHDIV ? curdir+1 : curdir; + curdir = strchr(prevdir, PATHDIV); + if(!curdir) break; + if(prevdir+1==curdir && prevdir[0]=='.') + { + memmove(prevdir, curdir+1, strlen(curdir+1)+1); + curdir = prevdir; + } + else if(curdir[1]=='.' && curdir[2]=='.' && curdir[3]==PATHDIV) + { + if(prevdir+2==curdir && prevdir[0]=='.' && prevdir[1]=='.') continue; + memmove(prevdir, curdir+4, strlen(curdir+4)+1); + curdir = prevdir; + } + } + if(endpart) + { + *endpart = '&'; + curpart = endpart+1; + } + else break; + } + return s; +} + +char *path(const char *s, bool copy) +{ + static string tmp; + s_strcpy(tmp, s); + path(tmp); + return tmp; +} + +const char *parentdir(const char *directory) +{ + const char *p = strrchr(directory, '/'); + if(!p) p = strrchr(directory, '\\'); + if(!p) p = directory; + static string parent; + size_t len = p-directory+1; + s_strncpy(parent, directory, len); + return parent; +} + +bool fileexists(const char *path, const char *mode) +{ + bool exists = true; + if(mode[0]=='w' || mode[0]=='a') path = parentdir(path); +#ifdef WIN32 + if(GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES) exists = false; +#else + if(access(path, R_OK | (mode[0]=='w' || mode[0]=='a' ? W_OK : 0)) == -1) exists = false; +#endif + return exists; +} + +bool createdir(const char *path) +{ + size_t len = strlen(path); + if(path[len-1]==PATHDIV) + { + static string strip; + path = s_strncpy(strip, path, len); + } +#ifdef WIN32 + return CreateDirectory(path, NULL)!=0; +#else + return mkdir(path, 0777)==0; +#endif +} + +static void fixdir(char *dir) +{ + path(dir); + size_t len = strlen(dir); + if(dir[len-1]!=PATHDIV) + { + dir[len] = PATHDIV; + dir[len+1] = '\0'; + } +} + +void sethomedir(const char *dir) +{ + fixdir(s_strcpy(homedir, dir)); +} + +void addpackagedir(const char *dir) +{ + fixdir(packagedirs.add(newstringbuf(dir))); +} + +const char *findfile(const char *filename, const char *mode) +{ + static string s; + if(homedir[0]) + { + s_sprintf(s)("%s%s", homedir, filename); + if(fileexists(s, mode)) return s; + if(mode[0]=='w' || mode[0]=='a') + { + string dirs; + s_strcpy(dirs, s); + char *dir = strchr(dirs[0]==PATHDIV ? dirs+1 : dirs, PATHDIV); + while(dir) + { + *dir = '\0'; + if(!fileexists(dirs, "r") && !createdir(dirs)) return s; + *dir = PATHDIV; + dir = strchr(dir+1, PATHDIV); + } + return s; + } + } + if(mode[0]=='w' || mode[0]=='a') return filename; + loopv(packagedirs) + { + s_sprintf(s)("%s%s", packagedirs[i], filename); + if(fileexists(s, mode)) return s; + } + return filename; +} + +FILE *openfile(const char *filename, const char *mode) +{ + const char *found = findfile(filename, mode); + if(!found) return NULL; + return fopen(found, mode); +} + +gzFile opengzfile(const char *filename, const char *mode) +{ + const char *found = findfile(filename, mode); + if(!found) return NULL; + return gzopen(found, mode); +} + +char *loadfile(const char *fn, int *size) +{ + FILE *f = openfile(fn, "rb"); + if(!f) return NULL; + fseek(f, 0, SEEK_END); + int len = ftell(f); + if(len<=0) { fclose(f); return NULL; } + fseek(f, 0, SEEK_SET); + char *buf = new char[len+1]; + if(!buf) { fclose(f); return NULL; } + buf[len] = 0; + size_t rlen = fread(buf, 1, len, f); + fclose(f); + if(size_t(len)!=rlen) + { + delete[] buf; + return NULL; + } + if(size!=NULL) *size = len; + return buf; +} + +bool listdir(const char *dir, const char *ext, vector &files) +{ + int extsize = ext ? (int)strlen(ext)+1 : 0; + #if defined(WIN32) + s_sprintfd(pathname)("%s\\*.%s", dir, ext ? ext : "*"); + WIN32_FIND_DATA FindFileData; + HANDLE Find = FindFirstFile(path(pathname), &FindFileData); + if(Find != INVALID_HANDLE_VALUE) + { + do { + files.add(newstring(FindFileData.cFileName, (int)strlen(FindFileData.cFileName) - extsize)); + } while(FindNextFile(Find, &FindFileData)); + return true; + } + #else + string pathname; + s_strcpy(pathname, dir); + DIR *d = opendir(path(pathname)); + if(d) + { + struct dirent *de; + while((de = readdir(d)) != NULL) + { + if(!ext) files.add(newstring(de->d_name)); + else + { + int namelength = (int)strlen(de->d_name) - extsize; + if(namelength > 0 && de->d_name[namelength] == '.' && strncmp(de->d_name+namelength+1, ext, extsize-1)==0) + files.add(newstring(de->d_name, namelength)); + } + } + closedir(d); + return true; + } + #endif + else return false; +} + +int listfiles(const char *dir, const char *ext, vector &files) +{ + int dirs = 0; + if(listdir(dir, ext, files)) dirs++; + string s; + if(homedir[0]) + { + s_sprintf(s)("%s%s", homedir, dir); + if(listdir(s, ext, files)) dirs++; + } + loopv(packagedirs) + { + s_sprintf(s)("%s%s", packagedirs[i], dir); + if(listdir(s, ext, files)) dirs++; + } + return dirs; +} + +///////////////////////// misc tools /////////////////////// + +void endianswap(void *memory, int stride, int length) // little endian as storage format +{ + static const int littleendian = 1; + if(!*(const char *)&littleendian) loop(w, length) loop(i, stride/2) + { + uchar *p = (uchar *)memory+w*stride; + uchar t = p[i]; + p[i] = p[stride-i-1]; + p[stride-i-1] = t; + } +} + + +////////////////////////// rnd numbers //////////////////////////////////////// + +#define N (624) +#define M (397) +#define K (0x9908B0DFU) +#define hiBit(u) ((u) & 0x80000000U) +#define loBit(u) ((u) & 0x00000001U) +#define loBits(u) ((u) & 0x7FFFFFFFU) +#define mixBits(u, v) (hiBit(u)|loBits(v)) + +static uint state[N+1]; +static uint *next; +static int left = -1; + +void seedMT(uint seed) +{ + register uint x = (seed | 1U) & 0xFFFFFFFFU, *s = state; + register int j; + for(left=0, *s++=x, j=N; --j; *s++ = (x*=69069U) & 0xFFFFFFFFU); +} + +uint reloadMT(void) +{ + register uint *p0=state, *p2=state+2, *pM=state+M, s0, s1; + register int j; + if(left < -1) seedMT(time(NULL)); + left=N-1, next=state+1; + for(s0=state[0], s1=state[1], j=N-M+1; --j; s0=s1, s1=*p2++) *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U); + for(pM=state, j=M; --j; s0=s1, s1=*p2++) *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U); + s1=state[0], *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U); + s1 ^= (s1 >> 11); + s1 ^= (s1 << 7) & 0x9D2C5680U; + s1 ^= (s1 << 15) & 0xEFC60000U; + return(s1 ^ (s1 >> 18)); +} + +uint randomMT(void) +{ + uint y; + if(--left < 0) return(reloadMT()); + y = *next++; + y ^= (y >> 11); + y ^= (y << 7) & 0x9D2C5680U; + y ^= (y << 15) & 0xEFC60000U; + return(y ^ (y >> 18)); +} diff --git a/src/shared/tools.h b/src/shared/tools.h new file mode 100644 index 0000000..05f14db --- /dev/null +++ b/src/shared/tools.h @@ -0,0 +1,648 @@ +// generic useful stuff for any C++ program + +#ifndef _TOOLS_H +#define _TOOLS_H + +#ifdef NULL +#undef NULL +#endif +#define NULL 0 + +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; + +#ifdef _DEBUG +#ifdef __GNUC__ +#define ASSERT(c) if(!(c)) { asm("int $3"); } +#else +#define ASSERT(c) if(!(c)) { __asm int 3 } +#endif +#else +#define ASSERT(c) if(c) {} +#endif + +#ifdef swap +#undef swap +#endif +template +static inline void swap(T &a, T &b) +{ + T t = a; + a = b; + b = t; +} +#ifdef max +#undef max +#endif +#ifdef min +#undef min +#endif +template +static inline T max(T a, T b) +{ + return a > b ? a : b; +} +template +static inline T min(T a, T b) +{ + return a < b ? a : b; +} + +#define clamp(a,b,c) (max(b, min(a, c))) +#define rnd(x) ((int)(randomMT()&0xFFFFFF)%(x)) +#define detrnd(s, x) ((int)(((((uint)(s))*1103515245+12345)>>16)%(x))) + +#define loop(v,m) for(int v = 0; v=0; i--) + +template +struct databuf +{ + enum + { + OVERREAD = 1<<0, + OVERWROTE = 1<<1 + }; + + T *buf; + int len, maxlen; + uchar flags; + + template + databuf(T *buf, U maxlen) : buf(buf), len(0), maxlen((int)maxlen), flags(0) {} + + const T &get() + { + static T overreadval; + if(len charbuf; +typedef databuf ucharbuf; + +template struct vector +{ + static const int MINSIZE = 8; + + T *buf; + int alen, ulen; + + vector() : buf(NULL), alen(0), ulen(0) + { + } + + vector(const vector &v) : buf(NULL), alen(0), ulen(0) + { + *this = v; + } + + ~vector() { setsize(0); if(buf) delete[] (uchar *)buf; } + + vector &operator=(const vector &v) + { + setsize(0); + if(v.length() > alen) vrealloc(v.length()); + loopv(v) add(v[i]); + return *this; + } + + T &add(const T &x) + { + if(ulen==alen) vrealloc(ulen+1); + new (&buf[ulen]) T(x); + return buf[ulen++]; + } + + T &add() + { + if(ulen==alen) vrealloc(ulen+1); + new (&buf[ulen]) T; + return buf[ulen++]; + } + + T &dup() + { + if(ulen==alen) vrealloc(ulen+1); + new (&buf[ulen]) T(buf[ulen-1]); + return buf[ulen++]; + } + + void move(vector &v) + { + if(!ulen) + { + swap(buf, v.buf); + swap(ulen, v.ulen); + swap(alen, v.alen); + } + else + { + vrealloc(ulen+v.ulen); + if(v.ulen) memcpy(&buf[ulen], v.buf, v.ulen*sizeof(T)); + ulen += v.ulen; + v.ulen = 0; + } + } + + bool inrange(size_t i) const { return i=0 && i=0 && i= 0 && ii) drop(); } + void setsizenodelete(int i) { ASSERT(i<=ulen); ulen = i; } + + void deletecontentsp() { while(!empty()) delete pop(); } + void deletecontentsa() { while(!empty()) delete[] pop(); } + + T *getbuf() { return buf; } + const T *getbuf() const { return buf; } + + template + void sort(int (__cdecl *cf)(ST *, ST *), int i = 0, int n = -1) + { + qsort(&buf[i], n<0 ? ulen : n, sizeof(T), (int (__cdecl *)(const void *,const void *))cf); + } + + void vrealloc(int sz) + { + int olen = alen; + if(!alen) alen = max(MINSIZE, sz); + else while(alen < sz) alen *= 2; + if(alen <= olen) return; + uchar *newbuf = new uchar[alen*sizeof(T)]; + if(olen > 0) + { + memcpy(newbuf, buf, olen*sizeof(T)); + delete[] (uchar *)buf; + } + buf = (T *)newbuf; + } + + databuf reserve(int sz) + { + if(ulen+sz > alen) vrealloc(ulen+sz); + return databuf(&buf[ulen], sz); + } + + void advance(int sz) + { + ulen += sz; + } + + void addbuf(const databuf &p) + { + advance(p.length()); + } + + void put(const T *v, int n) + { + databuf buf = reserve(n); + buf.put(v, n); + addbuf(buf); + } + + void remove(int i, int n) + { + for(int p = i+n; p + int find(const U &o) + { + loopi(ulen) if(buf[i]==o) return i; + return -1; + } + + void removeobj(const T &o) + { + loopi(ulen) if(buf[i]==o) remove(i--); + } + + void replacewithlast(const T &o) + { + if(!ulen) return; + loopi(ulen-1) if(buf[i]==o) + { + buf[i] = buf[ulen-1]; + } + ulen--; + } + + T &insert(int i, const T &e) + { + add(T()); + for(int p = ulen-1; p>i; p--) buf[p] = buf[p-1]; + buf[i] = e; + return buf[i]; + } + + T *insert(int i, const T *e, int n) + { + if(ulen+n>alen) vrealloc(ulen+n); + loopj(n) add(T()); + for(int p = ulen-1; p>=i+n; p--) buf[p] = buf[p-n]; + loopj(n) buf[i+j] = e[j]; + return &buf[i]; + } + + void reverse() + { + loopi(ulen/2) swap(buf[i], buf[ulen-1-i]); + } +}; + +typedef vector cvector; +typedef vector ivector; +typedef vector usvector; + +static inline uint hthash(const char *key) +{ + uint h = 5381; + for(int i = 0, k; (k = key[i]); i++) h = ((h<<5)+h)^k; // bernstein k=33 xor + return h; +} + +static inline bool htcmp(const char *x, const char *y) +{ + return !strcmp(x, y); +} + +static inline uint hthash(int key) +{ + return key; +} + +static inline bool htcmp(int x, int y) +{ + return x==y; +} + +template struct hashtable +{ + typedef K key; + typedef const K const_key; + typedef T value; + typedef const T const_value; + + enum { CHUNKSIZE = 64 }; + + struct chain { T data; K key; chain *next; }; + struct chainchunk { chain chains[CHUNKSIZE]; chainchunk *next; }; + + int size; + int numelems; + chain **table; + chain *enumc; + + chainchunk *chunks; + chain *unused; + + hashtable(int size = 1<<10) + : size(size) + { + numelems = 0; + chunks = NULL; + unused = NULL; + table = new chain *[size]; + loopi(size) table[i] = NULL; + } + + ~hashtable() + { + DELETEA(table); + } + + chain *insert(const K &key, uint h) + { + if(!unused) + { + chainchunk *chunk = new chainchunk; + chunk->next = chunks; + chunks = chunk; + loopi(CHUNKSIZE-1) chunk->chains[i].next = &chunk->chains[i+1]; + chunk->chains[CHUNKSIZE-1].next = unused; + unused = chunk->chains; + } + chain *c = unused; + unused = unused->next; + c->key = key; + c->next = table[h]; + table[h] = c; + numelems++; + return c; + } + + chain *find(const K &key, bool doinsert) + { + uint h = hthash(key)&(size-1); + for(chain *c = table[h]; c; c = c->next) + { + if(htcmp(key, c->key)) return c; + } + if(doinsert) return insert(key, h); + return NULL; + } + + T *access(const K &key, const T *data = NULL) + { + chain *c = find(key, data != NULL); + if(data) c->data = *data; + if(c) return &c->data; + return NULL; + } + + T &operator[](const K &key) + { + return find(key, true)->data; + } + + bool remove(const K &key) + { + uint h = hthash(key)&(size-1); + for(chain **p = &table[h], *c = table[h]; c; p = &c->next, c = c->next) + { + if(htcmp(key, c->key)) + { + *p = c->next; + c->data.~T(); + c->key.~K(); + new (&c->data) T; + new (&c->key) K; + c->next = unused; + unused = c->next; + numelems--; + return true; + } + } + return false; + } + + void clear() + { + if(!numelems) return; + loopi(size) table[i] = NULL; + numelems = 0; + unused = NULL; + for(chainchunk *nextchunk; chunks; chunks = nextchunk) + { + nextchunk = chunks->next; + delete chunks; + } + } +}; + +#define enumeratekt(ht,k,e,t,f,b) loopi((ht).size) for(hashtable::chain *enumc = (ht).table[i]; enumc; enumc = enumc->next) { hashtable::const_key &e = enumc->key; t &f = enumc->data; b; } +#define enumerate(ht,t,e,b) loopi((ht).size) for((ht).enumc = (ht).table[i]; (ht).enumc; (ht).enumc = (ht).enumc->next) { t &e = (ht).enumc->data; b; } + +struct unionfind +{ + struct ufval + { + int rank, next; + + ufval() : rank(0), next(-1) {} + }; + + vector ufvals; + + int find(int k) + { + if(k>=ufvals.length()) return k; + while(ufvals[k].next>=0) k = ufvals[k].next; + return k; + } + + int compressfind(int k) + { + if(ufvals[k].next<0) return k; + return ufvals[k].next = compressfind(ufvals[k].next); + } + + void unite (int x, int y) + { + while(ufvals.length() <= max(x, y)) ufvals.add(); + x = compressfind(x); + y = compressfind(y); + if(x==y) return; + ufval &xval = ufvals[x], &yval = ufvals[y]; + if(xval.rank < yval.rank) xval.next = y; + else + { + yval.next = x; + if(xval.rank==yval.rank) yval.rank++; + } + } +}; + +template struct ringbuf +{ + int index, len; + T data[SIZE]; + + ringbuf() { clear(); } + + void clear() + { + index = len = 0; + } + + bool empty() const { return !len; } + + const int length() const { return len; } + + T &add(const T &e) + { + T &t = data[index]; + t = e; + index++; + if(index>=SIZE) index = 0; + if(len= SIZE) i -= SIZE; + return data[i]; + } + + const T &operator[](int i) const + { + int start = index - len; + if(start < 0) start += SIZE; + i += start; + if(i >= SIZE) i -= SIZE; + return data[i]; + } +}; + +inline char *newstring(size_t l) { return new char[l+1]; } +inline char *newstring(const char *s, size_t l) { return s_strncpy(newstring(l), s, l+1); } +inline char *newstring(const char *s) { return newstring(s, strlen(s)); } +inline char *newstringbuf(const char *s) { return newstring(s, MAXSTRLEN-1); } + +#if defined(WIN32) && !defined(__GNUC__) +#ifdef _DEBUG +//#define _CRTDBG_MAP_ALLOC +#include +inline void *__cdecl operator new(size_t n, const char *fn, int l) { return ::operator new(n, 1, fn, l); } +inline void __cdecl operator delete(void *p, const char *fn, int l) { ::operator delete(p, 1, fn, l); } +#define new new(__FILE__,__LINE__) +#endif +#endif + +extern char *makerelpath(const char *dir, const char *file, const char *prefix = NULL); +extern char *path(char *s); +extern char *path(const char *s, bool copy); +extern const char *parentdir(const char *directory); +extern bool fileexists(const char *path, const char *mode); +extern bool createdir(const char *path); +extern void sethomedir(const char *dir); +extern void addpackagedir(const char *dir); +extern const char *findfile(const char *filename, const char *mode); +extern FILE *openfile(const char *filename, const char *mode); +extern gzFile opengzfile(const char *filename, const char *mode); +extern char *loadfile(const char *fn, int *size); +extern bool listdir(const char *dir, const char *ext, vector &files); +extern int listfiles(const char *dir, const char *ext, vector &files); +extern void endianswap(void *, int, int); +extern void seedMT(uint seed); +extern uint randomMT(void); + +#endif + diff --git a/src/vcpp/CVS/Entries b/src/vcpp/CVS/Entries new file mode 100644 index 0000000..b909900 --- /dev/null +++ b/src/vcpp/CVS/Entries @@ -0,0 +1,8 @@ +/cube.vcproj/1.69/Sun May 25 15:28:11 2008// +/cube.vcproj.SMU.21490304.user/1.42/Thu Dec 13 10:43:25 2007// +/icon1.ico/1.1/Thu Oct 12 08:42:14 2006/-kb/ +/sauerbraten.nsi/1.6/Thu Oct 25 23:16:36 2007// +/sauerbraten.rc/1.3/Sun Apr 6 16:06:00 2008// +/sauerbraten.sln/1.2/Fri Oct 5 21:41:25 2007// +/sauerbraten.suo/1.140/Thu Jan 31 07:54:04 2008/-kb/ +D diff --git a/src/vcpp/CVS/Repository b/src/vcpp/CVS/Repository new file mode 100644 index 0000000..bfda021 --- /dev/null +++ b/src/vcpp/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/vcpp diff --git a/src/vcpp/CVS/Root b/src/vcpp/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/vcpp/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/vcpp/cube.vcproj b/src/vcpp/cube.vcproj new file mode 100644 index 0000000..76fe9d4 --- /dev/null +++ b/src/vcpp/cube.vcproj @@ -0,0 +1,1730 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/vcpp/cube.vcproj.SMU.21490304.user b/src/vcpp/cube.vcproj.SMU.21490304.user new file mode 100644 index 0000000..c06fdb1 --- /dev/null +++ b/src/vcpp/cube.vcproj.SMU.21490304.user @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + diff --git a/src/vcpp/icon1.ico b/src/vcpp/icon1.ico new file mode 100644 index 0000000000000000000000000000000000000000..722278bb5ee72b9d89d0414ea5f503b5867dd5f6 GIT binary patch literal 2998 zcwWVoF=!)46o#K{!KpAo8xkugyHIS)#6-oxG*)-mjs&p>4vcGe(%u^|LQ0+avEtfXCAzB|(7t)6z@``^y{c4k&0 z%FqOrN_is6(ytRli?}M4@I^WLHb?Z%B+*BlgFl96Q0HudhL(@rTg!c@)$%7kaMA1a zaORA4AF|e;_}~3LF^C$7#j+a>Uzn{%rs`s6L=Re&NyG?Y!}w{u0L$r+=mQRS zX=Ib_W{Z+G`H235mB??%x3kCaEBHU~8~88diqiW$=abn)K_+%*t$X)*@8=#}{qzlG zvsudJax^tHML`hI^z<~%&d$=@+#D?}Ez#E27D*{-Wo3n`)he~Vvh?JMr4F5ueP!s! zvp?wUjSmIB1abm7!8z+o6!Hoe3VDURvi>%WyhdIl(8z1+h9ZN! zLEa#5kTCp0BDRRF@vYpU;2O?3>)Yc?fI)ykfI)!4A%Q`FL4ZMkL4d(wfxVHGJXot#~&u1Ug3ze;Mn@9MsE!! zjiwq6G?+AcYlwI!;XIc0%i($>kNz6{HTv@sY4q2e2ZIKKw$?41UkT;9GZ`e%N1A_&F1%m~H1p|hLBM$}(1`7sj z_`d>UU@(gtEsB)lHNrab|A`x$YZQG*FKByvoA{?{Z*Pwd4i4z_^puW|kLmpUoGvad zsNe6?<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,0 +1,19 @@ +/ConsoleView.h/1.1/Mon Jun 12 14:02:17 2006// +/ConsoleView.m/1.1/Mon Jun 12 14:02:17 2006// +/Help.tiff/1.1/Mon Mar 19 20:00:32 2007/-kb/ +/Keys.gif/1.1/Mon Mar 19 20:00:32 2007/-kb/ +/Launcher.h/1.13/Sun Feb 24 04:31:23 2008// +/Launcher.m/1.31/Sat Jun 14 10:00:02 2008// +/Maps.gif/1.1/Wed Mar 21 09:28:04 2007/-kb/ +/Nomap.png/1.1/Sat Jul 14 17:42:27 2007/-kb/ +/SDLMain.h/1.1/Tue Mar 7 06:04:42 2006// +/Server.gif/1.1/Mon Mar 19 20:00:33 2007/-kb/ +/launcher-Info.plist/1.6/Sun Jun 15 00:38:05 2008// +/macutils.mm/1.4/Tue May 6 17:42:52 2008// +/main.m/1.2/Wed Jan 24 18:28:08 2007// +/map.icns/1.1/Mon Jun 12 14:02:17 2006// +/sauerbraten-Info.plist/1.2/Sun Jun 15 00:38:05 2008// +/sauerbraten.icns/1.1/Tue Mar 7 06:04:42 2006// +D/English.lproj//// +D/sauerbraten.xcodeproj//// +/SDLMain.m/1.3/Wed Jun 18 06:43:52 2008// diff --git a/src/xcode/CVS/Repository b/src/xcode/CVS/Repository new file mode 100644 index 0000000..ea1edc9 --- /dev/null +++ b/src/xcode/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/xcode diff --git a/src/xcode/CVS/Root b/src/xcode/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/xcode/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/xcode/ConsoleView.h b/src/xcode/ConsoleView.h new file mode 100755 index 0000000..89df0b7 --- /dev/null +++ b/src/xcode/ConsoleView.h @@ -0,0 +1,25 @@ +#import + +/* + * A basic console view + */ + +@interface ConsoleView : NSView { +@private + NSMutableArray *array; + NSDictionary *attr; + BOOL endScroll; +} +- (void)scrollToEnd:(BOOL)enable; + +/* + * Append the given line + */ +- (void)appendLine:(NSString*)line; + +/* + * Append multiple lines, skip blank ones + */ +- (void)appendText:(NSString*)text; + +@end diff --git a/src/xcode/ConsoleView.m b/src/xcode/ConsoleView.m new file mode 100755 index 0000000..a8c65c3 --- /dev/null +++ b/src/xcode/ConsoleView.m @@ -0,0 +1,120 @@ +#import "ConsoleView.h" + +#define MAX_LINES 200 +#define LINE_WIDTH 500 +#define LINE_HEIGHT 12 + +/* + * This VScroller sends a scrollToEnd message to the console based on whether you hit page/line down or not + */ +@interface VScroller : NSScroller { +} +@end +@implementation VScroller +- (NSScrollerPart)hitPart { + ConsoleView *view = (ConsoleView *)[(NSScrollView*)[self superview] documentView]; + NSScrollerPart part = [super hitPart]; + [view scrollToEnd:((part == NSScrollerIncrementPage) || (part == NSScrollerIncrementLine))]; + return part; +} +@end + + +@implementation ConsoleView + +- (id)initWithFrame:(NSRect)frame { + self = [super initWithFrame:frame]; + if (self) { + array = [[[NSMutableArray alloc] init] retain]; + + attr = [[NSDictionary dictionaryWithObjectsAndKeys: + [NSFont userFontOfSize:(LINE_HEIGHT-2)], NSFontAttributeName, + [NSColor colorWithCalibratedRed:0.2 green:0.8 blue:0.2 alpha:1.0], NSForegroundColorAttributeName, + nil] retain]; + } + return self; +} + +- (void)awakeFromNib { + [self scrollToEnd:YES]; + + NSScroller *vscroll = [[VScroller alloc] init]; + [vscroll setControlSize:[[[self enclosingScrollView] verticalScroller] controlSize]]; + [[self enclosingScrollView] setVerticalScroller:vscroll]; +} + +- (void)dealloc { + [attr release]; + [array release]; + [super dealloc]; +} + +- (BOOL)isFlipped { + return YES; +} + +- (void)drawRect:(NSRect)rect { + //draw the visible lines only + int startLine = rect.origin.y/LINE_HEIGHT; + int endLine = 1 + (rect.origin.y+rect.size.height)/LINE_HEIGHT; + if(startLine < 0) startLine = 0; + if(endLine > [array count]) endLine = [array count]; + int i; + for(i = startLine; i < endLine; i++) { + NSString *str = [array objectAtIndex:i]; + [str drawAtPoint:NSMakePoint(2, i * LINE_HEIGHT) withAttributes:attr]; + } +} + +- (void)scrollToEnd:(BOOL)enable { + endScroll = enable; +} + +- (void)appendLine:(NSString*)line { + BOOL chop = [array count] > MAX_LINES; + if(chop) { + [array removeObjectAtIndex:0]; // limit the number of lines + } + [array addObject:line]; + int i = [array count]; + [self setFrame:NSMakeRect(0, 0, LINE_WIDTH, i*LINE_HEIGHT)]; // increase the frame size + + NSRect rect = NSMakeRect(0, (i-1)*LINE_HEIGHT, LINE_WIDTH, LINE_HEIGHT); + if(endScroll) { + // Scroll to the line just added + if([self scrollRectToVisible:rect]) return; + } else { + // Lock the scrolling on the first visible line + i = [self visibleRect].origin.y/LINE_HEIGHT; + if(!chop) i++; + if(i < 0) i = 0; + if(i > [array count]) i = [array count]; + NSRect vrect = NSMakeRect(0, (i-1)*LINE_HEIGHT, LINE_WIDTH, LINE_HEIGHT); + if([self scrollRectToVisible:vrect]) return; + } + if(chop) + [self setNeedsDisplay:YES]; + else + [self setNeedsDisplayInRect:rect]; +} + +- (void)appendText:(NSString*)text { + NSArray *lines = [text componentsSeparatedByString:@"\n"]; //@TODO assumes we get given lines rather than fragments... + int i; + for(i = 0; i < [lines count]; i++) { + NSString *line = [lines objectAtIndex:i]; + if([line length] == 0) continue; //skip empty + [self appendLine:line]; + } +} + +- (BOOL)acceptsFirstResponder { + return YES; +} + +- (IBAction)delete:(id)sender { + [array removeAllObjects]; + [self setFrame:NSMakeRect(0,0,0,0)]; +} + +@end diff --git a/src/xcode/English.lproj/CVS/Entries b/src/xcode/English.lproj/CVS/Entries new file mode 100644 index 0000000..adfb29a --- /dev/null +++ b/src/xcode/English.lproj/CVS/Entries @@ -0,0 +1,3 @@ +/Localizable.strings/1.1/Sun Feb 24 01:02:17 2008// +D/MainMenu.nib//// +/InfoPlist.strings/1.10/Wed Jun 18 06:43:52 2008// diff --git a/src/xcode/English.lproj/CVS/Repository b/src/xcode/English.lproj/CVS/Repository new file mode 100644 index 0000000..05f5f50 --- /dev/null +++ b/src/xcode/English.lproj/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/xcode/English.lproj diff --git a/src/xcode/English.lproj/CVS/Root b/src/xcode/English.lproj/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/xcode/English.lproj/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/xcode/English.lproj/InfoPlist.strings b/src/xcode/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000000000000000000000000000000000..187e55c573134871945c6d93fc9edad2ba4f4320 GIT binary patch literal 600 zcwViLOAi4-5QOXOS4>+1DSN!OixW!_ngkk zC?TV+0!=j1N(&w3$)&ajLv5)9@<9Vm$sJBp_GxV_f2)Y<686Ee5@^O)bv0Gf4z>%= zQxE+$XjCQQayaj-$CwzQ;=zrp^5(6hIgTNm;Y(Kzm5{x!*%w`-yt1saQsg2zr_u+v z77;z?{MEytKfuALf&K#St@ot83HZf>)t@nA^wcQu`k`h%`VGMAucq&l^kBAOuBrO! R+gq0y+qvGk-RAjo9~bV;V;KMd literal 0 HcwPel00001 diff --git a/src/xcode/English.lproj/Localizable.strings b/src/xcode/English.lproj/Localizable.strings new file mode 100644 index 0000000..4055ba4 --- /dev/null +++ b/src/xcode/English.lproj/Localizable.strings @@ -0,0 +1,27 @@ +/* note ':s' becomes 'sauerbraten' */ + +/* tabs */ +"Main" = "Main"; +"Maps" = "Maps"; +"Keys" = "Keys"; +"Server" = "Server"; +"EisenStern" = "EisenStern"; +"Help" = "Help"; + +"Ok" = "Ok"; +"Cancel" = "Cancel"; +"Start" = "Start"; +"Stop" = "Stop"; +"ServerAlertMesg" = "Error - Can't launch server"; + +"ClientAlertTitle" = "Can't start :s"; +"ClientAlertMesg" = "Try moving the game folder contain :s so that the path doesn't contain weird characters, or start :s manually."; + +"InitAlertTitle" = "Invalid installation"; +"InitAlertMesg" = "The :s folder must exist alongside this launcher"; + +"FileAlertTitle" = "Invalid file location"; +"FileAlertMesg" = "Can only load files that are within the :s/packages/ folder. Do you want to show this folder?"; + +/* for MOD convenience */ +"forumURL" = "http://www.cubeengine.com/forum.php4"; diff --git a/src/xcode/English.lproj/MainMenu.nib/CVS/Entries b/src/xcode/English.lproj/MainMenu.nib/CVS/Entries new file mode 100644 index 0000000..2fe816e --- /dev/null +++ b/src/xcode/English.lproj/MainMenu.nib/CVS/Entries @@ -0,0 +1,5 @@ +/classes.nib/1.15/Sun Feb 24 01:29:00 2008// +/info.nib/1.17/Sun Mar 2 08:38:47 2008// +/keyedobjects.nib/1.22/Sun Mar 2 08:38:47 2008// +/objects.nib/1.20/Sat Aug 11 12:54:48 2007// +D diff --git a/src/xcode/English.lproj/MainMenu.nib/CVS/Repository b/src/xcode/English.lproj/MainMenu.nib/CVS/Repository new file mode 100644 index 0000000..4402f11 --- /dev/null +++ b/src/xcode/English.lproj/MainMenu.nib/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/xcode/English.lproj/MainMenu.nib diff --git a/src/xcode/English.lproj/MainMenu.nib/CVS/Root b/src/xcode/English.lproj/MainMenu.nib/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/xcode/English.lproj/MainMenu.nib/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/xcode/English.lproj/MainMenu.nib/classes.nib b/src/xcode/English.lproj/MainMenu.nib/classes.nib new file mode 100644 index 0000000..3bc2dad --- /dev/null +++ b/src/xcode/English.lproj/MainMenu.nib/classes.nib @@ -0,0 +1,86 @@ + + + + + IBClasses + + + ACTIONS + + helpAction + id + multiplayerAction + id + openUserdir + id + playAction + id + playMap + id + playRpg + id + showForum + id + + CLASS + Launcher + LANGUAGE + ObjC + OUTLETS + + console + ConsoleView + keys + NSArrayController + maps + NSArrayController + multiplayer + NSButton + prog + NSProgressIndicator + resolutions + NSPopUpButton + tabs + NSTabView + view1 + NSView + view2 + NSView + view3 + NSView + view4 + NSView + view5 + NSView + window + NSWindow + + SUPERCLASS + NSObject + + + ACTIONS + + + id + + CLASS + FirstResponder + LANGUAGE + ObjC + SUPERCLASS + NSObject + + + CLASS + ConsoleView + LANGUAGE + ObjC + SUPERCLASS + NSView + + + IBVersion + 1 + + diff --git a/src/xcode/English.lproj/MainMenu.nib/info.nib b/src/xcode/English.lproj/MainMenu.nib/info.nib new file mode 100644 index 0000000..84ac30e --- /dev/null +++ b/src/xcode/English.lproj/MainMenu.nib/info.nib @@ -0,0 +1,21 @@ + + + + + IBFramework Version + 629 + IBLastKnownRelativeProjectPath + ../../sauerbraten.xcodeproj + IBOldestOS + 5 + IBOpenObjects + + 264 + 213 + + IBSystem Version + 9C31 + targetFramework + IBCocoaFramework + + diff --git a/src/xcode/English.lproj/MainMenu.nib/keyedobjects.nib b/src/xcode/English.lproj/MainMenu.nib/keyedobjects.nib new file mode 100644 index 0000000000000000000000000000000000000000..54f100c37ddc6b7e728089cde19dce9c54c8813f GIT binary patch literal 47188 zcwW4{2YeL8`!GH;TWK1Q4D1+7LTP zQ7jO^0wTqZ3WC`ES^-fMdj%CMh)UjPX7@@8{`|e~|ML%AvO7C7&olEp^R#(pZ&r0> zAQDYa--j?FNJ27FkcxEVoZe-wKO6~!g1KFyq3Ri3eBqMv02EE{5}H-vFNsE4Abjnb zw~+&BMPrAhS%sy(sE^`e!!t4G690UE=}^1T7E`W3F62fTs4p6bhM?hS1R9GtN zztc%3=}#^od1NXnAZ4VSRFW!EO~NEf7LhB+mH16U$#rBgxs}{Tmg69~liWk@CF{rr z@&MULHj}Mn8`(}CAy1JVWEa^>ULY@%*T@0#0r`Y{Pktr8NxI~cJdz=`l-fvVN@q#k zq#jbblpzg}21-Muq0$&>tTa)|lcq{V(oD%O&6cX9pj0Exl@>`?NY_Z$N;gTjOUtFZ zq`Rf{(gx`vvQ^qFJuE#cJtjRN?UZ&&FG?>-Z%A)SA4nfdpGaRz-$*}8zep#gKV>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T{GP<-8S7d{cCz?dSZHJ8a912eKt3lTg{Wr zh*@QxV%D31d78P$+;2wBW;1S{ZJuZT)x6le%>0{qwRx?1gL$)gn|Y^sk9oiOkolR1na>{bn@`vS;<*MZ`%XP~w%RiR;mWP%nmgkn2mN%C7mQR+imLC`agRn7} z4Q7W?F$c^EV_EUup8KI>>unN_5gc?J;h#Nuduh+2kaB} z1^b5m#I11%AA^s>NjMp&;tn_sr{gZT8$KSNh)=?qxHrzi{qaCN7!SiEaW)=@bMPdb zho|A0cn+S27vM#BDK5mz@k+b~m*6s7j@RQ&cnjW+cj8K1jcaiOJ{9lAd+~mJ20jzF z;5a@DpNr4Of5jK!OYs%>DtryT9^Z&>!MEeP@IClG`~ZFkKY|~}PvWQXv-o-ZB7PYk z!mr`i@tgP^{4RbUe~3TEpW@H)Vf;1z4*!6E#=qh}1_^`E;Fv+1LDC>)5FT_GbQ)v~ zx(>PzP8j@U&~wmxkTn=E7(5s@7%><%$R3Ovl_e>i=AWGyWe(%DET- literal 0 HcwPel00001 diff --git a/src/xcode/English.lproj/MainMenu.nib/objects.nib b/src/xcode/English.lproj/MainMenu.nib/objects.nib new file mode 100644 index 0000000000000000000000000000000000000000..42707bdd93feb69363234262545ffb6bd6725067 GIT binary patch literal 20994 zcwV(U4R{nqmQ_h7Kz<+z1jC>7DvJ0MlkjWQB_t4xN{A#b>lzm)Gd)SmWM=H1A>`E4 z3O#-9x96P~L!adEWIfJZjX$h{3+s9)t9$3Nr>=tEs;i3TF)%IdzCSuDNwtG~($9D6J7q4R%tFY2ObR^t|Hc)m;Z3$^ieJ%`pjXk~z3qPN4n5x-5$#k-k8V}8H7d|G z(_!yRb^2}x7<89#d9DIYu?zVCo8PkKlFL+|;t~{gt83(LAz~p%TpsCCG(Cw^ak6f9 zg?i*gfj~w#|94_5xhkqgGMK+{IOegoXqA{uibGl(IWcL8PmPQ$e*prrFG9540`2Oc zFT~sZn~{WO1FukQ;2(?(d~yj0g1HUR2&cF96dG>`g?l-$_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p7B14=(=(Ggaby#HH}m%IGCkddDO*w>8o1JV_Y zE|9h`@~lK)Q~?kY=dY#b8TmJ;1l<3Ya5b8KA1-$?@)cY*GIC5h&d3e`Sjy-;=^{oB zNnq!qP*BXse@KTJxlh7XcRB-#7BX5R9RXV*;YvH5BJF}kq~{p9U3w4PBa}YG=x6{u zjgjZ!=|_xwA#I!{aVva1l%L1wIdHj$QA66s$U12uBL^iA*QZcAosqXBTnwi_gs0hz zo+rJ<$nW4DMtr`6n+o&{>AnRL4-KYCd!PeQ8DjKmi3f=l@U)E4izJN3$zh z(A^I;XE0g-mpd5km3|Ho68Ar=py(P#>m|N-Qzqe3I{gk5j$&jhTtIP_OE6@A3-{v~ zd0JY<$O*V#$LI}kp^R*ic!)J!!rX;|W}%z^0n}XwB;hg!WCeww#&^The2|6o0wez_ zLHhKK#CHqENf7>yk_J1a^%OuhF&dK&F>){5-^8d-8iF2S{P6-5{3D|`Nf6`bz&&V8 zhm;FS3)P=7@?*HbU~Yh#7^4xmKzO?n3W5EzBp&RRNZeIkC-JD^T4^^U4@eUk`2@;` z7@Z6_rHuRmmk*#1G|tGQ09DAyui&zrQNSV3 gFgh2e;O&E?-?)22NmG3TzLC(VLFfZv;%d|UAK;q_y8r+H literal 0 HcwPel00001 diff --git a/src/xcode/Help.tiff b/src/xcode/Help.tiff new file mode 100644 index 0000000000000000000000000000000000000000..058483139a4cd978174d42cc19784de5978d37ea GIT binary patch literal 1716 zcwSA63sjN`7RSF25KvL@0hy41;VUi2YD*`_`7}cu#|gEEHCc+!%*e{pT*nVI^8qtM zj*V;iDoiMC7abbZ(Gii!%t}p7tq81_uLM0KjOT z2hiA_43Zh5^|W+0RpFNTTq@!gya)^^44>l57jThPCZ_P_^Zqm|JX;d6B7VQFq~-zpI=&&KXE3 zJbtpZGma$Im&POx3Eo=zUZ`4SkY*1S420fe-w6{(vOU>58Km+Mwck%(E2m|{FWyEw zx?8V0m7I+^_vVPff9o*ox0hdWpRu?9yv^vPxs@5O?S%WFG}-o@t@XErPMyn1v9KdL zmE3}MD~jwQ1>Y-vcROxYckhx>-w#|xDO`kmS$cf%Ox^J8{q%>-n-r$otIl6);o{Dw z(bk9iYQ7lBT!8hNCmdEbjTJv`?Y!dsa{y_v?hKNy+b~24@Nv2Xa!>$JTS$B`sS@=`2b-KK#zvWw4 z81`C9=!T1Blf#B|JIS;m&}!1dKobPH_EC0+)W*~>jqQ)wn}md^JzC#@2FJ%?jP@P% z_&p?Yfood&mfFq0#H4BVCHZ^Ym$DLX#rd5b+k0@wn&B=^Axr$dnpfaf6SlMo>YfWP zAK9NIJLg=>IJ?_vmrWQTXL7HcY5YrO^pqG)mW4ewovjm^C(Iil8L@` zirX>nHSb%YPWwGXNWDYjG9+1lx!4fUJG)hKQYiQ9GCog8ajCVJ_Ur5$}um1)mT+)zxfWGQY>E#GC5a${XC(@o8Oah5ME0xinq49jPAqb0otrd5E8 z;hTyy^7v`8q|sn!B7l)kUN=t~cei{!z1n;xkOmQ}`ODSuUURdR-4|Mf>GCTaj-0bm z@?)FB-k5nVoTCdVht)zw)Yy_?|1tSeMEqCR8N9r0_61Rz3T&xC zcVy-D9hfO!Q-`9ZcC{E0uzC z6D&5@KbTS(Hv1xLts-Ul@XI9paZC1K{kZ(^-Q&dh8%Ep@61(#c1$wY68~Dg z>1!z5GujYLtW2^tP4g3)RMkJ}Ot7}2sQ=c7hzja~ASJGeror-gg=mygw9#1m&@$V1 zmxr$`Xk)hC7Im{|O69g<)JBVYK&U!Y*{i@<@!;&p5}ygiO8HNtY29A`+QXvEl|hIU z5e*9|qmW2{9MM{th2%;1;Wf$DnBLx@_nix2xX1^_HbT=#1RBz^QC0B-omMiZdzhYueZT?LZ=$F(43{r1C!^Pm2Q{@?#m P*!4Ei^8mn!@NxbZgr(8$ literal 0 HcwPel00001 diff --git a/src/xcode/Keys.gif b/src/xcode/Keys.gif new file mode 100644 index 0000000000000000000000000000000000000000..3ca1565796281d7ae92dc8b2becbd1aa4609bcd2 GIT binary patch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)U;&V#qXw>BFnepeJDS$Q z&HQ~&6&%31ZHc6f9LuE;tovmzXaEUNz@`6M(b{u%0KFXmhdS)4a9L>T08Ow>8Jt)K zm$W4*>S*E<$KaBeOo1b2Fh&^!G6theK^GygQ5awV12Vum)_u+n^{)Fo21d`Z*vGEY HAOHY6VKqWB literal 0 HcwPel00001 diff --git a/src/xcode/Launcher.h b/src/xcode/Launcher.h new file mode 100644 index 0000000..607ae6c --- /dev/null +++ b/src/xcode/Launcher.h @@ -0,0 +1,42 @@ +#import + +@class ConsoleView; + +@interface Launcher : NSObject { + IBOutlet NSWindow *window; + + //able to leave these disconnected + IBOutlet NSView *view1; //Main + IBOutlet NSView *view2; //Maps + IBOutlet NSView *view3; //Keys + IBOutlet NSView *view4; //Server + IBOutlet NSView *view5; //EisenStern + + + IBOutlet NSProgressIndicator *prog; //while scanning maps - it's there if you want to wire it up + IBOutlet NSArrayController *maps; + IBOutlet NSArrayController *keys; + IBOutlet NSPopUpButton *resolutions; + IBOutlet NSButton *multiplayer; + IBOutlet ConsoleView *console; +@private + NSMutableDictionary *toolBarItems; + pid_t server; + NSMutableDictionary *fileRoles; +} + +- (IBAction)playAction:(id)sender; + +- (IBAction)multiplayerAction:(id)sender; + +- (IBAction)helpAction:(id)sender; + +- (IBAction)showForum:(id)sender; + +- (IBAction)playRpg:(id)sender; + +- (IBAction)playMap:(id)sender; + +- (IBAction)openUserdir:(id)sender; + +@end diff --git a/src/xcode/Launcher.m b/src/xcode/Launcher.m new file mode 100644 index 0000000..cabe0ce --- /dev/null +++ b/src/xcode/Launcher.m @@ -0,0 +1,742 @@ +#import "Launcher.h" +#import "ConsoleView.h" +#include +#include /* _exit() */ +#include /* forkpty() */ + +// User default keys +#define dkVERSION @"version" +#define dkUSERDIR @"userdir" +#define dkNAME @"name" +#define dkFULLSCREEN @"fullscreen" +#define dkFSAA @"fsaa" +#define dkSHADER @"shader" +#define dkRESOLUTION @"resolution" +#define dkADVANCEDOPTS @"advancedOptions" +#define dkSERVEROPTS @"server_options" +#define dkDESCRIPTION @"server_description" +#define dkPASSWORD @"server_password" +#define dkMAXCLIENTS @"server_maxclients" + +#define kMaxDisplays 16 + +//If you make a MOD then please change this, the bundle indentifier, the file extensions (.ogz, .dmo), and the url registration. +#define kSAUERBRATEN @"sauerbraten" + +//tab names, i.e. image names (text is localised) +#define tkMAIN @"Main" +#define tkMAPS @"Maps" +#define tkKEYS @"Keys" +#define tkSERVER @"Server" +#define tkEISENSTERN @"EisenStern" + + +@interface NSString(Extras) +@end +@implementation NSString(Extras) +- (NSString*)expand { + NSMutableString *str = [NSMutableString string]; + [str setString:self]; + [str replaceOccurrencesOfString:@":s" withString:kSAUERBRATEN options:0 range:NSMakeRange(0, [str length])]; + return str; +} +@end + + +@interface NSUserDefaults(Extras) // unless you want strings with "(null)" in them :-/ +- (NSString*)nonNullStringForKey:(NSString*)key; +@end +@implementation NSUserDefaults(Extras) +- (NSString*)nonNullStringForKey:(NSString*)key { + NSString *result = [self stringForKey:key]; + return (result ? result : @""); +} +@end + + +@interface Map : NSObject { + NSString *path; + BOOL demo, user; +} +@end +@implementation Map +- (id)initWithPath:(NSString*)aPath user:(BOOL)aUser demo:(BOOL)aDemo +{ + if((self = [super init])) + { + path = [[aPath stringByDeletingPathExtension] retain]; + user = aUser; + demo = aDemo; + } + return self; +} +- (void)dealloc +{ + [path release]; + [super dealloc]; +} +- (NSString*)path { return (demo ? [NSString stringWithFormat:@"-xdemo \"%@\"", path] : path); } // minor hack +- (NSString*)name { return [path lastPathComponent]; } +- (NSImage*)image +{ + NSImage *image = [[NSImage alloc] initWithContentsOfFile:[path stringByAppendingString:@".jpg"]]; + if(!image && demo) image = [NSImage imageNamed:tkMAIN]; + if(!image) image = [NSImage imageNamed:@"Nomap"]; + return image; +} +- (NSString*)text +{ + NSString *text = [NSString alloc]; + NSError *error; + if([text respondsToSelector:@selector(initWithContentsOfFile:encoding:error:)]) + text = [text initWithContentsOfFile:[path stringByAppendingString:@".txt"] encoding:NSASCIIStringEncoding error:&error]; + else + text = [text initWithContentsOfFile:[path stringByAppendingString:@".txt"]]; //deprecated in 10.4 + if(!text) + { + text = user ? @"user " : @""; + if(demo) text = [text stringByAppendingString:@"demo"]; + } + return text; +} +- (void)setText:(NSString*)text { } // wtf? - damn textfield believes it's editable +- (NSString*)tickIfExists:(NSString*)ext +{ + unichar tickCh = 0x2713; + return ([[NSFileManager defaultManager] fileExistsAtPath:[path stringByAppendingString:ext]] ? [NSString stringWithCharacters:&tickCh length:1] : @""); +} +- (NSString*)hasImage { return [self tickIfExists:@".jpg"]; } +- (NSString*)hasText { return [self tickIfExists:@".txt"]; } +- (NSString*)hasCfg { return [self tickIfExists:@".cfg"]; } +@end + + +static int numberForKey(CFDictionaryRef desc, CFStringRef key) +{ + CFNumberRef value; + int num = 0; + if ((value = CFDictionaryGetValue(desc, key)) == NULL) + return 0; + CFNumberGetValue(value, kCFNumberIntType, &num); + return num; +} + + +@interface Launcher(ToolBar) +@end +@implementation Launcher(ToolBar) + +- (void)switchViews:(NSToolbarItem *)item +{ + NSView *views[] = {view1, view2, view3, view4, view5}; + NSView *prefsView = views[[item tag]-1]; + + //to stop flicker, we make a temp blank view. + NSView *tempView = [[NSView alloc] initWithFrame:[[window contentView] frame]]; + [window setContentView:tempView]; + [tempView release]; + + //mojo to get the right frame for the new window. + NSRect newFrame = [window frame]; + newFrame.size.height = [prefsView frame].size.height + ([window frame].size.height - [[window contentView] frame].size.height); + newFrame.size.width = [prefsView frame].size.width; + newFrame.origin.y += ([[window contentView] frame].size.height - [prefsView frame].size.height); + + //set the frame to newFrame and animate it. + [window setFrame:newFrame display:YES animate:YES]; + //set the main content view to the new view we have picked through. + [window setContentView:prefsView]; + [window setContentMinSize:[prefsView bounds].size]; +} + +- (void)initToolBar +{ + toolBarItems = [[NSMutableDictionary alloc] init]; + NSEnumerator *e = [[self toolbarDefaultItemIdentifiers:nil] objectEnumerator]; + NSString *identifier; + while(identifier = [e nextObject]) + { + NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:identifier]; + int tag = [identifier intValue]; + NSString *name = identifier; + SEL action = @selector(helpAction:); + if(tag) { + NSString *names[] = {tkMAIN, tkMAPS, tkKEYS, tkSERVER, tkEISENSTERN}; + name = names[tag-1]; + action = @selector(switchViews:); + } + [item setTag:tag]; + [item setTarget:self]; + [item setAction:action]; + [item setLabel:NSLocalizedString(name, @"")]; + [item setImage:[NSImage imageNamed:name]]; + [toolBarItems setObject:item forKey:identifier]; + [item release]; + } + NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier:@""]; + [toolbar setDelegate:self]; + [toolbar setAllowsUserCustomization:NO]; + [toolbar setAutosavesConfiguration:NO]; + [window setToolbar:toolbar]; + [toolbar release]; + if([window respondsToSelector:@selector(setShowsToolbarButton:)]) [window setShowsToolbarButton:NO]; //10.4+ + + //select the first by default + NSToolbarItem *first = [toolBarItems objectForKey:[[self toolbarDefaultItemIdentifiers:nil] objectAtIndex:0]]; + [toolbar setSelectedItemIdentifier:[first itemIdentifier]]; + [self switchViews:first]; +} + +#pragma mark toolbar delegate methods + +- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag +{ + return [toolBarItems objectForKey:itemIdentifier]; +} + +- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)theToolbar +{ + return [self toolbarDefaultItemIdentifiers:theToolbar]; +} + +- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar +{ + NSMutableArray *array = (NSMutableArray *)[self toolbarSelectableItemIdentifiers:toolbar]; + [array addObject:NSToolbarFlexibleSpaceItemIdentifier]; + [array addObject:@"Help"]; + return array; +} + +- (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)toolbar +{ + NSMutableArray *array = [NSMutableArray array]; + NSView *views[] = {view1, view2, view3, view4, view5}; + int i; + for(i = 0; i < sizeof(views)/sizeof(NSView*); i++) if(views[i]) [array addObject:[NSString stringWithFormat:@"%d", i+1]]; + return array; +} +@end + + +@implementation Launcher + +/* directory where the executable lives */ ++ (NSString *)cwd +{ + return [[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:kSAUERBRATEN]; +} + ++ (BOOL)hasUserdir { return [[NSUserDefaults standardUserDefaults] boolForKey:dkUSERDIR]; } + +/* directory where user files are kept - typically /Users//Application Support/sauerbraten */ ++ (NSString*)userdir +{ + FSRef folder; + NSString *path = nil; + if(FSFindFolder(kUserDomain, kApplicationSupportFolderType, NO, &folder) == noErr) { + CFURLRef url = CFURLCreateFromFSRef(kCFAllocatorDefault, &folder); + path = [(NSURL *)url path]; + CFRelease(url); + path = [path stringByAppendingPathComponent:kSAUERBRATEN]; + } + return path; +} + +- (void)addResolutionsForDisplay:(CGDirectDisplayID)dspy +{ + CFIndex i, cnt; + CFArrayRef modeList = CGDisplayAvailableModes(dspy); + if(modeList == NULL) return; + cnt = CFArrayGetCount(modeList); + for(i = 0; i < cnt; i++) { + CFDictionaryRef mode = CFArrayGetValueAtIndex(modeList, i); + NSString *title = [NSString stringWithFormat:@"%i x %i", numberForKey(mode, kCGDisplayWidth), numberForKey(mode, kCGDisplayHeight)]; + if(![resolutions itemWithTitle:title]) [resolutions addItemWithTitle:title]; + } +} + +- (void)initResolutions +{ + CGDirectDisplayID display[kMaxDisplays]; + CGDisplayCount numDisplays; + [resolutions removeAllItems]; + if(CGGetActiveDisplayList(kMaxDisplays, display, &numDisplays) == CGDisplayNoErr) + { + CGDisplayCount i; + for (i = 0; i < numDisplays; i++) + [self addResolutionsForDisplay:display[i]]; + } + [resolutions selectItemAtIndex: [[NSUserDefaults standardUserDefaults] integerForKey:dkRESOLUTION]]; +} + +/* build key array from config data */ +-(NSArray *)getKeys:(NSDictionary *)dict +{ + NSMutableArray *arr = [NSMutableArray array]; + NSEnumerator *e = [dict keyEnumerator]; + NSString *key; + while ((key = [e nextObject])) + { + int pos = [key rangeOfString:@"bind."].location; + if(pos == NSNotFound || pos > 5) continue; + [arr addObject:[NSDictionary dictionaryWithObjectsAndKeys: //keys used in nib + [key substringFromIndex:pos+5], @"key", + [key substringToIndex:pos], @"mode", + [dict objectForKey:key], @"action", + nil]]; + } + return arr; +} + +/* + * extract a dictionary from the config files containing: + * - name, team, gamma strings + * - bind/editbind '.' key strings + */ +-(NSDictionary *)readConfigFiles +{ + NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; + [dict setObject:@"" forKey:@"name"]; //ensure these entries are never nil + [dict setObject:@"" forKey:@"team"]; + + NSString *files[] = {@"config.cfg", @"autoexec.cfg"}; + int i; + for(i = 0; i < sizeof(files)/sizeof(NSString*); i++) + { + NSString *file = [Launcher hasUserdir] ? [Launcher userdir] : [Launcher cwd]; + file = [file stringByAppendingPathComponent:files[i]]; + + NSArray *lines = [[NSString stringWithContentsOfFile:file] componentsSeparatedByString:@"\n"]; + + if(i==0 && !lines) // ugh - special case when first run... + { + file = [[Launcher cwd] stringByAppendingPathComponent:@"data/defaults.cfg"]; + lines = [[NSString stringWithContentsOfFile:file] componentsSeparatedByString:@"\n"]; + } + + NSString *line; + NSEnumerator *e = [lines objectEnumerator]; + while(line = [e nextObject]) + { + NSRange r; // more flexible to do this manually rather than via NSScanner... + int j = 0; + while(j < [line length] && [line characterAtIndex:j] <= ' ') j++; //skip white + r.location = j; + while(j < [line length] && [line characterAtIndex:j] > ' ') j++; //until white + r.length = j - r.location; + NSString *type = [line substringWithRange:r]; + + while(j < [line length] && [line characterAtIndex:j] <= ' ') j++; //skip white + if(j < [line length] && [line characterAtIndex:j] == '"') + { + r.location = ++j; + while(j < [line length] && [line characterAtIndex:j] != '"') j++; //until close quote + r.length = (j++) - r.location; + } else { + r.location = j; + while(j < [line length] && [line characterAtIndex:j] > ' ') j++; //until white + r.length = j - r.location; + } + NSString *value = [line substringWithRange:r]; + + while(j < [line length] && [line characterAtIndex:j] <= ' ') j++; //skip white + NSString *remainder = [line substringFromIndex:j]; + + if([type isEqual:@"name"] || [type isEqual:@"team"] || [type isEqual:@"gamma"]) + [dict setObject:value forKey:type]; + else if([type isEqual:@"bind"] || [type isEqual:@"editbind"] || [type isEqual:@"specbind"]) + [dict setObject:remainder forKey:[NSString stringWithFormat:@"%@.%@", type,value]]; + } + } + return dict; +} + +- (void)killServer { + if(server > 0) kill(server, SIGKILL); //@WARNING - you do NOT want a 0 or -1 to be accidentally sent a kill! + server = -1; + [multiplayer setTitle:NSLocalizedString(@"Start", @"")]; + [console appendText:@"\n \n"]; +} + +- (void)serverDataAvailable:(NSNotification *)note +{ + NSFileHandle *taskOutput = [note object]; + NSData *data = [[note userInfo] objectForKey:NSFileHandleNotificationDataItem]; + + if (data && [data length]) + { + NSString *text = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; + [console appendText:text]; + [text release]; + [taskOutput readInBackgroundAndNotify]; //wait for more data + } + else + { + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + [nc removeObserver:self name:NSFileHandleReadCompletionNotification object:taskOutput]; + close([taskOutput fileDescriptor]); + [self killServer]; + } +} + +- (BOOL)launchGame:(NSArray *)args { + NSString *cwd = [Launcher cwd]; + //NSString *exe = [cwd stringByAppendingPathComponent:[@":s.app/Contents/MacOS/:s" expand]]; + NSString *exe = [[NSBundle bundleWithPath:[cwd stringByAppendingPathComponent:[@":s.app" expand]]] executablePath]; + + BOOL okay = YES; + + if([args containsObject:@"-d"]) + { + if(server != -1) return NO; // server is already running + + const char **argv = (const char**)malloc(sizeof(char*)*([args count] + 2)); //{path, , NULL}; + argv[0] = [exe fileSystemRepresentation]; + argv[[args count]+1] = NULL; + int i; + for(i = 0; i < [args count]; i++) argv[i+1] = [[args objectAtIndex:i] UTF8String]; + + int fdm; + NSString *fail = [NSLocalizedString(@"ServerAlertMesg", nil) expand]; + switch ( (server = forkpty(&fdm, NULL, NULL, NULL)) ) // forkpty so we can reliably grab SDL console + { + case -1: + [console appendLine:fail]; + [self killServer]; + okay = NO; + break; + case 0: // child + chdir([cwd fileSystemRepresentation]); + if(execv([exe fileSystemRepresentation], (char*const*)argv) == -1) fprintf(stderr, "%s\n", [fail UTF8String]); + _exit(0); + default: // parent + [multiplayer setTitle:NSLocalizedString(@"Stop", @"")]; + NSFileHandle *taskOutput = [[NSFileHandle alloc] initWithFileDescriptor:fdm]; + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + [nc addObserver:self selector:@selector(serverDataAvailable:) name:NSFileHandleReadCompletionNotification object:taskOutput]; + [taskOutput readInBackgroundAndNotify]; + break; + } + free(argv); + } + else + { + NS_DURING + NSTask *task = [[NSTask alloc] init]; + [task setCurrentDirectoryPath:cwd]; + [task setLaunchPath:exe]; + [task setArguments:args]; + [task setEnvironment:[NSDictionary dictionaryWithObjectsAndKeys: + @"1", @"SDL_SINGLEDISPLAY", + @"1", @"SDL_ENABLEAPPEVENTS", nil + ]]; // makes Command-H, Command-M and Command-Q work at least when not in fullscreen + + [task launch]; + if(server == -1) [NSApp terminate:self]; //if there is a server then don't exit! + NS_HANDLER + //NSLog(@"%@", localException); + NSBeginCriticalAlertSheet( + [NSLocalizedString(@"ClientAlertTitle", @"") expand] , nil, nil, nil, + window, nil, nil, nil, nil, + [NSLocalizedString(@"ClientAlertMesg", @"") expand]); + okay = NO; + NS_ENDHANDLER + } + + return okay; +} + +/* + * nil will just launch the fps game + * "-rpg" will launch the rpg demo + * "-x.." will launch and run commands + * otherwise we are specifying a map to play + */ +- (BOOL)playFile:(id)filename +{ + NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; + + NSArray *res = [[resolutions titleOfSelectedItem] componentsSeparatedByString:@" x "]; + NSMutableArray *args = [NSMutableArray array]; + + [args addObject:[NSString stringWithFormat:@"-w%@", [res objectAtIndex:0]]]; + [args addObject:[NSString stringWithFormat:@"-h%@", [res objectAtIndex:1]]]; + [args addObject:@"-z32"]; //otherwise seems to have a fondness to use -z16 which looks crap + + if([defs integerForKey:dkFULLSCREEN] == 0) [args addObject:@"-t"]; + [args addObject:[NSString stringWithFormat:@"-a%d", [defs integerForKey:dkFSAA]]]; + [args addObject:[NSString stringWithFormat:@"-f%d", [defs integerForKey:dkSHADER]]]; + + if([Launcher hasUserdir]) [args addObject:[NSString stringWithFormat:@"-q%@", [Launcher userdir]]]; + + NSMutableArray *cmds = [NSMutableArray array]; + NSString *name = [defs nonNullStringForKey:dkNAME]; + if(name) [cmds addObject:[NSString stringWithFormat:@"name \"%@\"", name]]; + + if(filename) + { + if([filename isEqual:@"-rpg"]) { + [cmds removeAllObjects]; // rpg current doesn't require name/team + [args addObject:@"-grpg"]; //demo the rpg game + } else if([filename hasPrefix:@"-x"]) + [cmds addObject:[filename substringFromIndex:2]]; + else + [args addObject:[NSString stringWithFormat:@"-l%@", filename]]; + } + + if([cmds count] > 0) + { + NSString *script = [cmds objectAtIndex:0]; + int i; + for(i = 1; i < [cmds count]; i++) script = [NSString stringWithFormat:@"%@;%@", script, [cmds objectAtIndex:i]]; + [args addObject:[NSString stringWithFormat:@"-x%@", script]]; + } + + NSEnumerator *e = [[[defs nonNullStringForKey:dkADVANCEDOPTS] componentsSeparatedByString:@" "] objectEnumerator]; + NSString *opt; + while(opt = [e nextObject]) if([opt length] != 0) [args addObject:opt]; //skip empty ones + + return [self launchGame:args]; +} + +- (void)scanMaps:(id)obj //@note threaded! +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + int len = [Launcher hasUserdir] ? 2 : 1; + int i; + for(i = 0; i < len; i++) + { + NSString *dir = (i==0) ? [Launcher cwd] : [Launcher userdir]; + NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtPath:dir]; + NSString *file; + while(file = [enumerator nextObject]) + { + NSString *role = [fileRoles objectForKey:[file pathExtension]]; + if(role) + { + Map *map = [[Map alloc] initWithPath:[dir stringByAppendingPathComponent:file] user:(i==1) demo:[role isEqual:@"Viewer"]]; + [maps performSelectorOnMainThread:@selector(addObject:) withObject:map waitUntilDone:NO]; + } + } + } + [prog performSelectorOnMainThread:@selector(stopAnimation:) withObject:nil waitUntilDone:NO]; + [pool release]; +} + +- (void)initMaps +{ + [prog startAnimation:nil]; + [maps removeObjects:[maps arrangedObjects]]; + [NSThread detachNewThreadSelector: @selector(scanMaps:) toTarget:self withObject:nil]; +} + +- (void)awakeFromNib +{ + //generate some pretty icons if they are missing + NSRect region = NSMakeRect(0, 0, 64, 64); + NSImage *image = [NSImage imageNamed:tkMAIN]; + if(!image) { + image = [[NSImage imageNamed:@"NSApplicationIcon"] copy]; + [image setSize:region.size]; + [image setName:tkMAIN]; //one less image to include + } + NSImage *en = [NSImage imageNamed:tkEISENSTERN]; + if(!en) { + en = [image copy]; + [en lockFocus]; + [[NSColor cyanColor] set]; //greenish icon instead - as CGBlendMode is 10.4+, bitmap filters are too much code + NSRectFillUsingOperation(region, NSCompositeSourceAtop); + [image drawInRect:region fromRect:region operation:NSCompositePlusDarker fraction:1.0]; + [en unlockFocus]; + [en setName:tkEISENSTERN]; //one less image to include + } + + [self initToolBar]; + [window setBackgroundColor:[NSColor colorWithDeviceRed:0.90 green:0.90 blue:0.90 alpha:1.0]]; //Apples 'mercury' crayon color + + //from the plist we determine that dmo->Viewer, and ogz->Editor + fileRoles = [[NSMutableDictionary dictionary] retain]; + NSEnumerator *types = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDocumentTypes"] objectEnumerator]; + NSDictionary *type; + while((type = [types nextObject])) { + NSString *role = [type objectForKey:@"CFBundleTypeRole"]; + NSEnumerator *exts = [[type objectForKey:@"CFBundleTypeExtensions"] objectEnumerator]; + NSString *ext; + while((ext = [exts nextObject])) [fileRoles setObject:role forKey:ext]; + } + + NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; + NSFileManager *fm = [NSFileManager defaultManager]; + + NSString *appVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]; + NSString *version = [defs stringForKey:dkVERSION]; + if(!version || ![version isEqual:appVersion]) + { + NSLog(@"Upgraded Version..."); + //need to flush lurking config files - they're automatically generated, so no big deal... + NSString *dir = [Launcher userdir]; + [fm removeFileAtPath:[dir stringByAppendingPathComponent:@"init.cfg"] handler:nil]; + [fm removeFileAtPath:[dir stringByAppendingPathComponent:@"config.cfg"] handler:nil]; + } + [defs setObject:appVersion forKey:dkVERSION]; + + NSDictionary *dict = [self readConfigFiles]; + [keys addObjects:[self getKeys:dict]]; + + if([[defs nonNullStringForKey:dkNAME] isEqual:@""]) + { + NSString *name = [dict objectForKey:@"name"]; + if([name isEqual:@""] || [name isEqual:@"unnamed"]) name = NSUserName(); + [defs setValue:name forKey:dkNAME]; + } + + NSString *dir = [Launcher cwd]; + if(![fm isWritableFileAtPath:dir]) [defs setBool:YES forKey:dkUSERDIR]; // auto-enable userdir + + [self initMaps]; + [self initResolutions]; + server = -1; + [NSApp setDelegate:self]; //so can catch the double-click, dropped files, termination + [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(getUrl:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; + + //Listen for changes in the preferences that require the gui to refresh + [defs addObserver:self forKeyPath:dkUSERDIR options:NSKeyValueObservingOptionNew context:nil]; + +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + if(![keyPath isEqual:dkUSERDIR]) return; + [self initMaps]; +} + +#pragma mark - +#pragma mark application delegate + +- (void)applicationDidFinishLaunching:(NSNotification *)note { + NSFileManager *fm = [NSFileManager defaultManager]; + NSString *dir = [Launcher cwd]; + if(![fm fileExistsAtPath:dir]) + NSBeginCriticalAlertSheet( + [NSLocalizedString(@"InitAlertTitle", @"") expand], nil, nil, nil, + window, self, nil, nil, nil, + [NSLocalizedString(@"InitAlertMesg", @"") expand]); +} + +-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { + return YES; +} + +- (void)applicationWillTerminate: (NSNotification *)note { + [self killServer]; +} + +//we register 'ogz' and 'dmo' as doc types +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename +{ + NSString *role = [fileRoles objectForKey:[filename pathExtension]]; + if(!role) return NO; + BOOL demo = [role isEqual:@"Viewer"]; + filename = [filename stringByDeletingPathExtension]; //chop off extension + int len = [Launcher hasUserdir] ? 2 : 1; + int i; + for(i = 0; i < len; i++) { + NSString *pkg = (i == 0) ? [Launcher cwd] : [Launcher userdir]; + if(!demo) pkg = [pkg stringByAppendingPathComponent:@"packages"]; + if([filename hasPrefix:pkg]) + return [self playFile:(demo ? [NSString stringWithFormat:@"-xdemo \"%@\"", filename] : filename)]; + } + NSBeginCriticalAlertSheet( + [NSLocalizedString(@"FileAlertMesg", @"") expand], NSLocalizedString(@"Ok", @""), NSLocalizedString(@"Cancel", @""), nil, + window, self, @selector(openPackageFolder:returnCode:contextInfo:), nil, nil, + [NSLocalizedString(@"FileAlertMesg", @"") expand]); + return NO; +} + +- (void)openPackageFolder:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + if(returnCode == 0) return; + if([Launcher hasUserdir]) //close enough... otherwise need to ensure that sauerbraten/packages folder exists too + [self openUserdir:nil]; + else + [[NSWorkspace sharedWorkspace] openFile:[Launcher cwd]]; +} + +//we register 'sauerbraten' as a url scheme +- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent +{ + NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]]; + if(!url) return; + [self playFile:[NSString stringWithFormat:@"-xconnect %@", [url host]]]; +} + +#pragma mark interface actions + +- (IBAction)multiplayerAction:(id)sender +{ + [window makeFirstResponder:window]; //ensure fields are exited and committed + if(server != -1) + { + [self killServer]; + } + else + { + NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; + + NSMutableArray *args = [NSMutableArray arrayWithObject:@"-d"]; + + NSEnumerator *e = [[[defs nonNullStringForKey:dkSERVEROPTS] componentsSeparatedByString:@" "] objectEnumerator]; + NSString *opt; + while(opt = [e nextObject]) if([opt length] != 0) [args addObject:opt]; //skip empty ones + + NSString *desc = [defs nonNullStringForKey:dkDESCRIPTION]; + if (![desc isEqual:@""]) [args addObject:[NSString stringWithFormat:@"-n%@", desc]]; + + NSString *pass = [defs nonNullStringForKey:dkPASSWORD]; + if (![pass isEqual:@""]) [args addObject:[NSString stringWithFormat:@"-p%@", pass]]; + + int clients = [defs integerForKey:dkMAXCLIENTS]; + if (clients > 0) [args addObject:[NSString stringWithFormat:@"-c%d", clients]]; + + if([Launcher hasUserdir]) [args addObject:[NSString stringWithFormat:@"-q%@", [Launcher userdir]]]; + + [self launchGame:args]; + } +} + +- (IBAction)playAction:(id)sender +{ + [window makeFirstResponder:window]; //ensure fields are exited and committed + [self playFile:nil]; +} + +- (IBAction)playRpg:(id)sender +{ + [self playFile:@"-rpg"]; +} + +- (IBAction)playMap:(id)sender +{ + NSArray *sel = [maps selectedObjects]; + if(sel && [sel count] > 0) [self playFile:[[sel objectAtIndex:0] path]]; +} + +- (IBAction)helpAction:(id)sender +{ + NSString *file = [[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"README.html"]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL fileURLWithPath:file]]; +} + +- (IBAction)showForum:(id)sender +{ + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:NSLocalizedString(@"forumURL", @"")]]; +} + +- (IBAction)openUserdir:(id)sender +{ + NSString *dir = [Launcher userdir]; + NSFileManager *fm = [NSFileManager defaultManager]; + if(![fm fileExistsAtPath:dir]) [fm createDirectoryAtPath:dir attributes:nil]; //ensure there is a folder to open + [[NSWorkspace sharedWorkspace] openFile:dir]; +} + +@end diff --git a/src/xcode/Maps.gif b/src/xcode/Maps.gif new file mode 100644 index 0000000000000000000000000000000000000000..00ff6ccefe360bae5035d5d3653c7c6f91a0f74d GIT binary patch literal 2048 zcwQCHi(gWQ0>JTe4zI&gFhoU7L{v~fKtMsU1DfIUV%OACmu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T8x=t7Dpfe!N#U&kmwnJ zxn3-YaTI{Wk%vZ24hI)Tb*AQD?3^|^dtW;Musmfdolmj0_4aJ9rF0xBA`vcOSfVIX z>Fk?-rSoNDxsxUQErZ9KSB1aOKi^uNy>=>|tHc6}K`==p$g(i5b720voiFa`^nQE* z5L4%&_=!3B2X@ZJ1r|kvDiIQl>on$H>O5oiCcZtrx;3ov&*p*7!=&`*HsYZgJPu)0 zr#b&(=jl6i{+`~P{<*1j9%XB5Fxzj%S`lSxMK4V(e5>=PW7j@+#DS4_3B0V6R(JOD zDSf<2^*gl%v-Dppf0*3~^Y7^GdBneGCw}rT-A~%dnF9Iz_g;F+WP1+0A6)-G094Ue Ud(A+Jxc~qF07*qoM6N<$f?nG3R{#J2 literal 0 HcwPel00001 diff --git a/src/xcode/SDLMain.h b/src/xcode/SDLMain.h new file mode 100644 index 0000000..4683df5 --- /dev/null +++ b/src/xcode/SDLMain.h @@ -0,0 +1,11 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + Initial Version: Darrell Walisser + Non-NIB-Code & other changes: Max Horn + + Feel free to customize this file to suit your needs +*/ + +#import + +@interface SDLMain : NSObject +@end diff --git a/src/xcode/SDLMain.m b/src/xcode/SDLMain.m new file mode 100644 index 0000000..1022a3e --- /dev/null +++ b/src/xcode/SDLMain.m @@ -0,0 +1,401 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + Initial Version: Darrell Walisser + Non-NIB-Code & other changes: Max Horn + + Feel free to customize this file to suit your needs +*/ + +#import "SDL.h" +#import "SDLMain.h" +#import /* for MAXPATHLEN */ +#import + +/* For some reaon, Apple removed setAppleMenu from the headers in 10.4, + but the method still is there and works. To avoid warnings, we declare + it ourselves here. */ +@interface NSApplication(SDL_Missing_Methods) +- (void)setAppleMenu:(NSMenu *)menu; +@end + +/* Use this flag to determine whether we use SDLMain.nib or not */ +#define SDL_USE_NIB_FILE 0 + +/* Use this flag to determine whether we use CPS (docking) or not */ +#define SDL_USE_CPS 1 +#ifdef SDL_USE_CPS +/* Portions of CPS.h */ +typedef struct CPSProcessSerNum +{ + UInt32 lo; + UInt32 hi; +} CPSProcessSerNum; + +extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); +extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); +extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); + +#endif /* SDL_USE_CPS */ + +static int gArgc; +static char **gArgv; +static BOOL gFinderLaunch; +static BOOL gCalledAppMainline = FALSE; + +static NSString *getApplicationName(void) +{ + NSDictionary *dict; + NSString *appName = 0; + + /* Determine the application name */ + dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); + if (dict) + appName = [dict objectForKey: @"CFBundleName"]; + + if (![appName length]) + appName = [[NSProcessInfo processInfo] processName]; + + return appName; +} + +#if SDL_USE_NIB_FILE +/* A helper category for NSString */ +@interface NSString (ReplaceSubString) +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; +@end +#endif + +@interface SDLApplication : NSApplication +@end + +@implementation SDLApplication +/* Invoked from the Quit menu item */ +- (void)terminate:(id)sender +{ + /* Post a SDL_QUIT event */ + SDL_Event event; + event.type = SDL_QUIT; + SDL_PushEvent(&event); +} + +// ADDED SO IT DOESN'T BEEP BECAUSE WE ENABLE SDL_ENABLEAPPEVENTS +- (void)sendEvent:(NSEvent *)anEvent +{ + if( NSKeyDown == [anEvent type] || NSKeyUp == [anEvent type] ) { + if( [anEvent modifierFlags] & NSCommandKeyMask ) + [super sendEvent: anEvent]; + } else + [super sendEvent: anEvent]; +} +@end + +/* The main class of the application, the application's delegate */ +@implementation SDLMain + +/* Set the working directory to the .app's parent directory */ +- (void) setupWorkingDirectory:(BOOL)shouldChdir +{ + if (shouldChdir) + { + char parentdir[MAXPATHLEN]; + CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); + if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) { + assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ + } + CFRelease(url); + CFRelease(url2); + } + +} + +#if SDL_USE_NIB_FILE + +/* Fix menu to contain the real app name instead of "SDL App" */ +- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName +{ + NSRange aRange; + NSEnumerator *enumerator; + NSMenuItem *menuItem; + + aRange = [[aMenu title] rangeOfString:@"SDL App"]; + if (aRange.length != 0) + [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]]; + + enumerator = [[aMenu itemArray] objectEnumerator]; + while ((menuItem = [enumerator nextObject])) + { + aRange = [[menuItem title] rangeOfString:@"SDL App"]; + if (aRange.length != 0) + [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; + if ([menuItem hasSubmenu]) + [self fixMenu:[menuItem submenu] withAppName:appName]; + } + [ aMenu sizeToFit ]; +} + +#else + +static void setApplicationMenu(void) +{ + /* warning: this code is very odd */ + NSMenu *appleMenu; + NSMenuItem *menuItem; + NSString *title; + NSString *appName; + + appName = getApplicationName(); + appleMenu = [[NSMenu alloc] initWithTitle:@""]; + + /* Add menu items */ + title = [@"About " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Hide " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; + + menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; + [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + + [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; + + [appleMenu addItem:[NSMenuItem separatorItem]]; + + title = [@"Quit " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; + + + /* Put menu into the menubar */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:appleMenu]; + [[NSApp mainMenu] addItem:menuItem]; + + /* Tell the application object that this is now the application menu */ + [NSApp setAppleMenu:appleMenu]; + + /* Finally give up our references to the objects */ + [appleMenu release]; + [menuItem release]; +} + +/* Create a window menu */ +static void setupWindowMenu(void) +{ + NSMenu *windowMenu; + NSMenuItem *windowMenuItem; + NSMenuItem *menuItem; + + windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; + + /* "Minimize" item */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; + [windowMenu addItem:menuItem]; + [menuItem release]; + + /* Put menu into the menubar */ + windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; + [windowMenuItem setSubmenu:windowMenu]; + [[NSApp mainMenu] addItem:windowMenuItem]; + + /* Tell the application object that this is now the window menu */ + [NSApp setWindowsMenu:windowMenu]; + + /* Finally give up our references to the objects */ + [windowMenu release]; + [windowMenuItem release]; +} + +/* Replacement for NSApplicationMain */ +static void CustomApplicationMain (int argc, char **argv) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + SDLMain *sdlMain; + + /* Ensure the application object is initialised */ + [SDLApplication sharedApplication]; + +#ifdef SDL_USE_CPS + /* @TODO - use this to get rid of the warnings? + { + ProcessSerialNumber psn = { 0, kCurrentProcess }; + if(TransformProcessType(&psn,kProcessTransformToForegroundApplication)==0) //10.3 + if(SetFrontProcess(&psn) == 0) + [SDLApplication sharedApplication]; + } + */ + { + CPSProcessSerNum PSN; + /* Tell the dock about us */ + if (!CPSGetCurrentProcess(&PSN)) + if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) + if (!CPSSetFrontProcess(&PSN)) + [SDLApplication sharedApplication]; + } +#endif /* SDL_USE_CPS */ + + /* Set up the menubar */ + [NSApp setMainMenu:[[NSMenu alloc] init]]; + setApplicationMenu(); + setupWindowMenu(); + + /* Create SDLMain and make it the app delegate */ + sdlMain = [[SDLMain alloc] init]; + [NSApp setDelegate:sdlMain]; + + /* Start the main event loop */ + [NSApp run]; + + [sdlMain release]; + [pool release]; +} + +#endif + + +/* + * Catch document open requests...this lets us notice files when the app + * was launched by double-clicking a document, or when a document was + * dragged/dropped on the app's icon. You need to have a + * CFBundleDocumentsType section in your Info.plist to get this message, + * apparently. + * + * Files are added to gArgv, so to the app, they'll look like command line + * arguments. Previously, apps launched from the finder had nothing but + * an argv[0]. + * + * This message may be received multiple times to open several docs on launch. + * + * This message is ignored once the app's mainline has been called. + */ +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename +{ + const char *temparg; + size_t arglen; + char *arg; + char **newargv; + + if (!gFinderLaunch) /* MacOS is passing command line args. */ + return FALSE; + + if (gCalledAppMainline) /* app has started, ignore this document. */ + return FALSE; + + temparg = [filename UTF8String]; + arglen = SDL_strlen(temparg) + 1; + arg = (char *) SDL_malloc(arglen); + if (arg == NULL) + return FALSE; + + newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2)); + if (newargv == NULL) + { + SDL_free(arg); + return FALSE; + } + gArgv = newargv; + + SDL_strlcpy(arg, temparg, arglen); + gArgv[gArgc++] = arg; + gArgv[gArgc] = NULL; + return TRUE; +} + + +/* Called when the internal event loop has just started running */ +- (void) applicationDidFinishLaunching: (NSNotification *) note +{ + int status; + + /* Set the working directory to the .app's parent directory */ + [self setupWorkingDirectory:gFinderLaunch]; + +#if SDL_USE_NIB_FILE + /* Set the main menu to contain the real app name instead of "SDL App" */ + [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()]; +#endif + + /* Hand off to main application code */ + gCalledAppMainline = TRUE; + status = SDL_main (gArgc, gArgv); + + /* We're done, thank you for playing */ + exit(status); +} +@end + + +@implementation NSString (ReplaceSubString) + +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString +{ + unsigned int bufferSize; + unsigned int selfLen = [self length]; + unsigned int aStringLen = [aString length]; + unichar *buffer; + NSRange localRange; + NSString *result; + + bufferSize = selfLen + aStringLen - aRange.length; + buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar)); + + /* Get first part into buffer */ + localRange.location = 0; + localRange.length = aRange.location; + [self getCharacters:buffer range:localRange]; + + /* Get middle part into buffer */ + localRange.location = 0; + localRange.length = aStringLen; + [aString getCharacters:(buffer+aRange.location) range:localRange]; + + /* Get last part into buffer */ + localRange.location = aRange.location + aRange.length; + localRange.length = selfLen - localRange.location; + [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange]; + + /* Build output string */ + result = [NSString stringWithCharacters:buffer length:bufferSize]; + + NSDeallocateMemoryPages(buffer, bufferSize); + + return result; +} + +@end + + + +#ifdef main +# undef main +#endif + + +/* Main entry point to executable - should *not* be SDL_main! */ +int main (int argc, char **argv) +{ + /* Copy the arguments into a global variable */ + /* This is passed if we are launched by double-clicking */ + if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { + gArgv = (char **) SDL_malloc(sizeof (char *) * 2); + gArgv[0] = argv[0]; + gArgv[1] = NULL; + gArgc = 1; + gFinderLaunch = YES; + } else { + int i; + gArgc = argc; + gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1)); + for (i = 0; i <= argc; i++) + gArgv[i] = argv[i]; + gFinderLaunch = NO; + } + +#if SDL_USE_NIB_FILE + [SDLApplication poseAsClass:[NSApplication class]]; + NSApplicationMain (argc, argv); +#else + CustomApplicationMain (argc, argv); +#endif + return 0; +} \ No newline at end of file diff --git a/src/xcode/Server.gif b/src/xcode/Server.gif new file mode 100644 index 0000000000000000000000000000000000000000..60a7b3b0a8c6470ddbd4b3516399cbb36e95c96e GIT binary patch literal 2344 zcwPZ03D@>VNk%w1VL$*t0M!5h00030|Ns3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Qzg*U1}x9BtVw_%#IuA?0Cxci;6eyUMgUcO2sLk48x9X|rb8ac5GkGU{Udd6cE6u}E07K;GZ z95@LX0F5Y~lb6421l^~ + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + dmo + + CFBundleTypeIconFile + map.icns + CFBundleTypeName + Sauerbraten demo + CFBundleTypeRole + Viewer + LSTypeIsPackage + + NSPersistentStoreTypeKey + Binary + + + CFBundleTypeExtensions + + ogz + + CFBundleTypeIconFile + map.icns + CFBundleTypeName + Sauerbraten map + CFBundleTypeRole + Editor + LSTypeIsPackage + + NSPersistentStoreTypeKey + Binary + + + CFBundleExecutable + launcher + CFBundleIconFile + sauerbraten + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + SauerbratenServer + CFBundleURLSchemes + + sauerbraten + + + + CFBundleVersion + 1.2 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/src/xcode/macutils.mm b/src/xcode/macutils.mm new file mode 100644 index 0000000..d8b81a8 --- /dev/null +++ b/src/xcode/macutils.mm @@ -0,0 +1,28 @@ +#import + +#define MAXSTRLEN 260 +inline char *s_strncpy(char *d, const char *s, size_t m) { strncpy(d,s,m); d[m-1] = 0; return d; }; +inline char *s_strcat(char *d, const char *s) { size_t n = strlen(d); return s_strncpy(d+n,s,MAXSTRLEN-n); }; + +void mac_pasteconsole(char *commandbuf) +{ + NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; + NSString *type = [pasteboard availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]]; + if (type != nil) { + NSString *contents = [pasteboard stringForType:type]; + if (contents != nil) + s_strcat(commandbuf, [contents lossyCString]); + } +} + +/* + * 0x1030 = 10.3 + * 0x1040 = 10.4 + * 0x1050 = 10.5 + */ +int mac_osversion() +{ + SInt32 MacVersion; + Gestalt(gestaltSystemVersion, &MacVersion); + return MacVersion; +} diff --git a/src/xcode/main.m b/src/xcode/main.m new file mode 100644 index 0000000..05e5b6c --- /dev/null +++ b/src/xcode/main.m @@ -0,0 +1,6 @@ +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **) argv); +} \ No newline at end of file diff --git a/src/xcode/map.icns b/src/xcode/map.icns new file mode 100644 index 0000000000000000000000000000000000000000..fcf4bfdc08aef6c0598f9677be1429f3a74a2dac GIT binary patch literal 36882 zcwX(C2V4|a)VF7MsVZ%E0fAl7sIf$iMx%*Ij4?6BL`_euQBkTTw#1q^vxTL1#I7jT zDE5kif`}l!T9CR+?{zEto;$lBEC@>U&G-I3u9C!i&vVY1J7@09{BuXg6>B$Qm=E1? z#hMQ=410k6A8)fipEnf4D0y?S90s_vgQj@3?y6 zdl;rW{Rn1MP>`RW^Yl?hYGPdE#jDZ9o)}hu7Y-=M&3>Gjn)ER8RLp}c4~&C)o;}G- zONzU8BQGY)9pefI6z1hT%}P&-IHP=aKi&=FiJ&Jp`%zl-QAj@~$rU4t@giN35PW6D z9m18=XHoGk7{5fPSQH)kG~ooHq~^t>3NWIKC^d))d;IwN)vKOfp22rB9|$nKLc6@Y zBusL1<-DOmuA%-YCGhGX2V^@S@5V@q_3JycutT6CfvKI^_{}-#NOI>QwgFbL@_4xaby~KF?u>3f` z<(Ji^7R$C|&0V$Q_!Yre#@kM-RxY`zF10u|+v4LdXZl8-`^bFY3`fT$;p$R@0n1Nk zn7-w7*zrA!FP$8h+*OxaJUL)##a`g<^5N$&5UnmXG%)>3hUL&@>(Yzcax0X4qvUfV$R%=yzK41@B z;plLpL#_F~za&_*)(Z36)f%Oxg-6yFE~QE&|3_-=Zn$Qx-RAv4_+QYhwR7tiZsrFZ z-?L{|hgv)M^XCifHaYJKz7T!q^oi%o+Q*}&&ici{e&%e?%XbpXiUh5-c8_T_e%9P6 zBUf%1_RI0)(4Q>Nt8486lVLj8a>53W&*%o$pPCz(UPHA;ZETFinMQQRD7*c{aAU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77nOS(woc^m^EUjuPm__vbw~^nrSReVv#1I-EkGX=&@|=;*%Q1|GFv R?(298YSh=?NWYz;{SV6Te)#|Z literal 0 HcwPel00001 diff --git a/src/xcode/sauerbraten-Info.plist b/src/xcode/sauerbraten-Info.plist new file mode 100644 index 0000000..f4febb0 --- /dev/null +++ b/src/xcode/sauerbraten-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sauerbraten + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.2 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/src/xcode/sauerbraten.icns b/src/xcode/sauerbraten.icns new file mode 100644 index 0000000000000000000000000000000000000000..9bf56a1a41ef3427d24112c700a53eb457ea723e GIT binary patch literal 33393 zcwX&$2UJv7xHTQ6&D=JX5lieXwx}_-Xo`t7Mq_NTzzm4Jqeh2m^ePCV2!e zZ!@#cXPZG73}yy(pxAJfW65%`XPw}P4Tm|lEGB2^S`LGC3@#6H?AZ>S;Rg(cv{CT! z2oxRQU@Y8a+QFw9y;i5!JxQPKjI$2{u%BZ?Ikff3GHAUu-dY=-;Za}*domr66pk%r z@3JJ*V9-i560NPyV7RlWg9DWY*j|n;8*`D|0ZgWmYi$gMC%$|pI~AZ^oE8-Olj$2D z>2z9!Mxkw?)9W8?oz|J4_5!+-V@Wy=JR~;wYy6R{D5AF`u^WIL92*v+)0Wo;ZJ;I) zA%)w!J5tGjByem<2hQkBgFaXjjF7t%_zq+eAaR_Q6xD6j^}KLWsuUaRA*z*9Q@24XT<@!g=2#=2d#Q+(8*|22B;x#Wq$(S252AR19UceLviYC4l@eSaB#LCdEH>p1<`1bPHeEeJlcVX1TdJ>l7;hz_?<1$s#U=i zxSd{aFep#^e$K^NVL%GvSTou$ys6Vmswfh@*kE;YO&2G22oU_?0Ws}o{$ntxrBxIe zP%QtQ=EMvJhA(1ZLnDd}YIzkyp@+LD-9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NgCd zq?=0F)HvG4lxJnw4Uf1~YARjRqxARap^a#SUSZj$GX3{>9&BopFu&MTj(3aeBN{L_ z|MnNXsRZvD`t%7_b$Wj^DfD+!;^v9#AyYflwr?3~O4Ym(%&6(^wEPcKg659yR(EhNv>$Il0%^f;e*)nab{7aj0wr@YFpe66Q36yVY z7`*Kd&ql3k!bZPop;oFjh8j_aKMK{G_c9nXZ))FIJ^lu5>6>Qn2f8|P*5?m3C{s1- zVAPkD)p1Al`_p4o+e}r^YwMX?8t{kEmo`fy=vAd<^`vRoA2mWV>_bb{_1=Ujf9MDA z-T)0`Fzx?-`-%_#AN)V~fABZOdtdRv|AYSr z{}2AAc<(Dd_-FW;KGb+mxX0_^F9FGl=Q7=x_?PLuTFCm*0Zxr$!kSZ{q-py*Xxd=*DX^SjH8ME%GC|JL)diq?r0Of zbZ&}&S>jh*Q}%QWPcfCMDjM%!ytTV2-|86ikEwJO(P;la>hALOg>!U~sf=_q(*J>1 zlmASKnt!Vixf|nOdU}q%*?)W@*6Ok_9df4{FOj|PMEDrqpi z3I77mcmCtB&g(K7m=qiG|9kJcM*rx$!LSXj*P{XdU<*@u8y(j3Zr5W{umAP$o6jD? zW>nmrx_*;Zr@#KssIQE67tIsH>i8R+y8Qoo*S|WcFWR4MgunLGJB)V|Ve$DH6aK2r zpPHM>@-ESG?568AesLZYUB?mSbb8`%a*Bb~^y!RKw O&fWRi6z4-U6#oxLptU>z literal 0 HcwPel00001 diff --git a/src/xcode/sauerbraten.xcodeproj/CVS/Entries b/src/xcode/sauerbraten.xcodeproj/CVS/Entries new file mode 100644 index 0000000..a9b7ee9 --- /dev/null +++ b/src/xcode/sauerbraten.xcodeproj/CVS/Entries @@ -0,0 +1,2 @@ +/project.pbxproj/1.27/Sun Jun 15 00:38:05 2008// +D diff --git a/src/xcode/sauerbraten.xcodeproj/CVS/Repository b/src/xcode/sauerbraten.xcodeproj/CVS/Repository new file mode 100644 index 0000000..d9f2d30 --- /dev/null +++ b/src/xcode/sauerbraten.xcodeproj/CVS/Repository @@ -0,0 +1 @@ +sauerbraten/src/xcode/sauerbraten.xcodeproj diff --git a/src/xcode/sauerbraten.xcodeproj/CVS/Root b/src/xcode/sauerbraten.xcodeproj/CVS/Root new file mode 100644 index 0000000..173dcb3 --- /dev/null +++ b/src/xcode/sauerbraten.xcodeproj/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@sauerbraten.cvs.sourceforge.net:/cvsroot/sauerbraten diff --git a/src/xcode/sauerbraten.xcodeproj/project.pbxproj b/src/xcode/sauerbraten.xcodeproj/project.pbxproj new file mode 100644 index 0000000..95f62fc --- /dev/null +++ b/src/xcode/sauerbraten.xcodeproj/project.pbxproj @@ -0,0 +1,995 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 666E40F00B67D87F005B491F /* macutils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 666E40EF0B67D87F005B491F /* macutils.mm */; }; + B90357B509D09B9D002C9DC7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + B90ADD4509B344D800A5B00B /* callbacks.c in Sources */ = {isa = PBXBuildFile; fileRef = B90ADD0009B344D800A5B00B /* callbacks.c */; }; + B90ADD5709B344D800A5B00B /* host.c in Sources */ = {isa = PBXBuildFile; fileRef = B90ADD1309B344D800A5B00B /* host.c */; }; + B90ADD6A09B344D800A5B00B /* list.c in Sources */ = {isa = PBXBuildFile; fileRef = B90ADD2809B344D800A5B00B /* list.c */; }; + B90ADD7109B344D800A5B00B /* packet.c in Sources */ = {isa = PBXBuildFile; fileRef = B90ADD2F09B344D800A5B00B /* packet.c */; }; + B90ADD7209B344D800A5B00B /* peer.c in Sources */ = {isa = PBXBuildFile; fileRef = B90ADD3009B344D800A5B00B /* peer.c */; }; + B90ADD7309B344D800A5B00B /* protocol.c in Sources */ = {isa = PBXBuildFile; fileRef = B90ADD3109B344D800A5B00B /* protocol.c */; }; + B90ADD7609B344D800A5B00B /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = B90ADD3409B344D800A5B00B /* unix.c */; }; + B91D401F0D525FD3004EF78A /* animmodel.h in Headers */ = {isa = PBXBuildFile; fileRef = B91D401E0D525FD3004EF78A /* animmodel.h */; }; + B91D40210D525FE0004EF78A /* decal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B91D40200D525FE0004EF78A /* decal.cpp */; }; + B91D40230D525FE9004EF78A /* md5.h in Headers */ = {isa = PBXBuildFile; fileRef = B91D40220D525FE9004EF78A /* md5.h */; }; + B91D40250D52600A004EF78A /* skelmodel.h in Headers */ = {isa = PBXBuildFile; fileRef = B91D40240D52600A004EF78A /* skelmodel.h */; }; + B92DC0FC09D08CF9008219BD /* SDL_image.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B92DC0F909D08CF9008219BD /* SDL_image.framework */; }; + B92DC0FD09D08CF9008219BD /* SDL_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B92DC0FA09D08CF9008219BD /* SDL_mixer.framework */; }; + B92DC0FE09D08CF9008219BD /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B92DC0FB09D08CF9008219BD /* SDL.framework */; }; + B930D0920A3D9BC700BDFB85 /* ConsoleView.m in Sources */ = {isa = PBXBuildFile; fileRef = B930D0910A3D9BC700BDFB85 /* ConsoleView.m */; }; + B930D0D20A3DA92300BDFB85 /* map.icns in Resources */ = {isa = PBXBuildFile; fileRef = B930D0D10A3DA92300BDFB85 /* map.icns */; }; + B941988C09207E810029DAD1 /* SDLMain.h in Headers */ = {isa = PBXBuildFile; fileRef = F5A47A9D01A0482F01D3D55B /* SDLMain.h */; }; + B94198A509207E810029DAD1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + B94198A809207E810029DAD1 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = F5A47A9E01A0483001D3D55B /* SDLMain.m */; }; + B94198C309207E810029DAD1 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; + B94198C409207E810029DAD1 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2F67ED704C74A3F00A80002 /* OpenGL.framework */; }; + B96D0D590920970C00B6C936 /* Launcher.m in Sources */ = {isa = PBXBuildFile; fileRef = B96D0D580920970C00B6C936 /* Launcher.m */; }; + B96D0D630920971300B6C936 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = B96D0D5A0920971300B6C936 /* MainMenu.nib */; }; + B96D0D6D0920976E00B6C936 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B96D0D6C0920976E00B6C936 /* main.m */; }; + B9AC7ACF0D06DB44005506F8 /* 3dgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A840D06DB44005506F8 /* 3dgui.cpp */; }; + B9AC7AD00D06DB44005506F8 /* bih.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A850D06DB44005506F8 /* bih.cpp */; }; + B9AC7AD10D06DB44005506F8 /* bih.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7A860D06DB44005506F8 /* bih.h */; }; + B9AC7AD20D06DB44005506F8 /* client.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A870D06DB44005506F8 /* client.cpp */; }; + B9AC7AD30D06DB44005506F8 /* command.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A880D06DB44005506F8 /* command.cpp */; }; + B9AC7AD40D06DB44005506F8 /* console.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A890D06DB44005506F8 /* console.cpp */; }; + B9AC7AD50D06DB44005506F8 /* cubeloader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A8A0D06DB44005506F8 /* cubeloader.cpp */; }; + B9AC7AD60D06DB44005506F8 /* engine.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7A8B0D06DB44005506F8 /* engine.h */; }; + B9AC7AD70D06DB44005506F8 /* grass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A8C0D06DB44005506F8 /* grass.cpp */; }; + B9AC7AD80D06DB44005506F8 /* lightmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A8D0D06DB44005506F8 /* lightmap.cpp */; }; + B9AC7AD90D06DB44005506F8 /* lightmap.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7A8E0D06DB44005506F8 /* lightmap.h */; }; + B9AC7ADA0D06DB44005506F8 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A8F0D06DB44005506F8 /* main.cpp */; }; + B9AC7ADB0D06DB44005506F8 /* material.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A900D06DB44005506F8 /* material.cpp */; }; + B9AC7ADC0D06DB44005506F8 /* md2.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7A910D06DB44005506F8 /* md2.h */; }; + B9AC7ADD0D06DB44005506F8 /* md3.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7A920D06DB44005506F8 /* md3.h */; }; + B9AC7ADE0D06DB44005506F8 /* menus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A930D06DB44005506F8 /* menus.cpp */; }; + B9AC7ADF0D06DB44005506F8 /* model.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7A940D06DB44005506F8 /* model.h */; }; + B9AC7AE00D06DB44005506F8 /* normal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A950D06DB44005506F8 /* normal.cpp */; }; + B9AC7AE10D06DB44005506F8 /* octa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A960D06DB44005506F8 /* octa.cpp */; }; + B9AC7AE20D06DB44005506F8 /* octa.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7A970D06DB44005506F8 /* octa.h */; }; + B9AC7AE30D06DB44005506F8 /* octaedit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A980D06DB44005506F8 /* octaedit.cpp */; }; + B9AC7AE40D06DB44005506F8 /* octarender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A990D06DB44005506F8 /* octarender.cpp */; }; + B9AC7AE50D06DB44005506F8 /* physics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A9A0D06DB44005506F8 /* physics.cpp */; }; + B9AC7AE60D06DB44005506F8 /* rendergl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A9B0D06DB44005506F8 /* rendergl.cpp */; }; + B9AC7AE70D06DB44005506F8 /* rendermodel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A9C0D06DB44005506F8 /* rendermodel.cpp */; }; + B9AC7AE80D06DB44005506F8 /* renderparticles.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A9D0D06DB44005506F8 /* renderparticles.cpp */; }; + B9AC7AE90D06DB44005506F8 /* rendersky.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A9E0D06DB44005506F8 /* rendersky.cpp */; }; + B9AC7AEA0D06DB44005506F8 /* rendertext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7A9F0D06DB44005506F8 /* rendertext.cpp */; }; + B9AC7AEB0D06DB44005506F8 /* renderva.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AA00D06DB44005506F8 /* renderva.cpp */; }; + B9AC7AEC0D06DB44005506F8 /* server.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AA10D06DB44005506F8 /* server.cpp */; }; + B9AC7AED0D06DB44005506F8 /* serverbrowser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AA20D06DB44005506F8 /* serverbrowser.cpp */; }; + B9AC7AEE0D06DB44005506F8 /* shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AA30D06DB44005506F8 /* shader.cpp */; }; + B9AC7AEF0D06DB44005506F8 /* shadowmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AA40D06DB44005506F8 /* shadowmap.cpp */; }; + B9AC7AF00D06DB44005506F8 /* sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AA50D06DB44005506F8 /* sound.cpp */; }; + B9AC7AF10D06DB44005506F8 /* texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AA60D06DB44005506F8 /* texture.cpp */; }; + B9AC7AF20D06DB44005506F8 /* texture.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AA70D06DB44005506F8 /* texture.h */; }; + B9AC7AF30D06DB44005506F8 /* vertmodel.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AA80D06DB44005506F8 /* vertmodel.h */; }; + B9AC7AF40D06DB44005506F8 /* water.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AA90D06DB44005506F8 /* water.cpp */; }; + B9AC7AF50D06DB44005506F8 /* world.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AAA0D06DB44005506F8 /* world.cpp */; }; + B9AC7AF60D06DB44005506F8 /* world.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AAB0D06DB44005506F8 /* world.h */; }; + B9AC7AF70D06DB44005506F8 /* worldio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AAC0D06DB44005506F8 /* worldio.cpp */; }; + B9AC7AF80D06DB44005506F8 /* capture.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AAE0D06DB44005506F8 /* capture.h */; }; + B9AC7AF90D06DB44005506F8 /* client.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AAF0D06DB44005506F8 /* client.h */; }; + B9AC7AFA0D06DB44005506F8 /* entities.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AB00D06DB44005506F8 /* entities.h */; }; + B9AC7AFB0D06DB44005506F8 /* fps.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AB10D06DB44005506F8 /* fps.cpp */; }; + B9AC7AFC0D06DB44005506F8 /* fpsrender.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AB20D06DB44005506F8 /* fpsrender.h */; }; + B9AC7AFD0D06DB44005506F8 /* fpsserver.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AB30D06DB44005506F8 /* fpsserver.h */; }; + B9AC7AFE0D06DB44005506F8 /* game.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AB40D06DB44005506F8 /* game.h */; }; + B9AC7AFF0D06DB44005506F8 /* monster.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AB50D06DB44005506F8 /* monster.h */; }; + B9AC7B000D06DB44005506F8 /* movable.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AB60D06DB44005506F8 /* movable.h */; }; + B9AC7B010D06DB44005506F8 /* scoreboard.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AB70D06DB44005506F8 /* scoreboard.h */; }; + B9AC7B020D06DB44005506F8 /* weapon.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AB80D06DB44005506F8 /* weapon.h */; }; + B9AC7B030D06DB44005506F8 /* entities.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7ABA0D06DB44005506F8 /* entities.h */; }; + B9AC7B040D06DB44005506F8 /* rpg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7ABB0D06DB44005506F8 /* rpg.cpp */; }; + B9AC7B050D06DB44005506F8 /* rpgent.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7ABC0D06DB44005506F8 /* rpgent.h */; }; + B9AC7B060D06DB44005506F8 /* rpgobj.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7ABD0D06DB44005506F8 /* rpgobj.h */; }; + B9AC7B070D06DB44005506F8 /* rpgobjset.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7ABE0D06DB44005506F8 /* rpgobjset.h */; }; + B9AC7B080D06DB44005506F8 /* stats.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7ABF0D06DB44005506F8 /* stats.h */; }; + B9AC7B090D06DB44005506F8 /* stubs.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AC00D06DB44005506F8 /* stubs.h */; }; + B9AC7B0A0D06DB44005506F8 /* command.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AC20D06DB44005506F8 /* command.h */; }; + B9AC7B0B0D06DB44005506F8 /* cube.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AC30D06DB44005506F8 /* cube.h */; }; + B9AC7B0C0D06DB44005506F8 /* ents.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AC40D06DB44005506F8 /* ents.h */; }; + B9AC7B0D0D06DB44005506F8 /* geom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AC50D06DB44005506F8 /* geom.cpp */; }; + B9AC7B0E0D06DB44005506F8 /* geom.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AC60D06DB44005506F8 /* geom.h */; }; + B9AC7B0F0D06DB44005506F8 /* iengine.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AC70D06DB44005506F8 /* iengine.h */; }; + B9AC7B100D06DB44005506F8 /* igame.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7AC80D06DB44005506F8 /* igame.h */; }; + B9AC7B110D06DB44005506F8 /* pch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7AC90D06DB44005506F8 /* pch.cpp */; }; + B9AC7B120D06DB44005506F8 /* pch.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7ACA0D06DB44005506F8 /* pch.h */; }; + B9AC7B130D06DB44005506F8 /* sbtrace.d in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7ACB0D06DB44005506F8 /* sbtrace.d */; }; + B9AC7B140D06DB44005506F8 /* sbtrace.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7ACC0D06DB44005506F8 /* sbtrace.h */; }; + B9AC7B150D06DB44005506F8 /* tools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B9AC7ACD0D06DB44005506F8 /* tools.cpp */; }; + B9AC7B160D06DB44005506F8 /* tools.h in Headers */ = {isa = PBXBuildFile; fileRef = B9AC7ACE0D06DB44005506F8 /* tools.h */; }; + B9CACA13092099DF00A13F04 /* launcher-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B9CACA12092099DF00A13F04 /* launcher-Info.plist */; }; + B9CACA15092099E700A13F04 /* sauerbraten-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B9CACA14092099E700A13F04 /* sauerbraten-Info.plist */; }; + B9CACA2509209A5800A13F04 /* sauerbraten.icns in Resources */ = {isa = PBXBuildFile; fileRef = B97E99CE085F4B3E002F9BC6 /* sauerbraten.icns */; }; + D116C0AB0D9F7DB500E8B945 /* rendertarget.h in Headers */ = {isa = PBXBuildFile; fileRef = D116C0AA0D9F7DB500E8B945 /* rendertarget.h */; }; + D118DEB60D979281000E8C4C /* glare.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D118DEB50D979281000E8C4C /* glare.cpp */; }; + D123F95B0DA8B312001DB09F /* ctf.h in Headers */ = {isa = PBXBuildFile; fileRef = D123F95A0DA8B312001DB09F /* ctf.h */; }; + D139B59E0D59A8E600AA994D /* assassin.h in Headers */ = {isa = PBXBuildFile; fileRef = D139B59D0D59A8E600AA994D /* assassin.h */; }; + D167A1970C493AED007F7D96 /* Nomap.png in Resources */ = {isa = PBXBuildFile; fileRef = D167A1960C493AED007F7D96 /* Nomap.png */; }; + D16BD00D0D7000EA0053CECE /* dynlight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D16BD00C0D7000EA0053CECE /* dynlight.cpp */; }; + D16C16920E04812500A522EB /* obj.h in Headers */ = {isa = PBXBuildFile; fileRef = D16C16900E04812500A522EB /* obj.h */; }; + D16C16930E04812500A522EB /* textedit.h in Headers */ = {isa = PBXBuildFile; fileRef = D16C16910E04812500A522EB /* textedit.h */; }; + D17E0F2C0BAF1FA9008BB696 /* Keys.gif in Resources */ = {isa = PBXBuildFile; fileRef = D17E0F280BAF1FA9008BB696 /* Keys.gif */; }; + D17E0F2E0BAF1FA9008BB696 /* Server.gif in Resources */ = {isa = PBXBuildFile; fileRef = D17E0F2A0BAF1FA9008BB696 /* Server.gif */; }; + D17E0F310BAF2031008BB696 /* Help.tiff in Resources */ = {isa = PBXBuildFile; fileRef = D17E0F300BAF2031008BB696 /* Help.tiff */; }; + D18B8FC10DB0AF8200171439 /* explosion.h in Headers */ = {isa = PBXBuildFile; fileRef = D18B8FBE0DB0AF8200171439 /* explosion.h */; }; + D18B8FC20DB0AF8200171439 /* lensflare.h in Headers */ = {isa = PBXBuildFile; fileRef = D18B8FBF0DB0AF8200171439 /* lensflare.h */; }; + D18B8FC30DB0AF8200171439 /* lightning.h in Headers */ = {isa = PBXBuildFile; fileRef = D18B8FC00DB0AF8200171439 /* lightning.h */; }; + D1C660CA0D5467C8002E52C1 /* pvs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D1C660C90D5467C8002E52C1 /* pvs.cpp */; }; + D1DB53E80D70F1CD003AE25C /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = D1DB53E70D70F1CD003AE25C /* Localizable.strings */; }; + D1F0AC200BB0688A00CE4E84 /* Maps.gif in Resources */ = {isa = PBXBuildFile; fileRef = D1F0AC1F0BB0688A00CE4E84 /* Maps.gif */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + B96D0D780920980E00B6C936 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = B96D0D4B092096F200B6C936; + remoteInfo = launcher; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 666E40EF0B67D87F005B491F /* macutils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = macutils.mm; sourceTree = ""; }; + B2F67ED704C74A3F00A80002 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; + B90ADD0009B344D800A5B00B /* callbacks.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = callbacks.c; sourceTree = ""; }; + B90ADD1309B344D800A5B00B /* host.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = host.c; sourceTree = ""; }; + B90ADD2809B344D800A5B00B /* list.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = list.c; sourceTree = ""; }; + B90ADD2F09B344D800A5B00B /* packet.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = packet.c; sourceTree = ""; }; + B90ADD3009B344D800A5B00B /* peer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = peer.c; sourceTree = ""; }; + B90ADD3109B344D800A5B00B /* protocol.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = protocol.c; sourceTree = ""; }; + B90ADD3409B344D800A5B00B /* unix.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = unix.c; sourceTree = ""; }; + B91D401E0D525FD3004EF78A /* animmodel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = animmodel.h; sourceTree = ""; }; + B91D40200D525FE0004EF78A /* decal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = decal.cpp; sourceTree = ""; }; + B91D40220D525FE9004EF78A /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = ""; }; + B91D40240D52600A004EF78A /* skelmodel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = skelmodel.h; sourceTree = ""; }; + B92DC0F909D08CF9008219BD /* SDL_image.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_image.framework; path = /Library/Frameworks/SDL_image.framework; sourceTree = ""; }; + B92DC0FA09D08CF9008219BD /* SDL_mixer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_mixer.framework; path = /Library/Frameworks/SDL_mixer.framework; sourceTree = ""; }; + B92DC0FB09D08CF9008219BD /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = ""; }; + B930D0900A3D9BC700BDFB85 /* ConsoleView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ConsoleView.h; sourceTree = ""; }; + B930D0910A3D9BC700BDFB85 /* ConsoleView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ConsoleView.m; sourceTree = ""; }; + B930D0D10A3DA92300BDFB85 /* map.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = map.icns; sourceTree = ""; }; + B94198CB09207E810029DAD1 /* sauerbraten.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = sauerbraten.app; sourceTree = BUILT_PRODUCTS_DIR; }; + B96D0D4C092096F200B6C936 /* launcher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = launcher.app; sourceTree = BUILT_PRODUCTS_DIR; }; + B96D0D570920970C00B6C936 /* Launcher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Launcher.h; sourceTree = ""; }; + B96D0D580920970C00B6C936 /* Launcher.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = Launcher.m; sourceTree = ""; }; + B96D0D5B0920971300B6C936 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; + B96D0D6C0920976E00B6C936 /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + B97E99CE085F4B3E002F9BC6 /* sauerbraten.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = sauerbraten.icns; sourceTree = ""; }; + B9AC7A840D06DB44005506F8 /* 3dgui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = 3dgui.cpp; sourceTree = ""; }; + B9AC7A850D06DB44005506F8 /* bih.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bih.cpp; sourceTree = ""; }; + B9AC7A860D06DB44005506F8 /* bih.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bih.h; sourceTree = ""; }; + B9AC7A870D06DB44005506F8 /* client.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = client.cpp; sourceTree = ""; }; + B9AC7A880D06DB44005506F8 /* command.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = command.cpp; sourceTree = ""; }; + B9AC7A890D06DB44005506F8 /* console.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = console.cpp; sourceTree = ""; }; + B9AC7A8A0D06DB44005506F8 /* cubeloader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cubeloader.cpp; sourceTree = ""; }; + B9AC7A8B0D06DB44005506F8 /* engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = engine.h; sourceTree = ""; }; + B9AC7A8C0D06DB44005506F8 /* grass.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = grass.cpp; sourceTree = ""; }; + B9AC7A8D0D06DB44005506F8 /* lightmap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lightmap.cpp; sourceTree = ""; }; + B9AC7A8E0D06DB44005506F8 /* lightmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lightmap.h; sourceTree = ""; }; + B9AC7A8F0D06DB44005506F8 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + B9AC7A900D06DB44005506F8 /* material.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = material.cpp; sourceTree = ""; }; + B9AC7A910D06DB44005506F8 /* md2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md2.h; sourceTree = ""; }; + B9AC7A920D06DB44005506F8 /* md3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md3.h; sourceTree = ""; }; + B9AC7A930D06DB44005506F8 /* menus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = menus.cpp; sourceTree = ""; }; + B9AC7A940D06DB44005506F8 /* model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model.h; sourceTree = ""; }; + B9AC7A950D06DB44005506F8 /* normal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = normal.cpp; sourceTree = ""; }; + B9AC7A960D06DB44005506F8 /* octa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = octa.cpp; sourceTree = ""; }; + B9AC7A970D06DB44005506F8 /* octa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = octa.h; sourceTree = ""; }; + B9AC7A980D06DB44005506F8 /* octaedit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = octaedit.cpp; sourceTree = ""; }; + B9AC7A990D06DB44005506F8 /* octarender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = octarender.cpp; sourceTree = ""; }; + B9AC7A9A0D06DB44005506F8 /* physics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = physics.cpp; sourceTree = ""; }; + B9AC7A9B0D06DB44005506F8 /* rendergl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rendergl.cpp; sourceTree = ""; }; + B9AC7A9C0D06DB44005506F8 /* rendermodel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rendermodel.cpp; sourceTree = ""; }; + B9AC7A9D0D06DB44005506F8 /* renderparticles.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = renderparticles.cpp; sourceTree = ""; }; + B9AC7A9E0D06DB44005506F8 /* rendersky.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rendersky.cpp; sourceTree = ""; }; + B9AC7A9F0D06DB44005506F8 /* rendertext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rendertext.cpp; sourceTree = ""; }; + B9AC7AA00D06DB44005506F8 /* renderva.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = renderva.cpp; sourceTree = ""; }; + B9AC7AA10D06DB44005506F8 /* server.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = server.cpp; sourceTree = ""; }; + B9AC7AA20D06DB44005506F8 /* serverbrowser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = serverbrowser.cpp; sourceTree = ""; }; + B9AC7AA30D06DB44005506F8 /* shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shader.cpp; sourceTree = ""; }; + B9AC7AA40D06DB44005506F8 /* shadowmap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shadowmap.cpp; sourceTree = ""; }; + B9AC7AA50D06DB44005506F8 /* sound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sound.cpp; sourceTree = ""; }; + B9AC7AA60D06DB44005506F8 /* texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = texture.cpp; sourceTree = ""; }; + B9AC7AA70D06DB44005506F8 /* texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = texture.h; sourceTree = ""; }; + B9AC7AA80D06DB44005506F8 /* vertmodel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vertmodel.h; sourceTree = ""; }; + B9AC7AA90D06DB44005506F8 /* water.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = water.cpp; sourceTree = ""; }; + B9AC7AAA0D06DB44005506F8 /* world.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = world.cpp; sourceTree = ""; }; + B9AC7AAB0D06DB44005506F8 /* world.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = world.h; sourceTree = ""; }; + B9AC7AAC0D06DB44005506F8 /* worldio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = worldio.cpp; sourceTree = ""; }; + B9AC7AAE0D06DB44005506F8 /* capture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = capture.h; sourceTree = ""; }; + B9AC7AAF0D06DB44005506F8 /* client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = client.h; sourceTree = ""; }; + B9AC7AB00D06DB44005506F8 /* entities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = entities.h; sourceTree = ""; }; + B9AC7AB10D06DB44005506F8 /* fps.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fps.cpp; sourceTree = ""; }; + B9AC7AB20D06DB44005506F8 /* fpsrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpsrender.h; sourceTree = ""; }; + B9AC7AB30D06DB44005506F8 /* fpsserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fpsserver.h; sourceTree = ""; }; + B9AC7AB40D06DB44005506F8 /* game.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = game.h; sourceTree = ""; }; + B9AC7AB50D06DB44005506F8 /* monster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = monster.h; sourceTree = ""; }; + B9AC7AB60D06DB44005506F8 /* movable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = movable.h; sourceTree = ""; }; + B9AC7AB70D06DB44005506F8 /* scoreboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scoreboard.h; sourceTree = ""; }; + B9AC7AB80D06DB44005506F8 /* weapon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = weapon.h; sourceTree = ""; }; + B9AC7ABA0D06DB44005506F8 /* entities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = entities.h; sourceTree = ""; }; + B9AC7ABB0D06DB44005506F8 /* rpg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rpg.cpp; sourceTree = ""; }; + B9AC7ABC0D06DB44005506F8 /* rpgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rpgent.h; sourceTree = ""; }; + B9AC7ABD0D06DB44005506F8 /* rpgobj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rpgobj.h; sourceTree = ""; }; + B9AC7ABE0D06DB44005506F8 /* rpgobjset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rpgobjset.h; sourceTree = ""; }; + B9AC7ABF0D06DB44005506F8 /* stats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stats.h; sourceTree = ""; }; + B9AC7AC00D06DB44005506F8 /* stubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stubs.h; sourceTree = ""; }; + B9AC7AC20D06DB44005506F8 /* command.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = command.h; sourceTree = ""; }; + B9AC7AC30D06DB44005506F8 /* cube.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cube.h; sourceTree = ""; }; + B9AC7AC40D06DB44005506F8 /* ents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ents.h; sourceTree = ""; }; + B9AC7AC50D06DB44005506F8 /* geom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = geom.cpp; sourceTree = ""; }; + B9AC7AC60D06DB44005506F8 /* geom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = geom.h; sourceTree = ""; }; + B9AC7AC70D06DB44005506F8 /* iengine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iengine.h; sourceTree = ""; }; + B9AC7AC80D06DB44005506F8 /* igame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = igame.h; sourceTree = ""; }; + B9AC7AC90D06DB44005506F8 /* pch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pch.cpp; sourceTree = ""; }; + B9AC7ACA0D06DB44005506F8 /* pch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pch.h; sourceTree = ""; }; + B9AC7ACB0D06DB44005506F8 /* sbtrace.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = sbtrace.d; sourceTree = ""; }; + B9AC7ACC0D06DB44005506F8 /* sbtrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sbtrace.h; sourceTree = ""; }; + B9AC7ACD0D06DB44005506F8 /* tools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tools.cpp; sourceTree = ""; }; + B9AC7ACE0D06DB44005506F8 /* tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tools.h; sourceTree = ""; }; + B9CACA12092099DF00A13F04 /* launcher-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = "launcher-Info.plist"; sourceTree = ""; }; + B9CACA14092099E700A13F04 /* sauerbraten-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = "sauerbraten-Info.plist"; sourceTree = ""; }; + D116C0AA0D9F7DB500E8B945 /* rendertarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rendertarget.h; sourceTree = ""; }; + D118DEB50D979281000E8C4C /* glare.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glare.cpp; sourceTree = ""; }; + D123F95A0DA8B312001DB09F /* ctf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ctf.h; sourceTree = ""; }; + D139B59D0D59A8E600AA994D /* assassin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = assassin.h; sourceTree = ""; }; + D167A1960C493AED007F7D96 /* Nomap.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Nomap.png; sourceTree = ""; }; + D16BD00C0D7000EA0053CECE /* dynlight.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dynlight.cpp; sourceTree = ""; }; + D16C16900E04812500A522EB /* obj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = obj.h; sourceTree = ""; }; + D16C16910E04812500A522EB /* textedit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = textedit.h; sourceTree = ""; }; + D17E0F280BAF1FA9008BB696 /* Keys.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = Keys.gif; sourceTree = ""; }; + D17E0F2A0BAF1FA9008BB696 /* Server.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = Server.gif; sourceTree = ""; }; + D17E0F300BAF2031008BB696 /* Help.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Help.tiff; sourceTree = ""; }; + D18B8FBE0DB0AF8200171439 /* explosion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = explosion.h; sourceTree = ""; }; + D18B8FBF0DB0AF8200171439 /* lensflare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lensflare.h; sourceTree = ""; }; + D18B8FC00DB0AF8200171439 /* lightning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lightning.h; sourceTree = ""; }; + D1C660C90D5467C8002E52C1 /* pvs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pvs.cpp; sourceTree = ""; }; + D1DB53E50D70F1C3003AE25C /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; + D1F0AC1F0BB0688A00CE4E84 /* Maps.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = Maps.gif; sourceTree = ""; }; + F5A47A9D01A0482F01D3D55B /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = SOURCE_ROOT; }; + F5A47A9E01A0483001D3D55B /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + B94198C209207E810029DAD1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B94198C309207E810029DAD1 /* Cocoa.framework in Frameworks */, + B94198C409207E810029DAD1 /* OpenGL.framework in Frameworks */, + B92DC0FC09D08CF9008219BD /* SDL_image.framework in Frameworks */, + B92DC0FD09D08CF9008219BD /* SDL_mixer.framework in Frameworks */, + B92DC0FE09D08CF9008219BD /* SDL.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B96D0D4A092096F200B6C936 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 666E40EF0B67D87F005B491F /* macutils.mm */, + B96D0D6C0920976E00B6C936 /* main.m */, + B930D0900A3D9BC700BDFB85 /* ConsoleView.h */, + B930D0910A3D9BC700BDFB85 /* ConsoleView.m */, + B96D0D570920970C00B6C936 /* Launcher.h */, + B96D0D580920970C00B6C936 /* Launcher.m */, + F5A47A9D01A0482F01D3D55B /* SDLMain.h */, + F5A47A9E01A0483001D3D55B /* SDLMain.m */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + B92DC0F909D08CF9008219BD /* SDL_image.framework */, + B92DC0FA09D08CF9008219BD /* SDL_mixer.framework */, + B92DC0FB09D08CF9008219BD /* SDL.framework */, + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + B2F67ED704C74A3F00A80002 /* OpenGL.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + B94198CB09207E810029DAD1 /* sauerbraten.app */, + B96D0D4C092096F200B6C936 /* launcher.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* sauerbraten */ = { + isa = PBXGroup; + children = ( + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = sauerbraten; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + B90ADCEE09B344D800A5B00B /* enet */, + B9AC7A830D06DB44005506F8 /* engine */, + B9AC7AAD0D06DB44005506F8 /* fpsgame */, + B9AC7AB90D06DB44005506F8 /* rpggame */, + B9AC7AC10D06DB44005506F8 /* shared */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + D167A1960C493AED007F7D96 /* Nomap.png */, + D1F0AC1F0BB0688A00CE4E84 /* Maps.gif */, + D17E0F280BAF1FA9008BB696 /* Keys.gif */, + D17E0F2A0BAF1FA9008BB696 /* Server.gif */, + D17E0F300BAF2031008BB696 /* Help.tiff */, + B930D0D10A3DA92300BDFB85 /* map.icns */, + B9CACA14092099E700A13F04 /* sauerbraten-Info.plist */, + B9CACA12092099DF00A13F04 /* launcher-Info.plist */, + B97E99CE085F4B3E002F9BC6 /* sauerbraten.icns */, + B96D0D5A0920971300B6C936 /* MainMenu.nib */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + D1DB53E70D70F1CD003AE25C /* Localizable.strings */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + B90ADCEE09B344D800A5B00B /* enet */ = { + isa = PBXGroup; + children = ( + B90ADD0009B344D800A5B00B /* callbacks.c */, + B90ADD1309B344D800A5B00B /* host.c */, + B90ADD2809B344D800A5B00B /* list.c */, + B90ADD2F09B344D800A5B00B /* packet.c */, + B90ADD3009B344D800A5B00B /* peer.c */, + B90ADD3109B344D800A5B00B /* protocol.c */, + B90ADD3409B344D800A5B00B /* unix.c */, + ); + name = enet; + path = ../enet; + sourceTree = SOURCE_ROOT; + }; + B9AC7A830D06DB44005506F8 /* engine */ = { + isa = PBXGroup; + children = ( + D16C16900E04812500A522EB /* obj.h */, + D16C16910E04812500A522EB /* textedit.h */, + D18B8FBE0DB0AF8200171439 /* explosion.h */, + D18B8FBF0DB0AF8200171439 /* lensflare.h */, + D18B8FC00DB0AF8200171439 /* lightning.h */, + D116C0AA0D9F7DB500E8B945 /* rendertarget.h */, + D118DEB50D979281000E8C4C /* glare.cpp */, + D1C660C90D5467C8002E52C1 /* pvs.cpp */, + D16BD00C0D7000EA0053CECE /* dynlight.cpp */, + B9AC7A840D06DB44005506F8 /* 3dgui.cpp */, + B91D401E0D525FD3004EF78A /* animmodel.h */, + B9AC7A850D06DB44005506F8 /* bih.cpp */, + B9AC7A860D06DB44005506F8 /* bih.h */, + B9AC7A870D06DB44005506F8 /* client.cpp */, + B9AC7A880D06DB44005506F8 /* command.cpp */, + B9AC7A890D06DB44005506F8 /* console.cpp */, + B9AC7A8A0D06DB44005506F8 /* cubeloader.cpp */, + B91D40200D525FE0004EF78A /* decal.cpp */, + B9AC7A8B0D06DB44005506F8 /* engine.h */, + B9AC7A8C0D06DB44005506F8 /* grass.cpp */, + B9AC7A8D0D06DB44005506F8 /* lightmap.cpp */, + B9AC7A8E0D06DB44005506F8 /* lightmap.h */, + B9AC7A8F0D06DB44005506F8 /* main.cpp */, + B9AC7A900D06DB44005506F8 /* material.cpp */, + B9AC7A910D06DB44005506F8 /* md2.h */, + B9AC7A920D06DB44005506F8 /* md3.h */, + B91D40220D525FE9004EF78A /* md5.h */, + B9AC7A930D06DB44005506F8 /* menus.cpp */, + B9AC7A940D06DB44005506F8 /* model.h */, + B9AC7A950D06DB44005506F8 /* normal.cpp */, + B9AC7A960D06DB44005506F8 /* octa.cpp */, + B9AC7A970D06DB44005506F8 /* octa.h */, + B9AC7A980D06DB44005506F8 /* octaedit.cpp */, + B9AC7A990D06DB44005506F8 /* octarender.cpp */, + B9AC7A9A0D06DB44005506F8 /* physics.cpp */, + B9AC7A9B0D06DB44005506F8 /* rendergl.cpp */, + B9AC7A9C0D06DB44005506F8 /* rendermodel.cpp */, + B9AC7A9D0D06DB44005506F8 /* renderparticles.cpp */, + B9AC7A9E0D06DB44005506F8 /* rendersky.cpp */, + B9AC7A9F0D06DB44005506F8 /* rendertext.cpp */, + B9AC7AA00D06DB44005506F8 /* renderva.cpp */, + B9AC7AA10D06DB44005506F8 /* server.cpp */, + B9AC7AA20D06DB44005506F8 /* serverbrowser.cpp */, + B9AC7AA30D06DB44005506F8 /* shader.cpp */, + B9AC7AA40D06DB44005506F8 /* shadowmap.cpp */, + B91D40240D52600A004EF78A /* skelmodel.h */, + B9AC7AA50D06DB44005506F8 /* sound.cpp */, + B9AC7AA60D06DB44005506F8 /* texture.cpp */, + B9AC7AA70D06DB44005506F8 /* texture.h */, + B9AC7AA80D06DB44005506F8 /* vertmodel.h */, + B9AC7AA90D06DB44005506F8 /* water.cpp */, + B9AC7AAA0D06DB44005506F8 /* world.cpp */, + B9AC7AAB0D06DB44005506F8 /* world.h */, + B9AC7AAC0D06DB44005506F8 /* worldio.cpp */, + ); + name = engine; + path = ../engine; + sourceTree = SOURCE_ROOT; + }; + B9AC7AAD0D06DB44005506F8 /* fpsgame */ = { + isa = PBXGroup; + children = ( + D123F95A0DA8B312001DB09F /* ctf.h */, + D139B59D0D59A8E600AA994D /* assassin.h */, + B9AC7AAE0D06DB44005506F8 /* capture.h */, + B9AC7AAF0D06DB44005506F8 /* client.h */, + B9AC7AB00D06DB44005506F8 /* entities.h */, + B9AC7AB10D06DB44005506F8 /* fps.cpp */, + B9AC7AB20D06DB44005506F8 /* fpsrender.h */, + B9AC7AB30D06DB44005506F8 /* fpsserver.h */, + B9AC7AB40D06DB44005506F8 /* game.h */, + B9AC7AB50D06DB44005506F8 /* monster.h */, + B9AC7AB60D06DB44005506F8 /* movable.h */, + B9AC7AB70D06DB44005506F8 /* scoreboard.h */, + B9AC7AB80D06DB44005506F8 /* weapon.h */, + ); + name = fpsgame; + path = ../fpsgame; + sourceTree = SOURCE_ROOT; + }; + B9AC7AB90D06DB44005506F8 /* rpggame */ = { + isa = PBXGroup; + children = ( + B9AC7ABA0D06DB44005506F8 /* entities.h */, + B9AC7ABB0D06DB44005506F8 /* rpg.cpp */, + B9AC7ABC0D06DB44005506F8 /* rpgent.h */, + B9AC7ABD0D06DB44005506F8 /* rpgobj.h */, + B9AC7ABE0D06DB44005506F8 /* rpgobjset.h */, + B9AC7ABF0D06DB44005506F8 /* stats.h */, + B9AC7AC00D06DB44005506F8 /* stubs.h */, + ); + name = rpggame; + path = ../rpggame; + sourceTree = SOURCE_ROOT; + }; + B9AC7AC10D06DB44005506F8 /* shared */ = { + isa = PBXGroup; + children = ( + B9AC7AC20D06DB44005506F8 /* command.h */, + B9AC7AC30D06DB44005506F8 /* cube.h */, + B9AC7AC40D06DB44005506F8 /* ents.h */, + B9AC7AC50D06DB44005506F8 /* geom.cpp */, + B9AC7AC60D06DB44005506F8 /* geom.h */, + B9AC7AC70D06DB44005506F8 /* iengine.h */, + B9AC7AC80D06DB44005506F8 /* igame.h */, + B9AC7AC90D06DB44005506F8 /* pch.cpp */, + B9AC7ACA0D06DB44005506F8 /* pch.h */, + B9AC7ACB0D06DB44005506F8 /* sbtrace.d */, + B9AC7ACC0D06DB44005506F8 /* sbtrace.h */, + B9AC7ACD0D06DB44005506F8 /* tools.cpp */, + B9AC7ACE0D06DB44005506F8 /* tools.h */, + ); + name = shared; + path = ../shared; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + B941988B09207E810029DAD1 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + B941988C09207E810029DAD1 /* SDLMain.h in Headers */, + B9AC7AD10D06DB44005506F8 /* bih.h in Headers */, + B9AC7AD60D06DB44005506F8 /* engine.h in Headers */, + B9AC7AD90D06DB44005506F8 /* lightmap.h in Headers */, + B9AC7ADC0D06DB44005506F8 /* md2.h in Headers */, + B9AC7ADD0D06DB44005506F8 /* md3.h in Headers */, + B9AC7ADF0D06DB44005506F8 /* model.h in Headers */, + B9AC7AE20D06DB44005506F8 /* octa.h in Headers */, + B9AC7AF20D06DB44005506F8 /* texture.h in Headers */, + B9AC7AF30D06DB44005506F8 /* vertmodel.h in Headers */, + B9AC7AF60D06DB44005506F8 /* world.h in Headers */, + B9AC7AF80D06DB44005506F8 /* capture.h in Headers */, + B9AC7AF90D06DB44005506F8 /* client.h in Headers */, + B9AC7AFA0D06DB44005506F8 /* entities.h in Headers */, + B9AC7AFC0D06DB44005506F8 /* fpsrender.h in Headers */, + B9AC7AFD0D06DB44005506F8 /* fpsserver.h in Headers */, + B9AC7AFE0D06DB44005506F8 /* game.h in Headers */, + B9AC7AFF0D06DB44005506F8 /* monster.h in Headers */, + B9AC7B000D06DB44005506F8 /* movable.h in Headers */, + B9AC7B010D06DB44005506F8 /* scoreboard.h in Headers */, + B9AC7B020D06DB44005506F8 /* weapon.h in Headers */, + B9AC7B030D06DB44005506F8 /* entities.h in Headers */, + B9AC7B050D06DB44005506F8 /* rpgent.h in Headers */, + B9AC7B060D06DB44005506F8 /* rpgobj.h in Headers */, + B9AC7B070D06DB44005506F8 /* rpgobjset.h in Headers */, + B9AC7B080D06DB44005506F8 /* stats.h in Headers */, + B9AC7B090D06DB44005506F8 /* stubs.h in Headers */, + B9AC7B0A0D06DB44005506F8 /* command.h in Headers */, + B9AC7B0B0D06DB44005506F8 /* cube.h in Headers */, + B9AC7B0C0D06DB44005506F8 /* ents.h in Headers */, + B9AC7B0E0D06DB44005506F8 /* geom.h in Headers */, + B9AC7B0F0D06DB44005506F8 /* iengine.h in Headers */, + B9AC7B100D06DB44005506F8 /* igame.h in Headers */, + B9AC7B120D06DB44005506F8 /* pch.h in Headers */, + B9AC7B140D06DB44005506F8 /* sbtrace.h in Headers */, + B9AC7B160D06DB44005506F8 /* tools.h in Headers */, + B91D401F0D525FD3004EF78A /* animmodel.h in Headers */, + B91D40230D525FE9004EF78A /* md5.h in Headers */, + B91D40250D52600A004EF78A /* skelmodel.h in Headers */, + D139B59E0D59A8E600AA994D /* assassin.h in Headers */, + D116C0AB0D9F7DB500E8B945 /* rendertarget.h in Headers */, + D123F95B0DA8B312001DB09F /* ctf.h in Headers */, + D18B8FC10DB0AF8200171439 /* explosion.h in Headers */, + D18B8FC20DB0AF8200171439 /* lensflare.h in Headers */, + D18B8FC30DB0AF8200171439 /* lightning.h in Headers */, + D16C16920E04812500A522EB /* obj.h in Headers */, + D16C16930E04812500A522EB /* textedit.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + B941988A09207E810029DAD1 /* sauerbraten */ = { + isa = PBXNativeTarget; + buildConfigurationList = B94198C609207E810029DAD1 /* Build configuration list for PBXNativeTarget "sauerbraten" */; + buildPhases = ( + B941988B09207E810029DAD1 /* Headers */, + B94198A409207E810029DAD1 /* Resources */, + B94198A709207E810029DAD1 /* Sources */, + B94198C209207E810029DAD1 /* Frameworks */, + B94199400920820E0029DAD1 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + B96D0D790920980E00B6C936 /* PBXTargetDependency */, + ); + name = sauerbraten; + productInstallPath = "$(HOME)/Applications"; + productName = sauerbraten; + productReference = B94198CB09207E810029DAD1 /* sauerbraten.app */; + productType = "com.apple.product-type.application"; + }; + B96D0D4B092096F200B6C936 /* launcher */ = { + isa = PBXNativeTarget; + buildConfigurationList = B96D0D4F092096F300B6C936 /* Build configuration list for PBXNativeTarget "launcher" */; + buildPhases = ( + B96D0D48092096F200B6C936 /* Resources */, + B96D0D49092096F200B6C936 /* Sources */, + B96D0D4A092096F200B6C936 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = launcher; + productName = launcher; + productReference = B96D0D4C092096F200B6C936 /* launcher.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = B960CF35085F3CC7004FB142 /* Build configuration list for PBXProject "sauerbraten" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* sauerbraten */; + projectDirPath = ""; + projectRoot = ../..; + targets = ( + B941988A09207E810029DAD1 /* sauerbraten */, + B96D0D4B092096F200B6C936 /* launcher */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + B94198A409207E810029DAD1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B94198A509207E810029DAD1 /* InfoPlist.strings in Resources */, + B9CACA15092099E700A13F04 /* sauerbraten-Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B96D0D48092096F200B6C936 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B96D0D630920971300B6C936 /* MainMenu.nib in Resources */, + B9CACA13092099DF00A13F04 /* launcher-Info.plist in Resources */, + B9CACA2509209A5800A13F04 /* sauerbraten.icns in Resources */, + B90357B509D09B9D002C9DC7 /* InfoPlist.strings in Resources */, + B930D0D20A3DA92300BDFB85 /* map.icns in Resources */, + D17E0F2C0BAF1FA9008BB696 /* Keys.gif in Resources */, + D17E0F2E0BAF1FA9008BB696 /* Server.gif in Resources */, + D17E0F310BAF2031008BB696 /* Help.tiff in Resources */, + D1F0AC200BB0688A00CE4E84 /* Maps.gif in Resources */, + D167A1970C493AED007F7D96 /* Nomap.png in Resources */, + D1DB53E80D70F1CD003AE25C /* Localizable.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + B94199400920820E0029DAD1 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/sh; + shellScript = "echo $TARGET_BUILD_DIR\ncd $TARGET_BUILD_DIR\n\n#make the directory which our disk image will be made of\n#use /tmp as a destination because copying ourself (xcode folder) whilst compling causes the dog to chase its tail\nSAUERPKG=`mktemp -d /tmp/sauerpkg.XXXXXX` || exit 1\nmkdir $SAUERPKG/sauerbraten\n\n#leave indicator of where temp directory is in case things break\nln -sf $SAUERPKG $TARGET_BUILD_DIR/sauerpkg\n\n#copy sauerbraten there\n/Developer/Tools/CpMac -r $TARGET_BUILD_DIR/sauerbraten.app $SAUERPKG/sauerbraten\n/Developer/Tools/CpMac -r $TARGET_BUILD_DIR/launcher.app $SAUERPKG/\nmv $SAUERPKG/launcher.app $SAUERPKG/Sauerbraten.app\n\nstrip -u -r $SAUERPKG/sauerbraten/sauerbraten.app/Contents/MacOS/sauerbraten\n\n#install all frameworks into app bundle\nmkdir $SAUERPKG/sauerbraten/sauerbraten.app/Contents/Frameworks\nfor framework in SDL.framework SDL_mixer.framework SDL_image.framework\ndo\n\tif [ -d $LOCAL_LIBRARY_DIR/Frameworks/$framework/ ] \n\tthen\t\n\t\t/Developer/Tools/CpMac -r $LOCAL_LIBRARY_DIR/Frameworks/$framework/ $SAUERPKG/sauerbraten/sauerbraten.app/Contents/Frameworks\n\t\trm -rf $SAUERPKG/sauerbraten/sauerbraten.app/Contents/Frameworks/$framework/Versions/A/Headers\n\telse\n\t\texit 1\n\tfi\ndone\n\n#copy readme and data and remove unneccesary stuff\n/Developer/Tools/CpMac -r $SRCROOT/../../docs $SAUERPKG/\n/Developer/Tools/CpMac -r $SRCROOT/../../data $SAUERPKG/sauerbraten/\n/Developer/Tools/CpMac -r $SRCROOT/../../packages $SAUERPKG/sauerbraten/\n/Developer/Tools/CpMac -r $SRCROOT/../../src $SAUERPKG/sauerbraten/\n/Developer/Tools/CpMac -r $SRCROOT/../../README.html $SAUERPKG/\nfind -d $SAUERPKG -name \"CVS\" -exec rm -rf {} \\;\nfind $SAUERPKG -name \".DS_Store\" -exec rm -f {} \\;\nrm -rf $SAUERPKG/sauerbraten/src/xcode/build\n\n#finally make a disk image out of the stuff\nhdiutil create -srcfolder $SAUERPKG -volname sauerbraten sauerbraten.dmg\nhdiutil internet-enable -yes sauerbraten.dmg\n\n#cleanup\nrm -rf $SAUERPKG\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + B94198A709207E810029DAD1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B94198A809207E810029DAD1 /* SDLMain.m in Sources */, + B90ADD4509B344D800A5B00B /* callbacks.c in Sources */, + B90ADD5709B344D800A5B00B /* host.c in Sources */, + B90ADD6A09B344D800A5B00B /* list.c in Sources */, + B90ADD7109B344D800A5B00B /* packet.c in Sources */, + B90ADD7209B344D800A5B00B /* peer.c in Sources */, + B90ADD7309B344D800A5B00B /* protocol.c in Sources */, + B90ADD7609B344D800A5B00B /* unix.c in Sources */, + 666E40F00B67D87F005B491F /* macutils.mm in Sources */, + B9AC7ACF0D06DB44005506F8 /* 3dgui.cpp in Sources */, + B9AC7AD00D06DB44005506F8 /* bih.cpp in Sources */, + B9AC7AD20D06DB44005506F8 /* client.cpp in Sources */, + B9AC7AD30D06DB44005506F8 /* command.cpp in Sources */, + B9AC7AD40D06DB44005506F8 /* console.cpp in Sources */, + B9AC7AD50D06DB44005506F8 /* cubeloader.cpp in Sources */, + B9AC7AD70D06DB44005506F8 /* grass.cpp in Sources */, + B9AC7AD80D06DB44005506F8 /* lightmap.cpp in Sources */, + B9AC7ADA0D06DB44005506F8 /* main.cpp in Sources */, + B9AC7ADB0D06DB44005506F8 /* material.cpp in Sources */, + B9AC7ADE0D06DB44005506F8 /* menus.cpp in Sources */, + B9AC7AE00D06DB44005506F8 /* normal.cpp in Sources */, + B9AC7AE10D06DB44005506F8 /* octa.cpp in Sources */, + B9AC7AE30D06DB44005506F8 /* octaedit.cpp in Sources */, + B9AC7AE40D06DB44005506F8 /* octarender.cpp in Sources */, + B9AC7AE50D06DB44005506F8 /* physics.cpp in Sources */, + B9AC7AE60D06DB44005506F8 /* rendergl.cpp in Sources */, + B9AC7AE70D06DB44005506F8 /* rendermodel.cpp in Sources */, + B9AC7AE80D06DB44005506F8 /* renderparticles.cpp in Sources */, + B9AC7AE90D06DB44005506F8 /* rendersky.cpp in Sources */, + B9AC7AEA0D06DB44005506F8 /* rendertext.cpp in Sources */, + B9AC7AEB0D06DB44005506F8 /* renderva.cpp in Sources */, + B9AC7AEC0D06DB44005506F8 /* server.cpp in Sources */, + B9AC7AED0D06DB44005506F8 /* serverbrowser.cpp in Sources */, + B9AC7AEE0D06DB44005506F8 /* shader.cpp in Sources */, + B9AC7AEF0D06DB44005506F8 /* shadowmap.cpp in Sources */, + B9AC7AF00D06DB44005506F8 /* sound.cpp in Sources */, + B9AC7AF10D06DB44005506F8 /* texture.cpp in Sources */, + B9AC7AF40D06DB44005506F8 /* water.cpp in Sources */, + B9AC7AF50D06DB44005506F8 /* world.cpp in Sources */, + B9AC7AF70D06DB44005506F8 /* worldio.cpp in Sources */, + B9AC7AFB0D06DB44005506F8 /* fps.cpp in Sources */, + B9AC7B040D06DB44005506F8 /* rpg.cpp in Sources */, + B9AC7B0D0D06DB44005506F8 /* geom.cpp in Sources */, + B9AC7B110D06DB44005506F8 /* pch.cpp in Sources */, + B9AC7B130D06DB44005506F8 /* sbtrace.d in Sources */, + B9AC7B150D06DB44005506F8 /* tools.cpp in Sources */, + B91D40210D525FE0004EF78A /* decal.cpp in Sources */, + D1C660CA0D5467C8002E52C1 /* pvs.cpp in Sources */, + D16BD00D0D7000EA0053CECE /* dynlight.cpp in Sources */, + D118DEB60D979281000E8C4C /* glare.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B96D0D49092096F200B6C936 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B96D0D590920970C00B6C936 /* Launcher.m in Sources */, + B96D0D6D0920976E00B6C936 /* main.m in Sources */, + B930D0920A3D9BC700BDFB85 /* ConsoleView.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + B96D0D790920980E00B6C936 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = B96D0D4B092096F200B6C936 /* launcher */; + targetProxy = B96D0D780920980E00B6C936 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + B96D0D5A0920971300B6C936 /* MainMenu.nib */ = { + isa = PBXVariantGroup; + children = ( + B96D0D5B0920971300B6C936 /* English */, + ); + name = MainMenu.nib; + sourceTree = ""; + }; + D1DB53E70D70F1CD003AE25C /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + D1DB53E50D70F1C3003AE25C /* English */, + ); + name = Localizable.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + B94198C709207E810029DAD1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = HAS_SOCKLEN_T; + HEADER_SEARCH_PATHS = ( + ../enet/include, + ../include/, + ); + INFOPLIST_FILE = "sauerbraten-Info.plist"; + OTHER_LDFLAGS = "-lz"; + PRODUCT_NAME = sauerbraten; + }; + name = Debug; + }; + B94198C809207E810029DAD1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = HAS_SOCKLEN_T; + HEADER_SEARCH_PATHS = ( + ../enet/include, + ../include/, + ); + INFOPLIST_FILE = "sauerbraten-Info.plist"; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-fomit-frame-pointer", + ); + OTHER_LDFLAGS = "-lz"; + PRODUCT_NAME = sauerbraten; + }; + name = Release; + }; + B94198EB09207F510029DAD1 /* Release-Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = HAS_SOCKLEN_T; + HEADER_SEARCH_PATHS = ( + ../enet/include, + ../include/, + ); + INFOPLIST_FILE = "sauerbraten-Info.plist"; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-fomit-frame-pointer", + ); + OTHER_LDFLAGS = "-lz"; + PRODUCT_NAME = sauerbraten; + }; + name = "Release-Deployment"; + }; + B94198EC09207F510029DAD1 /* Release-Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + COPY_PHASE_STRIP = NO; + DEPLOYMENT_POSTPROCESSING = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(USER_LIBRARY_DIR)/Frameworks", + "$(LOCAL_LIBRARY_DIR)/Frameworks", + ); + GCC_OPTIMIZATION_LEVEL = 3; + MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; + MACOSX_DEPLOYMENT_TARGET_ppc = 10.3; + PREBINDING = NO; + SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk; + SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk; + STRIP_INSTALLED_PRODUCT = NO; + }; + name = "Release-Deployment"; + }; + B960CF36085F3CC7004FB142 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(NATIVE_ARCH)"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(USER_LIBRARY_DIR)/Frameworks", + "$(LOCAL_LIBRARY_DIR)/Frameworks", + ); + GCC_OPTIMIZATION_LEVEL = 0; + MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; + MACOSX_DEPLOYMENT_TARGET_ppc = 10.3; + PREBINDING = NO; + SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk; + SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk; + STRIP_INSTALLED_PRODUCT = NO; + }; + name = Debug; + }; + B960CF37085F3CC7004FB142 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(USER_LIBRARY_DIR)/Frameworks", + "$(LOCAL_LIBRARY_DIR)/Frameworks", + ); + GCC_OPTIMIZATION_LEVEL = 3; + MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; + MACOSX_DEPLOYMENT_TARGET_ppc = 10.3; + PREBINDING = NO; + SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk; + SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk; + STRIP_INSTALLED_PRODUCT = NO; + }; + name = Release; + }; + B96D0D50092096F300B6C936 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "launcher-Info.plist"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + "-bind_at_load", + ); + PRODUCT_NAME = launcher; + }; + name = Debug; + }; + B96D0D51092096F300B6C936 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "launcher-Info.plist"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + "-bind_at_load", + ); + PRODUCT_NAME = launcher; + }; + name = Release; + }; + B96D0D52092096F300B6C936 /* Release-Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "launcher-Info.plist"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + "-bind_at_load", + ); + PRODUCT_NAME = launcher; + }; + name = "Release-Deployment"; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B94198C609207E810029DAD1 /* Build configuration list for PBXNativeTarget "sauerbraten" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B94198C709207E810029DAD1 /* Debug */, + B94198C809207E810029DAD1 /* Release */, + B94198EB09207F510029DAD1 /* Release-Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + B960CF35085F3CC7004FB142 /* Build configuration list for PBXProject "sauerbraten" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B960CF36085F3CC7004FB142 /* Debug */, + B960CF37085F3CC7004FB142 /* Release */, + B94198EC09207F510029DAD1 /* Release-Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + B96D0D4F092096F300B6C936 /* Build configuration list for PBXNativeTarget "launcher" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B96D0D50092096F300B6C936 /* Debug */, + B96D0D51092096F300B6C936 /* Release */, + B96D0D52092096F300B6C936 /* Release-Deployment */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} -- 2.11.4.GIT