Liquid War 6, a unique multiplayer wargame. Table of Contents ***************** 1 Introduction 1.1 In a nutshell 1.2 Project status 1.3 How you can help 1.3.1 Help GNU 1.3.2 Todo list 2 User's manual 2.1 Mailing lists 2.1.1 General discussion 2.1.2 Announcements 2.1.3 Bugs 2.2 Getting the game 2.2.1 Download source 2.2.2 Download binaries 2.2.3 Work in progress 2.3 Installation 2.3.1 Requirements 2.3.2 Optional libraries 2.3.3 Installing requirements using RPM/DEB packages 2.3.4 Compiling 2.4 Extra maps 2.4.1 The extra maps package 2.4.2 Install extra maps on GNU/Linux and POSIX systems 2.4.3 Raw install of extra maps (all-platforms) 2.5 Troubleshooting 2.5.1 Compilation problems 2.5.2 Check installation 2.5.3 Problems running the game 2.6 Quick start 2.6.1 Quick start 2.7 Strategy tips 2.8 User interface 2.8.1 A reduced set of keys 2.8.2 Combining mouse, keyboard and joysticks 2.8.3 Quit with F10 2.9 Network games 2.10 Graphics 2.10.1 Standard, high and low resolution 2.10.2 Display rate 2.11 Sound & music 2.11.1 Current status 2.11.2 The future 2.12 Config file 2.13 Logs 2.14 Report bugs 3 Hacker's guide 3.1 Designing levels 3.1.1 Why is level design so important? 3.1.2 Format overview 3.1.3 map.png 3.1.4 layer2.png ... layer7.png 3.1.5 texture.png, texture.jpeg and texture-alpha.jpeg 3.1.6 rules.xml 3.1.7 hints.xml 3.1.8 style.xml 3.2 Translating 3.2.1 Using gettext 3.2.2 Formatted strings 3.2.3 Partial translation 3.3 Architecture 3.3.1 C + Guile 3.3.2 Threading and SMP 3.3.3 Internal libraries 3.4 Memory structures 3.5 100% predictable algorithm 3.6 About mod-gl 3.6.1 The main renderer 3.6.2 Hardware requirements 3.6.3 The gl-utils toolbox 3.7 Compilation tips 3.7.1 Advanced ./configure options 3.7.2 Microsoft Windows msys/mingw32 port 3.7.3 Mac OS X port 3.8 Coding guidelines 3.8.1 Project goals reminder 3.8.2 Common sense 3.8.3 Unitary tests 3.8.4 Memory allocation 3.8.5 Private and public interfaces 3.9 Using the console 3.10 Advanced tweaking 3.10.1 Hacking ressources 3.10.2 Optimize for speed 3.11 Writing modules 3.12 Use as a library 3.13 Network protocol 3.14 Using GNU Arch 3.14.1 About GNU Arch 3.14.2 Getting the latest version from the repository 3.14.3 Setting up your own arch repository 3.14.4 Synchronizing your repository with upstream releases 3.14.5 Submitting patches 3.14.6 Recover from broken lock 4 Reference 4.1 Basic options 4.1.1 about 4.1.2 copyright 4.1.3 debug 4.1.4 defaults 4.1.5 help 4.1.6 list 4.1.7 test 4.1.8 version 4.2 Doc options 4.2.1 example-hints-xml 4.2.2 example-rules-xml 4.2.3 example-style-xml 4.2.4 list-aliases 4.2.5 list-doc 4.2.6 list-funcs 4.2.7 list-graphics 4.2.8 list-hooks 4.2.9 list-input 4.2.10 list-map 4.2.11 list-map-hints 4.2.12 list-map-rules 4.2.13 list-map-style 4.2.14 list-network 4.2.15 list-path 4.2.16 list-players 4.2.17 list-quick 4.2.18 list-show 4.2.19 list-sound 4.2.20 list-tuning 4.3 Show options 4.3.1 show-build-cflags 4.3.2 show-build-codename 4.3.3 show-build-configure-args 4.3.4 show-build-copyright 4.3.5 show-build-datadir 4.3.6 show-build-date 4.3.7 show-build-docdir 4.3.8 show-build-enable-allinone 4.3.9 show-build-enable-console 4.3.10 show-build-enable-fullstatic 4.3.11 show-build-enable-gcov 4.3.12 show-build-enable-gprof 4.3.13 show-build-enable-instrument 4.3.14 show-build-enable-mod-csound 4.3.15 show-build-enable-mod-gl 4.3.16 show-build-enable-mod-http 4.3.17 show-build-enable-mod-ogg 4.3.18 show-build-enable-optimize 4.3.19 show-build-enable-paranoid 4.3.20 show-build-enable-profiler 4.3.21 show-build-enable-valgrind 4.3.22 show-build-endianness 4.3.23 show-build-gcc-version 4.3.24 show-build-hostname 4.3.25 show-build-includedir 4.3.26 show-build-ldflags 4.3.27 show-build-libdir 4.3.28 show-build-license 4.3.29 show-build-localedir 4.3.30 show-build-mac-os-x 4.3.31 show-build-md5sum 4.3.32 show-build-ms-windows 4.3.33 show-build-package-name 4.3.34 show-build-package-string 4.3.35 show-build-package-tarname 4.3.36 show-build-pointer-size 4.3.37 show-build-prefix 4.3.38 show-build-stamp 4.3.39 show-build-target-cpu 4.3.40 show-build-target-os 4.3.41 show-build-time 4.3.42 show-build-top-srcdir 4.3.43 show-build-version 4.3.44 show-build-x86 4.3.45 show-config-file 4.3.46 show-cwd 4.3.47 show-data-dir 4.3.48 show-default-config-file 4.3.49 show-default-data-dir 4.3.50 show-default-log-file 4.3.51 show-default-map-dir 4.3.52 show-default-map-path 4.3.53 show-default-mod-dir 4.3.54 show-default-prefix 4.3.55 show-default-script-file 4.3.56 show-default-user-dir 4.3.57 show-log-file 4.3.58 show-map-dir 4.3.59 show-map-path 4.3.60 show-mod-dir 4.3.61 show-prefix 4.3.62 show-run-dir 4.3.63 show-script-file 4.3.64 show-user-dir 4.4 Path options 4.4.1 config-file 4.4.2 data-dir 4.4.3 log-file 4.4.4 map-dir 4.4.5 map-path 4.4.6 mod-dir 4.4.7 prefix 4.4.8 script-file 4.4.9 user-dir 4.5 Graphics options 4.5.1 fullscreen 4.5.2 gfx-backend 4.5.3 height 4.5.4 width 4.5.5 windowed-mode-limit 4.6 Sound options 4.6.1 music-volume 4.6.2 snd-backend 4.6.3 sound-volume 4.7 Network options 4.8 Map parameters 4.8.1 chosen-map 4.8.2 force 4.8.3 use-hints-xml 4.8.4 use-rules-xml 4.8.5 use-style-xml 4.8.6 use-texture 4.9 Map rules.xml 4.9.1 color-conflict-mode 4.9.2 cursor-pot-init 4.9.3 fighter-attack 4.9.4 fighter-defense 4.9.5 fighter-new-health 4.9.6 fighter-regenerate 4.9.7 max-cursor-pot 4.9.8 max-cursor-pot-offset 4.9.9 max-nb-cursors 4.9.10 max-nb-servers 4.9.11 max-nb-teams 4.9.12 max-round-delta 4.9.13 max-zone-size 4.9.14 moves-per-round 4.9.15 nb-attack-tries 4.9.16 nb-defense-tries 4.9.17 nb-move-tries 4.9.18 respawn-team 4.9.19 round-delta 4.9.20 rounds-per-sec 4.9.21 side-attack-factor 4.9.22 side-defense-factor 4.9.23 single-army-size 4.9.24 spread-thread 4.9.25 spreads-per-round 4.9.26 start-blue-x 4.9.27 start-blue-y 4.9.28 start-cyan-x 4.9.29 start-cyan-y 4.9.30 start-green-x 4.9.31 start-green-y 4.9.32 start-lightblue-x 4.9.33 start-lightblue-y 4.9.34 start-magenta-x 4.9.35 start-magenta-y 4.9.36 start-orange-x 4.9.37 start-orange-y 4.9.38 start-pink-x 4.9.39 start-pink-y 4.9.40 start-position-mode 4.9.41 start-purple-x 4.9.42 start-purple-y 4.9.43 start-red-x 4.9.44 start-red-y 4.9.45 start-yellow-x 4.9.46 start-yellow-y 4.9.47 total-armies-size 4.9.48 total-time 4.9.49 vertical-move 4.9.50 x-polarity 4.9.51 y-polarity 4.9.52 z-polarity 4.10 Map hints.xml 4.10.1 background-color-auto 4.10.2 fighter-scale 4.10.3 guess-colors 4.10.4 hud-color-auto 4.10.5 max-map-height 4.10.6 max-map-surface 4.10.7 max-map-width 4.10.8 menu-color-auto 4.10.9 min-map-height 4.10.10 min-map-surface 4.10.11 min-map-width 4.10.12 resample 4.10.13 system-color-auto 4.10.14 view-color-auto 4.11 Map style.xml 4.11.1 animation-density 4.11.2 animation-speed 4.11.3 background-color-root-bg 4.11.4 background-color-root-fg 4.11.5 background-color-stuff-bg 4.11.6 background-color-stuff-fg 4.11.7 background-style 4.11.8 color-alternate-bg 4.11.9 color-alternate-fg 4.11.10 color-base-bg 4.11.11 color-base-fg 4.11.12 colorize 4.11.13 cursor-size 4.11.14 hidden-layer-alpha 4.11.15 hud-color-frame-bg 4.11.16 hud-color-frame-fg 4.11.17 hud-color-text-bg 4.11.18 hud-color-text-fg 4.11.19 hud-style 4.11.20 keep-ratio 4.11.21 menu-color-default-bg 4.11.22 menu-color-default-fg 4.11.23 menu-color-disabled-bg 4.11.24 menu-color-disabled-fg 4.11.25 menu-color-selected-bg 4.11.26 menu-color-selected-fg 4.11.27 menu-style 4.11.28 pixelize 4.11.29 system-color-bg 4.11.30 system-color-fg 4.11.31 team-color-blue 4.11.32 team-color-cyan 4.11.33 team-color-green 4.11.34 team-color-lightblue 4.11.35 team-color-magenta 4.11.36 team-color-orange 4.11.37 team-color-pink 4.11.38 team-color-purple 4.11.39 team-color-red 4.11.40 team-color-yellow 4.11.41 view-color-cursor-bg 4.11.42 view-color-cursor-fg 4.11.43 view-color-map-bg 4.11.44 view-color-map-fg 4.11.45 view-style 4.11.46 x-wrap 4.11.47 y-wrap 4.11.48 zoom 4.11.49 zoom-max 4.11.50 zoom-min 4.12 Advanced settings 4.12.1 audit 4.12.2 bench 4.12.3 bot-iq 4.12.4 bot-speed 4.12.5 commands-per-sec 4.12.6 debug-layer-id 4.12.7 debug-team-id 4.12.8 demo 4.12.9 dirty-read 4.12.10 display-background 4.12.11 display-console 4.12.12 display-cursors 4.12.13 display-debug-gradient 4.12.14 display-debug-zones 4.12.15 display-fighters 4.12.16 display-fps 4.12.17 display-hud 4.12.18 display-log 4.12.19 display-map 4.12.20 display-menu 4.12.21 display-mouse 4.12.22 display-preview 4.12.23 display-progress 4.12.24 display-rps 4.12.25 display-score 4.12.26 display-splash 4.12.27 gfx-cpu-usage 4.12.28 io-per-sec 4.12.29 loader-sleep 4.12.30 log-level 4.12.31 log-timeout 4.12.32 memory-bazooka-eraser 4.12.33 memory-bazooka-size 4.12.34 modules 4.12.35 pedigree 4.12.36 pilot-lag 4.12.37 quick-start 4.12.38 reset 4.12.39 server 4.12.40 target 4.12.41 target-fps 4.13 Script hooks 4.14 C to Guile API 4.15 C functions 4.15.1 libbot 4.15.2 libbot 4.15.3 libcfg 4.15.4 libcli 4.15.5 libcns 4.15.6 libdsp 4.15.7 libdyn 4.15.8 libgfx 4.15.9 libgui 4.15.10 libhlp 4.15.11 libimg 4.15.12 libker 4.15.13 libldr 4.15.14 libmap 4.15.15 libnet 4.15.16 libp2p 4.15.17 libpil 4.15.18 libsnd 4.15.19 libsrv 4.15.20 libsys 4.15.21 libtsk 4.15.22 libbot 4.15.23 libbot 4.15.24 libcfg 4.15.25 libcli 4.15.26 libcns 4.15.27 libdsp 4.15.28 libdyn 4.15.29 libgfx 4.15.30 libgui 4.15.31 libhlp 4.15.32 libimg 4.15.33 libker 4.15.34 libldr 4.15.35 libmap 4.15.36 libnet 4.15.37 libp2p 4.15.38 libpil 4.15.39 libsnd 4.15.40 libsrv 4.15.41 libsys 4.15.42 libtsk Appendix A 2005 .plan A.1 Complete rewrite A.2 Technologies A.2.1 Script + standard C + assembly A.2.2 OpenGL A.2.3 CSound A.3 Functionnalities A.3.1 Visual enhancements A.3.2 Rules enhancements A.3.3 Hey, you forgot my idea!!! A.4 Road map Appendix B Fanfic B.1 The Battle of Emberlificoted Appendix C Links Appendix D GNU GENERAL PUBLIC LICENSE Appendix E GNU Free Documentation License Appendix F Indexes F.1 Concept index F.2 Function and keyword index 1 Introduction ************** Read this chapter to discover Liquid War 6. 1.1 In a nutshell ================= Liquid War 6 is a unique multiplayer wargame. Your army is a blob of liquid and you have to try and eat your opponents. Rules are very simple yet original, they have been invented by Thomas Colcombet. It is possible to play alone against the computer but the game is really designed to be played with friends, on a single computer, on a LAN, or on Internet. An older version, Liquid War 5 (http://www.ufoot.org/liquidwar/v5), is available, but is not part of the GNU Project. Only Liquid War 6 is part of the GNU Project (http://www.gnu.org/), it is a complete rewrite. Yor more information, you can read the Wikipedia article (http://en.wikipedia.org/wiki/Liquid_War) about Liquid War. 1.2 Project status ================== As of today, the game is in beta state. It can be installed, and you can toy arround with, but it's far from being complete. What works: * The whole framework is here, some functions are not implemented yet, but the bases are set up, and they are believed solid. The game is very modular, and is fully threaded. It is designed so that graphics, sound, network and bot backends can be hacked at will. It has a complete self-test suite, and many debugging built-in tools. This is not a quick hack. * Documentation. Yes, you're reading it. * Version 0.0.7beta is playable. Local game between humans (up to 4 players) is possible. Two bots are implemented, named random and stupid. No great players but well, they move the cursor. A new "deatchmatch" mode, different from LW5, is in place. * Liquid War 6 already has some features which are nowhere to be found in Liquid War 5, such as multiple layers. It can be worth the upgrade. * Maps. A number of interesting maps have already been designed (thanks to Kasper Hviid). * The game has been ported to Microsoft Windows 32-bit proprietary platform. It also runs on Mac OS X (but you'll have to compile it yourself). It still runs fine under GNU/Linux, of course. In the near future: * Network play. Top-level priority. Yes, network has been promised for months (years?) and is still not there. I said "when it's done". * Fix bugs ;) The current engine is somewhat buggy, fighters might loose the cursor, it clearly needs polishing. In the long run: * Write new graphical backends so that the game does not require Mesa or any OpenGL-like subsystem. The idea is to get rid of the 3D-accelerator dependency. * Implement all the fancy 3D features, make it possible to play Liquid War 6 on a Moebius ring. * Use the cool features of CSound to provide dynamic, contextualized sounds & musics. * Optimize the bot algorithm, which is probably a complex AI problem. 1.3 How you can help ==================== 1.3.1 Help GNU -------------- Please remember that development of Liquid War 6 is a volunteer effort, and you can also contribute to its development. For information about contributing to the GNU Project, please read How to help GNU (http://www.gnu.org/help/help.html). 1.3.2 Todo list --------------- Here's a short list of todo items. It is probably too early to start hacking the core engine itself, for it is still under heavy development, might undergo major rewrites, and it's hard for documentation to keep up with the reality of the code. However, there are still many things to do. * Try the game. Play. Test. Send bug reports. Without bug reports, bugs don't get fixed. * Write maps. Obviously, this is something which can perfectly be delegated. Experience shows user-contributed maps are, on average, better than maps conceived by the author... * Translate texts. Liquid War 6 uses GNU gettext, so all messages can be translated. * ...any help is welcome. Feel free to join the mailing-lists or contact Christian Mauduit (mailto:ufoot@ufoot.org) if you are interested. 2 User's manual *************** The Liquid War 6 user's manual hopefully contains any usefull information to install the program and play the game. If you just want to enjoy Liquid War 6 without diving into map creation and programming, this is just for you. 2.1 Mailing lists ================= 2.1.1 General discussion ------------------------ The main discussion list is (mailto:help-liquidwar6@gnu.org), and is used to discuss all aspects of Liquid War 6, including installation, development, game strategies, and whatever subject players and hackers might want to talk about, provided it is Liquid War 6 related. If you don't know on which list to subscribe, this is the one. To subscribe to it, please send an empty mail with a Subject: header line of just "subscribe" to the `-request' list, that is (mailto:help-liquidwar6-request@gnu.org). You can also subscribe to the list using the Mailman web interface for help-liquidwar6 (http://lists.gnu.org/mailman/listinfo/help-liquidwar6) and consult help-liquidwar6 archives (http://lists.gnu.org/archive/html/help-liquidwar6/). 2.1.2 Announcements ------------------- Announcements about LiquidWar 6 are made on (mailto:info-liquidwar6@gnu.org). Subscribe to it to be informed of major releases, and other significant news. To subscribe to it, please send an empty mail with a Subject: header line of just "subscribe" to the `-request' list, that is (mailto:info-liquidwar6-request@gnu.org). You can also subscribe to the list using the Mailman web interface for info-liquidwar6 (http://lists.gnu.org/mailman/listinfo/info-liquidwar6) and consult info-liquidwar6 archives (http://lists.gnu.org/archive/html/info-liquidwar6/). Please also consider reading the latest news on Savannah (http://savannah.gnu.org/news/?group=liquidwar6). 2.1.3 Bugs ---------- There is also a special list used for reporting bugs, (mailto:bug-liquidwar6@gnu.org). Please try and describe the bug as precisely as possible. The more accurate the description, the more chances it will get to be fixed. While this is the standard GNU way of reporting bugs, modern SPAM standards make it very hard to filter real bug reports from junk on this list. It is more convenient to report bugs on Savannah (https://savannah.gnu.org/bugs/?func=additem&group=liquidwar6) using a web interface. Please take a look at the bug list (http://savannah.gnu.org/bugs/?group=liquidwar6) before submitting new bugs. 2.2 Getting the game ==================== 2.2.1 Download source --------------------- Liquid War 6 can be found on `http://download.savannah.gnu.org/releases/liquidwar6/' and `http://www.ufoot.org/download/liquidwar/v6/'. Downloading the latest file from this place, and compile it yourself on your computer with a classical `./configure && make && make install' is the recommended way to install Liquid War 6. 2.2.2 Download binaries ----------------------- Some binary packages are available. As of today, only GNU/Linux based systems are supported, through Debian (http://www.debian.org/) `.deb' and Red Hat (http://www.redhat.com/) `RPM' packages. Using these files might save you time installing the game, but installing from source is still the safest and best supported way to install the game, as it is still in beta stage. Binary are also not necessarly available for the latest, most up to date versions of the game. The list of all the available downloads is accessible on `http://www.ufoot.org/liquidwar/v6/download'. Check out the MD5 checksums and GnuPG signatures to verify the integrity and authenticity of the files you download. 2.2.3 Work in progress ---------------------- Latest work in progress versions can be obtained with GNU Arch. Here's a typical set of commands which will fetch the latest version: tla register-archive http://arch.sv.gnu.org/archives/liquidwar6 tla get -A liquidwar6@sv.gnu.org liquidwar6--beta Alternatively, you can directly download GNU Arch patches (http://arch.sv.gnu.org/archives/liquidwar6/), and an Archzoom (http://www.ufoot.org/cgi-bin/archzoom.cgi/liquidwar6@sv.gnu.org) server allows you to browse the source interactively. 2.3 Installation ================ This section covers installation from source. Other ways of installing the program are not described here. 2.3.1 Requirements ------------------ All these libraries are mandatory to compile the game. Liquid War 6 won't compile, let alone run, without them. Some of them could probably be replaced by equivalent tools, but this would certainly require a programming effort and some changes in Liquid War 6 source code. * GNU Make (http://www.gnu.org/software/make/). Liquid War 6 might and certainly does use GNU Make extensions. * GNU C library (http://www.gnu.org/software/libc/). Sounds obvious, but you need a standard C library. It happens that glibc has some rather usefull extensions (yes, as of 2006, some vendors continue to offer C libraries without `snprintf'...) and Liquid War 6 might use them. In a general manner, Liquid War 6 is part of and designed for GNU. You might however manage to compile it with limited libc support, this is the case with mingw32 for instance but, do it at your own risk. * Perl (http://www.perl.com/). Some Makefile commands require Perl. You don't need any Perl devel packages, and you can probably use any Perl 5.x version, since no fancy recent feature of Perl is used. Just plain Perl. * Guile (http://www.gnu.org/software/guile/). Possibly the most required library, since Liquid War 6 is a scheme program which uses a set of functions coded in standard C. You need at least Guile 1.8. * GNU MP (http://gmplib.org/). GMP is a free library for arbitrary precision arithmetic, required by Guile. * ltdl (http://www.gnu.org/software/libtool/). This library, which comes with libtool, provides a portable alternative to `dlopen' and `dlclose'. Check that you have a `/usr/include/ltdl.h' file, or install the corresponding package. * zlib (http://www.zlib.net/). Required by other libraries, but can also be used directly by Liquid War 6 to compress network messages for instance. * expat (http://www.libexpat.org/). Used to read and write XML files, which contain constants and configuration data. * libpng (http://www.libpng.org/pub/png/libpng.html). Liquid War 6 uses libpng to read levels (maps), not to speak of other optional libraries (SDL and the rest) who need it themselves. * libjpeg (http://www.ijg.org/). Maps can also be provided as jpeg files, so libjpeg is required as well. * SQLite 3 (http://www.sqlite.org). Used to handle the list of available servers. 2.3.2 Optional libraries ------------------------ While all these libraries are theorically optional (the game will successfully compile without them), you'll obviously need, for instance, one graphics backend. Otherwise, you'll simply have no display. This is not acceptable. As of today, one can reasonnably consider all SDL-related libraries are required. The rest is truely optional. * ncurses (http://www.gnu.org/software/ncurses/). Required by readline, needs to be there otherwise readline might not be detected properly on some systems. * GNU readline (http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html). Used to handle input on the console. Console is not absolutely mandatory, but it's a must-have if you want to hack the game. Console unavailable does not mean you won't get anything on stdout but, the interactive script shell just won't work. * Mesa (http://www.mesa3d.org/). This library provides an API similar to OpenGL and enables 2-D and 3-D drawing. * SDL (http://www.libsdl.org/). SDL is used to set up a working OpenGL environnement, and handle input (mouse and keyboard). * SDL_image (http://www.libsdl.org/projects/SDL_image/). This SDL extension is used to read textures and other graphics from disk. * FreeType 2 (http://freetype.sourceforge.net/). This library is required by SDL_ttf, to draw fonts. * SDL_ttf (http://www.libsdl.org/projects/SDL_ttf/). This SDL extension is used to draw fonts. It is UTF-8 enabled. * libcsound (http://www.csounds.com/). While this tool is not used yet, it is meant to be the final sound backend, as CSounds offers great power to the composer, enabling truely dynamically generated sound & music. For now Liquid War 6 tries to detect csound 4 but as the mainstream stable release is now 5 an update is needed. It will probably be updated/fixed (Liquid War 6 using csounds 5) some day, for now you can safely *not* install csound on your system and enjoy all the possibilities of the game. * SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/). This SDL extension is used to allow dynamic mixing of sounds, and it also provides a builtin `OGG/Vorbis' file renderer. * libcURL (http://curl.haxx.se/libcurl/). Used to handle HTTP requests, the idea being not to re-invent the wheel but use a robust standards-compliant generic library. 2.3.3 Installing requirements using RPM/DEB packages ---------------------------------------------------- You might find it convenient not to install all the requirements from source, but use your favorite GNU/Linux distribution packages. On an RPM based GNU/Linux system, a typical command (tested with Fedora (http://www.fedoraproject.org/) 11) could be: yum install \ make gcc glibc glibc-devel binutils \ guile guile-devel gmp gmp-devel \ libtool libtool-ltdl libtool-ltdl-devel \ zlib zlib-devel expat expat-devel \ libpng libpng-devel libjpeg libjpeg-devel \ sqlite sqlite-devel \ ncurses ncurses-devel readline readline-devel \ libGL libGL-devel libGLU libGLU-devel \ SDL SDL-devel SDL_image SDL_image-devel \ SDL_mixer SDL_mixer-devel \ freetype freetype-devel SDL_ttf SDL_ttf-devel \ libcurl libcurl-devel \ perl lcov valgrind graphviz gv texinfo-tex On a DEB package based GNU/Linux system this command (tested with Debian (http://www.debian.org/) lenny) would be: apt-get install \ make gcc libc6 libc6-dev binutils \ guile-1.8 guile-1.8-dev guile-1.8-libs libgmp3c2 libgmp3-dev \ libtool libltdl3 libltdl3-dev \ zlib1g zlib1g-dev libexpat1 libexpat1-dev \ libpng12-0 libpng12-dev libjpeg62 libjpeg62-dev \ libsqlite3-0 libsqlite3-dev \ libncurses5 libncurses5-dev libreadline5 libreadline5-dev \ libgl1-mesa-glx libgl1-mesa-dri libgl1-mesa-dev libglu1-mesa libglu1-mesa-dev \ libsdl1.2debian-alsa libsdl1.2-dev libsdl-image1.2 libsdl-image1.2-dev \ libsdl-mixer1.2 libsdl-mixer1.2-dev \ libfreetype6 libfreetype6-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev \ libcurl4-gnutls-dev \ perl lcov valgrind graphviz gv texinfo texlive-full Note that those requirements really depend on the exact distribution you have, package names may vary from one to another. 2.3.4 Compiling --------------- Liquid War 6 uses GNU Automake (http://www.gnu.org/software/automake/), Autoconf (http://www.gnu.org/software/autoconf/) and GNU Libtool (http://www.gnu.org/software/libtool/). Once all the requirements are installed, run: ./configure make make install Liquid War 6 supports the standard `./configure --prefix=/my/path' option (in fact, it supports much more than that) so you can install the game in any directory. You do not need to be `root' to install Liquid War 6. 2.4 Extra maps ============== 2.4.1 The extra maps package ---------------------------- The main package contains some maps so that you can try out the game. Still, an additionnal package, called `extra-maps' or `liquidwar6-extra-maps' is available, containing more maps. It really does contain many of them, including most Liquid War 3 and Liquid War 5 legacy maps, plus new Liquid War 6 maps. 2.4.2 Install extra maps on GNU/Linux and POSIX systems ------------------------------------------------------- On GNU/Linux systems (and possibly any POSIX unixish system) running: ./configure make make install will install the extra maps on your system automatically, they will then be available in the `extra/' sub-directory when browsing maps. The `./configure' script has a `--enable-liquidwar6' switch which will try and find automatically if there's an existing `liquidwar6' binary in the path. If there's such a binary, it will run it and ask for its `map-path' and use this value automatically. 2.4.3 Raw install of extra maps (all-platforms) ----------------------------------------------- Another solution, which works on all platforms including MS-Windows but also works on GNU/Linux, is to simply unpack the `extra-maps' package (unzip or untar) in your custom map directory, or in the system map directory. There's nothing else to do to install these maps but simply put them on your hard drive in the right directory. Typically on an MS-Windows system, you would unpack the extra maps in `C:\Program Files\Liquid War 6\map\' (system directory) and on a GNU/Linux or POSIX system you would unpack them in `$HOME/.liquidwar6/map/' (user directory). Next time you run the game, the maps should be browsable. If you can't see them, run `liquidwar6 --audit' and check that the place where you unpacked the files is actually searched by the binary. 2.5 Troubleshooting =================== 2.5.1 Compilation problems -------------------------- A quick survival guide: * Check that you have all dependencies installed. Also check their version number. Double-check that you have devel packages installed, not only run-time binaries. * Read carefully the output of `./configure'. Running `./configure > configure.log 2> configure.err' does help. * Editing `/etc/ld.so.conf' and running `ldconfig' as `root' can help if some dependencies are installed in exotic places. * Check the values of the environment variables `CFLAGS', `LDFLAGS' and `LD_LIBRARY_PATH'. * Try `./configure --enable-allinone', this will disable some fancy but somewhat complicated dynamic `.so' file support, it can help if shared libraries are handled differently on your system than on a plain GNU/Linux box. If none of these help, consider reporting a bug, or search the mailing-lists for help. 2.5.2 Check installation ------------------------ Here's a check-list to ensure that your installation is correct: * What was the output of `make install'? `make check'? * Is the `liquidwar6' binary in your `PATH' environment variable? It might be in `/usr/games'. * Run `liquidwar6 --pedigree'. Look at the output. Check the compilation date & time, the version number. * Run `liquidwar6 --audit'. What do these paths look like? Are they absolute paths? Do they exist? What's there? Normally, once the game is installed, all of them should exist, and be populated with sub-directories and files. * Run `liquidwar6 --modules', to know which modules where compiled. You need at least one graphical module, for instance `mod-gl', else the game won't run. * Run `liquidwar6 --target', this displays informations about the target system the binary has been built for. 2.5.3 Problems running the game ------------------------------- Now, game looks correctly installed, but you have problems running it. * Run the game from a terminal, not from a Gnome or KDE launcher, you need to see the console output. * In the `$HOME/.liquidwar6/' directory, you'll find two files, `log.csv' and `dump.txt'. They might contain valuable information, read them. * Run `liquidwar6 --defaults'. This will reset all options to defaults. You might need to run this when upgrading from a version to another, since some options might appear, disappear, or defaults values can change. * Run `liquidwar6 --test'. This should run a complete test suite, many functions in the game will be tested automatically, and errors reported. * Run `liquidwar6 --show-script-file'. Are you really running the right code? * Game segfaults: try `make uninstall && make clean && make && make install'. Many problems can come from using a wrong shared module, especially with beta versions. * Game (still) segfaults: try `gdb liquidwar6'. Type `run' and watch output. * The dynamic library loader can sometimes have problemes, and does not always report explicit messages on `stdout' or `stderr'. You can change this by modifying some environment variables: `export LD_DEBUG=all'. This is very verbose but does help finding bugs. * Consider compiling the game using `./configure --enable-valgrind' and then run it using Valgrind (http://valgrind.org/). * Try `find / -type d -a -name "liquidwar6*" 2> /dev/null' to ensure you don't have an old version of Liquid War 6 somewhere else... 2.6 Quick start =============== 2.6.1 Quick start ----------------- Once the game is installed, run it, click on `Quick start' with the mouse, and control the red `'a'' cursor with the mouse, or keyboard, both work. Try and surround the green team, it's a stupid bot, you should win ;) You army is formed by all the red pixels on the screen, they should try and rejoin the cursor (the blinking `'a'' letter) using the shortest path. When red and green meet, they fight. Try it, toy arround. The `Quick start' button will always make you play red against a green stupid bot, whatever other options you have set up. Todo... 2.7 Strategy tips ================= 2.8 User interface ================== 2.8.1 A reduced set of keys --------------------------- Liquid War 6 can be controlled using a reduced set of keys. This is to make the game more portable and allow possible ports to platforms where a full keyboard is not available. Depending on the graphics backend, exact mapping might change, they should be obvious and intuitive. Those keys are: * `up' : the arrow up key * `down' : the down arrow key * `left' : the left arrow key * `right' : the right arrow key * `enter' : the enter / return key * `esc' : the escape key * `pgup' : the page up key * `pgdown' : the page down key 2.8.2 Combining mouse, keyboard and joysticks --------------------------------------------- It's also possible to control the game with the mouse only, or with a joystick. By default the interface will trap all events and respond on any of these possible devices. The mouse follows these rules: * mouse left-click is equivalent to the keyboard `enter', it validates an item * mouse right-click is equivalent to the keyboard `esc', it goes back, cancels, ... * mouse wheel-up is equivalent to the keyboard `pgup' * mouse wheel-down is equivalent to the keyboard `pgdown' The joytick bindings is done as follows: * button `A' is equivalent to the keyboard `enter', it validates an item * button `B' is equivalent to the keyboard `esc', it goes back, cancels, ... * button `C' is equivalent to the keyboard `pgup' * button `D' is equivalent to the keyboard `pgdown' What these buttons are exactly on your joystick depends on your hardware and driver. Note that Liquid War 6 converts any analog joystick input to a digital pad-like information. 2.8.3 Quit with F10 ------------------- There's also an (almost) hardcoded shortcut which will quit the game immediately, or at least as quickly as possible, without any prompt or warning. It is the `F10' key. Think of this feature as the procastinator's "whoops, here comes my boss!!!" emergency function. 2.9 Network games ================= Not implemented yet. 2.10 Graphics ============= 2.10.1 Standard, high and low resolution ---------------------------------------- Liquid War 6 will try and pick up a default resolution when the game is launched the first time. It won't use your maximum screen resolution but will instead list all available fullscreen modes, and pick up one which is usually something like two thirds of the highest mode. This is to allow switching back and forth between fullscreen and windowed mode using the same settings. This automatically picked-up resolution really depends on your hardware and driver. It is called "standard" in the graphics options menu. Then it is possible to automatically select the minimum and maximum resolution your hardware allows in fullscreen mode. These are called "low" and "high" in the graphics options menu. Just click on the button that display the resolution, it will change and use the next setting. In windowed mode, the game won't accept the highest available mode but will instead use a percentage of it, defined by the `--windowed-mode-limit' parameter. You might still be in a case where this is not enough. For instance your maximum resolution is 1600x1200, Liquid War 6 picks a default mode of 1280x960 for you but for some reason you want to play in 800x600, fullscreen. In this case, simply switch to windowed mode, resize the window with the mouse (the resolution button will show you the current resolution) and just choose a resolution near 800x600. It does not even need to be exactly 800x600, 798x603 would probably fit. Then when switching back to fullscreen, you'll be in 800x600, the game will automatically pick up the fullscreen mode which is closest to the current windowed mode resolution. 2.10.2 Display rate ------------------- By default the game will try and run at 60 frames per second. Given the nature of Liquid War 6, this is probably enough. Higher values will maybe give a slightly smoother display, but barely noticeable. You can activate the display of frames per seconds (aka "fps") through the menu ("options -> system") or with the command line ("-display-fps"). On a single processor system, reducing the number of frames per second might allow the rest of the game run faster. So if you notice the game is really slow, in terms of "fighters move slowly" then you might be happy reducing the display rate and therefore giving power back to the other parts of the program. On a dual-core (or more) or on a multi-processor system, this is probably useless since the game is threaded and has a dedicated thread for display purposes. The command line option to reduce the number of frames per second is `--target-fps'. Additionnally, the parameter `--gfx-cpu-usage' allows you to force the display thread to "take a rest" and go idle for some time. This is advanced settings, most users won't touch this. 2.11 Sound & music ================== 2.11.1 Current status --------------------- As of today, the game is capable of playing Ogg Vorbis (http://www.vorbis.com/) audio files. That's it. 2.11.2 The future ----------------- In the long run, what is planned is to support Csound (http://www.csounds.com/) which would allow very cool effects, such as dynamically changing the music while the game is running, typically following the action. If there's a lot of fight, the music could reflect this. For now this is only vaporware, just a nice idea among others, nothing implmented yet. 2.12 Config file ================ The config file is a simple XML file. It uses XML only to benefit standard parsing tools, but it's not a structured XML file, in the sense that the tree is so simple that all items are at the same level. It is just a simple key-value binding. This file is in `$HOME/.liquidwar6/config.xml', you're free to edit it manually, but all parameters are changeable with command line options. The program will overwrite this file each time it exits, so if you put comments in it, they will disappear. The advantage of this is that if you mispell something, or if for some reason the game does not understand a value, then when rewriting the file, it will show you it just did not get it. The file embeds the documentation for all its entries, it is therefore rather verbose. The documentation is the same you will find online or by quering the game with the `--about' option, also the same you would get reading this manual. 2.13 Logs ========= Liquid War 6 uses `stdout' to output important messages, and `stderr' to log warnings and errors. It will also use syslog (http://en.wikipedia.org/wiki/Syslog) if available. Additionnally, a verbose log is available in `$HOME/.liquidwar6/log.csv'. You can read this using any spreadsheet software capable of reading csv file. It uses the tab (`\t') character as a separator. It contains valuable informations including version and most default values for the game, and for each line logged, it says where in the code the log function was called. A must-have for debugging. 2.14 Report bugs ================ There are two ways to report bugs: * send a mail to (mailto:bug-liquidwar6@gnu.org); * use the web-based Savannah bug tracker (https://savannah.gnu.org/bugs/?func=additem&group=liquidwar6). The latter (Savannah (http://savannah.gnu.org)) is much preferred, because the mailing-list is bloated with spam... It also offers a list of bugs (http://savannah.gnu.org/bugs/?group=liquidwar6) which you should read before submitting a new one. 3 Hacker's guide **************** This hacker's guide is for anyone who is curious about the game, and wants to know how it works. It covers many aspects from simple map creation to technical program internals. A great effort has been done in Liquid War 6 so that it should be much more hackable than previous versions. Any feedback is welcome. 3.1 Designing levels ==================== 3.1.1 Why is level design so important? --------------------------------------- As of Liquid War 5 (http://www.ufoot.org/liquidwar/v5), most levels have been contributed by players. While the maintainer of Liquid War 6 has technical knowledge to develop the game, artistic talent and taste might not be his domain of excellence 8-) Therefore contribution are truely welcomed when they take the form of a new, original, fun and good looking level. It's believed the levels often make the game much more than its engine. This is true for any type of game, and Liquid War is no exception. So this section is here to help players understand how to hack existing levels, and create new ones, in the hope that 1) they can enjoy their own creations and 2) possibly share their work with others. Note that this manual might refer to levels and maps: they are just two different names to describe the very same thing. It's an alias. 3.1.2 Format overview --------------------- Liquid War 6 stores level information in a plain directory. There is no such thing as an opaque `.dat' binary file. The name of the level is the name of the directory itself, and its elements are the files contained in it. Files must follow a precise naming scheme. For instance Liquid War 6 expects a `map.png' file to be present in each map directory. All image files in a level use the Portable Network Graphics (http://www.w3.org/Graphics/PNG/) or JPEG (http://www.jpeg.org/) format. It is possible that in the long term, Liquid War 6 will be able to handle levels as `.tar.gz' or `.zip' files. In that case these files will only be a compressed image of the actual level directory. See the `./map/' directory of the source Liquid War 6 distribution to see example of maps. 3.1.3 map.png ------------- This is the only required file in a level. In fact, the existence of `map.png' makes a directory a level. When checking wether a directory is a correct level, Liquid War 6 simply tests the existence and validity of `map.png'. This image is a simple black & white area, where white zones are the background, the sea, the places where fighters can move, and black zones are the foreground, the walls, the places where fighters can't go. This informations can be stored in a 2-color indexed file, or in a grayscaled or even truecolor RGB file, but color information won't be used. Internally, Liquid War 6 will read the color of every point. If it is over 127 on a 0 to 255 scale, it will be considered as background, if it is below 127, it will be considered as foreground. 3.1.4 layer2.png ... layer7.png ------------------------------- Liquid War 6 can handle mutiple layer maps. Think of a pile of maps, one being on top of the other. This allows you to create a volume, the game considers every layer has two axis x and y, and the z axis is to travel through layers. First layer corresponds to z=0, second layer to z=1, and so on. Here are the files you can use to define layers: * `map.png' this one is on top, it's always defined (z=0) * `layer2.png' (z=1) * `layer3.png' (z=2) * `layer4.png' (z=3) * `layer5.png' (z=4) * `layer6.png' (z=5) * `layer7.png' (z=6) A `layerX.png' file should be designed exactly like `map.png'. In fact, `map.png' could simply have been called `layer1.png'. Up to 6 extra layers can be defined (from `layer2.png' to `layer7.png'). This is a hardcoded limit. It allows you to define 7 different layers, including the top `map.png' layer. Keep in mind this layer system is not real 3D, it's more a "2D and a half" model. Adding layers can considerably slow down the game, so it's wise to try and use as few layers as possible. Technically, 3 layers will allow you to build bridges and tunnels, which is probably the most usefull construction using layers. Fighters can also have difficulties navigating through layers so piling up layers in narrow "vertical" z-axis based tunnels is probably not a great idea. The `ufoot/concept/pass' map of the `liquidwar6-extra-maps' demonstrates basic layer usage. 3.1.5 texture.png, texture.jpeg and texture-alpha.jpeg ------------------------------------------------------ It is possible to define a texture for the map by putting a `texture.png' or `texture.jpeg' file. It does not need to have the same dimensions as the map itself. Indeed, textures can be much more precise than the actual logical map. There's no theorical limit on how big a texture can be, more precisely, it can be much bigger than any hardware/driver maximum texture size. In practice, a too big texture will waste your video card RAM, and slow everything down. Sizes ranging from 640x480 to 1600x1200 are reasonable texture sizes. If you don't define this, the `map.png' file will be used as the texture, and also import colors from `style.xml' if defined. Note that the shape of the texture defines the shape of the map, that is, the ratio with which it will appear on the screen. The PNG alpha layer will be used for transparency. But to save disk space, it can be convienient to prefer the JPEG format, use `texture.jpeg' instead of `texture.png' and store the alpha layer in a separated file, called `texture-alpha.jpeg'. This avoids handling heavy PNG files, PNG compression not being performant on most textures. In `texture-alpha.jpeg', white is considered opaque, black is transparent. Different levels of gray correspond to different levels of opacity. 3.1.6 rules.xml --------------- Whereas `style.xml' is only about the appearance of the map, `options.xml' allows the map designer to change pretty much any parameter. Ultimately, the player can still ignore these settings and overide them with its own values, but the idea is: most game options are only pertinent in a given context. For instance, on some maps it's interesting to move slowly, on some other it's interesting to move fast. Some maps might be playable packed with fighters everywhere, some other might be much more fun with almost nobody on them. The approach in Liquid War 5 (http://www.ufoot.org/liquidwar/v5) was to make the options available, but let the player himself find the right settings for the right map. The consequence is that no one ever used all those cryptic options in the advanced options menu, and probably 99% of the players ended up playing with default settings. This is not that bad, but given the fact that changing a few parameters one can totally transform the gameplay, it has decided been that in Liquid War 6, the map designer suggests the right options that matches his map. This does not prevent the player from toying with options himself, he can still do it. There's also one important point to note: all these options are technically implemented as integer parameters. We certainly do not want any float here, since, and it is a Liquid War specific behavior, the game must be 100,00% predictable and behave the same on every platform. As there is nothing like exactness when speaking of floats, those are forbidden here. As for strings, we are dealing here with low-level internals, and this section is not about telling a story. They are technical options only. Booleans are implemented with the usual `false = 0' and `true = 1' convention. Note that other config files in Liquid War 6 might rely on floats, strings, and booleans with conventionnal `true' and `false' values, but not this one. `rules.xml' is special. *Note rules.xml reference: Map rules.xml. 3.1.7 hints.xml --------------- This XML file gives hints to the map loader. It will for instance allow the user to modify the resolution on the fly, force a minimum, a maximum surface (resolution) for the map. It can seriously change gameplay, but parameters set here never appear directly in the loaded map, changing them afterwards makes no sense. *Note hints.xml reference: Map hints.xml. 3.1.8 style.xml --------------- This is a simple XML file defining various appearance parameters. It has absolutely no effect on gameplay. These settings can ultimately be overriden by the player, but the idea is that if the map designer thinks this level looks better with this or that option, let him say it in this file. *Note style.xml reference: Map style.xml. 3.2 Translating =============== 3.2.1 Using gettext ------------------- Liquid War 6 uses GNU gettext (http://www.gnu.org/software/gettext/) for all its messages. There's an online manual (http://www.gnu.org/software/gettext/manual/gettext.html) about this tool. In practice, what you have to do as a translator is to edit the `po/xx.po' file with `xx' being your language / country code. For instance, to translate the game in French, one needs to edit `po/fr.po'. 3.2.2 Formatted strings ----------------------- This is very important, you might already be aware of it if you are familiar with gettext, but still it's worth mentionning : when a string contains special characters such as `%d' or `%s' (in a general manner, anything with a `%' it's important that all translations contain exactly the same number of `%d's and `%s's than the original. For instance: "foo has %d bars (%s)" can be translated to: "ziblug zdonc %d zuc - %s - tac" The number, order and type of `%' entries is preserved. To learn more about these formats, use `info printf' or `man 3 printf'. In a general manner, get informations about printf (http://en.wikipedia.org/wiki/Printf). Additionnally, some strings are used by Scheme (Guile) code and not by C code. Thus, they don't use the standard C/printf convention. In these strings, what you must preserve and be aware of is the tilde character `~'. Very often you'll see `~a' in a string. As with the printf `%', you must preserve the number, order and type of those. There is a complete online reference (http://www.gnu.org/software/guile/manual/html_node/Formatted-Output.html) about this way of formatting strings. 3.2.3 Partial translation ------------------------- Liquid War 6 has thousands and thousands of messages which could theorically be translated. In practise it's counter-productive to spend time to translate those, as the game is still evolving constantly, and as most of these messages are technical messages which inform about rare bugs and strange conditions. All sort of informations which, while valuable, are not intented for end-users and are more destinated to be reported in bug reports. To select only the interesting messages to translate, the current gettext configuration only uses a reduced set of files. * `src/scriptpo.c' : the most important file. It contains the definitions used by all the Guile code, this is where you'll find all the menu labels. * `src/lib/sys/sys-log.c' : log messages and keywords. * `src/lib/sys/sys-mem.c' : memory error messages, probably the most important ones. * `src/lib/lw6-print.c' : contains some messages printed on the console. As a side note, the file `src/lib/hlp/hlp-reference.c' contains all the entries for the various configuration options, anything that can be queried by `liquidwar6 --about='. This is several hundred messages. It might be interesting to translate them some day, but it's obviously not a priority today. 3.3 Architecture ================ 3.3.1 C + Guile --------------- Technically, Liquid War 6 is a collection of C functions which are exported to Guile. The main binary embeds a Guile interpreter, which will run a Guile script. This script calls the exported C functions, and glues them together. It should be possible to implement the game without using Guile at all, using C code to make the various modules communicate together. This might seem an easier way to go, not involving several languages. However, using this script level is a good way to achieve several important goals: * it's possible, at any time, to query the game about its internal state, dump objects, take actions. That's what the console is about. It's a bit like having an embedded debugger, it's really a very convenient tool to develop, make experiments and track problems. * many hacks can be done without recompiling anything at all. Simply edit a few files with an editor, and your patch is running. Once the binary base is set up, hacking scripts on top of it is (almost) a piece of cake. * forcing the program to use scripts to transfer informations from a module to another is a good way to avoid "spaghetti" code, when modules cross-use each other in an uncontrollable way. Of course in some cases, modules communicate directly, especially when performance is important. But for many tasks, it's just very comfortable and safe to have module A send orders to module B through a high-level script API. Having Guile to implement high-level stuff also decreases, to some extent, the need for object-oriented features of C++. The big picture is : low level code that require speed, optimized data processing, is written in C. Code which is more high level and requires abstraction is written in scheme. 3.3.2 Threading and SMP ----------------------- Liquid War 6 makes a heavy usage of threads. Early versions of the game did not have this feature but starting with 0.0.7beta, one can really consider the game is heavily threaded. There's basically: * a thread to handle the main control flow. This thread runs scheme code which Guile. It's not the most CPU-greedy thread, but when it's stalled, there's no more interaction between the user and the program. * a thread to handle the display. Depending on rendering options, this thread can consume lots of CPU cycle. On a single processor/core system, it can be interesting to lower rendering options in order to gain speed on other aspects of the game. On a quad-core system, it's probably useless, just play with all bells and whistles activated. * two threads to run the core algorithm. One maintains the so-called reference state, the other being dedicated to the draft sate. In a local game there's no draft state so only one of those two threads is used. There's even a technical optimization which can be turned on and can theorically use even more threads and be efficient on very big maps but well, it's rather untested and still has to prove its real efficiency. * a thread to handle map loading. This one is not active all the time, it's just here to keep a preemptive interface while loading complex maps. * network code can also fire threads, especially when connecting on remote systems. So globally, if you have an SMP system, the game will be happy with it. It will also run on a single processor, as the program uses POSIX pthreads it's capable to run on any computer which has pthreads implemented for it. But, and this is a strong limitation, without pthreads, the game won't run. At all. Or at least, not unless it's almost completely rewritten. 3.3.3 Internal libraries ------------------------ The C code is splitted into several internal libraries. This allow independant testing of various game modules. The main module, the most important one, is `ker' (stands for "kernel"). This is were the core algorithm is. To some extent, the rest of the code is just about how to provide this module with the right data and environment. Logically, if you profle the game, you should find out that a great part of the CPU time is spent here. Code here is about spreading gradients, moving fighters and cursors. The `map' module is here to handle maps, it contains the code to manipulate maps in memory. But it does not know how to load them from disk. This is the responsability of another module, `ldr', which is linked against libraries such as libpng (http://www.libpng.org/pub/png/libpng.html) or libjpeg (http://www.ijg.org/) and does the job of transforming those standard formats into a usable in-memory structure. There's still a third moduled involved in map handling, it's `tsk', whose job is to load a level in the background. It has a 2-steps asynchronous loading system which allows the game to load maps while the user interface is still responsive, and give a preview of the map as soon as possible, when loading continues in the background, building optimizing structures which are usefull when playing but not mandatory just to show the map. At the other end of the algorithm-chain, the `pil' module will "pilot" things. It's this module which will translate text readable orders (typically adapted for network usage) into function calls. It has event lists, keeps them in the right order, and will also permanently maintain three different states of the game. A backup state which can be used any time to go back in time and get the game in a stable 100% sure state. A reference state which is correct but ever changing. Basically backup plus all the orders received between backup and reference gives reference. And finally a draft state which is as up to date as possible but might be wrong. This is typically interesting in network game, where we want to show something moving, something fast, even if there's lag on the network and other computers fail to send information in time. In this case we display draft while still keeping reference and updating it when we finally receive valid informations. Backup would be used to send bootstrap information when people are joining a new game, or to check up if things are going right. A special `bot' module is here to handle bot algorithms. A bot is just a simple `move' function which takes a game state as an input, and returns an `x,y' position, just the way a mouse handler would. How complex a bot is "under the hood" depends on the type of bot. Current bots are really basic. The `gfx' module handles all the graphics stuff. It is itself splitted in several sub-modules, that is, it does not do anything but load a module such as `mod-gl' which will actually contain the implementation. In an object-oriented language, it would be an abstract class, an inteface. The implementation does not need to be thread-safe. It's better if it is, for theorically it could be possible to fire Liquid War 6 with two display backends running at the same time on the same game instance, but this code has yet to be written, and it's a rare dual headed configuration which probably has no real-life usage. If only one graphics backend is activated at a time, the rest of the implementation garantees there will never be two concurrent calls to a function is this module. It is the `dsp' ("display") which handles this. It fires a thread for rendering purposes, and sends information to this thread, detecting automatically if it's necessary to acquire a mutex and update rendering informations. For the caller, this is transparent, one just has to call an update function from time to time. The module will even perform "dirty-reads" on a game state being calculated, to render things in real time, as soon as possible. To ease up the implementation of different graphics backends, a `gui' module contains code which is meant to be used by any graphics backend. It's just a factorisation module, containing common code and interfaces, related to displaying things. This is where, for instance, one can find a high level menu object. The `snd' module handles sound. It's also an abstract class, an interface, which uses dynamic backends as implementations. The `net' module is a wrapper over different network APIs, it handles Winsock and POSIX sockets in a uniform manner. The `cli' and `srv' contain network client and server code, implementing the various protocols in dynamically loadable sub-modules. It's the role of `p2p' to glue this together, handle the list of available servers, the message queue, verifying nobody is cheating, and so on. The `sys' contains most system and convenience functions, it handles logs, type conversions, timer, memory allocation, it's the fundamental module every other module depends on. The `hlp' is used to handle keywords and internal self-documentation (this is what is used by `--list' and `--about'), `cfg' knows how to read and save config files, `cns' handles the console, and `dyn' can load `.so' shared files dynamically. Finally the `img' module is just here to make screenshots of the game, it's been separated for this feature required to link against a dedicated library. So well, this is a lot of modules. The list might move a bit, but the big picture is here. Each module is testable separately. 3.4 Memory structures ===================== The most important memory structures in Liquid War 6 are: * map (`lw6map_level_t') : this contain the map immutable informations. This is what resides in memory after a map has been loaded from the disk. It contains all the various `.png' and `.jpeg' files stored as pixel arrays, resampled if need, and also contains the various map attributes. Once this structure is ready, the game is capable of displaying the map on the screen, but it can not do anything with it yet. * game_struct (`lw6ker_game_struct_t') : this one contains the same informations as the previous structure, only the information has been post-treated so that it's ready for use by the core algorithm. It will, for instance, contain the famous mesh structure, which groups squares by packets of 1, 4, 16, 64 or more. The reason it's been separated from the level is that operations such as creating the mesh might require a lot of time. So to allow players to see the level while black magic is still running in the background, it was required to make a difference between what is required to view the map ("level") and what is required to play on it ("game_struct"). * game_state (`lw6ker_game_state_t') : contains all the variable, ever changing game data. This is where the position of fighters is stored, their health, and such things. It is designed to be synchronizable by using mostly simple calls to `memcpy'. It heavily relies on the previous structures, the idea is that one can have several "game_state" plugged on a single "game_struct". All these structures are defined in the `ker/ker.h' header. 3.5 100% predictable algorithm ============================== The core Liquid War 6 algorithm is 100% predictable, that is to say, given the same input, it will produce the same results, on any computer. Previous versions of the game also had this property. This is very important for network games, since in a network only informations such as "cursor A is at position x,y" are transmitted. Every node maintains its own internal game state, so it's very important that every node comes with the same output given the same input. For this reason Liquid War 6 never uses floating point numbers for its core algorithm, it uses fixed point numbers instead. It also never relies on a real "random" function but fakes random behavior by using predictable pseudo-random sources, implementation independant, such as checksums, or modulos. There are also some optimizations which are not possible because of the predictability requirement, for instance one can not spread a gradient and move the fighters in concurrent threads, or move fighters from different teams in different threads. If you read the code, you'll find lots of checksums here and there, a global checksum not being enough for you never know where the problem happened. The test suite uses those facilities to garantee that the game will run the same on any platform. Not being able to rely on a predictable algorithm would require to send whole game states on the network, and this is certainly way too much data to transmit. A moderate 200x200 map has a memory footprint of possibly several megabytes, so serializing this and sending it to multiple computers at a fast-paced rate is very hard, if possible at all, even with a high bandwidth. We're talking about Internet play here. 3.6 About mod-gl ================ 3.6.1 The main renderer ----------------------- Liquid War 6 has a modular architecture which allows the programmer (and the player) to plug pretty much any rendering/graphics backend, provided this one is... developped. As of 2009 the only available backend is still `mod-gl', it will display the game using 3D acceleration, if available, through the SDL (http://www.libsdl.org/) library, using its GL bindings. Additionnally, versions available for MS-Windows and Mac OS X will probably never any other backends available. For technical reasons, those platforms do not have the flexibility of GNU/Linux and do not allow graphical libraries to be loaded dynamically. In practice, both of them require hacks that override the standard `main' function. MS-Windows has its `WinMain' instead, and Mac OS X is even more pedantic, requiring graphical functions to be executed in the main thread. So `mod-gl' is just linked statically in those versions, and the modularity of the game is purely theorical on these platforms. This `mod-gl' module is really one of the key stones of Liquid War 6, and if you want to change graphical things, it's definitely the place to hack on. The source is in `src/lib/gfx/mod-gl'. 3.6.2 Hardware requirements --------------------------- The `mod-gl' backend requires "moderate" hardware, but it still does require hardware acceleration. Pure software rendering through mesa (http://www.mesa3d.org/) for instance, won't be enough. So if you're running Xorg on GNU/Linux and there's a DRI driver for your card, the game should run fine. On the programmer side, the counterpart is that one should not rely on fancy OpenGL features. Textures have a maximum size of 512x512 for instance. Of course some maps are bigger than this but this means that internally, `mod-gl' splits them into smaller tiles, and displays those tiles one by one. 3.6.3 The gl-utils toolbox -------------------------- Inside the `mod-gl' backend, the `src/lib/gfx/mod-gl/gl-utils' directory contains lots of common structures, factorized functions which can (and should, if appliable) be used. 3.7 Compilation tips ==================== 3.7.1 Advanced ./configure options ---------------------------------- In addition to all the common Autoconf (http://www.gnu.org/software/autoconf/) switches such as `--prefix', Liquid War 6 has some custom switches: * `--enable-optimize': will turn on optimizations. This will turn on compiler options such as `-fomit-frame-pointer' but also disable some code in the program. Indeed, most of the advanced memory checking in the game - which ensures it does not leak - will be turned of. This will certainly speed up things, however, it's not recommended to turn this on until program is not stable enough so that memory leaks and other problems can be declared 'impossible'. Turn this on if you really have some speed problem, otherwise it's safer to use the full-featured 'slow' version of the game. * `--enable-allinone': will stuff all the internal libraries into one big executable. Very convenient for profiling. The major drawback is that you need to have all the optional libraries installed to compile all the optional modules. Another side effect is that with this option there's no more dynamic loading of binary modules, so if your platform has a strange or buggy support for `.so' files, this option can help. * `--enable-fullstatic': will build a totally static binary, that is using the `--static' option for `gcc' and the `-all-static' option for `libtool'. Currently broken, this option could in the future allow for building binaries that run pretty much everywhere, without requiring any dependency but a Kernel. * `--enable-gprof': will enable profiling informations. This will activate `--enable-allinone', else you would only track the time spent in functions in the main `liquidwar6' executable, and exclude lots of interesting code contained in dynamic libraries. * `--enable-instrument': will instrument functions for profiling. This will turn on the `-finstrument-functions' switch when compiling, so that the hooks `__cyg_profile_func_enter' and `__cyg_profile_func_exit' are called automatically. Then you can link against tools like cprof (http://cprof.sourceforge.net/) or FunctionCheck (http://sourceforge.net/projects/fnccheck/). * `--enable-profiler': will enable Google Performance Tools (http://code.google.com/p/google-perftools/) support. Basically, this means linking against `libtcmalloc' and `libprofiler'. You could activate those by using `LD_PRELOAD' or by using your own `LDFLAGS' but using this option will also make the game tell you if `CPUPROFILE' or `HEAPPROFILE' are set when it starts. The `pprof -gv' output is very handy. * `--enable-gcov': will enable coverage informations, to use with gcov (http://gcc.gnu.org/onlinedocs/gcc/Gcov.html) and lcov (http://ltp.sourceforge.net/coverage/lcov.php). This is for developpers only. It will activate `--enable-allinone', else there would be some link errors when opening dynamic libraries. * `--enable-valgrind': will enable some `CFLAGS' options which are suitable for the use of Valgrind (http://www.valgrind.org/), to track down memory leaks and other common programming errors. Use for debugging only, usually together with `--enable-allinone'. 3.7.2 Microsoft Windows msys/mingw32 port ----------------------------------------- This section describes how to compile the game from source under Microsoft Windows. Note that players are encouraged to use a free system such as GNU/Linux, which is the platform Liquid War 6 is being hacked on by default. If you encounter problems with this port, you'll probably save time by installing a double-boot with GNU/Linux coexisting with your previous Microsoft Windows install. Basically, Liquid War 6 requires MinGW (http://www.mingw.org/). More precisely, it requires MSYS (http://www.mingw.org/msys.shtml). A standard Cygwin (http://www.cygwin.com/) installation won't work, because it is too UNIXish to allow third party libraries like SDL (http://www.libsdl.org/) to compile natively. You might argue that SDL is available for Cygwin, but in reality, the Cygwin port of SDL is a MinGW port. Indeed, Cygwin brings all standard POSIX functions including the use of `main' instead of `WinMain' and I suspect this is a problem for graphical libraries like SDL which do require some sort of direct access to the OS low-level functions. Therefore, MinGW is more adapted for it does not define all these functions, and allows any library to hook on Microsoft Windows internals directly. Point is then, you also loose the cool effect of Cygwin which is to have a complete glibc (http://www.gnu.org/software/libc) available, including network functions like `select' defined the POSIX way, and not the WinSock way. If you ever ported code from POSIX sockets to WinSock 2, you know what I mean. Using MinGW is also embarassing for some libraries won't compile easily, and for instance programs which heavily rely on a real `TTY' interface to work are usually hard to port. This includes ncurses (http://www.gnu.org/software/ncurses/) and GNU readline (http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html). Liquid War 6 tries to have workarrounds for all this, and in some cases the workarround is simply that embarassing code is not compiled on Microsoft Windows. For this reason, some features are not available on this platform. Period. Now the reason you need MSYS and not only MinGW is that MSYS will allow `./configure' scripts to run, and this eases up the porting process a lot. MinGW and MSYS packages are downloadable on the SourceForge MinGW download page (http://sourceforge.net/project/showfiles.php?group_id=2435). Alternatively, there is a mirror on ufoot.org (http://www.ufoot.org/download/liquidwar/v6/mingw32/pkg/), but files might be outdated. To compile Liquid War 6, first download and unzip all the following files in the same directory, for instance `C:\MSYS'. If you do not have any tool to handle `.tar.gz' and `.tar.bz2' files under Microsoft Windows, which is likely to be the case when MSYS is not installed yet, you can untar these on any GNU/Linux box, then upload the whole directory to the target Windows host. * autoconf2.5-2.61-1-bin.tar.bz2 * autoconf-4-1-bin.tar.bz2 * autogen-5.9.2-MSYS-1.0.11-1-bin.tar.gz * autogen-5.9.2-MSYS-1.0.11-1-dev.tar.gz * autogen-5.9.2-MSYS-1.0.11-1-dll25.tar.gz * automake1.10-1.10-1-bin.tar.bz2 * automake-3-1-bin.tar.bz2 * bash-3.1-MSYS-1.0.11-1.tar.bz2 * binutils-2.18.50-20080109-2.tar.gz * bison-2.3-MSYS-1.0.11-1.tar.bz2 * coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2 * crypt-1.1-1-MSYS-1.0.11-1.tar.bz2 * csmake-3.81-MSYS-1.0.11-2.tar.bz2 * cvs-1.11.22-MSYS-1.0.11-1-bin.tar.gz * diffutils-2.8.7-MSYS-1.0.11-1.tar.bz2 * findutils-4.3-MSYS-1.0.11-1.tar.bz2 * flex-2.5.33-MSYS-1.0.11-1.tar.bz2 * gawk-3.1.5-MSYS-1.0.11-1.tar.bz2 * gcc-core-3.4.5-20060117-3.tar.gz * gcc-g++-3.4.5-20060117-3.tar.gz * gcc-g77-3.4.5-20060117-3.tar.gz * gcc-objc-3.4.5-20060117-3.tar.gz * gdb-6.8-mingw-3.tar.bz2 * gdbm-1.8.3-MSYS-1.0.11-1.tar.bz2 * gettext-0.16.1-1-bin.tar.bz2 * gettext-0.16.1-1-dll.tar.bz2 * gettext-0.16.1-MSYS-1.0.11-1.tar.bz2 * gettext-devel-0.16.1-MSYS-1.0.11-1.tar.bz2 * inetutils-1.3.2-40-MSYS-1.0.11-2-bin.tar.gz * libiconv-1.11-1-bin.tar.bz2 * libiconv-1.11-1-dll.tar.bz2 * libiconv-1.11-MSYS-1.0.11-1.tar.bz2 * libtool1.5-1.5.25a-1-bin.tar.bz2 * libtool1.5-1.5.25a-1-dll.tar.bz2 * libtool1.5-1.5.25a-20070701-MSYS-1.0.11-1.tar.bz2 * lndir-6.8.1.0-MSYS-1.0.11-1.tar.bz2 * lpr-1.0.1-MSYS.tar.gz * lzma-4.43-MSYS-1.0.11-1-bin.tar.gz * make-3.81-MSYS-1.0.11-2.tar.bz2 * mingw-runtime-3.14.tar.gz * mingw-utils-0.3.tar.gz * minires-1.01-1-MSYS-1.0.11-1.tar.bz2 * MSYS-1.0.11-20071204.tar.bz2 * msysCORE-1.0.11-2007.01.19-1.tar.bz2 * openssh-4.7p1-MSYS-1.0.11-1-bin.tar.gz * openssl-0.9.8g-1-MSYS-1.0.11-2-bin.tar.gz * openssl-0.9.8g-1-MSYS-1.0.11-2-dev.tar.gz * openssl-0.9.8g-1-MSYS-1.0.11-2-dll098.tar.gz * perl-5.6.1-MSYS-1.0.11-1.tar.bz2 * perl-man-5.6.1-MSYS-1.0.11-1.tar.bz2 * regex-0.12-MSYS-1.0.11-1.tar.bz2 * tar-1.19.90-MSYS-1.0.11-1-bin.tar.gz * texinfo-4.11-MSYS-1.0.11-1.tar.bz2 * vim-7.1-MSYS-1.0.11-1-bin.tar.gz * w32api-3.11.tar.gz * zlib-1.2.3-MSYS-1.0.11-1.tar.bz2 This file list might contain file which are not absolutely mandatory for Liquid War 6, for instance the Fortran 77 compiler is absolutely useless, but installing it won't harm either. Some packages might unzip things the right way, but some do it in a subfolder. You might need to run commands like: cp -r coreutils*/* . rm -rf coreutils* Get rid of useless files: rm ._.DS_Store .DS_Store It's also mandatory to move everything that has been installed in `/usr' or `/usr/local' to `/' since MSYS has some builtin wizardry which maps `/usr' on `/'. You need to do this if you don't unzip files from a MinGW shell, which is obviously the case when you first install it. Usefull command can be: mv usr/* . rmdir usr Next, `libintl' is not correctly handled/detected by LW6, and can raise an error like `"gcc.exe: C:/msys/local/lib/.libs/libintl.dll.a: No such file or directory"' so one needs to copy some libraries in `/usr/local/lib/.libs/': mkdir local/lib/.libs cp local/lib/libintl.* local/lib/.libs/ Another step is to edit `/etc/profile' and add lines like: export CFLAGS="-g -I/usr/local/include" export LDFLAGS="-L/usr/local/lib" export GUILE_LOAD_PATH="C:\\MSYS\\local\\share\\guile\\1.8\\" Close and re-launch your msys shell (rxvt) so that these changes take effect. Check that those values are correctly set: env | grep FLAGS env | grep GUILE Finally, your MSYS environment is (hopefully...) working. Now you need to compile the following programs, from source. Files are mirrored on ufoot.org (http://www.ufoot.org/download/liquidwar/v6/mingw32/src/) for your convenience, however these might be outdated. Still, there are known to work. Proceed like if you were under a POSIX system. Some packages use the `--disable-rpath' swith, there are various reasons for which rpath is an issue (http://wiki.debian.org/RpathIssue). In the same manner, `--disable-nls' when linking against `libintl' or `libiconv' was painful. * pthreads-win32 (http://sourceware.org/pthreads-win32/), untar pthreads-w32-2-8-0-release.tar.gz then `make clean GC; cp pthread.h sched.h /usr/local/include/; cp pthreadGC2.dll /usr/local/bin/; cp libpthreadGC2.a /usr/local/lib/' * GNU MP (http://gmplib.org/), untar `gmp-4.2.2.tar.gz' then `./configure && make && make install' * Guile (http://www.gnu.org/software/guile/), untar `guile-1.8.5.tar.gz'. Edit `libguile/guile.c' and insert `#undef SCM_IMPORT' just before `#include '. Edit `./libguile/threads.c' and place `struct timespec { long tv_sec; long tv_nsec; };' just before `#include "libguile/_scm.h"'. Then `./configure --disable-nls --disable-rpath --disable-error-on-warning --without-threads && make && make install'. The `GUILE_LOAD_PATH' value must be correctly set for `guile-config' to work. For unknown reasons, running `guile' can throw a stack overflow error. Don't panic. See bug 2007506 on SourceForge.net (https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2007506&group_id=2435) for an explanation on why the Guile binary shipped with MSYS is not suitable for Liquid War 6. * expat (http://www.libexpat.org/), untar `expat-2.0.1.tar.gz' then `./configure && make && make install' * SQLite (http://www.sqlite.org/), untar `sqlite-amalgamation-3.5.9.tar.gz' then `./configure && make && make install' * libpng (http://www.libpng.org/pub/png/libpng.html), untar `libpng-1.2.29.tar.gz' then `./configure && make && make install' * libjpeg (http://www.ijg.org/), untar `jpegsrc.v6b.tar.gz' then `./configure && make && make install && make install-lib' * libcURL (http://curl.haxx.se/libcurl/), untar `curl-7.18.1.tar.gz' then `./configure --without-ssl && make && make install' * FreeType 2 (http://freetype.sourceforge.net/), untar `freetype-2.3.5.tar.gz' then `./configure && make && make install' * libogg (http://www.xiph.org/), untar `libogg-1.1.3.tar.gz' then `./configure && make && make install' * libvorbis (http://www.xiph.org/), untar `libvorbis-1.2.0.tar.gz' then `LDFLAGS="$LDFLAGS -logg" && ./configure && make && make install' * SDL (http://www.libsdl.org/), untar `SDL-1.2.13.tar.gz' then `./configure && make && make install' * SDL_image (http://www.libsdl.org/projects/SDL_image/), untar `SDL_image-1.2.6.tar.gz' then `./configure && make && make install' * SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/), untar `SDL_mixer-1.2.8.tar.gz' then `./configure && make && make install' * SDL_ttf (http://www.libsdl.org/projects/SDL_ttf/), untar `SDL_ttf-2.0.9.tar.gz' then `./configure && make && make install' For your convenience, a zip file containing a complete MSYS "Liquid War 6 ready" environment is available. It is simply the result of all the operations described above. Simply unzip msys-for-liquidwar6-20080819.zip (http://www.ufoot.org/download/liquidwar/v6/mingw32/msys-for-liquidwar6-20080819.zip) (about 240 megs) in `C:\MSYS\'. All dependencies compiled in `/local' have been generated using the command: cd /usr/local/src ./msys-for-liquidwar6-build.sh > ./msys-for-liquidwar6-build.log 2>&1 Note that this script does't do everything, you'll still need to edit Guile source code and patch it manually. It might even be possible to use this MSYS environment under Wine (http://www.winehq.com/). Simply unzip it under `$HOME/.wine/drive_c', and run `wine "$HOME/.wine/drive_c/windows/system32/cmd.exe" /c "c:\\msys\\msys.bat"' and with luck, you'll get a working shell. Note that this might allow you to compile the game, but running it is another story. Consider this MSYS over Wine trick as a hack enabling the use of free software only when compiling for Microsoft proprietary platform. It is not a reasonnable way to run the game. If running under a UNIXish platform, or better, GNU, simply run native code. Use the Windows 32-bit port only if you are jailed on a Microsoft system. Now, let's come to the real meat, untar the Liquid War 6 source tarball, launch your MSYS shell, and: ./configure make make install Now the binary is in `src/.libs/liquidwar6.exe' (beware, `src/liquidwar6.exe' is only a wrapper). This binary is an MSYS/MinGW binary, so it read paths "à la" Microsoft, that is, it has no knowledge of what `/usr' is, for instance. It requires paths starting by `C:\'. 3.7.3 Mac OS X port ------------------- This is still experimental. Basically, install MacPorts, and most dependencies with, except for SDL which you compile from source. The idea is to compile SDL using the native OS X bindings (and not some other GL files you could have in `/opt/local' installed by MacPorts), then compile the game and other SDL dependencies against this SDL. The SDL_mixer library might need to be told to compile itself without dynamic ogg support. By default it seems that it tries to load `libvorbisfile.dylib' at runtime, and it can fail. To disable this dynamic loading, use for instance : /configure --prefix=/opt/extra --enable-music-ogg --disable-music-ogg-shared Also, it might seem obvious for Mac OS X users, but there are some important issues related to compiling options and handling dynamic libraries at runtime. * The command `ldd' does not exist, run `otool -L' instead. * The equivalent of `LD_LIBRARY_PATH' is `DYLD_LIBRARY_PATH'. * The extension for shared binaries is `.dylib' and not `.so'. * You might need to set the `OBJCFLAGS' environment variable along with `CFLAGS' because the Mac OS X port uses some Objective-C code. It is very important to have the right SDL flags when linking the Liquid War 6 binaries. For instance it could be: -I/opt/extra/include -I/opt/local/include -Wl,-framework -Wl,CoreFoundation -I/opt/local/include -D_THREAD_SAFE -Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,OpenGL -Wl,-framework -Wl,Cocoa The point is to have Cocoa and OpenGL support. Depending on the way you installed SDL, you might also need to include an SDL framework support, this is mostly if you installed SDL from .dmg binary images, and not from source with the command line. A typical output of `sdl-config --libs' is: -L/opt/extra/lib -lSDLmain -lSDL -Wl,-framework,Cocoa Another important issue is to include `SDL.h', which in turn includes `SDLmain.h', in all the .c source files defining the standard `main' function. This is done in liquidwar6 but should you try to link yourself on liquidwar6 libraries and/or hack code, you must do this or you'll get errors when running the game. Such errors look like: *** _NSAutoreleaseNoPool(): Object 0x420c90 of class NSCFNumber autoreleased with no pool in place - just leaking The reason is that SDL replaces your `main' with its own version of it. One strong implication is that all the dynamic loading of SDL, which works on sandard GNU/Linux boxes, won't work under Mac OS X, since SDL hard codes itself by patching `main' with `#define' C-preprocessor commands. As of today, there's still no nice `.dmg' package containing a `Liquid War 6.app' folder with its `info.plist' file. 3.8 Coding guidelines ===================== 3.8.1 Project goals reminder ---------------------------- One of the purposes of Liquid War 6 is to make a cleaner implementation of Liquid War than the previous one, namely Liquid War 5 (http://www.ufoot.org/liquidwar/v5). While the latter has achieved the practical goal of providing a playable implementation of the game, it failed at providing an evolutive platform. Network capabilities where finally added to Liquid War 5 (http://www.ufoot.org/liquidwar/v5), but anyone who played on Internet with someone a few hundreds of milliseconds away would agree that it's far from being perfect. The main reason for this is that it is really had to hack on Liquid War 5 (http://www.ufoot.org/liquidwar/v5), especially when you are not the core developper. The core developper himself, even knowing all the various hacks in the game, is very quickly lost when trying to implement major changes. To put it short, Liquid War 5 (http://www.ufoot.org/liquidwar/v5) is a global variable hell, a pile of hacks on top of a quick and dirty implementation. Still, it works. With Liquid War 6, the idea is to take the time to make something stable, something nice which will enable developpers to implement the cool features, and have fun along the way. Of course, this is only a dream, and in the (hopefully "very") long run, Liquid War 6 will also end up as a big unmaintainable mess, like any real-life program, until then, it should remain hackable. 3.8.2 Common sense ------------------ Here are a few guidelines which I think are common sense advice, but they are still worth mentionning: * try and respect the GNU coding standards (http://www.gnu.org/prep/standards/); * absolutely no `strcpy' or `sprintf' anywhere in the code. Nowhere. Use their equivalent `strncpy' and `snprintf' systematically, as they are part of the glibc and are an order of magnitude safer. Moreover, Liquid War 6 provides wrappers, such as `lw6sys_new_sprintf' which handles all the nasty dirty memory allocation stuff for you; * keep global variables for when there is something truely global, and even in that case try to fit them in clearly identified structures. 3.8.3 Unitary tests ------------------- Each of the internal libraries in Liquid War has a "test" program associated with it. For instance `liquidwar6sys-test' is associated to `libliquidwar6sys', and its purpose is to test the features of this library. While it is fairly easy to test out unitary functions which require no peculiar context, testing high-level functions which requires files, graphical and possibly network contexts to exist is obviously harder to achieve. There's no easy way to draw the line, but the idea is to put in these test executables as many features as possible, to be sure that what is tested in them is rock solid, bullet proof, and that one can safely rely on it and trust that code when running it in a more complex environnement. These test executables are also very good places to see a library API in action, find code fragments, and make experiments. 3.8.4 Memory allocation ----------------------- Liquid War 6 provides macros to allocate and free memory. One should use them systematically, except when trying to free something allocated by another library, and in very special cases, mostly concerning low-low level operations which are seldom hacked on. Usage of macros `LW6SYS_MALLOC', `LW6SYS_CALLOC' and `LW6SYS_FREE' is straightforward, read any random chunk of code, for instance `./src/lib/sys/sys-test.c' to see them in action. They are defined in `sys/sys.h'. Once used, these macros will track every single call to `malloc' and `free', and if there's a difference, it will report it. It will also help you by showing what's in the non-freed memory area, at which line of code it has been allocated, and when. This is very usefull to track down memory leaks. Of course a debugger could tell you some of these informations, but experience shows than when you encounter a memory bug, it's very often impossible to reproduce it. So you one wastes time trying to reproduce the bug, whereas with this tool you have the information reported just when the problem happens. 3.8.5 Private and public interfaces ----------------------------------- Each library exports a public interface and hides its internal. Since Liquid War 6 uses standard C and no C++, there's no real standard way to handle public/private features. The convention used in Liquid War 6 is to show internal structures as opaque pointers (`void *') whenever some function needs to operate on a structure which has possibly private fields. This way the caller function has no way to access the internals, and we are sure that no reference to any internal implementation specific feature will appear. Here's a code excerpt from `src/gfx/setup.c': void _lw6gfx_quit(_LW6GFX_CONTEXT *context) { /* * Implementation here. */ [...] } void lw6gfx_quit(void *context) { _lw6gfx_quit((_LW6GFX_CONTEXT *) context); } The function `_lw6gfx_quit' (note the "_") is internal, declared in `internal.h' whereas the function `lw6gfx_quit' is public, and is therefore exported in `gfx.h'. This way, functions in the program using `lw6gfx_quit' do not know what is in the `_LW6GFX_CONTEXT' structure, and they need not know it. This does not mean it is not possible to have public structures, only these structures must reflect some truely public, accessible and safe to access structures. 3.9 Using the console ===================== The console can be activated by passing `--display-console' when starting the game or by using the system options menu. When the console is activated, a `lw6>' prompt should appear in the terminal which launched the program. If you started Liquid War 6 by clicking on an icon, console probably won't work at all since `stdout' and `stdin' won't be attached to anything. The console allows you to type arbitray Scheme/Guile code. Try, for instance: (+ 1 2) (display "foo\n") You can really break things with this console, it gives you a direct access to all the program internals. At least, all the values which are accessible through the script interface, that is, many of them. You can call any internal C function which has been exported to Guile, here are some examples: (c-lw6sys-timestamp) (c-lw6bot-get-backends) (c-lw6sys-sleep 2.0) (lw6-config-get-number "zoom") (lw6-config-set-number! "zoom" 0.9) (lw6-config-get-number "zoom") While syntax (and possibly other) errors will be trapped by the interpreter, note that if you break things inside the game by, say, changing some global value, or in a general manner cause an error elsewhere in the code, the game will really raise a fatal error and stop. That's how you can "break things". Still, this console is a very powerfull tool, very usefull for debugging but also for tweaking the game without restarting it and/or navigating through the menu interface. 3.10 Advanced tweaking ====================== 3.10.1 Hacking ressources ------------------------- Liquid War 6 tries to have as few hardcoded data as possible. So many constants, and pretty much all the image files, are accessible in the data directory. You can know where it is by launching `liquidwar6 --show-data-dir'. If you look in this directory you'll find different files, among them XML files. Let's take an example. Try and find the file `gfx/gl/hud/floating/gl-floating-const.xml'. Edit the line with the `clock-y1' entry. Change the number after `"value"'. Re-run the program. Play a game. What happens? Logically you should see that "something" is not displayed at the same place than before. You could also modify the textures (JPEG and PNG files). In a general manner it's more cautious to keep them the same size but it depends, sometimes other sizes will work as well. Many of these parameters are really too technical and obscure to have their place in the main config file (which is already rather big). Use at your own risks, you can really break things touching this, but you can also find out lots of things can be tuned. 3.10.2 Optimize for speed ------------------------- Todo... 3.11 Writing modules ==================== Todo... 3.12 Use as a library ===================== Todo... 3.13 Network protocol ===================== This section describes how Liquid War 6 handles network messages. Note that for now this is purely theorical, more of a draft, a plan, it might change before being implemented. Bare technical stuff. Out of band messages: * UPTIME -> uptime in seconds * ROUND -> number of rounds (session related) * BPS -> number of net messages send per second * LIST -> list all known servers * PEERS -> list servers with active connections * VERSION -> version of the program * ID -> the id of this server * SESSION -> the id of the session * PING -> expects PONG * URL -> an alternate URL, possibly proxied * MAX -> max number of teams on this server/session * PLAYERS -> players playing * COLORS -> colors playing * LOCKED -> expects "YES" or "NO" * MOTD -> message of the day TCP messages: LW6 MSG1 MSG2 UDP messages: LW6 MSG1 LW6 MSG2 HTTP messages: /lw6///MSG1 /lw6///MSG2 HTTP public URLs: error 404 -> /lw6/ /lw6/ -> HTML human readbable page /favicon.ico /lw6/favicon.ico /lw6/screenshot.jpg /lw6/ MSG syntax: -- COMMAND COMMAND format: ... COMMAND examples: 2 1234abcd1234abcd REGISTER 3 1234abcd1234abcd ADD 5678 YELLOW 4 1234abcd1234abcd SET 5678 20 5 10 1234abcd1234abcd NOP 400 1234abcd1234abcd REMOVE 5678 1000 1234abcd1234abcd UNREGISTER 3.14 Using GNU Arch =================== 3.14.1 About GNU Arch --------------------- There is no CVS or SVN repository for Liquid War 6. Instead, a GNU Arch (http://www.gnu.org/software/gnu-arch/) repository is used to follow the different versions. Read the GNU Arch tutorial (http://www.gnu.org/software/gnu-arch/tutorial/arch.html) to learn how Arch works. Note that there are many other source control managers available, some of which provide functionnalities similar to GNU Arch / tla. GNU Arch has been chosen for Liquid War 6 because: * it is Free Software, * it is not limited to per-file commits like CVS, and supports atomic commits involving several files, * it is distributed, * it enables developpers to sign each of their contributions, * it was already available back in 2005. 3.14.2 Getting the latest version from the repository ----------------------------------------------------- The repository for Liquid War 6 is accessible on `http://arch.savannah.gnu.org/archives/liquidwar6'. This is a read-only access, but with the distributed nature of GNU Arch, it still allows you to keep track of your own changes, and submit patches. Accessing it in read/write mode with sftp requires a Savannah account and special rights on the Liquid War 6 project. Here are typicall commands one can use to get Liquid War 6 source from the GNU Arch repository: tla register-archive http://arch.savannah.gnu.org/archives/liquidwar6 tla get -A liquidwar6@sv.gnu.org liquidwar6--beta All the patches in the archive are signed with GnuPG (http://www.gnupg.org/), so you can check their authenticity with my public key (http://www.ufoot.org/ufoot.pub). You might need to edit your `$HOME/.arch-params/signing/=default.check' file and put the following text in it: tla-gpg-check gpg_command="gpg --verify-files -" 3.14.3 Setting up your own arch repository ------------------------------------------ This section is for those who want to hack the game and set up their own repositories. This will enable you to keep track of your patches, package them, and help the core maintainer merging them in the main repository. You can introduce yourself and create a repository by issuing commands like: You can introduce yourself and create a repository by issuing commands like: tla my-id me@home.net tla register-archive me@home.net--2008 /home/me/tla-archives Then, you can get create your own repository, with a command like: tla tag -S liquidwar6@sv.gnu.org/liquidwar6--beta--0.1 me@home.net--2008/liquidwar6--beta--0.4 The idea is that you create, locally, a depot which has a name that matches the name on savannah (http://arch.savannah.gnu.org) (this is for convenience, you could technically give it any name...) and indicate that they represent, today, the same thing. You can get a working copy of your depot with the command: tla get me@home.net--2008/liquidwar6--beta--0.4 This will create a complete source tree, which you are free to modify, this is where you should hack. 3.14.4 Synchronizing your repository with upstream releases ----------------------------------------------------------- To synchronize yourself with upstream developments, go into your copy (the directory created by `tla get') and type: tla star-merge liquidwar6@sv.gnu.org/liquidwar6--beta--0.1 This will apply locally all the changes that happened since the last synchronization. Of course this is one way to work, you can decide to cherry pick patches and such stuff, but for most dayly uses, a good'ol `star-merge' is fine. Not that `star-merge' will only apply patches on your working copy, not on your repository. The only way to actually commit the modifications on the repository is to use the `commit' command. 3.14.5 Submitting patches ------------------------- When using Arch, you can of course still send patches created with `diff', or even send updated files directly, the way you would without revision control. But it can be more convenient to either * Send the patches stored in the depot (`/home/me/tla-archives' in our example). * Make patches using `tla mkpatch'. Here's an example of an `mkpatch' command, and which will compute the differences between a previous `liquidwar6--beta--0.4--patch-2' snapshot and a not yet commited latest version: tla mkpatch {arch}/++pristine-trees/unlocked/liquidwar6/liquidwar6--beta/liquidwar6--beta--0.4/me@home.net--2006/liquidwar6--beta--0.4--patch-2 . my-patch This will create a `my-patch' directory, which can be gzipped and sent by mail. 3.14.6 Recover from broken lock ------------------------------- Sometimes, when signing a patch, you might enter the wrong passphrase several times, or you might press CTRL+D inadvertantly. In that case, tla will be in a half-broken state, telling you it can't acquire revision lock... A quick workarround for this is to go to the depot, find the latest patch, and in this repository, create the following folders: ++revision-lock/+contents Both are directories, note the two ++ and the single +. the `+contents' directory can be empty. Once you've done this, try to re-commit. 4 Reference *********** This chapter is a technical reference. Most of its content is self-generated by the program itself. That is to say, most if its content is already available to you if you have the game installed. Running `liquidwar6 --list' and `liquidwar6 --about=' is very likely to give you the very same informations, the advantage being that you'll be sure the information is up-to-date and corresponds to the exact version of the program you have. However, publishing this in a reader-friendly way is convenient, plus it enables web search engines to harvest the content. 4.1 Basic options ================= 4.1.1 about ----------- -- Command-line option: `--about=' Type: string. Will allow you to get informations about a given keyword. Let's say that, for instance, you want informations about the keyword 'map-path'. Simply run 'liquidwar6 -about=map-path'. Note that this internal self-documentation system can describe command line switches as well as XML config file parameters or environment variables, and even some Guile script functions. The '-list' command line switch will give you the list of all available keywords. 4.1.2 copyright --------------- -- Command-line option: `--copyright' Returns the copyright notice for the program. 4.1.3 debug ----------- -- Command-line option: `--debug' Enables debug mode. This will turn on maximum log information, and display everything on stderr, even messages which are normally only stored in the log file. 4.1.4 defaults -------------- -- Command-line option: `--defaults' Clears the config file and run the game with default settings. Use this if you suspect you have broken something by tweaking user settings, or when upgrading the game to a new version. 4.1.5 help ---------- -- Command-line option: `--help' Returns a short help for the program. 4.1.6 list ---------- -- Command-line option: `--list' Returns the list of all keywords which can be queried for information. This includes command-line options, environment variables, and so on. This is the companion option of '-about'. Results obtained with '-list' can be passed to '-about'. 4.1.7 test ---------- -- Command-line option: `--test' Runs a (hopefully) complete test suite which will call most internal Liquid War 6 functions and check out wether they work, in a simple context, without any game interference. Usefull for troubleshooting. 4.1.8 version ------------- -- Command-line option: `--version' Returns the version of the program, as defined by the GNU Coding Standards. 4.2 Doc options =============== 4.2.1 example-hints-xml ----------------------- -- Command-line option: `--example-hints-xml' Dumps on stdout an example hints.xml file. Such a file is normally shipped with the game. It is indeed generated using this command. 4.2.2 example-rules-xml ----------------------- -- Command-line option: `--example-rules-xml' Dumps on stdout an example options.xml file. Such a file is normally shipped with the game. It is indeed generated using this command. 4.2.3 example-style-xml ----------------------- -- Command-line option: `--example-style-xml' Dumps on stdout an example style.xml file. Such a file is normally shipped with the game. It is indeed generated using this command. 4.2.4 list-aliases ------------------ -- Command-line option: `--list-aliases' List the keyword aliases. These are here for convenience. 4.2.5 list-doc -------------- -- Command-line option: `--list-doc' List documentation-related command line options. These commands allow you to list all the keywords related to a given domain. 4.2.6 list-funcs ---------------- -- Command-line option: `--list-funcs' List the C-functions which are exported to Guile, thus usable in scripts. 4.2.7 list-graphics ------------------- -- Command-line option: `--list-graphics' List graphics options (resolution, fullscreen...). 4.2.8 list-hooks ---------------- -- Command-line option: `--list-hooks' List user-modifiable hooks. 4.2.9 list-input ---------------- -- Command-line option: `--list-input' List input (AKA controls) related options. Use these to change keyboard, joystick and mouse settingds. 4.2.10 list-map --------------- -- Command-line option: `--list-map' List map-related entries, excluding rules.xml, hints.xml and style.xml entries. 4.2.11 list-map-hints --------------------- -- Command-line option: `--list-map-hints' List 'hints.xml' entries. These parameters enable you to modify the behavior of the map loader. 4.2.12 list-map-rules --------------------- -- Command-line option: `--list-map-rules' List 'options.xml' entries. These parameters enable you to modify the gameplay. 4.2.13 list-map-style --------------------- -- Command-line option: `--list-map-style' List 'style.xml' entries. These parameters enable you to modify the aspect of the game. 4.2.14 list-network ------------------- -- Command-line option: `--list-network' List network options. 4.2.15 list-path ---------------- -- Command-line option: `--list-path' List parameters which allow you to override the defaults of the game, and force the game your own file paths and directories. 4.2.16 list-players ------------------- -- Command-line option: `--list-players' List player-related entries, that is to say 'who plays'. 4.2.17 list-quick ----------------- -- Command-line option: `--list-quick' List quick help entries, this includes the GNU standard options and a few troubleshooting tools. 4.2.18 list-show ---------------- -- Command-line option: `--list-show' List command-line options which begin with '-show-...'. These will display on the console many internal parameters. Usefull when debugging. 4.2.19 list-sound ----------------- -- Command-line option: `--list-sound' List sound options (volume...). 4.2.20 list-tuning ------------------ -- Command-line option: `--list-tuning' List advanced options which can be used for fine-tuning the game. 4.3 Show options ================ 4.3.1 show-build-cflags ----------------------- -- Command-line option: `--show-build-cflags' Shows what value you should put in 'CFLAGS' (environment variable) if you want to compile programs that use Liquid War 6 as a library, and include 'liquidwar6.h'. 4.3.2 show-build-codename ------------------------- -- Command-line option: `--show-build-codename' Shows the codename associated with this version, generally the name of someone famous who is war-related (a general, an emperor...). 4.3.3 show-build-configure-args ------------------------------- -- Command-line option: `--show-build-configure-args' Shows the arguments that have been passed to the GNU Autoconf './configure' script when building the program. This can be very usefull if you want to know how the program has been built. 4.3.4 show-build-copyright -------------------------- -- Command-line option: `--show-build-copyright' Shows a very short copyright notice. 4.3.5 show-build-datadir ------------------------ -- Command-line option: `--show-build-datadir' Shows the 'datadir' value as passed to the GNU Autoconf './configure' script when compiling the program. Default is '/usr/local/share'. This is the generic, non Liquid War 6 specific data directory. Liquid War 6 related data is stored elsewhere (usually in a sub-directory) see the 'data-dir' switch for more information. 'datadir' is not 'data-dir'. That's the point. 4.3.6 show-build-date --------------------- -- Command-line option: `--show-build-date' Shows the date when the binary was compiled. 4.3.7 show-build-docdir ----------------------- -- Command-line option: `--show-build-docdir' Shows the 'docdir' value as passed to the GNU Autoconf './configure' script when compiling the program. Default is '/usr/local/share/doc/liquidwar6'. 4.3.8 show-build-enable-allinone -------------------------------- -- Command-line option: `--show-build-enable-allinone' Shows wether the 'allinone' option has been chosen when building the game. This depends on parameters passed to './configure'. 4.3.9 show-build-enable-console ------------------------------- -- Command-line option: `--show-build-enable-console' Shows wether the console has been enabled when building the game. This depends on parameters passed to './configure' and also on the presence of ncurses and readline. 4.3.10 show-build-enable-fullstatic ----------------------------------- -- Command-line option: `--show-build-enable-fullstatic' Shows wether the 'fullstatic' option has been chosen when building the game. This depends on parameters passed to './configure'. 4.3.11 show-build-enable-gcov ----------------------------- -- Command-line option: `--show-build-enable-gcov' Shows wether the game was build with suitable informations for gcov. This depends on parameters passed to './configure'. 4.3.12 show-build-enable-gprof ------------------------------ -- Command-line option: `--show-build-enable-gprof' Shows wether the game was build with suitable informations for gprof. This depends on parameters passed to './configure'. 4.3.13 show-build-enable-instrument ----------------------------------- -- Command-line option: `--show-build-enable-instrument' Shows wether the game was build with the '-finstrument-functions' GCC switch. This depends on parameters passed to './configure'. 4.3.14 show-build-enable-mod-csound ----------------------------------- -- Command-line option: `--show-build-enable-mod-csound' Shows wether the mod-csound audio backend has been enabled when building the game. This depends on parameters passed to './configure' and also on the presence of the csound library. 4.3.15 show-build-enable-mod-gl ------------------------------- -- Command-line option: `--show-build-enable-mod-gl' Shows wether the mod-gl graphical backend has been enabled when building the game. This depends on parameters passed to './configure' and also on the presence of SDL and related libraries. 4.3.16 show-build-enable-mod-http --------------------------------- -- Command-line option: `--show-build-enable-mod-http' Shows wether the mod-http network backend has been enabled when building the game. This depends on parameters passed to './configure' and also on the presence of libCurl. 4.3.17 show-build-enable-mod-ogg -------------------------------- -- Command-line option: `--show-build-enable-mod-ogg' Shows wether the mod-ogg audio backend has been enabled when building the game. This depends on parameters passed to './configure' and also on the presence of SDL and related libraries. 4.3.18 show-build-enable-optimize --------------------------------- -- Command-line option: `--show-build-enable-optimize' Shows wether the 'optimize' option has been chosen when building the game. This depends on parameters passed to './configure'. 4.3.19 show-build-enable-paranoid --------------------------------- -- Command-line option: `--show-build-enable-paranoid' Shows wether the game was build with paranoid memory management. This is for debugging purposes, the default already includes some controls, with turned it's really... paranoid. 4.3.20 show-build-enable-profiler --------------------------------- -- Command-line option: `--show-build-enable-profiler' Shows wether the game was build with Google Profiler support. This depends on parameters passed to './configure'. 4.3.21 show-build-enable-valgrind --------------------------------- -- Command-line option: `--show-build-enable-valgrind' Shows wether the game was build with valgrind later use in mind. This depends on parameters passed to './configure'. 4.3.22 show-build-endianness ---------------------------- -- Command-line option: `--show-build-endianness' Returns the endianness. 'little' corresponds to x86-like systems, 'big' to ppc-like systems. 4.3.23 show-build-gcc-version ----------------------------- -- Command-line option: `--show-build-gcc-version' Returns the version of the GNU C compiler which was used to compile the program. 4.3.24 show-build-hostname -------------------------- -- Command-line option: `--show-build-hostname' Shows the name of the host where the binary was compiled. 4.3.25 show-build-includedir ---------------------------- -- Command-line option: `--show-build-includedir' Shows the 'includedir' value as passed to the GNU Autoconf './configure' script when compiling the program. Default is '/usr/local/include'. 4.3.26 show-build-ldflags ------------------------- -- Command-line option: `--show-build-ldflags' Shows what value you should put in 'LDFLAGS' (environment variable) if you want to link programs against libliquidwar6. 4.3.27 show-build-libdir ------------------------ -- Command-line option: `--show-build-libdir' Shows the 'libdir' value as passed to the GNU Autoconf './configure' script when compiling the program. Default is '/usr/local/lib'. This is the generic, non Liquid War 6 specific library directory. Dedicated Liquid War 6 modules are stored elsewhere (usually in a sub-directory) see the 'mod-dir' switch for more information. 4.3.28 show-build-license ------------------------- -- Command-line option: `--show-build-license' Shows the license of the program (GNU GPL v3 or later). 4.3.29 show-build-localedir --------------------------- -- Command-line option: `--show-build-localedir' Shows the 'localedir' value as passed to the GNU Autoconf './configure' script when compiling the program. Default is '/usr/local/share/locale'. 4.3.30 show-build-mac-os-x -------------------------- -- Command-line option: `--show-build-mac-os-x' Returns 1 (true) if target OS is Mac OS X, 0 (false) if not. 4.3.31 show-build-md5sum ------------------------ -- Command-line option: `--show-build-md5sum' Shows the MD5 checksum, which has been calculated from the C source files. Complementary with 'show-build-stamp'. 4.3.32 show-build-ms-windows ---------------------------- -- Command-line option: `--show-build-ms-windows' Returns 1 (true) if target OS is Microsoft Windows 32-bit platform, 0 (false) if not. 4.3.33 show-build-package-name ------------------------------ -- Command-line option: `--show-build-package-name' Shows the package name, that is, 'Liquid War 6'. 4.3.34 show-build-package-string -------------------------------- -- Command-line option: `--show-build-package-string' Shows the package string, that is, 'Liquid War 6 4.3.35 show-build-package-tarname --------------------------------- -- Command-line option: `--show-build-package-tarname' Shows the package tarname, that is, liquidwar6. 4.3.36 show-build-pointer-size ------------------------------ -- Command-line option: `--show-build-pointer-size' Returns the pointer size, in bytes. Should be 4 on 32-bit systems and 8 on 64-bit systems. 4.3.37 show-build-prefix ------------------------ -- Command-line option: `--show-build-prefix' Shows the 'prefix' value as passed to the GNU Autoconf './configure' script when compiling the program. Default is '/usr/local'. 4.3.38 show-build-stamp ----------------------- -- Command-line option: `--show-build-stamp' Shows the build stamp. A very usefull value, more precise than the version to track down binaries. It is incremented each time the core C code is updated. It won't reflect all the programs for it does not take scripts in account, but if you are running a work-in-progress version, it might be very convenient to use this to know what your are running exactly. 4.3.39 show-build-target-cpu ---------------------------- -- Command-line option: `--show-build-target-cpu' Shows the target CPU, as defined by 'target_cpu' in GNU Autoconf. 4.3.40 show-build-target-os --------------------------- -- Command-line option: `--show-build-target-os' Shows the target OS, as defined by 'target_os' in GNU Autoconf. 4.3.41 show-build-time ---------------------- -- Command-line option: `--show-build-time' Shows the time when the binary was compiled. 4.3.42 show-build-top-srcdir ---------------------------- -- Command-line option: `--show-build-top-srcdir' Shows the top source directory on the machine where the binary was compiled. 4.3.43 show-build-version ------------------------- -- Command-line option: `--show-build-version' Shows the version. Note that this is different from the standard GNU 'version' command line option which shows a complete message with a short copyright notice. This one will just return the version, without the package tarname or anything else. 4.3.44 show-build-x86 --------------------- -- Command-line option: `--show-build-x86' Tells wether the CPU belongs to x86 family. 4.3.45 show-config-file ----------------------- -- Command-line option: `--show-config-file' Shows the config file path. Default is '$HOME/.liquidwar6/config.xml'. 4.3.46 show-cwd --------------- -- Command-line option: `--show-cwd' Shows the current working directory, the value that the pwd command would return. 4.3.47 show-data-dir -------------------- -- Command-line option: `--show-data-dir' Shows the data directory path. This is where the games searches for most of its data,the most important exception being maps, which are stored elsewhere. Default is '/usr/local/share/liquidwar6-/data'. 4.3.48 show-default-config-file ------------------------------- -- Command-line option: `--show-default-config-file' Shows the default config file path. Default is '$HOME/.liquidwar6/config.xml'. 4.3.49 show-default-data-dir ---------------------------- -- Command-line option: `--show-default-data-dir' Shows the default data directory path. This is where the games searches for most of its data,the most important exception being maps, which are stored elsewhere. Default is '/usr/local/share/liquidwar6-/data'. 4.3.50 show-default-log-file ---------------------------- -- Command-line option: `--show-default-log-file' Shows the default log file path. Default is '$HOME/.liquidwar6/log.csv'. 4.3.51 show-default-map-dir --------------------------- -- Command-line option: `--show-default-map-dir' Shows the default map directory. This is where builtin maps are stored. Default is '/usr/local/share/liquidwar6-/map'. 4.3.52 show-default-map-path ---------------------------- -- Command-line option: `--show-default-map-path' Shows the default map search path. This is where the game searches for maps. It's the combination of command-line arguments and builtin paths. Might return more directories than the one specified in a single 'map-path=dir1:dir2' argument. 4.3.53 show-default-mod-dir --------------------------- -- Command-line option: `--show-default-mod-dir' Shows the default module directory path. This is where all dynamically loaded modules are stored. Default is '/usr/local/lib/liquidwar6-'. 4.3.54 show-default-prefix -------------------------- -- Command-line option: `--show-default-prefix' Shows the default prefix used. This should logically be the value passed to the GNU Autoconf ./configure script when building the game. Most other path are deduced from this one. Default is '/usr/local'. 4.3.55 show-default-script-file ------------------------------- -- Command-line option: `--show-default-script-file' Shows the default main script file path. This file is very important, since the program is more or less a hudge scheme interpreter, and this file is the file loaded by Guile. In short, it is the main program. Default is '/usr/local/share/liquidwar6-/script/liquidwar6.scm'. 4.3.56 show-default-user-dir ---------------------------- -- Command-line option: `--show-default-user-dir' Shows the default user directory path. This is where run-time data, config files, log files, are stored. Default is '$HOME/.liquidwar6/'. 4.3.57 show-log-file -------------------- -- Command-line option: `--show-log-file' Shows the log file path. Default is '$HOME/.liquidwar6/log.csv'. 4.3.58 show-map-dir ------------------- -- Command-line option: `--show-map-dir' Shows the map directory. This is where builtin maps are stored. Default is '/usr/local/share/liquidwar6-/map'. 4.3.59 show-map-path -------------------- -- Command-line option: `--show-map-path' Shows the map search path. This is where the game searches for maps. It's the combination of command-line arguments and builtin paths. Might return more directories than the one specified in a single 'map-path=dir1:dir2' argument. 4.3.60 show-mod-dir ------------------- -- Command-line option: `--show-mod-dir' Shows the module directory path. This is where all dynamically loaded modules are stored. Default is '/usr/local/lib/liquidwar6-'. 4.3.61 show-prefix ------------------ -- Command-line option: `--show-prefix' Shows the prefix used. This should logically be the value passed to the GNU Autoconf ./configure script when building the game. Most other path are deduced from this one. Default is '/usr/local'. 4.3.62 show-run-dir ------------------- -- Command-line option: `--show-run-dir' Shows the run directory, usually the path where the binary is. It depends on how and where the program is launched. It is guessed from the argc/argv values at runtime. 4.3.63 show-script-file ----------------------- -- Command-line option: `--show-script-file' Shows the main script file path. This file is very important, since the program is more or less a hudge scheme interpreter, and this file is the file loaded by Guile. In short, it is the main program. Default is '/usr/local/share/liquidwar6-/script/liquidwar6.scm'. 4.3.64 show-user-dir -------------------- -- Command-line option: `--show-user-dir' Shows the user directory path. This is where run-time data, config files, log files, are stored. Default is '$HOME/.liquidwar6/'. 4.4 Path options ================ 4.4.1 config-file ----------------- -- Command-line option: `--config-file' -- Environment variable: `LW6_CONFIG_FILE' Type: string. Default value: $HOME/.liquidwar6/config.xml. Set the config file path. This enables you to use whatever config file you like, keeping all other informations in the same place. 4.4.2 data-dir -------------- -- Command-line option: `--data-dir' -- Environment variable: `LW6_DATA_DIR' Type: string. Default value: /usr/local/share/liquidwar6-/data. Set the data directory. By changing ths value you'll be able to use an alternative data directory. 4.4.3 log-file -------------- -- Command-line option: `--log-file=' -- Environment variable: `LW6_LOG_FILE' -- XML key: `log-file' Type: string. Default value: $HOME/.liquidwar6/log.csv. Set the log file path. This enables you to use whatever log file you like, keeping all other informations in the same place. 4.4.4 map-dir ------------- -- Command-line option: `--map-dir' -- Environment variable: `LW6_MAP_DIR' Type: string. Default value: /usr/local/share/liquidwar6-/map. Set the map directory path. By changing this value you'll be able to play with your own maps in your own directory. Note that there are other ways to achieve that, but using this option will work. However, a side effect is that you might not see builtin maps anymore. 4.4.5 map-path -------------- -- Command-line option: `--map-path=' -- Environment variable: `LW6_MAP_PATH' -- XML key: `map-path' Type: string. Default value: $HOME/.liquidwar6/map:/usr/local/share/liquidwar6-/map. Set the map search path. By changing this value you'll be able to play with your own maps in your own directory. This is different from 'map-dir', since it includes 'map-dir', plus it adds a number of other search paths. Unlike most other parameters, the values given from the command-line, from the environment variables, or from the config file, are not overwritten, but appended. That is to say if you specify a 'map-path' with the command-line argument 'map-path=path', but also define the 'LW6_MAP_PATH' value and finally edit 'config.xml' to change the 'map-path' entry in it, you'll end up with the game searching for maps in all these directories. Additionnally, 'map-dir' and '/map' will always be in the list. Any given value can itself include several pathes, separated by the path separator. This separator is ':' on GNU/Linux, and ';' on Microsoft Windows. For instance, on a GNU/Linux box, you could use the command-line argument 'map-path=/foo/bar/map:/home/user/map/:/map'. 4.4.6 mod-dir ------------- -- Command-line option: `--mod-dir' -- Environment variable: `LW6_MOD_DIR' Type: string. Default value: /usr/local/lib/liquidwar6-. Set the module directory path. By changing this you will load dynamic shared libraries (game specific modules such as the graphical backend) from an alternative place. Use this at your own risks, for there can always be a binary incompatibility. You've been warned. 4.4.7 prefix ------------ -- Command-line option: `--prefix' -- Environment variable: `LW6_PREFIX' Type: string. Default value: /usr/local. Override the prefix value given to the GNU Autoconf ./configure script when building the game. Not all path will be changed, some of them might remain the same, for instance message translations (localedir). But most game-specific data including maps, graphics, sounds, will be searched according to the new given parameter. 4.4.8 script-file ----------------- -- Command-line option: `--script-file' -- Environment variable: `LW6_SCRIPT_FILE' Type: string. Default value: /usr/local/share/liquidwar6-/script/liquidwar6.scm. Set the main script file path. This file is very important, since the program is more or less a hudge scheme interpreter, and this file is the file loaded by Guile. In short, it is the main program. 4.4.9 user-dir -------------- -- Command-line option: `--user-dir=' -- Environment variable: `LW6_USER_DIR' -- XML key: `user-dir' Type: string. Default value: $HOME/.liquidwar6. Set the user directory path. This is where run-time data, config files, log files, are stored. If you override this value, other parameters such as where the config and log files reside, will change. 4.5 Graphics options ==================== 4.5.1 fullscreen ---------------- -- Command-line option: `--fullscreen=' -- Environment variable: `LW6_FULLSCREEN' -- XML key: `fullscreen' Type: boolean. Default value: false. Force the game to fun fullscreen. Note that the graphics backend might ignore this hint. 4.5.2 gfx-backend ----------------- -- Command-line option: `--gfx-backend=' -- Environment variable: `LW6_GFX_BACKEND' -- XML key: `gfx-backend' Type: string. Default value: gl. Sets the graphics backend AKA 'gfx' to use. For now the only choice is 'gl' and will use an OpenGL/SDL 3D-accelerated driver. 4.5.3 height ------------ -- Command-line option: `--height=' -- Environment variable: `LW6_HEIGHT' -- XML key: `height' Type: integer. Default value: -1. Run the game with the given screen height.Note that the graphics backend might ignore this hint. Use with its companion option 'width'. A negative value will force the use of a default value. 4.5.4 width ----------- -- Command-line option: `--width=' -- Environment variable: `LW6_WIDTH' -- XML key: `width' Type: integer. Default value: -1. Run the game with the given screen width. Note that the graphics backend might ignore this hint. Use with its companion option 'height'.A negative value will force the use of a default value. 4.5.5 windowed-mode-limit ------------------------- -- Command-line option: `--windowed-mode-limit=' -- Environment variable: `LW6_WINDOWED_MODE_LIMIT' -- XML key: `windowed-mode-limit' Type: float. Default value: 0.95. When switching back from fullscreen mode to windowed mode, if we're in maximum resolution, then this coefficient will be applied before resizing the window. The idea is that (obviously) a windowed mode is prefered when a little smaller that totally fullscreen. So set this to a value just below 1.0. 4.6 Sound options ================= 4.6.1 music-volume ------------------ -- Command-line option: `--music-volume=' -- Environment variable: `LW6_MUSIC_VOLUME' -- XML key: `music-volume' Type: float. Default value: 0.6. Min value: 0. Max value: 1. Set the music volume.This is a floating point value. 0 is mute. Maximum value is 1. 4.6.2 snd-backend ----------------- -- Command-line option: `--snd-backend=' -- Environment variable: `LW6_SND_BACKEND' -- XML key: `snd-backend' Type: string. Default value: ogg. Sets the sound backend AKA 'snd' to use. Can be 'ogg' or 'csound' but only 'ogg' will produce sound in the current release. 4.6.3 sound-volume ------------------ -- Command-line option: `--sound-volume=' -- Environment variable: `LW6_SOUND_VOLUME' -- XML key: `sound-volume' Type: float. Default value: 0.3. Min value: 0. Max value: 1. Set the sound volume.This is a floating point value. 0 is mute. Maximum value is 1. 4.7 Network options =================== 4.8 Map parameters ================== 4.8.1 chosen-map ---------------- -- Command-line option: `--chosen-map=' -- Environment variable: `LW6_CHOSEN_MAP' -- XML key: `chosen-map' Type: string. Default value: strange-new-world. The last map chosen by the player, locally. This is the map which will be used for a quick-start game, a local game, or a game started as a server. 4.8.2 force ----------- -- Command-line option: `--force=' -- Environment variable: `LW6_FORCE' -- XML key: `force' Type: string. Default value: respawn-team,color-conflict-mode. A comma separated list of options which should be ignored when reading map XML files. For instance, if this contains 'rounds-per-sec,moves-per-round' then whatever values were defined for this in 'rules.xml', then game will ignore them and use the user's values, stored in 'config.xml', running the game at the requested speed. This ultimately allows the player to control everything despite the values set by the map designer. 4.8.3 use-hints-xml ------------------- -- Command-line option: `--use-hints-xml=' -- Environment variable: `LW6_USE_HINTS_XML' -- XML key: `use-hints-xml' Type: boolean. Default value: true. If set, then hints will be picked up from the map defined hints.xml, if it exists. This is the default. 4.8.4 use-rules-xml ------------------- -- Command-line option: `--use-rules-xml=' -- Environment variable: `LW6_USE_RULES_XML' -- XML key: `use-rules-xml' Type: boolean. Default value: true. If set, then rules will be picked up from the map defined rules.xml, if it exists. This is the default. Use force-time and force-size to override this and use user-defined values anyway. 4.8.5 use-style-xml ------------------- -- Command-line option: `--use-style-xml=' -- Environment variable: `LW6_USE_STYLE_XML' -- XML key: `use-style-xml' Type: boolean. Default value: true. If set, then style will be picked up from the map defined style.xml, if it exists. This is the default. Use force-time and force-background to override this and use user-defined values anyway. 4.8.6 use-texture ----------------- -- Command-line option: `--use-texture=' -- Environment variable: `LW6_USE_TEXTURE' -- XML key: `use-texture' Type: boolean. Default value: true. Defines wether the map texture should be used. Of course if there's no map texture, the texture... won't be used. But if there is one, this parameter will force the game to ignore it and play with solid colors. This probably won't look as nice as the textured map in most cases, but some players might find it more readable and confortable to play when throwing eye candy away. 4.9 Map rules.xml ================= 4.9.1 color-conflict-mode ------------------------- -- Command-line option: `--color-conflict-mode=' -- Environment variable: `LW6_COLOR_CONFLICT_MODE' -- XML key: `color-conflict-mode' Type: integer. Default value: 1. Min value: 0. Max value: 2. How to handle color conflicts, that is, when a player requests a color, but this color is already used, what should be done? If 0, wether a color already exists won't affect the color of a new cursor. If 1, then two players on the same computer will be allowed to share the same color/team, but if another computer is already playing with a color, any new computer will need to use another team. If 2, then it's impossible for a new cursor to use a pre-existing color, any new cursor will require a new color, if that color is already used, a new color will be picked randomly. 4.9.2 cursor-pot-init --------------------- -- Command-line option: `--cursor-pot-init=' -- Environment variable: `LW6_CURSOR_POT_INIT' -- XML key: `cursor-pot-init' Type: integer. Default value: 100000. Min value: 5000. Max value: 500000. Defines the cursor potential at startup. Not really any reason to change it. Theorically, there could be maps where the default value doesn't fit, but none has been seen yet. 4.9.3 fighter-attack -------------------- -- Command-line option: `--fighter-attack=' -- Environment variable: `LW6_FIGHTER_ATTACK' -- XML key: `fighter-attack' Type: integer. Default value: 500. Min value: 1. Max value: 10000. Defines how hard fighters will attack others, that is, in one attack, how many life-points the attacked fighter will loose. Increasing this will cause your opponents to melt faster when you attack them. With a low value, it will take ages to take on your opponents. Different styles of game. Can radically change the gameplay. 4.9.4 fighter-defense --------------------- -- Command-line option: `--fighter-defense=' -- Environment variable: `LW6_FIGHTER_DEFENSE' -- XML key: `fighter-defense' Type: integer. Default value: 50. Min value: 0. Max value: 10000. Defines how fast fighters will regenerate after an attack. When this parameter is set low, an attacked fighter, which is very dark and almost dead will take a very long time to regain energy. If the parameter is set high, it can almost instantaneously regain energy. 4.9.5 fighter-new-health ------------------------ -- Command-line option: `--fighter-new-health=' -- Environment variable: `LW6_FIGHTER_NEW_HEALTH' -- XML key: `fighter-new-health' Type: integer. Default value: 5000. Min value: 1. Max value: 10000. Defines how healthy fighters will be when they appear on the map. This can be either at the beginning of the game of when a fighter changes team. Setting this low will allow battefields to switch from one side to another very fast, for freshly gained fighters will be feeble and very likely to return to their original camp. To calibrate this parameter, keep in mind that the absolute maximum health a fighter can have is always 10000 (ten-thousands). 4.9.6 fighter-regenerate ------------------------ -- Command-line option: `--fighter-regenerate=' -- Environment variable: `LW6_FIGHTER_REGENERATE' -- XML key: `fighter-regenerate' Type: integer. Default value: 5. Min value: 0. Max value: 10000. Defines at which speed fighters will self-regenerate, without even begin packed together. This will allow lone fighters to regenerate a bit by hiding somewhere in the map. This is typically a low value, might even be 0. 4.9.7 max-cursor-pot -------------------- -- Command-line option: `--max-cursor-pot=' -- Environment variable: `LW6_MAX_CURSOR_POT' -- XML key: `max-cursor-pot' Type: integer. Default value: 1000000. Min value: 50000. Max value: 5000000. Defines the maximum cursor potential. Not really any reason to change it. Any high value should produce the same results. Low values might reveal algorithm bugs and inconsistencies. 4.9.8 max-cursor-pot-offset --------------------------- -- Command-line option: `--max-cursor-pot-offset=' -- Environment variable: `LW6_MAX_CURSOR_POT_OFFSET' -- XML key: `max-cursor-pot-offset' Type: integer. Default value: 100. Min value: 1. Max value: 10000. Defines the maximum cursor potential offset. The idea is that in some cases, the potential of a cursor can increase in burst mode, for instance to make this cursor more important than others, so that fighters rally to it, neglecting other cursors (talking about a multi-cursor controlled team). This parameter is here to limit this burst effect and avoid bugs. 4.9.9 max-nb-cursors -------------------- -- Command-line option: `--max-nb-cursors=' -- Environment variable: `LW6_MAX_NB_CURSORS' -- XML key: `max-nb-cursors' Type: integer. Default value: 26. Min value: 2. Max value: 26. Defines the maximum number of cursors who can enter the game. Really makes sense in network games. Default value is 26, the maximum. 4.9.10 max-nb-servers --------------------- -- Command-line option: `--max-nb-servers=' -- Environment variable: `LW6_MAX_NB_SERVERS' -- XML key: `max-nb-servers' Type: integer. Default value: 10. Min value: 2. Max value: 26. Defines the maximum number of servers who can enter the game. Really makes sense in network games. Default value is 10, and should fit in most cases. Can be raised up to 26. 4.9.11 max-nb-teams ------------------- -- Command-line option: `--max-nb-teams=' -- Environment variable: `LW6_MAX_NB_TEAMS' -- XML key: `max-nb-teams' Type: integer. Default value: 10. Min value: 2. Max value: 10. Defines the maximum number of teams who can enter the game. Really makes sense in network games. Default value is 10, the maximum. 4.9.12 max-round-delta ---------------------- -- Command-line option: `--max-round-delta=' -- Environment variable: `LW6_MAX_ROUND_DELTA' -- XML key: `max-round-delta' Type: integer. Default value: 1000. Min value: 1. Max value: 10000. This is the companion value of 'round-delta'. Will put an absolute limit to the delta, which (what did you think?) is of course incremented in some cases by the core algorithm. If in doubt, don't touch. 4.9.13 max-zone-size -------------------- -- Command-line option: `--max-zone-size=' -- Environment variable: `LW6_MAX_ZONE_SIZE' -- XML key: `max-zone-size' Type: integer. Default value: 8. Min value: 1. Max value: 64. Defines the maximum zone size, which is an internal and rather technical parameter. The idea is that to optimize things, Liquid War 6 divides the battlefield in squares, where it can, and tries to make these squares as big as possible, the idea being that everywhere in this square, fighters follow the same intructions. Just a technical optimization. The problem is that setting it too high will reveal the optimization and its tradeoffs to the player, who will see the fighter behave strangely, following invisible paths. Plus, it's ugly. Depending on your tastes (speed, look'n'feel) you'll prefer something nice or something fast. Note that anyways passed a certain value, this does not optimize anything anymore. In doubt, don't touch it. 4.9.14 moves-per-round ---------------------- -- Command-line option: `--moves-per-round=' -- Environment variable: `LW6_MOVES_PER_ROUND' -- XML key: `moves-per-round' Type: integer. Default value: 2. Min value: 1. Max value: 10. Defines how many times fighters move per round. Increasing this will just make fighters move faster, but won't change anything for the rest, that is keyboard and mouse responsivity, and network traffic will stay the same. Multiplying the number of moves per round by the number of rounds per second will give the number of moves per second, which is, in fact, how fast fighters move on the screen. 4.9.15 nb-attack-tries ---------------------- -- Command-line option: `--nb-attack-tries=' -- Environment variable: `LW6_NB_ATTACK_TRIES' -- XML key: `nb-attack-tries' Type: integer. Default value: 3. Min value: 1. Max value: 7. Defines how many tries a fighter will do before giving-up attacking and choosing another behvior (defense). By tries we mean: how many directions it will try. Going North? Going North-West? Setting this to a low value will make fighters somewhat less aggressive. This idea is that they'll prefer to switch to the next option, that is, defense/regeneration, if there's no opponent right in front of them. 4.9.16 nb-defense-tries ----------------------- -- Command-line option: `--nb-defense-tries=' -- Environment variable: `LW6_NB_DEFENSE_TRIES' -- XML key: `nb-defense-tries' Type: integer. Default value: 1. Min value: 1. Max value: 7. Defines how many tries a fighter will do before giving-up attacking and choosing another behavior (do nothing). By tries we mean: how many directions it will try. Going North? Going North-West? Setting this to a low value, you'll need a very compact pack of fighters for regeneration to operate, else fighters will hang arround unhealthy. 4.9.17 nb-move-tries -------------------- -- Command-line option: `--nb-move-tries=' -- Environment variable: `LW6_NB_MOVE_TRIES' -- XML key: `nb-move-tries' Type: integer. Default value: 5. Min value: 3. Max value: 7. Defines how many tries a fighter will do before giving-up moving and choosing another behvior (attack or defense). By tries we mean: how many directions it will try. Going North? Going North-West? Setting this to a low value, your fighters will look very stubborn and always try to move in one direction, neglecting the fact that they could dodge. This can lead to queues of fighters and other strange behaviors. On the other hand, setting it too high will cause fighter to always avoid the enemy, and groups of fighters will just pass each other without any fight. Matter of taste. 4.9.18 respawn-team ------------------- -- Command-line option: `--respawn-team=' -- Environment variable: `LW6_RESPAWN_TEAM' -- XML key: `respawn-team' Type: integer. Default value: 1. Min value: 0. Max value: 1. Defines what to do when a team dies. If set to 0, team disappears forever, if set to 1, team reappears automatically with fresh fighters. It's a deathmatch mode, where the winner is not the one who stays alive the longest time, since it makes no real sens in this case, but the one who has died less often than others. 4.9.19 round-delta ------------------ -- Command-line option: `--round-delta=' -- Environment variable: `LW6_ROUND_DELTA' -- XML key: `round-delta' Type: integer. Default value: 1. Min value: 0. Max value: 100. Conditions by how much the cursor potential will be incremented each time gradient is spreaded. Sounds cryptic? It is. The idea is that at each time you move your cursor of 1 pixel, theorically, you'll need in the worst case to move of 1 more pixel to reach any point on the map. Of course this is not true but this is the default asumption, and gradient spread will fix that. Only in Liquid War 6 this is not even the worst case, for you can control your cursor with the mouse and cross walls. Whenever you cross a wall, you might have done a great distance from the fighters' point of view, if the map is a maze. Thus this parameter, which corrects things, experience shows it does give acceptable results to increase the cursor potential by more than one at each turn. Toy arround with this if you find fighters take wrong paths on some given map. If in doubt, don't touch. 4.9.20 rounds-per-sec --------------------- -- Command-line option: `--rounds-per-sec=' -- Environment variable: `LW6_ROUNDS_PER_SEC' -- XML key: `rounds-per-sec' Type: integer. Default value: 50. Min value: 1. Max value: 100. Defines the overall speed of the game. All other settings being equal, raising this value will cause the game to behave faster. Everything will be faster, except probably the display since your computer will calculate more game positions in a given time and spend more CPU time. It will also increase network traffic. Values between 10 and 50 really make sense. 4.9.21 side-attack-factor ------------------------- -- Command-line option: `--side-attack-factor=' -- Environment variable: `LW6_SIDE_ATTACK_FACTOR' -- XML key: `side-attack-factor' Type: integer. Default value: 20. Min value: 0. Max value: 100. Defines how hard fighters will attack sideways. It's an algorithm trick, fighters attack by default the opponent right in front, but if there's no fighter there, they will still try to attack someone else, maybe sideways. But doing this their attack is not as strong. This parameter enables you to tune this. This is a percentage. 4.9.22 side-defense-factor -------------------------- -- Command-line option: `--side-defense-factor=' -- Environment variable: `LW6_SIDE_DEFENSE_FACTOR' -- XML key: `side-defense-factor' Type: integer. Default value: 20. Min value: 0. Max value: 100. Defines how fast fighters will regenerate, when being side by side instead of being right in front of the other. This is a percentage. 4.9.23 single-army-size ----------------------- -- Command-line option: `--single-army-size=' -- Environment variable: `LW6_SINGLE_ARMY_SIZE' -- XML key: `single-army-size' Type: integer. Default value: 30. Min value: 1. Max value: 95. Defines the proportion of the whole available space, which will be occupied by an army at the beginning of the game. You can either imagine playing with almost empty maps, or play very crowded with almost no space left. This is a percentage, but will be multiplied by itself to get the actual surface. That is, 50 means 50%*50%, that is, a square of 1/2 the size of a square map, so it represents 25% (1/4) of the total surface. 4.9.24 spread-thread -------------------- -- Command-line option: `--spread-thread=' -- Environment variable: `LW6_SPREAD_THREAD' -- XML key: `spread-thread' Type: integer. Default value: 0. Min value: 0. Max value: 1. If set to 1, the core algorithm with fire a separate thread to spread the gradient. By default this is turned off (set to 0). Consider this as an experimental feature, the program is already rather heavily threaded, turning this on will probably not offer any significant performance gain, even on SMP systems. This might change in the future. 4.9.25 spreads-per-round ------------------------ -- Command-line option: `--spreads-per-round=' -- Environment variable: `LW6_SPREADS_PER_ROUND' -- XML key: `spreads-per-round' Type: integer. Default value: 3. Min value: 1. Max value: 12. Defines how many times the gradient is spread per round. Gradient spread is a very Liquid War 6 specific feature, just remember that the more often you do it, the more accurately fighters will move. That is, you will be sure they really take the shortest path. Usually this does not have much effect, the default value should fit in most cases, but you might want to decrease it on very simple maps where the gradient is obvious, or increase it on complex maps where you want fighters to be real smart. 4.9.26 start-blue-x ------------------- -- Command-line option: `--start-blue-x=' -- Environment variable: `LW6_START_BLUE_X' -- XML key: `start-blue-x' Type: integer. Default value: 90. Min value: 0. Max value: 100. X start position for the blue team. This is a percentage of map width, value between 0 and 100. 4.9.27 start-blue-y ------------------- -- Command-line option: `--start-blue-y=' -- Environment variable: `LW6_START_BLUE_Y' -- XML key: `start-blue-y' Type: integer. Default value: 10. Min value: 0. Max value: 100. Y start position for the blue team. This is a percentage of map height, value between 0 and 100. 4.9.28 start-cyan-x ------------------- -- Command-line option: `--start-cyan-x=' -- Environment variable: `LW6_START_CYAN_X' -- XML key: `start-cyan-x' Type: integer. Default value: 35. Min value: 0. Max value: 100. X start position for the cyan team. This is a percentage of map width, value between 0 and 100. 4.9.29 start-cyan-y ------------------- -- Command-line option: `--start-cyan-y=' -- Environment variable: `LW6_START_CYAN_Y' -- XML key: `start-cyan-y' Type: integer. Default value: 10. Min value: 0. Max value: 100. Y start position for the cyan team. This is a percentage of map height, value between 0 and 100. 4.9.30 start-green-x -------------------- -- Command-line option: `--start-green-x=' -- Environment variable: `LW6_START_GREEN_X' -- XML key: `start-green-x' Type: integer. Default value: 90. Min value: 0. Max value: 100. X start position for the green team. This is a percentage of map width, value between 0 and 100. 4.9.31 start-green-y -------------------- -- Command-line option: `--start-green-y=' -- Environment variable: `LW6_START_GREEN_Y' -- XML key: `start-green-y' Type: integer. Default value: 90. Min value: 0. Max value: 100. Y start position for the green team. This is a percentage of map height, value between 0 and 100. 4.9.32 start-lightblue-x ------------------------ -- Command-line option: `--start-lightblue-x=' -- Environment variable: `LW6_START_LIGHTBLUE_X' -- XML key: `start-lightblue-x' Type: integer. Default value: 35. Min value: 0. Max value: 100. X start position for the lightblue team. This is a percentage of map width, value between 0 and 100. 4.9.33 start-lightblue-y ------------------------ -- Command-line option: `--start-lightblue-y=' -- Environment variable: `LW6_START_LIGHTBLUE_Y' -- XML key: `start-lightblue-y' Type: integer. Default value: 90. Min value: 0. Max value: 100. Y start position for the lightblue team. This is a percentage of map height, value between 0 and 100. 4.9.34 start-magenta-x ---------------------- -- Command-line option: `--start-magenta-x=' -- Environment variable: `LW6_START_MAGENTA_X' -- XML key: `start-magenta-x' Type: integer. Default value: 65. Min value: 0. Max value: 100. X start position for the magenta team. This is a percentage of map width, value between 0 and 100. 4.9.35 start-magenta-y ---------------------- -- Command-line option: `--start-magenta-y=' -- Environment variable: `LW6_START_MAGENTA_Y' -- XML key: `start-magenta-y' Type: integer. Default value: 90. Min value: 0. Max value: 100. Y start position for the magenta team. This is a percentage of map height, value between 0 and 100. 4.9.36 start-orange-x --------------------- -- Command-line option: `--start-orange-x=' -- Environment variable: `LW6_START_ORANGE_X' -- XML key: `start-orange-x' Type: integer. Default value: 65. Min value: 0. Max value: 100. X start position for the orange team. This is a percentage of map width, value between 0 and 100. 4.9.37 start-orange-y --------------------- -- Command-line option: `--start-orange-y=' -- Environment variable: `LW6_START_ORANGE_Y' -- XML key: `start-orange-y' Type: integer. Default value: 10. Min value: 0. Max value: 100. Y start position for the orange team. This is a percentage of map height, value between 0 and 100. 4.9.38 start-pink-x ------------------- -- Command-line option: `--start-pink-x=' -- Environment variable: `LW6_START_PINK_X' -- XML key: `start-pink-x' Type: integer. Default value: 10. Min value: 0. Max value: 100. X start position for the pink team. This is a percentage of map width, value between 0 and 100. 4.9.39 start-pink-y ------------------- -- Command-line option: `--start-pink-y=' -- Environment variable: `LW6_START_PINK_Y' -- XML key: `start-pink-y' Type: integer. Default value: 50. Min value: 0. Max value: 100. Y start position for the pink team. This is a percentage of map height, value between 0 and 100. 4.9.40 start-position-mode -------------------------- -- Command-line option: `--start-position-mode=' -- Environment variable: `LW6_START_POSITION_MODE' -- XML key: `start-position-mode' Type: integer. Default value: 0. Min value: 0. Max value: 2. Defines how teams or set up on the map at game startup. 0, the default, means teams respect the pre-defined start positions. 1 means that a random position will be picked, among the existing positions. That is, red could take green's place. 2 means total randomness, teams can appear anywhere. 4.9.41 start-purple-x --------------------- -- Command-line option: `--start-purple-x=' -- Environment variable: `LW6_START_PURPLE_X' -- XML key: `start-purple-x' Type: integer. Default value: 90. Min value: 0. Max value: 100. X start position for the purple team. This is a percentage of map width, value between 0 and 100. 4.9.42 start-purple-y --------------------- -- Command-line option: `--start-purple-y=' -- Environment variable: `LW6_START_PURPLE_Y' -- XML key: `start-purple-y' Type: integer. Default value: 50. Min value: 0. Max value: 100. Y start position for the purple team. This is a percentage of map height, value between 0 and 100. 4.9.43 start-red-x ------------------ -- Command-line option: `--start-red-x=' -- Environment variable: `LW6_START_RED_X' -- XML key: `start-red-x' Type: integer. Default value: 10. Min value: 0. Max value: 100. X start position for the red team. This is a percentage of map width, value between 0 and 100. 4.9.44 start-red-y ------------------ -- Command-line option: `--start-red-y=' -- Environment variable: `LW6_START_RED_Y' -- XML key: `start-red-y' Type: integer. Default value: 10. Min value: 0. Max value: 100. Y start position for the red team. This is a percentage of map height, value between 0 and 100. 4.9.45 start-yellow-x --------------------- -- Command-line option: `--start-yellow-x=' -- Environment variable: `LW6_START_YELLOW_X' -- XML key: `start-yellow-x' Type: integer. Default value: 10. Min value: 0. Max value: 100. X start position for the yellow team. This is a percentage of map width, value between 0 and 100. 4.9.46 start-yellow-y --------------------- -- Command-line option: `--start-yellow-y=' -- Environment variable: `LW6_START_YELLOW_Y' -- XML key: `start-yellow-y' Type: integer. Default value: 90. Min value: 0. Max value: 100. Y start position for the yellow team. This is a percentage of map height, value between 0 and 100. 4.9.47 total-armies-size ------------------------ -- Command-line option: `--total-armies-size=' -- Environment variable: `LW6_TOTAL_ARMIES_SIZE' -- XML key: `total-armies-size' Type: integer. Default value: 60. Min value: 1. Max value: 95. Defines the proportion of the whole available space, which can be occupied by all the armies present together. Setting this low, whenever a new team arrives on the map, fighters might be stolen to other teams, otherwise the ame would get too crowded. This allows you to play with reasonnably enough fighters with 2 players, while still allowing interesting gameplay with many players. This is a percentage, but will be multiplied by itself to get the actual surface. That is, 50 means 50%*50%, that is, a square of 1/2 the size of a square map, so it represents 25% (1/4) of the total surface. 4.9.48 total-time ----------------- -- Command-line option: `--total-time=' -- Environment variable: `LW6_TOTAL_TIME' -- XML key: `total-time' Type: integer. Default value: 900. Min value: 10. Max value: 864000. Defines the maximum time of the game, in seconds. Note that in some cases, the game can end much earlier if some player has managed to win before the bell rings. Also, technically, this value will be translated into rounds and moves, and the game engine will wait until enough rounds and moves have been played. So if the computer is too slow and the desired speed is not reached, then the game will last for a longer time. 4.9.49 vertical-move -------------------- -- Command-line option: `--vertical-move=' -- Environment variable: `LW6_VERTICAL_MOVE' -- XML key: `vertical-move' Type: integer. Default value: 1. Min value: 0. Max value: 7. Defines when to process a vertical move (along the Z 'depth' axis). If set to 0, fighters never spontaneously move along this axis. If set to 1, it will be tried just after the first move failed. If set to 2, it will be tried just after the second move failed. And so on. 4.9.50 x-polarity ----------------- -- Command-line option: `--x-polarity=' -- Environment variable: `LW6_X_POLARITY' -- XML key: `x-polarity' Type: integer. Default value: 0. Min value: -1. Max value: 1. Defines how the map will be wrapped on the X (horizontal) axis. If set to 0, nothing is wrapped. If set to 1, the right and left borders are connected, any fighter can disappear on the right border and reappear on the left border, for instance. If set to -1, it will be wrapped but also inversed, that is on a 320x240 map, a fighter disappearing on the left border at position (0,60) will reapper on the right border at position (319,180). You can combine it with 'y-polarity'. 4.9.51 y-polarity ----------------- -- Command-line option: `--y-polarity=' -- Environment variable: `LW6_Y_POLARITY' -- XML key: `y-polarity' Type: integer. Default value: 0. Min value: -1. Max value: 1. Defines how the map will be wrapped on the Y (vertical) axis. If set to 0, nothing is wrapped. If set to 1, the top and bottom borders are connected, any fighter can disappear on the top border and reappear on the bottom border, for instance. If set to -1, it will be wrapped but also inversed, that is on a 320x240 map, a fighter disappearing on the bottom border at position (40,239) will reapper on the top border at position (280,0). You can combine it with 'x-polarity'. 4.9.52 z-polarity ----------------- -- Command-line option: `--z-polarity=' -- Environment variable: `LW6_Z_POLARITY' -- XML key: `z-polarity' Type: integer. Default value: 0. Min value: 0. Max value: 1. Defines how the map will be wrapped on the Z (deep) axis. If set to 0, nothing is wrapped. If set to 1, when using a 4 layer map, for instance, fighters on layer 1 will be able to go directly to layer 4 even if layers 2 and 3 are filled with walls. A value of -1 is forbidden, this is not like x and y axis, it does not really make sense. Consider this an advanced setting which might save a layer in some tricky cases, the default value of 0 should fit in most cases. 4.10 Map hints.xml ================== 4.10.1 background-color-auto ---------------------------- -- Command-line option: `--background-color-auto=' -- Environment variable: `LW6_BACKGROUND_COLOR_AUTO' -- XML key: `background-color-auto' Type: boolean. Default value: true. Defines wether hud colors will be set automatically from base and alternate colors. This is a time saver to keep map designers from requiring to redefined every single color in the game. You only need to set color-base-bg, color-base-fg, color-alternate-bg and color-alternate-fg. Then hud_color_frame_bg, hud_color_frame_fg, hud_color_text_bg and hud_color_text_fg will be automatically set. 4.10.2 fighter-scale -------------------- -- Command-line option: `--fighter-scale=' -- Environment variable: `LW6_FIGHTER_SCALE' -- XML key: `fighter-scale' Type: float. Default value: 4.0. Defines how wide (in pixels) fighters must be. This parameter is very important and will largely condition the number of fighters on the map. It is used when loading the map. If it is, for instance, set to 1, there will be exactly a fighter per pixel on the screen. That is, if you play 640x480 on an empty map, the maximum fighters you could have is about 300000. The idea is that by changing the resolution, you also define the density of the map. In pratice, this is done in the hope that someone with a slow computer will pick up a low resolution and therefore play small levels. Conversely, someone with a brand new computer with powerfull CPU & GPU will use great resolutions and be happy with many fighters on the map. Still, changing the resolution after loading the map will not affet the number of fighters. Same for network games, the first player, who loads the map, defines its properties according to its own settings. 4.10.3 guess-colors ------------------- -- Command-line option: `--guess-colors=' -- Environment variable: `LW6_GUESS_COLORS' -- XML key: `guess-colors' Type: boolean. Default value: true. Defines wether colors should be set automatically from texture colors. If set to true, then the program will try to pick up colors automatically from the texture, and will override the values of the color-base-bg, color-base-fg, color-alternate-bg and color-alternate-fg parameters. How these colors are picked up can't be garanteed, so if the map does not have strong contrast or if there can be any form of ambiguity, it's safe to set this to false and define one's own colors. 4.10.4 hud-color-auto --------------------- -- Command-line option: `--hud-color-auto=' -- Environment variable: `LW6_HUD_COLOR_AUTO' -- XML key: `hud-color-auto' Type: boolean. Default value: true. Defines wether hud colors will be set automatically from base and alternate colors. This is a time saver to keep map designers from requiring to redefined every single color in the game. You only need to set color-base-bg, color-base-fg, color-alternate-bg and color-alternate-fg. Then hud_color_frame_bg, hud_color_frame_fg, hud_color_text_bg and hud_color_text_fg will be automatically set. 4.10.5 max-map-height --------------------- -- Command-line option: `--max-map-height=' -- Environment variable: `LW6_MAX_MAP_HEIGHT' -- XML key: `max-map-height' Type: integer. Default value: 1200. Allows you to give a maximum map height. When designing a map you might wonder: this is dumb I'm conceiving this map I know its height, why should I limit it? Now think of the play who plays on a old slowish computer with a tiny screen. He might redefine this himself, and does not necessarly wishes to fire Gimp to rescale the map. 4.10.6 max-map-surface ---------------------- -- Command-line option: `--max-map-surface=' -- Environment variable: `LW6_MAX_MAP_SURFACE' -- XML key: `max-map-surface' Type: integer. Default value: 480000. Allows you to give a maximum map surface. Map surface is simply (width * height). This parameter is just here to save you the hassle of defining both 'max-map-width' and 'max-map-height' in a consistent manner. 4.10.7 max-map-width -------------------- -- Command-line option: `--max-map-width=' -- Environment variable: `LW6_MAX_MAP_WIDTH' -- XML key: `max-map-width' Type: integer. Default value: 1600. Allows you to give a maximum map width. When designing a map you might wonder: this is dumb I'm conceiving this map I know its width, why should I limit it? Now think of the play who plays on a old slowish computer with a tiny screen. He might redefine this himself, and does not necessarly wishes to fire Gimp to rescale the map. 4.10.8 menu-color-auto ---------------------- -- Command-line option: `--menu-color-auto=' -- Environment variable: `LW6_MENU_COLOR_AUTO' -- XML key: `menu-color-auto' Type: boolean. Default value: true. Defines wether menu colors will be set automatically from base and alternate colors. This is a time saver to keep map designers from requiring to redefined every single color in the game. You only need to set color-base-bg, color-base-fg, color-alternate-bg and color-alternate-fg. Then menu_color_default_bg, menu_color_default_fg, menu_color_selected_bg, menu_color_selected_fg, menu_color_disabled_bg and menu_color_disabled_fg will be automatically set. 4.10.9 min-map-height --------------------- -- Command-line option: `--min-map-height=' -- Environment variable: `LW6_MIN_MAP_HEIGHT' -- XML key: `min-map-height' Type: integer. Default value: 30. Allows you to give a minimum map height. When designing a map you might wonder: this is dumb I'm conceiving this map I know its height, why should I limit it? Now think of the player who decided to play with highly-defined maps because he has a super calculator and a hudge screen. He might redefine this himself, and does not necessarly wishes to fire Gimp to rescale the map. 4.10.10 min-map-surface ----------------------- -- Command-line option: `--min-map-surface=' -- Environment variable: `LW6_MIN_MAP_SURFACE' -- XML key: `min-map-surface' Type: integer. Default value: 4800. Allows you to give a minimum map surface. Map surface is simply (width * height). This parameter is just here to save you the hassle of defining both 'min-map-width' and 'min-map-height' in a consistent manner. 4.10.11 min-map-width --------------------- -- Command-line option: `--min-map-width=' -- Environment variable: `LW6_MIN_MAP_WIDTH' -- XML key: `min-map-width' Type: integer. Default value: 40. Allows you to give a minimum map width. When designing a map you might wonder: this is dumb I'm conceiving this map I know its width, why should I limit it? Now think of the player who decided to play with highly-defined maps because he has a super calculator and a hudge screen. He might redefine this himself, and does not necessarly wishes to fire Gimp to rescale the map. 4.10.12 resample ---------------- -- Command-line option: `--resample=' -- Environment variable: `LW6_RESAMPLE' -- XML key: `resample' Type: boolean. Default value: true. If set to true, maps will always be resampled to a size which depends on your screen resolution, zoom factor, and the rest. If false, maps will be set at the exact resolution of map.png. 4.10.13 system-color-auto ------------------------- -- Command-line option: `--system-color-auto=' -- Environment variable: `LW6_SYSTEM_COLOR_AUTO' -- XML key: `system-color-auto' Type: boolean. Default value: true. Defines wether system colors will be set automatically from base and alternate colors. This is a time saver to keep map designers from requiring to redefined every single color in the game. You only need to set color-base-bg, color-base-fg, color-alternate-bg and color-alternate-fg. Then system_color_bg and system_color_fg will be automatically set. 4.10.14 view-color-auto ----------------------- -- Command-line option: `--view-color-auto=' -- Environment variable: `LW6_VIEW_COLOR_AUTO' -- XML key: `view-color-auto' Type: boolean. Default value: true. Defines wether view colors will be set automatically from base and alternate colors. This is a time saver to keep map designers from requiring to redefined every single color in the game. You only need to set color-base-bg, color-base-fg, color-alternate-bg and color-alternate-fg. Then view_color_cursor_bg, view_color_cursor_fg, view_color_map_bg and view_color_map_fg will be automatically set. 4.11 Map style.xml ================== 4.11.1 animation-density ------------------------ -- Command-line option: `--animation-density=' -- Environment variable: `LW6_ANIMATION_DENSITY' -- XML key: `animation-density' Type: float. Default value: 1.0f. Min value: 0. Max value: 10. Density of the background animation, that is, for instance, if the background animation is about displaying bubbles, using a high value will display many bubbles. A value of 1.0 corresponds to the default setting. 4.11.2 animation-speed ---------------------- -- Command-line option: `--animation-speed=' -- Environment variable: `LW6_ANIMATION_SPEED' -- XML key: `animation-speed' Type: float. Default value: 1.0f. Min value: 0. Max value: 10. Speed of the background animation, that is, for instance, if the background animation is about displaying bubbles, using a high value will cause bubbles to move very fast. A value of 1.0 corresponds to the default setting. 4.11.3 background-color-root-bg ------------------------------- -- Command-line option: `--background-color-root-bg=' -- Environment variable: `LW6_BACKGROUND_COLOR_ROOT_BG' -- XML key: `background-color-root-bg' Type: color. Default value: #000. Defines the main background color. This is, for instance, the color which will be used to clear the screen before drawing thing. Will be automatically guessed from the map texture if color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.4 background-color-root-fg ------------------------------- -- Command-line option: `--background-color-root-fg=' -- Environment variable: `LW6_BACKGROUND_COLOR_ROOT_FG' -- XML key: `background-color-root-fg' Type: color. Default value: #ccc. Defines a color which will be used together with color-base-bg to compose the background. It can be wise to have a minimum contrast between this color and color-base-bg, but it is not mandatory, especially if other colors are manually redefined. Will be automatically guessed from the map texture if color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.5 background-color-stuff-bg -------------------------------- -- Command-line option: `--background-color-stuff-bg=' -- Environment variable: `LW6_BACKGROUND_COLOR_STUFF_BG' -- XML key: `background-color-stuff-bg' Type: color. Default value: #333. Defines a color which will be used together with color-alternate-fg to draw things (animations, sprites, text, whatever) in the background. It should be different enough from color-alternate-fg so that one can really distinguish these colors. Will be automatically guessed from the map texture if color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.6 background-color-stuff-fg -------------------------------- -- Command-line option: `--background-color-stuff-fg=' -- Environment variable: `LW6_BACKGROUND_COLOR_STUFF_FG' -- XML key: `background-color-stuff-fg' Type: color. Default value: #fff. Defines a color which will be used to draw things (animations, sprites, text, whatever) in the background. It should be different enough from color-alternate-bg so that one can really distinguish these colors. Think of this as the sprite, the text, the whatever-needs-to-be-seen-uses-this color. Will be automatically guessed from the map texture if color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.7 background-style ----------------------- -- Command-line option: `--background-style=' -- Environment variable: `LW6_BACKGROUND_STYLE' -- XML key: `background-style' Type: string. Default value: bubbles. The background defines, of course, what is displayed at the background, but it also conditions the colors used for other items, such as the menus for instance. The only possible value for now is 'bubbles'. 4.11.8 color-alternate-bg ------------------------- -- Command-line option: `--color-alternate-bg=' -- Environment variable: `LW6_COLOR_ALTERNATE_BG' -- XML key: `color-alternate-bg' Type: color. Default value: #333. Defines the alternate color, more precisely, its bg (background) part. Colors are always defined by a bg/fg pair. Most colors in the game can be deduced from this one, usually to color a map you only need to define color-base-bg, color-base-fg, color-alternate-bg and color-alternate-fg. 4.11.9 color-alternate-fg ------------------------- -- Command-line option: `--color-alternate-fg=' -- Environment variable: `LW6_COLOR_ALTERNATE_FG' -- XML key: `color-alternate-fg' Type: color. Default value: #fff. Defines the alternate color, more precisely, its fg (foreground) part. Colors are always defined by a bg/fg pair. Most colors in the game can be deduced from this one, usually to color a map you only need to define color-base-bg, color-base-fg, color-alternate-bg and color-alternate-fg. 4.11.10 color-base-bg --------------------- -- Command-line option: `--color-base-bg=' -- Environment variable: `LW6_COLOR_BASE_BG' -- XML key: `color-base-bg' Type: color. Default value: #000. Defines the base color, more precisely, its bg (background) part. Colors are always defined by a bg/fg pair. Most colors in the game can be deduced from this one, usually to color a map you only need to define color-base-bg, color-base-fg, color-alternate-bg and color-alternate-fg. 4.11.11 color-base-fg --------------------- -- Command-line option: `--color-base-fg=' -- Environment variable: `LW6_COLOR_BASE_FG' -- XML key: `color-base-fg' Type: color. Default value: #ccc. Defines the base color, more precisely, its fg (foreground) part. Colors are always defined by a bg/fg pair. Most colors in the game can be deduced from this one, usually to color a map you only need to define color-base-bg, color-base-fg, color-alternate-bg and color-alternate-fg. 4.11.12 colorize ---------------- -- Command-line option: `--colorize=' -- Environment variable: `LW6_COLORIZE' -- XML key: `colorize' Type: boolean. Default value: true. If set, then all background drawings including textures will use the bakground colors. This means, for instance, that if background colors are set automatically by color-auto from the map texture, then the background will adopt the same range of colors than the map itself. In short, the background will mimic the map. 4.11.13 cursor-size ------------------- -- Command-line option: `--cursor-size=' -- Environment variable: `LW6_CURSOR_SIZE' -- XML key: `cursor-size' Type: float. Default value: 1.0f. Min value: 0. Max value: 10. Size of the cursors on the map. 1 is the default, setting it to a higher value will make cursors bigger, a lower value will make them smaller. 4.11.14 hidden-layer-alpha -------------------------- -- Command-line option: `--hidden-layer-alpha=' -- Environment variable: `LW6_HIDDEN_LAYER_ALPHA' -- XML key: `hidden-layer-alpha' Type: float. Default value: 0.1f. Min value: 0. Max value: 1. Whenever players are supposed to be hidden behind a wall, for instance if they are in layer 2 and layer 1 is filled with walls, it's still possible to see them, but with a low alpha value (almost transparent). This parameter allows you to trick this value, 0 will make these players absolutely invisible, 1 will make them totally opaque, like if they were on layer 1. 4.11.15 hud-color-frame-bg -------------------------- -- Command-line option: `--hud-color-frame-bg=' -- Environment variable: `LW6_HUD_COLOR_FRAME_BG' -- XML key: `hud-color-frame-bg' Type: color. Default value: #000. Defines the background color for the hud frame. Ignored if hud-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.16 hud-color-frame-fg -------------------------- -- Command-line option: `--hud-color-frame-fg=' -- Environment variable: `LW6_HUD_COLOR_FRAME_FG' -- XML key: `hud-color-frame-fg' Type: color. Default value: #ccc. Defines the foreground color for the hud frame. Ignored if hud-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.17 hud-color-text-bg ------------------------- -- Command-line option: `--hud-color-text-bg=' -- Environment variable: `LW6_HUD_COLOR_TEXT_BG' -- XML key: `hud-color-text-bg' Type: color. Default value: #333. Defines the background color for hud text. Ignored if hud-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.18 hud-color-text-fg ------------------------- -- Command-line option: `--hud-color-text-fg=' -- Environment variable: `LW6_HUD_COLOR_TEXT_FG' -- XML key: `hud-color-text-fg' Type: color. Default value: #fff. Defines the foreground color for hud text. Ignored if hud-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.19 hud-style ----------------- -- Command-line option: `--hud-style=' -- Environment variable: `LW6_HUD_STYLE' -- XML key: `hud-style' Type: string. Default value: floating. The hud is where informations about the game are displayed. This means, who is winning, are other status-like informations. Possible values include 'floating' and 'tactical'. 4.11.20 keep-ratio ------------------ -- Command-line option: `--keep-ratio=' -- Environment variable: `LW6_KEEP_RATIO' -- XML key: `keep-ratio' Type: boolean. Default value: true. Defines wether the map should keep its ratio, or if it should be stretched to fill the shape of your screen. 4.11.21 menu-color-default-bg ----------------------------- -- Command-line option: `--menu-color-default-bg=' -- Environment variable: `LW6_MENU_COLOR_DEFAULT_BG' -- XML key: `menu-color-default-bg' Type: color. Default value: #333. Defines the default background color for menus. Ignored if menu-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.22 menu-color-default-fg ----------------------------- -- Command-line option: `--menu-color-default-fg=' -- Environment variable: `LW6_MENU_COLOR_DEFAULT_FG' -- XML key: `menu-color-default-fg' Type: color. Default value: #fff. Defines the default foreground color for menus. In fact, this is the main color for menu text, the color used to draw letters in menus. Ignored if menu-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.23 menu-color-disabled-bg ------------------------------ -- Command-line option: `--menu-color-disabled-bg=' -- Environment variable: `LW6_MENU_COLOR_DISABLED_BG' -- XML key: `menu-color-disabled-bg' Type: color. Default value: #000. Defines the background color for a disabled menu item. Ignored if menu-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.24 menu-color-disabled-fg ------------------------------ -- Command-line option: `--menu-color-disabled-fg=' -- Environment variable: `LW6_MENU_COLOR_DISABLED_FG' -- XML key: `menu-color-disabled-fg' Type: color. Default value: #ccc. Defines the foreground color for a disabled menu item. Ignored if menu-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.25 menu-color-selected-bg ------------------------------ -- Command-line option: `--menu-color-selected-bg=' -- Environment variable: `LW6_MENU_COLOR_SELECTED_BG' -- XML key: `menu-color-selected-bg' Type: color. Default value: #fff. Defines the background color for a selected menu item. Ignored if menu-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.26 menu-color-selected-fg ------------------------------ -- Command-line option: `--menu-color-selected-fg=' -- Environment variable: `LW6_MENU_COLOR_SELECTED_FG' -- XML key: `menu-color-selected-fg' Type: color. Default value: #333. Defines the foreground color for a selected menu item. Ignored if menu-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.27 menu-style ------------------ -- Command-line option: `--menu-style=' -- Environment variable: `LW6_MENU_STYLE' -- XML key: `menu-style' Type: string. Default value: cylinder. The menu style is simply the name of the engine used to power the menu system. The only possible value, for now, is 'cylinder'. 4.11.28 pixelize ---------------- -- Command-line option: `--pixelize=' -- Environment variable: `LW6_PIXELIZE' -- XML key: `pixelize' Type: boolean. Default value: false. Depending on the renderer capabilities, will try to pixelize some parts of the game. This can be used to emulate the old LW5 appearance. 4.11.29 system-color-bg ----------------------- -- Command-line option: `--system-color-bg=' -- Environment variable: `LW6_SYSTEM_COLOR_BG' -- XML key: `system-color-bg' Type: color. Default value: #333. Defines the system background color, used when displaying system info, such as the number of frames per second. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.30 system-color-fg ----------------------- -- Command-line option: `--system-color-fg=' -- Environment variable: `LW6_SYSTEM_COLOR_FG' -- XML key: `system-color-fg' Type: color. Default value: #fff. Defines the system foreground color, used when displaying system info, such as the number of frames per second. This will typically be text color. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.31 team-color-blue ----------------------- -- Command-line option: `--team-color-blue=' -- Environment variable: `LW6_TEAM_COLOR_BLUE' -- XML key: `team-color-blue' Type: color. Default value: #00f. Defines the color for the blue team. Syntax is HTML-like, #RGB or #RRGGBB. 4.11.32 team-color-cyan ----------------------- -- Command-line option: `--team-color-cyan=' -- Environment variable: `LW6_TEAM_COLOR_CYAN' -- XML key: `team-color-cyan' Type: color. Default value: #0ff. Defines the color for the cyan team. Syntax is HTML-like, #RGB or #RRGGBB. 4.11.33 team-color-green ------------------------ -- Command-line option: `--team-color-green=' -- Environment variable: `LW6_TEAM_COLOR_GREEN' -- XML key: `team-color-green' Type: color. Default value: #0f0. Defines the color for the green team. Syntax is HTML-like, #RGB or #RRGGBB. 4.11.34 team-color-lightblue ---------------------------- -- Command-line option: `--team-color-lightblue=' -- Environment variable: `LW6_TEAM_COLOR_LIGHTBLUE' -- XML key: `team-color-lightblue' Type: color. Default value: #8bf. Defines the color for the light blue team. Syntax is HTML-like, #RGB or #RRGGBB. 4.11.35 team-color-magenta -------------------------- -- Command-line option: `--team-color-magenta=' -- Environment variable: `LW6_TEAM_COLOR_MAGENTA' -- XML key: `team-color-magenta' Type: color. Default value: #f0f. Defines the color for the magenta team. Syntax is HTML-like, #RGB or #RRGGBB. 4.11.36 team-color-orange ------------------------- -- Command-line option: `--team-color-orange=' -- Environment variable: `LW6_TEAM_COLOR_ORANGE' -- XML key: `team-color-orange' Type: color. Default value: #f80. Defines the color for the orange team. Syntax is HTML-like, #RGB or #RRGGBB. 4.11.37 team-color-pink ----------------------- -- Command-line option: `--team-color-pink=' -- Environment variable: `LW6_TEAM_COLOR_PINK' -- XML key: `team-color-pink' Type: color. Default value: #f8b. Defines the color for the pink team. Syntax is HTML-like, #RGB or #RRGGBB. 4.11.38 team-color-purple ------------------------- -- Command-line option: `--team-color-purple=' -- Environment variable: `LW6_TEAM_COLOR_PURPLE' -- XML key: `team-color-purple' Type: color. Default value: #b8f. Defines the color for the purple team. Syntax is HTML-like, #RGB or #RRGGBB. 4.11.39 team-color-red ---------------------- -- Command-line option: `--team-color-red=' -- Environment variable: `LW6_TEAM_COLOR_RED' -- XML key: `team-color-red' Type: color. Default value: #f00. Defines the color for the red team. Syntax is HTML-like, #RGB or #RRGGBB. 4.11.40 team-color-yellow ------------------------- -- Command-line option: `--team-color-yellow=' -- Environment variable: `LW6_TEAM_COLOR_YELLOW' -- XML key: `team-color-yellow' Type: color. Default value: #ff0. Defines the color for the yellow team. Syntax is HTML-like, #RGB or #RRGGBB. 4.11.41 view-color-cursor-bg ---------------------------- -- Command-line option: `--view-color-cursor-bg=' -- Environment variable: `LW6_VIEW_COLOR_CURSOR_BG' -- XML key: `view-color-cursor-bg' Type: color. Default value: #333. Defines the background cursor color. Will typically be used to draw the shape of the cursor. Ignored if view-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.42 view-color-cursor-fg ---------------------------- -- Command-line option: `--view-color-cursor-fg=' -- Environment variable: `LW6_VIEW_COLOR_CURSOR_FG' -- XML key: `view-color-cursor-fg' Type: color. Default value: #fff. Defines the foreground cursor color. Will typically be used to draw text in the cursor. Ignored if view-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.43 view-color-map-bg ------------------------- -- Command-line option: `--view-color-map-bg=' -- Environment variable: `LW6_VIEW_COLOR_MAP_BG' -- XML key: `view-color-map-bg' Type: color. Default value: #000. Defines the background map color. If there's no map texture defined or if use-texture is false, this is the color of the places where armies will go. Ignored if view-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.44 view-color-map-fg ------------------------- -- Command-line option: `--view-color-map-fg=' -- Environment variable: `LW6_VIEW_COLOR_MAP_FG' -- XML key: `view-color-map-fg' Type: color. Default value: #ccc. Defines the foreground map color. If there's no map texture defined or if use-texture is false, this is the color of walls, what armies can't go through. Ignored if view-color-auto is set. Can be #RGB, #RGBA, #RRGGBB or #RRGGBBAA. 4.11.45 view-style ------------------ -- Command-line option: `--view-style=' -- Environment variable: `LW6_VIEW_STYLE' -- XML key: `view-style' Type: string. Default value: flat. The view style conditions which renderer is used for the map, the area where fighters are displayed. This is not the graphics backend. Indeed, the graphics backend defines which technical tool one uses (which library) one runs, wether this parameter says what kind of rendering one wants. 4.11.46 x-wrap -------------- -- Command-line option: `--x-wrap=' -- Environment variable: `LW6_X_WRAP' -- XML key: `x-wrap' Type: boolean. Default value: true. Defines wether the map should be wrapped on the x axis. This is the companion of 'x-polarity', if no polarity is defined, map can't be wrapped, but in some cases, one might wish to have a map with polarity but without wrapping if, for instance, textures do not tile nicely. 4.11.47 y-wrap -------------- -- Command-line option: `--y-wrap=' -- Environment variable: `LW6_Y_WRAP' -- XML key: `y-wrap' Type: boolean. Default value: true. Defines wether the map should be wrapped on the y axis. This is the companion of 'y-polarity', if no polarity is defined, map can't be wrapped, but in some cases, one might wish to have a map with polarity but without wrapping if, for instance, textures do not tile nicely. 4.11.48 zoom ------------ -- Command-line option: `--zoom=' -- Environment variable: `LW6_ZOOM' -- XML key: `zoom' Type: float. Default value: 1.0f. Defines the map zoom. If lower than 1.0, map will occupy only a fraction of the screen, if greater than 1.0, some areas will be outside the screen, and the player will need to scroll through it. 4.11.49 zoom-max ---------------- -- Command-line option: `--zoom-max=' -- Environment variable: `LW6_ZOOM_MAX' -- XML key: `zoom-max' Type: float. Default value: 30.0f. Defines the max map zoom. If set to a high value, you'll be able to dynamically view the map with hudge fighters, seeing only a fraction of the level. 4.11.50 zoom-min ---------------- -- Command-line option: `--zoom-min=' -- Environment variable: `LW6_ZOOM_MIN' -- XML key: `zoom-min' Type: float. Default value: 0.3f. Defines the min map zoom. If set to a low value, you'll be able to dynamically view a very small, reduced map. 4.12 Advanced settings ====================== 4.12.1 audit ------------ -- Command-line option: `--audit' -- Environment variable: `LW6_AUDIT' Display all path values, defaults and current settings. This output is very usefull to track down problems such as missing directories, broken installations. If you get an error message that suggests some file is missing, then give this option a try. 4.12.2 bench ------------ -- Command-line option: `--bench' -- Environment variable: `LW6_BENCH' Runs a benchmarking test which will report an approximative performance estimation of the game on your computer. 4.12.3 bot-iq ------------- -- Command-line option: `--bot-iq=' -- Environment variable: `LW6_BOT_IQ' -- XML key: `bot-iq' Type: integer. Default value: 100. Min value: 0. Max value: 200. The IQ (intelligence quotient) of bots. Typically, a value of 100 will make the bot behave normally, performing at its best. A value of 0 will just make it act the worst way it can. Values over 100 probably won't change anything compared to 100, but this truely depends on which bot backend you're running. 4.12.4 bot-speed ---------------- -- Command-line option: `--bot-speed=' -- Environment variable: `LW6_BOT_SPEED' -- XML key: `bot-speed' Type: float. Default value: 1.0. The speed of bots, 1 means normal speed, higher value will speed it up, lower will slow it down. Note that this only has an impact on bot engines, not on the game speed itself. 4.12.5 commands-per-sec ----------------------- -- Command-line option: `--commands-per-sec=' -- Environment variable: `LW6_COMMANDS_PER_SEC' -- XML key: `commands-per-sec' Type: integer. Default value: 5. Defines the number of commands per second. When a command is generated, orders are actually sent to the game engine, for instance, 'this cursor moved there'. So this option will affect game responsiveness, setting this to a high value will make the game more responsive but consume bandwidth on network games. 4.12.6 debug-layer-id --------------------- -- Command-line option: `--debug-layer-id=' -- Environment variable: `LW6_DEBUG_LAYER_ID' -- XML key: `debug-layer-id' Type: integer. Default value: 0. Min value: 0. Max value: 6. A team id which will be used for debugging purposes, for instance when displaying gradient. 4.12.7 debug-team-id -------------------- -- Command-line option: `--debug-team-id=' -- Environment variable: `LW6_DEBUG_TEAM_ID' -- XML key: `debug-team-id' Type: integer. Default value: 0. Min value: 0. Max value: 9. A team id which will be used for debugging purposes, for instance when displaying gradient. 4.12.8 demo ----------- -- Command-line option: `--demo' -- Environment variable: `LW6_DEMO' Start the game in demo mode. 2 bots play against each other forever. 4.12.9 dirty-read ----------------- -- Command-line option: `--dirty-read=' -- Environment variable: `LW6_DIRTY_READ' -- XML key: `dirty-read' Type: integer. Default value: 2. Min value: 0. Max value: 2. How to handle dirty reads and locks when displaying stuff. If set to 0, there will be no dirty reads at all, a lock (mutex) will be set whenever it's needed. If set to 1, display might be done with inconsistent data, however the data itself won't be modified while displaying. If set to 2, displayed data can (and will) be modified while the rendering thread is running. 4.12.10 display-background -------------------------- -- Command-line option: `--display-background=' -- Environment variable: `LW6_DISPLAY_BACKGROUND' -- XML key: `display-background' Type: boolean. Default value: true. Decides wether the background animation/image should be displayed at all. 4.12.11 display-console ----------------------- -- Command-line option: `--display-console=' -- Environment variable: `LW6_DISPLAY_CONSOLE' -- XML key: `display-console' Type: boolean. Default value: false. Defines wether the interactive system console must be displayed. Note that console support must have been enabled at compilation time. It might not be available on your computer, for instance if you are running a system such as Microsoft Windows. 4.12.12 display-cursors ----------------------- -- Command-line option: `--display-cursors=' -- Environment variable: `LW6_DISPLAY_CURSORS' -- XML key: `display-cursors' Type: boolean. Default value: true. Debugging option which can be set to 'false' to disable the display of cursors when playing. 4.12.13 display-debug-gradient ------------------------------ -- Command-line option: `--display-debug-gradient=' -- Environment variable: `LW6_DISPLAY_DEBUG_GRADIENT' -- XML key: `display-debug-gradient' Type: boolean. Default value: false. Set this to 'true' to display the gradient, this is usefull to debug the core algorithm or understand how it works. 4.12.14 display-debug-zones --------------------------- -- Command-line option: `--display-debug-zones=' -- Environment variable: `LW6_DISPLAY_DEBUG_ZONES' -- XML key: `display-debug-zones' Type: boolean. Default value: false. Set this to 'true' to display the zones, this is usefull to debug the core algorithm or understand how it works. 4.12.15 display-fighters ------------------------ -- Command-line option: `--display-fighters=' -- Environment variable: `LW6_DISPLAY_FIGHTERS' -- XML key: `display-fighters' Type: boolean. Default value: true. Debugging option which can be set to 'false' to disable the display of fighters when playing. 4.12.16 display-fps ------------------- -- Command-line option: `--display-fps=' -- Environment variable: `LW6_DISPLAY_FPS' -- XML key: `display-fps' Type: boolean. Default value: false. Set this to 'true' to display the number of frames per second. When this gets too low... play a smaller map, buy a new computer or contribute and hack Liquid War 6 so that it runs faster! 4.12.17 display-hud ------------------- -- Command-line option: `--display-hud=' -- Environment variable: `LW6_DISPLAY_HUD' -- XML key: `display-hud' Type: boolean. Default value: true. Decides wether the hud (informations while playing) should be displayed. 4.12.18 display-log ------------------- -- Command-line option: `--display-log=' -- Environment variable: `LW6_DISPLAY_LOG' -- XML key: `display-log' Type: boolean. Default value: true. Set this to 'false' to disable the display of error messages on the screen. Mote that you can miss valuable informations. 4.12.19 display-map ------------------- -- Command-line option: `--display-map=' -- Environment variable: `LW6_DISPLAY_MAP' -- XML key: `display-map' Type: boolean. Default value: true. Debugging option which can be set to 'false' to disable map (level) display when playing. 4.12.20 display-menu -------------------- -- Command-line option: `--display-menu=' -- Environment variable: `LW6_DISPLAY_MENU' -- XML key: `display-menu' Type: boolean. Default value: true. Debugging option which can be set to 'false' to disable the display of menus. 4.12.21 display-mouse --------------------- -- Command-line option: `--display-mouse=' -- Environment variable: `LW6_DISPLAY_MOUSE' -- XML key: `display-mouse' Type: boolean. Default value: true. Set this to 'false' to always hide the mouse pointer. 4.12.22 display-preview ----------------------- -- Command-line option: `--display-preview=' -- Environment variable: `LW6_DISPLAY_PREVIEW' -- XML key: `display-preview' Type: boolean. Default value: true. Decides wether a map preview should be displayed when choosing a level. 4.12.23 display-progress ------------------------ -- Command-line option: `--display-progress=' -- Environment variable: `LW6_DISPLAY_PROGRESS' -- XML key: `display-progress' Type: boolean. Default value: true. Decides wether a progress bar should be displayed when a long operation is realized as a background task. 4.12.24 display-rps ------------------- -- Command-line option: `--display-rps=' -- Environment variable: `LW6_DISPLAY_RPS' -- XML key: `display-rps' Type: boolean. Default value: false. Set this to 'true' to display the number of rounds per second. In theory the game should maintain this constant but in practise it can get low if your computer is too slow or too busy. 4.12.25 display-score --------------------- -- Command-line option: `--display-score=' -- Environment variable: `LW6_DISPLAY_SCORE' -- XML key: `display-score' Type: boolean. Default value: true. Decides wether the score screen should be displayed. 4.12.26 display-splash ---------------------- -- Command-line option: `--display-splash=' -- Environment variable: `LW6_DISPLAY_SPLASH' -- XML key: `display-splash' Type: boolean. Default value: true. Set this to 'false' to disable the display of the splash screen at game startup. 4.12.27 gfx-cpu-usage --------------------- -- Command-line option: `--gfx-cpu-usage=' -- Environment variable: `LW6_GFX_CPU_USAGE' -- XML key: `gfx-cpu-usage' Type: float. Default value: 0.75. Min value: 0. Max value: 1. Percentage of the CPU which will be used by the display thread. It's wise to leave some time to other threads to execute. The OS does it naturally, but setting this helps the whole process by explicitely pausing (sleep call) the display thread. You could change this to a low value if you have lagging games but smooth display. 4.12.28 io-per-sec ------------------ -- Command-line option: `--io-per-sec=' -- Environment variable: `LW6_IO_PER_SEC' -- XML key: `io-per-sec' Type: integer. Default value: 15. Defines the number of calls to input/output functions per second. This can affect speed of menus but also cursors, but won't change the speed of the game itself. It's a cosmectic, comfort option. 4.12.29 loader-sleep -------------------- -- Command-line option: `--loader-sleep=' -- Environment variable: `LW6_LOADER_SLEEP' -- XML key: `loader-sleep' Type: float. Default value: 0.5. Defines how long the loader thread should wait between two polls. Default value should fit in most cases. 4.12.30 log-level ----------------- -- Command-line option: `--log-level=' -- Environment variable: `LW6_LOG_LEVEL' -- XML key: `log-level' Type: integer. Default value: 3. Min value: 0. Max value: 4. Defines the log level, that is, how verbose the program will be regarding logs and console output. 0 (ERROR) is the minimum, only errors are reported. 1 (WARNING) means errors + warnings. 2 (NOTICE) displays most important messages. 3 (INFO) is the default, the log file will contain all messages but debug stuff. 4 (DEBUG) logs everything, including debug informations. 4.12.31 log-timeout ------------------- -- Command-line option: `--log-timeout=' -- Environment variable: `LW6_LOG_TIMEOUT' -- XML key: `log-timeout' Type: integer. Default value: 5000. Delay, in msec, for which a log message will stay displayed on the screen. 4.12.32 memory-bazooka-eraser ----------------------------- -- Command-line option: `--memory-bazooka-eraser=' -- Environment variable: `LW6_MEMORY_BAZOOKA_ERASER' -- XML key: `memory-bazooka-eraser' Type: boolean. Default value: true. The memory eraser is a tool which will systematically fill allocated memory with 'M', and overwrite all allocated bytes with 'F' before freeing memory. It will even handle realloc calls. This is usefull to track bugs. Indeed, with this option enabled, freshly allocated memory will never contain zeroes unless one calls calloc, and if you ever free some memory zone before being done with it, it will be filled with junk and therefore not be usable. The memory bazooka must be big enough if you want this feature to actually work. 4.12.33 memory-bazooka-size --------------------------- -- Command-line option: `--memory-bazooka-size=' -- Environment variable: `LW6_MEMORY_BAZOOKA_SIZE' -- XML key: `memory-bazooka-size' Type: integer. Default value: 100000. The memory bazooka is a brute-force tool, conceived after a full night spent tracking some memory leak. The idea is to keep a track of all allocated pointers, when the data was allocated (timestamp), where in the code (file, line), and even point out what data there is in that place. A memory bazooka report at the end of the game will just show what's left. There should be nothing. This parameter is here to avoid wasting CPU cycles on a feature which is very debug-oriented and does not really make sense for the casual user. Set it to 0 for best performance, something like 100 might just be helpfull, but 1000000 is the right way to seriously debug code. 4.12.34 modules --------------- -- Command-line option: `--modules' -- Environment variable: `LW6_MODULES' Tells which modules have been enabled when the game was compiled. It's still possible to add or remove modules afterwards, but this option allows you to know how things were at first. 4.12.35 pedigree ---------------- -- Command-line option: `--pedigree' -- Environment variable: `LW6_PEDIGREE' Display all build values, these are general constants which can help debugging, tracing what binary you are running, and so on. It's a good idea to take a look at the output of 'pedigree' if you have problems running the game. 4.12.36 pilot-lag ----------------- -- Command-line option: `--pilot-lag=' -- Environment variable: `LW6_PILOT_LAG' -- XML key: `pilot-lag' Type: integer. Default value: 10. Maximum lag, in rounds, until the game engine is slowed down. This will typically be usefull if your computer is too slow for the map resolution and the game speed you set up. 4.12.37 quick-start ------------------- -- Command-line option: `--quick-start' -- Environment variable: `LW6_QUICK_START' Start the game just like if the player had requested a quick start, without showing any menu. 4.12.38 reset ------------- -- Command-line option: `--reset' -- Environment variable: `LW6_RESET' Clears the config file so that the game will run with defaults next time. The idea is to get rid of traces of previous executions. The difference with '-defaults' is that '-reset' does not run the game, while '-defaults' does. 4.12.39 server -------------- -- Command-line option: `--server' -- Environment variable: `LW6_SERVER' Start the game in server mode, without requiring any graphics backend. 4.12.40 target -------------- -- Command-line option: `--target' -- Environment variable: `LW6_TARGET' Display all known system target properties, including os and cpu informations. 4.12.41 target-fps ------------------ -- Command-line option: `--target-fps=' -- Environment variable: `LW6_TARGET_FPS' -- XML key: `target-fps' Type: integer. Default value: 60. Defines how many frames will be displayed per second. Of course this is a maximum value, if your hardware can't keep up with this value, display will just be slow, no matter what value you define here. Note that you might really wish to have something rather low here, to keep network and 'logic' function responsiveness. Passed 60 frames per second, speed is really only for visual comfort, as Liquid War 6 is now so fast-paced that it requires 200 frames/sec to outperform opponents. 4.13 Script hooks ================= 4.14 C to Guile API =================== 4.15 C functions ================ This section lists all documented C functions in the program. It contains many references and is self-generated from C comments using gdoc (http://josefsson.org/gdoc/) by Simon Josefsson (http://josefsson.org/). In order to reduce the number of pages of printed output, this complete reference is, by default, disabled in printable versions of the documentation (PostScript, PDF). This is both to make the manual more readable and to avoid wasting paper. Think about the environment. It is however available in the HTML version of the documentation, which you can read online (http://www.gnu.org/software/liquidwar6/manual/html_node/C-functions.html). 4.15.1 libbot ------------- -- Function: void lw6_release () Functions which will call `quit'(), `free'(), `destroy'() on whatever smob object that has threads and/or requires hardware ressources. This is to be called before the Guile interpreter ends. This is because when it garbage collects objects at the end of the program, it has no idea of what order to use when freeing objects. So if an object which uses another one in a thread is freed after the other is freed, you get a (rather unexplainabled if not warned) segfault. *Return value:* none -- Function: void lw6_exit () Will exit the program. If there are some display objects alive, that is if there's a display activated, it will find them and send a quit event, giving a chance to the to exit cleanly. If not, it will just call `exit'() directly. *Return value:* none -- Function: int lw6_main (int ARGC, char * [] ARGV) ARGC: the argc parameter of the `main'() function, that is, the number of command-line args. ARGV: the argv parameter of the `main'() function, that is, an array containing pointers on command-line args. This function is directly called by `main'(). This means by linking against libliquidwar6 and calling it, you would have a program that is almost exactly the "official" upstream liquidwar6 binary, except you can tweak it and have all the power to call whatever other functions you like, embed it. In short, everything the binary does, you can do it in your own binarn, by linking against the library and calling this function. *Return value:* 1 if success, zero if failure. Note that this is the "standard" C / liquidwar6 way to proceed, but your `main'() function should return 0 if success, else an error code. Typical use is "return !lw6_main(argc, argv);". -- Function: int lw6_process_non_run_options (int ARGC, char * [] ARGV, int * RUN_GAME) ARGC: the number of command-line args, as passed to `main()' ARGV: an array of strings containing command-line args, as passed to `main()' RUN_GAME: a pointer to a boolean which will contain true (1) if the game must be launched, or false (0) if the option is such that game must be skipped. Example: -copyright, -help, ... *Return value:* non-zero if success, 0 if error. The error can be, for instance, the test suite returning "no, tests were not OK". 4.15.2 libbot ------------- 4.15.3 libcfg ------------- -- Function: int lw6cfg_parse_command_line (void * CONTEXT) CONTEXT: opaque pointer on a context Overwrites any existing option with command line args *Return value:* 1 if success, 0 if error -- Function: int lw6cfg_defaults (void * CONTEXT) CONTEXT: opaque pointer on a context Sets all values to their defaults. *Return value:* 1 if success, 0 if error -- Function: int lw6cfg_merge_env (void * CFG_CONTEXT) CFG_CONTEXT: a context returned by `lw6cfg_init' Overwrites any existing vale in the config with environment variables prefixed by LW6_. *Return value:* 1 if successfull, 0 if error. -- Function: char * lw6cfg_format (char * KEY, char * VALUE, lw6hlp_type_t TYPE) KEY: the key of the value to format VALUE: the value to format TYPE: the type of the value to format Formats, converts, a given value to its cannonical representation. Booleans will be converted to true/false, strings containing integers will be stripped from junk, and so on. This is a performance killer but will ensure everything is correct. *Return value:* a newly allocated string, containing the same as the input, but reformatted the pedantic way. -- Function: char * lw6cfg_format_guess_type (char * KEY, char * VALUE) KEY: the key of the value to format VALUE: the value to format Formats, converts, a given value to its cannonical representation. Booleans will be converted to true/false, strings containing integers will be stripped from junk, and so on. This is a performance killer but will ensure everything is correct. This function will automatically guess the type of the value from its description in the help system. *Return value:* a newly allocated string, containing the same as the input, but reformatted the pedantic way. -- Function: int lw6cfg_load (void * CFG_CONTEXT, char * FILENAME) CFG_CONTEXT: a context returned by `lw6cfg_init' FILENAME: a file path, absolute or relative Loads the given config file, and stores its values into the current context. Parameters which are both in the config file and given as command line parameters, will be taken from the command-line. *Return value:* 1 if successfull, 0 if error. -- Function: int lw6cfg_save (void * CFG_CONTEXT, char * FILENAME) CFG_CONTEXT: a context returned by `lw6cfg_init' FILENAME: a file path, absolute or relative Save current options into the given config file. Before saving the file, all command line arguments will be read and will override current values. This means the saved file will contain values given as command line arguments. *Return value:* 1 if successfull, 0 if error. -- Function: void * lw6cfg_init (int ARGC, char * [] ARGV) ARGC: number of command line arguments, as given to `main' ARGV: a list of command line arguments, as given to `main' Initializes a config context object. This object is hidden behind an opaque void * pointer to avoid direct access to its elements. *Return value:* an opaque pointer, must be freed with `lw6cfg_quit'. -- Function: void lw6cfg_quit (void * CFG_CONTEXT) CFG_CONTEXT: a context returned by `lw6cfg_init' Frees a config cfg_context object. You must call this once you're done with the context. *Return value:* none. -- Function: void lw6cfg_reset (int ARGC, char * [] ARGV) ARGC: number of command line arguments, as given to `main' ARGV: a list of command line arguments, as given to `main' Overwrites the config file with defaults. Use this to get rid of old configurations. -- Function: char * lw6cfg_unified_get_value (int ARGC, char * [] ARGV, char * KEY) ARGC: number of command-line args, as passed to `main' ARGV: arry of command-line args, as passed to `main' KEY: the key to query Unified "value" getter, which gets informations from environment variables, command line, and config file. The rules is that the command-line argument always has the last word. It will override any other value. Follows environment variables, which will be used if no command-line argument is supplied. Note that these are "LW6_" prefixed and uppercased environment variables as opposed to lowercased and "dash-separated" keys. Finally, if there's no environment variable, nor any config-file corresponding entry, the value will be searched in the config file. If there's no information in the config file, NULL is returned. *Return value:* a string with the value. Can be NULL. Must be freed. -- Function: char * lw6cfg_unified_get_user_dir (int ARGC, char * [] ARGV) ARGC: number of command-line args, as passed to `main' ARGV: arry of command-line args, as passed to `main' Gets the user dir, taking all parameters in account, that's to say the "LW6_USER_DIR" env value, the "-user-dir" command-line paramater and the LW6DEF_USER_DIR config file entry. *Return value:* the directory path, might be NULL, must be freed. -- Function: char * lw6cfg_unified_get_log_file (int ARGC, char * [] ARGV) ARGC: number of command-line args, as passed to `main' ARGV: arry of command-line args, as passed to `main' Gets the log file, taking all parameters in account, that's to say the "LW6_LOG_FILE" env value, the "-log-file" command-line paramater and the LW6DEF_LOG_FILE config file entry. *Return value:* the directory path, might be NULL, must be freed. -- Function: char * lw6cfg_unified_get_map_path (int ARGC, char * [] ARGV) ARGC: number of command-line args, as passed to `main' ARGV: arry of command-line args, as passed to `main' Gets the user dir, taking all parameters in account, that's to say the "LW6_MAP_PATH" env value, the "-map-path" command-line paramater and the LW6DEF_MAP_PATH config file entry. *Return value:* the directory path, might be NULL, must be freed. 4.15.4 libcli ------------- 4.15.5 libcns ------------- 4.15.6 libdsp ------------- -- Function: lw6dsp_backend_t * lw6dsp_create_backend (int ARGC, char * [] ARGV, char * GFX_BACKEND_NAME) ARGC: argc as passed to `main' ARGV: argv as passed to `main' GFX_BACKEND_NAME: the id/name of the gfx backend to use Creates a dsp_backend object. The created object won't be displaying things until `lw6dsp_init' is called. No thread is created, but the graphics backend is loaded into memory. If video mode is not available, it will appear later, when trying to start displaying things, this function only allocates memory and checks code is available in case of a dynamically loaded gfx backend. *Return value:* a newly allocated object. -- Function: void lw6dsp_destroy_backend (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend object to free Frees all ressources used by a dsp_backend object. Note that you must call this on a inactive 'stopped' dsp_backend object. *Return value:* none. -- Function: char * lw6dsp_repr (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the object to represent Gives a short human-readable description of the object. *Return value:* a newly allocated string, must be freed. -- Function: int lw6dsp_init (lw6dsp_backend_t * DSP_BACKEND, lw6dsp_param_t * PARAM, lw6gui_resize_callback_func_t RESIZE_CALLBACK) DSP_BACKEND: the dsp_backend to start PARAM: parameters to pass to the display funcs RESIZE_CALLBACK: a function which will be called when there's a resize event Starts a dsp_backend object, that is, fire a separate thread and start rendering. This will set up a video mode, so it's very likely to fail if for some reason the video context isn't right, for instance if you try to set up graphical stuff but only have console access. *Return value:* 1 if success, 0 if error. -- Function: void lw6dsp_quit (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend to stop Stops a dsp_backend, that is, cancel rendering and unset the video mode, hardware shouldn't be used any more after this call. *Return value:* none. -- Function: int lw6dsp_update (lw6dsp_backend_t * DSP_BACKEND, lw6dsp_param_t * PARAM) DSP_BACKEND: the dsp_backend to update PARAM: parameters to pass to the dsp_backend funcs Passes a new set of parameters to the display function. This is in fact the only way to pass informations to the dsp_backend object once it's been started. This function will acquire a mutex, copy parameters, then give control back to the main thread while display keeps on going with new parameters in the background. It will get input informations. You really must call it often otherwise the screen won't get updated, or, at least, it will always display the same informations. It should be reasonnable to call this 10 or 20 times per second, the display itself can be faster, run at 60 or 100 fps to show smooth animation (eye candy). *Return value:* 1 if success, 0 if error. -- Function: int lw6dsp_get_nb_frames (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend to query Returns the number of frames displayed since the display was started. *Return value:* the number of frames displayed. -- Function: int lw6dsp_get_last_frame_rendering_time (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend to query Returns the rendering time of the last frame. Gives clues about performance. *Return value:* the number of milliseconds it took to draw screen -- Function: int lw6dsp_get_instant_fps (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend to query Returns the current frames per sec display rate. This is the instant value, it changes very often even if display seems smooth. *Return value:* the current instant display rate. -- Function: int lw6dsp_get_average_fps (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend to query Returns the current frames per sec display rate. This is not absolutely accurate but fits for displaying info to the player, it's an average. *Return value:* the current averaged display rate. -- Function: int lw6dsp_get_video_mode (lw6dsp_backend_t * DSP_BACKEND, lw6gui_video_mode_t * VIDEO_MODE) DSP_BACKEND: the dsp_backend to query VIDEO_MODE: a structure which will contain the results Returns the current video mode, the one obtained by the driver. This function is also a way to know wether display is running correcly or not, by testing its return value. *Return value:* 1 if ok, 0 if failure (mode not set) -- Function: int lw6dsp_get_fullscreen_modes (lw6dsp_backend_t * DSP_BACKEND, lw6gui_fullscreen_modes_t * FULLSCREEN_MODES) DSP_BACKEND: the dsp_backend to query FULLSCREEN_MODES: a structure which will contain the results Returns the current available fullscreen modes. Note that this one will only work if display is started, unlike `lw6gfx_get_fullscreen_modes' which is used internally. The reason is that in this dsp module context, we need the thread to be launched, and the thread does start/stop display on its own. *Return value:* 1 if ok, 0 if failure (mode not set) -- Function: void lw6dsp_param_zero (lw6dsp_param_t * PARAM) PARAM: the structure to initialize Fills a display param struct with zeros, this is mandatory before any use. Think of it as a raw memset. *Return value:* none. -- Function: int lw6dsp_test () Runs the test suite for the dsp module. *Return value:* 1 if OK, 0 if error. 4.15.7 libdyn ------------- -- Function: lw6dyn_dl_handle_t * lw6dyn_dlopen_backend_so (char * SO_FILE) Opens a .so file directly, using a valid (full) path name. *Return value:* a handle to the module, once it's opened. You might still need to call a module specific `init'() function, but it's another story. -- Function: lw6dyn_dl_handle_t * lw6dyn_dlopen_backend (int ARGC, char * [] ARGV, char * TOP_LEVEL_LIB, char * BACKEND_NAME) ARGC: the number of command-line arguments as passed to `main' TOP_LEVEL_LIB: the top-level library concerned, this means is it "cli", "gfx", "snd" or "srv". This will tell the function to search for the .so file in the correct subdirectory. Think of this as a category. Opens a .so file corresponding to the given backend, it is capable to search for system libraries installed after "make install" but if not found, it will also search in the current build directory, finding the .so files in hidden .libs subdirectories. *Return value:* a handle to the module, once it's opened. You might still need to call a module specific `init'() function, but it's another story. -- Function: int lw6dyn_dlclose_backend (lw6dyn_dl_handle_t * HANDLE) HANDLE: the backend to close. Closes an opened backend. Note that you must call any backend specific clear, destroy, deinit, exit, function before. *Return value:* 1 if success, 0 on error. -- Function: void * lw6dyn_dlsym (lw6dyn_dl_handle_t * HANDLE, char * FUNC_NAME) HANDLE: the backend concerned FUNC_NAME: the function name, as a NULL terminated string Finds a C function in the given backend. *Return value:* a pointer to the function, NULL if not found. -- Function: lw6sys_assoc_t * lw6dyn_list_backends (int ARGC, char * [] ARGV, char * TOP_LEVEL_LIB) ARGC: the number of command line args, as passed to main ARGV: the commind line args, as passed to main TOP_LEVEL_LIB: the library category to query (gfx, snd, cli, srv ...) Returns an assoc which lists all the available modules. The key of the assoc entries in the module internal name such as 'gl' and the value associated is a NULL terminated string describing the module, for instance 'OpenGL'. *Return value:* an assoc object containing key/label pairs. -- Function: char * lw6dyn_path_find_backend (int ARGC, char * [] ARGV, char * TOP_LEVEL_LIB, char * BACKEND_NAME) ARGC: the number of command-line arguments as passed to `main' TOP_LEVEL_LIB: the top-level library concerned, this means is it "cli", "gfx", "snd" or "srv". This will tell the function to search for the .so file in the correct subdirectory. Think of this as a category. BACKEND_NAME: the actual name of the backend, this is the name of the .so file, between "libmod_" and ".so". For instance, to find "libmod_gl.so", the right argument is "gl". Get the full path to a .so file corresponding to the given backend, it is capable to search for system libraries installed after "make install" but if not found, it will also search in the current build directory, finding the .so files in hidden .libs subdirectories. *Return value:* the full path of the .so file, needs to be freed. -- Function: int lw6dyn_test () Runs the `dyn' module test suite, testing most (if not all...) functions. Will try to load libraries and query them for standard LW6-expected functions. *Return value:* 1 if test is successfull, 0 on error. 4.15.8 libgfx ------------- -- Function: int lw6gfx_init (lw6gfx_backend_t * BACKEND, lw6gui_video_mode_t * VIDEO_MODE, lw6gui_resize_callback_func_t RESIZE_CALLBACK) BACKEND: the graphical backend to use VIDEO_MODE: the video mode to use at start up RESIZE_CALLBACK: a callback function which will be called at each resize event Sets up the graphical backend for good, initializing a video mode and allocating ressources. This call can typically fail if there's no device available, if the user doesn't have enough rights to access the hardware, and so on. *Return value:* 1 on success, 0 if not -- Function: void lw6gfx_quit (lw6gfx_backend_t * BACKEND) BACKEND: the backend to free Uninitializes the backend, that is, exits the graphical mode. All threads that use graphics must be closed when this is called. *Return value:* none. -- Function: char * lw6gfx_repr (lw6gfx_backend_t * BACKEND) BACKEND: the backend to represent Returns a readable version of the backend object. *Return value:* a newly allocated pointer. -- Function: int lw6gfx_set_video_mode (lw6gfx_backend_t * BACKEND, lw6gui_video_mode_t * VIDEO_MODE) BACKEND: the backend to use VIDEO_MODE: the new video mode This function changes the video mode. Note that the first time you set up the graphical environment you must call `lw6gfx_init' but to change the current mode, use this function. It should reload backend data automatically if needed (textures for instance). Note that before giving up and failing this function will try alternate video modes, and you're not garanteed to have the right mode after the call, even if it returns true. To check this, use `lw6gfx_get_video_mode'. *Return value:* 1 on success, 0 on failure; -- Function: int lw6gfx_get_video_mode (lw6gfx_backend_t * BACKEND, lw6gui_video_mode_t * VIDEO_MODE) BACKEND: the backend to use VIDEO_MODE: the current video mode (will be overwritten, out parameter) This function returns the current video mode. *Return value:* 1 on success, 0 on failure; -- Function: int lw6gfx_get_fullscreen_modes (lw6gfx_backend_t * BACKEND, lw6gui_fullscreen_modes_t * FULLSCREEN_MODES) BACKEND: the backend to use FULLSCREEN_MODES: the available fullscreen modes (will be overwritten, out parameter) This function returns the current video mode. *Return value:* 1 on success, 0 on failure; -- Function: lw6gui_input_t * lw6gfx_pump_events (lw6gfx_backend_t * BACKEND) BACKEND: the backend to use This function "pumps" events, that is gets pending events, puts them in queues, maintains internal states up to date. You really must call this very often or no input will be processed at all. *Return value:* a pointer on the internal input state, musn't be freed. -- Function: int lw6gfx_display (lw6gfx_backend_t * BACKEND, int MASK, lw6gui_look_t * LOOK, lw6map_level_t * LEVEL, lw6ker_game_struct_t * GAME_STRUCT, lw6ker_game_state_t * GAME_STATE, lw6gui_main_cursor_t * MAIN_CURSOR, lw6gui_menu_t * MENU, float PROGRESS, float FPS, float RPS, char ** LOG_LIST, int DEBUG_TEAM_ID, int DEBUG_LAYER_ID) BACKEND: the graphical backend to use MASK: display flag, tells what to display LOOK: the look, the skin, contains display options LEVEL: the level to display GAME_STRUCT: the game_struct associated with the level GAME_STATE: the game_state associated with the level MAIN_CURSOR: the cursor to center the focus on MENU: the menu to display PROGRESS: the value of the progress indicator FPS: the number of frames per second to display RPS: the number of rounds per second to display LOG_LIST: log messages to display DEBUG_TEAM_ID: for debug display, team to display informations about DEBUG_LAYER_ID: for debug display, layer to display This is the major drawing function, the one that encapsulates all others. As the program uses a separate thread to display things, we just pass this function many parameters, and let it do its job alone. So many parameters might sometimes be useless. It also allows the graphics backend decide wether menus and hud and background should interact. Or not. *Return value:* 1 on success, 0 on failure. 4.15.9 libgui ------------- -- Function: void lw6gui_button_register_down (lw6gui_button_t * BUTTON, int64_t TIMESTAMP) BUTTON: the button to update TIMESTAMP: the current ticks (milliseconds) Registers a "down" (press) event on a button. *Return value:* none. -- Function: void lw6gui_button_register_up (lw6gui_button_t * BUTTON) BUTTON: the button to update Registers a "up" (release) event on a button. *Return value:* none. -- Function: int lw6gui_button_is_pressed (lw6gui_button_t * BUTTON) BUTTON: the button to query Tells wether a button is pressed or not. *Return value:* 1 if pressed, 0 if not. -- Function: int lw6gui_button_pop_press (lw6gui_button_t * BUTTON) BUTTON: the button to query Tells how many times the button has been pressed. Typical usage: the button is pressed, released, pressed, released several times. Then, after all this, you want to know how many times it has been pressed. Querying its state with `lw6gui_button_is_pressed' won't tell you much but this `pop_press' function will return 1 for each press there's been. *Return value:* 1 if there's a press event in the queue, 0 if empty. -- Function: void lw6gui_button_update_repeat (lw6gui_button_t * BUTTON, lw6gui_repeat_settings_t * REPEAT_SETTINGS, int64_t TIMESTAMP) BUTTON: the button to update REPEAT_SETTINGS: the repeat settings (delay + interval) TIMESTAMP: the current ticks (milliseconds) Updates the repeat informations for a button, must be called regularly, as often as possible. *Return value:* none. -- Function: int lw6gui_button_sync (lw6gui_button_t * DST, lw6gui_button_t * SRC) DST: the target button object SRC: the source button object Synchronizes two button objects. This is typically used to pass data from one thread to another. This is not a simple copy, it will handle data such as "when was it pressed last" it an intelligent manner, popping src data to put it in dst, and clearing src. *Return value:* 1 if success, O if failure. -- Function: int lw6gui_coord_calc_xy (float * DST_X, float * DST_Y, float DST_X0, float DST_Y0, float DST_W, float DST_H, float SRC_X, float SRC_Y, float SRC_X0, float SRC_Y0, float SRC_W, float SRC_H) DST_X: the x coord to return DST_Y: the y coord to return DST_X0: the x coord of point 0 in destination coord system DST_Y0: the y coord of point 0 in destination coord system DST_W: the width of the area in destination coord system DST_H: the width of the area in destination coord system SRC_X: the x coord in source coord system SRC_Y: the y coord in source coord system SRC_X0: the x coord of point 0 in source coord system SRC_Y0: the y coord of point 0 in source coord system SRC_W: the width of the area in source coord system SRC_H: the width of the area in source coord system Registers a "down" (press) event on a button. *Return value:* none. -- Function: int lw6gui_input_init (lw6gui_input_t * INPUT) INPUT: the input struct to initialise Initialises an input structure, don't use twice, it won't free a previous init. *Return value:* a pointer to the newly allocated object. -- Function: void lw6gui_input_quit (lw6gui_input_t * INPUT) INPUT: the input struct to uninitialise Unitialises an input structure, need to call it to free event queue. *Return value:* a pointer to the newly allocated object. -- Function: lw6gui_input_t * lw6gui_input_new () Creates an input structure, which can be used to handle input state & buffer. *Return value:* a pointer to the newly allocated object. -- Function: void lw6gui_input_free (lw6gui_input_t * INPUT) INPUT: the input object to free. Deletes an input structure. *Return value:* none. -- Function: int lw6gui_input_reset (lw6gui_input_t * INPUT) INPUT: the input struct to reset Resets an input structure. Must have been initialized before. It will empty all queues and mark everything as unpressed. *Return value:* 1 on success, 0 if failure. -- Function: void lw6gui_input_update_repeat (lw6gui_input_t * INPUT, lw6gui_repeat_settings_t * REPEAT_SETTINGS, int64_t TIMESTAMP) INPUT: the input to update REPEAT_SETTINGS: the repeat settings (delay + interval) TIMESTAMP: the current ticks (milliseconds) Updates the repeat informations for an input, must be called regularly, as often as possible. *Return value:* none. -- Function: void lw6gui_input_register_change (lw6gui_input_t * INPUT) INPUT: the input to update Tells an input object that one of its descendants has been modified. This will affect the return value of `lw6gui_input_need_sync' *Return value:* none. -- Function: int lw6gui_input_need_sync (lw6gui_input_t * INPUT) INPUT: the input to test Tests wether an input object contains was modified and needs synchronisation. *Return value:* 1 if sync is need, 0 if not. -- Function: int lw6gui_input_sync (lw6gui_input_t * DST, lw6gui_input_t * SRC) DST: the target input object SRC: the source input object Synchronizes two input objects. This is typically used to pass data from one thread to another. This is not a copy, it will brute-force copy the static data such as mouse position, but anything like a queue will be treated in a "empty source and fill target with data" scheme. So source will be affected by this, the key buffer will be emptied, and so on. And if there are key in the target buffer, they won't be overwritten but kept in front of the FIFO list. *Return value:* 1 if success, O if failure. -- Function: int lw6gui_input_poll_quit (lw6gui_input_t * INPUT) INPUT: the input to query Asks the display manager wether a quit event (usually CTRL-C or click on close button) has been detected. *Return value:* 1 if quit was receivedm 0 if not -- Function: void lw6gui_input_send_quit (lw6gui_input_t * INPUT) INPUT: the input to send an event to Artificially send a QUIT event (equivalent of CTRL-C or click on close button). This allow a uniform treatment of game stopping. *Return value:* none -- Function: int lw6gui_joystick_check_index (int I) I: index to check Checks wether the index is correct. Does not mean the joystick exists, it's just to avoid out of bounds errors. *Return value:* 1 if within range, 0 if not. -- Function: void lw6gui_joystick_update_axis_x (lw6gui_joystick_t * JOYSTICK, int X, int LIMIT, int64_t TIMESTAMP) JOYSTICK: joystick to update X: x-axis position, as returned by the driver LIMIT: the limit, under this, buttons are considered unpressed. TIMESTAMP: current ticks (timestamp in ms) Updates the x axis of a joystick, this will convert an information of analog type such as "joystick is here" to a pad-like information such as "pressed in that direction". *Return value:* 1 if within range, 0 if not. -- Function: void lw6gui_joystick_update_axis_y (lw6gui_joystick_t * JOYSTICK, int Y, int LIMIT, int64_t TIMESTAMP) JOYSTICK: joystick to update LIMIT: the limit, under this, buttons are considered unpressed. TIMESTAMP: current ticks (timestamp in ms) Updates the y axis of a joystick, this will convert an information of analog type such as "joystick is here" to a pad-like information such as "pressed in that direction". *Return value:* 1 if within range, 0 if not. -- Function: void lw6gui_joystick_update_repeat (lw6gui_joystick_t * JOYSTICK, lw6gui_repeat_settings_t * REPEAT_SETTINGS, int64_t TIMESTAMP) JOYSTICK: the joystick to update REPEAT_SETTINGS: the repeat settings (delay + interval) TIMESTAMP: the current ticks (milliseconds) Updates the repeat informations for a joystick, must be called regularly, as often as possible. *Return value:* none. -- Function: int lw6gui_joystick_sync (lw6gui_joystick_t * DST, lw6gui_joystick_t * SRC) DST: the target joystick object SRC: the source joystick object Synchronizes two joystick objects. This is typically used to pass data from one thread to another. *Return value:* 1 if success, O if failure. -- Function: void lw6gui_joystick_get_move_pad (lw6gui_joystick_t * JOYSTICK, lw6gui_move_pad_t * MOVE_PAD) JOYSTICK: the joystick to query MOVE_PAD: the structure which will contain the results Returns the state of the joystick in a uniform, non-device specific structure containing only the up/down/left/right information. *Return value:* none, the value are stored in `move_pad'. -- Function: int lw6gui_keyboard_check_keysym (int KEYSYM) KEYSYM: the keysym to check Tells wether the keysym is valid or not. *Return value:* 1 if valid, 0 if not -- Function: lw6gui_keypress_t * lw6gui_keyboard_pop_keypress (lw6gui_keyboard_t * KEYBOARD) KEYBOARD: the keyboard structure which stores keyboard state Pops (in FIFO mode) a keypress stored in the keyboard buffer. You must free the obtained keypress object after you're done with it. *Return value:* a newly allocated pointer, or NULL if no keypress pending. -- Function: int lw6gui_keyboard_is_pressed (lw6gui_keyboard_t * KEYBOARD, int KEYSYM) KEYBOARD: the keyboard structure which stores keyboard state Tells wether a key is pressed or not. The function will test out of bound values. *Return value:* 1 if pressed, 0 if not. -- Function: int lw6gui_keyboard_register_key_down (lw6gui_keyboard_t * KEYBOARD, int KEYSYM, int UNICODE, char * LABEL, int64_t TIMESTAMP) KEYBOARD: the keyboard structure which will store the keypress KEYSYM: the keysym for the keypress UNICODE: the ASCII/unicode code for the keypress LABEL: the label for the keypress TIMESTAMP: the current ticks (timestamp in ms) Registers a keypress event, that is, puts it in the event queue. This function does not take an `lw6gui_keypress_t' structure but separated args, this is because it will construct the object internally. You may free `label' after calling this, an internal copy will be done. This function will also maintain the array of key states up to date. *Return value:* 1 if success, O if failure. -- Function: int lw6gui_keyboard_register_key_up (lw6gui_keyboard_t * KEYBOARD, int KEYSYM) KEYBOARD: the keyboard structure which will store the keypress KEYSYM: the keysym for the keypress Registers a key release event. *Return value:* 1 if success, O if failure. -- Function: void lw6gui_keyboard_update_repeat (lw6gui_keyboard_t * KEYBOARD, lw6gui_repeat_settings_t * REPEAT_SETTINGS, int64_t TIMESTAMP) KEYBOARD: the keyboard to update REPEAT_SETTINGS: the repeat settings (delay + interval) TIMESTAMP: the current ticks (milliseconds) Updates the repeat informations for a keyboard, must be called regularly, as often as possible. *Return value:* none. -- Function: int lw6gui_keyboard_sync (lw6gui_keyboard_t * DST, lw6gui_keyboard_t * SRC) DST: the target keyboard object SRC: the source keyboard object Synchronizes two keyboard objects. This is typically used to pass data from one thread to another. Will pop the src queue to fill the dst queue. *Return value:* 1 if success, O if failure. -- Function: void lw6gui_keyboard_get_move_pad (lw6gui_keyboard_t * KEYBOARD, lw6gui_move_pad_t * MOVE_PAD) KEYBOARD: the keyboard to query MOVE_PAD: the structure which will contain the results Returns the state of the keyboard in a uniform, non-device specific structure containing only the up/down/left/right information. *Return value:* none, the value are stored in `move_pad'. -- Function: lw6gui_keypress_t * lw6gui_keypress_new (int KEYSYM, int UNICODE, char * LABEL) KEYSYM: the keysym to use UNICODE: the unicode value for this keysym LABEL: the label (optional, might be NULL) Creates a keypress structure, the only reason for needing a contructor is that the label field needs be duplicated. *Return value:* a pointer to the newly allocated object. -- Function: void lw6gui_keypress_free (lw6gui_keypress_t * KEYPRESS) KEYPRESS: the keypress object to free. Deletes a keypress structure. *Return value:* none. -- Function: char * lw6gui_keypress_repr (lw6gui_keypress_t * KEYPRESS) KEYPRESS: the keypress to work on Returns a human-readable representation of the keypress. *Return value:* a newly allocated string -- Function: lw6gui_menu_t * lw6gui_menu_new (char * TITLE, char * ESC, int ENABLE_ESC) TITLE: the string to be displayed, what the user sees. Can be freed after the call is done, function will make a copy internally. ESC: the label to be displayed in the ESC button ENABLE_ESC: wether to enable the escape button. Constructs a new menu object. Note that you can always call other functions to modify it afterwards. *Return value:* a pointer to the newly allocated object. -- Function: void lw6gui_menu_free (lw6gui_menu_t * MENU) MENU: a pointer to the menu. Frees the menu, checking if things are OK before doing so. *Return value:* none. -- Function: int lw6gui_menu_memory_footprint (lw6gui_menu_t * MENU) MENU: a pointer to the menu. Gets the memory occupied by the menu. Could be usefull to help a garbage collector taking decisions or reporting erros, for instance. *Return value:* the number of bytes used. -- Function: char * lw6gui_menu_repr (lw6gui_menu_t * MENU) MENU: a pointer to the menu. Constructs a readable description of the object. Usefull for debugging, or to introspect things using scripts, at run-time. Does not necessarly describe all the informations about the object, but helps knowing what it is. *Return value:* a string describing the object, must be freed. -- Function: void lw6gui_menu_set_title (lw6gui_menu_t * MENU, char * TITLE) MENU: a pointer to the menu. TITLE: the new title, you can free it after calling the function, an internal copy will be made. Change the title of the menu. That is to say, its title. Use this function to change the title, don't try to access the struct directly. The idea is to have safe memory management. *Return value:* none -- Function: lw6gui_menuitem_t * lw6gui_menu_get_item (lw6gui_menu_t * MENU, int POSITION) MENU: the menu we want to query POSITION: the order of the item we want Gets the menu item at the given position. First item is 0, last is N-1. Returns a pointer on the real object, not a copy. *Return value:* a pointer to a menu item, NULL if out of range. -- Function: int lw6gui_menu_select (lw6gui_menu_t * MENU, int POSITION, int ALLOW_SCROLL, int64_t NOW) MENU: the menu we want to modify POSITION: the position of the item we want to select ALLOW_SCROLL: wether scrolling should be allowed when displaying it NOW: the current time, as a timestamp. Selects the item at the given position. Use this function to be sure that only one item is selected, and all other states are consistent. Timestamp is needed for the sake of eye-candy. *Return value:* 1 if success, 0 if failure (out of range). -- Function: void lw6gui_menu_select_esc (lw6gui_menu_t * MENU, int STATE, int64_t NOW) MENU: the menu we want to modify STATE: 1 to select, 0 to unselect NOW: the current time, as a timestamp. Selects the escape item, this does not affect other items, it's mostly. to handle eye candy. *Return value:* none. -- Function: void lw6gui_menu_enable_esc (lw6gui_menu_t * MENU, int STATE, int64_t NOW) MENU: the menu we want to modify STATE: 1 to enable, 0 to disable NOW: the current time, as a timestamp. Enables the escape item, this does not affect other items, it's mostly. to handle eye candy. *Return value:* none. -- Function: int lw6gui_menu_scroll_up (lw6gui_menu_t * MENU) MENU: the menu to scroll Scrolls a menu up, used as a callback for mouse wheel up for instance. The idea is just to decrement the first displayed item index. *Return value:* 1 if OK, 0 if failed (out of range). -- Function: int lw6gui_menu_scroll_down (lw6gui_menu_t * MENU) MENU: the menu to scroll Scrolls a menu down, used as a callback for mouse wheel down for instance. The idea is just to increment the first displayed item index. *Return value:* 1 if OK, 0 if failed (out of range). -- Function: void lw6gui_menu_center (lw6gui_menu_t * MENU, int POSITION, int MAX_DISPLAYED_ITEMS) MENU: the menu to center POSITION: the position of the menuitem to be put in the center MAX_DISPLAYED_ITEMS: the maximum number of items displayed Centers the menu on a given menuitem. Typically used when pushing a menu with a menuitem selected 'anywhere' in the list. *Return value:* none. -- Function: int lw6gui_menu_insert (lw6gui_menu_t * MENU, lw6gui_menuitem_t * MENUITEM, int POSITION, int64_t NOW) MENU: the menu we want to modify MENUITEM: the item to insert POSITION: the position the new item will occupy ("insert before" mode) NOW: the current time, as a timestamp. Inserts the given item in the menu. All items starting at the insert position will be "pushed" (that is, their position incremented by 1). Once the menuitem is inserted, the menu object will take care of memory management and automatically free it when needed. *Return value:* 1 if success, 0 if failure (memory problem, out of range). -- Function: int lw6gui_menu_append (lw6gui_menu_t * MENU, lw6gui_menuitem_t * MENUITEM, int64_t NOW) MENU: the menu we want to modify MENUITEM: the item to insert NOW: the current time, as a timestamp. Appends the given item to the menu. Once the menuitem is appended, the menu object will take care of memory management and automatically free it when needed. *Return value:* 1 if success, 0 if failure (memory problem). -- Function: int lw6gui_menu_remove (lw6gui_menu_t * MENU, int POSITION, int64_t NOW) MENU: the menu we want to modify POSITION: the item to insert NOW: the current time, as a timestamp. Removes an item from the menu. It will automatically be freed. *Return value:* 1 if success, 0 if failure (out of range). -- Function: void lw6gui_menu_update_display_range (lw6gui_menu_t * MENU, int MAX_DISPLAYED_ITEMS) MENU: the menu concerned MAX_DISPLAYED_ITEMS: the maximum number of items to display at once Updates the display range. The reason for having this is that the first item, that is, how far we scroll in a very long menu, depends on the previous position. Plus you have to handle limit cases (begin/end). Thus, this function, which will automatically pick-up a suitable position. Of course, `first_item_displayed' is not necessarly equal to `selected_item'. *Return value:* none. -- Function: int lw6gui_menu_insert_for_id_use (lw6gui_menu_t * MENU, char * LABEL, int VALUE, int ENABLED, int SELECTED, int COLORED, int POSITION, int64_t NOW) MENU: the menu to work on LABEL: the label of the menuitem to append VALUE: the value of the menuitem to append ENABLED: wether the inserted menuitem should be enabled SELECTED: wether the inserted menuitem should be selected COLORED: wether the inserted menuitem should use value as its color NOW: current time (timestamp) Inserts a menu item at the given position. The idea is that the menu item object is automatically constructed on the fly, and an id is returned, which can be passed to '_using_id' menu-related functions. This is typically for using in scripts. The idea is that the script just keeps a copy of the id returned, and can this way operate directly on the menuitem without keeping a pointer, a smob or anything internally. From the C point of view, having a real C structure enables persistent data from one display to the other, and this is nice and conveninent. I acknowledge the prototype is scary. *Return value:* 0 if error, or else an id which will later be used with '_using_id' functions. -- Function: int lw6gui_menu_append_for_id_use (lw6gui_menu_t * MENU, char * LABEL, int VALUE, int ENABLED, int SELECTED, int COLORED, int64_t NOW) MENU: the menu to work on LABEL: the label of the menuitem to append VALUE: the value of the menuitem to append ENABLED: wether the appended menuitem should be enabled SELECTED: wether the appended menuitem should be selected COLORED: wether the appended menuitem should use value as its color NOW: current time (timestamp) Appends a menuitem using the same logic as `lw6gui_menu_insert_for_id_use' that is to say a parameter is returned which can later be used to directly operate on a given menuitem, without having its pointer, and even if its position changes. *Return value:* 0 if error, or else an id which will later be used with '_using_id' functions. -- Function: int lw6gui_menu_remove_using_id (lw6gui_menu_t * MENU, int MENUITEM_ID, int64_t NOW) MENU: the menu to work on MENUITEM_ID: the id of the menuitem to remove NOW: current time (timestamp) Deletes the menuitem with the given id. Very important: the id is not the position. Id are arbitrary numbers that stick to menuitems, but they are not directly linked with the position. This function is practical to use if, for some reason, you don't have the pointer on the menuitem. *Return value:* 1 if success, 0 if failure (out of range). -- Function: void lw6gui_menu_sync_using_id (lw6gui_menu_t * MENU, int MENUITEM_ID, char * LABEL, int VALUE, int ENABLED, int SELECTED, int COLORED, int64_t NOW) MENU: the menu to work on MENUITEM_ID: the id of the menuitem to synchronize NOW: current time (timestamp) Updates the menuitem with the given id. Very important: the id is not the position. Id are arbitrary numbers that stick to menuitems, but they are not directly linked with the position. This function is practical to use if, for some reason, you don't have the pointer on the menuitem. In practice, it's heavily used in the game to transmit informations from the scripts to the core C engine. Additionnaly, this function will automatically synchronize the `selected_item' field of the menu struct. *Return value:* 1 if success, 0 if failure (out of range). -- Function: int lw6gui_menu_is_same (lw6gui_menu_t * MENU_A, lw6gui_menu_t * MENU_B) MENU_A: first item to compare MENU_B: second item to compare Compares two menus. *Return value:* 1 if they are the same, 0 if not -- Function: lw6gui_menu_t * lw6gui_menu_dup (lw6gui_menu_t * MENU) MENU: the menu to duplicate Duplicates a menu structure. *Return value:* a pointer to the new menu. -- Function: int lw6gui_menu_sync (lw6gui_menu_t * DST, lw6gui_menu_t * SRC) DST: the target menu SRC: the source menu Synchronizes two menus, this supposes that they represent the same menu, but simply in a different state. This function does not really copy src to dst, it has a special behavior, indeed everything is copied from src to dst, except the `first_item_displayed' and `nb_items_displayed' which are taken from dst and copied to src. This is because in practise, those values are updated in the display loop/thread, which is the one which uses the target. This is not very orthodox, but should work. *Return value:* 1 if success, 0 if failure -- Function: lw6gui_menuitem_t * lw6gui_menuitem_new (char * LABEL, int VALUE, int ENABLED, int SELECTED, int COLORED) LABEL: the string to be displayed, what the user sees. Can be freed after the call is done, function will make a copy internally. VALUE: the value. No GUI function uses this, this is the "real" value associated to the item. ENABLED: wether the menu item can be selected, used, and so on SELECTED: wether the menu item is the item selected among all menu items. COLORED: wetherr the menu item must, when drawn, be colored according to its value. Constructs a new menuitem object. Note that you can always call other functions to modify these values afterwards, this might change rendering since `lw6gui_menuitem_set_value' or `lw6gui_menuitem_set_label' will, for instance, modify the "when was that item last modified" information. *Return value:* a pointer to the newly allocated object. -- Function: void lw6gui_menuitem_free (lw6gui_menuitem_t * MENUITEM) MENUITEM: a pointer to the menuitem. Frees the menuitem, checking if things are OK before doing so. *Return value:* none. -- Function: int lw6gui_menuitem_memory_footprint (lw6gui_menuitem_t * MENUITEM) MENUITEM: a pointer to the menuitem. Gets the memory occupied by the menuitem. Could be usefull to help a garbage collector taking decisions or reporting erros, for instance. *Return value:* the number of bytes used. -- Function: char * lw6gui_menuitem_repr (lw6gui_menuitem_t * MENUITEM) MENUITEM: a pointer to the menuitem. Constructs a readable description of the object. Usefull for debugging, or to introspect things using scripts, at run-time. Does not necessarly describe all the informations about the object, but helps knowing what it is. *Return value:* a string describing the object, must be freed. -- Function: void lw6gui_menuitem_set_label (lw6gui_menuitem_t * MENUITEM, char * LABEL, int64_t NOW) MENUITEM: a pointer to the menuitem. LABEL: the new label, you can free it after calling the function, an internal copy will be made. NOW: the current time, as a timestamp. Change the label of the menu item. That is to say, what the user sees. Use this function to change the menuitem value, don't try to access the struct directly. The idea is 1) to have safe memory management and 2) to keep the `last_change' member up to date. It can be later used for eye-candy effects. *Return value:* none -- Function: void lw6gui_menuitem_set_value (lw6gui_menuitem_t * MENUITEM, int VALUE, int64_t NOW) MENUITEM: a pointer to the menuitem. NOW: the current time, as a timestamp. Changes the value of a menuitem. This is the internal value, not what the user sees. Use this function to change the menuitem value, don't try to access the struct directly. The idea is to keep the `last_change' member up to date. It can be later used for eye-candy effects. *Return value:* none -- Function: void lw6gui_menuitem_select (lw6gui_menuitem_t * MENUITEM, int STATE, int64_t NOW) MENUITEM: a pointer to the menuitem. STATE: 1 to select, 0 to unselect NOW: the current time, as a timestamp. Switches the menuitem to (un)selected state. Use this function, don't try to modify the struct members directly. The idea is to have the `last_select' parameter up to date. It can be later used for eye-candy effects. *Return value:* none -- Function: void lw6gui_menuitem_enable (lw6gui_menuitem_t * MENUITEM, int STATE, int64_t NOW) MENUITEM: a pointer to the menuitem. STATE: 1 to enable, 0 to disable NOW: the current time, as a timestamp. Switches the menuitem to enabled/disabled state. Use this function, don't try to modify the struct members directly. The idea is to have the `last_select' parameter up to date. It can be later used for eye-candy effects. *Return value:* none -- Function: u_int32_t lw6gui_menuitem_checksum (lw6gui_menuitem_t * MENUITEM, lw6gui_look_t * LOOK) MENUITEM: the menuitem we want to identify Returns a checksum which can be used to know, for instance, wether the menuitem has changed or not, and if we should redraw it. *Return value:* a checksum. -- Function: int lw6gui_menuitem_is_same (lw6gui_menuitem_t * MENUITEM_A, lw6gui_menuitem_t * MENUITEM_B) MENUITEM_A: first item to compare MENUITEM_B: second item to compare Compares two menuitems. *Return value:* 1 if they are the same, 0 if not -- Function: lw6gui_menuitem_t * lw6gui_menuitem_dup (lw6gui_menuitem_t * MENUITEM) MENUITEM: the menuitem to duplicate The menuitem to duplicate. *Return value:* a pointer to the duplicted menuitem. -- Function: int lw6gui_menuitem_sync (lw6gui_menuitem_t * DST, lw6gui_menuitem_t * SRC) DST: the target menuitem SRC: the source menuitem Synchronizes two menuitems, this supposes that they represent the same item, but simply in a different state. *Return value:* 1 if success, 0 if failure -- Function: void lw6gui_mouse_register_move (lw6gui_mouse_t * MOUSE, int X, int Y, int64_t TIMESTAMP) MOUSE: the mouse object to work on X: the x position Y: the y position TIMESTAMP: current timestamp Registers a mouse move event. *Return value:* note. -- Function: int lw6gui_mouse_poll_move (lw6gui_mouse_t * MOUSE, int * X, int * Y) MOUSE: the mouse object to poll X: pointer to the x position (can be NULL), will be updated even if no move Y: pointer to the y position (can be NULL), will be updated even if no move Asks wether the mouse has moved or not. *Return value:* 1 if mouse was moved since last call, 0 if not. -- Function: void lw6gui_mouse_update_repeat (lw6gui_mouse_t * MOUSE, lw6gui_repeat_settings_t * REPEAT_SETTINGS, int64_t TIMESTAMP) MOUSE: the mouse to update REPEAT_SETTINGS: the repeat settings (delay + interval) TIMESTAMP: the current ticks (milliseconds) Updates the repeat informations for a mouse, must be called regularly, as often as possible. *Return value:* none. -- Function: int lw6gui_mouse_sync (lw6gui_mouse_t * DST, lw6gui_mouse_t * SRC) DST: the target mouse object SRC: the source mouse object Synchronizes two mouse objects. This is typically used to pass data from one thread to another. Will handle "mouse move" attribute and clear it in src if needed while setting it in dst. *Return value:* 1 if success, O if failure. -- Function: void lw6gui_smoother_init (lw6gui_smoother_t * SMOOTHER, float VALUE, int DURATION) SMOOTHER: the structure to initialize VALUE: the value to use for now DURATION: the duration of a standard move, in ticks (msec) Initializes a smoother object, with a default value. The important point is the duration which will condition all the behavior of the object. *Return value:* none. -- Function: void lw6gui_smoother_immediate_force (lw6gui_smoother_t * SMOOTHER, float VALUE) SMOOTHER: the structure to use VALUE: the target value Forces a smoother object to immediately point on a value. *Return value:* none. -- Function: void lw6gui_smoother_set_target (lw6gui_smoother_t * SMOOTHER, float VALUE, int64_t NOW) SMOOTHER: the structure to use VALUE: the target value NOW: the current timestamp Sets a new target, will automatically calculate current speed to smooth the next returned values. *Return value:* none. -- Function: float lw6gui_smoother_get_value (lw6gui_smoother_t * SMOOTHER, int64_t NOW) SMOOTHER: the structure to use NOW: the current timestamp Returns the current value of the smoother. *Return value:* a float. -- Function: int lw6gui_test () Run tests in the gui module. *Return value:* 1 if successfull, 0 if failed. -- Function: int lw6gui_video_mode_find_closest (lw6gui_video_mode_t * CLOSEST, lw6gui_video_mode_t * WISHED, lw6sys_list_t * AVAILABLE) CLOSEST: the closest video_mode found WISHED: the wished video_mode AVAILABLE: a list of available video_modes (list of lw6gui_video_mode_t *) Finds the closest video_mode available, this is just a small utility to cope with different screen shapes and avoid requesting 640x480 when it's just not available but there's a 640x400 instead. *Return value:* 1 if the wished video_mode exists in available list and was found, else 0 if the wished video_mode doesn't exist and an approximative match was picked. -- Function: int lw6gui_video_mode_is_same (lw6gui_video_mode_t * MODE_A, lw6gui_video_mode_t * MODE_B) MODE_A: first mode to compare MODE_B: second mode to compare Compares two video modes, to know if they're the same. *Return value:* 1 if equal, 0 if not. -- Function: int lw6gui_video_mode_sync_ratio (lw6gui_video_mode_t * DST, lw6gui_video_mode_t * SRC) DST: the target video mode SRC: the source video mode Applies the ratio of src to dst, for instance if src is 16/9, then dst will be made 16/9 too, trying to keep the same surface. *Return value:* 1 on success, 0 on failure -- Function: int lw6gui_viewport_init (lw6gui_viewport_t * VIEWPORT, int SCREEN_W, int SCREEN_H, float DRAWABLE_X1, float DRAWABLE_Y1, float DRAWABLE_X2, float DRAWABLE_Y2, float CENTER_X, float CENTER_Y, int MAP_W, int MAP_H, int X_POLARITY, int Y_POLARITY, int X_WRAP, int Y_WRAP, int KEEP_RATIO, float GLOBAL_ZOOM) VIEWPORT: the viewport to initalize SCREEN_W: screen width SCREEN_H: screen height DRAWABLE_X1: viewport min x DRAWABLE_Y1: viewport min y DRAWABLE_X2: viewport max x DRAWABLE_Y2: viewport max y CENTER_X: center of display (in map coordinates) CENTER_Y: center of display (in map coordinates) MAP_W: map width (shape) MAP_H: map height (shape) X_POLARITY: x polarity Y_POLARITY: y polarity X_WRAP: wether to wrap horizontally Y_WRAP: wether to wrap vertically KEEP_RATIO: wether to adapt to viewport shape or keep original GLOBAL_ZOOM: global zoom is style_zoom * dynamic_zoom Initializes all the (jumbo?) viewport structure which will contain valuable informations for a simple "flat" display. Special renderers might not find usefull some fields and handle wrapping and zooming their own way, but this offers a basic skeleton. *Return value:* 1 if ok, 0 on failure -- Function: void lw6gui_viewport_map_to_screen (lw6gui_viewport_t * VIEWPORT, float * SCREEN_X, float * SCREEN_Y, float MAP_X, float MAP_Y, int CLIP) VIEWPORT: the viewport to use SCREEN_X: the x coord on the screen SCREEN_Y: the y coord on the screen MAP_X: the x coord in map coordinates MAP_Y: the y coord in map coordinates CLIP: wether to clip returned values Translates from map coords to screen coords. Returned values might be outside screen boundaries if clip is 0. If screen coords are outside drawable area anc clip is 1, then they will be clipped. *Return value:* NULL -- Function: void lw6gui_viewport_screen_to_map (lw6gui_viewport_t * VIEWPORT, float * MAP_X, float * MAP_Y, float SCREEN_X, float SCREEN_Y, int WRAP) VIEWPORT: the viewport to use MAP_X: the x coord in map coordinates MAP_Y: the y coord in map coordinates SCREEN_X: the x coord on the screen SCREEN_Y: the y coord on the screen WRAP: wether to use polarity informations to wrap coords. Translates from screen coords to map coords. If wrap is set, it will interpret coords the way `lw6map_coords_fix_xy' would, only it can still be formally outside map boundaries for it can return a value exactly equal to w,h while in interger mode it would be w-1,h-1. *Return value:* NULL -- Function: void lw6gui_zone_init_x1y1x2y2 (lw6gui_zone_t * ZONE, float X1, float Y1, float X2, float Y2) ZONE: the structure to initialize X1: x for top left corner Y1: y for top left corner X2: x for bottom right corner Y2: y for bottom right corner Initializes a zone structure, will calculate w & h. *Return value:* none. -- Function: void lw6gui_zone_init_xywh (lw6gui_zone_t * ZONE, float X, float Y, float W, float H) ZONE: the structure to initialize X: x for top left corner Y: y for top left corner W: width H: height Initializes a zone structure, will calculate x2 & y2. *Return value:* none. -- Function: void lw6gui_zone_clip (lw6gui_zone_t * DST, lw6gui_zone_t * SRC, lw6gui_zone_t * CLIP) DST: the structure which will contain the result SRC: the source zone CLIP: the clipping zone (boundaries) Clips a zone (think of rectangle clips). *Return value:* none. 4.15.10 libhlp -------------- -- Function: int lw6hlp_is_documented (char * KEYWORD) KEYWORD: the keyword we want to check out Checks wether a given keyword is documented or not. *Return value:* 1 if documented, 0 if not. -- Function: char * lw6hlp_about (lw6hlp_type_t * TYPE, char ** DEFAULT_VALUE, int * MIN_VALUE, int * MAX_VALUE, char * KEYWORD) TYPE: the type of the data associated to the keyword, will be written DEFAULT_VALUE: the default value for the keyword, will be written MIN_VALUE: the min value for the keyword, will be written MAX_VALUE: the max value for the keyword, will be written KEYWORD: the keyword we want help about Returns the documentation string associated to a keyword. The keyword might be a command-line option, a Guile function, an XML file entry. Raises a warning if the keyword is undocumented, but never returns NULL, you can use the returned value without checking it. String is localized if a translation is available. It's safe to call this function with type or other parameters being NULL. *Return value:* a help string, never NULL, must not be freed. Additionnally, type will be updated. -- Function: lw6hlp_type_t lw6hlp_get_type (char * KEYWORD) KEYWORD: the keyword we want the type of Returns the type of a keyword. Calls lw6hlp_about internally. *Return value:* the type, might be LW6HLP_TYPE_VOID. -- Function: char * lw6hlp_get_default_value (char * KEYWORD) KEYWORD: the keyword we want the default for Returns the default value for a keyword. Note that it can be NULL! The returned value is always a string, it's suitable to store in the config file, it's the value a user would pass on a command line, the one he wants documented. *Return value:* a pointer, which can be NULL, must not be freed. -- Function: int lw6hlp_get_min_value (char * KEYWORD) KEYWORD: the keyword we want the min for Returns the min value for a keyword. Wether this is relevant for a given keyword does not affect the fact that you can call this function. A min and max of zero means min and max make no sense. *Return value:* the value (integer) -- Function: int lw6hlp_get_max_value (char * KEYWORD) KEYWORD: the keyword we want the max for Returns the max value for a keyword. Wether this is relevant for a given keyword does not affect the fact that you can call this function. A min and max of zero means min and max make no sense. *Return value:* the value (integer) -- Function: int lw6hlp_match (char * KEYWORD1, char * KEYWORD2) KEYWORD1: the 1st keyword KEYWORD2: the 2nd keyword Checks wether a keyword matches another. Not only a string comparison, will also try and guess if the error is only about dash "-" replaced by underscode "_", for instance. *Return value:* 1 if matches, 0 if different. -- Function: lw6sys_list_t * lw6hlp_list () Returns a list of all available keywords. *Return value:* a list containing all the keywords. Strings are not dynamically allocated, you can't modify them. -- Function: void lw6hlp_print_keyword (lw6sys_list_t ** LIST, FILE * F) list: a pointer to a list of keywords f: the file to print the content to Prints all the keywords from the list. One keyword per line. *Return value:* none. -- Function: void lw6hlp_print_content (lw6sys_list_t ** LIST, FILE * F) list: a pointer to a list of keywords f: the file to print the content to Prints all the keywords from the list, with the associated keyword help, to the given file. Output is formatted to fit on the standard terminal/console. *Return value:* none. -- Function: int lw6hlp_reference_init () Initializes the help reference, this must be called before any call to lw6hlp_about or such help related functions. *Return value:* 1 on success, 0 if failed -- Function: void lw6hlp_reference_quit () Un-initializes the help reference, this must be called at the end of the program. *Return value:* 1 on success, 0 if failed 4.15.11 libimg -------------- 4.15.12 libker -------------- 4.15.13 libldr -------------- -- Function: int lw6ldr_body_read (lw6map_body_t * BODY, char * DIRNAME, lw6map_param_t * PARAM, lw6ldr_hints_t * HINTS, int DISPLAY_W, int DISPLAY_H, float RATIO, lw6sys_progress_t * PROGRESS) BODY: the body to read, must point to allocated memory DIRNAME: the directory of the map PARAM: map parameters HINTS: map hints RATIO: wished map ratio PROGRESS: structure to transmit loading progress Reads the map body, that is, all the layers. *Return value:* 1 if OK, 0 if failed. -- Function: void lw6ldr_auto_colors (lw6map_style_t * STYLE, lw6ldr_hints_t * HINTS) STYLE: the style structure to process. HINTS: additionnal hints to know what to set automatically Deduces all colors from background color, if needed. The function will check color_auto parameters and replace all other colors by base and alternate colors if needed. Note that the background color itself is not changed by this function. Background can only be guessed from texture. *Return value:* none. -- Function: void lw6ldr_free_entry (lw6ldr_entry_t * ENTRY) ENTRY: the entry to free Frees a map entry. *Return value:* none. -- Function: lw6sys_list_t * lw6ldr_get_entries (char * MAP_PATH, char * RELATIVE_PATH) MAP_PATH: the map_path environment config variable, delimited path list RELATIVE_PATH: the relative path to use to find the map directory Lists all maps in a given directory. Returns a list of lw6ldr_entry_t which can contain both directories with subdirs and actual maps. Maps are sorted before being returned, first directories, then maps, sorted in alphabetical order. *Return value:* a list of dynamically allocated lw6ldr_entry_t. -- Function: void lw6ldr_for_all_entries (char * MAP_PATH, char * RELATIVE_PATH, int RECURSIVE, lw6sys_list_callback_func_t CALLBACK_FUNC, void * FUNC_DATA) MAP_PATH: the map_path environment config variable, delimited path list RELATIVE_PATH: the relative path to use to find the map directory RECURSIVE: if non-zero, map search will recurse in subdirs CALLBACK_FUNC: the function which will be called on each entry FUNC_DATA: an extra pointer to pass data to callback_func Executes a given function on all maps in a given place, typically used in test programs. *Return value:* none. -- Function: int lw6ldr_hints_read (lw6ldr_hints_t * HINTS, char * DIRNAME) DIRNAME: the directory of the map Read the hints (hints.xml) of a map. Pointer to hints must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_hints_set (lw6ldr_hints_t * HINTS, char * KEY, char * VALUE) HINTS: the hints to modify KEY: the key to modify VALUE: the value to affect to the key, as a string Sets one single parameter in a hints structure. Value must always be passed as a string, will be converted to the right type automatically when storing it in the structure. *Return value:* 1 if success, 0 if failed. Note that while 0 really means there's a problem, some affectations can fail and return 1, needs to be worked on. -- Function: int lw6ldr_hints_update (lw6ldr_hints_t * HINTS, lw6sys_assoc_t * VALUES) HINTS: the hints struct to fill with values (read/write parameter) VALUES: an assoc containing strings with the new values Overrides hints with values. Pointer to hints must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. Not all parameters need be defined in values. It can even be NULL. The idea is just that if something is defined in values, it will override the existing hints. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_param_read (lw6map_param_t * PARAM, char * DIRNAME) PARAM: the parameter struct to fill with values (read/write parameter) DIRNAME: the directory of the map Read the parameters associated to a map. Pointer to param must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_param_update (lw6map_param_t * PARAM, lw6sys_assoc_t * VALUES) PARAM: the parameter struct to fill with values (read/write parameter) VALUES: an assoc containing strings with the new values Overrides param with values. Pointer to param must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. Not all parameters need be defined in values. It can even be NULL. The idea is just that if something is defined in values, it will override the existing param. *Return value:* 1 if success, 0 if failed. -- Function: void lw6ldr_print_example_rules_xml (FILE * F) F: file to output content to Print to a file a typical map rules.xml file. *Return value:* none. -- Function: void lw6ldr_print_example_hints_xml (FILE * F) F: file to output content to Print to a file a typical map hints.xml file. *Return value:* none. -- Function: void lw6ldr_print_example_style_xml (FILE * F) F: file to output content to Print to a file a typical map style.xml file. *Return value:* none. -- Function: int lw6ldr_print_examples (char * USER_DIR) USER_DIR: the user directory or at least, a writable one Writes all example XML files in 'user_dir/example/', will create the directory if needed. *Return value:* 1 if success, 0 if failed. -- Function: lw6map_level_t * lw6ldr_read (char * DIRNAME, lw6sys_assoc_t * DEFAULT_PARAM, lw6sys_assoc_t * FORCED_PARAM, int DISPLAY_W, int DISPLAY_H, lw6sys_progress_t * PROGRESS) DIRNAME: the directory containing the map DEFAULT_PARAM: default parameters, as strings FORCED_PARAM: forced parameters, as strings DISPLAY_W: the width of the display output (resolution) DISPLAY_H: the height of the display output (resolution) PROGRESS: information used to handle the progress bar Loads a map from dist. The default_param and forced_param can contain values corresponding to rules.xml and style.xml entries. Parameters are read in 4 steps. 1st, a default value is picked by the program. 2nd, any value in `default_param' replaces previous values. 3rd, any value in rules.xml or style.xml replaces previous values. 4th, any value in `forced_param' replaces previous values. In practice, the `default_param' allows the user to set defaults which can still be overwritten by the map, while `forced_param' is a definitive 'ignore what is is defined in the map' way of doing things. See also `lw6ldr_read_relative'. *Return value:* 1 if success, 0 if failed. -- Function: lw6map_level_t * lw6ldr_read_relative (char * MAP_PATH, char * RELATIVE_PATH, lw6sys_assoc_t * DEFAULT_PARAM, lw6sys_assoc_t * FORCED_PARAM, int DISPLAY_W, int DISPLAY_H, lw6sys_progress_t * PROGRESS) MAP_PATH: a collection of paths where to find maps RELATIVE_PATH: something which will be appended to a `map_path' member DEFAULT_PARAM: default parameters, as strings FORCED_PARAM: forced parameters, as strings DISPLAY_W: the width of the display output (resolution) DISPLAY_H: the height of the display output (resolution) PROGRESS: information used to handle the progress bar Reads a map from disk, using the map-path value, which is a collection of paths defined by the command-line, the environment variables, and the config file. `default_param' and `forced_param' work as in the function `lw6ldr_read'. *Return value:* 1 if success, 0 if failure. -- Function: int lw6ldr_rules_read (lw6map_rules_t * RULES, char * DIRNAME) DIRNAME: the directory of the map Read the rules (rules.xml) of a map. Pointer to rules must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_rules_update (lw6map_rules_t * RULES, lw6sys_assoc_t * VALUES) RULES: the rules struct to fill with values (read/write parameter) VALUES: an assoc containing strings with the new values Overrides rules with values. Pointer to rules must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. Not all parameters need be defined in values. It can even be NULL. The idea is just that if something is defined in values, it will override the existing rules. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_style_read (lw6map_style_t * STYLE, char * DIRNAME) DIRNAME: the directory of the map Read the style (style.xml) of a map. Pointer to style must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_style_set (lw6map_style_t * STYLE, char * KEY, char * VALUE) STYLE: the style to modify KEY: the key to modify VALUE: the value to affect to the key, as a string Sets one single parameter in a style structure. Value must always be passed as a string, will be converted to the right type automatically when storing it in the structure. *Return value:* 1 if success, 0 if failed. Note that while 0 really means there's a problem, some affectations can fail and return 1, needs to be worked on. -- Function: int lw6ldr_style_update (lw6map_style_t * STYLE, lw6sys_assoc_t * VALUES) STYLE: the style struct to fill with values (read/write parameter) VALUES: an assoc containing strings with the new values Overrides style with values. Pointer to style must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. Not all parameters need be defined in values. It can even be NULL. The idea is just that if something is defined in values, it will override the existing style. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_use_update (lw6ldr_use_t * USE, lw6sys_assoc_t * VALUES) USE: the use struct to fill with values (read/write parameter) VALUES: an assoc containing strings with the new values Overrides use with values. Pointer to use must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. Not all parameters need be defined in values. It can even be NULL. The idea is just that if something is defined in values, it will override the existing use. *Return value:* 1 if success, 0 if failed. 4.15.14 libmap -------------- -- Function: void lw6map_color_invert (lw6map_color_couple_t * COLOR) COLOR: the color to invert Inverts a color couple, that is, replace fg by bg and vice-versa. *Return value:* none. -- Function: int lw6map_color_is_same (lw6map_color_couple_t * COLOR1, lw6map_color_couple_t * COLOR2) COLOR1: 1st color to compare COLOR2: 2nd color to compare Compares two colors. *Return value:* 1 if equal, 0 if not. -- Function: char * lw6map_team_color_index_to_key (int INDEX) INDEX: index of the color between 0 & 9 Transforms a team color index into its readable string form, which can be used in config files for instance. *Return value:* a string, must *not* be freed. -- Function: int lw6map_team_color_key_to_index (char * KEY) KEY: key of the color, for instance "red" The index of the color, between 0 & 9 *Return value:* an integer. -- Function: lw6map_level_t * lw6map_dup (lw6map_level_t * SOURCE, lw6sys_progress_t * PROGRESS) SOURCE: the map to copy PROGRESS: to show advancement Performs a deep copy of the map, all elements are newly allocated and source can safely be destroyed after it's been duplicated. *Return value:* a newly allocated map, may be NULL. -- Function: char * lw6map_to_hexa (lw6map_level_t * LEVEL) Converts a map to something that is later readable by `lw6map_from_hexa' to reproduce the exact same map. Just a serializer. *Return value:* a newly allocated pointer, NULL if conversion failed. -- Function: lw6map_level_t * lw6map_from_hexa (char * HEXA) HEXA: an hexadecimal ASCII string, created by `lw6map_to_hexa' Constructs a map from an hexadecimal string generated by `lw6map_to_hexa'. Just an un-serializer. *Return value:* a new map, might be NULL if string isn't correct. -- Function: lw6map_level_t * lw6map_new () Creates a new empty map. This object is perfectly unusable as is, since it has a 0x0 size, and many things set to "NULL". Still, it's used internally and is the canonical way to create the object, it ensures later calls that set up default parameters, for instance, will succeed. *Return value:* a newly allocated pointer. -- Function: lw6map_level_t * lw6map_builtin_defaults () Creates a map, set to defaults. This is usefull mostly for testing. This builtin map has walls, paths, it's playable. *Return value:* a newly allocated map. -- Function: lw6map_level_t * lw6map_builtin_whd (int W, int H, int D) W: the width of the map H: the height of the map D: the depth (number of layers) of the map Creates a map, set to defaults. This is usefull mostly for testing. This one, unlike `lw6map_builtin_defaults' will let you give a width, height and a depth. *Return value:* a newly allocated map. -- Function: void lw6map_free (lw6map_level_t * LEVEL) Frees a map and releases all its internal ressources. *Return value:* none. -- Function: int lw6map_memory_footprint (lw6map_level_t * LEVEL) Reports how many bytes the map needs, in memory. Note that this is not contiguous memory, it involves a bunch of pointers, and possibly much more... -- Function: char * lw6map_repr (lw6map_level_t * LEVEL) Returns a string describing the map. This is a very short description, use it for logs, and to debug stuff. By no means it's a complete exhaustive description. Still, the string returned should be unique. *Return value:* a dynamically allocated string. -- Function: int lw6map_is_same (lw6map_level_t * LEVEL_A, lw6map_level_t * LEVEL_B) LEVEL_A: the first level to compare LEVEL_B: the other level to compare Compares two level structs, the idea is to compare the content, not only the pointers and level ids. *Return value:* 1 if they're the same, 0 if not. -- Function: void lw6map_param_defaults (lw6map_param_t * PARAM) PARAM: the param struct to modify Sets a param structure to its default value, note that current structured must be zeroed or correctly initialized. *Return value:* none -- Function: void lw6map_param_clear (lw6map_param_t * PARAM) PARAM: the param struct to modify Resets a param structure to nothing. Note that current structured must be zeroed or correctly initialized. The idea is just to free member pointers before calling free. *Return value:* none -- Function: void lw6map_param_copy (lw6map_param_t * DST, lw6map_param_t * SRC) DST: the destination param struct SRC: the source param struct Copies parameters. Both structures must be zeroed or correctly initialized. *Return value:* none -- Function: int lw6map_param_set (lw6map_param_t * PARAM, char * KEY, char * VALUE) PARAM: the param struct to modify KEY: the name of the parameter to modify VALUE: the value of the parameter to modify Sets an entry in a param struct. All values must be submitted as strings, internally, the function will call atoi to convert to integers if needed, for instance. It will also dispatch automatically between rules and style. *Return value:* 1 if parameter successfully set, 0 on error. 4.15.15 libnet -------------- -- Function: int lw6net_last_error () Reports the last network error. This is basically a debug function, designed mostly for Microsoft Winsock API, but can be safely called on any platform. *Return value:* the last error code, has no universal meaning, depends on the platform you're working on. -- Function: char * lw6net_recv_line_tcp (int SOCK) SOCK: the socket descriptor Receives a line terminated by LF ("\n", chr(10)) or CR/LF ("\r\n", chr(10)chr(13)) on a TCP socket, that is, stream oriented. If there's no complete line available, function returns immediately with NULL. Same if socket is closed, broken, whatever. Only if there's something consistent will the function return non-NULL. *Return value:* a dynamically allocated string with the content received. The tailing (CR)/LF is stripped. -- Function: int lw6net_send_line_tcp (int SOCK, char * LINE) SOCK: the socket descriptor LINE: the line to be sent, without the "\n" at the end Sends a line terminated by LF ("\n", chr(10)) on a TCP socket, that is, stream oriented. The "\n" is automatically added, do not bother sending it. *Return value:* non-zero if success -- Function: char * lw6net_recv_line_udp (int SOCK, char ** INCOMING_IP, int * INCOMING_PORT) SOCK: the socket descriptor INCOMING_IP: the IP address of the sender (returned) INCOMING_PORT: the IP port of the sender (returned) Receives a line terminated by LF ("\n", chr(10)) or CR/LF ("\r\n", chr(10)chr(13)) on a UDP socket, that is, datagram oriented. If there's no complete line available, function returns immediately with NULL. Same if socket is closed, broken, whatever. Only if there's something consistent will the function return non-NULL. By-value parameters allow the caller to know where the data come from. *Return value:* a dynamically allocated string with the content received. The tailing (CR)/LF is stripped. -- Function: int lw6net_send_line_udp (int SOCK, char * LINE, char * IP, int PORT) SOCK: the socket descriptor LINE: the line to be sent, without the "\n" at the end IP: the IP address of the target PORT: the IP port of the target Sends a line terminated by LF ("\n", chr(10)) on a UDP socket, that is, datagram oriented. The "\n" is automatically added, do not bother sending it. *Return value:* the number of bytes sent, 0 if failure -- Function: int lw6net_init (int ARGC, char * [] ARGV) Initializes the low-level network API, you must call this before calling any other network related function, for it allocates a dynamic context which is in turn used by every function. *Return value:* non-zero if success -- Function: void lw6net_quit () Frees memory, joins active threads, and releases everything set up by network code. *Return value:* void 4.15.16 libp2p -------------- 4.15.17 libpil -------------- -- Function: int lw6pil_bench (float * BENCH_RESULT) BENCH_RESULT: pointer to float, will contain the bench result Runs a standard, normalized bench on a default map. Results can be interpreted as an estimated speed/power of your computer. *Return value:* 1 on success, 0 if failure -- Function: void lw6pil_coords_fix (lw6map_rules_t * RULES, lw6sys_whd_t * SHAPE, float * X, float * Y, float * Z) RULES: the set of rules to use (defines polarity) SHAPE: the shape of the map (logical part) X: the x coord to fix Y: the y coord to fix Z: the z coord to fix Similar to `lw6map_coords_fix' but using floats, this function can be used to check cursor position boundaries. Any float pointer can be NULL. *Return value:* none. -- Function: lw6pil_pilot_t * lw6pil_pilot_new (lw6ker_game_state_t * GAME_STATE, int64_t TIMESTAMP, lw6sys_progress_t * PROGRESS) GAME_STATE: the game state we're going to work on TIMESTAMP: the current ticks (1000 ticks per sec, used to calibrate) PROGRESS: object used to show the advancement of the process Initializes a 'pilot' object, this object is responsible for interpreting messages, transform them into low-level 'ker' module function calls, and handle all the thread-spooky stuff. *Return value:* a working pilot object. May be NULL on memory failure. -- Function: void lw6pil_pilot_free (lw6pil_pilot_t * PILOT) PILOT: the object to free. Frees a 'pilot' object, note that this might involve joining some threads, so it can 'take some time'. *Return value:* none. -- Function: int lw6pil_pilot_send_command (lw6pil_pilot_t * PILOT, char * COMMAND_TEXT, int VERIFIED) PILOT: the object to send commands to. COMMAND_TEXT: the text of the command, as received form network VERIFIED: wether we're sure this message is valid. Sends a command and handles it internally. *Return value:* 1 if OK, 0 if not. -- Function: int lw6pil_pilot_commit (lw6pil_pilot_t * PILOT) PILOT: the object to commit. Commits all commands sent and actually send them to the corresponding threads. This commit system allows better performance by sending, for instance, all the commands for a given round together. *Return value:* none. -- Function: int lw6pil_pilot_make_backup (lw6pil_pilot_t * PILOT) PILOT: the object to perform the backup on Makes a new backup in the pilot, that is, copy 'reference' to 'backup'. *Return value:* 1 if OK, 0 if not. -- Function: int lw6pil_pilot_can_sync (lw6ker_game_state_t * TARGET, lw6pil_pilot_t * PILOT) TARGET: the target game_state we would sync on PILOT: the object to perform the backup on Tests wether sync functions are callable with a given game state. It verifies if the internal game_state and the target look the same. *Return value:* 1 if sync functions can be called, 0 if not. -- Function: int lw6pil_pilot_sync_from_backup (lw6ker_game_state_t * TARGET, lw6pil_pilot_t * PILOT) TARGET: the game_state structure which will get the informations. PILOT: the object to get informations from. Gets the backup from the pilot object. This is the last snapshot taken by `make_backup' or, by default, the game_state the pilot was constructed with. *Return value:* 1 if OK, 0 if not. -- Function: int lw6pil_pilot_sync_from_reference (lw6ker_game_state_t * TARGET, lw6pil_pilot_t * PILOT) TARGET: the game_state structure which will get the informations. PILOT: the object to get informations from. Gets the latest reference game_state, that is, a stable snapshot of the game, with no inconsistency, a game position that exists and that we can rely on. Note that getting this can take time since a global mutex is required, and computations must end before you get the data. *Return value:* 1 if OK, 0 if not. -- Function: int lw6pil_pilot_sync_from_draft (lw6ker_game_state_t * TARGET, lw6pil_pilot_t * PILOT, int DIRTY_READ) TARGET: the game_state structure which will get the informations. PILOT: the object to get informations from. DIRTY_READ: wether to allow dirty read or not Gets the informations from the pilot object, not being worried about game consistency, this one will just return the latest version available. It might even be in an inconsistent state, the position could reflect a position which will never exist. Still, the data returned will not correspond to a half-spread or half-moved game_state if dirty_read is set to 0. In this case the data has at least some basic consistency and getting this does require some mutex lock, however wait time should be fairly small (max. a round). But, in a general manner, this function is only used for display, and we do not care much if there's a small glitch, we prefer fast & smooth display. *Return value:* 1 if OK, 0 if not. -- Function: lw6ker_game_state_t * lw6pil_pilot_dirty_read (lw6pil_pilot_t * PILOT) PILOT: the object to get informations from. Returns a direct access to the most up-to-date game_state, without locking anything whatsoever. This is clearly to implement a dirty read mode as the name of the function suggests. *Return value:* 1 if OK, 0 if not. -- Function: char * lw6pil_pilot_repr (lw6pil_pilot_t * PILOT) Returns a string describing the pilot. This is a very short description, use it for logs, and to debug stuff. By no means it's a complete exhaustive description. Still, the string returned should be unique. *Return value:* a dynamically allocated string. -- Function: void lw6pil_pilot_calibrate (lw6pil_pilot_t * PILOT, int64_t TIMESTAMP, int ROUND) PILOT: the object to calibrate TIMESTAMP: the current ticks setting (1000 ticks per second) ROUND: the round expected to be returned with this ticks value Calibrates the pilot, that is, initializes it so that subsequent calls to `lw6pil_pilot_get_round' return consistent values. *Return value:* none. -- Function: void lw6pil_pilot_speed_up (lw6pil_pilot_t * PILOT, int ROUND_INC) PILOT: the pilot to speed up ROUND_INC: the number of rounds Re-calibrates the pilot so that it speeds up a bit. This will basically increase next_round by round_inc. *Return value:* none. -- Function: void lw6pil_pilot_slow_down (lw6pil_pilot_t * PILOT, int ROUND_DEC) PILOT: the pilot to speed up ROUND_DEC: the number of rounds Re-calibrates the pilot so that it slows down a bit. This will basically decrease next_round by round_inc. *Return value:* none. -- Function: int lw6pil_pilot_get_next_round (lw6pil_pilot_t * PILOT, int64_t TIMESTAMP) PILOT: the object to query TIMESTAMP: the current ticks setting (1000 ticks per second) Returns the round one should use to generate new events/commands at a given time (given in ticks). *Return value:* none. -- Function: int lw6pil_pilot_get_last_commit_round (lw6pil_pilot_t * PILOT) PILOT: the object to query Returns the round of the last commit (reference game_state) for this object. *Return value:* the commit round (reference object) -- Function: int lw6pil_pilot_get_reference_target_round (lw6pil_pilot_t * PILOT) PILOT: the object to query Returns the round which is targetted in the reference game_state, this is 'how far computation will go in the reference game_state if no new commands are issued'. Note that there can always be some commands which are not yet processed, so you should not rely on this too heavily, however it gives a good idea of how things are going. *Return value:* the target round (reference object) -- Function: int lw6pil_pilot_get_reference_current_round (lw6pil_pilot_t * PILOT) PILOT: the object to query Returns the current round in the reference game_state. There's no lock on this call so don't rely on this too heavily, it just gives you an idea of wether the pilot is very late on its objectives or just on time. *Return value:* the current round (reference object) -- Function: int lw6pil_pilot_get_max_round (lw6pil_pilot_t * PILOT) PILOT: the object to query Returns the max current round in the reference or draft game states. No lock on this call so don't rely on this too heavily, it just gives you an idea of computation state. *Return value:* the current round (reference object) -- Function: int lw6pil_pilot_is_over (lw6pil_pilot_t * PILOT) PILOT: the object to query Tells wether the game is over or not. *Return value:* 1 if over, 0 if not -- Function: int lw6pil_test () Runs the `pil' module test suite. *Return value:* 1 if test is successfull, 0 on error. 4.15.18 libsnd -------------- 4.15.19 libsrv -------------- 4.15.20 libsys -------------- -- Function: int lw6sys_arg_match (char * KEYWORD, char * ARGV_STRING) KEYWORD: the option to match, without the prefix "-" or "-" ARGV_STRING: the argv value, for instance argv[1] This is an utility function which allow the program to handle options in a uniform manner. Key comparison is insensitive, that is, -option and -OPTION are equivalent. Besides, -option and -OPTION are equivalent too. Liquid War 6 documentation mentions options in lowercase with a double dash (-option) by default, but it's a fact, the program supports variants. This is just for convenience, the philosophy behind this behavior is "be as permissive as possible when interpreting input, and as strict as possible when generating output". In fact, it's even said that Liquid War 6 will accept the argument without any prefix dash as being valid... This is to say running "liquidwar6 -option" is the same as running "liquidwar6 option". But, this is a secret 8-) *Return value:* non zero if it matches, 0 if it doesn't. -- Function: int lw6sys_arg_exists (int ARGC, char * [] ARGV, char * KEYWORD) ARGC: the number of arguments, as passed to `main' ARGV: an array of arguments, as passed to `main' KEYWORD: the keyword to match Parses all command-line arguments, searching for one precise "-key[=...]" entry. *Return value:* 1 if key is present, 0 if not. -- Function: char * lw6sys_arg_get_value (int ARGC, char * [] ARGV, char * KEYWORD) ARGC: the number of arguments, as passed to `main' ARGV: an array of arguments, as passed to `main' KEYWORD: the keyword to match Parses all command-line arguments, searching for one precise "-key=value" pair, and returns the value. *Return value:* a pointer to the value. May be NULL. Must be freed. -- Function: char * lw6sys_arg_get_value_with_env (int ARGC, char * [] ARGV, char * KEYWORD) ARGC: the number of arguments, as passed to `main' ARGV: an array of arguments, as passed to `main' KEYWORD: the keyword to match Parses all command-line arguments, searching for one precise "-key=value" pair, and returns the value. If a corresponding environment variable is available, but no command-line parameter was passed, the environment variable is intepreted. Such environment variables are uppercased, prefixed by "LW6_" and "_" replaces "-". The environment variable will be overriden if the command-line parameter is present. *Return value:* a pointer to the value. May be NULL. Must be freed. -- Function: lw6sys_assoc_t * lw6sys_assoc_new (lw6sys_free_func_t FREE_FUNC) FREE_FUNC: optional callback used to free memory when stored date is a pointer. Can be NULL when one stores non dynamically allocated data, such as an integer or a static array. Creates an empty assoc. There's a difference between NULL and an empty assoc. The empty assoc would (in Scheme) be '() whereas NULL corresponds to undefined "is not a assoc and will generate errors if you ever call assoc functions on it". Such created assoc are not performant hash tables but slowish "strcmp me for each key" associative arrays, the key being a "char *" string and the value a "void *" pointer. *Return value:* a pointer to the newly allocated associative array. Must be freed with `lw6sys_assoc_free'. -- Function: void lw6sys_assoc_free (lw6sys_assoc_t * ASSOC) ASSOC: the assoc to be freed. The function will cascade delete all elements, using (if not NULL...) the callback passed when first creating the assoc. *Return value:* void -- Function: int lw6sys_assoc_has_key (lw6sys_assoc_t * ASSOC, char * KEY) ASSOC: the assoc to test KEY: the key to search Not a very fast function, since on a "big" assoc, strcmp will be called internally until the key is found. *Return value:* non-zero if there's an entry with the corresponding key. -- Function: void * lw6sys_assoc_get (lw6sys_assoc_t * ASSOC, char * KEY) ASSOC: the assoc to query KEY: the key of which we want the value *Return value:* a void pointer to the data contained in the assoc. Note that the pointer on the actual data is returned, that is, if it's static data, you must not try to free it... As long as memory management is concerned, destroying the assoc will actually free the data if needed. -- Function: void lw6sys_assoc_set (lw6sys_assoc_t ** ASSOC, char * KEY, void * VALUE) ASSOC: the assoc to modify KEY: the key we want to updated VALUE: the new value Sets a value in an associative array. The key pointer need not be persistent, it can be freed after affectation. In fact a new string will be created internally. This is not true for the value, it's hard to find way to copy "any object". So if you want an associative array of strings, key can disappear after calling this function, but not value. The function passed as free_func when creating the assoc will be used to free stuff whenever needed (unset or free). *Return value:* void -- Function: void lw6sys_assoc_unset (lw6sys_assoc_t * ASSOC, char * KEY) ASSOC: the assoc concerned KEY: the key to unset Clears an entry in an associative array. The callback passed when creating the assoc will be called if needed, to free the data automatically. *Return value:* void -- Function: lw6sys_list_t * lw6sys_assoc_keys (lw6sys_assoc_t * ASSOC) ASSOC: the assoc to work on Returns a list containing all the keys of the assoc. The list must be free with lw6sys_list_free by the caller. This list copies all the keys of the assoc, so it is safe to use it once the assoc is deleted. However the keys will of course be of little interest in this case. But the program won't segfault. *Return value:* the list of keys. -- Function: void lw6sys_assoc_map (lw6sys_assoc_t * ASSOC, lw6sys_assoc_callback_func_t FUNC, void * FUNC_DATA) ASSOC: the assoc to work on FUNC: a callback to call on each entry FUNC_DATA: a pointer on some data which will be passed to the callback Executes a function on all assoc items. The func_data parameter allows you to pass extra values to the function, such as a file handler or any variable which can not be inferred from list item values, and you of course do not want to make global... *Return value:* void -- Function: void lw6sys_assoc_sort_and_map (lw6sys_assoc_t * ASSOC, lw6sys_assoc_callback_func_t FUNC, void * FUNC_DATA) ASSOC: the assoc to work on FUNC: a callback to call on each entry, may be NULL FUNC_DATA: a pointer on some data which will be passed to the callback Executes a function on all assoc items, like `lw6sys_assoc_sort_and_map' but befor doing so, sorts all entries in alphabetical order. *Return value:* void -- Function: lw6sys_assoc_t * lw6sys_assoc_dup (lw6sys_assoc_t * ASSOC, lw6sys_dup_func_t DUP_FUNC) ASSOC: the assoc to duplicate, can be NULL DUP_FUNC: the function which will be called to duplicate data Duplicates an assoc. All keys will be copied so that if the first assoc is deleted, the duplicated one is fine. Additionnaly, dup_func will be called with all data fields. If dup_func is NULL, then data values will simply be copied. This is likely to be usefull when data is not dynamically allocated. *Returned value:* a newly allocated assoc. -- Function: int lw6sys_default_memory_bazooka () Will set up a default memory bazooka, a slow yet convenient tool to track down and hopefully kill memory leaks. Named bazooka after a night wasted to track down an unfoundable leak... BAZOOOOOOKA!!! *Return value:* 1 if success, 0 if failed. -- Function: void lw6sys_clear_memory_bazooka () Clears the memory bazooka. *Return value:* none. -- Function: int lw6sys_set_memory_bazooka_size (int SIZE) SIZE: number of items (calls to malloc) to keep Resizes, the memory bazooka. What's this? It's an inelegant yet efficient tool to track down memory leak. Memory bazooka will keep track of every call to malloc, keeping a trace of what has been malloced, where it has been called (from which file, which line), how much memory was allocated, it will even show you what's at the address in a 0-terminated string-friendly fashion. Of course this slows down the program, so in production, you might set this to 0, but for debugging, a million bazooka is worth the megabytes and CPU cycles it wastes. *Return value:* 1 if success, 0 if failure. -- Function: int lw6sys_get_memory_bazooka_size () The companion of `lw6sys_set_memory_bazooka_size'. This function will return how many calls to malloc can be traced. A return value of 0 indicates that feature is disabled. *Return value:* size of the bazooka array. -- Function: int lw6sys_set_memory_bazooka_eraser (int STATE) STATE: the state of the eraser Sets the memory bazooka eraser state. Note that to really work, it requires the memory bazooka to be "big enough". *Return value:* 1 if activated, 0 if not. Note that the main reason for it not to be activated is if the memory bazooka has zero size. -- Function: int lw6sys_get_memory_bazooka_malloc_count () Provided you have always called the `LW6SYS_MALLOC' an `LW6SYS_CALLOC' to allocate memory, this function will tell you how many times `malloc' has been called. *Return value:* the number of calls to `lw6sys_malloc' or `lw6sys_calloc' since program was started. -- Function: int lw6sys_get_memory_bazooka_free_count () Provided you have always called the `LW6SYS_FREE' macro to free memory, this function will tell you how many times `free' has been called. *Return value:* the number of calls to `lw6sys_free' since program was started. -- Function: int lw6sys_get_memory_bazooka_malloc_max () Provided you have always called the `LW6SYS_MALLOC' an `LW6SYS_CALLOC' to allocate memory, this function will tell you the maximum of pointers returned by `malloc' that were present at the same time on the heap. *Return value:* the number of calls to `lw6sys_malloc' or `lw6sys_calloc' since program was started. -- Function: int lw6sys_is_memory_bazooka_trustable () Returns true if memory bazooka data are perfectly trustable, that is, it has never been resetted or resized. *Return value:* 1 if trustable, 0 if not. -- Function: int lw6sys_memory_bazooka_report () Reports memory bazooka diagnostics on the console. Carefull, this one is not reentrant, call at the end of your program when all threads are joined. *Return value:* 1 if no allocated stuff left, 0 if there are still malloc'ed stuff -- Function: char * lw6sys_build_get_package_tarname () Returns the name of the package. This is the `PACKAGE_TARNAME' constant defined by the GNU Autoconf ./configure script. While it's always possible to use the defined constant directly, using this function will return the value defined when compiling the binary, not the one you're using when compiling another program relying on Liquid War as a library. *Return value:* a non-NULL string "liquidwar6", must not be freed. -- Function: char * lw6sys_build_get_package_name () Returns the name of the package, in a user friendly form, which can include spaces, for instance. This is the `PACKAGE_NAME' constant defined by the GNU Autoconf ./configure script. While it's always possible to use the defined constant directly, using this function will return the value defined when compiling the binary, not the one you're using when compiling another program relying on Liquid War as a library. *Return value:* a non-NULL string "Liquid War 6", must not be freed. -- Function: char * lw6sys_build_get_package_string () Returns the description of the package. This is the `PACKAGE_STRING' constant defined by the GNU Autoconf ./configure script. It's the concatenation of `PACKAGE_NAME' and `VERSION'. While it's always possible to use the defined constant directly, using this function will return the value defined when compiling the binary, not the one you're using when compiling another program relying on Liquid War as a library. *Return value:* a non-NULL string "Liquid War 6 ", must not be freed. -- Function: char * lw6sys_build_get_version () Returns the version of the program. This is the `VERSION' constant defined by the GNU Autoconf ./configure script. Same as `PACKAGE_VERSION'. Note that while using a function to get `PACKAGE_TARNAME' might seem useless, having both ways to get the version, that is, a function and a constant, is very usefull. Think, for instance, that a dynamically loaded shared library might need to check its own version against the version of the core program. *Return value:* a non-NULL string, which must not be freed. -- Function: char * lw6sys_build_get_codename () Returns the the program codename. This is the little name of the version. It's been decided that all LW6 releases would take the name of a famous general, warrior, whatever. For instance, it could be "Napoleon". *Return value:* a non-NULL string, traditionnally the name of a famous general, someone which has been involved in war. Must not be freed (I mean, the string, not the general). -- Function: char * lw6sys_build_get_stamp () Returns the program stamp. This is like a serial number. It's is not the same as the version. The version is meant to be set to something readable. This is just a cryptic thing, incremented at each ./configure or each developper's "I feel like it needs to be incremented". The idea is just to keep (one more...) track of which source code is build. Ideally, this would be plugged to the source revision control system but this has some drawbacks, including that it would require it to modify files before commiting them, which is not safe, and almost impossible if you sign archives. One more point: this is a string. It's true the return value is actually a string containing the representation of an integer, but because all other build parameters are strings, and because we don't know what the future reserves, it's a string. *Return value:* a non-NULL string like "42", which must not be freed. -- Function: char * lw6sys_build_get_md5sum () Returns an md5 checkum which is caculated from C (.c and .h) source files. This is complementary with the build stamp. By default the stamp will be enough to check what has been compiled, but one can always imagine a case where Bob compiles something a little different than Alice, with the same stamp, incremented by 1 from a common source tree. They apply their own patches, for instance. This md5sum double-checks that two binaries have been built from the same sources. Note that this is not the md5 checksum of the generated binary. Nor does it include any information about scheme scripts and data. *Return value:* a non-NULL string, which must not be freed. -- Function: char * lw6sys_build_get_copyright () Returns a (very) short copyright information about the program. *Return value:* a non-NULL string, single line whithout '\n' at the end. Must not be freed. -- Function: char * lw6sys_build_get_license () Returns the license for the program (GNU GPL v3 or later). *Return value:* a non-NULL string, single line whithout '\n' at the end. Must not be freed. -- Function: char * lw6sys_build_get_configure_args () Returns the arguments passed to the GNU Autoconf ./configure script when buildling the game. Very usefull to know how the binary was generated, that is, what kind of optimizations are peculiar settings it uses. *Return value:* a non-NULL string, which, passed to ./configure again, would hopefully generate the same binary. Must not be freed. -- Function: char * lw6sys_build_get_gcc_version () Returns __VERSION__ GCC preprocessor value, that is, the human readable version of the compiler. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_cflags () Returns the arguments which would allow another program to use liquidwar6 as a library. Typically, pass this to gcc when compiling your sources. Basically contains "-I" switches which tell where the headers are. *Return value:* a non-NULL string, which must not be freed. -- Function: char * lw6sys_build_get_ldflags () Returns the arguments which would allow another program to link against liquidwar6. Pass this to gcc or libtool when compiling your program. Basically contains a "-L" option which says where the library is. Note that this will only allow you to link against the main libliquidwar6 library, but not the dynamically loaded modules. *Return value:* a non-NULL string, which must not be freed. -- Function: char * lw6sys_build_get_hostname () Returns the value return by the standard shell `hostname' command on the machine where the game has been built. Usefull to track binaries and know where do they come from. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_date () Returns the compilation date. While this information can easily be obtained with the C `__DATE__' macro, having this function is convenient for it returns a value which is the same for the whole program, and does not possibly change in every file. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_time () Returns the compilation date. While this information can easily be obtained with the C `__TIME__' macro, having this function is convenient for it returns a value which is the same for the whole program, and does not possibly change in every file. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_target_cpu () Returns the CPU this program is designed for. Convenient on i386 compatible CPUs to know which flavor (i386, i586...) the binary is made for. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_endianness () Returns the endianness of the computer. *Return value:* 'little' (x86-like) or 'big' (ppc-like), as a string. Must not be freed. -- Function: int lw6sys_build_get_pointer_size () Returns the system pointer size, in bytes. *Return value:* 4 for 32-bit, 8 for 64-bit. -- Function: int lw6sys_build_is_x86 () Tells wether CPU belongs to x86 family or not. *Return value:* 1 if x86, 0 if not -- Function: char * lw6sys_build_get_target_os () Returns the OS this program is designed for. Usefull for bug reports. *Return value:* a non-NULL string, must not be freed. -- Function: int lw6sys_build_is_ms_windows () Tells wether the program was compiled for Microsoft Windows, or not. *Return value:* 1 if compiled on windows, 0 if not -- Function: int lw6sys_build_is_mac_os_x () Tells wether the program was compiled for Mac OS X, or not. *Return value:* 1 if compiled on OS X, 0 if not -- Function: char * lw6sys_build_get_top_srcdir () Returns the top source directory, when the game was built. This can seem useless and non relevant on the end-user's machine, but... it's a must-have for developpers and packagers. Without this, binaries would never find their associated data, especially when building outside the source tree. Or, testing the game would be impossible without installing it, given the fact that most of the code is in scripts that are stored in /usr/local by default, this would be painfull. So this function is here to help finding data within the source tree when the game is not installed yet. Note that the function is rather clever, since it will automatically try to remove useless '../' sequences at the beginning of a possibly relative path. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_prefix () Returns the `prefix' value as given to the GNU Autoconf ./configure script. Used to deduce the path to other directories and files. *Return value:* a non-NULL string, "/usr/local" by default. Must not be freed. -- Function: char * lw6sys_build_get_datadir () Returns the `datadir' value defined by the GNU Autoconf ./configure script. This is not the value which can be overriden by the Liquid War 6 specific. "-data-dir" option. `datadir' is usually something like "/usr/local/share" while the actual Liquid War 6 defined data dir is a more profound path which includes the name of the package, its version, and so on. *Return value:* a non-NULL string, "/usr/local/share" by default. Must not be freed. -- Function: char * lw6sys_build_get_libdir () Returns the `libdir' value defined by the GNU Autoconf ./configure script. This is not the value which can be overriden by the Liquid War 6 specific. "-mod-dir" option. `datadir' is usually something like "/usr/local/lib" while the actual Liquid War 6 defined module dir is a more profound path which includes the name of the package, its version, and so on. *Return value:* a non-NULL string, "/usr/local/lib" by default. Must not be freed. -- Function: char * lw6sys_build_get_includedir () Returns the `includedir' value defined by the GNU Autoconf ./configure script. As for other options, it's interesting to have this value, this enables the program to inform people who want to hack the game of the place headers are supposed to be installed. *Return value:* a non-NULL string, "/usr/local/include" by default. Must not be freed. -- Function: char * lw6sys_build_get_localedir () Returns the `localedir' value defined by the GNU Autoconf ./configure script. Used as an argument for gettext / libintl functions. *Return value:* a non-NULL string, "/usr/local/share/locale" by default. Must not be freed. -- Function: char * lw6sys_build_get_docdir () Returns the `docdir' value defined by the GNU Autoconf ./configure script. Used to write consistent XML file headers. *Return value:* a non-NULL string, "/usr/local/share/doc/liquidwar6" by default. Must not be freed. -- Function: char * lw6sys_build_get_enable_console () Tells wether console is enabled or not. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_mod_gl () Tells wether the graphical mod-gl backend was compiled. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_mod_csound () Tells wether the audio mod-csound backend was compiled. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_mod_ogg () Tells wether the audio mod-ogg backend was compiled. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_mod_http () Tells wether the network mod-http backend was compiled. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_optimize () Tells wether the game was compiled in optimize mode. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_allinone () Tells wether the game was compiled in allinone mode. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_fullstatic () Tells wether the game was compiled in fullstatic mode. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_paranoid () Tells wether the game was compiled with paranoid memory management. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_gprof () Tells wether the game was compiled with suitable informations for gprof. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_instrument () Tells wether the game was compiled with the '-finstrument-fonctions' GCC flag. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_profiler () Tells wether the game was compiled for later use with Google Profiler support. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_gcov () Tells wether the game was compiled with suitable informations for gcov. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_valgrind () Tells wether the game was compiled for later use with valgrind. *Return value:* "yes" or "no", must no be freed. -- Function: void lw6sys_build_log_all () Dumps in the log file the whole program pedigree, target, modules, that is, what are the values of all the build options. Usefull for bug reports. *Return value:* none. -- Function: u_int32_t lw6sys_checksum (unsigned char * DATA, int LEN) DATA: the data to process LEN: the length, in bytes, of the data to process Creates a checksum from a byte array. This could be mapped on any standard CRC-32 and/or MD5 algorithm, but licence issues for those are such a headache that for the sake of simplicity, it's wrapped here. In LW6 context, we do not really really fear any attack for these checksums are used internally to track bugs and check, for instance, that two game states are actually the same on two distant computers in a network game. Data encryption and security of network links is another debate. Additionnally, this function returns an integer, easier to handle in standard C than any malloc'ed stuff. *Return value:* the checksum, as an integer. -- Function: u_int32_t lw6sys_checksum_str (char * VALUE) VALUE: the string to process Creates a checksum from a string. This is a convenience function to save the programmer the hassle of calling strlen before any checksum calculation. *Return value:* the checksum, as an integer. -- Function: u_int32_t lw6sys_checksum_int32 (u_int32_t VALUE) VALUE: the integer to process Creates a checksum from an integer. This is a convenience function to save the programmer the hassle of passing a pointer to the integer with the size of it each time there's a checksum to do. Additionnally, with this one you can pass an int8 or an int16, and function will work just the same indenpendantly of endianness. *Return value:* the checksum, as an integer. -- Function: u_int32_t lw6sys_checksum_int64 (u_int64_t VALUE) VALUE: the integer to process Creates a checksum from an integer. This is a convenience function to save the programmer the hassle of passing a pointer to the integer with the size of it each time there's a checksum to do. This function handles 64-bit long long integers.. *Return value:* the checksum, as an integer. -- Function: u_int32_t lw6sys_checksum_whd (lw6sys_whd_t * WHD) WHD: a pointer to the wh struct to be processed Creates a checksum from the given structure. Convenience function to save the hassle of passing a pointer to and the size of the `lw6sys_wh_t' struct each time, knowing that there are very often checksums calculated on it. Also avoids endianess issues. *Return value:* the checksum, as an integer. -- Function: u_int32_t lw6sys_checksum_xyz (lw6sys_xyz_t * XYZ) XYZ: a pointer to the xy struct to be processed Creates a checksum from the given structure. Convenience function to save the hassle of passing a pointer to and the size of the `lw6sys_xy_t' struct each time, knowing that there are very often checksums calculated on it. Also avoids endianess issues. *Return value:* the checksum, as an integer. -- Function: void lw6sys_checksum_update (u_int32_t * CHECKSUM, unsigned char * DATA, int LEN) CHECKSUM: a pointer to the previous checksum DATA: the data to process LEN: the length, in bytes, of the data to process Creates a checksum from the given data. The difference with `lw6sys_checksum' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: void lw6sys_checksum_update_str (u_int32_t * CHECKSUM, char * VALUE) CHECKSUM: a pointer to the previous checksum VALUE: the string to process Creates a checksum from the given string. The difference with `lw6sys_checksum_str' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: void lw6sys_checksum_update_int32 (u_int32_t * CHECKSUM, int32_t VALUE) CHECKSUM: a pointer to the previous checksum VALUE: the integer to process Creates a checksum from the given integer. The difference with `lw6sys_checksum_int32' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: void lw6sys_checksum_update_int64 (u_int32_t * CHECKSUM, int64_t VALUE) CHECKSUM: a pointer to the previous checksum VALUE: the integer to process Creates a checksum from the given integer. The difference with `lw6sys_checksum_int64' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: void lw6sys_checksum_update_whd (u_int32_t * CHECKSUM, lw6sys_whd_t * WHD) CHECKSUM: a pointer to the previous checksum WHD: a pointer to the wh struct to be processed Creates a checksum from the given structure. The difference with `lw6sys_checksum_whd' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: void lw6sys_checksum_update_xyz (u_int32_t * CHECKSUM, lw6sys_xyz_t * XYZ) CHECKSUM: a pointer to the previous checksum XYZ: a pointer to the xy struct to be processed Creates a checksum from the given structure. The difference with `lw6sys_checksum_xyz' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: u_int8_t lw6sys_color_float2char (float F) F: the value to convert, from 0.0f to 1.0f Converts a floating point value between 0.0f and 1.0f to its 8-bit equivalent between 0 and 255. Usefull in color conversion. *Return value:* an integer between 0 and 255. -- Function: float lw6sys_color_char2float (u_int8_t I) I: the value to convert, from 0 to 255 Converts an 8-bit value between 0 and 255 to its floating-point equivalent between 0.0f and 1.0f. Usefull in color conversion. *Return value:* a float between 0.0f and 1.0f. -- Function: lw6sys_color_8_t lw6sys_color_f_to_8 (lw6sys_color_f_t * COLOR_F) COLOR_F: the color to convert Converts a color from floating point format to the integer "0 to 255" common format. All fields (RGBA) are converted. *Return value:* the color in 8-bit format. -- Function: void lw6sys_color_8_to_f (lw6sys_color_f_t * COLOR_F, lw6sys_color_8_t COLOR_8) COLOR_F: the converted color (pointer must point to writable memory) COLOR_8: the color to convert Converts a color from the integer "0 to 255" common format to floating point format. All fields (RGBA) are converted. *Return value:* none. -- Function: u_int32_t lw6sys_color_f_to_i (lw6sys_color_f_t * COLOR_F) COLOR_F: the color to convert Converts a color from floating point format to a single integer, where all fields (RGBA) are serialized. This serialization is endianess independant. Could be used directly by low-level libraries such as SDL. *Return value:* the color serialized in an integer. -- Function: u_int32_t lw6sys_color_8_to_i (lw6sys_color_8_t COLOR_8) COLOR_8: the color to convert Converts a color from common "0 to 255" structured format to a single integer, where all fields (RGBA) are serialized. This serialization is endianess independant. Could be used directly by low-level libraries such as SDL. *Return value:* the color serialized in an integer. -- Function: void lw6sys_color_i_to_f (lw6sys_color_f_t * COLOR_F, u_int32_t COLOR_I) COLOR_F: the converted color (point must point to writable memory) COLOR_I: the color to convert Converts a color from a serialized integer format to a floating point structure. *Return value:* none. -- Function: lw6sys_color_8_t lw6sys_color_i_to_8 (u_int32_t COLOR_I) COLOR_I: the color to convert Converts a color from a serialized integer format to a "0 to 255" based structure. *Return value:* the converted color (structure). -- Function: lw6sys_color_8_t lw6sys_color_a_to_8 (char * ASCII) ASCII: the color to convert Converts a color from a human readable string to a "0 to 255" based structure. The string must be of the form "#RRGGBBAA" or "#RGB", in a general manner any HTML-valid value should work. *Return value:* the converted color (structure). -- Function: void lw6sys_color_a_to_f (lw6sys_color_f_t * COLOR_F, char * ASCII) COLOR_F: the converted color (pointer must point to writable memory) ASCII: the color to convert Converts a color from a human readable string to a float based structure. The string must be of the form "#RRGGBBAA" or "#RGB", in a general manner any HTML-valid value should work. *Return value:* none. -- Function: char * lw6sys_color_8_to_a (lw6sys_color_8_t COLOR_8) COLOR_8: the color to convert Converts a color from a "0 - 255" integer based structure to its readable form "#RRGGBBAA". If alpha is 255 (0xFF), that is, if it's opaque, then the "AA" part is ommitted. *Return value:* a newly allocated string. -- Function: void lw6sys_color_rgb_to_hsv (lw6sys_color_hsv_t * COLOR_HSV, lw6sys_color_8_t COLOR_8) COLOR_HSV: the target color, in HSV format COLOR_8: the source color, in RGB 256 format Converts from HSV to RGB. Usefull for color manipulation, since most colors are stored in RGB but HSV is convenient for transformation. Alpha layer is kept as is. *Return value:* none. -- Function: lw6sys_color_8_t lw6sys_color_hsv_to_rgb (lw6sys_color_hsv_t * COLOR_HSV) COLOR_HSV: the source color, in HSV format Converts from RGB to HSV. Usefull to make colors transformed in HSV format usable again by all display routines, which consume RGB. Alpha layer is kept as is. *Return value:* the RGB color. -- Function: lw6sys_color_8_t lw6sys_color_average (int SIZE, lw6sys_color_8_t * COLORS) SIZE: number of the color array (number of items) COLORS: the colors to compute Tries to find out the "average" color from an array of colors. The algorithm is far from perfect, but should output a color which reflects the colors passed in. *Return value:* the (inexact) average color. -- Function: lw6sys_color_8_t lw6sys_color_ponderate (lw6sys_color_8_t COLOR1, lw6sys_color_8_t COLOR2, float COEFF) COLOR1: first color COLOR2: second color COEFF: the ponderation coefficient Tries to find a color between the two colors passed as an argument. The coefficient can be used, to set the relative weight of each color. Using 0 will return color1, 1 will return color2 and 0.5 will make an average between the two colors. Any value between 0 and 1 can be used. *Return value:* the (inexact) ponderated color. -- Function: float lw6sys_color_distance (lw6sys_color_8_t COLOR1, lw6sys_color_8_t COLOR2) COLOR1: first color COLOR2: second color Calculates the distance between two colors. The unit is arbitrary, a big value means "colors are different", 0 means they are the same. A distance of 1 corresponds to colors which have barely anything in common, but the result can still be greater than 1. Alpha layer is not taken in account. *Return value:* the distance. -- Function: int lw6sys_color_is_same (lw6sys_color_8_t COLOR1, lw6sys_color_8_t COLOR2) COLOR1: the first color to compare COLOR2: the second color to compare Compares two colors. *Return value:* 1 if they are the same, 0 if not. -- Function: void lw6sys_color_8_solid (lw6sys_color_8_t * COLOR) color: the color to modify Make a color "solid" that is make it not transparent at all. *Return value:* none. -- Function: void lw6sys_color_f_solid (lw6sys_color_f_t * COLOR) color: the color to modify Make a color "solid" that is make it not transparent at all. *Return value:* none. -- Function: int lw6sys_atoi (char * STR) STR: string to convert Just a plain wrapper on `atoi', it's here for API consistency. *Return value:* an integer. -- Function: int lw6sys_atob (char * STR) STR: string to convert Transform a string into a boolean value. Accepts "0"/"1" in input, but also y/n, yes/no, true/false, on/off. *Return value:* an integer, 0 or 1. -- Function: float lw6sys_atof (char * STR) STR: string to convert A wrapper on `atof', makes sure the locale used is C (default) and won't change the decimal separator whatsoever. Usefull for serialization for instance. *Return value:* a float. -- Function: char * lw6sys_itoa (int VALUE) VALUE: the integer to convert Converts an integer to a string, the advantage of this function is it allocates memory, and does the dirty job. *Return value:* a newly allocated pointer, must be freed, may be NULL. -- Function: char * lw6sys_btoa (int VALUE) VALUE: the boolean to convert Converts a boolean to a string, the advantage of this function is it allocates memory, and does the dirty job. *Return value:* a newly allocated pointer, must be freed, may be NULL. -- Function: char * lw6sys_ftoa (float VALUE) VALUE: the float to convert Converts a float to a string, the advantage of this function is it allocates memory, and does the dirty job. *Return value:* a newly allocated pointer, must be freed, may be NULL. -- Function: int lw6sys_debug_get () Gets the debug mode. -- Function: void lw6sys_debug_set (int MODE) MODE: the debug mode, 1 if set, 0 if not. Sets the debug mode. -- Function: void lw6sys_dump_clear (char * USER_DIR) USER_DIR: the user directory, where user can write data. Clears the dump file. That is, resets it to a "0 byte" file. *Return value:* none. -- Function: int lw6sys_dump (char * USER_DIR, char * CONTENT) USER_DIR: the user directory, where user can write data. CONTENT: the content to be written in the dump file. Writes the dump file onto the disk. The dump is used for special error messages which do not really fit in the standard log, and require a special treatment. In pratice, it's used to log fatal script (Guile) errors. *Return value:* 1 if success, 0 if failure. -- Function: char lw6sys_env_separator_char () Gets the ENV separator, that is, for instance, the character used to separate paths in environment variables. Typically, this would be ":" on GNU and ";" on Microsft platforms. *Return value:* the ascii character code. -- Function: char * lw6sys_env_separator_str () Gets the ENV separator, that is, for instance, the character used to separate paths in environment variables. Typically, this would be ":" on GNU and ";" on Microsft platforms. *Return value:* a pointer to a single 0-terminated character string which contains the character. Must not be freed. -- Function: char * lw6sys_env_concat (char * VALUE1, char * VALUE2) VALUE1: the left part to be concatenated VALUE2: the right part to be concatenated Concatenates two values and puts the ENV separator, as returned by `lw6sys_env_separator_char' between them. *Return value:* the concatenated string, must be freed. -- Function: int lw6sys_env_exists (char * KEYWORD) KEYWORD: the keyword to be searched in the environment variables. Searches environment variables for the given keyword. The keyword will be fixed so that all dashes "-" characters are replaced by underscores "_" characters. Characters will be changed to uppercase. Any non alphanumeric character will be replaced by "_". Finally, an "LW6_" prefix will be added. That is to say, calling this function with "my-param" will search for the "LW6_MY_PARAM" environment variable. *Return value:* 1 if the environment variable exists, 0 if not. -- Function: char * lw6sys_getenv (char * KEYWORD) KEYWORD: the keyword to be searched in the environment variables. Searches environment variables for the given value. The keyword will be fixed so that all dashes "-" characters are replaced by underscores "_" characters. Characters will be changed to uppercase. Any non alphanumeric character will be replaced by "_". Finally, an "LW6_" prefix will be added. That is to say, calling this function with "my-param" will search for the "LW6_MY_PARAM" environment variable. *Return value:* the value for the given keyword. May be NULL. Must be freed. -- Function: int lw6sys_setenv (char * KEYWORD, char * VALUE) KEYWORD: the environment variable to set VALUE: the value of the environment variable to set Sets the environment variable to a given value. If value is NULL, variable is unset. Note that unlike lw6sys_getenv, this function does not transform the keyword into "LW6_..." before setting the value, so it's your responsability to call "lw6sys_keyword_as_env" if needed. *Return value:* 1 if success, 0 if failed -- Function: lw6sys_list_t * lw6sys_env_split (char * VALUE) VALUE: the value, a list of item separated by... the separator Splits the environment value into a list of strings containing each element. All strings are dynamically allocated, but they will be freed automatically when the list is freed. *Return value:* a list of strings. -- Function: char * lw6sys_get_home () Gets the home directory of the user. Used internally to calculate the `user'-dir value. Note that Liquid War 6, by default, never stores files under '$HOME', instead it put things in '$HOME/.liquidwar6', that is 'user-dir'. If the environment variable 'HOME' is not set, will return '.'. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_get_username () Gets the name of the current user. Difference with the standard function `getlogin' is that this function will returned a dynamically allocated pointer, and provide a default value if it's undefined. Also, if will look at the content of the 'LOGNAME' environment variable if needed, and will even provide a default value. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_get_hostname () Gets the name of the current host. The name of the computer. Might not work perfectly, this function is just used to provide default values for player names and such things. *Return value:* a newly allocated pointer, must be freed. -- Function: int lw6sys_clear_file (char * FILENAME) FILENAME: absolute or relative filename Clears a file, that is, make it a 0 byte file, empty, ready to be filled if needed. If this function is called successfully, program can reasonnably assume file will be writable during its execution. *Return value:* 1 if success, 0 if failure. -- Function: char * lw6sys_read_file_content (char * FILENAME) FILENAME: absolute or relative filename Reads the content of a file, and returns it as a string. Note that content might or might not be ascii or binary, the function will however put a tailing 0 character at the end so that low-level standard C functions do not segfault when used with the returned value. *Return value:* a newly allocated pointer, must be freed. -- Function: int lw6sys_write_file_content (char * FILENAME, char * CONTENT) FILENAME: absolute or relative filename CONTENT: the content to be written. Writes the content into the file. Content is assumed to be a string, function will segfault if it's not correctly 0 terminated as in C string convention. So this function will not allow you to write down arbitrary binary data, however LW6 uses mostly text files to store information, and opaque binary data usage is not recommended. -- Function: lw6sys_hash_t * lw6sys_hash_new (lw6sys_free_func_t FREE_FUNC, int SIZE) FREE_FUNC: optional callback used to free memory when stored date is a pointer. Can be NULL when one stores non dynamically allocated data, such as an integer or a static array. SIZE: the estimated size of the hash table. Note that this is an estimation only. You could theorically fit 1000000 objects in a 3-sized hash. Problem -> this is inefficient, you'd better use an assoc or a bigger hash. If you store 3 elements in a 1000000-sized hash, you'll waste memory. It might be wise to use a prime number as the estimated size. 421 is prime ;) Creates an empty hash. There's a difference between NULL and an empty hash. *Return value:* a pointer to the newly allocated hash table. Must be freed with `lw6sys_hash_free'. -- Function: void lw6sys_hash_free (lw6sys_hash_t * HASH) HASH: the hash to be freed. The function will cascade delete all elements, using (if not NULL...) the callback passed when first creating the hash. *Return value:* void -- Function: int lw6sys_hash_has_key (lw6sys_hash_t * HASH, char * KEY) HASH: the hash to test KEY: the key to search Not a very fast function, since on a "big" hash, strcmp will be called internally until the key is found. *Return value:* non-zero if there's an entry with the corresponding key. -- Function: void * lw6sys_hash_get (lw6sys_hash_t * HASH, char * KEY) HASH: the hash to query KEY: the key of which we want the value *Return value:* a void pointer to the data contained in the hash. Note that the pointer on the actual data is returned, that is, if it's static data, you must not try to free it... As long as memory management is concerned, destroying the hash will actually free the data if needed. -- Function: void lw6sys_hash_set (lw6sys_hash_t * HASH, char * KEY, void * VALUE) HASH: the hash to modify KEY: the key we want to updated VALUE: the new value Sets a value in a hash table. The key pointer need not be persistent, it can be freed after affectation. In fact a new string will be created internally. This is not true for the value, it's hard to find way to copy "any object". So if you want a hash table of strings, key can disappear after calling this function, but not value. The function passed as free_func when creating the hash will be used to free stuff whenever needed (unset or free). *Return value:* void -- Function: void lw6sys_hash_unset (lw6sys_hash_t * HASH, char * KEY) HASH: the hash concerned KEY: the key to unset Clears an entry in a hash table. The callback passed when creating the hash will be called if needed, to free the data automatically. *Return value:* void -- Function: lw6sys_list_t * lw6sys_hash_keys (lw6sys_hash_t * HASH) HASH: the hash to work on Returns a list containing all the keys of the hash. The list must be free with lw6sys_list_free by the caller. This list copies all the keys of the hash, so it is safe to use it once the hash is deleted. However the keys will of course be of little interest in this case. But the program won't segfault. *Return value:* the list of keys. -- Function: void lw6sys_hash_map (lw6sys_hash_t * HASH, lw6sys_assoc_callback_func_t FUNC, void * FUNC_DATA) HASH: the hash to work on FUNC: a callback to call on each entry FUNC_DATA: a pointer on some data which will be passed to the callback Executes a function on all hash items. The func_data parameter allows you to pass extra values to the function, such as a file handler or any variable which can not be inferred from list item values, and you of course do not want to make global... *Return value:* void -- Function: void lw6sys_hash_sort_and_map (lw6sys_hash_t * HASH, lw6sys_assoc_callback_func_t FUNC, void * FUNC_DATA) HASH: the hash to work on FUNC: a callback to call on each entry, may be NULL FUNC_DATA: a pointer on some data which will be passed to the callback Executes a function on all hash items, like `lw6sys_hash_sort_and_map' but befor doing so, sorts all entries in alphabetical order. *Return value:* void -- Function: lw6sys_hash_t * lw6sys_hash_dup (lw6sys_hash_t * HASH, lw6sys_dup_func_t DUP_FUNC) HASH: the hash to duplicate, can be NULL DUP_FUNC: the function which will be called to duplicate data Duplicates an hash. All keys will be copied so that if the first hash is deleted, the duplicated one is fine. Additionnaly, dup_func will be called with all data fields. If dup_func is NULL, then data values will simply be copied. This is likely to be usefull when data is not dynamically allocated. *Returned value:* a newly allocated hash. -- Function: lw6sys_hexa_serializer_t * lw6sys_hexa_serializer_new (char * HEXA_STRING) HEXA_STRING: an initialization string, can be NULL. Creates an hexa serializer object. It can be initialized or not, if an initialization string is provided it must of course be valid hexadecimal ascii code, and all serialized content will simply be appended to it. *Return value:* a newly allocated object. -- Function: void lw6sys_hexa_serializer_free (lw6sys_hexa_serializer_t * HEXA_SERIALIZER) HEXA_SERIALIZER: an hexa serializer object Frees an hexa serializer object. *Return value:* none. -- Function: void lw6sys_hexa_serializer_rewind (lw6sys_hexa_serializer_t * HEXA_SERIALIZER) HEXA_SERIALIZER: an hexa serializer object Rewinds the serializer pointer, that is, make it point to start. Usefull before calling pop functions, when one wants to be sure to get the first object. *Return value:* none. -- Function: int lw6sys_hexa_serializer_eof (lw6sys_hexa_serializer_t * HEXA_SERIALIZER) HEXA_SERIALIZER: an hexa serializer object Tests wether we're at EOF. Usefull when one wants to know if there's still some data or if all objects have been correctly popped. *Return value:* 1 if at end of file, 0 if not. -- Function: char * lw6sys_hexa_serializer_as_string (lw6sys_hexa_serializer_t * HEXA_SERIALIZER) HEXA_SERIALIZER: an hexa serializer object Exports the current content of the serializer as a string. String can then safely be sent on the network, for instance. String is copied from internal value, so it's safe to use it after serializer has been freed or modified. *Return value:* a newly allocated string, must be freed. -- Function: int lw6sys_hexa_serializer_push_int64 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int64_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a 64 bit integer in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_int32 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int32_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a 32 bit integer in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_int16 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int16_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a 16 bit integer in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_int8 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int8_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes an 8 bit integer in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_float (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, float VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a floating point value in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_str (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, char * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a string in the serializer object. Note that the string is not directly copied in the serializer, instead all its characters are converted to their ASCII equivalent, then appended. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_xyz (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_xyz_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a lw6sys_xyz_t structure in the serializer object. Calling this avoids calling push for 2 integers separately. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_whd (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_whd_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a lw6sys_whd_t structure in the serializer object. Calling this avoids calling push for 2 integers separately. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_color (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_color_8_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a color structure in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_int64 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int64_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a 64 bit integer from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_int32 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int32_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a 32 bit integer from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_int16 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int16_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a 16 bit integer from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_int8 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int8_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops an 8 bit integer from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_float (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, float * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a floating point value from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_str (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, char ** VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a string from the serializer object. The returned value is a newly allocated pointer, which must be freed, you don't need to provide a buffer, just a valid pointer on a NULL pointer. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_xyz (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_xyz_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a lw6sys_xyz_t structure from the serializer object. Avoids calling two integer pops. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_whd (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_whd_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a lw6sys_whd_t structure from the serializer object. Avoids calling two integer pops. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_color (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_color_8_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a color from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: void lw6sys_history_init () Initializes the history system. Not initializing won't cause any segfault, but data will be inconsistent. *Return value:* none. -- Function: void lw6sys_history_register (char * MSG) MSG: the message to register. Registers a message in the history log, that is, adds it. *Return value:* none. -- Function: char_ptr_t * lw6sys_history_get (int64_t TIMEOUT) TIMEOUT: the message age limit. Get all the messages that are younger than timeout (in seconds). *Return value:* a pointer on string pointers. May be NULL. Last pointer is NULL too, that's how you know the array is over. -- Function: void lw6sys_history_free (char ** HISTORY) HISTORY: the data to free Frees a pointer returned by `lw6sys_history_get'. *Return value:* none. -- Function: char * lw6sys_locale_to_utf8 (char * STRING) STRING: the string to convert Used to force strings into UTF-8 mode, this is basically to match the TTF font settings used when displaying stuff on OpenGL. Indeed, in this case, the standard _ gettext function won't work, we need to force UTF-8 mode. If the locale is UTF-8, then function does nothing, but at least it's transparent usage won't hurt. *Returned value:* a newly allocated string, always in UTF-8 no matter what the locale is. -- Function: u_int16_t lw6sys_generate_id_16 () Long 16-bit ID generator, calls the random function internally. As usual, those are not perfect random numbers, however the function implementation emphasizes more on 'real randomness' rather than relying on performance. Generating twice the same number should be fairly rare. -- Function: u_int32_t lw6sys_generate_id_32 () Long 32-bit ID generator, calls the random function internally. As usual, those are not perfect random numbers, however the function implementation emphasizes more on 'real randomness' rather than relying on performance. Generating twice the same number should be fairly rare. -- Function: u_int64_t lw6sys_generate_id_64 () Long 64-bit ID generator, calls the random function internally. As usual, those are not perfect random numbers, however the function implementation emphasizes more on 'real randomness' rather than relying on performance. Generating twice the same number should be fairly rare. -- Function: int lw6sys_check_id_16 (u_int16_t ID_16) ID_16: the id to check Checks wether the given id is a valid 16-bit id. *Return value:* 1 if OK, 0 if not a valid id. -- Function: int lw6sys_check_id_32 (u_int32_t ID_32) ID_32: the id to check Checks wether the given id is a valid 32-bit id. *Return value:* 1 if OK, 0 if not a valid id. -- Function: int lw6sys_check_id_64 (u_int64_t ID_64) ID_64: the id to check Checks wether the given id is a valid 64-bit id. *Return value:* 1 if OK, 0 if not a valid id. -- Function: int lw6sys_check_id (u_int64_t ID) ID: the id to check Checks wether the given id is a valid id (16, 32 or 64-bit). *Return value:* 1 if OK, 0 if not a valid id. -- Function: char * lw6sys_id_ltoa (u_int64_t ID) id: the id to convert Transform an id into its string representation. Error checking is done, if the id is invalid, returned value is NULL. All ids (16, 32 and 64-bit) are handled. *Return value:* a newly allocated string, might be NULL. -- Function: u_int64_t lw6sys_id_atol (char * ID) id: the id to convert Transform an id into a long integer. Error checking is done, if the id is invalid, returned value is 0. All ids (16, 32 and 64-bit) are handled. *Return value:* the id as a long integer, 0 if incorrect source id. -- Function: char * lw6sys_keyword_as_key (char * KEYWORD) KEYWORD: the keyword to transform Transforms a keyword into a "key", that is, removes all heading dashes, switches to lowercase, and other stuff. This is used internally to match options and config file parameters, for instance. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_keyword_as_arg (char * KEYWORD) KEYWORD: the keyword to transform Transforms a keyword into a command-line parameter to be matched. Does the same as `lw6sys_keyword_as_key', and adds a "-" prefix. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_keyword_as_env (char * KEYWORD) KEYWORD: the keyword to transform Transforms a keyword into the corresponding environment variable name. It will uppercase the name, replace "-" by "_", and add a "LW6_" prefix. "my-param" will become "LW6_MY_PARAM". *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_keyword_as_xml (char * KEYWORD) KEYWORD: the keyword to transform Transforms a keyword into the corresponding config file entry. In practice, just the same as `lw6sys_keyword_as_key'. *Return value:* a newly allocated pointer, must be freed. -- Function: lw6sys_list_t * lw6sys_list_new (lw6sys_free_func_t FREE_FUNC) FREE_FUNC: a callback which will be called on data when freeing the list Creates an empty list. There's a difference between NULL and an empty list. The empty list would (in Scheme) be '() whereas NULL corresponds to undefined "is not a list and will generate errors if you ever call list functions on it". *Return value:* a pointer to the created object, may be NULL. -- Function: void lw6sys_list_free (lw6sys_list_t * LIST) LIST: the list to delete. Delete a list, this will cascade delete all the following items in the list. *Return value:* none. -- Function: lw6sys_list_t * lw6sys_list_next (lw6sys_list_t * LIST) LIST: the current position in the list It's safer to call this rather than dig right into the internals of the list. *Return value:* a new position in the list, may be NULL. -- Function: int lw6sys_list_is_empty (lw6sys_list_t * LIST) LIST: the list we want informations about Checks wether the list is empty or not. Note that being empty and being NULL is not the same. An empty list is a valid pointer on a list where there's no item, a NULL pointer is not a list at all. Do *NOT* call this function on NULL. *Return value:* 1 if empty, 0 if there is at list one item. -- Function: int lw6sys_list_length (lw6sys_list_t * LIST) LIST: the list we want informations about Calculates the length of the list. This is a performance killer for lists are inadapted to this. But it can still be usefull. *Return value:* the number of elements, 0 is none (empty list). -- Function: void lw6sys_list_map (lw6sys_list_t * LIST, lw6sys_list_callback_func_t FUNC, void * FUNC_DATA) LIST: the list where elements will be taken FUNC: the function which will be executed FUNC_DATA: additionnal data to be passed to `func' Executes a function on all list items. The `func_data' parameter allows you to pass extra values to the function, such as a file handler or any variable which can not be inferred from list item values, and you of course do not want to make global... Not as convenient as a real "for each" construct as can be found in any modern langage, but does the job. No return value, if you really want one, pass a structure in `func_data' and modify something in it on success, failure, whatever. *Return value:* none. -- Function: void lw6sys_list_push_front (lw6sys_list_t ** LIST, void * DATA) LIST: a pointer to the list (pointer on pointer, read/write value) DATA: the data to be pushed Pushes data on the list. The `free_func' function is copied from the previous element. The pointer on the list is changed "in place" (in/out). Note that if there's a `malloc' problem it might end-up being NULL... This should be rare but it *can* happen. You cannot push something else than a pointer, pushing an int is a very bad idea. Push a pointer on the integer, and ensure it's always there, or `malloc' it and pass `lw6sys_free_callback' when creating the list. If you think you can cast an integer into a pointer, think 64-bit machines... *Return value:* none. -- Function: void * lw6sys_list_pop_front (lw6sys_list_t ** LIST) LIST: a pointer to the list (pointer on pointer, read/write value) Pops data from the list, the returned value is what was passed to list_push. The pointer on the list is changed "in place" (in/out). When data is popped, that needs some freeing (i.e. free_func was not NULL when creating the list) then it's the responsibility of the caller to free it when popping it. One popped it's not freed, but it's out of the list scope. Of course the lw6sys_list_t is freed, but not the data. If you happen to store non-NULL data in your list, you can call this function without bothering calling `lw6sys_list_is_empty' and assume that when you get NULL, there's no data left. At this stage, the list won't exist anymore BTW, you won't even need to free it. The idea is: popping a list which has no elements left (empty list) destroys the list and returns NULL. *Return value:* a pointer on the popped data, whatever you pushed. -- Function: void lw6sys_list_push_back (lw6sys_list_t ** LIST, void * DATA) LIST: a pointer to the list (pointer on pointer, read/write value) DATA: the data to be pushed Pushes data on the list. The `free_func' function is copied from the previous element. The pointer on the list is changed "in place" (in/out). Note that if there's a `malloc' problem it might end-up being NULL... This should be rare but it *can* happen. You cannot push something else than a pointer, pushing an int is a very bad idea. Push a pointer on the integer, and ensure it's always there, or `malloc' it and pass `lw6sys_free_callback' when creating the list. If you think you can cast an integer into a pointer, think 64-bit machines... *Return value:* none. -- Function: void * lw6sys_list_pop_back (lw6sys_list_t ** LIST) LIST: a pointer to the list (pointer on pointer, read/write value) Pops data from the list, the returned value is what was passed to list_push. The pointer on the list is changed "in place" (in/out). When data is popped, that needs some freeing (i.e. free_func was not NULL when creating the list) then it's the responsibility of the caller to free it when popping it. One popped it's not freed, but it's out of the list scope. Of course the lw6sys_list_t is freed, but not the data. If you happen to store non-NULL data in your list, you can call this function without bothering calling `lw6sys_list_is_empty' and assume that when you get NULL, there's no data left. At this stage, the list won't exist anymore BTW, you won't even need to free it. The idea is: popping a list which has no elements left (empty list) destroys the list and returns NULL. *Return value:* a pointer on the popped data, whatever you pushed. -- Function: lw6sys_list_t * lw6sys_list_dup (lw6sys_list_t * LIST, lw6sys_dup_func_t DUP_FUNC) LIST: the list to duplicate, can be NULL DUP_FUNC: the function which will be called to duplicate data Duplicates a list. All data will be copied so that if the first list is deleted, the duplicated one is fine. Addtionnally, dup_func will be called to filter all data, and possibly allocated new pointers if needed, for instance. If dup_func is NULL, then data values will simply be copied. This is likely to be usefull when data is not dynamically allocated. *Returned value:* a newly allocated list. -- Function: void lw6sys_log_set_file (char * FILENAME) FILENAME: the name of the log file. Sets up the log file. Until you call this function, messages all logged to the default log file, as returned by the `lw6sys_get_default_log_file' function. *Return value:* void -- Function: void lw6sys_log_clear (char * FILENAME) FILENAME: the name of the log file. Clears the log file, this function would typically be called at the beginning of the program. If filename is NULL, then the default log file is cleared. *Return value:* void -- Function: void lw6sys_log (int LEVEL_ID, char * FILE, int LINE, char * FMT, ...) LEVEL_ID: the log level to use. Possible values are, by order, LW6SYS_LOG_ERROR_ID (0), LW6SYS_LOG_WARNING_ID (1), LW6SYS_LOG_NOTICE_ID (2), LW6SYS_LOG_INFO_ID (3), LW6SYS_LOG_DEBUG_ID (4) and LW6SYS_LOG_TMP_ID (5). FILE: the name of the source file where the function is called, one can use __FILE__ LINE: the line in the source file where the function is called, one can use __LINE__ FMT: a printf-like format string ...: printf-like arguments, corresponding to `fmt'. This function is usually called with the first three arguments packed into a single macro. For instance the `LW6SYS_LOG_WARNING' macro expands and fills the first 3 args, so there's no need to type __FILE__ and __LINE__ again and again. Note that this function will reset errno. The idea is to call it whenever there's something to do with errno (if you deal with errno, it's a good habit to log it) then errno is cleared so that it won't interfere with next log messages. -- Function: void lw6sys_log_critical (char * FMT, ...) FMT: a printf-like format string ...: printf-like arguments, corresponding to `fmt'. This function is a special log function which will dump informations on the console only, without opening any log file whatsoever. The idea is that it's a "never fail" function. Additionnally, it will never return but quit the program. This can be used as an ultimate emergency function, use it when the program won't run for sure, and displaying an immediate error message is the only issue. -- Function: int lw6sys_log_get_level () -- Function: void lw6sys_log_set_level (int LEVEL) LEVEL: the log level, integer between 0 & 4. 4 is very verbose (debug), 0 displays errors only. -- Function: void lw6sys_math_poly_wy1y2s1 (float * Y, float * S, float X, float W, float Y1, float Y2, float S1) Y: the return value (position, may be NULL) S: the return value (speed, may be NULL) X: the x parameter, the value to iterate on W: the width, that is, the x value after which output is constant Y1: the initial value, when v is s1 and x=0 Y2: the target value, when v=0 and x>=w S1: the initial speed, that is dy/dx at x=0 A function which can be used to implement smooth moving. It will extrapolate, for values of x>=0, an y position with a continuous derivate (dy/dx is continuous, function is 2nd order polynom) and which ends up at x=w with a constant value, that is dy/dx=v=0. Typically an item set with an initial speed of v with this function -- Function: float lw6sys_math_angle_360 (int X, int Y) X: x coordinate Y: y coordinate This is a wrapper over the standard `atan' function which will handle internally the special x == 0 case and the various positive/negative values of `x' and `y'. *Return value:* the angle, in degrees -- Function: float lw6sys_math_heartbeat (int64_t X, int PERIOD, float Y1, float Y2) X: the parameter (typically a timestamp) PERIOD: the period (typically something like 1000 milliseconds) Y1: the low value (heart at rest) Y2: the high value (when bumping) A heartbeat function, typically usefull to power up eye-candy, but it could do something else. -- Function: int lw6sys_math_blink (int64_t X, int PERIOD) X: the parameter (typically a timestamp) PERIOD: the period (typically something like 1000 milliseconds) This function will alternatively return 1 or 0, usefull to handle blinking for instance. *Return value:* 0 or 1 -- Function: void * lw6sys_malloc (int SIZE, char * FILE, int LINE) SIZE: number of bytes to allocate. FILE: name of the file calling the function, use `__FILE__' LINE: line in the file calling the function, use `__LINE__' This is a wrapper over the standard `malloc' function. Additionnally it will keep track of the call with an internal program-wide counter, thus enabling memory leak checks. You should not use this function directly but use the macro `LW6SYS_MALLOC' which has the same syntax, without the last two parameters, which are automatically provided by macro expansion. *Return value:* the newly allocated pointer. Data is not initialized. -- Function: void * lw6sys_calloc (int SIZE, char * FILE, int LINE) SIZE: number of bytes to allocate. FILE: name of the file calling the function, use `__FILE__' LINE: line in the file calling the function, use `__LINE__' This is a wrapper over the standard `calloc' function. Additionnally it will keep track of the call with an internal program-wide counter, thus enabling memory leak checks. You should not use this function directly but use the macro `LW6SYS_CALLOC' which has the same syntax, without the last two parameters, which are automatically provided by macro expansion. *Return value:* the newly allocated pointer. Data is filled with zeros. -- Function: void * lw6sys_realloc (void * PTR, int SIZE, char * FILE, int LINE) PTR: the pointer to reallocate. SIZE: number of bytes to allocate. FILE: name of the file calling the function, use `__FILE__' LINE: line in the file calling the function, use `__LINE__' This is a wrapper over the standard `realloc' function. You should not use this function directly but use the macro `LW6SYS_REALLOC' which has the same syntax, without the last two parameters, which are automatically provided by macro expansion. *Return value:* the newly allocated pointer. -- Function: void lw6sys_free (void * PTR, char * FILE, int LINE) PTR: the pointer to free. FILE: name of the file calling the function, use `__FILE__' LINE: line in the file calling the function, use `__LINE__' This is a wrapper over the standard `free' function. Additionnally it will keep track of the call with an internal program-wide counter, thus enabling memory leak checks. You should not use this function directly but use the macro `LW6SYS_FREE' which has the same syntax, without the last two parameters, which are automatically provided by macro expansion. *Return value:* none. -- Function: void lw6sys_free_callback (void * PTR) PTR: the pointer to free. This is a callback to be used when the `lw6sys_free' does not fit. A good example is a list, which, to free its elements, requires you to provide a callback that only takes 1 arg, the pointer to free. Problem, `lw6sys_free' takes 3 args. And the `LW6SYS_FREE' macro is not usable in such a context. And you can't use standard `free' either for it would mess up the `malloc' / `free' automatical count which is so convenient to track memory leaks. So this callback is here, it's only drawback is that in case of an error, the error will not be reported with the real file and line parameters. It's still better than nothing. *Return value:* none. -- Function: int lw6sys_megabytes_available () Gives a raw approximation of available memory, in megabytes. Value is to be taken with distance, but it can give good hints when system is running short of ressources. *Return value:* number of megabytes (physical memory) available. -- Function: int lw6sys_is_big_endian () Checks the endianess of the machine. PPC is big endian, for instance. *Return value:* 1 if system is big endian, 0 if little endian. -- Function: int lw6sys_is_little_endian () Checks the endianess of the machine. x86 is little endian, for instance. *Return value:* 1 if system is little endian, 0 if big endian. -- Function: int lw6sys_check_types_size () Checks of common types and usefull structures, this is a debugging function which helps finding compiler strange behaviors and programmer's bad intuitions. *Return value:* 1 if everything is OK, 0 if error. -- Function: void * lw6sys_mutex_create () Creates a mutex object. *Return value:* newly allocated pointer. -- Function: void lw6sys_mutex_destroy (void * MUTEX) MUTEX: the mutex to destroy. Destroys a mutex object. *Return value:* none. -- Function: int lw6sys_mutex_lock (void * MUTEX) MUTEX: the mutex to use Locks the mutex. Note that this should never fail unless there's a serious initialization problem, instead, function will wait forever until mutex is released. *Return value:* 1 if success, 0 if failure. -- Function: int lw6sys_mutex_trylock (void * MUTEX) MUTEX: the mutex to use Tries to locks the mutex. That is, tells wether mutex can be locked immediately or not. Note that this does not mean there's 100% chance next call to lock will terminated immediately, since lock can still be acquired by another thread. *Return value:* 1 if mutex unlocked, 0 if locked or error. -- Function: int lw6sys_mutex_unlock (void * MUTEX) MUTEX: the mutex to use Unlocks a mutex. *Return value:* 1 if sucess, 0 if error. -- Function: int lw6sys_get_mutex_lock_count () Returns how many mutexes have been locked since program start. Usefull for sanity checking when debugging. *Return value:* number of calls to lock -- Function: int lw6sys_get_mutex_unlock_count () Returns how many mutexes have been unlocked since program start. Usefull for sanity checking when debugging. *Return value:* number of calls to unlock -- Function: int lw6sys_check_mutex_count () Checks wether unlock has been called as many times as lock. Usefull for sanity checking when debugging. *Return value:* 1 if OK, 0 if inconsistency. -- Function: int lw6sys_true () Function which returns always true, that is, something different than 0. -- Function: int lw6sys_false () Function which returns always false, that is, 0. This can seem totally useless but it does have some utility. It's used for instance to "fool" the compiler and force it to compile and link functions in binaries, so that, afterwards, dynamically loaded .so files can find in the main binary some functions which would otherwise be stripped during the final link. -- Function: char * lw6sys_get_default_user_dir () Returns the default user directory. Note that this value is not static, it can depend, for instance, of the environment variable `HOME'. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_config_file () Returns the default config file. Note that this value is not static, it can depend, for instance, of the environment variable `HOME'. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_log_file () Returns the default log file. Note that this value is not static, it can depend, for instance, of the environment variable `HOME'. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_prefix () Returns the default prefix, could be /usr/local for instance. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_mod_dir () Returns the default module directory (dynamically loaded libraries). *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_data_dir () Returns the default data directory. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_map_dir () Returns the default map directory. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_map_path () Returns the default map path, which can be composed of several directories. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_script_file () Returns the default script file. *Return value:* a newly allocated string. -- Function: void lw6sys_options_log_defaults () Logs all default values to log file. Usefull for debugging, to know where the program is searching for its informations. -- Function: char * lw6sys_get_cwd () Returns the current working directory (absolute path). *Return value:* a newly allocated string. -- Function: char * lw6sys_get_run_dir (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the binary directory, that is, the directory the binary is stored in. This is calculated dynamically, by interpreting command-line arguments. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_user_dir (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the user dir, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_config_file (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the config file, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_log_file (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the log file, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_prefix (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the prefix, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_mod_dir (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the mod dir (modules, shared .so), taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_data_dir (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the data dir, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_map_dir (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the map dir, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_map_path (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the map path, taking in account command-line and environment variables. However config file content has no impact on the result. Map path can contain several directories. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_script_file (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the script file, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: void lw6sys_options_log (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Logs all the main options values which are not config-file dependant but depend on built-in defaults, command-line arguments and environment variables. Usefull to debug and know where the program is searching for things. -- Function: int lw6sys_file_exists (char * FILENAME) FILENAME: the file to test Tests the existence of a file on the filesystem. File is considered to exists if it's at least readable. *Return value:* 1 if OK, 0 if file doesn't exist or can't be read. -- Function: int lw6sys_dir_exists (char * DIRNAME) DIRNAME: the directory to test Tests the existence of a directory on the filesystem. *Return value:* 1 if OK, 0 if directory doesn't exist. -- Function: int lw6sys_create_dir (char * DIRNAME) DIRNAME: the directory to create Creates a directory, performing sanity checks such as verifying the directory really exists after being created. *Return value:* 1 if OK, 0 if error. -- Function: int lw6sys_create_dir_silent (char * DIRNAME) DIRNAME: the directory to create Creates a directory like `lw6sys_create_dir' but this function is silent in the sense that it won't log any error. Usefull to create the log directory itself, for instance, and avoid infinite loops on error. *Return value:* 1 if OK, 0 if error. -- Function: char * lw6sys_path_add_slash (char * PATH) PATH: a path Adds a slash, or in a general manner, a directory separator, at the end of a path, if needed. So /foo/bar will become /foo/bar/ but /bar/foo/ will remain /bar/foo/. *Return value:* a newly allocated string, must be freed. -- Function: char * lw6sys_path_strip_slash (char * PATH) PATH: a path Strips the slash, or in a general manner, the directory separator, at the end of a path, if needed. So /foo/bar/ will become /foo/bar but /bar/foo will remain /bar/foo. *Return value:* a newly allocated string, must be freed. -- Function: char * lw6sys_path_concat (char * PATH1, char * PATH2) PATH1: left part of the path PATH2: right part of the path Concatenates 2 parts of a path. Function will try to avoid stupid "double-slash" when concatenating /foo/ with /bar/ and conversely insert a directory separator when concatenating /foo with bar/. *Return value:* a newly allocated string, must be freed. -- Function: lw6sys_list_t * lw6sys_path_split (char * PATH) PATH: a path Splits a path into all its parts. For instance /boo/bar/foo2/bar2 returns a 4 elements list. This is more than a plain split, for heading and tailing slashes will be ignored, and various path separators will be interpreted (depends on platform). *Return value:* a list containing 0-terminated strings. -- Function: int lw6sys_path_is_relative (char * PATH) PATH: a path Checks wether a path is relative or absolute. *Return value:* 1 if relative, 0 if absolute. -- Function: int lw6sys_path_is_cwd (char * PATH) PATH: a path Checks wether a path is "." or not. Will also trap "" and "./". *Return value:* 1 if relative, 0 if absolute. -- Function: char * lw6sys_path_parent (char * PATH) PATH: a path Returns the parent path. That will return /foo when given /foo/bar in input. *Return value:* a newly allocated string, must be freed. -- Function: char * lw6sys_path_unparent (char * PATH) PATH: a path Given the ../foo/bar path, will return foo/bar. Usefull to get rid of heading ../ when a path is known to start with it. *Return value:* a newly allocated string, must be freed. -- Function: char * lw6sys_path_unparent_no_malloc (char * PATH) PATH: a path Given the ../foo/bar path, will return foo/bar. Usefull to get rid of heading ../ when a path is known to start with it. This is different from `lw6sys_path_unparent' just because the result is not dynamically allocated and copied from source. *Return value:* a pointer which points somewhere within the string passed as an argument. -- Function: void lw6sys_print_xml_header (FILE * F, char * COMMENT) F: file to output content to Prints a standard Liquid War compliant XML header in the given file. *Return value:* none. -- Function: void lw6sys_print_xml_footer (FILE * F) F: file to output content to Prints a standard Liquid War 6 compliant XML footer in the given file. *Return value:* none. -- Function: int lw6sys_profiler_check (int VERBOSE) VERBOSE: wether to display informations on the console Checks wether Google Profiler support has been built, and if it's set, outputs the log file. If CPUPROFILE is defined but binary has no support for it, will display a warning message. *Return value:* 1 if google profile enabled and activated, 0 if not -- Function: void lw6sys_progress_default (lw6sys_progress_t * PROGRESS, float * VALUE) PROGRESS: the progress struct to initialize VALUE: the value to point to Sets a progress struct to default values, that is, ranging from 0.0f to 1.0f. *Return value:* none. -- Function: void lw6sys_progress_update (lw6sys_progress_t * PROGRESS, int MIN, int MAX, int VALUE) PROGRESS: the progress struct to update MIN: the min value MAX: the max value VALUE: the current value Updates a progress struct. This is typically the function used by a callback to show the progress of a process. Note that this is note an initializer. Rather, the progress struct was initialized before, and this call is done in a loop with min being 0, max being the last value in the loop, and value the current index in the loop. NULL pointers correctly handled internally, so call this with any parameters, it's safe. *Return value:* none. -- Function: void lw6sys_progress_split (lw6sys_progress_t * PROGRESS1, lw6sys_progress_t * PROGRESS2, lw6sys_progress_t * PROGRESS_SRC) progress1: the first part of the splitted progress progress2: the second part of the splitted progress progress_src: the progress to split Utility function to split a progress struct, that is, if a progress was ranging from a to b, make 2 progress structs, ranging from a to c and from c to b, c being between a and b. *Return value:* none -- Function: void lw6sys_progress_split3 (lw6sys_progress_t * PROGRESS1, lw6sys_progress_t * PROGRESS2, lw6sys_progress_t * PROGRESS3, lw6sys_progress_t * PROGRESS_SRC) progress1: the first part of the splitted progress progress2: the second part of the splitted progress progress3: the third part of the splitted progress progress_src: the progress to split Utility function to split a progress struct, this one will split it into 3 equal parts. *Return value:* none -- Function: void lw6sys_progress_split4 (lw6sys_progress_t * PROGRESS1, lw6sys_progress_t * PROGRESS2, lw6sys_progress_t * PROGRESS3, lw6sys_progress_t * PROGRESS4, lw6sys_progress_t * PROGRESS_SRC) progress1: the first part of the splitted progress progress2: the second part of the splitted progress progress3: the third part of the splitted progress progress4: the fourth part of the splitted progress progress_src: the progress to split Utility function to split a progress struct, this one will split it into 4 equal parts. *Return value:* none -- Function: void lw6sys_progress_split5 (lw6sys_progress_t * PROGRESS1, lw6sys_progress_t * PROGRESS2, lw6sys_progress_t * PROGRESS3, lw6sys_progress_t * PROGRESS4, lw6sys_progress_t * PROGRESS5, lw6sys_progress_t * PROGRESS_SRC) progress1: the first part of the splitted progress progress2: the second part of the splitted progress progress3: the third part of the splitted progress progress4: the fourth part of the splitted progress progress5: the fourth part of the splitted progress progress_src: the progress to split Utility function to split a progress struct, this one will split it into 5 equal parts. *Return value:* none -- Function: void lw6sys_progress_begin (lw6sys_progress_t * PROGRESS) progress: the progress to update Sets the progress to its min value, NULL values correctly handled. *Return value:* none -- Function: void lw6sys_progress_half (lw6sys_progress_t * PROGRESS) progress: the progress to update Sets the progress to the average between min and max, NULL values correctly handled. *Return value:* none -- Function: void lw6sys_progress_end (lw6sys_progress_t * PROGRESS) progress: the progress to update Sets the progress to its max value, NULL values correctly handled. *Return value:* none -- Function: u_int32_t lw6sys_random (u_int32_t RANGE) RANGE: the high limit for random generated numbers. If you want random numbers between 0 and 5, set this to 6. Wrapper over standard random function. This one is thread safe. This idea is not to provide cryptographic-proof random numbers, rather generate sequences which are random enough to generate unique server ids and such things. The function is initialized on its first call, and results depend on timestamp, host name, user name, and memory available. -- Function: float lw6sys_random_float (float MIN, float MAX) MIN: the min value, as a float MAX: the max value, as a float Returns a random float number between min & max. Can be equal to min or max. -- Function: int lw6sys_sdl_register () Function used to avoid initializing SDL several times in a program. AFAIK Allegro has a `was_init' function, but SDL doesn't. With this function - which every LW6 sub-module should use - one can know globally, for the whole program, wether SDL has been initialized or not. -- Function: int lw6sys_sdl_unregister () Call this whenever you are done with SDL and exit it, so that the `lw6sys_sdl_register' function works correctly. *Return value:* 1 if SDL needs to be unregistered, that is, if it has already been initialized, else 0. -- Function: void lw6sys_serialize_int64 (unsigned char * DATA, int64_t VALUE) DATA: pointer to the data, must contain at least 8 bytes of writable space VALUE: the integer to serialize Serializes a 64-bit integer in a byte buffer. Result is not dependant on machine endianess. Typically used for checksums or high-level serializations. -- Function: int64_t lw6sys_unserialize_int64 (unsigned char * DATA) DATA: pointer to the data, must contain at least 8 bytes Recovers a 64-bit integer from a byte buffer created, for instance, with `lw6sys_serialize_int64'. -- Function: void lw6sys_serialize_int32 (unsigned char * DATA, int32_t VALUE) DATA: pointer to the data, must contain at least 4 bytes of writable space VALUE: the integer to serialize Serializes a 32-bit integer in a byte buffer. Result is not dependant on machine endianess. Typically used for checksums or high-level serializations. -- Function: int32_t lw6sys_unserialize_int32 (unsigned char * DATA) DATA: pointer to the data, must contain at least 4 bytes Recovers a 32-bit integer from a byte buffer created, for instance, with `lw6sys_serialize_int32'. -- Function: void lw6sys_serialize_int16 (unsigned char * DATA, int16_t VALUE) DATA: pointer to the data, must contain at least 2 bytes of writable space VALUE: the integer to serialize Serializes a 16-bit integer in a byte buffer. Result is not dependant on machine endianess. Typically used for checksums or high-level serializations. -- Function: int16_t lw6sys_unserialize_int16 (unsigned char * DATA) DATA: pointer to the data, must contain at least 2 bytes Recovers a 16-bit integer from a byte buffer created, for instance, with `lw6sys_serialize_int16'. -- Function: int lw6sys_shape_check_min_max_whd (lw6sys_whd_t * SHAPE, int MIN_WH, int MAX_WH, int MAX_D) SHAPE: the dimensions to control MIN_WH: the min value for w and h MAX_WH: the max value for w and h MAX_D: the max value for d Will check wether the given shape respects some basic constraints, being not to small and not too big. *Return value:* 1 if OK, 0 if not. -- Function: int lw6sys_shape_check_pos (lw6sys_whd_t * SHAPE, lw6sys_xyz_t * POS) SHAPE: the boundary box POS: the position Checks wether position is within the given boundary box. *Return value:* 1 if OK, 0 if not. -- Function: int lw6sys_shape_is_same (lw6sys_whd_t * SHAPE_A, lw6sys_whd_t * SHAPE_B) SHAPE_A: the first shape to compare SHAPE_B: the other shape to compare Compares two shapes. *Return value:* 1 if same, 0 if not. -- Function: int lw6sys_sort_int_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of int item LIST_B: pointer to a list of int item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of integers. *Return value:* -1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', 1 if `list_a' > `list_b' -- Function: int lw6sys_sort_int_desc_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of int item LIST_B: pointer to a list of int item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of integers. This one will sort in reverse mode. *Return value:* 1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', -1 if `list_a' > `list_b' -- Function: int lw6sys_sort_float_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of float item LIST_B: pointer to a list of float item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of floating point numbers. *Return value:* -1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', 1 if `list_a' > `list_b' -- Function: int lw6sys_sort_float_desc_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of float item LIST_B: pointer to a list of float item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of floating point numbers. This one will sort in reverse mode. *Return value:* 1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', -1 if `list_a' > `list_b' -- Function: int lw6sys_sort_str_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of string item LIST_B: pointer to a list of string item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of 0-terminated strings. *Return value:* -1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', 1 if `list_a' > `list_b' -- Function: int lw6sys_sort_str_desc_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of string item LIST_B: pointer to a list of string item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of 0-terminated strings. This one will sort in reverse mode. *Return value:* 1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', -1 if `list_a' > `list_b' -- Function: void lw6sys_sort (lw6sys_list_t ** LIST, lw6sys_sort_callback_func_t SORT_FUNC) LIST: the list to sort, might be modified by the function SORT_FUNC: the callback function used to sort A general sorting function. Internally, will use the glibc `qsort' function, but this one is adapted to the LW6 specific data structures, more exactly, the `lw6sys_list' structure. Several default sort callbacks are defined, but one is free to use any callback, provided it has the right prototype. -- Function: void * lw6sys_spinlock_create () Creates a spinlock object. *Return value:* newly allocated pointer. -- Function: void lw6sys_spinlock_destroy (void * SPINLOCK) SPINLOCK: the spinlock to destroy. Destroys a spinlock object. *Return value:* none. -- Function: int lw6sys_spinlock_lock (void * SPINLOCK) SPINLOCK: the spinlock to use Locks the spinlock. Note that this should never fail unless there's a serious initialization problem, instead, function will wait forever until spinlock is released. *Return value:* 1 if success, 0 if failure. -- Function: int lw6sys_spinlock_trylock (void * SPINLOCK) SPINLOCK: the spinlock to use Tries to locks the spinlock. That is, tells wether spinlock can be locked immediately or not. Note that this does not mean there's 100% chance next call to lock will terminated immediately, since lock can still be acquired by another thread. *Return value:* 1 if spinlock unlocked, 0 if locked or error. -- Function: int lw6sys_spinlock_unlock (void * SPINLOCK) SPINLOCK: the spinlock to use Unlocks a spinlock. *Return value:* 1 if sucess, 0 if error. -- Function: char * lw6sys_str_copy (char * SRC) SRC: the string to copy Duplicate a string, creating a new pointer on it, which must be freed afterwards. The main difference with `strdup' is that here we use the LW6SYS_MALLOC macro to track down possible memory leaks. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_str_concat (char * STR1, char * STR2) STR1: the left part to be concatenated STR2: the right part to be concatenated Concatenate 2 strings, and put the result in a newly allocated string. Unlike `strcat' which uses the same pointer. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_new_sprintf (char * FMT, ...) FMT: a format string, like the one you would pass to `printf' ...: optional arguments, like the ones you would pass to `printf' An sprintf like function, except it allocates a new string automatically, with "enough space". This is not a highly optimized function, it will allocate plenty of memory, possibly several times, and thus consume time and resources. But it has the great advantage of freeing the programmer of the dirty work of guessing "how log will the sprintf'ed string be?" before even generating it. So it's a time saver for the programmer. Additionnally, helps avoiding memory leaks and buffer overflows. *Return value:* a new allocated string, must be freed. -- Function: int lw6sys_str_is_blank (char * STR) STR: the string to test Tests wether a string is blank, that is, if it's composed of space, tabs, or carriage returns only. *Return value:* 1 if blank, 0 if not. -- Function: int lw6sys_str_is_same (char * STR_A, char * STR_B) STR_A: 1st string to compare, can be NULL STR_B: 2nd string to compare, can be NULL Compares two strings for equality. Difference with strcmp is that this one won't check for alphabetical order and return -1 or +1, but will check for NULL args. of space, tabs, or carriage returns only. *Return value:* 1 if same, 0 if not. -- Function: int lw6sys_skip_blanks (char ** STR_PTR) STR_PTR: a pointer to a string pointer (read/write parameter). Skips blanks at the beginning of a string. The passed parameter is modifed in place. Usefull for parsing. *Return value:* 1 if blanks were found, else 0. -- Function: void lw6sys_str_cleanup (char * STR) STR: a pointer to the string, which will be modified in-place. Used to clean up some strings, for instance if they come from the network, we don't necessarly want system chars to be displayed on the console. Basically it removes all characters with an ASCII code inferior to 32, that is, all system characters. This way, there won't be any tab, linefeed, or any of such characters left. *Return value:* none. -- Function: char * lw6sys_str_reformat (char * STR, char * PREFIX, int NB_COLUMNS) STR: a pointer to the string we want to modify PREFIX: a prefix to put before each line Reformats a string, that is, insert newline characters in the right places to that it fits in a given number of columns. A prefix is appended at the beginning of each line. Will not handle strings which already contain newline characters perfectly. *Return value:* a newly allocated string, must be freed. -- Function: char * lw6sys_eol () Returns the value of EOL, that is, the "end of line" sequence. Will simply return "\n" on UNIX and "\r\n" on Microsoft platforms. Note that while this is convenient to write config and example files, for instance, it's a bad idea to use this to generate network messages, because this kind of message needs to be platform independant. Thus any network protocol oriented string would use chr(10) and char(13) directly. *Return value:* the EOL string, must not be freed. -- Function: lw6sys_list_t * lw6sys_str_split (char * STR, char C) STR: a string C: the delimiter to split with Splits a string, for instance 'foo,bar' splited with 'o' will return 'f', " and ',bar'. *Return value:* a list containing 0-terminated strings. -- Function: lw6sys_list_t * lw6sys_str_split_no_0 (char * STR, char C) STR: a string C: the delimiter to split with Splits a string, ignoring empty '0-length' members. For instance 'foo,bar' splited with 'o' will return 'f' and ',bar'. *Return value:* a list containing 0-terminated strings. -- Function: int lw6sys_test () Runs the `sys' module test suite, testing most (if not all...) functions. Note that some tests perform file system operations and might therefore fail on a read-only filesystem, or if user permissions are not sufficient. *Return value:* 1 if test is successfull, 0 on error. -- Function: void * lw6sys_thread_create (lw6sys_thread_callback_func_t CALLBACK_FUNC, lw6sys_thread_callback_func_t CALLBACK_JOIN, void * CALLBACK_DATA) CALLBACK_FUNC: the main callback, the function that will run the thread CALLBACK_JOIN: function which will be called when joining, at the end CALLBACK_DATA: data which will be passed to the callback Creates a thread. All threads must be joined. This is because we really do not want the game to leak, and detached threads are typically the kind of thing that leaves stuff in the heap. Note that callback_func is just something which will be called when joining it can be NULL. The idea is to put in it free & delete functions, which you can't call before joining when you want the main thread to get the results of the callback_func. *Return value:* an opaque pointer on the thread. Can be NULL if failed. -- Function: int lw6sys_thread_is_callback_done (void * THREAD_HANDLER) THREAD_HANDLER: thread to work on Tells wether the callback is done, that is to say, wether the results are available, and we can join. *Return value:* 1 if done, else 0. -- Function: int lw6sys_thread_get_id (void * THREAD_HANDLER) THREAD_HANDLER: thread to query Returns the id of the thread, this is an internal value, unique for each process, which can help identifying the thread. *Return value:* the id, should be >0. -- Function: void * lw6sys_thread_get_data (void * THREAD_HANDLER) THREAD_HANDLER: thread to query Returns the data associated to the thread, that is, the pointer which was passed to the callback function. *Return value:* a pointer. -- Function: void lw6sys_thread_join (void * THREAD_HANDLER) THREAD_HANDLER: thread to end Joins the thread, that's to say wait until the thread is over, and destroys the ressources associated to it. Note that if the thread is looping forever, this function will just wait forever. This is the only way to end a thread. *Return value:* none. -- Function: int lw6sys_get_thread_create_count () Utility function used to check how many threads where created and joined. *Return value:* how many threads were created. -- Function: int lw6sys_get_thread_join_count () Utility function used to check how many threads where created and joined. *Return value:* how many threads were joined. -- Function: int lw6sys_check_thread_count () Utility function used to check how many threads where created and joined. This one will compare the results of `lw6sys_get_thread_create_count' and `lw6sys_get_thread_join_count'. *Return value:* 1 if both are equals, 0 if not (error...). -- Function: int64_t lw6sys_timestamp () Returns a 64-bit timestamp, for general purpose. The unit is milliseconds, should return the number of milliseconds since EPOCH. Don't use this for accurate date handling, but rather to technical stamp events. *Return value:* the timestamp. -- Function: int64_t lw6sys_uptime () Returns the number of milliseconds since program was started. Milliseconds are often referred to as 'ticks'. *Return value:* the number of milliseconds (64-bit) -- Function: void lw6sys_timer_update (int64_t * TIMESTAMP, int64_t * UPTIME) TIMESTAMP: the timestamp in msec since EPOCH (output), can be NULL UPTIME: the uptime in msec since startup (output), can be NULL Returns timestamp & uptime with only one system call. *Return value:* none (parameters modified). -- Function: void lw6sys_sleep (float SECONDS) SECONDS: the number of seconds to wait, fractions allowed Will sleep for the given amount of seconds. Same as `lw6sys_delay' only input is provided as a floating number of seconds instead of ticks. -- Function: void lw6sys_delay (int MSEC) MSEC: the number of milliseconds (ticks) to wait Will sleep for the given amount of seconds. Provides accurate timing and has "about-millisecond" precision, since it uses `select' internally. Might however be interrupted in some cases, so consider function can always return quicker than specified. A common usage of this function is polling loops, where you don't care if 2 polls are very close, but simply want to avoid polling continuously, therefore consumming 100% of the CPU for nothing. -- Function: void lw6sys_idle () Will sleep for a minimal amount of time, just giving the OS a chance to let other threads/processes execute themselves. This can make a big difference in polling loops between a process that eats 100% CPU and a process that has a very moderate load. of ticks. -- Function: void lw6sys_time_init () Global initializations required to handle time properly. -- Function: int lw6sys_vthread_run (lw6sys_thread_callback_func_t CALLBACK_FUNC, lw6sys_thread_callback_func_t CALLBACK_JOIN, void * CALLBACK_DATA) CALLBACK_FUNC: the main callback, the function that will run the thread CALLBACK_JOIN: function which will be called when joining, at the end CALLBACK_DATA: data which will be passed to the callback This function is similar to `lw6sys_thread_create', but it's dedicated to creating a unique (one per process only) thread, which, in turn, will be able to run commands in the main thread itself. This is a hack to allow apparently spawned child threads to be actually handled by main. This is because some libraries, which LW6 uses in threads, need to be actually called in the main thread. SDL, for instance. Note that after running this you loose control on the main thread, this one will only wait for possible commands from the spawned thread, typically sent with the `lw6sys_vthread_create' function. *Return value:* 1 on success, 0 on failure. -- Function: int lw6sys_vthread_is_running () Returns true if `lw6sys_vthread_run' has been called. Note that this is not bullet proof, it will return true in a correct manner only if you call it from the vthread itself. In practise this shouldn't be a problem, the idea is just to write portable code for the main control thread and be able to decide on the fly wether to create a thread we should prefer the `lw6sys_thread_create' or its equivalent the `lw6sys_vthread_create' function. *Return value:* 1 on success, 0 on failure. -- Function: int lw6sys_vthread_create (lw6sys_thread_callback_func_t CALLBACK_FUNC, lw6sys_thread_callback_func_t CALLBACK_JOIN, void * CALLBACK_DATA) CALLBACK_FUNC: the main callback, the function that will run the thread CALLBACK_JOIN: function which will be called when joining, at the end CALLBACK_DATA: data which will be passed to the callback The equivalent of `lw6sys_thread_create' but for the vthread infrastructure. The idea is to pretend firing a spawned thread, but in fact it's the main thread that runs the code. This function must imperatively be called within the `lw6sys_vthread_run' function, else it will fail or be buggy. *Return value:* 1 on success, 0 on failure. -- Function: void lw6sys_vthread_join () The equivalent of `lw6sys_thread_join' but for the vthread infrastructure. The idea is to pretend firing a spawned thread, but in fact it's the main thread that runs the code. This function must imperatively be called within the `lw6sys_vthread_run' function, else it will fail or be buggy. *Return value:* none. 4.15.21 libtsk -------------- -- Function: lw6tsk_loader_t * lw6tsk_loader_new (float SLEEP, float * PROGRESS) SLEEP: how many seconds to wait between every poll Creates a new loader. This object is used to do some reputed slow calculus in the background, in a separated thread. Typical example is map loading. This is a high-level objects which encapsulates threads and other wizardry. *Return value:* a pointer to the loader, NULL if failed. -- Function: void lw6tsk_loader_free (lw6tsk_loader_t * LOADER) LOADER: the loader to free. Deletes a loader. Will automatically stop the child thread, free data, and so on. *Return value:* none. -- Function: char * lw6tsk_loader_repr (lw6tsk_loader_t * LOADER) LOADER: the loader to represent. Creates a string which briefly describes the loader. *Return value:* a dynamically allocated pointer, must be freed. -- Function: int lw6tsk_loader_get_stage (lw6tsk_loader_t * LOADER) LOADER: the loader to query. Returns the current stage of the loader. *Return value:* 0 if idle, 1 if loading the map from disk, 2 if build dynamic stuff such as game_state. 4.15.22 libbot -------------- -- Function: void lw6_release () Functions which will call `quit'(), `free'(), `destroy'() on whatever smob object that has threads and/or requires hardware ressources. This is to be called before the Guile interpreter ends. This is because when it garbage collects objects at the end of the program, it has no idea of what order to use when freeing objects. So if an object which uses another one in a thread is freed after the other is freed, you get a (rather unexplainabled if not warned) segfault. *Return value:* none -- Function: void lw6_exit () Will exit the program. If there are some display objects alive, that is if there's a display activated, it will find them and send a quit event, giving a chance to the to exit cleanly. If not, it will just call `exit'() directly. *Return value:* none -- Function: int lw6_main (int ARGC, char * [] ARGV) ARGC: the argc parameter of the `main'() function, that is, the number of command-line args. ARGV: the argv parameter of the `main'() function, that is, an array containing pointers on command-line args. This function is directly called by `main'(). This means by linking against libliquidwar6 and calling it, you would have a program that is almost exactly the "official" upstream liquidwar6 binary, except you can tweak it and have all the power to call whatever other functions you like, embed it. In short, everything the binary does, you can do it in your own binarn, by linking against the library and calling this function. *Return value:* 1 if success, zero if failure. Note that this is the "standard" C / liquidwar6 way to proceed, but your `main'() function should return 0 if success, else an error code. Typical use is "return !lw6_main(argc, argv);". -- Function: int lw6_process_non_run_options (int ARGC, char * [] ARGV, int * RUN_GAME) ARGC: the number of command-line args, as passed to `main()' ARGV: an array of strings containing command-line args, as passed to `main()' RUN_GAME: a pointer to a boolean which will contain true (1) if the game must be launched, or false (0) if the option is such that game must be skipped. Example: -copyright, -help, ... *Return value:* non-zero if success, 0 if error. The error can be, for instance, the test suite returning "no, tests were not OK". 4.15.23 libbot -------------- 4.15.24 libcfg -------------- -- Function: int lw6cfg_parse_command_line (void * CONTEXT) CONTEXT: opaque pointer on a context Overwrites any existing option with command line args *Return value:* 1 if success, 0 if error -- Function: int lw6cfg_defaults (void * CONTEXT) CONTEXT: opaque pointer on a context Sets all values to their defaults. *Return value:* 1 if success, 0 if error -- Function: int lw6cfg_merge_env (void * CFG_CONTEXT) CFG_CONTEXT: a context returned by `lw6cfg_init' Overwrites any existing vale in the config with environment variables prefixed by LW6_. *Return value:* 1 if successfull, 0 if error. -- Function: char * lw6cfg_format (char * KEY, char * VALUE, lw6hlp_type_t TYPE) KEY: the key of the value to format VALUE: the value to format TYPE: the type of the value to format Formats, converts, a given value to its cannonical representation. Booleans will be converted to true/false, strings containing integers will be stripped from junk, and so on. This is a performance killer but will ensure everything is correct. *Return value:* a newly allocated string, containing the same as the input, but reformatted the pedantic way. -- Function: char * lw6cfg_format_guess_type (char * KEY, char * VALUE) KEY: the key of the value to format VALUE: the value to format Formats, converts, a given value to its cannonical representation. Booleans will be converted to true/false, strings containing integers will be stripped from junk, and so on. This is a performance killer but will ensure everything is correct. This function will automatically guess the type of the value from its description in the help system. *Return value:* a newly allocated string, containing the same as the input, but reformatted the pedantic way. -- Function: int lw6cfg_load (void * CFG_CONTEXT, char * FILENAME) CFG_CONTEXT: a context returned by `lw6cfg_init' FILENAME: a file path, absolute or relative Loads the given config file, and stores its values into the current context. Parameters which are both in the config file and given as command line parameters, will be taken from the command-line. *Return value:* 1 if successfull, 0 if error. -- Function: int lw6cfg_save (void * CFG_CONTEXT, char * FILENAME) CFG_CONTEXT: a context returned by `lw6cfg_init' FILENAME: a file path, absolute or relative Save current options into the given config file. Before saving the file, all command line arguments will be read and will override current values. This means the saved file will contain values given as command line arguments. *Return value:* 1 if successfull, 0 if error. -- Function: void * lw6cfg_init (int ARGC, char * [] ARGV) ARGC: number of command line arguments, as given to `main' ARGV: a list of command line arguments, as given to `main' Initializes a config context object. This object is hidden behind an opaque void * pointer to avoid direct access to its elements. *Return value:* an opaque pointer, must be freed with `lw6cfg_quit'. -- Function: void lw6cfg_quit (void * CFG_CONTEXT) CFG_CONTEXT: a context returned by `lw6cfg_init' Frees a config cfg_context object. You must call this once you're done with the context. *Return value:* none. -- Function: void lw6cfg_reset (int ARGC, char * [] ARGV) ARGC: number of command line arguments, as given to `main' ARGV: a list of command line arguments, as given to `main' Overwrites the config file with defaults. Use this to get rid of old configurations. -- Function: char * lw6cfg_unified_get_value (int ARGC, char * [] ARGV, char * KEY) ARGC: number of command-line args, as passed to `main' ARGV: arry of command-line args, as passed to `main' KEY: the key to query Unified "value" getter, which gets informations from environment variables, command line, and config file. The rules is that the command-line argument always has the last word. It will override any other value. Follows environment variables, which will be used if no command-line argument is supplied. Note that these are "LW6_" prefixed and uppercased environment variables as opposed to lowercased and "dash-separated" keys. Finally, if there's no environment variable, nor any config-file corresponding entry, the value will be searched in the config file. If there's no information in the config file, NULL is returned. *Return value:* a string with the value. Can be NULL. Must be freed. -- Function: char * lw6cfg_unified_get_user_dir (int ARGC, char * [] ARGV) ARGC: number of command-line args, as passed to `main' ARGV: arry of command-line args, as passed to `main' Gets the user dir, taking all parameters in account, that's to say the "LW6_USER_DIR" env value, the "-user-dir" command-line paramater and the LW6DEF_USER_DIR config file entry. *Return value:* the directory path, might be NULL, must be freed. -- Function: char * lw6cfg_unified_get_log_file (int ARGC, char * [] ARGV) ARGC: number of command-line args, as passed to `main' ARGV: arry of command-line args, as passed to `main' Gets the log file, taking all parameters in account, that's to say the "LW6_LOG_FILE" env value, the "-log-file" command-line paramater and the LW6DEF_LOG_FILE config file entry. *Return value:* the directory path, might be NULL, must be freed. -- Function: char * lw6cfg_unified_get_map_path (int ARGC, char * [] ARGV) ARGC: number of command-line args, as passed to `main' ARGV: arry of command-line args, as passed to `main' Gets the user dir, taking all parameters in account, that's to say the "LW6_MAP_PATH" env value, the "-map-path" command-line paramater and the LW6DEF_MAP_PATH config file entry. *Return value:* the directory path, might be NULL, must be freed. 4.15.25 libcli -------------- 4.15.26 libcns -------------- 4.15.27 libdsp -------------- -- Function: lw6dsp_backend_t * lw6dsp_create_backend (int ARGC, char * [] ARGV, char * GFX_BACKEND_NAME) ARGC: argc as passed to `main' ARGV: argv as passed to `main' GFX_BACKEND_NAME: the id/name of the gfx backend to use Creates a dsp_backend object. The created object won't be displaying things until `lw6dsp_init' is called. No thread is created, but the graphics backend is loaded into memory. If video mode is not available, it will appear later, when trying to start displaying things, this function only allocates memory and checks code is available in case of a dynamically loaded gfx backend. *Return value:* a newly allocated object. -- Function: void lw6dsp_destroy_backend (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend object to free Frees all ressources used by a dsp_backend object. Note that you must call this on a inactive 'stopped' dsp_backend object. *Return value:* none. -- Function: char * lw6dsp_repr (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the object to represent Gives a short human-readable description of the object. *Return value:* a newly allocated string, must be freed. -- Function: int lw6dsp_init (lw6dsp_backend_t * DSP_BACKEND, lw6dsp_param_t * PARAM, lw6gui_resize_callback_func_t RESIZE_CALLBACK) DSP_BACKEND: the dsp_backend to start PARAM: parameters to pass to the display funcs RESIZE_CALLBACK: a function which will be called when there's a resize event Starts a dsp_backend object, that is, fire a separate thread and start rendering. This will set up a video mode, so it's very likely to fail if for some reason the video context isn't right, for instance if you try to set up graphical stuff but only have console access. *Return value:* 1 if success, 0 if error. -- Function: void lw6dsp_quit (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend to stop Stops a dsp_backend, that is, cancel rendering and unset the video mode, hardware shouldn't be used any more after this call. *Return value:* none. -- Function: int lw6dsp_update (lw6dsp_backend_t * DSP_BACKEND, lw6dsp_param_t * PARAM) DSP_BACKEND: the dsp_backend to update PARAM: parameters to pass to the dsp_backend funcs Passes a new set of parameters to the display function. This is in fact the only way to pass informations to the dsp_backend object once it's been started. This function will acquire a mutex, copy parameters, then give control back to the main thread while display keeps on going with new parameters in the background. It will get input informations. You really must call it often otherwise the screen won't get updated, or, at least, it will always display the same informations. It should be reasonnable to call this 10 or 20 times per second, the display itself can be faster, run at 60 or 100 fps to show smooth animation (eye candy). *Return value:* 1 if success, 0 if error. -- Function: int lw6dsp_get_nb_frames (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend to query Returns the number of frames displayed since the display was started. *Return value:* the number of frames displayed. -- Function: int lw6dsp_get_last_frame_rendering_time (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend to query Returns the rendering time of the last frame. Gives clues about performance. *Return value:* the number of milliseconds it took to draw screen -- Function: int lw6dsp_get_instant_fps (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend to query Returns the current frames per sec display rate. This is the instant value, it changes very often even if display seems smooth. *Return value:* the current instant display rate. -- Function: int lw6dsp_get_average_fps (lw6dsp_backend_t * DSP_BACKEND) DSP_BACKEND: the dsp_backend to query Returns the current frames per sec display rate. This is not absolutely accurate but fits for displaying info to the player, it's an average. *Return value:* the current averaged display rate. -- Function: int lw6dsp_get_video_mode (lw6dsp_backend_t * DSP_BACKEND, lw6gui_video_mode_t * VIDEO_MODE) DSP_BACKEND: the dsp_backend to query VIDEO_MODE: a structure which will contain the results Returns the current video mode, the one obtained by the driver. This function is also a way to know wether display is running correcly or not, by testing its return value. *Return value:* 1 if ok, 0 if failure (mode not set) -- Function: int lw6dsp_get_fullscreen_modes (lw6dsp_backend_t * DSP_BACKEND, lw6gui_fullscreen_modes_t * FULLSCREEN_MODES) DSP_BACKEND: the dsp_backend to query FULLSCREEN_MODES: a structure which will contain the results Returns the current available fullscreen modes. Note that this one will only work if display is started, unlike `lw6gfx_get_fullscreen_modes' which is used internally. The reason is that in this dsp module context, we need the thread to be launched, and the thread does start/stop display on its own. *Return value:* 1 if ok, 0 if failure (mode not set) -- Function: void lw6dsp_param_zero (lw6dsp_param_t * PARAM) PARAM: the structure to initialize Fills a display param struct with zeros, this is mandatory before any use. Think of it as a raw memset. *Return value:* none. -- Function: int lw6dsp_test () Runs the test suite for the dsp module. *Return value:* 1 if OK, 0 if error. 4.15.28 libdyn -------------- -- Function: lw6dyn_dl_handle_t * lw6dyn_dlopen_backend_so (char * SO_FILE) Opens a .so file directly, using a valid (full) path name. *Return value:* a handle to the module, once it's opened. You might still need to call a module specific `init'() function, but it's another story. -- Function: lw6dyn_dl_handle_t * lw6dyn_dlopen_backend (int ARGC, char * [] ARGV, char * TOP_LEVEL_LIB, char * BACKEND_NAME) ARGC: the number of command-line arguments as passed to `main' TOP_LEVEL_LIB: the top-level library concerned, this means is it "cli", "gfx", "snd" or "srv". This will tell the function to search for the .so file in the correct subdirectory. Think of this as a category. Opens a .so file corresponding to the given backend, it is capable to search for system libraries installed after "make install" but if not found, it will also search in the current build directory, finding the .so files in hidden .libs subdirectories. *Return value:* a handle to the module, once it's opened. You might still need to call a module specific `init'() function, but it's another story. -- Function: int lw6dyn_dlclose_backend (lw6dyn_dl_handle_t * HANDLE) HANDLE: the backend to close. Closes an opened backend. Note that you must call any backend specific clear, destroy, deinit, exit, function before. *Return value:* 1 if success, 0 on error. -- Function: void * lw6dyn_dlsym (lw6dyn_dl_handle_t * HANDLE, char * FUNC_NAME) HANDLE: the backend concerned FUNC_NAME: the function name, as a NULL terminated string Finds a C function in the given backend. *Return value:* a pointer to the function, NULL if not found. -- Function: lw6sys_assoc_t * lw6dyn_list_backends (int ARGC, char * [] ARGV, char * TOP_LEVEL_LIB) ARGC: the number of command line args, as passed to main ARGV: the commind line args, as passed to main TOP_LEVEL_LIB: the library category to query (gfx, snd, cli, srv ...) Returns an assoc which lists all the available modules. The key of the assoc entries in the module internal name such as 'gl' and the value associated is a NULL terminated string describing the module, for instance 'OpenGL'. *Return value:* an assoc object containing key/label pairs. -- Function: char * lw6dyn_path_find_backend (int ARGC, char * [] ARGV, char * TOP_LEVEL_LIB, char * BACKEND_NAME) ARGC: the number of command-line arguments as passed to `main' TOP_LEVEL_LIB: the top-level library concerned, this means is it "cli", "gfx", "snd" or "srv". This will tell the function to search for the .so file in the correct subdirectory. Think of this as a category. BACKEND_NAME: the actual name of the backend, this is the name of the .so file, between "libmod_" and ".so". For instance, to find "libmod_gl.so", the right argument is "gl". Get the full path to a .so file corresponding to the given backend, it is capable to search for system libraries installed after "make install" but if not found, it will also search in the current build directory, finding the .so files in hidden .libs subdirectories. *Return value:* the full path of the .so file, needs to be freed. -- Function: int lw6dyn_test () Runs the `dyn' module test suite, testing most (if not all...) functions. Will try to load libraries and query them for standard LW6-expected functions. *Return value:* 1 if test is successfull, 0 on error. 4.15.29 libgfx -------------- -- Function: int lw6gfx_init (lw6gfx_backend_t * BACKEND, lw6gui_video_mode_t * VIDEO_MODE, lw6gui_resize_callback_func_t RESIZE_CALLBACK) BACKEND: the graphical backend to use VIDEO_MODE: the video mode to use at start up RESIZE_CALLBACK: a callback function which will be called at each resize event Sets up the graphical backend for good, initializing a video mode and allocating ressources. This call can typically fail if there's no device available, if the user doesn't have enough rights to access the hardware, and so on. *Return value:* 1 on success, 0 if not -- Function: void lw6gfx_quit (lw6gfx_backend_t * BACKEND) BACKEND: the backend to free Uninitializes the backend, that is, exits the graphical mode. All threads that use graphics must be closed when this is called. *Return value:* none. -- Function: char * lw6gfx_repr (lw6gfx_backend_t * BACKEND) BACKEND: the backend to represent Returns a readable version of the backend object. *Return value:* a newly allocated pointer. -- Function: int lw6gfx_set_video_mode (lw6gfx_backend_t * BACKEND, lw6gui_video_mode_t * VIDEO_MODE) BACKEND: the backend to use VIDEO_MODE: the new video mode This function changes the video mode. Note that the first time you set up the graphical environment you must call `lw6gfx_init' but to change the current mode, use this function. It should reload backend data automatically if needed (textures for instance). Note that before giving up and failing this function will try alternate video modes, and you're not garanteed to have the right mode after the call, even if it returns true. To check this, use `lw6gfx_get_video_mode'. *Return value:* 1 on success, 0 on failure; -- Function: int lw6gfx_get_video_mode (lw6gfx_backend_t * BACKEND, lw6gui_video_mode_t * VIDEO_MODE) BACKEND: the backend to use VIDEO_MODE: the current video mode (will be overwritten, out parameter) This function returns the current video mode. *Return value:* 1 on success, 0 on failure; -- Function: int lw6gfx_get_fullscreen_modes (lw6gfx_backend_t * BACKEND, lw6gui_fullscreen_modes_t * FULLSCREEN_MODES) BACKEND: the backend to use FULLSCREEN_MODES: the available fullscreen modes (will be overwritten, out parameter) This function returns the current video mode. *Return value:* 1 on success, 0 on failure; -- Function: lw6gui_input_t * lw6gfx_pump_events (lw6gfx_backend_t * BACKEND) BACKEND: the backend to use This function "pumps" events, that is gets pending events, puts them in queues, maintains internal states up to date. You really must call this very often or no input will be processed at all. *Return value:* a pointer on the internal input state, musn't be freed. -- Function: int lw6gfx_display (lw6gfx_backend_t * BACKEND, int MASK, lw6gui_look_t * LOOK, lw6map_level_t * LEVEL, lw6ker_game_struct_t * GAME_STRUCT, lw6ker_game_state_t * GAME_STATE, lw6gui_main_cursor_t * MAIN_CURSOR, lw6gui_menu_t * MENU, float PROGRESS, float FPS, float RPS, char ** LOG_LIST, int DEBUG_TEAM_ID, int DEBUG_LAYER_ID) BACKEND: the graphical backend to use MASK: display flag, tells what to display LOOK: the look, the skin, contains display options LEVEL: the level to display GAME_STRUCT: the game_struct associated with the level GAME_STATE: the game_state associated with the level MAIN_CURSOR: the cursor to center the focus on MENU: the menu to display PROGRESS: the value of the progress indicator FPS: the number of frames per second to display RPS: the number of rounds per second to display LOG_LIST: log messages to display DEBUG_TEAM_ID: for debug display, team to display informations about DEBUG_LAYER_ID: for debug display, layer to display This is the major drawing function, the one that encapsulates all others. As the program uses a separate thread to display things, we just pass this function many parameters, and let it do its job alone. So many parameters might sometimes be useless. It also allows the graphics backend decide wether menus and hud and background should interact. Or not. *Return value:* 1 on success, 0 on failure. 4.15.30 libgui -------------- -- Function: void lw6gui_button_register_down (lw6gui_button_t * BUTTON, int64_t TIMESTAMP) BUTTON: the button to update TIMESTAMP: the current ticks (milliseconds) Registers a "down" (press) event on a button. *Return value:* none. -- Function: void lw6gui_button_register_up (lw6gui_button_t * BUTTON) BUTTON: the button to update Registers a "up" (release) event on a button. *Return value:* none. -- Function: int lw6gui_button_is_pressed (lw6gui_button_t * BUTTON) BUTTON: the button to query Tells wether a button is pressed or not. *Return value:* 1 if pressed, 0 if not. -- Function: int lw6gui_button_pop_press (lw6gui_button_t * BUTTON) BUTTON: the button to query Tells how many times the button has been pressed. Typical usage: the button is pressed, released, pressed, released several times. Then, after all this, you want to know how many times it has been pressed. Querying its state with `lw6gui_button_is_pressed' won't tell you much but this `pop_press' function will return 1 for each press there's been. *Return value:* 1 if there's a press event in the queue, 0 if empty. -- Function: void lw6gui_button_update_repeat (lw6gui_button_t * BUTTON, lw6gui_repeat_settings_t * REPEAT_SETTINGS, int64_t TIMESTAMP) BUTTON: the button to update REPEAT_SETTINGS: the repeat settings (delay + interval) TIMESTAMP: the current ticks (milliseconds) Updates the repeat informations for a button, must be called regularly, as often as possible. *Return value:* none. -- Function: int lw6gui_button_sync (lw6gui_button_t * DST, lw6gui_button_t * SRC) DST: the target button object SRC: the source button object Synchronizes two button objects. This is typically used to pass data from one thread to another. This is not a simple copy, it will handle data such as "when was it pressed last" it an intelligent manner, popping src data to put it in dst, and clearing src. *Return value:* 1 if success, O if failure. -- Function: int lw6gui_coord_calc_xy (float * DST_X, float * DST_Y, float DST_X0, float DST_Y0, float DST_W, float DST_H, float SRC_X, float SRC_Y, float SRC_X0, float SRC_Y0, float SRC_W, float SRC_H) DST_X: the x coord to return DST_Y: the y coord to return DST_X0: the x coord of point 0 in destination coord system DST_Y0: the y coord of point 0 in destination coord system DST_W: the width of the area in destination coord system DST_H: the width of the area in destination coord system SRC_X: the x coord in source coord system SRC_Y: the y coord in source coord system SRC_X0: the x coord of point 0 in source coord system SRC_Y0: the y coord of point 0 in source coord system SRC_W: the width of the area in source coord system SRC_H: the width of the area in source coord system Registers a "down" (press) event on a button. *Return value:* none. -- Function: int lw6gui_input_init (lw6gui_input_t * INPUT) INPUT: the input struct to initialise Initialises an input structure, don't use twice, it won't free a previous init. *Return value:* a pointer to the newly allocated object. -- Function: void lw6gui_input_quit (lw6gui_input_t * INPUT) INPUT: the input struct to uninitialise Unitialises an input structure, need to call it to free event queue. *Return value:* a pointer to the newly allocated object. -- Function: lw6gui_input_t * lw6gui_input_new () Creates an input structure, which can be used to handle input state & buffer. *Return value:* a pointer to the newly allocated object. -- Function: void lw6gui_input_free (lw6gui_input_t * INPUT) INPUT: the input object to free. Deletes an input structure. *Return value:* none. -- Function: int lw6gui_input_reset (lw6gui_input_t * INPUT) INPUT: the input struct to reset Resets an input structure. Must have been initialized before. It will empty all queues and mark everything as unpressed. *Return value:* 1 on success, 0 if failure. -- Function: void lw6gui_input_update_repeat (lw6gui_input_t * INPUT, lw6gui_repeat_settings_t * REPEAT_SETTINGS, int64_t TIMESTAMP) INPUT: the input to update REPEAT_SETTINGS: the repeat settings (delay + interval) TIMESTAMP: the current ticks (milliseconds) Updates the repeat informations for an input, must be called regularly, as often as possible. *Return value:* none. -- Function: void lw6gui_input_register_change (lw6gui_input_t * INPUT) INPUT: the input to update Tells an input object that one of its descendants has been modified. This will affect the return value of `lw6gui_input_need_sync' *Return value:* none. -- Function: int lw6gui_input_need_sync (lw6gui_input_t * INPUT) INPUT: the input to test Tests wether an input object contains was modified and needs synchronisation. *Return value:* 1 if sync is need, 0 if not. -- Function: int lw6gui_input_sync (lw6gui_input_t * DST, lw6gui_input_t * SRC) DST: the target input object SRC: the source input object Synchronizes two input objects. This is typically used to pass data from one thread to another. This is not a copy, it will brute-force copy the static data such as mouse position, but anything like a queue will be treated in a "empty source and fill target with data" scheme. So source will be affected by this, the key buffer will be emptied, and so on. And if there are key in the target buffer, they won't be overwritten but kept in front of the FIFO list. *Return value:* 1 if success, O if failure. -- Function: int lw6gui_input_poll_quit (lw6gui_input_t * INPUT) INPUT: the input to query Asks the display manager wether a quit event (usually CTRL-C or click on close button) has been detected. *Return value:* 1 if quit was receivedm 0 if not -- Function: void lw6gui_input_send_quit (lw6gui_input_t * INPUT) INPUT: the input to send an event to Artificially send a QUIT event (equivalent of CTRL-C or click on close button). This allow a uniform treatment of game stopping. *Return value:* none -- Function: int lw6gui_joystick_check_index (int I) I: index to check Checks wether the index is correct. Does not mean the joystick exists, it's just to avoid out of bounds errors. *Return value:* 1 if within range, 0 if not. -- Function: void lw6gui_joystick_update_axis_x (lw6gui_joystick_t * JOYSTICK, int X, int LIMIT, int64_t TIMESTAMP) JOYSTICK: joystick to update X: x-axis position, as returned by the driver LIMIT: the limit, under this, buttons are considered unpressed. TIMESTAMP: current ticks (timestamp in ms) Updates the x axis of a joystick, this will convert an information of analog type such as "joystick is here" to a pad-like information such as "pressed in that direction". *Return value:* 1 if within range, 0 if not. -- Function: void lw6gui_joystick_update_axis_y (lw6gui_joystick_t * JOYSTICK, int Y, int LIMIT, int64_t TIMESTAMP) JOYSTICK: joystick to update LIMIT: the limit, under this, buttons are considered unpressed. TIMESTAMP: current ticks (timestamp in ms) Updates the y axis of a joystick, this will convert an information of analog type such as "joystick is here" to a pad-like information such as "pressed in that direction". *Return value:* 1 if within range, 0 if not. -- Function: void lw6gui_joystick_update_repeat (lw6gui_joystick_t * JOYSTICK, lw6gui_repeat_settings_t * REPEAT_SETTINGS, int64_t TIMESTAMP) JOYSTICK: the joystick to update REPEAT_SETTINGS: the repeat settings (delay + interval) TIMESTAMP: the current ticks (milliseconds) Updates the repeat informations for a joystick, must be called regularly, as often as possible. *Return value:* none. -- Function: int lw6gui_joystick_sync (lw6gui_joystick_t * DST, lw6gui_joystick_t * SRC) DST: the target joystick object SRC: the source joystick object Synchronizes two joystick objects. This is typically used to pass data from one thread to another. *Return value:* 1 if success, O if failure. -- Function: void lw6gui_joystick_get_move_pad (lw6gui_joystick_t * JOYSTICK, lw6gui_move_pad_t * MOVE_PAD) JOYSTICK: the joystick to query MOVE_PAD: the structure which will contain the results Returns the state of the joystick in a uniform, non-device specific structure containing only the up/down/left/right information. *Return value:* none, the value are stored in `move_pad'. -- Function: int lw6gui_keyboard_check_keysym (int KEYSYM) KEYSYM: the keysym to check Tells wether the keysym is valid or not. *Return value:* 1 if valid, 0 if not -- Function: lw6gui_keypress_t * lw6gui_keyboard_pop_keypress (lw6gui_keyboard_t * KEYBOARD) KEYBOARD: the keyboard structure which stores keyboard state Pops (in FIFO mode) a keypress stored in the keyboard buffer. You must free the obtained keypress object after you're done with it. *Return value:* a newly allocated pointer, or NULL if no keypress pending. -- Function: int lw6gui_keyboard_is_pressed (lw6gui_keyboard_t * KEYBOARD, int KEYSYM) KEYBOARD: the keyboard structure which stores keyboard state Tells wether a key is pressed or not. The function will test out of bound values. *Return value:* 1 if pressed, 0 if not. -- Function: int lw6gui_keyboard_register_key_down (lw6gui_keyboard_t * KEYBOARD, int KEYSYM, int UNICODE, char * LABEL, int64_t TIMESTAMP) KEYBOARD: the keyboard structure which will store the keypress KEYSYM: the keysym for the keypress UNICODE: the ASCII/unicode code for the keypress LABEL: the label for the keypress TIMESTAMP: the current ticks (timestamp in ms) Registers a keypress event, that is, puts it in the event queue. This function does not take an `lw6gui_keypress_t' structure but separated args, this is because it will construct the object internally. You may free `label' after calling this, an internal copy will be done. This function will also maintain the array of key states up to date. *Return value:* 1 if success, O if failure. -- Function: int lw6gui_keyboard_register_key_up (lw6gui_keyboard_t * KEYBOARD, int KEYSYM) KEYBOARD: the keyboard structure which will store the keypress KEYSYM: the keysym for the keypress Registers a key release event. *Return value:* 1 if success, O if failure. -- Function: void lw6gui_keyboard_update_repeat (lw6gui_keyboard_t * KEYBOARD, lw6gui_repeat_settings_t * REPEAT_SETTINGS, int64_t TIMESTAMP) KEYBOARD: the keyboard to update REPEAT_SETTINGS: the repeat settings (delay + interval) TIMESTAMP: the current ticks (milliseconds) Updates the repeat informations for a keyboard, must be called regularly, as often as possible. *Return value:* none. -- Function: int lw6gui_keyboard_sync (lw6gui_keyboard_t * DST, lw6gui_keyboard_t * SRC) DST: the target keyboard object SRC: the source keyboard object Synchronizes two keyboard objects. This is typically used to pass data from one thread to another. Will pop the src queue to fill the dst queue. *Return value:* 1 if success, O if failure. -- Function: void lw6gui_keyboard_get_move_pad (lw6gui_keyboard_t * KEYBOARD, lw6gui_move_pad_t * MOVE_PAD) KEYBOARD: the keyboard to query MOVE_PAD: the structure which will contain the results Returns the state of the keyboard in a uniform, non-device specific structure containing only the up/down/left/right information. *Return value:* none, the value are stored in `move_pad'. -- Function: lw6gui_keypress_t * lw6gui_keypress_new (int KEYSYM, int UNICODE, char * LABEL) KEYSYM: the keysym to use UNICODE: the unicode value for this keysym LABEL: the label (optional, might be NULL) Creates a keypress structure, the only reason for needing a contructor is that the label field needs be duplicated. *Return value:* a pointer to the newly allocated object. -- Function: void lw6gui_keypress_free (lw6gui_keypress_t * KEYPRESS) KEYPRESS: the keypress object to free. Deletes a keypress structure. *Return value:* none. -- Function: char * lw6gui_keypress_repr (lw6gui_keypress_t * KEYPRESS) KEYPRESS: the keypress to work on Returns a human-readable representation of the keypress. *Return value:* a newly allocated string -- Function: lw6gui_menu_t * lw6gui_menu_new (char * TITLE, char * ESC, int ENABLE_ESC) TITLE: the string to be displayed, what the user sees. Can be freed after the call is done, function will make a copy internally. ESC: the label to be displayed in the ESC button ENABLE_ESC: wether to enable the escape button. Constructs a new menu object. Note that you can always call other functions to modify it afterwards. *Return value:* a pointer to the newly allocated object. -- Function: void lw6gui_menu_free (lw6gui_menu_t * MENU) MENU: a pointer to the menu. Frees the menu, checking if things are OK before doing so. *Return value:* none. -- Function: int lw6gui_menu_memory_footprint (lw6gui_menu_t * MENU) MENU: a pointer to the menu. Gets the memory occupied by the menu. Could be usefull to help a garbage collector taking decisions or reporting erros, for instance. *Return value:* the number of bytes used. -- Function: char * lw6gui_menu_repr (lw6gui_menu_t * MENU) MENU: a pointer to the menu. Constructs a readable description of the object. Usefull for debugging, or to introspect things using scripts, at run-time. Does not necessarly describe all the informations about the object, but helps knowing what it is. *Return value:* a string describing the object, must be freed. -- Function: void lw6gui_menu_set_title (lw6gui_menu_t * MENU, char * TITLE) MENU: a pointer to the menu. TITLE: the new title, you can free it after calling the function, an internal copy will be made. Change the title of the menu. That is to say, its title. Use this function to change the title, don't try to access the struct directly. The idea is to have safe memory management. *Return value:* none -- Function: lw6gui_menuitem_t * lw6gui_menu_get_item (lw6gui_menu_t * MENU, int POSITION) MENU: the menu we want to query POSITION: the order of the item we want Gets the menu item at the given position. First item is 0, last is N-1. Returns a pointer on the real object, not a copy. *Return value:* a pointer to a menu item, NULL if out of range. -- Function: int lw6gui_menu_select (lw6gui_menu_t * MENU, int POSITION, int ALLOW_SCROLL, int64_t NOW) MENU: the menu we want to modify POSITION: the position of the item we want to select ALLOW_SCROLL: wether scrolling should be allowed when displaying it NOW: the current time, as a timestamp. Selects the item at the given position. Use this function to be sure that only one item is selected, and all other states are consistent. Timestamp is needed for the sake of eye-candy. *Return value:* 1 if success, 0 if failure (out of range). -- Function: void lw6gui_menu_select_esc (lw6gui_menu_t * MENU, int STATE, int64_t NOW) MENU: the menu we want to modify STATE: 1 to select, 0 to unselect NOW: the current time, as a timestamp. Selects the escape item, this does not affect other items, it's mostly. to handle eye candy. *Return value:* none. -- Function: void lw6gui_menu_enable_esc (lw6gui_menu_t * MENU, int STATE, int64_t NOW) MENU: the menu we want to modify STATE: 1 to enable, 0 to disable NOW: the current time, as a timestamp. Enables the escape item, this does not affect other items, it's mostly. to handle eye candy. *Return value:* none. -- Function: int lw6gui_menu_scroll_up (lw6gui_menu_t * MENU) MENU: the menu to scroll Scrolls a menu up, used as a callback for mouse wheel up for instance. The idea is just to decrement the first displayed item index. *Return value:* 1 if OK, 0 if failed (out of range). -- Function: int lw6gui_menu_scroll_down (lw6gui_menu_t * MENU) MENU: the menu to scroll Scrolls a menu down, used as a callback for mouse wheel down for instance. The idea is just to increment the first displayed item index. *Return value:* 1 if OK, 0 if failed (out of range). -- Function: void lw6gui_menu_center (lw6gui_menu_t * MENU, int POSITION, int MAX_DISPLAYED_ITEMS) MENU: the menu to center POSITION: the position of the menuitem to be put in the center MAX_DISPLAYED_ITEMS: the maximum number of items displayed Centers the menu on a given menuitem. Typically used when pushing a menu with a menuitem selected 'anywhere' in the list. *Return value:* none. -- Function: int lw6gui_menu_insert (lw6gui_menu_t * MENU, lw6gui_menuitem_t * MENUITEM, int POSITION, int64_t NOW) MENU: the menu we want to modify MENUITEM: the item to insert POSITION: the position the new item will occupy ("insert before" mode) NOW: the current time, as a timestamp. Inserts the given item in the menu. All items starting at the insert position will be "pushed" (that is, their position incremented by 1). Once the menuitem is inserted, the menu object will take care of memory management and automatically free it when needed. *Return value:* 1 if success, 0 if failure (memory problem, out of range). -- Function: int lw6gui_menu_append (lw6gui_menu_t * MENU, lw6gui_menuitem_t * MENUITEM, int64_t NOW) MENU: the menu we want to modify MENUITEM: the item to insert NOW: the current time, as a timestamp. Appends the given item to the menu. Once the menuitem is appended, the menu object will take care of memory management and automatically free it when needed. *Return value:* 1 if success, 0 if failure (memory problem). -- Function: int lw6gui_menu_remove (lw6gui_menu_t * MENU, int POSITION, int64_t NOW) MENU: the menu we want to modify POSITION: the item to insert NOW: the current time, as a timestamp. Removes an item from the menu. It will automatically be freed. *Return value:* 1 if success, 0 if failure (out of range). -- Function: void lw6gui_menu_update_display_range (lw6gui_menu_t * MENU, int MAX_DISPLAYED_ITEMS) MENU: the menu concerned MAX_DISPLAYED_ITEMS: the maximum number of items to display at once Updates the display range. The reason for having this is that the first item, that is, how far we scroll in a very long menu, depends on the previous position. Plus you have to handle limit cases (begin/end). Thus, this function, which will automatically pick-up a suitable position. Of course, `first_item_displayed' is not necessarly equal to `selected_item'. *Return value:* none. -- Function: int lw6gui_menu_insert_for_id_use (lw6gui_menu_t * MENU, char * LABEL, int VALUE, int ENABLED, int SELECTED, int COLORED, int POSITION, int64_t NOW) MENU: the menu to work on LABEL: the label of the menuitem to append VALUE: the value of the menuitem to append ENABLED: wether the inserted menuitem should be enabled SELECTED: wether the inserted menuitem should be selected COLORED: wether the inserted menuitem should use value as its color NOW: current time (timestamp) Inserts a menu item at the given position. The idea is that the menu item object is automatically constructed on the fly, and an id is returned, which can be passed to '_using_id' menu-related functions. This is typically for using in scripts. The idea is that the script just keeps a copy of the id returned, and can this way operate directly on the menuitem without keeping a pointer, a smob or anything internally. From the C point of view, having a real C structure enables persistent data from one display to the other, and this is nice and conveninent. I acknowledge the prototype is scary. *Return value:* 0 if error, or else an id which will later be used with '_using_id' functions. -- Function: int lw6gui_menu_append_for_id_use (lw6gui_menu_t * MENU, char * LABEL, int VALUE, int ENABLED, int SELECTED, int COLORED, int64_t NOW) MENU: the menu to work on LABEL: the label of the menuitem to append VALUE: the value of the menuitem to append ENABLED: wether the appended menuitem should be enabled SELECTED: wether the appended menuitem should be selected COLORED: wether the appended menuitem should use value as its color NOW: current time (timestamp) Appends a menuitem using the same logic as `lw6gui_menu_insert_for_id_use' that is to say a parameter is returned which can later be used to directly operate on a given menuitem, without having its pointer, and even if its position changes. *Return value:* 0 if error, or else an id which will later be used with '_using_id' functions. -- Function: int lw6gui_menu_remove_using_id (lw6gui_menu_t * MENU, int MENUITEM_ID, int64_t NOW) MENU: the menu to work on MENUITEM_ID: the id of the menuitem to remove NOW: current time (timestamp) Deletes the menuitem with the given id. Very important: the id is not the position. Id are arbitrary numbers that stick to menuitems, but they are not directly linked with the position. This function is practical to use if, for some reason, you don't have the pointer on the menuitem. *Return value:* 1 if success, 0 if failure (out of range). -- Function: void lw6gui_menu_sync_using_id (lw6gui_menu_t * MENU, int MENUITEM_ID, char * LABEL, int VALUE, int ENABLED, int SELECTED, int COLORED, int64_t NOW) MENU: the menu to work on MENUITEM_ID: the id of the menuitem to synchronize NOW: current time (timestamp) Updates the menuitem with the given id. Very important: the id is not the position. Id are arbitrary numbers that stick to menuitems, but they are not directly linked with the position. This function is practical to use if, for some reason, you don't have the pointer on the menuitem. In practice, it's heavily used in the game to transmit informations from the scripts to the core C engine. Additionnaly, this function will automatically synchronize the `selected_item' field of the menu struct. *Return value:* 1 if success, 0 if failure (out of range). -- Function: int lw6gui_menu_is_same (lw6gui_menu_t * MENU_A, lw6gui_menu_t * MENU_B) MENU_A: first item to compare MENU_B: second item to compare Compares two menus. *Return value:* 1 if they are the same, 0 if not -- Function: lw6gui_menu_t * lw6gui_menu_dup (lw6gui_menu_t * MENU) MENU: the menu to duplicate Duplicates a menu structure. *Return value:* a pointer to the new menu. -- Function: int lw6gui_menu_sync (lw6gui_menu_t * DST, lw6gui_menu_t * SRC) DST: the target menu SRC: the source menu Synchronizes two menus, this supposes that they represent the same menu, but simply in a different state. This function does not really copy src to dst, it has a special behavior, indeed everything is copied from src to dst, except the `first_item_displayed' and `nb_items_displayed' which are taken from dst and copied to src. This is because in practise, those values are updated in the display loop/thread, which is the one which uses the target. This is not very orthodox, but should work. *Return value:* 1 if success, 0 if failure -- Function: lw6gui_menuitem_t * lw6gui_menuitem_new (char * LABEL, int VALUE, int ENABLED, int SELECTED, int COLORED) LABEL: the string to be displayed, what the user sees. Can be freed after the call is done, function will make a copy internally. VALUE: the value. No GUI function uses this, this is the "real" value associated to the item. ENABLED: wether the menu item can be selected, used, and so on SELECTED: wether the menu item is the item selected among all menu items. COLORED: wetherr the menu item must, when drawn, be colored according to its value. Constructs a new menuitem object. Note that you can always call other functions to modify these values afterwards, this might change rendering since `lw6gui_menuitem_set_value' or `lw6gui_menuitem_set_label' will, for instance, modify the "when was that item last modified" information. *Return value:* a pointer to the newly allocated object. -- Function: void lw6gui_menuitem_free (lw6gui_menuitem_t * MENUITEM) MENUITEM: a pointer to the menuitem. Frees the menuitem, checking if things are OK before doing so. *Return value:* none. -- Function: int lw6gui_menuitem_memory_footprint (lw6gui_menuitem_t * MENUITEM) MENUITEM: a pointer to the menuitem. Gets the memory occupied by the menuitem. Could be usefull to help a garbage collector taking decisions or reporting erros, for instance. *Return value:* the number of bytes used. -- Function: char * lw6gui_menuitem_repr (lw6gui_menuitem_t * MENUITEM) MENUITEM: a pointer to the menuitem. Constructs a readable description of the object. Usefull for debugging, or to introspect things using scripts, at run-time. Does not necessarly describe all the informations about the object, but helps knowing what it is. *Return value:* a string describing the object, must be freed. -- Function: void lw6gui_menuitem_set_label (lw6gui_menuitem_t * MENUITEM, char * LABEL, int64_t NOW) MENUITEM: a pointer to the menuitem. LABEL: the new label, you can free it after calling the function, an internal copy will be made. NOW: the current time, as a timestamp. Change the label of the menu item. That is to say, what the user sees. Use this function to change the menuitem value, don't try to access the struct directly. The idea is 1) to have safe memory management and 2) to keep the `last_change' member up to date. It can be later used for eye-candy effects. *Return value:* none -- Function: void lw6gui_menuitem_set_value (lw6gui_menuitem_t * MENUITEM, int VALUE, int64_t NOW) MENUITEM: a pointer to the menuitem. NOW: the current time, as a timestamp. Changes the value of a menuitem. This is the internal value, not what the user sees. Use this function to change the menuitem value, don't try to access the struct directly. The idea is to keep the `last_change' member up to date. It can be later used for eye-candy effects. *Return value:* none -- Function: void lw6gui_menuitem_select (lw6gui_menuitem_t * MENUITEM, int STATE, int64_t NOW) MENUITEM: a pointer to the menuitem. STATE: 1 to select, 0 to unselect NOW: the current time, as a timestamp. Switches the menuitem to (un)selected state. Use this function, don't try to modify the struct members directly. The idea is to have the `last_select' parameter up to date. It can be later used for eye-candy effects. *Return value:* none -- Function: void lw6gui_menuitem_enable (lw6gui_menuitem_t * MENUITEM, int STATE, int64_t NOW) MENUITEM: a pointer to the menuitem. STATE: 1 to enable, 0 to disable NOW: the current time, as a timestamp. Switches the menuitem to enabled/disabled state. Use this function, don't try to modify the struct members directly. The idea is to have the `last_select' parameter up to date. It can be later used for eye-candy effects. *Return value:* none -- Function: u_int32_t lw6gui_menuitem_checksum (lw6gui_menuitem_t * MENUITEM, lw6gui_look_t * LOOK) MENUITEM: the menuitem we want to identify Returns a checksum which can be used to know, for instance, wether the menuitem has changed or not, and if we should redraw it. *Return value:* a checksum. -- Function: int lw6gui_menuitem_is_same (lw6gui_menuitem_t * MENUITEM_A, lw6gui_menuitem_t * MENUITEM_B) MENUITEM_A: first item to compare MENUITEM_B: second item to compare Compares two menuitems. *Return value:* 1 if they are the same, 0 if not -- Function: lw6gui_menuitem_t * lw6gui_menuitem_dup (lw6gui_menuitem_t * MENUITEM) MENUITEM: the menuitem to duplicate The menuitem to duplicate. *Return value:* a pointer to the duplicted menuitem. -- Function: int lw6gui_menuitem_sync (lw6gui_menuitem_t * DST, lw6gui_menuitem_t * SRC) DST: the target menuitem SRC: the source menuitem Synchronizes two menuitems, this supposes that they represent the same item, but simply in a different state. *Return value:* 1 if success, 0 if failure -- Function: void lw6gui_mouse_register_move (lw6gui_mouse_t * MOUSE, int X, int Y, int64_t TIMESTAMP) MOUSE: the mouse object to work on X: the x position Y: the y position TIMESTAMP: current timestamp Registers a mouse move event. *Return value:* note. -- Function: int lw6gui_mouse_poll_move (lw6gui_mouse_t * MOUSE, int * X, int * Y) MOUSE: the mouse object to poll X: pointer to the x position (can be NULL), will be updated even if no move Y: pointer to the y position (can be NULL), will be updated even if no move Asks wether the mouse has moved or not. *Return value:* 1 if mouse was moved since last call, 0 if not. -- Function: void lw6gui_mouse_update_repeat (lw6gui_mouse_t * MOUSE, lw6gui_repeat_settings_t * REPEAT_SETTINGS, int64_t TIMESTAMP) MOUSE: the mouse to update REPEAT_SETTINGS: the repeat settings (delay + interval) TIMESTAMP: the current ticks (milliseconds) Updates the repeat informations for a mouse, must be called regularly, as often as possible. *Return value:* none. -- Function: int lw6gui_mouse_sync (lw6gui_mouse_t * DST, lw6gui_mouse_t * SRC) DST: the target mouse object SRC: the source mouse object Synchronizes two mouse objects. This is typically used to pass data from one thread to another. Will handle "mouse move" attribute and clear it in src if needed while setting it in dst. *Return value:* 1 if success, O if failure. -- Function: void lw6gui_smoother_init (lw6gui_smoother_t * SMOOTHER, float VALUE, int DURATION) SMOOTHER: the structure to initialize VALUE: the value to use for now DURATION: the duration of a standard move, in ticks (msec) Initializes a smoother object, with a default value. The important point is the duration which will condition all the behavior of the object. *Return value:* none. -- Function: void lw6gui_smoother_immediate_force (lw6gui_smoother_t * SMOOTHER, float VALUE) SMOOTHER: the structure to use VALUE: the target value Forces a smoother object to immediately point on a value. *Return value:* none. -- Function: void lw6gui_smoother_set_target (lw6gui_smoother_t * SMOOTHER, float VALUE, int64_t NOW) SMOOTHER: the structure to use VALUE: the target value NOW: the current timestamp Sets a new target, will automatically calculate current speed to smooth the next returned values. *Return value:* none. -- Function: float lw6gui_smoother_get_value (lw6gui_smoother_t * SMOOTHER, int64_t NOW) SMOOTHER: the structure to use NOW: the current timestamp Returns the current value of the smoother. *Return value:* a float. -- Function: int lw6gui_test () Run tests in the gui module. *Return value:* 1 if successfull, 0 if failed. -- Function: int lw6gui_video_mode_find_closest (lw6gui_video_mode_t * CLOSEST, lw6gui_video_mode_t * WISHED, lw6sys_list_t * AVAILABLE) CLOSEST: the closest video_mode found WISHED: the wished video_mode AVAILABLE: a list of available video_modes (list of lw6gui_video_mode_t *) Finds the closest video_mode available, this is just a small utility to cope with different screen shapes and avoid requesting 640x480 when it's just not available but there's a 640x400 instead. *Return value:* 1 if the wished video_mode exists in available list and was found, else 0 if the wished video_mode doesn't exist and an approximative match was picked. -- Function: int lw6gui_video_mode_is_same (lw6gui_video_mode_t * MODE_A, lw6gui_video_mode_t * MODE_B) MODE_A: first mode to compare MODE_B: second mode to compare Compares two video modes, to know if they're the same. *Return value:* 1 if equal, 0 if not. -- Function: int lw6gui_video_mode_sync_ratio (lw6gui_video_mode_t * DST, lw6gui_video_mode_t * SRC) DST: the target video mode SRC: the source video mode Applies the ratio of src to dst, for instance if src is 16/9, then dst will be made 16/9 too, trying to keep the same surface. *Return value:* 1 on success, 0 on failure -- Function: int lw6gui_viewport_init (lw6gui_viewport_t * VIEWPORT, int SCREEN_W, int SCREEN_H, float DRAWABLE_X1, float DRAWABLE_Y1, float DRAWABLE_X2, float DRAWABLE_Y2, float CENTER_X, float CENTER_Y, int MAP_W, int MAP_H, int X_POLARITY, int Y_POLARITY, int X_WRAP, int Y_WRAP, int KEEP_RATIO, float GLOBAL_ZOOM) VIEWPORT: the viewport to initalize SCREEN_W: screen width SCREEN_H: screen height DRAWABLE_X1: viewport min x DRAWABLE_Y1: viewport min y DRAWABLE_X2: viewport max x DRAWABLE_Y2: viewport max y CENTER_X: center of display (in map coordinates) CENTER_Y: center of display (in map coordinates) MAP_W: map width (shape) MAP_H: map height (shape) X_POLARITY: x polarity Y_POLARITY: y polarity X_WRAP: wether to wrap horizontally Y_WRAP: wether to wrap vertically KEEP_RATIO: wether to adapt to viewport shape or keep original GLOBAL_ZOOM: global zoom is style_zoom * dynamic_zoom Initializes all the (jumbo?) viewport structure which will contain valuable informations for a simple "flat" display. Special renderers might not find usefull some fields and handle wrapping and zooming their own way, but this offers a basic skeleton. *Return value:* 1 if ok, 0 on failure -- Function: void lw6gui_viewport_map_to_screen (lw6gui_viewport_t * VIEWPORT, float * SCREEN_X, float * SCREEN_Y, float MAP_X, float MAP_Y, int CLIP) VIEWPORT: the viewport to use SCREEN_X: the x coord on the screen SCREEN_Y: the y coord on the screen MAP_X: the x coord in map coordinates MAP_Y: the y coord in map coordinates CLIP: wether to clip returned values Translates from map coords to screen coords. Returned values might be outside screen boundaries if clip is 0. If screen coords are outside drawable area anc clip is 1, then they will be clipped. *Return value:* NULL -- Function: void lw6gui_viewport_screen_to_map (lw6gui_viewport_t * VIEWPORT, float * MAP_X, float * MAP_Y, float SCREEN_X, float SCREEN_Y, int WRAP) VIEWPORT: the viewport to use MAP_X: the x coord in map coordinates MAP_Y: the y coord in map coordinates SCREEN_X: the x coord on the screen SCREEN_Y: the y coord on the screen WRAP: wether to use polarity informations to wrap coords. Translates from screen coords to map coords. If wrap is set, it will interpret coords the way `lw6map_coords_fix_xy' would, only it can still be formally outside map boundaries for it can return a value exactly equal to w,h while in interger mode it would be w-1,h-1. *Return value:* NULL -- Function: void lw6gui_zone_init_x1y1x2y2 (lw6gui_zone_t * ZONE, float X1, float Y1, float X2, float Y2) ZONE: the structure to initialize X1: x for top left corner Y1: y for top left corner X2: x for bottom right corner Y2: y for bottom right corner Initializes a zone structure, will calculate w & h. *Return value:* none. -- Function: void lw6gui_zone_init_xywh (lw6gui_zone_t * ZONE, float X, float Y, float W, float H) ZONE: the structure to initialize X: x for top left corner Y: y for top left corner W: width H: height Initializes a zone structure, will calculate x2 & y2. *Return value:* none. -- Function: void lw6gui_zone_clip (lw6gui_zone_t * DST, lw6gui_zone_t * SRC, lw6gui_zone_t * CLIP) DST: the structure which will contain the result SRC: the source zone CLIP: the clipping zone (boundaries) Clips a zone (think of rectangle clips). *Return value:* none. 4.15.31 libhlp -------------- -- Function: int lw6hlp_is_documented (char * KEYWORD) KEYWORD: the keyword we want to check out Checks wether a given keyword is documented or not. *Return value:* 1 if documented, 0 if not. -- Function: char * lw6hlp_about (lw6hlp_type_t * TYPE, char ** DEFAULT_VALUE, int * MIN_VALUE, int * MAX_VALUE, char * KEYWORD) TYPE: the type of the data associated to the keyword, will be written DEFAULT_VALUE: the default value for the keyword, will be written MIN_VALUE: the min value for the keyword, will be written MAX_VALUE: the max value for the keyword, will be written KEYWORD: the keyword we want help about Returns the documentation string associated to a keyword. The keyword might be a command-line option, a Guile function, an XML file entry. Raises a warning if the keyword is undocumented, but never returns NULL, you can use the returned value without checking it. String is localized if a translation is available. It's safe to call this function with type or other parameters being NULL. *Return value:* a help string, never NULL, must not be freed. Additionnally, type will be updated. -- Function: lw6hlp_type_t lw6hlp_get_type (char * KEYWORD) KEYWORD: the keyword we want the type of Returns the type of a keyword. Calls lw6hlp_about internally. *Return value:* the type, might be LW6HLP_TYPE_VOID. -- Function: char * lw6hlp_get_default_value (char * KEYWORD) KEYWORD: the keyword we want the default for Returns the default value for a keyword. Note that it can be NULL! The returned value is always a string, it's suitable to store in the config file, it's the value a user would pass on a command line, the one he wants documented. *Return value:* a pointer, which can be NULL, must not be freed. -- Function: int lw6hlp_get_min_value (char * KEYWORD) KEYWORD: the keyword we want the min for Returns the min value for a keyword. Wether this is relevant for a given keyword does not affect the fact that you can call this function. A min and max of zero means min and max make no sense. *Return value:* the value (integer) -- Function: int lw6hlp_get_max_value (char * KEYWORD) KEYWORD: the keyword we want the max for Returns the max value for a keyword. Wether this is relevant for a given keyword does not affect the fact that you can call this function. A min and max of zero means min and max make no sense. *Return value:* the value (integer) -- Function: int lw6hlp_match (char * KEYWORD1, char * KEYWORD2) KEYWORD1: the 1st keyword KEYWORD2: the 2nd keyword Checks wether a keyword matches another. Not only a string comparison, will also try and guess if the error is only about dash "-" replaced by underscode "_", for instance. *Return value:* 1 if matches, 0 if different. -- Function: lw6sys_list_t * lw6hlp_list () Returns a list of all available keywords. *Return value:* a list containing all the keywords. Strings are not dynamically allocated, you can't modify them. -- Function: void lw6hlp_print_keyword (lw6sys_list_t ** LIST, FILE * F) list: a pointer to a list of keywords f: the file to print the content to Prints all the keywords from the list. One keyword per line. *Return value:* none. -- Function: void lw6hlp_print_content (lw6sys_list_t ** LIST, FILE * F) list: a pointer to a list of keywords f: the file to print the content to Prints all the keywords from the list, with the associated keyword help, to the given file. Output is formatted to fit on the standard terminal/console. *Return value:* none. -- Function: int lw6hlp_reference_init () Initializes the help reference, this must be called before any call to lw6hlp_about or such help related functions. *Return value:* 1 on success, 0 if failed -- Function: void lw6hlp_reference_quit () Un-initializes the help reference, this must be called at the end of the program. *Return value:* 1 on success, 0 if failed 4.15.32 libimg -------------- 4.15.33 libker -------------- 4.15.34 libldr -------------- -- Function: int lw6ldr_body_read (lw6map_body_t * BODY, char * DIRNAME, lw6map_param_t * PARAM, lw6ldr_hints_t * HINTS, int DISPLAY_W, int DISPLAY_H, float RATIO, lw6sys_progress_t * PROGRESS) BODY: the body to read, must point to allocated memory DIRNAME: the directory of the map PARAM: map parameters HINTS: map hints RATIO: wished map ratio PROGRESS: structure to transmit loading progress Reads the map body, that is, all the layers. *Return value:* 1 if OK, 0 if failed. -- Function: void lw6ldr_auto_colors (lw6map_style_t * STYLE, lw6ldr_hints_t * HINTS) STYLE: the style structure to process. HINTS: additionnal hints to know what to set automatically Deduces all colors from background color, if needed. The function will check color_auto parameters and replace all other colors by base and alternate colors if needed. Note that the background color itself is not changed by this function. Background can only be guessed from texture. *Return value:* none. -- Function: void lw6ldr_free_entry (lw6ldr_entry_t * ENTRY) ENTRY: the entry to free Frees a map entry. *Return value:* none. -- Function: lw6sys_list_t * lw6ldr_get_entries (char * MAP_PATH, char * RELATIVE_PATH) MAP_PATH: the map_path environment config variable, delimited path list RELATIVE_PATH: the relative path to use to find the map directory Lists all maps in a given directory. Returns a list of lw6ldr_entry_t which can contain both directories with subdirs and actual maps. Maps are sorted before being returned, first directories, then maps, sorted in alphabetical order. *Return value:* a list of dynamically allocated lw6ldr_entry_t. -- Function: void lw6ldr_for_all_entries (char * MAP_PATH, char * RELATIVE_PATH, int RECURSIVE, lw6sys_list_callback_func_t CALLBACK_FUNC, void * FUNC_DATA) MAP_PATH: the map_path environment config variable, delimited path list RELATIVE_PATH: the relative path to use to find the map directory RECURSIVE: if non-zero, map search will recurse in subdirs CALLBACK_FUNC: the function which will be called on each entry FUNC_DATA: an extra pointer to pass data to callback_func Executes a given function on all maps in a given place, typically used in test programs. *Return value:* none. -- Function: int lw6ldr_hints_read (lw6ldr_hints_t * HINTS, char * DIRNAME) DIRNAME: the directory of the map Read the hints (hints.xml) of a map. Pointer to hints must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_hints_set (lw6ldr_hints_t * HINTS, char * KEY, char * VALUE) HINTS: the hints to modify KEY: the key to modify VALUE: the value to affect to the key, as a string Sets one single parameter in a hints structure. Value must always be passed as a string, will be converted to the right type automatically when storing it in the structure. *Return value:* 1 if success, 0 if failed. Note that while 0 really means there's a problem, some affectations can fail and return 1, needs to be worked on. -- Function: int lw6ldr_hints_update (lw6ldr_hints_t * HINTS, lw6sys_assoc_t * VALUES) HINTS: the hints struct to fill with values (read/write parameter) VALUES: an assoc containing strings with the new values Overrides hints with values. Pointer to hints must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. Not all parameters need be defined in values. It can even be NULL. The idea is just that if something is defined in values, it will override the existing hints. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_param_read (lw6map_param_t * PARAM, char * DIRNAME) PARAM: the parameter struct to fill with values (read/write parameter) DIRNAME: the directory of the map Read the parameters associated to a map. Pointer to param must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_param_update (lw6map_param_t * PARAM, lw6sys_assoc_t * VALUES) PARAM: the parameter struct to fill with values (read/write parameter) VALUES: an assoc containing strings with the new values Overrides param with values. Pointer to param must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. Not all parameters need be defined in values. It can even be NULL. The idea is just that if something is defined in values, it will override the existing param. *Return value:* 1 if success, 0 if failed. -- Function: void lw6ldr_print_example_rules_xml (FILE * F) F: file to output content to Print to a file a typical map rules.xml file. *Return value:* none. -- Function: void lw6ldr_print_example_hints_xml (FILE * F) F: file to output content to Print to a file a typical map hints.xml file. *Return value:* none. -- Function: void lw6ldr_print_example_style_xml (FILE * F) F: file to output content to Print to a file a typical map style.xml file. *Return value:* none. -- Function: int lw6ldr_print_examples (char * USER_DIR) USER_DIR: the user directory or at least, a writable one Writes all example XML files in 'user_dir/example/', will create the directory if needed. *Return value:* 1 if success, 0 if failed. -- Function: lw6map_level_t * lw6ldr_read (char * DIRNAME, lw6sys_assoc_t * DEFAULT_PARAM, lw6sys_assoc_t * FORCED_PARAM, int DISPLAY_W, int DISPLAY_H, lw6sys_progress_t * PROGRESS) DIRNAME: the directory containing the map DEFAULT_PARAM: default parameters, as strings FORCED_PARAM: forced parameters, as strings DISPLAY_W: the width of the display output (resolution) DISPLAY_H: the height of the display output (resolution) PROGRESS: information used to handle the progress bar Loads a map from dist. The default_param and forced_param can contain values corresponding to rules.xml and style.xml entries. Parameters are read in 4 steps. 1st, a default value is picked by the program. 2nd, any value in `default_param' replaces previous values. 3rd, any value in rules.xml or style.xml replaces previous values. 4th, any value in `forced_param' replaces previous values. In practice, the `default_param' allows the user to set defaults which can still be overwritten by the map, while `forced_param' is a definitive 'ignore what is is defined in the map' way of doing things. See also `lw6ldr_read_relative'. *Return value:* 1 if success, 0 if failed. -- Function: lw6map_level_t * lw6ldr_read_relative (char * MAP_PATH, char * RELATIVE_PATH, lw6sys_assoc_t * DEFAULT_PARAM, lw6sys_assoc_t * FORCED_PARAM, int DISPLAY_W, int DISPLAY_H, lw6sys_progress_t * PROGRESS) MAP_PATH: a collection of paths where to find maps RELATIVE_PATH: something which will be appended to a `map_path' member DEFAULT_PARAM: default parameters, as strings FORCED_PARAM: forced parameters, as strings DISPLAY_W: the width of the display output (resolution) DISPLAY_H: the height of the display output (resolution) PROGRESS: information used to handle the progress bar Reads a map from disk, using the map-path value, which is a collection of paths defined by the command-line, the environment variables, and the config file. `default_param' and `forced_param' work as in the function `lw6ldr_read'. *Return value:* 1 if success, 0 if failure. -- Function: int lw6ldr_rules_read (lw6map_rules_t * RULES, char * DIRNAME) DIRNAME: the directory of the map Read the rules (rules.xml) of a map. Pointer to rules must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_rules_update (lw6map_rules_t * RULES, lw6sys_assoc_t * VALUES) RULES: the rules struct to fill with values (read/write parameter) VALUES: an assoc containing strings with the new values Overrides rules with values. Pointer to rules must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. Not all parameters need be defined in values. It can even be NULL. The idea is just that if something is defined in values, it will override the existing rules. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_style_read (lw6map_style_t * STYLE, char * DIRNAME) DIRNAME: the directory of the map Read the style (style.xml) of a map. Pointer to style must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_style_set (lw6map_style_t * STYLE, char * KEY, char * VALUE) STYLE: the style to modify KEY: the key to modify VALUE: the value to affect to the key, as a string Sets one single parameter in a style structure. Value must always be passed as a string, will be converted to the right type automatically when storing it in the structure. *Return value:* 1 if success, 0 if failed. Note that while 0 really means there's a problem, some affectations can fail and return 1, needs to be worked on. -- Function: int lw6ldr_style_update (lw6map_style_t * STYLE, lw6sys_assoc_t * VALUES) STYLE: the style struct to fill with values (read/write parameter) VALUES: an assoc containing strings with the new values Overrides style with values. Pointer to style must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. Not all parameters need be defined in values. It can even be NULL. The idea is just that if something is defined in values, it will override the existing style. *Return value:* 1 if success, 0 if failed. -- Function: int lw6ldr_use_update (lw6ldr_use_t * USE, lw6sys_assoc_t * VALUES) USE: the use struct to fill with values (read/write parameter) VALUES: an assoc containing strings with the new values Overrides use with values. Pointer to use must be valid, and values already initialized, either zeroed or filled in with defaults or custom values. Not all parameters need be defined in values. It can even be NULL. The idea is just that if something is defined in values, it will override the existing use. *Return value:* 1 if success, 0 if failed. 4.15.35 libmap -------------- -- Function: void lw6map_color_invert (lw6map_color_couple_t * COLOR) COLOR: the color to invert Inverts a color couple, that is, replace fg by bg and vice-versa. *Return value:* none. -- Function: int lw6map_color_is_same (lw6map_color_couple_t * COLOR1, lw6map_color_couple_t * COLOR2) COLOR1: 1st color to compare COLOR2: 2nd color to compare Compares two colors. *Return value:* 1 if equal, 0 if not. -- Function: char * lw6map_team_color_index_to_key (int INDEX) INDEX: index of the color between 0 & 9 Transforms a team color index into its readable string form, which can be used in config files for instance. *Return value:* a string, must *not* be freed. -- Function: int lw6map_team_color_key_to_index (char * KEY) KEY: key of the color, for instance "red" The index of the color, between 0 & 9 *Return value:* an integer. -- Function: lw6map_level_t * lw6map_dup (lw6map_level_t * SOURCE, lw6sys_progress_t * PROGRESS) SOURCE: the map to copy PROGRESS: to show advancement Performs a deep copy of the map, all elements are newly allocated and source can safely be destroyed after it's been duplicated. *Return value:* a newly allocated map, may be NULL. -- Function: char * lw6map_to_hexa (lw6map_level_t * LEVEL) Converts a map to something that is later readable by `lw6map_from_hexa' to reproduce the exact same map. Just a serializer. *Return value:* a newly allocated pointer, NULL if conversion failed. -- Function: lw6map_level_t * lw6map_from_hexa (char * HEXA) HEXA: an hexadecimal ASCII string, created by `lw6map_to_hexa' Constructs a map from an hexadecimal string generated by `lw6map_to_hexa'. Just an un-serializer. *Return value:* a new map, might be NULL if string isn't correct. -- Function: lw6map_level_t * lw6map_new () Creates a new empty map. This object is perfectly unusable as is, since it has a 0x0 size, and many things set to "NULL". Still, it's used internally and is the canonical way to create the object, it ensures later calls that set up default parameters, for instance, will succeed. *Return value:* a newly allocated pointer. -- Function: lw6map_level_t * lw6map_builtin_defaults () Creates a map, set to defaults. This is usefull mostly for testing. This builtin map has walls, paths, it's playable. *Return value:* a newly allocated map. -- Function: lw6map_level_t * lw6map_builtin_whd (int W, int H, int D) W: the width of the map H: the height of the map D: the depth (number of layers) of the map Creates a map, set to defaults. This is usefull mostly for testing. This one, unlike `lw6map_builtin_defaults' will let you give a width, height and a depth. *Return value:* a newly allocated map. -- Function: void lw6map_free (lw6map_level_t * LEVEL) Frees a map and releases all its internal ressources. *Return value:* none. -- Function: int lw6map_memory_footprint (lw6map_level_t * LEVEL) Reports how many bytes the map needs, in memory. Note that this is not contiguous memory, it involves a bunch of pointers, and possibly much more... -- Function: char * lw6map_repr (lw6map_level_t * LEVEL) Returns a string describing the map. This is a very short description, use it for logs, and to debug stuff. By no means it's a complete exhaustive description. Still, the string returned should be unique. *Return value:* a dynamically allocated string. -- Function: int lw6map_is_same (lw6map_level_t * LEVEL_A, lw6map_level_t * LEVEL_B) LEVEL_A: the first level to compare LEVEL_B: the other level to compare Compares two level structs, the idea is to compare the content, not only the pointers and level ids. *Return value:* 1 if they're the same, 0 if not. -- Function: void lw6map_param_defaults (lw6map_param_t * PARAM) PARAM: the param struct to modify Sets a param structure to its default value, note that current structured must be zeroed or correctly initialized. *Return value:* none -- Function: void lw6map_param_clear (lw6map_param_t * PARAM) PARAM: the param struct to modify Resets a param structure to nothing. Note that current structured must be zeroed or correctly initialized. The idea is just to free member pointers before calling free. *Return value:* none -- Function: void lw6map_param_copy (lw6map_param_t * DST, lw6map_param_t * SRC) DST: the destination param struct SRC: the source param struct Copies parameters. Both structures must be zeroed or correctly initialized. *Return value:* none -- Function: int lw6map_param_set (lw6map_param_t * PARAM, char * KEY, char * VALUE) PARAM: the param struct to modify KEY: the name of the parameter to modify VALUE: the value of the parameter to modify Sets an entry in a param struct. All values must be submitted as strings, internally, the function will call atoi to convert to integers if needed, for instance. It will also dispatch automatically between rules and style. *Return value:* 1 if parameter successfully set, 0 on error. 4.15.36 libnet -------------- -- Function: int lw6net_last_error () Reports the last network error. This is basically a debug function, designed mostly for Microsoft Winsock API, but can be safely called on any platform. *Return value:* the last error code, has no universal meaning, depends on the platform you're working on. -- Function: char * lw6net_recv_line_tcp (int SOCK) SOCK: the socket descriptor Receives a line terminated by LF ("\n", chr(10)) or CR/LF ("\r\n", chr(10)chr(13)) on a TCP socket, that is, stream oriented. If there's no complete line available, function returns immediately with NULL. Same if socket is closed, broken, whatever. Only if there's something consistent will the function return non-NULL. *Return value:* a dynamically allocated string with the content received. The tailing (CR)/LF is stripped. -- Function: int lw6net_send_line_tcp (int SOCK, char * LINE) SOCK: the socket descriptor LINE: the line to be sent, without the "\n" at the end Sends a line terminated by LF ("\n", chr(10)) on a TCP socket, that is, stream oriented. The "\n" is automatically added, do not bother sending it. *Return value:* non-zero if success -- Function: char * lw6net_recv_line_udp (int SOCK, char ** INCOMING_IP, int * INCOMING_PORT) SOCK: the socket descriptor INCOMING_IP: the IP address of the sender (returned) INCOMING_PORT: the IP port of the sender (returned) Receives a line terminated by LF ("\n", chr(10)) or CR/LF ("\r\n", chr(10)chr(13)) on a UDP socket, that is, datagram oriented. If there's no complete line available, function returns immediately with NULL. Same if socket is closed, broken, whatever. Only if there's something consistent will the function return non-NULL. By-value parameters allow the caller to know where the data come from. *Return value:* a dynamically allocated string with the content received. The tailing (CR)/LF is stripped. -- Function: int lw6net_send_line_udp (int SOCK, char * LINE, char * IP, int PORT) SOCK: the socket descriptor LINE: the line to be sent, without the "\n" at the end IP: the IP address of the target PORT: the IP port of the target Sends a line terminated by LF ("\n", chr(10)) on a UDP socket, that is, datagram oriented. The "\n" is automatically added, do not bother sending it. *Return value:* the number of bytes sent, 0 if failure -- Function: int lw6net_init (int ARGC, char * [] ARGV) Initializes the low-level network API, you must call this before calling any other network related function, for it allocates a dynamic context which is in turn used by every function. *Return value:* non-zero if success -- Function: void lw6net_quit () Frees memory, joins active threads, and releases everything set up by network code. *Return value:* void 4.15.37 libp2p -------------- 4.15.38 libpil -------------- -- Function: int lw6pil_bench (float * BENCH_RESULT) BENCH_RESULT: pointer to float, will contain the bench result Runs a standard, normalized bench on a default map. Results can be interpreted as an estimated speed/power of your computer. *Return value:* 1 on success, 0 if failure -- Function: void lw6pil_coords_fix (lw6map_rules_t * RULES, lw6sys_whd_t * SHAPE, float * X, float * Y, float * Z) RULES: the set of rules to use (defines polarity) SHAPE: the shape of the map (logical part) X: the x coord to fix Y: the y coord to fix Z: the z coord to fix Similar to `lw6map_coords_fix' but using floats, this function can be used to check cursor position boundaries. Any float pointer can be NULL. *Return value:* none. -- Function: lw6pil_pilot_t * lw6pil_pilot_new (lw6ker_game_state_t * GAME_STATE, int64_t TIMESTAMP, lw6sys_progress_t * PROGRESS) GAME_STATE: the game state we're going to work on TIMESTAMP: the current ticks (1000 ticks per sec, used to calibrate) PROGRESS: object used to show the advancement of the process Initializes a 'pilot' object, this object is responsible for interpreting messages, transform them into low-level 'ker' module function calls, and handle all the thread-spooky stuff. *Return value:* a working pilot object. May be NULL on memory failure. -- Function: void lw6pil_pilot_free (lw6pil_pilot_t * PILOT) PILOT: the object to free. Frees a 'pilot' object, note that this might involve joining some threads, so it can 'take some time'. *Return value:* none. -- Function: int lw6pil_pilot_send_command (lw6pil_pilot_t * PILOT, char * COMMAND_TEXT, int VERIFIED) PILOT: the object to send commands to. COMMAND_TEXT: the text of the command, as received form network VERIFIED: wether we're sure this message is valid. Sends a command and handles it internally. *Return value:* 1 if OK, 0 if not. -- Function: int lw6pil_pilot_commit (lw6pil_pilot_t * PILOT) PILOT: the object to commit. Commits all commands sent and actually send them to the corresponding threads. This commit system allows better performance by sending, for instance, all the commands for a given round together. *Return value:* none. -- Function: int lw6pil_pilot_make_backup (lw6pil_pilot_t * PILOT) PILOT: the object to perform the backup on Makes a new backup in the pilot, that is, copy 'reference' to 'backup'. *Return value:* 1 if OK, 0 if not. -- Function: int lw6pil_pilot_can_sync (lw6ker_game_state_t * TARGET, lw6pil_pilot_t * PILOT) TARGET: the target game_state we would sync on PILOT: the object to perform the backup on Tests wether sync functions are callable with a given game state. It verifies if the internal game_state and the target look the same. *Return value:* 1 if sync functions can be called, 0 if not. -- Function: int lw6pil_pilot_sync_from_backup (lw6ker_game_state_t * TARGET, lw6pil_pilot_t * PILOT) TARGET: the game_state structure which will get the informations. PILOT: the object to get informations from. Gets the backup from the pilot object. This is the last snapshot taken by `make_backup' or, by default, the game_state the pilot was constructed with. *Return value:* 1 if OK, 0 if not. -- Function: int lw6pil_pilot_sync_from_reference (lw6ker_game_state_t * TARGET, lw6pil_pilot_t * PILOT) TARGET: the game_state structure which will get the informations. PILOT: the object to get informations from. Gets the latest reference game_state, that is, a stable snapshot of the game, with no inconsistency, a game position that exists and that we can rely on. Note that getting this can take time since a global mutex is required, and computations must end before you get the data. *Return value:* 1 if OK, 0 if not. -- Function: int lw6pil_pilot_sync_from_draft (lw6ker_game_state_t * TARGET, lw6pil_pilot_t * PILOT, int DIRTY_READ) TARGET: the game_state structure which will get the informations. PILOT: the object to get informations from. DIRTY_READ: wether to allow dirty read or not Gets the informations from the pilot object, not being worried about game consistency, this one will just return the latest version available. It might even be in an inconsistent state, the position could reflect a position which will never exist. Still, the data returned will not correspond to a half-spread or half-moved game_state if dirty_read is set to 0. In this case the data has at least some basic consistency and getting this does require some mutex lock, however wait time should be fairly small (max. a round). But, in a general manner, this function is only used for display, and we do not care much if there's a small glitch, we prefer fast & smooth display. *Return value:* 1 if OK, 0 if not. -- Function: lw6ker_game_state_t * lw6pil_pilot_dirty_read (lw6pil_pilot_t * PILOT) PILOT: the object to get informations from. Returns a direct access to the most up-to-date game_state, without locking anything whatsoever. This is clearly to implement a dirty read mode as the name of the function suggests. *Return value:* 1 if OK, 0 if not. -- Function: char * lw6pil_pilot_repr (lw6pil_pilot_t * PILOT) Returns a string describing the pilot. This is a very short description, use it for logs, and to debug stuff. By no means it's a complete exhaustive description. Still, the string returned should be unique. *Return value:* a dynamically allocated string. -- Function: void lw6pil_pilot_calibrate (lw6pil_pilot_t * PILOT, int64_t TIMESTAMP, int ROUND) PILOT: the object to calibrate TIMESTAMP: the current ticks setting (1000 ticks per second) ROUND: the round expected to be returned with this ticks value Calibrates the pilot, that is, initializes it so that subsequent calls to `lw6pil_pilot_get_round' return consistent values. *Return value:* none. -- Function: void lw6pil_pilot_speed_up (lw6pil_pilot_t * PILOT, int ROUND_INC) PILOT: the pilot to speed up ROUND_INC: the number of rounds Re-calibrates the pilot so that it speeds up a bit. This will basically increase next_round by round_inc. *Return value:* none. -- Function: void lw6pil_pilot_slow_down (lw6pil_pilot_t * PILOT, int ROUND_DEC) PILOT: the pilot to speed up ROUND_DEC: the number of rounds Re-calibrates the pilot so that it slows down a bit. This will basically decrease next_round by round_inc. *Return value:* none. -- Function: int lw6pil_pilot_get_next_round (lw6pil_pilot_t * PILOT, int64_t TIMESTAMP) PILOT: the object to query TIMESTAMP: the current ticks setting (1000 ticks per second) Returns the round one should use to generate new events/commands at a given time (given in ticks). *Return value:* none. -- Function: int lw6pil_pilot_get_last_commit_round (lw6pil_pilot_t * PILOT) PILOT: the object to query Returns the round of the last commit (reference game_state) for this object. *Return value:* the commit round (reference object) -- Function: int lw6pil_pilot_get_reference_target_round (lw6pil_pilot_t * PILOT) PILOT: the object to query Returns the round which is targetted in the reference game_state, this is 'how far computation will go in the reference game_state if no new commands are issued'. Note that there can always be some commands which are not yet processed, so you should not rely on this too heavily, however it gives a good idea of how things are going. *Return value:* the target round (reference object) -- Function: int lw6pil_pilot_get_reference_current_round (lw6pil_pilot_t * PILOT) PILOT: the object to query Returns the current round in the reference game_state. There's no lock on this call so don't rely on this too heavily, it just gives you an idea of wether the pilot is very late on its objectives or just on time. *Return value:* the current round (reference object) -- Function: int lw6pil_pilot_get_max_round (lw6pil_pilot_t * PILOT) PILOT: the object to query Returns the max current round in the reference or draft game states. No lock on this call so don't rely on this too heavily, it just gives you an idea of computation state. *Return value:* the current round (reference object) -- Function: int lw6pil_pilot_is_over (lw6pil_pilot_t * PILOT) PILOT: the object to query Tells wether the game is over or not. *Return value:* 1 if over, 0 if not -- Function: int lw6pil_test () Runs the `pil' module test suite. *Return value:* 1 if test is successfull, 0 on error. 4.15.39 libsnd -------------- 4.15.40 libsrv -------------- 4.15.41 libsys -------------- -- Function: int lw6sys_arg_match (char * KEYWORD, char * ARGV_STRING) KEYWORD: the option to match, without the prefix "-" or "-" ARGV_STRING: the argv value, for instance argv[1] This is an utility function which allow the program to handle options in a uniform manner. Key comparison is insensitive, that is, -option and -OPTION are equivalent. Besides, -option and -OPTION are equivalent too. Liquid War 6 documentation mentions options in lowercase with a double dash (-option) by default, but it's a fact, the program supports variants. This is just for convenience, the philosophy behind this behavior is "be as permissive as possible when interpreting input, and as strict as possible when generating output". In fact, it's even said that Liquid War 6 will accept the argument without any prefix dash as being valid... This is to say running "liquidwar6 -option" is the same as running "liquidwar6 option". But, this is a secret 8-) *Return value:* non zero if it matches, 0 if it doesn't. -- Function: int lw6sys_arg_exists (int ARGC, char * [] ARGV, char * KEYWORD) ARGC: the number of arguments, as passed to `main' ARGV: an array of arguments, as passed to `main' KEYWORD: the keyword to match Parses all command-line arguments, searching for one precise "-key[=...]" entry. *Return value:* 1 if key is present, 0 if not. -- Function: char * lw6sys_arg_get_value (int ARGC, char * [] ARGV, char * KEYWORD) ARGC: the number of arguments, as passed to `main' ARGV: an array of arguments, as passed to `main' KEYWORD: the keyword to match Parses all command-line arguments, searching for one precise "-key=value" pair, and returns the value. *Return value:* a pointer to the value. May be NULL. Must be freed. -- Function: char * lw6sys_arg_get_value_with_env (int ARGC, char * [] ARGV, char * KEYWORD) ARGC: the number of arguments, as passed to `main' ARGV: an array of arguments, as passed to `main' KEYWORD: the keyword to match Parses all command-line arguments, searching for one precise "-key=value" pair, and returns the value. If a corresponding environment variable is available, but no command-line parameter was passed, the environment variable is intepreted. Such environment variables are uppercased, prefixed by "LW6_" and "_" replaces "-". The environment variable will be overriden if the command-line parameter is present. *Return value:* a pointer to the value. May be NULL. Must be freed. -- Function: lw6sys_assoc_t * lw6sys_assoc_new (lw6sys_free_func_t FREE_FUNC) FREE_FUNC: optional callback used to free memory when stored date is a pointer. Can be NULL when one stores non dynamically allocated data, such as an integer or a static array. Creates an empty assoc. There's a difference between NULL and an empty assoc. The empty assoc would (in Scheme) be '() whereas NULL corresponds to undefined "is not a assoc and will generate errors if you ever call assoc functions on it". Such created assoc are not performant hash tables but slowish "strcmp me for each key" associative arrays, the key being a "char *" string and the value a "void *" pointer. *Return value:* a pointer to the newly allocated associative array. Must be freed with `lw6sys_assoc_free'. -- Function: void lw6sys_assoc_free (lw6sys_assoc_t * ASSOC) ASSOC: the assoc to be freed. The function will cascade delete all elements, using (if not NULL...) the callback passed when first creating the assoc. *Return value:* void -- Function: int lw6sys_assoc_has_key (lw6sys_assoc_t * ASSOC, char * KEY) ASSOC: the assoc to test KEY: the key to search Not a very fast function, since on a "big" assoc, strcmp will be called internally until the key is found. *Return value:* non-zero if there's an entry with the corresponding key. -- Function: void * lw6sys_assoc_get (lw6sys_assoc_t * ASSOC, char * KEY) ASSOC: the assoc to query KEY: the key of which we want the value *Return value:* a void pointer to the data contained in the assoc. Note that the pointer on the actual data is returned, that is, if it's static data, you must not try to free it... As long as memory management is concerned, destroying the assoc will actually free the data if needed. -- Function: void lw6sys_assoc_set (lw6sys_assoc_t ** ASSOC, char * KEY, void * VALUE) ASSOC: the assoc to modify KEY: the key we want to updated VALUE: the new value Sets a value in an associative array. The key pointer need not be persistent, it can be freed after affectation. In fact a new string will be created internally. This is not true for the value, it's hard to find way to copy "any object". So if you want an associative array of strings, key can disappear after calling this function, but not value. The function passed as free_func when creating the assoc will be used to free stuff whenever needed (unset or free). *Return value:* void -- Function: void lw6sys_assoc_unset (lw6sys_assoc_t * ASSOC, char * KEY) ASSOC: the assoc concerned KEY: the key to unset Clears an entry in an associative array. The callback passed when creating the assoc will be called if needed, to free the data automatically. *Return value:* void -- Function: lw6sys_list_t * lw6sys_assoc_keys (lw6sys_assoc_t * ASSOC) ASSOC: the assoc to work on Returns a list containing all the keys of the assoc. The list must be free with lw6sys_list_free by the caller. This list copies all the keys of the assoc, so it is safe to use it once the assoc is deleted. However the keys will of course be of little interest in this case. But the program won't segfault. *Return value:* the list of keys. -- Function: void lw6sys_assoc_map (lw6sys_assoc_t * ASSOC, lw6sys_assoc_callback_func_t FUNC, void * FUNC_DATA) ASSOC: the assoc to work on FUNC: a callback to call on each entry FUNC_DATA: a pointer on some data which will be passed to the callback Executes a function on all assoc items. The func_data parameter allows you to pass extra values to the function, such as a file handler or any variable which can not be inferred from list item values, and you of course do not want to make global... *Return value:* void -- Function: void lw6sys_assoc_sort_and_map (lw6sys_assoc_t * ASSOC, lw6sys_assoc_callback_func_t FUNC, void * FUNC_DATA) ASSOC: the assoc to work on FUNC: a callback to call on each entry, may be NULL FUNC_DATA: a pointer on some data which will be passed to the callback Executes a function on all assoc items, like `lw6sys_assoc_sort_and_map' but befor doing so, sorts all entries in alphabetical order. *Return value:* void -- Function: lw6sys_assoc_t * lw6sys_assoc_dup (lw6sys_assoc_t * ASSOC, lw6sys_dup_func_t DUP_FUNC) ASSOC: the assoc to duplicate, can be NULL DUP_FUNC: the function which will be called to duplicate data Duplicates an assoc. All keys will be copied so that if the first assoc is deleted, the duplicated one is fine. Additionnaly, dup_func will be called with all data fields. If dup_func is NULL, then data values will simply be copied. This is likely to be usefull when data is not dynamically allocated. *Returned value:* a newly allocated assoc. -- Function: int lw6sys_default_memory_bazooka () Will set up a default memory bazooka, a slow yet convenient tool to track down and hopefully kill memory leaks. Named bazooka after a night wasted to track down an unfoundable leak... BAZOOOOOOKA!!! *Return value:* 1 if success, 0 if failed. -- Function: void lw6sys_clear_memory_bazooka () Clears the memory bazooka. *Return value:* none. -- Function: int lw6sys_set_memory_bazooka_size (int SIZE) SIZE: number of items (calls to malloc) to keep Resizes, the memory bazooka. What's this? It's an inelegant yet efficient tool to track down memory leak. Memory bazooka will keep track of every call to malloc, keeping a trace of what has been malloced, where it has been called (from which file, which line), how much memory was allocated, it will even show you what's at the address in a 0-terminated string-friendly fashion. Of course this slows down the program, so in production, you might set this to 0, but for debugging, a million bazooka is worth the megabytes and CPU cycles it wastes. *Return value:* 1 if success, 0 if failure. -- Function: int lw6sys_get_memory_bazooka_size () The companion of `lw6sys_set_memory_bazooka_size'. This function will return how many calls to malloc can be traced. A return value of 0 indicates that feature is disabled. *Return value:* size of the bazooka array. -- Function: int lw6sys_set_memory_bazooka_eraser (int STATE) STATE: the state of the eraser Sets the memory bazooka eraser state. Note that to really work, it requires the memory bazooka to be "big enough". *Return value:* 1 if activated, 0 if not. Note that the main reason for it not to be activated is if the memory bazooka has zero size. -- Function: int lw6sys_get_memory_bazooka_malloc_count () Provided you have always called the `LW6SYS_MALLOC' an `LW6SYS_CALLOC' to allocate memory, this function will tell you how many times `malloc' has been called. *Return value:* the number of calls to `lw6sys_malloc' or `lw6sys_calloc' since program was started. -- Function: int lw6sys_get_memory_bazooka_free_count () Provided you have always called the `LW6SYS_FREE' macro to free memory, this function will tell you how many times `free' has been called. *Return value:* the number of calls to `lw6sys_free' since program was started. -- Function: int lw6sys_get_memory_bazooka_malloc_max () Provided you have always called the `LW6SYS_MALLOC' an `LW6SYS_CALLOC' to allocate memory, this function will tell you the maximum of pointers returned by `malloc' that were present at the same time on the heap. *Return value:* the number of calls to `lw6sys_malloc' or `lw6sys_calloc' since program was started. -- Function: int lw6sys_is_memory_bazooka_trustable () Returns true if memory bazooka data are perfectly trustable, that is, it has never been resetted or resized. *Return value:* 1 if trustable, 0 if not. -- Function: int lw6sys_memory_bazooka_report () Reports memory bazooka diagnostics on the console. Carefull, this one is not reentrant, call at the end of your program when all threads are joined. *Return value:* 1 if no allocated stuff left, 0 if there are still malloc'ed stuff -- Function: char * lw6sys_build_get_package_tarname () Returns the name of the package. This is the `PACKAGE_TARNAME' constant defined by the GNU Autoconf ./configure script. While it's always possible to use the defined constant directly, using this function will return the value defined when compiling the binary, not the one you're using when compiling another program relying on Liquid War as a library. *Return value:* a non-NULL string "liquidwar6", must not be freed. -- Function: char * lw6sys_build_get_package_name () Returns the name of the package, in a user friendly form, which can include spaces, for instance. This is the `PACKAGE_NAME' constant defined by the GNU Autoconf ./configure script. While it's always possible to use the defined constant directly, using this function will return the value defined when compiling the binary, not the one you're using when compiling another program relying on Liquid War as a library. *Return value:* a non-NULL string "Liquid War 6", must not be freed. -- Function: char * lw6sys_build_get_package_string () Returns the description of the package. This is the `PACKAGE_STRING' constant defined by the GNU Autoconf ./configure script. It's the concatenation of `PACKAGE_NAME' and `VERSION'. While it's always possible to use the defined constant directly, using this function will return the value defined when compiling the binary, not the one you're using when compiling another program relying on Liquid War as a library. *Return value:* a non-NULL string "Liquid War 6 ", must not be freed. -- Function: char * lw6sys_build_get_version () Returns the version of the program. This is the `VERSION' constant defined by the GNU Autoconf ./configure script. Same as `PACKAGE_VERSION'. Note that while using a function to get `PACKAGE_TARNAME' might seem useless, having both ways to get the version, that is, a function and a constant, is very usefull. Think, for instance, that a dynamically loaded shared library might need to check its own version against the version of the core program. *Return value:* a non-NULL string, which must not be freed. -- Function: char * lw6sys_build_get_codename () Returns the the program codename. This is the little name of the version. It's been decided that all LW6 releases would take the name of a famous general, warrior, whatever. For instance, it could be "Napoleon". *Return value:* a non-NULL string, traditionnally the name of a famous general, someone which has been involved in war. Must not be freed (I mean, the string, not the general). -- Function: char * lw6sys_build_get_stamp () Returns the program stamp. This is like a serial number. It's is not the same as the version. The version is meant to be set to something readable. This is just a cryptic thing, incremented at each ./configure or each developper's "I feel like it needs to be incremented". The idea is just to keep (one more...) track of which source code is build. Ideally, this would be plugged to the source revision control system but this has some drawbacks, including that it would require it to modify files before commiting them, which is not safe, and almost impossible if you sign archives. One more point: this is a string. It's true the return value is actually a string containing the representation of an integer, but because all other build parameters are strings, and because we don't know what the future reserves, it's a string. *Return value:* a non-NULL string like "42", which must not be freed. -- Function: char * lw6sys_build_get_md5sum () Returns an md5 checkum which is caculated from C (.c and .h) source files. This is complementary with the build stamp. By default the stamp will be enough to check what has been compiled, but one can always imagine a case where Bob compiles something a little different than Alice, with the same stamp, incremented by 1 from a common source tree. They apply their own patches, for instance. This md5sum double-checks that two binaries have been built from the same sources. Note that this is not the md5 checksum of the generated binary. Nor does it include any information about scheme scripts and data. *Return value:* a non-NULL string, which must not be freed. -- Function: char * lw6sys_build_get_copyright () Returns a (very) short copyright information about the program. *Return value:* a non-NULL string, single line whithout '\n' at the end. Must not be freed. -- Function: char * lw6sys_build_get_license () Returns the license for the program (GNU GPL v3 or later). *Return value:* a non-NULL string, single line whithout '\n' at the end. Must not be freed. -- Function: char * lw6sys_build_get_configure_args () Returns the arguments passed to the GNU Autoconf ./configure script when buildling the game. Very usefull to know how the binary was generated, that is, what kind of optimizations are peculiar settings it uses. *Return value:* a non-NULL string, which, passed to ./configure again, would hopefully generate the same binary. Must not be freed. -- Function: char * lw6sys_build_get_gcc_version () Returns __VERSION__ GCC preprocessor value, that is, the human readable version of the compiler. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_cflags () Returns the arguments which would allow another program to use liquidwar6 as a library. Typically, pass this to gcc when compiling your sources. Basically contains "-I" switches which tell where the headers are. *Return value:* a non-NULL string, which must not be freed. -- Function: char * lw6sys_build_get_ldflags () Returns the arguments which would allow another program to link against liquidwar6. Pass this to gcc or libtool when compiling your program. Basically contains a "-L" option which says where the library is. Note that this will only allow you to link against the main libliquidwar6 library, but not the dynamically loaded modules. *Return value:* a non-NULL string, which must not be freed. -- Function: char * lw6sys_build_get_hostname () Returns the value return by the standard shell `hostname' command on the machine where the game has been built. Usefull to track binaries and know where do they come from. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_date () Returns the compilation date. While this information can easily be obtained with the C `__DATE__' macro, having this function is convenient for it returns a value which is the same for the whole program, and does not possibly change in every file. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_time () Returns the compilation date. While this information can easily be obtained with the C `__TIME__' macro, having this function is convenient for it returns a value which is the same for the whole program, and does not possibly change in every file. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_target_cpu () Returns the CPU this program is designed for. Convenient on i386 compatible CPUs to know which flavor (i386, i586...) the binary is made for. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_endianness () Returns the endianness of the computer. *Return value:* 'little' (x86-like) or 'big' (ppc-like), as a string. Must not be freed. -- Function: int lw6sys_build_get_pointer_size () Returns the system pointer size, in bytes. *Return value:* 4 for 32-bit, 8 for 64-bit. -- Function: int lw6sys_build_is_x86 () Tells wether CPU belongs to x86 family or not. *Return value:* 1 if x86, 0 if not -- Function: char * lw6sys_build_get_target_os () Returns the OS this program is designed for. Usefull for bug reports. *Return value:* a non-NULL string, must not be freed. -- Function: int lw6sys_build_is_ms_windows () Tells wether the program was compiled for Microsoft Windows, or not. *Return value:* 1 if compiled on windows, 0 if not -- Function: int lw6sys_build_is_mac_os_x () Tells wether the program was compiled for Mac OS X, or not. *Return value:* 1 if compiled on OS X, 0 if not -- Function: char * lw6sys_build_get_top_srcdir () Returns the top source directory, when the game was built. This can seem useless and non relevant on the end-user's machine, but... it's a must-have for developpers and packagers. Without this, binaries would never find their associated data, especially when building outside the source tree. Or, testing the game would be impossible without installing it, given the fact that most of the code is in scripts that are stored in /usr/local by default, this would be painfull. So this function is here to help finding data within the source tree when the game is not installed yet. Note that the function is rather clever, since it will automatically try to remove useless '../' sequences at the beginning of a possibly relative path. *Return value:* a non-NULL string, must not be freed. -- Function: char * lw6sys_build_get_prefix () Returns the `prefix' value as given to the GNU Autoconf ./configure script. Used to deduce the path to other directories and files. *Return value:* a non-NULL string, "/usr/local" by default. Must not be freed. -- Function: char * lw6sys_build_get_datadir () Returns the `datadir' value defined by the GNU Autoconf ./configure script. This is not the value which can be overriden by the Liquid War 6 specific. "-data-dir" option. `datadir' is usually something like "/usr/local/share" while the actual Liquid War 6 defined data dir is a more profound path which includes the name of the package, its version, and so on. *Return value:* a non-NULL string, "/usr/local/share" by default. Must not be freed. -- Function: char * lw6sys_build_get_libdir () Returns the `libdir' value defined by the GNU Autoconf ./configure script. This is not the value which can be overriden by the Liquid War 6 specific. "-mod-dir" option. `datadir' is usually something like "/usr/local/lib" while the actual Liquid War 6 defined module dir is a more profound path which includes the name of the package, its version, and so on. *Return value:* a non-NULL string, "/usr/local/lib" by default. Must not be freed. -- Function: char * lw6sys_build_get_includedir () Returns the `includedir' value defined by the GNU Autoconf ./configure script. As for other options, it's interesting to have this value, this enables the program to inform people who want to hack the game of the place headers are supposed to be installed. *Return value:* a non-NULL string, "/usr/local/include" by default. Must not be freed. -- Function: char * lw6sys_build_get_localedir () Returns the `localedir' value defined by the GNU Autoconf ./configure script. Used as an argument for gettext / libintl functions. *Return value:* a non-NULL string, "/usr/local/share/locale" by default. Must not be freed. -- Function: char * lw6sys_build_get_docdir () Returns the `docdir' value defined by the GNU Autoconf ./configure script. Used to write consistent XML file headers. *Return value:* a non-NULL string, "/usr/local/share/doc/liquidwar6" by default. Must not be freed. -- Function: char * lw6sys_build_get_enable_console () Tells wether console is enabled or not. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_mod_gl () Tells wether the graphical mod-gl backend was compiled. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_mod_csound () Tells wether the audio mod-csound backend was compiled. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_mod_ogg () Tells wether the audio mod-ogg backend was compiled. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_mod_http () Tells wether the network mod-http backend was compiled. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_optimize () Tells wether the game was compiled in optimize mode. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_allinone () Tells wether the game was compiled in allinone mode. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_fullstatic () Tells wether the game was compiled in fullstatic mode. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_paranoid () Tells wether the game was compiled with paranoid memory management. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_gprof () Tells wether the game was compiled with suitable informations for gprof. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_instrument () Tells wether the game was compiled with the '-finstrument-fonctions' GCC flag. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_profiler () Tells wether the game was compiled for later use with Google Profiler support. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_gcov () Tells wether the game was compiled with suitable informations for gcov. *Return value:* "yes" or "no", must no be freed. -- Function: char * lw6sys_build_get_enable_valgrind () Tells wether the game was compiled for later use with valgrind. *Return value:* "yes" or "no", must no be freed. -- Function: void lw6sys_build_log_all () Dumps in the log file the whole program pedigree, target, modules, that is, what are the values of all the build options. Usefull for bug reports. *Return value:* none. -- Function: u_int32_t lw6sys_checksum (unsigned char * DATA, int LEN) DATA: the data to process LEN: the length, in bytes, of the data to process Creates a checksum from a byte array. This could be mapped on any standard CRC-32 and/or MD5 algorithm, but licence issues for those are such a headache that for the sake of simplicity, it's wrapped here. In LW6 context, we do not really really fear any attack for these checksums are used internally to track bugs and check, for instance, that two game states are actually the same on two distant computers in a network game. Data encryption and security of network links is another debate. Additionnally, this function returns an integer, easier to handle in standard C than any malloc'ed stuff. *Return value:* the checksum, as an integer. -- Function: u_int32_t lw6sys_checksum_str (char * VALUE) VALUE: the string to process Creates a checksum from a string. This is a convenience function to save the programmer the hassle of calling strlen before any checksum calculation. *Return value:* the checksum, as an integer. -- Function: u_int32_t lw6sys_checksum_int32 (u_int32_t VALUE) VALUE: the integer to process Creates a checksum from an integer. This is a convenience function to save the programmer the hassle of passing a pointer to the integer with the size of it each time there's a checksum to do. Additionnally, with this one you can pass an int8 or an int16, and function will work just the same indenpendantly of endianness. *Return value:* the checksum, as an integer. -- Function: u_int32_t lw6sys_checksum_int64 (u_int64_t VALUE) VALUE: the integer to process Creates a checksum from an integer. This is a convenience function to save the programmer the hassle of passing a pointer to the integer with the size of it each time there's a checksum to do. This function handles 64-bit long long integers.. *Return value:* the checksum, as an integer. -- Function: u_int32_t lw6sys_checksum_whd (lw6sys_whd_t * WHD) WHD: a pointer to the wh struct to be processed Creates a checksum from the given structure. Convenience function to save the hassle of passing a pointer to and the size of the `lw6sys_wh_t' struct each time, knowing that there are very often checksums calculated on it. Also avoids endianess issues. *Return value:* the checksum, as an integer. -- Function: u_int32_t lw6sys_checksum_xyz (lw6sys_xyz_t * XYZ) XYZ: a pointer to the xy struct to be processed Creates a checksum from the given structure. Convenience function to save the hassle of passing a pointer to and the size of the `lw6sys_xy_t' struct each time, knowing that there are very often checksums calculated on it. Also avoids endianess issues. *Return value:* the checksum, as an integer. -- Function: void lw6sys_checksum_update (u_int32_t * CHECKSUM, unsigned char * DATA, int LEN) CHECKSUM: a pointer to the previous checksum DATA: the data to process LEN: the length, in bytes, of the data to process Creates a checksum from the given data. The difference with `lw6sys_checksum' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: void lw6sys_checksum_update_str (u_int32_t * CHECKSUM, char * VALUE) CHECKSUM: a pointer to the previous checksum VALUE: the string to process Creates a checksum from the given string. The difference with `lw6sys_checksum_str' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: void lw6sys_checksum_update_int32 (u_int32_t * CHECKSUM, int32_t VALUE) CHECKSUM: a pointer to the previous checksum VALUE: the integer to process Creates a checksum from the given integer. The difference with `lw6sys_checksum_int32' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: void lw6sys_checksum_update_int64 (u_int32_t * CHECKSUM, int64_t VALUE) CHECKSUM: a pointer to the previous checksum VALUE: the integer to process Creates a checksum from the given integer. The difference with `lw6sys_checksum_int64' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: void lw6sys_checksum_update_whd (u_int32_t * CHECKSUM, lw6sys_whd_t * WHD) CHECKSUM: a pointer to the previous checksum WHD: a pointer to the wh struct to be processed Creates a checksum from the given structure. The difference with `lw6sys_checksum_whd' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: void lw6sys_checksum_update_xyz (u_int32_t * CHECKSUM, lw6sys_xyz_t * XYZ) CHECKSUM: a pointer to the previous checksum XYZ: a pointer to the xy struct to be processed Creates a checksum from the given structure. The difference with `lw6sys_checksum_xyz' is that this one updates an existing checksum, thus enabling the programmer to call it sequentially and get a global checksum on different sources. *Return value:* none. -- Function: u_int8_t lw6sys_color_float2char (float F) F: the value to convert, from 0.0f to 1.0f Converts a floating point value between 0.0f and 1.0f to its 8-bit equivalent between 0 and 255. Usefull in color conversion. *Return value:* an integer between 0 and 255. -- Function: float lw6sys_color_char2float (u_int8_t I) I: the value to convert, from 0 to 255 Converts an 8-bit value between 0 and 255 to its floating-point equivalent between 0.0f and 1.0f. Usefull in color conversion. *Return value:* a float between 0.0f and 1.0f. -- Function: lw6sys_color_8_t lw6sys_color_f_to_8 (lw6sys_color_f_t * COLOR_F) COLOR_F: the color to convert Converts a color from floating point format to the integer "0 to 255" common format. All fields (RGBA) are converted. *Return value:* the color in 8-bit format. -- Function: void lw6sys_color_8_to_f (lw6sys_color_f_t * COLOR_F, lw6sys_color_8_t COLOR_8) COLOR_F: the converted color (pointer must point to writable memory) COLOR_8: the color to convert Converts a color from the integer "0 to 255" common format to floating point format. All fields (RGBA) are converted. *Return value:* none. -- Function: u_int32_t lw6sys_color_f_to_i (lw6sys_color_f_t * COLOR_F) COLOR_F: the color to convert Converts a color from floating point format to a single integer, where all fields (RGBA) are serialized. This serialization is endianess independant. Could be used directly by low-level libraries such as SDL. *Return value:* the color serialized in an integer. -- Function: u_int32_t lw6sys_color_8_to_i (lw6sys_color_8_t COLOR_8) COLOR_8: the color to convert Converts a color from common "0 to 255" structured format to a single integer, where all fields (RGBA) are serialized. This serialization is endianess independant. Could be used directly by low-level libraries such as SDL. *Return value:* the color serialized in an integer. -- Function: void lw6sys_color_i_to_f (lw6sys_color_f_t * COLOR_F, u_int32_t COLOR_I) COLOR_F: the converted color (point must point to writable memory) COLOR_I: the color to convert Converts a color from a serialized integer format to a floating point structure. *Return value:* none. -- Function: lw6sys_color_8_t lw6sys_color_i_to_8 (u_int32_t COLOR_I) COLOR_I: the color to convert Converts a color from a serialized integer format to a "0 to 255" based structure. *Return value:* the converted color (structure). -- Function: lw6sys_color_8_t lw6sys_color_a_to_8 (char * ASCII) ASCII: the color to convert Converts a color from a human readable string to a "0 to 255" based structure. The string must be of the form "#RRGGBBAA" or "#RGB", in a general manner any HTML-valid value should work. *Return value:* the converted color (structure). -- Function: void lw6sys_color_a_to_f (lw6sys_color_f_t * COLOR_F, char * ASCII) COLOR_F: the converted color (pointer must point to writable memory) ASCII: the color to convert Converts a color from a human readable string to a float based structure. The string must be of the form "#RRGGBBAA" or "#RGB", in a general manner any HTML-valid value should work. *Return value:* none. -- Function: char * lw6sys_color_8_to_a (lw6sys_color_8_t COLOR_8) COLOR_8: the color to convert Converts a color from a "0 - 255" integer based structure to its readable form "#RRGGBBAA". If alpha is 255 (0xFF), that is, if it's opaque, then the "AA" part is ommitted. *Return value:* a newly allocated string. -- Function: void lw6sys_color_rgb_to_hsv (lw6sys_color_hsv_t * COLOR_HSV, lw6sys_color_8_t COLOR_8) COLOR_HSV: the target color, in HSV format COLOR_8: the source color, in RGB 256 format Converts from HSV to RGB. Usefull for color manipulation, since most colors are stored in RGB but HSV is convenient for transformation. Alpha layer is kept as is. *Return value:* none. -- Function: lw6sys_color_8_t lw6sys_color_hsv_to_rgb (lw6sys_color_hsv_t * COLOR_HSV) COLOR_HSV: the source color, in HSV format Converts from RGB to HSV. Usefull to make colors transformed in HSV format usable again by all display routines, which consume RGB. Alpha layer is kept as is. *Return value:* the RGB color. -- Function: lw6sys_color_8_t lw6sys_color_average (int SIZE, lw6sys_color_8_t * COLORS) SIZE: number of the color array (number of items) COLORS: the colors to compute Tries to find out the "average" color from an array of colors. The algorithm is far from perfect, but should output a color which reflects the colors passed in. *Return value:* the (inexact) average color. -- Function: lw6sys_color_8_t lw6sys_color_ponderate (lw6sys_color_8_t COLOR1, lw6sys_color_8_t COLOR2, float COEFF) COLOR1: first color COLOR2: second color COEFF: the ponderation coefficient Tries to find a color between the two colors passed as an argument. The coefficient can be used, to set the relative weight of each color. Using 0 will return color1, 1 will return color2 and 0.5 will make an average between the two colors. Any value between 0 and 1 can be used. *Return value:* the (inexact) ponderated color. -- Function: float lw6sys_color_distance (lw6sys_color_8_t COLOR1, lw6sys_color_8_t COLOR2) COLOR1: first color COLOR2: second color Calculates the distance between two colors. The unit is arbitrary, a big value means "colors are different", 0 means they are the same. A distance of 1 corresponds to colors which have barely anything in common, but the result can still be greater than 1. Alpha layer is not taken in account. *Return value:* the distance. -- Function: int lw6sys_color_is_same (lw6sys_color_8_t COLOR1, lw6sys_color_8_t COLOR2) COLOR1: the first color to compare COLOR2: the second color to compare Compares two colors. *Return value:* 1 if they are the same, 0 if not. -- Function: void lw6sys_color_8_solid (lw6sys_color_8_t * COLOR) color: the color to modify Make a color "solid" that is make it not transparent at all. *Return value:* none. -- Function: void lw6sys_color_f_solid (lw6sys_color_f_t * COLOR) color: the color to modify Make a color "solid" that is make it not transparent at all. *Return value:* none. -- Function: int lw6sys_atoi (char * STR) STR: string to convert Just a plain wrapper on `atoi', it's here for API consistency. *Return value:* an integer. -- Function: int lw6sys_atob (char * STR) STR: string to convert Transform a string into a boolean value. Accepts "0"/"1" in input, but also y/n, yes/no, true/false, on/off. *Return value:* an integer, 0 or 1. -- Function: float lw6sys_atof (char * STR) STR: string to convert A wrapper on `atof', makes sure the locale used is C (default) and won't change the decimal separator whatsoever. Usefull for serialization for instance. *Return value:* a float. -- Function: char * lw6sys_itoa (int VALUE) VALUE: the integer to convert Converts an integer to a string, the advantage of this function is it allocates memory, and does the dirty job. *Return value:* a newly allocated pointer, must be freed, may be NULL. -- Function: char * lw6sys_btoa (int VALUE) VALUE: the boolean to convert Converts a boolean to a string, the advantage of this function is it allocates memory, and does the dirty job. *Return value:* a newly allocated pointer, must be freed, may be NULL. -- Function: char * lw6sys_ftoa (float VALUE) VALUE: the float to convert Converts a float to a string, the advantage of this function is it allocates memory, and does the dirty job. *Return value:* a newly allocated pointer, must be freed, may be NULL. -- Function: int lw6sys_debug_get () Gets the debug mode. -- Function: void lw6sys_debug_set (int MODE) MODE: the debug mode, 1 if set, 0 if not. Sets the debug mode. -- Function: void lw6sys_dump_clear (char * USER_DIR) USER_DIR: the user directory, where user can write data. Clears the dump file. That is, resets it to a "0 byte" file. *Return value:* none. -- Function: int lw6sys_dump (char * USER_DIR, char * CONTENT) USER_DIR: the user directory, where user can write data. CONTENT: the content to be written in the dump file. Writes the dump file onto the disk. The dump is used for special error messages which do not really fit in the standard log, and require a special treatment. In pratice, it's used to log fatal script (Guile) errors. *Return value:* 1 if success, 0 if failure. -- Function: char lw6sys_env_separator_char () Gets the ENV separator, that is, for instance, the character used to separate paths in environment variables. Typically, this would be ":" on GNU and ";" on Microsft platforms. *Return value:* the ascii character code. -- Function: char * lw6sys_env_separator_str () Gets the ENV separator, that is, for instance, the character used to separate paths in environment variables. Typically, this would be ":" on GNU and ";" on Microsft platforms. *Return value:* a pointer to a single 0-terminated character string which contains the character. Must not be freed. -- Function: char * lw6sys_env_concat (char * VALUE1, char * VALUE2) VALUE1: the left part to be concatenated VALUE2: the right part to be concatenated Concatenates two values and puts the ENV separator, as returned by `lw6sys_env_separator_char' between them. *Return value:* the concatenated string, must be freed. -- Function: int lw6sys_env_exists (char * KEYWORD) KEYWORD: the keyword to be searched in the environment variables. Searches environment variables for the given keyword. The keyword will be fixed so that all dashes "-" characters are replaced by underscores "_" characters. Characters will be changed to uppercase. Any non alphanumeric character will be replaced by "_". Finally, an "LW6_" prefix will be added. That is to say, calling this function with "my-param" will search for the "LW6_MY_PARAM" environment variable. *Return value:* 1 if the environment variable exists, 0 if not. -- Function: char * lw6sys_getenv (char * KEYWORD) KEYWORD: the keyword to be searched in the environment variables. Searches environment variables for the given value. The keyword will be fixed so that all dashes "-" characters are replaced by underscores "_" characters. Characters will be changed to uppercase. Any non alphanumeric character will be replaced by "_". Finally, an "LW6_" prefix will be added. That is to say, calling this function with "my-param" will search for the "LW6_MY_PARAM" environment variable. *Return value:* the value for the given keyword. May be NULL. Must be freed. -- Function: int lw6sys_setenv (char * KEYWORD, char * VALUE) KEYWORD: the environment variable to set VALUE: the value of the environment variable to set Sets the environment variable to a given value. If value is NULL, variable is unset. Note that unlike lw6sys_getenv, this function does not transform the keyword into "LW6_..." before setting the value, so it's your responsability to call "lw6sys_keyword_as_env" if needed. *Return value:* 1 if success, 0 if failed -- Function: lw6sys_list_t * lw6sys_env_split (char * VALUE) VALUE: the value, a list of item separated by... the separator Splits the environment value into a list of strings containing each element. All strings are dynamically allocated, but they will be freed automatically when the list is freed. *Return value:* a list of strings. -- Function: char * lw6sys_get_home () Gets the home directory of the user. Used internally to calculate the `user'-dir value. Note that Liquid War 6, by default, never stores files under '$HOME', instead it put things in '$HOME/.liquidwar6', that is 'user-dir'. If the environment variable 'HOME' is not set, will return '.'. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_get_username () Gets the name of the current user. Difference with the standard function `getlogin' is that this function will returned a dynamically allocated pointer, and provide a default value if it's undefined. Also, if will look at the content of the 'LOGNAME' environment variable if needed, and will even provide a default value. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_get_hostname () Gets the name of the current host. The name of the computer. Might not work perfectly, this function is just used to provide default values for player names and such things. *Return value:* a newly allocated pointer, must be freed. -- Function: int lw6sys_clear_file (char * FILENAME) FILENAME: absolute or relative filename Clears a file, that is, make it a 0 byte file, empty, ready to be filled if needed. If this function is called successfully, program can reasonnably assume file will be writable during its execution. *Return value:* 1 if success, 0 if failure. -- Function: char * lw6sys_read_file_content (char * FILENAME) FILENAME: absolute or relative filename Reads the content of a file, and returns it as a string. Note that content might or might not be ascii or binary, the function will however put a tailing 0 character at the end so that low-level standard C functions do not segfault when used with the returned value. *Return value:* a newly allocated pointer, must be freed. -- Function: int lw6sys_write_file_content (char * FILENAME, char * CONTENT) FILENAME: absolute or relative filename CONTENT: the content to be written. Writes the content into the file. Content is assumed to be a string, function will segfault if it's not correctly 0 terminated as in C string convention. So this function will not allow you to write down arbitrary binary data, however LW6 uses mostly text files to store information, and opaque binary data usage is not recommended. -- Function: lw6sys_hash_t * lw6sys_hash_new (lw6sys_free_func_t FREE_FUNC, int SIZE) FREE_FUNC: optional callback used to free memory when stored date is a pointer. Can be NULL when one stores non dynamically allocated data, such as an integer or a static array. SIZE: the estimated size of the hash table. Note that this is an estimation only. You could theorically fit 1000000 objects in a 3-sized hash. Problem -> this is inefficient, you'd better use an assoc or a bigger hash. If you store 3 elements in a 1000000-sized hash, you'll waste memory. It might be wise to use a prime number as the estimated size. 421 is prime ;) Creates an empty hash. There's a difference between NULL and an empty hash. *Return value:* a pointer to the newly allocated hash table. Must be freed with `lw6sys_hash_free'. -- Function: void lw6sys_hash_free (lw6sys_hash_t * HASH) HASH: the hash to be freed. The function will cascade delete all elements, using (if not NULL...) the callback passed when first creating the hash. *Return value:* void -- Function: int lw6sys_hash_has_key (lw6sys_hash_t * HASH, char * KEY) HASH: the hash to test KEY: the key to search Not a very fast function, since on a "big" hash, strcmp will be called internally until the key is found. *Return value:* non-zero if there's an entry with the corresponding key. -- Function: void * lw6sys_hash_get (lw6sys_hash_t * HASH, char * KEY) HASH: the hash to query KEY: the key of which we want the value *Return value:* a void pointer to the data contained in the hash. Note that the pointer on the actual data is returned, that is, if it's static data, you must not try to free it... As long as memory management is concerned, destroying the hash will actually free the data if needed. -- Function: void lw6sys_hash_set (lw6sys_hash_t * HASH, char * KEY, void * VALUE) HASH: the hash to modify KEY: the key we want to updated VALUE: the new value Sets a value in a hash table. The key pointer need not be persistent, it can be freed after affectation. In fact a new string will be created internally. This is not true for the value, it's hard to find way to copy "any object". So if you want a hash table of strings, key can disappear after calling this function, but not value. The function passed as free_func when creating the hash will be used to free stuff whenever needed (unset or free). *Return value:* void -- Function: void lw6sys_hash_unset (lw6sys_hash_t * HASH, char * KEY) HASH: the hash concerned KEY: the key to unset Clears an entry in a hash table. The callback passed when creating the hash will be called if needed, to free the data automatically. *Return value:* void -- Function: lw6sys_list_t * lw6sys_hash_keys (lw6sys_hash_t * HASH) HASH: the hash to work on Returns a list containing all the keys of the hash. The list must be free with lw6sys_list_free by the caller. This list copies all the keys of the hash, so it is safe to use it once the hash is deleted. However the keys will of course be of little interest in this case. But the program won't segfault. *Return value:* the list of keys. -- Function: void lw6sys_hash_map (lw6sys_hash_t * HASH, lw6sys_assoc_callback_func_t FUNC, void * FUNC_DATA) HASH: the hash to work on FUNC: a callback to call on each entry FUNC_DATA: a pointer on some data which will be passed to the callback Executes a function on all hash items. The func_data parameter allows you to pass extra values to the function, such as a file handler or any variable which can not be inferred from list item values, and you of course do not want to make global... *Return value:* void -- Function: void lw6sys_hash_sort_and_map (lw6sys_hash_t * HASH, lw6sys_assoc_callback_func_t FUNC, void * FUNC_DATA) HASH: the hash to work on FUNC: a callback to call on each entry, may be NULL FUNC_DATA: a pointer on some data which will be passed to the callback Executes a function on all hash items, like `lw6sys_hash_sort_and_map' but befor doing so, sorts all entries in alphabetical order. *Return value:* void -- Function: lw6sys_hash_t * lw6sys_hash_dup (lw6sys_hash_t * HASH, lw6sys_dup_func_t DUP_FUNC) HASH: the hash to duplicate, can be NULL DUP_FUNC: the function which will be called to duplicate data Duplicates an hash. All keys will be copied so that if the first hash is deleted, the duplicated one is fine. Additionnaly, dup_func will be called with all data fields. If dup_func is NULL, then data values will simply be copied. This is likely to be usefull when data is not dynamically allocated. *Returned value:* a newly allocated hash. -- Function: lw6sys_hexa_serializer_t * lw6sys_hexa_serializer_new (char * HEXA_STRING) HEXA_STRING: an initialization string, can be NULL. Creates an hexa serializer object. It can be initialized or not, if an initialization string is provided it must of course be valid hexadecimal ascii code, and all serialized content will simply be appended to it. *Return value:* a newly allocated object. -- Function: void lw6sys_hexa_serializer_free (lw6sys_hexa_serializer_t * HEXA_SERIALIZER) HEXA_SERIALIZER: an hexa serializer object Frees an hexa serializer object. *Return value:* none. -- Function: void lw6sys_hexa_serializer_rewind (lw6sys_hexa_serializer_t * HEXA_SERIALIZER) HEXA_SERIALIZER: an hexa serializer object Rewinds the serializer pointer, that is, make it point to start. Usefull before calling pop functions, when one wants to be sure to get the first object. *Return value:* none. -- Function: int lw6sys_hexa_serializer_eof (lw6sys_hexa_serializer_t * HEXA_SERIALIZER) HEXA_SERIALIZER: an hexa serializer object Tests wether we're at EOF. Usefull when one wants to know if there's still some data or if all objects have been correctly popped. *Return value:* 1 if at end of file, 0 if not. -- Function: char * lw6sys_hexa_serializer_as_string (lw6sys_hexa_serializer_t * HEXA_SERIALIZER) HEXA_SERIALIZER: an hexa serializer object Exports the current content of the serializer as a string. String can then safely be sent on the network, for instance. String is copied from internal value, so it's safe to use it after serializer has been freed or modified. *Return value:* a newly allocated string, must be freed. -- Function: int lw6sys_hexa_serializer_push_int64 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int64_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a 64 bit integer in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_int32 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int32_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a 32 bit integer in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_int16 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int16_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a 16 bit integer in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_int8 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int8_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes an 8 bit integer in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_float (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, float VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a floating point value in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_str (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, char * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a string in the serializer object. Note that the string is not directly copied in the serializer, instead all its characters are converted to their ASCII equivalent, then appended. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_xyz (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_xyz_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a lw6sys_xyz_t structure in the serializer object. Calling this avoids calling push for 2 integers separately. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_whd (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_whd_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a lw6sys_whd_t structure in the serializer object. Calling this avoids calling push for 2 integers separately. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_push_color (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_color_8_t VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to push Pushes a color structure in the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_int64 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int64_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a 64 bit integer from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_int32 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int32_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a 32 bit integer from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_int16 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int16_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a 16 bit integer from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_int8 (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, int8_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops an 8 bit integer from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_float (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, float * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a floating point value from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_str (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, char ** VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a string from the serializer object. The returned value is a newly allocated pointer, which must be freed, you don't need to provide a buffer, just a valid pointer on a NULL pointer. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_xyz (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_xyz_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a lw6sys_xyz_t structure from the serializer object. Avoids calling two integer pops. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_whd (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_whd_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a lw6sys_whd_t structure from the serializer object. Avoids calling two integer pops. *Return value:* 1 if success, 0 if failure -- Function: int lw6sys_hexa_serializer_pop_color (lw6sys_hexa_serializer_t * HEXA_SERIALIZER, lw6sys_color_8_t * VALUE) HEXA_SERIALIZER: an hexa serializer object VALUE: value to pop (returned value) Pops a color from the serializer object. *Return value:* 1 if success, 0 if failure -- Function: void lw6sys_history_init () Initializes the history system. Not initializing won't cause any segfault, but data will be inconsistent. *Return value:* none. -- Function: void lw6sys_history_register (char * MSG) MSG: the message to register. Registers a message in the history log, that is, adds it. *Return value:* none. -- Function: char_ptr_t * lw6sys_history_get (int64_t TIMEOUT) TIMEOUT: the message age limit. Get all the messages that are younger than timeout (in seconds). *Return value:* a pointer on string pointers. May be NULL. Last pointer is NULL too, that's how you know the array is over. -- Function: void lw6sys_history_free (char ** HISTORY) HISTORY: the data to free Frees a pointer returned by `lw6sys_history_get'. *Return value:* none. -- Function: char * lw6sys_locale_to_utf8 (char * STRING) STRING: the string to convert Used to force strings into UTF-8 mode, this is basically to match the TTF font settings used when displaying stuff on OpenGL. Indeed, in this case, the standard _ gettext function won't work, we need to force UTF-8 mode. If the locale is UTF-8, then function does nothing, but at least it's transparent usage won't hurt. *Returned value:* a newly allocated string, always in UTF-8 no matter what the locale is. -- Function: u_int16_t lw6sys_generate_id_16 () Long 16-bit ID generator, calls the random function internally. As usual, those are not perfect random numbers, however the function implementation emphasizes more on 'real randomness' rather than relying on performance. Generating twice the same number should be fairly rare. -- Function: u_int32_t lw6sys_generate_id_32 () Long 32-bit ID generator, calls the random function internally. As usual, those are not perfect random numbers, however the function implementation emphasizes more on 'real randomness' rather than relying on performance. Generating twice the same number should be fairly rare. -- Function: u_int64_t lw6sys_generate_id_64 () Long 64-bit ID generator, calls the random function internally. As usual, those are not perfect random numbers, however the function implementation emphasizes more on 'real randomness' rather than relying on performance. Generating twice the same number should be fairly rare. -- Function: int lw6sys_check_id_16 (u_int16_t ID_16) ID_16: the id to check Checks wether the given id is a valid 16-bit id. *Return value:* 1 if OK, 0 if not a valid id. -- Function: int lw6sys_check_id_32 (u_int32_t ID_32) ID_32: the id to check Checks wether the given id is a valid 32-bit id. *Return value:* 1 if OK, 0 if not a valid id. -- Function: int lw6sys_check_id_64 (u_int64_t ID_64) ID_64: the id to check Checks wether the given id is a valid 64-bit id. *Return value:* 1 if OK, 0 if not a valid id. -- Function: int lw6sys_check_id (u_int64_t ID) ID: the id to check Checks wether the given id is a valid id (16, 32 or 64-bit). *Return value:* 1 if OK, 0 if not a valid id. -- Function: char * lw6sys_id_ltoa (u_int64_t ID) id: the id to convert Transform an id into its string representation. Error checking is done, if the id is invalid, returned value is NULL. All ids (16, 32 and 64-bit) are handled. *Return value:* a newly allocated string, might be NULL. -- Function: u_int64_t lw6sys_id_atol (char * ID) id: the id to convert Transform an id into a long integer. Error checking is done, if the id is invalid, returned value is 0. All ids (16, 32 and 64-bit) are handled. *Return value:* the id as a long integer, 0 if incorrect source id. -- Function: char * lw6sys_keyword_as_key (char * KEYWORD) KEYWORD: the keyword to transform Transforms a keyword into a "key", that is, removes all heading dashes, switches to lowercase, and other stuff. This is used internally to match options and config file parameters, for instance. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_keyword_as_arg (char * KEYWORD) KEYWORD: the keyword to transform Transforms a keyword into a command-line parameter to be matched. Does the same as `lw6sys_keyword_as_key', and adds a "-" prefix. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_keyword_as_env (char * KEYWORD) KEYWORD: the keyword to transform Transforms a keyword into the corresponding environment variable name. It will uppercase the name, replace "-" by "_", and add a "LW6_" prefix. "my-param" will become "LW6_MY_PARAM". *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_keyword_as_xml (char * KEYWORD) KEYWORD: the keyword to transform Transforms a keyword into the corresponding config file entry. In practice, just the same as `lw6sys_keyword_as_key'. *Return value:* a newly allocated pointer, must be freed. -- Function: lw6sys_list_t * lw6sys_list_new (lw6sys_free_func_t FREE_FUNC) FREE_FUNC: a callback which will be called on data when freeing the list Creates an empty list. There's a difference between NULL and an empty list. The empty list would (in Scheme) be '() whereas NULL corresponds to undefined "is not a list and will generate errors if you ever call list functions on it". *Return value:* a pointer to the created object, may be NULL. -- Function: void lw6sys_list_free (lw6sys_list_t * LIST) LIST: the list to delete. Delete a list, this will cascade delete all the following items in the list. *Return value:* none. -- Function: lw6sys_list_t * lw6sys_list_next (lw6sys_list_t * LIST) LIST: the current position in the list It's safer to call this rather than dig right into the internals of the list. *Return value:* a new position in the list, may be NULL. -- Function: int lw6sys_list_is_empty (lw6sys_list_t * LIST) LIST: the list we want informations about Checks wether the list is empty or not. Note that being empty and being NULL is not the same. An empty list is a valid pointer on a list where there's no item, a NULL pointer is not a list at all. Do *NOT* call this function on NULL. *Return value:* 1 if empty, 0 if there is at list one item. -- Function: int lw6sys_list_length (lw6sys_list_t * LIST) LIST: the list we want informations about Calculates the length of the list. This is a performance killer for lists are inadapted to this. But it can still be usefull. *Return value:* the number of elements, 0 is none (empty list). -- Function: void lw6sys_list_map (lw6sys_list_t * LIST, lw6sys_list_callback_func_t FUNC, void * FUNC_DATA) LIST: the list where elements will be taken FUNC: the function which will be executed FUNC_DATA: additionnal data to be passed to `func' Executes a function on all list items. The `func_data' parameter allows you to pass extra values to the function, such as a file handler or any variable which can not be inferred from list item values, and you of course do not want to make global... Not as convenient as a real "for each" construct as can be found in any modern langage, but does the job. No return value, if you really want one, pass a structure in `func_data' and modify something in it on success, failure, whatever. *Return value:* none. -- Function: void lw6sys_list_push_front (lw6sys_list_t ** LIST, void * DATA) LIST: a pointer to the list (pointer on pointer, read/write value) DATA: the data to be pushed Pushes data on the list. The `free_func' function is copied from the previous element. The pointer on the list is changed "in place" (in/out). Note that if there's a `malloc' problem it might end-up being NULL... This should be rare but it *can* happen. You cannot push something else than a pointer, pushing an int is a very bad idea. Push a pointer on the integer, and ensure it's always there, or `malloc' it and pass `lw6sys_free_callback' when creating the list. If you think you can cast an integer into a pointer, think 64-bit machines... *Return value:* none. -- Function: void * lw6sys_list_pop_front (lw6sys_list_t ** LIST) LIST: a pointer to the list (pointer on pointer, read/write value) Pops data from the list, the returned value is what was passed to list_push. The pointer on the list is changed "in place" (in/out). When data is popped, that needs some freeing (i.e. free_func was not NULL when creating the list) then it's the responsibility of the caller to free it when popping it. One popped it's not freed, but it's out of the list scope. Of course the lw6sys_list_t is freed, but not the data. If you happen to store non-NULL data in your list, you can call this function without bothering calling `lw6sys_list_is_empty' and assume that when you get NULL, there's no data left. At this stage, the list won't exist anymore BTW, you won't even need to free it. The idea is: popping a list which has no elements left (empty list) destroys the list and returns NULL. *Return value:* a pointer on the popped data, whatever you pushed. -- Function: void lw6sys_list_push_back (lw6sys_list_t ** LIST, void * DATA) LIST: a pointer to the list (pointer on pointer, read/write value) DATA: the data to be pushed Pushes data on the list. The `free_func' function is copied from the previous element. The pointer on the list is changed "in place" (in/out). Note that if there's a `malloc' problem it might end-up being NULL... This should be rare but it *can* happen. You cannot push something else than a pointer, pushing an int is a very bad idea. Push a pointer on the integer, and ensure it's always there, or `malloc' it and pass `lw6sys_free_callback' when creating the list. If you think you can cast an integer into a pointer, think 64-bit machines... *Return value:* none. -- Function: void * lw6sys_list_pop_back (lw6sys_list_t ** LIST) LIST: a pointer to the list (pointer on pointer, read/write value) Pops data from the list, the returned value is what was passed to list_push. The pointer on the list is changed "in place" (in/out). When data is popped, that needs some freeing (i.e. free_func was not NULL when creating the list) then it's the responsibility of the caller to free it when popping it. One popped it's not freed, but it's out of the list scope. Of course the lw6sys_list_t is freed, but not the data. If you happen to store non-NULL data in your list, you can call this function without bothering calling `lw6sys_list_is_empty' and assume that when you get NULL, there's no data left. At this stage, the list won't exist anymore BTW, you won't even need to free it. The idea is: popping a list which has no elements left (empty list) destroys the list and returns NULL. *Return value:* a pointer on the popped data, whatever you pushed. -- Function: lw6sys_list_t * lw6sys_list_dup (lw6sys_list_t * LIST, lw6sys_dup_func_t DUP_FUNC) LIST: the list to duplicate, can be NULL DUP_FUNC: the function which will be called to duplicate data Duplicates a list. All data will be copied so that if the first list is deleted, the duplicated one is fine. Addtionnally, dup_func will be called to filter all data, and possibly allocated new pointers if needed, for instance. If dup_func is NULL, then data values will simply be copied. This is likely to be usefull when data is not dynamically allocated. *Returned value:* a newly allocated list. -- Function: void lw6sys_log_set_file (char * FILENAME) FILENAME: the name of the log file. Sets up the log file. Until you call this function, messages all logged to the default log file, as returned by the `lw6sys_get_default_log_file' function. *Return value:* void -- Function: void lw6sys_log_clear (char * FILENAME) FILENAME: the name of the log file. Clears the log file, this function would typically be called at the beginning of the program. If filename is NULL, then the default log file is cleared. *Return value:* void -- Function: void lw6sys_log (int LEVEL_ID, char * FILE, int LINE, char * FMT, ...) LEVEL_ID: the log level to use. Possible values are, by order, LW6SYS_LOG_ERROR_ID (0), LW6SYS_LOG_WARNING_ID (1), LW6SYS_LOG_NOTICE_ID (2), LW6SYS_LOG_INFO_ID (3), LW6SYS_LOG_DEBUG_ID (4) and LW6SYS_LOG_TMP_ID (5). FILE: the name of the source file where the function is called, one can use __FILE__ LINE: the line in the source file where the function is called, one can use __LINE__ FMT: a printf-like format string ...: printf-like arguments, corresponding to `fmt'. This function is usually called with the first three arguments packed into a single macro. For instance the `LW6SYS_LOG_WARNING' macro expands and fills the first 3 args, so there's no need to type __FILE__ and __LINE__ again and again. Note that this function will reset errno. The idea is to call it whenever there's something to do with errno (if you deal with errno, it's a good habit to log it) then errno is cleared so that it won't interfere with next log messages. -- Function: void lw6sys_log_critical (char * FMT, ...) FMT: a printf-like format string ...: printf-like arguments, corresponding to `fmt'. This function is a special log function which will dump informations on the console only, without opening any log file whatsoever. The idea is that it's a "never fail" function. Additionnally, it will never return but quit the program. This can be used as an ultimate emergency function, use it when the program won't run for sure, and displaying an immediate error message is the only issue. -- Function: int lw6sys_log_get_level () -- Function: void lw6sys_log_set_level (int LEVEL) LEVEL: the log level, integer between 0 & 4. 4 is very verbose (debug), 0 displays errors only. -- Function: void lw6sys_math_poly_wy1y2s1 (float * Y, float * S, float X, float W, float Y1, float Y2, float S1) Y: the return value (position, may be NULL) S: the return value (speed, may be NULL) X: the x parameter, the value to iterate on W: the width, that is, the x value after which output is constant Y1: the initial value, when v is s1 and x=0 Y2: the target value, when v=0 and x>=w S1: the initial speed, that is dy/dx at x=0 A function which can be used to implement smooth moving. It will extrapolate, for values of x>=0, an y position with a continuous derivate (dy/dx is continuous, function is 2nd order polynom) and which ends up at x=w with a constant value, that is dy/dx=v=0. Typically an item set with an initial speed of v with this function -- Function: float lw6sys_math_angle_360 (int X, int Y) X: x coordinate Y: y coordinate This is a wrapper over the standard `atan' function which will handle internally the special x == 0 case and the various positive/negative values of `x' and `y'. *Return value:* the angle, in degrees -- Function: float lw6sys_math_heartbeat (int64_t X, int PERIOD, float Y1, float Y2) X: the parameter (typically a timestamp) PERIOD: the period (typically something like 1000 milliseconds) Y1: the low value (heart at rest) Y2: the high value (when bumping) A heartbeat function, typically usefull to power up eye-candy, but it could do something else. -- Function: int lw6sys_math_blink (int64_t X, int PERIOD) X: the parameter (typically a timestamp) PERIOD: the period (typically something like 1000 milliseconds) This function will alternatively return 1 or 0, usefull to handle blinking for instance. *Return value:* 0 or 1 -- Function: void * lw6sys_malloc (int SIZE, char * FILE, int LINE) SIZE: number of bytes to allocate. FILE: name of the file calling the function, use `__FILE__' LINE: line in the file calling the function, use `__LINE__' This is a wrapper over the standard `malloc' function. Additionnally it will keep track of the call with an internal program-wide counter, thus enabling memory leak checks. You should not use this function directly but use the macro `LW6SYS_MALLOC' which has the same syntax, without the last two parameters, which are automatically provided by macro expansion. *Return value:* the newly allocated pointer. Data is not initialized. -- Function: void * lw6sys_calloc (int SIZE, char * FILE, int LINE) SIZE: number of bytes to allocate. FILE: name of the file calling the function, use `__FILE__' LINE: line in the file calling the function, use `__LINE__' This is a wrapper over the standard `calloc' function. Additionnally it will keep track of the call with an internal program-wide counter, thus enabling memory leak checks. You should not use this function directly but use the macro `LW6SYS_CALLOC' which has the same syntax, without the last two parameters, which are automatically provided by macro expansion. *Return value:* the newly allocated pointer. Data is filled with zeros. -- Function: void * lw6sys_realloc (void * PTR, int SIZE, char * FILE, int LINE) PTR: the pointer to reallocate. SIZE: number of bytes to allocate. FILE: name of the file calling the function, use `__FILE__' LINE: line in the file calling the function, use `__LINE__' This is a wrapper over the standard `realloc' function. You should not use this function directly but use the macro `LW6SYS_REALLOC' which has the same syntax, without the last two parameters, which are automatically provided by macro expansion. *Return value:* the newly allocated pointer. -- Function: void lw6sys_free (void * PTR, char * FILE, int LINE) PTR: the pointer to free. FILE: name of the file calling the function, use `__FILE__' LINE: line in the file calling the function, use `__LINE__' This is a wrapper over the standard `free' function. Additionnally it will keep track of the call with an internal program-wide counter, thus enabling memory leak checks. You should not use this function directly but use the macro `LW6SYS_FREE' which has the same syntax, without the last two parameters, which are automatically provided by macro expansion. *Return value:* none. -- Function: void lw6sys_free_callback (void * PTR) PTR: the pointer to free. This is a callback to be used when the `lw6sys_free' does not fit. A good example is a list, which, to free its elements, requires you to provide a callback that only takes 1 arg, the pointer to free. Problem, `lw6sys_free' takes 3 args. And the `LW6SYS_FREE' macro is not usable in such a context. And you can't use standard `free' either for it would mess up the `malloc' / `free' automatical count which is so convenient to track memory leaks. So this callback is here, it's only drawback is that in case of an error, the error will not be reported with the real file and line parameters. It's still better than nothing. *Return value:* none. -- Function: int lw6sys_megabytes_available () Gives a raw approximation of available memory, in megabytes. Value is to be taken with distance, but it can give good hints when system is running short of ressources. *Return value:* number of megabytes (physical memory) available. -- Function: int lw6sys_is_big_endian () Checks the endianess of the machine. PPC is big endian, for instance. *Return value:* 1 if system is big endian, 0 if little endian. -- Function: int lw6sys_is_little_endian () Checks the endianess of the machine. x86 is little endian, for instance. *Return value:* 1 if system is little endian, 0 if big endian. -- Function: int lw6sys_check_types_size () Checks of common types and usefull structures, this is a debugging function which helps finding compiler strange behaviors and programmer's bad intuitions. *Return value:* 1 if everything is OK, 0 if error. -- Function: void * lw6sys_mutex_create () Creates a mutex object. *Return value:* newly allocated pointer. -- Function: void lw6sys_mutex_destroy (void * MUTEX) MUTEX: the mutex to destroy. Destroys a mutex object. *Return value:* none. -- Function: int lw6sys_mutex_lock (void * MUTEX) MUTEX: the mutex to use Locks the mutex. Note that this should never fail unless there's a serious initialization problem, instead, function will wait forever until mutex is released. *Return value:* 1 if success, 0 if failure. -- Function: int lw6sys_mutex_trylock (void * MUTEX) MUTEX: the mutex to use Tries to locks the mutex. That is, tells wether mutex can be locked immediately or not. Note that this does not mean there's 100% chance next call to lock will terminated immediately, since lock can still be acquired by another thread. *Return value:* 1 if mutex unlocked, 0 if locked or error. -- Function: int lw6sys_mutex_unlock (void * MUTEX) MUTEX: the mutex to use Unlocks a mutex. *Return value:* 1 if sucess, 0 if error. -- Function: int lw6sys_get_mutex_lock_count () Returns how many mutexes have been locked since program start. Usefull for sanity checking when debugging. *Return value:* number of calls to lock -- Function: int lw6sys_get_mutex_unlock_count () Returns how many mutexes have been unlocked since program start. Usefull for sanity checking when debugging. *Return value:* number of calls to unlock -- Function: int lw6sys_check_mutex_count () Checks wether unlock has been called as many times as lock. Usefull for sanity checking when debugging. *Return value:* 1 if OK, 0 if inconsistency. -- Function: int lw6sys_true () Function which returns always true, that is, something different than 0. -- Function: int lw6sys_false () Function which returns always false, that is, 0. This can seem totally useless but it does have some utility. It's used for instance to "fool" the compiler and force it to compile and link functions in binaries, so that, afterwards, dynamically loaded .so files can find in the main binary some functions which would otherwise be stripped during the final link. -- Function: char * lw6sys_get_default_user_dir () Returns the default user directory. Note that this value is not static, it can depend, for instance, of the environment variable `HOME'. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_config_file () Returns the default config file. Note that this value is not static, it can depend, for instance, of the environment variable `HOME'. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_log_file () Returns the default log file. Note that this value is not static, it can depend, for instance, of the environment variable `HOME'. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_prefix () Returns the default prefix, could be /usr/local for instance. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_mod_dir () Returns the default module directory (dynamically loaded libraries). *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_data_dir () Returns the default data directory. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_map_dir () Returns the default map directory. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_map_path () Returns the default map path, which can be composed of several directories. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_default_script_file () Returns the default script file. *Return value:* a newly allocated string. -- Function: void lw6sys_options_log_defaults () Logs all default values to log file. Usefull for debugging, to know where the program is searching for its informations. -- Function: char * lw6sys_get_cwd () Returns the current working directory (absolute path). *Return value:* a newly allocated string. -- Function: char * lw6sys_get_run_dir (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the binary directory, that is, the directory the binary is stored in. This is calculated dynamically, by interpreting command-line arguments. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_user_dir (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the user dir, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_config_file (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the config file, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_log_file (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the log file, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_prefix (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the prefix, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_mod_dir (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the mod dir (modules, shared .so), taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_data_dir (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the data dir, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_map_dir (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the map dir, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_map_path (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the map path, taking in account command-line and environment variables. However config file content has no impact on the result. Map path can contain several directories. *Return value:* a newly allocated string. -- Function: char * lw6sys_get_script_file (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Returns the script file, taking in account command-line and environment variables. However config file content has no impact on the result. *Return value:* a newly allocated string. -- Function: void lw6sys_options_log (int ARGC, char * [] ARGV) ARGC: argc, number of arguments, as given to `main' ARGV: argv, pointer to arguments, as given to `main' Logs all the main options values which are not config-file dependant but depend on built-in defaults, command-line arguments and environment variables. Usefull to debug and know where the program is searching for things. -- Function: int lw6sys_file_exists (char * FILENAME) FILENAME: the file to test Tests the existence of a file on the filesystem. File is considered to exists if it's at least readable. *Return value:* 1 if OK, 0 if file doesn't exist or can't be read. -- Function: int lw6sys_dir_exists (char * DIRNAME) DIRNAME: the directory to test Tests the existence of a directory on the filesystem. *Return value:* 1 if OK, 0 if directory doesn't exist. -- Function: int lw6sys_create_dir (char * DIRNAME) DIRNAME: the directory to create Creates a directory, performing sanity checks such as verifying the directory really exists after being created. *Return value:* 1 if OK, 0 if error. -- Function: int lw6sys_create_dir_silent (char * DIRNAME) DIRNAME: the directory to create Creates a directory like `lw6sys_create_dir' but this function is silent in the sense that it won't log any error. Usefull to create the log directory itself, for instance, and avoid infinite loops on error. *Return value:* 1 if OK, 0 if error. -- Function: char * lw6sys_path_add_slash (char * PATH) PATH: a path Adds a slash, or in a general manner, a directory separator, at the end of a path, if needed. So /foo/bar will become /foo/bar/ but /bar/foo/ will remain /bar/foo/. *Return value:* a newly allocated string, must be freed. -- Function: char * lw6sys_path_strip_slash (char * PATH) PATH: a path Strips the slash, or in a general manner, the directory separator, at the end of a path, if needed. So /foo/bar/ will become /foo/bar but /bar/foo will remain /bar/foo. *Return value:* a newly allocated string, must be freed. -- Function: char * lw6sys_path_concat (char * PATH1, char * PATH2) PATH1: left part of the path PATH2: right part of the path Concatenates 2 parts of a path. Function will try to avoid stupid "double-slash" when concatenating /foo/ with /bar/ and conversely insert a directory separator when concatenating /foo with bar/. *Return value:* a newly allocated string, must be freed. -- Function: lw6sys_list_t * lw6sys_path_split (char * PATH) PATH: a path Splits a path into all its parts. For instance /boo/bar/foo2/bar2 returns a 4 elements list. This is more than a plain split, for heading and tailing slashes will be ignored, and various path separators will be interpreted (depends on platform). *Return value:* a list containing 0-terminated strings. -- Function: int lw6sys_path_is_relative (char * PATH) PATH: a path Checks wether a path is relative or absolute. *Return value:* 1 if relative, 0 if absolute. -- Function: int lw6sys_path_is_cwd (char * PATH) PATH: a path Checks wether a path is "." or not. Will also trap "" and "./". *Return value:* 1 if relative, 0 if absolute. -- Function: char * lw6sys_path_parent (char * PATH) PATH: a path Returns the parent path. That will return /foo when given /foo/bar in input. *Return value:* a newly allocated string, must be freed. -- Function: char * lw6sys_path_unparent (char * PATH) PATH: a path Given the ../foo/bar path, will return foo/bar. Usefull to get rid of heading ../ when a path is known to start with it. *Return value:* a newly allocated string, must be freed. -- Function: char * lw6sys_path_unparent_no_malloc (char * PATH) PATH: a path Given the ../foo/bar path, will return foo/bar. Usefull to get rid of heading ../ when a path is known to start with it. This is different from `lw6sys_path_unparent' just because the result is not dynamically allocated and copied from source. *Return value:* a pointer which points somewhere within the string passed as an argument. -- Function: void lw6sys_print_xml_header (FILE * F, char * COMMENT) F: file to output content to Prints a standard Liquid War compliant XML header in the given file. *Return value:* none. -- Function: void lw6sys_print_xml_footer (FILE * F) F: file to output content to Prints a standard Liquid War 6 compliant XML footer in the given file. *Return value:* none. -- Function: int lw6sys_profiler_check (int VERBOSE) VERBOSE: wether to display informations on the console Checks wether Google Profiler support has been built, and if it's set, outputs the log file. If CPUPROFILE is defined but binary has no support for it, will display a warning message. *Return value:* 1 if google profile enabled and activated, 0 if not -- Function: void lw6sys_progress_default (lw6sys_progress_t * PROGRESS, float * VALUE) PROGRESS: the progress struct to initialize VALUE: the value to point to Sets a progress struct to default values, that is, ranging from 0.0f to 1.0f. *Return value:* none. -- Function: void lw6sys_progress_update (lw6sys_progress_t * PROGRESS, int MIN, int MAX, int VALUE) PROGRESS: the progress struct to update MIN: the min value MAX: the max value VALUE: the current value Updates a progress struct. This is typically the function used by a callback to show the progress of a process. Note that this is note an initializer. Rather, the progress struct was initialized before, and this call is done in a loop with min being 0, max being the last value in the loop, and value the current index in the loop. NULL pointers correctly handled internally, so call this with any parameters, it's safe. *Return value:* none. -- Function: void lw6sys_progress_split (lw6sys_progress_t * PROGRESS1, lw6sys_progress_t * PROGRESS2, lw6sys_progress_t * PROGRESS_SRC) progress1: the first part of the splitted progress progress2: the second part of the splitted progress progress_src: the progress to split Utility function to split a progress struct, that is, if a progress was ranging from a to b, make 2 progress structs, ranging from a to c and from c to b, c being between a and b. *Return value:* none -- Function: void lw6sys_progress_split3 (lw6sys_progress_t * PROGRESS1, lw6sys_progress_t * PROGRESS2, lw6sys_progress_t * PROGRESS3, lw6sys_progress_t * PROGRESS_SRC) progress1: the first part of the splitted progress progress2: the second part of the splitted progress progress3: the third part of the splitted progress progress_src: the progress to split Utility function to split a progress struct, this one will split it into 3 equal parts. *Return value:* none -- Function: void lw6sys_progress_split4 (lw6sys_progress_t * PROGRESS1, lw6sys_progress_t * PROGRESS2, lw6sys_progress_t * PROGRESS3, lw6sys_progress_t * PROGRESS4, lw6sys_progress_t * PROGRESS_SRC) progress1: the first part of the splitted progress progress2: the second part of the splitted progress progress3: the third part of the splitted progress progress4: the fourth part of the splitted progress progress_src: the progress to split Utility function to split a progress struct, this one will split it into 4 equal parts. *Return value:* none -- Function: void lw6sys_progress_split5 (lw6sys_progress_t * PROGRESS1, lw6sys_progress_t * PROGRESS2, lw6sys_progress_t * PROGRESS3, lw6sys_progress_t * PROGRESS4, lw6sys_progress_t * PROGRESS5, lw6sys_progress_t * PROGRESS_SRC) progress1: the first part of the splitted progress progress2: the second part of the splitted progress progress3: the third part of the splitted progress progress4: the fourth part of the splitted progress progress5: the fourth part of the splitted progress progress_src: the progress to split Utility function to split a progress struct, this one will split it into 5 equal parts. *Return value:* none -- Function: void lw6sys_progress_begin (lw6sys_progress_t * PROGRESS) progress: the progress to update Sets the progress to its min value, NULL values correctly handled. *Return value:* none -- Function: void lw6sys_progress_half (lw6sys_progress_t * PROGRESS) progress: the progress to update Sets the progress to the average between min and max, NULL values correctly handled. *Return value:* none -- Function: void lw6sys_progress_end (lw6sys_progress_t * PROGRESS) progress: the progress to update Sets the progress to its max value, NULL values correctly handled. *Return value:* none -- Function: u_int32_t lw6sys_random (u_int32_t RANGE) RANGE: the high limit for random generated numbers. If you want random numbers between 0 and 5, set this to 6. Wrapper over standard random function. This one is thread safe. This idea is not to provide cryptographic-proof random numbers, rather generate sequences which are random enough to generate unique server ids and such things. The function is initialized on its first call, and results depend on timestamp, host name, user name, and memory available. -- Function: float lw6sys_random_float (float MIN, float MAX) MIN: the min value, as a float MAX: the max value, as a float Returns a random float number between min & max. Can be equal to min or max. -- Function: int lw6sys_sdl_register () Function used to avoid initializing SDL several times in a program. AFAIK Allegro has a `was_init' function, but SDL doesn't. With this function - which every LW6 sub-module should use - one can know globally, for the whole program, wether SDL has been initialized or not. -- Function: int lw6sys_sdl_unregister () Call this whenever you are done with SDL and exit it, so that the `lw6sys_sdl_register' function works correctly. *Return value:* 1 if SDL needs to be unregistered, that is, if it has already been initialized, else 0. -- Function: void lw6sys_serialize_int64 (unsigned char * DATA, int64_t VALUE) DATA: pointer to the data, must contain at least 8 bytes of writable space VALUE: the integer to serialize Serializes a 64-bit integer in a byte buffer. Result is not dependant on machine endianess. Typically used for checksums or high-level serializations. -- Function: int64_t lw6sys_unserialize_int64 (unsigned char * DATA) DATA: pointer to the data, must contain at least 8 bytes Recovers a 64-bit integer from a byte buffer created, for instance, with `lw6sys_serialize_int64'. -- Function: void lw6sys_serialize_int32 (unsigned char * DATA, int32_t VALUE) DATA: pointer to the data, must contain at least 4 bytes of writable space VALUE: the integer to serialize Serializes a 32-bit integer in a byte buffer. Result is not dependant on machine endianess. Typically used for checksums or high-level serializations. -- Function: int32_t lw6sys_unserialize_int32 (unsigned char * DATA) DATA: pointer to the data, must contain at least 4 bytes Recovers a 32-bit integer from a byte buffer created, for instance, with `lw6sys_serialize_int32'. -- Function: void lw6sys_serialize_int16 (unsigned char * DATA, int16_t VALUE) DATA: pointer to the data, must contain at least 2 bytes of writable space VALUE: the integer to serialize Serializes a 16-bit integer in a byte buffer. Result is not dependant on machine endianess. Typically used for checksums or high-level serializations. -- Function: int16_t lw6sys_unserialize_int16 (unsigned char * DATA) DATA: pointer to the data, must contain at least 2 bytes Recovers a 16-bit integer from a byte buffer created, for instance, with `lw6sys_serialize_int16'. -- Function: int lw6sys_shape_check_min_max_whd (lw6sys_whd_t * SHAPE, int MIN_WH, int MAX_WH, int MAX_D) SHAPE: the dimensions to control MIN_WH: the min value for w and h MAX_WH: the max value for w and h MAX_D: the max value for d Will check wether the given shape respects some basic constraints, being not to small and not too big. *Return value:* 1 if OK, 0 if not. -- Function: int lw6sys_shape_check_pos (lw6sys_whd_t * SHAPE, lw6sys_xyz_t * POS) SHAPE: the boundary box POS: the position Checks wether position is within the given boundary box. *Return value:* 1 if OK, 0 if not. -- Function: int lw6sys_shape_is_same (lw6sys_whd_t * SHAPE_A, lw6sys_whd_t * SHAPE_B) SHAPE_A: the first shape to compare SHAPE_B: the other shape to compare Compares two shapes. *Return value:* 1 if same, 0 if not. -- Function: int lw6sys_sort_int_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of int item LIST_B: pointer to a list of int item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of integers. *Return value:* -1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', 1 if `list_a' > `list_b' -- Function: int lw6sys_sort_int_desc_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of int item LIST_B: pointer to a list of int item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of integers. This one will sort in reverse mode. *Return value:* 1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', -1 if `list_a' > `list_b' -- Function: int lw6sys_sort_float_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of float item LIST_B: pointer to a list of float item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of floating point numbers. *Return value:* -1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', 1 if `list_a' > `list_b' -- Function: int lw6sys_sort_float_desc_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of float item LIST_B: pointer to a list of float item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of floating point numbers. This one will sort in reverse mode. *Return value:* 1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', -1 if `list_a' > `list_b' -- Function: int lw6sys_sort_str_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of string item LIST_B: pointer to a list of string item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of 0-terminated strings. *Return value:* -1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', 1 if `list_a' > `list_b' -- Function: int lw6sys_sort_str_desc_callback (lw6sys_list_t ** LIST_A, lw6sys_list_t ** LIST_B) LIST_A: pointer to a list of string item LIST_B: pointer to a list of string item A typicall sort callback function, can be passed to `lw6sys_sort' to sort a list of 0-terminated strings. This one will sort in reverse mode. *Return value:* 1 if `list_a' < `list_b' , 0 if `list_a' == `list_b', -1 if `list_a' > `list_b' -- Function: void lw6sys_sort (lw6sys_list_t ** LIST, lw6sys_sort_callback_func_t SORT_FUNC) LIST: the list to sort, might be modified by the function SORT_FUNC: the callback function used to sort A general sorting function. Internally, will use the glibc `qsort' function, but this one is adapted to the LW6 specific data structures, more exactly, the `lw6sys_list' structure. Several default sort callbacks are defined, but one is free to use any callback, provided it has the right prototype. -- Function: void * lw6sys_spinlock_create () Creates a spinlock object. *Return value:* newly allocated pointer. -- Function: void lw6sys_spinlock_destroy (void * SPINLOCK) SPINLOCK: the spinlock to destroy. Destroys a spinlock object. *Return value:* none. -- Function: int lw6sys_spinlock_lock (void * SPINLOCK) SPINLOCK: the spinlock to use Locks the spinlock. Note that this should never fail unless there's a serious initialization problem, instead, function will wait forever until spinlock is released. *Return value:* 1 if success, 0 if failure. -- Function: int lw6sys_spinlock_trylock (void * SPINLOCK) SPINLOCK: the spinlock to use Tries to locks the spinlock. That is, tells wether spinlock can be locked immediately or not. Note that this does not mean there's 100% chance next call to lock will terminated immediately, since lock can still be acquired by another thread. *Return value:* 1 if spinlock unlocked, 0 if locked or error. -- Function: int lw6sys_spinlock_unlock (void * SPINLOCK) SPINLOCK: the spinlock to use Unlocks a spinlock. *Return value:* 1 if sucess, 0 if error. -- Function: char * lw6sys_str_copy (char * SRC) SRC: the string to copy Duplicate a string, creating a new pointer on it, which must be freed afterwards. The main difference with `strdup' is that here we use the LW6SYS_MALLOC macro to track down possible memory leaks. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_str_concat (char * STR1, char * STR2) STR1: the left part to be concatenated STR2: the right part to be concatenated Concatenate 2 strings, and put the result in a newly allocated string. Unlike `strcat' which uses the same pointer. *Return value:* a newly allocated pointer, must be freed. -- Function: char * lw6sys_new_sprintf (char * FMT, ...) FMT: a format string, like the one you would pass to `printf' ...: optional arguments, like the ones you would pass to `printf' An sprintf like function, except it allocates a new string automatically, with "enough space". This is not a highly optimized function, it will allocate plenty of memory, possibly several times, and thus consume time and resources. But it has the great advantage of freeing the programmer of the dirty work of guessing "how log will the sprintf'ed string be?" before even generating it. So it's a time saver for the programmer. Additionnally, helps avoiding memory leaks and buffer overflows. *Return value:* a new allocated string, must be freed. -- Function: int lw6sys_str_is_blank (char * STR) STR: the string to test Tests wether a string is blank, that is, if it's composed of space, tabs, or carriage returns only. *Return value:* 1 if blank, 0 if not. -- Function: int lw6sys_str_is_same (char * STR_A, char * STR_B) STR_A: 1st string to compare, can be NULL STR_B: 2nd string to compare, can be NULL Compares two strings for equality. Difference with strcmp is that this one won't check for alphabetical order and return -1 or +1, but will check for NULL args. of space, tabs, or carriage returns only. *Return value:* 1 if same, 0 if not. -- Function: int lw6sys_skip_blanks (char ** STR_PTR) STR_PTR: a pointer to a string pointer (read/write parameter). Skips blanks at the beginning of a string. The passed parameter is modifed in place. Usefull for parsing. *Return value:* 1 if blanks were found, else 0. -- Function: void lw6sys_str_cleanup (char * STR) STR: a pointer to the string, which will be modified in-place. Used to clean up some strings, for instance if they come from the network, we don't necessarly want system chars to be displayed on the console. Basically it removes all characters with an ASCII code inferior to 32, that is, all system characters. This way, there won't be any tab, linefeed, or any of such characters left. *Return value:* none. -- Function: char * lw6sys_str_reformat (char * STR, char * PREFIX, int NB_COLUMNS) STR: a pointer to the string we want to modify PREFIX: a prefix to put before each line Reformats a string, that is, insert newline characters in the right places to that it fits in a given number of columns. A prefix is appended at the beginning of each line. Will not handle strings which already contain newline characters perfectly. *Return value:* a newly allocated string, must be freed. -- Function: char * lw6sys_eol () Returns the value of EOL, that is, the "end of line" sequence. Will simply return "\n" on UNIX and "\r\n" on Microsoft platforms. Note that while this is convenient to write config and example files, for instance, it's a bad idea to use this to generate network messages, because this kind of message needs to be platform independant. Thus any network protocol oriented string would use chr(10) and char(13) directly. *Return value:* the EOL string, must not be freed. -- Function: lw6sys_list_t * lw6sys_str_split (char * STR, char C) STR: a string C: the delimiter to split with Splits a string, for instance 'foo,bar' splited with 'o' will return 'f', " and ',bar'. *Return value:* a list containing 0-terminated strings. -- Function: lw6sys_list_t * lw6sys_str_split_no_0 (char * STR, char C) STR: a string C: the delimiter to split with Splits a string, ignoring empty '0-length' members. For instance 'foo,bar' splited with 'o' will return 'f' and ',bar'. *Return value:* a list containing 0-terminated strings. -- Function: int lw6sys_test () Runs the `sys' module test suite, testing most (if not all...) functions. Note that some tests perform file system operations and might therefore fail on a read-only filesystem, or if user permissions are not sufficient. *Return value:* 1 if test is successfull, 0 on error. -- Function: void * lw6sys_thread_create (lw6sys_thread_callback_func_t CALLBACK_FUNC, lw6sys_thread_callback_func_t CALLBACK_JOIN, void * CALLBACK_DATA) CALLBACK_FUNC: the main callback, the function that will run the thread CALLBACK_JOIN: function which will be called when joining, at the end CALLBACK_DATA: data which will be passed to the callback Creates a thread. All threads must be joined. This is because we really do not want the game to leak, and detached threads are typically the kind of thing that leaves stuff in the heap. Note that callback_func is just something which will be called when joining it can be NULL. The idea is to put in it free & delete functions, which you can't call before joining when you want the main thread to get the results of the callback_func. *Return value:* an opaque pointer on the thread. Can be NULL if failed. -- Function: int lw6sys_thread_is_callback_done (void * THREAD_HANDLER) THREAD_HANDLER: thread to work on Tells wether the callback is done, that is to say, wether the results are available, and we can join. *Return value:* 1 if done, else 0. -- Function: int lw6sys_thread_get_id (void * THREAD_HANDLER) THREAD_HANDLER: thread to query Returns the id of the thread, this is an internal value, unique for each process, which can help identifying the thread. *Return value:* the id, should be >0. -- Function: void * lw6sys_thread_get_data (void * THREAD_HANDLER) THREAD_HANDLER: thread to query Returns the data associated to the thread, that is, the pointer which was passed to the callback function. *Return value:* a pointer. -- Function: void lw6sys_thread_join (void * THREAD_HANDLER) THREAD_HANDLER: thread to end Joins the thread, that's to say wait until the thread is over, and destroys the ressources associated to it. Note that if the thread is looping forever, this function will just wait forever. This is the only way to end a thread. *Return value:* none. -- Function: int lw6sys_get_thread_create_count () Utility function used to check how many threads where created and joined. *Return value:* how many threads were created. -- Function: int lw6sys_get_thread_join_count () Utility function used to check how many threads where created and joined. *Return value:* how many threads were joined. -- Function: int lw6sys_check_thread_count () Utility function used to check how many threads where created and joined. This one will compare the results of `lw6sys_get_thread_create_count' and `lw6sys_get_thread_join_count'. *Return value:* 1 if both are equals, 0 if not (error...). -- Function: int64_t lw6sys_timestamp () Returns a 64-bit timestamp, for general purpose. The unit is milliseconds, should return the number of milliseconds since EPOCH. Don't use this for accurate date handling, but rather to technical stamp events. *Return value:* the timestamp. -- Function: int64_t lw6sys_uptime () Returns the number of milliseconds since program was started. Milliseconds are often referred to as 'ticks'. *Return value:* the number of milliseconds (64-bit) -- Function: void lw6sys_timer_update (int64_t * TIMESTAMP, int64_t * UPTIME) TIMESTAMP: the timestamp in msec since EPOCH (output), can be NULL UPTIME: the uptime in msec since startup (output), can be NULL Returns timestamp & uptime with only one system call. *Return value:* none (parameters modified). -- Function: void lw6sys_sleep (float SECONDS) SECONDS: the number of seconds to wait, fractions allowed Will sleep for the given amount of seconds. Same as `lw6sys_delay' only input is provided as a floating number of seconds instead of ticks. -- Function: void lw6sys_delay (int MSEC) MSEC: the number of milliseconds (ticks) to wait Will sleep for the given amount of seconds. Provides accurate timing and has "about-millisecond" precision, since it uses `select' internally. Might however be interrupted in some cases, so consider function can always return quicker than specified. A common usage of this function is polling loops, where you don't care if 2 polls are very close, but simply want to avoid polling continuously, therefore consumming 100% of the CPU for nothing. -- Function: void lw6sys_idle () Will sleep for a minimal amount of time, just giving the OS a chance to let other threads/processes execute themselves. This can make a big difference in polling loops between a process that eats 100% CPU and a process that has a very moderate load. of ticks. -- Function: void lw6sys_time_init () Global initializations required to handle time properly. -- Function: int lw6sys_vthread_run (lw6sys_thread_callback_func_t CALLBACK_FUNC, lw6sys_thread_callback_func_t CALLBACK_JOIN, void * CALLBACK_DATA) CALLBACK_FUNC: the main callback, the function that will run the thread CALLBACK_JOIN: function which will be called when joining, at the end CALLBACK_DATA: data which will be passed to the callback This function is similar to `lw6sys_thread_create', but it's dedicated to creating a unique (one per process only) thread, which, in turn, will be able to run commands in the main thread itself. This is a hack to allow apparently spawned child threads to be actually handled by main. This is because some libraries, which LW6 uses in threads, need to be actually called in the main thread. SDL, for instance. Note that after running this you loose control on the main thread, this one will only wait for possible commands from the spawned thread, typically sent with the `lw6sys_vthread_create' function. *Return value:* 1 on success, 0 on failure. -- Function: int lw6sys_vthread_is_running () Returns true if `lw6sys_vthread_run' has been called. Note that this is not bullet proof, it will return true in a correct manner only if you call it from the vthread itself. In practise this shouldn't be a problem, the idea is just to write portable code for the main control thread and be able to decide on the fly wether to create a thread we should prefer the `lw6sys_thread_create' or its equivalent the `lw6sys_vthread_create' function. *Return value:* 1 on success, 0 on failure. -- Function: int lw6sys_vthread_create (lw6sys_thread_callback_func_t CALLBACK_FUNC, lw6sys_thread_callback_func_t CALLBACK_JOIN, void * CALLBACK_DATA) CALLBACK_FUNC: the main callback, the function that will run the thread CALLBACK_JOIN: function which will be called when joining, at the end CALLBACK_DATA: data which will be passed to the callback The equivalent of `lw6sys_thread_create' but for the vthread infrastructure. The idea is to pretend firing a spawned thread, but in fact it's the main thread that runs the code. This function must imperatively be called within the `lw6sys_vthread_run' function, else it will fail or be buggy. *Return value:* 1 on success, 0 on failure. -- Function: void lw6sys_vthread_join () The equivalent of `lw6sys_thread_join' but for the vthread infrastructure. The idea is to pretend firing a spawned thread, but in fact it's the main thread that runs the code. This function must imperatively be called within the `lw6sys_vthread_run' function, else it will fail or be buggy. *Return value:* none. 4.15.42 libtsk -------------- -- Function: lw6tsk_loader_t * lw6tsk_loader_new (float SLEEP, float * PROGRESS) SLEEP: how many seconds to wait between every poll Creates a new loader. This object is used to do some reputed slow calculus in the background, in a separated thread. Typical example is map loading. This is a high-level objects which encapsulates threads and other wizardry. *Return value:* a pointer to the loader, NULL if failed. -- Function: void lw6tsk_loader_free (lw6tsk_loader_t * LOADER) LOADER: the loader to free. Deletes a loader. Will automatically stop the child thread, free data, and so on. *Return value:* none. -- Function: char * lw6tsk_loader_repr (lw6tsk_loader_t * LOADER) LOADER: the loader to represent. Creates a string which briefly describes the loader. *Return value:* a dynamically allocated pointer, must be freed. -- Function: int lw6tsk_loader_get_stage (lw6tsk_loader_t * LOADER) LOADER: the loader to query. Returns the current stage of the loader. *Return value:* 0 if idle, 1 if loading the map from disk, 2 if build dynamic stuff such as game_state. Appendix A 2005 .plan ********************* Here's my .plan file, which describes what I (Christian Mauduit (mailto:ufoot@ufoot.org)) have planned for Liquid War 6. There's no garantee that what's written here is a precise description of the real future, however it should give a good idea of what I have in mind. Note that the information here was written in summer 2005, it might or not be accurate now, as the main reason for plans to exist is that people never follow them. I'm no exception. A.1 Complete rewrite ==================== Liquid War 6 will be an almost complete rewrite. I mean that common code between branches 5 and 6 might end up in representing 0% of the total code. I think this is a wise decision, for the current code is really hard to maintain, and would not survive any serious cleanup. LW5 was first written in 1998, for DOS, when I had much less experience in programming. In 7 years I - and other people as well - hacked major enhancements in it such as cross-platform support, network games, and if you compare release 5.0 with the latest 5.x.x release, you'll see that a bunch of things have changed. I had never expected I would patch and fix this game for so long, and it's no surprise that it's bloated today. FYI, here's a list of what makes LW5 unsuitable for major improvements without a complete rewrite: * global variable hell. Lots of things are stored in globals. * hard-coded C GUI. Read src/level.c to get an idea of how horrible it is. * hard-coded 256 colors paletted mode. A clever bet in 1998 (performance...). Not anymore. * generally bloated code. Makes bug-finding very tricky. A.2 Technologies ================ Liquid War 6 will use a different technical framework than Liquid War 5 (http://www.ufoot.org/liquidwar/v5). A.2.1 Script + standard C + assembly ------------------------------------ It happens that coding a large project in pure C is a waist of time, if possible at all. If one applies the standard 80/20 rule to a computer game, one might state that 80% of the code eat up 20% of the CPU and the other 20% of the code eat up 80% of the CPU, the former being high-level glue code and the latter being low-level algorithmic code. With Liquid War, one could speak of the 99/01 rule. I mean that 99% of the CPU time concerns only 1% of the code, and vice-versa. Basically, Liquid War has a very CPU-greedy core algorithm, still spends a fair amount of CPU displaying stuff (but this is delegated to the low-level game programming library) and the rest is totally unsignificant, in terms of CPU. Point is this "rest" represents the vast majority of the code, and also represents the very same buggy code I spend nights to patch on Liquid War 5 (http://www.ufoot.org/liquidwar/v5). I'm talking about network code, GUI, and other high-level glue-code which are currently being written in C. This idea is to write all this in a convenient scripting language. There won't be any impact on performances. I can't garantee Liquid War 6 will be blazingly fast, but for sure it won't be the scripting language fault. And of course if, as in Liquid War 3 and 5, I feel the need to implement some stuff in assembly for performances issues, I will do it. We end up with a multi-language architecture: script + C + assembly. My guess is that I'll use Scheme (http://www.gnu.org/software/guile/) as an extension language. Python (http://www.python.org) would be a good choice too. Let's say I'll give Scheme a chance, and if it's really not adapted, I'll switch back to Python. The point is that today I know Python and don't really know Scheme, but, well, it's always a pleasure for me to learn new things. It's fun. So what is planned today is that Liquid War 6 will be a Scheme program, which will call callbacks functions written in C and/or assembly. These functions will do all the low-level time consuming algorithmic and graphical stuff. The rest of the code being entirely scripted. A.2.2 OpenGL ------------ Liquid War is not a 3D game, so why use OpenGL? * it's a very convenient way to access video hardware acceleration with XFree86. * low-end computers and/or computers without 3D acceleration can still run Liquid War 5 (http://www.ufoot.org/liquidwar/v5). * I'm interested in learning/using this API 8-) This choice implies that I won't use Allegro (http://alleg.sourceforge.net/) anymore. Allegro stays a very convenient library and I would recommend it for it's excellent, easy to learn, powerfull, and stable. But for the needs of Liquid War 6 I'll use something else (because of OpenGL). I first thought of using GLUT (http://freeglut.sourceforge.net/) but I might end up simply using SDL (http://www.libsdl.org/). The idea is just fo have an OpenGL wrapper which sets up OpenGL in a similar manner on all platforms, and handles basic things such as mouse or keyboard. A.2.3 CSound ------------ I've got two excellent books on Csound (http://www.csounds.com/), and the will to learn how to use this tool. I'll probably use Csound for a number of things, ranging from "bubbling sounds" to full blown music. Stay tuned 8-) A.3 Functionnalities ==================== A.3.1 Visual enhancements ------------------------- Of course Liquid War 6 will look nicer than Liquid War 5 (http://www.ufoot.org/liquidwar/v5), blah blah blah. What do you think? Maybe I'll try to use some OpenGL features to make it possible to play on a ball, on a Moebius ring, or other fancy things. I have zillion of ideas, future will decide which ones will be implemented first. To make it clear, visual enhancements aren't my top-level priority. However I'll try and make room for these enhancements, and prepare the terrain correctly. So it's possible that the first releases of Liquid War 6 won't be that much better than Liquid War 5 (http://www.ufoot.org/liquidwar/v5), but at least Liquid War 6 will have the possibility to evolve. Something Liquid War 5 (http://www.ufoot.org/liquidwar/v5) doesn't have. A.3.2 Rules enhancements ------------------------ There are many things that could be done easily: * several cursors for one team * alliances between teams * deep places on a map, where more liquid can reside * circular maps which "connect" the left border to the right one * ... As for graphical improvements, this is not my top-level priority. Simply, I'll make the game ready-to-improve. Again, all these enhancements are very hard to code in Liquid War 5 (http://www.ufoot.org/liquidwar/v5), else I would already have coded them. Network enhancements That's my top-level prioriry. Why is that? Well, think of Liquid War in terms of "what makes it a good game?" and "what makes it a poor game?". It's a good game because: * the idea is original * the gameplay is addictive * you can play on a LAN * all the family can play * it's cross-platform * it's Free Software It's a poor game because: * it's somewhat ugly and has a retro "back in the eighties" look * network games are slow on Internet * there are not enough active Internet servers For the ugliness, well, OpenGL and some artwork should make it. But for the network, what's the real problem? The real problem is that in the current situation, the server needs to have all "keystrokes" before doing anything, and all players must be connected before a game starts. Here's what I plan to do to fix this: * players will be able to connect on a game "on the fly". This is done by most online games, and it's IMHO a required features for a network mode to work on Internet (not speaking of local networks, but real wide online gaming). How this will fit with Liquid War's rules is not totally decided, but I already know of several way to achieve this. * I'll implement an "anticipation" system "a la" U61 (http://www.ufoot.org). This means that no matter if a remote player has a poor network connection, things will behave as if everything was fine. Internally, the system keeps 2 images of the game. One which is "anticipated" and displayed to the player, and one which is validated but outdated, kept internally. It's a little hard to explain, consumes twice as much CPU and memory, but it works. It happens that today the lacking ressource for playing Liquid War online is more on the network side than on the local CPU and memory aspects. * I'll take it to the next level and implement a "peer-to-peer-like" network model, in which any client can become a server. The idea behind is that if a server quits the game, then a client takes its role, letting the game continue for hours. This way one could virtually have a never ending Liquid War game which would last weeks. I believe this could be really cool. I also believe no proprietary game will ever implement that, for in this model there's no way to force people to access a centralized server, this server usually being the major key in the business model of a company which sells proprietary software. This third point will be the real enhancement of Liquid War with version 6. It's one of the very points which drives me to rewrite it completely. First because it's impossible to implement it without some heavy work. Then because I find it very motivating. A.3.3 Hey, you forgot my idea!!! -------------------------------- Many gamers submitted suggestions, either by mail or by posting messages on the mailing list. Don't worry, I keep them. Not reading them here does not mean I won't implement them. It simply means I won't implement them first. I first need the game basically function before enhancing it with fancy stuff. A.4 Road map ============ As I stated on the mailing list, when thinking about Liquid War 6, think of years rather than months (unless I get fired, jobless, or spend several months in a hospital with a laptop). Note that this road map takes it for granted that I'll be the lone coder on the project. It's unlikely that someone is going to help me for the first stages, until there's at least something real, something playable. Something that proves that the concept is valid. Besides, (real) team work implies a significant overhead, especially at project start. It's hard to figure out how to distribute tasks when the tasks themselves are not clearly identified. But for the rest (starting in 2007 or 2008), it's possible that external help might greatly... ...help! * 2005 : Project framework should be done. This implies that the scripting engine is up and running, graphical mode works, config and data loading work, basic menus are available. Nothing playable. * 2006 : Import the core algorithm from Liquid War 5 (http://www.ufoot.org/liquidwar/v5), make the game playable in "demo mode" ("à la" Liquid War 2), implement the network "peer-to-peer-like" mode. At this stage, it will be possible to know wether Liquid War 6 is true vaporware or not. * 2007 : glue all this together to make something usable by anyone, heavy work on the GUI, on the options, on error checking, many bug fixes. The goal is to have a game which is equivalent to Liquid War 5 (http://www.ufoot.org/liquidwar/v5), with the network aspects pushed to the next level. * 2008 : tadaaaaaaaaaaa! Release the game "publicly" - inform Freshmeat 8-) - and enhance it with all the feedback from gamers (bug reports and suggestions received since 1998). Work on artwork (both graphics and musics). Write documentation. * 2009 : stabilize the game, patch it for all those things which had been forgotten back then in 2005, optimize for speed, bug-fix bug-fix bug-fix. * 2010 : stop maintaining Liquid War 5 (http://www.ufoot.org/liquidwar/v5), invite Liquid War fans and coders to a hudge party in my garden, sing all night, drink beers and wine, teach Liquid War strategies to my 5 and 6 year old daughters, remember the old times when Liquid War wasn't so cool 8-) Appendix B Fanfic ***************** Quoting Gavin: "I wrote a liquid war fanfic some time ago [...] I wrote it after a friend claimed that there wasn't any liquid war fanfic because it wasn't possible." So here it is, a Liquid War fanfic. It was initially written for Liquid War 5, but applies to Liquid War 6 as well. Enjoy! B.1 The Battle of Emberlificoted ================================ ... The General presided over his massing army in his seat, or rather hovering ring, of power. It dipped slightly as he flew low over his troops marching through the viscous marsh-like terrain. They were like children: obedient, loyal, and they ate a lot. Glancing at the status panel mounted in front of him he grimaced; the other five armies: Yellow, Green, Orange, Turquoise, and, of course, Red, were also readying armies of a similar size to his own. His violet clones would have to fight hard and eat well to win this day. Today would not be a battle of luck, the General mused, it would be a battle of tactics, of alliances, and of betrayal. Every clone was identical - that was the general idea behind clones - and the terrain seemed strangely symmetrical; it would not give advantage to any of the six armies amassed today. Glancing at the hologram of the battlefield projected in front of him the General noted that he would have to move quickly, Orange and Yellow were too close for comfort, though fortunately Baron Red's army of eponymous coloured clones was the furthest. General Violet's fingertips were sweaty even before they touched the four main control keys in front of him. They were labeled 'W', 'A', 'D', and, of course, the full retreat button - very useful for misleading foes and ambushing them as they pursued - 'S'. The keys were arrange in a roughly equilateral triangular pattern; with 'S' forming the base and being adjacent to both 'A' and 'D', 'W' formed the tip of the triangle. A long breath left his parched lips as at last he made his move. ... "Dammit!" he screamed moments later. He had misjudged Captain Yellow and Commander Orange; he had expected one at least to attack immediately, one he could have handled. They were working together - foiling his attempt to shoot between them to near the center of the battlefield to gain a better vantage point. Yellow had shot down towards him, cutting off his advance, and now Orange had sealed his escape route. "It's not over yet" muttered the General. He opened a voice channel with Commander Orange: "Very clever. Flawed, but still clever." "Flawed?" came the reply. "Yes flawed, when the good Captain is finished devouring my army who do you think he will turn to next?", bluffed the General - his hands worked quickly as he manoeuvred his hovering control ring, all that his troops ever saw of him, carefully towards the weakest section of his attackers. If he could just break out a few units he could soon turn the tide against both Yellow and Orange. "We have an alliance..." Orange's voice was unsure now. Time for some sarcasm to through her even more off balance, thought the General, "I gathered", he spoke softly, slowly, and with too much meaning. Then closing the channel he turned his attention back to his escape. ... "Yes!" wooped the ecstatic figure of the General. Fifty or so of his troops had broken free undetected and were even now working their way cautiously towards the camps of the Yellow army, only the front lines were still actively fighting; this opening gambit of Yellow and Orange had turned into a stale siege and Yellow's army had pitched tent. General Violet steered his hovering guidance ring to the center of the Yellow camp. His troops struck, both those who had got behind the lines and those who were still besieged. Yellow reacted too slowly and suddenly found that her army, was shrinking back from the onslaught. There was nowhere to run to, and bye now her only ally - Commander Orange - had abandoned her to her fate; he was too busy engaging Sir. Turquoise, who had managed to escape from the slaughter that the Baron had caused to the Turquoise ranks and was even now valiantly attacking the flanks of the Orange troops. A glance at the status panel showed that Yellow's life force was fading quickly: 8%, 3%, 1%, Gone. The General smiled, he always enjoyed getting the first kill, and by now his armies life force had grown and his clones had replicated. With his, now, formidable fighting force it was no problem to engulf both Sir. Turquoise and Commander Orange's brawling armies and annihilate them. Once again his army grew in size and power. Now if only the Baron didn't notice that..., thought the General. ... "Too late!" yelped the General, now thrown into panic, as he saw the approaching Baron. His army had also grown in size and power - having fatally injured the Turquoise army within the opening moments of the battle, and having finally managed to catch the elusive fleeing form of, or what remained of, Emperor Green. Gripping the controls harder the General thought quickly, his army doesn't so completely outnumber me that this is already over, however unless I can cause him to make a mistake that allows me to take the upper hand then I will inevitably lose. Maybe I can... This thought was terminated and replaced by another as the Baron's angry red troops broke through the undergrowth that had covered their movements and started to surround the General's army. The thought that now throbbed through the panic-stricken mind of General Violet was simply 'Run!'. Even as he signaled the retreat and made for what seemed to be the only possible means of escape the Baron's blood red control ring appeared at the opening. The General knew it was over, even before the host of red beings appeared at the opening. There was no escape. His life force was almost depleted and he was surrounded. Then it was that the Baron decided to communicate: "Too bad. It was a good game" The General blinked, gaped, and was generally gobsmacked. Just before his life force completely failed and his own weary eyes closed in defeat he snarled, "What!? This is not a game!" were the General's dying words. Appendix C Links **************** This section lists various Internet Liquid War related links. * Liquid War 6 homepage (http://www.gnu.org/software/liquidwar6/) * Liquid War 6 on ufoot.org (http://www.ufoot.org/liquidwar/v6) * Online manual (http://www.gnu.org/software/liquidwar6/manual/) * Savannah downloads (http://download.savannah.gnu.org/releases/liquidwar6/) * ufoot.org downloads (http://www.ufoot.org/download/liquidwar/v6/) * GNU Arch repositoty (http://arch.sv.gnu.org/archives/liquidwar6/) * Project on Savannah (http://savannah.gnu.org/projects/liquidwar6/) * Mailing-list archives (http://lists.gnu.org/archive/html/help-liquidwar6/) * Liquid War entry on Wikipedia (http://en.wikipedia.org/wiki/Liquid_War) * Liquid War entry on Wikipedia (French) (http://fr.wikipedia.org/wiki/Liquid_War) * Liquid War 6 entry on LGDB (http://www.lgdb.org/game/liquid_war) * Liquid War 6 entry on Libregamewiki (http://libregamewiki.org/Liquid_War_6) * Liquid War 5 (http://www.ufoot.org/liquidwar/v5) Appendix D GNU GENERAL PUBLIC LICENSE ************************************* Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/' Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ======== The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS ==================== 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a. The work must carry prominent notices stating that you modified it, and giving a relevant date. b. The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c. You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d. If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a. Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b. Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c. Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d. Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e. Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a. Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b. Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c. Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d. Limiting the use for publicity purposes of names of licensors or authors of the material; or e. Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f. Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS =========================== How to Apply These Terms to Your New Programs ============================================= If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. Copyright (C) YEAR NAME OF AUTHOR This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see `http://www.gnu.org/licenses/'. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: PROGRAM Copyright (C) YEAR NAME OF AUTHOR This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see `http://www.gnu.org/licenses/'. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read `http://www.gnu.org/philosophy/why-not-lgpl.html'. Appendix E GNU Free Documentation License ***************************************** Version 1.3, 3 November 2008 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. `http://fsf.org/' Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque". Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. The "publisher" means any person or entity that distributes copies of the Document to the public. A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements." 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See `http://www.gnu.org/copyleft/'. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. 11. RELICENSING "Massive Multiauthor Collaboration Site" (or "MMC Site") means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A "Massive Multiauthor Collaboration" (or "MMC") contained in the site means any set of copyrightable works thus published on the MMC site. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. "Incorporate" means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is "eligible for relicensing" if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. ADDENDUM: How to use this License for your documents ==================================================== To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (C) YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. Appendix F Indexes ****************** F.1 Concept index ================= Apple: See 3.7.3. (line 2201) Arch: See 3.14.1. (line 2567) Bug report <1>: See 2.14. (line 1219) Bug report: See 2.1.3. (line 617) Compilation <1>: See 3.7.2. (line 1887) Compilation: See 2.5.1. (line 911) CVS: See 3.14.1. (line 2567) Download: See 2.2.1. (line 638) GPL, GNU General Public License: See Appendix D. (line 18366) hints.xml: See 3.1.7. (line 1419) Log file: See 2.13. (line 1204) Mac OS X: See 3.7.3. (line 2201) Microsoft Windows: See 3.7.2. (line 1887) rules.xml: See 3.1.6. (line 1378) source code: See 3.14.1. (line 2567) style.xml: See 3.1.8. (line 1430) SVN: See 3.14.1. (line 2567) F.2 Function and keyword index ============================== --about=: See 4.1.1. (line 2716) --animation-density=: See 4.11.1. (line 4832) --animation-speed=: See 4.11.2. (line 4847) --audit: See 4.12.1. (line 5549) --background-color-auto=: See 4.10.1. (line 4584) --background-color-root-bg=: See 4.11.3. (line 4862) --background-color-root-fg=: See 4.11.4. (line 4877) --background-color-stuff-bg=: See 4.11.5. (line 4894) --background-color-stuff-fg=: See 4.11.6. (line 4911) --background-style=: See 4.11.7. (line 4929) --bench: See 4.12.2. (line 5559) --bot-iq=: See 4.12.3. (line 5567) --bot-speed=: See 4.12.4. (line 5583) --chosen-map=: See 4.8.1. (line 3673) --color-alternate-bg=: See 4.11.8. (line 4944) --color-alternate-fg=: See 4.11.9. (line 4960) --color-base-bg=: See 4.11.10. (line 4976) --color-base-fg=: See 4.11.11. (line 4992) --color-conflict-mode=: See 4.9.1. (line 3767) --colorize=: See 4.11.12. (line 5008) --commands-per-sec=: See 4.12.5. (line 5597) --config-file: See 4.4.1. (line 3413) --copyright: See 4.1.2. (line 2731) --cursor-pot-init=: See 4.9.2. (line 3787) --cursor-size=: See 4.11.13. (line 5024) --data-dir: See 4.4.2. (line 3425) --debug: See 4.1.3. (line 2737) --debug-layer-id=: See 4.12.6. (line 5613) --debug-team-id=: See 4.12.7. (line 5626) --defaults: See 4.1.4. (line 2745) --demo: See 4.12.8. (line 5639) --dirty-read=: See 4.12.9. (line 5647) --display-background=: See 4.12.10. (line 5664) --display-console=: See 4.12.11. (line 5677) --display-cursors=: See 4.12.12. (line 5692) --display-debug-gradient=: See 4.12.13. (line 5705) --display-debug-zones=: See 4.12.14. (line 5718) --display-fighters=: See 4.12.15. (line 5731) --display-fps=: See 4.12.16. (line 5744) --display-hud=: See 4.12.17. (line 5758) --display-log=: See 4.12.18. (line 5771) --display-map=: See 4.12.19. (line 5784) --display-menu=: See 4.12.20. (line 5797) --display-mouse=: See 4.12.21. (line 5810) --display-preview=: See 4.12.22. (line 5822) --display-progress=: See 4.12.23. (line 5835) --display-rps=: See 4.12.24. (line 5848) --display-score=: See 4.12.25. (line 5862) --display-splash=: See 4.12.26. (line 5874) --example-hints-xml: See 4.2.1. (line 2787) --example-rules-xml: See 4.2.2. (line 2794) --example-style-xml: See 4.2.3. (line 2802) --fighter-attack=: See 4.9.3. (line 3801) --fighter-defense=: See 4.9.4. (line 3818) --fighter-new-health=: See 4.9.5. (line 3834) --fighter-regenerate=: See 4.9.6. (line 3852) --fighter-scale=: See 4.10.2. (line 4601) --force=: See 4.8.2. (line 3687) --fullscreen=: See 4.5.1. (line 3555) --gfx-backend=: See 4.5.2. (line 3568) --gfx-cpu-usage=: See 4.12.27. (line 5887) --guess-colors=: See 4.10.3. (line 4627) --height=: See 4.5.3. (line 3581) --help: See 4.1.5. (line 2753) --hidden-layer-alpha=: See 4.11.14. (line 5038) --hud-color-auto=: See 4.10.4. (line 4646) --hud-color-frame-bg=: See 4.11.15. (line 5055) --hud-color-frame-fg=: See 4.11.16. (line 5068) --hud-color-text-bg=: See 4.11.17. (line 5081) --hud-color-text-fg=: See 4.11.18. (line 5094) --hud-style=: See 4.11.19. (line 5107) --io-per-sec=: See 4.12.28. (line 5904) --keep-ratio=: See 4.11.20. (line 5121) --list: See 4.1.6. (line 2759) --list-aliases: See 4.2.4. (line 2809) --list-doc: See 4.2.5. (line 2815) --list-funcs: See 4.2.6. (line 2822) --list-graphics: See 4.2.7. (line 2829) --list-hooks: See 4.2.8. (line 2835) --list-input: See 4.2.9. (line 2841) --list-map: See 4.2.10. (line 2848) --list-map-hints: See 4.2.11. (line 2855) --list-map-rules: See 4.2.12. (line 2862) --list-map-style: See 4.2.13. (line 2869) --list-network: See 4.2.14. (line 2876) --list-path: See 4.2.15. (line 2882) --list-players: See 4.2.16. (line 2889) --list-quick: See 4.2.17. (line 2895) --list-show: See 4.2.18. (line 2902) --list-sound: See 4.2.19. (line 2910) --list-tuning: See 4.2.20. (line 2916) --loader-sleep=: See 4.12.29. (line 5918) --log-file=: See 4.4.3. (line 3437) --log-level=: See 4.12.30. (line 5931) --log-timeout=: See 4.12.31. (line 5948) --map-dir: See 4.4.4. (line 3450) --map-path=: See 4.4.5. (line 3465) --max-cursor-pot-offset=: See 4.9.8. (line 3881) --max-cursor-pot=: See 4.9.7. (line 3867) --max-map-height=: See 4.10.5. (line 4663) --max-map-surface=: See 4.10.6. (line 4680) --max-map-width=: See 4.10.7. (line 4695) --max-nb-cursors=: See 4.9.9. (line 3898) --max-nb-servers=: See 4.9.10. (line 3912) --max-nb-teams=: See 4.9.11. (line 3926) --max-round-delta=: See 4.9.12. (line 3939) --max-zone-size=: See 4.9.13. (line 3954) --memory-bazooka-eraser=: See 4.12.32. (line 5961) --memory-bazooka-size=: See 4.12.33. (line 5981) --menu-color-auto=: See 4.10.8. (line 4712) --menu-color-default-bg=: See 4.11.21. (line 5134) --menu-color-default-fg=: See 4.11.22. (line 5147) --menu-color-disabled-bg=: See 4.11.23. (line 5162) --menu-color-disabled-fg=: See 4.11.24. (line 5175) --menu-color-selected-bg=: See 4.11.25. (line 5188) --menu-color-selected-fg=: See 4.11.26. (line 5201) --menu-style=: See 4.11.27. (line 5214) --min-map-height=: See 4.10.9. (line 4731) --min-map-surface=: See 4.10.10. (line 4748) --min-map-width=: See 4.10.11. (line 4763) --mod-dir: See 4.4.6. (line 3493) --modules: See 4.12.34. (line 6003) --moves-per-round=: See 4.9.14. (line 3977) --music-volume=: See 4.6.1. (line 3628) --nb-attack-tries=: See 4.9.15. (line 3995) --nb-defense-tries=: See 4.9.16. (line 4013) --nb-move-tries=: See 4.9.17. (line 4030) --pedigree: See 4.12.35. (line 6012) --pilot-lag=: See 4.12.36. (line 6022) --pixelize=: See 4.11.28. (line 5227) --prefix: See 4.4.7. (line 3508) --quick-start: See 4.12.37. (line 6036) --resample=: See 4.10.12. (line 4780) --reset: See 4.12.38. (line 6044) --respawn-team=: See 4.9.18. (line 4051) --round-delta=: See 4.9.19. (line 4067) --rounds-per-sec=: See 4.9.20. (line 4092) --script-file: See 4.4.8. (line 3523) --server: See 4.12.39. (line 6054) --show-build-cflags: See 4.3.1. (line 2925) --show-build-codename: See 4.3.2. (line 2933) --show-build-configure-args: See 4.3.3. (line 2941) --show-build-copyright: See 4.3.4. (line 2949) --show-build-datadir: See 4.3.5. (line 2955) --show-build-date: See 4.3.6. (line 2966) --show-build-docdir: See 4.3.7. (line 2972) --show-build-enable-allinone: See 4.3.8. (line 2980) --show-build-enable-console: See 4.3.9. (line 2987) --show-build-enable-fullstatic: See 4.3.10. (line 2995) --show-build-enable-gcov: See 4.3.11. (line 3002) --show-build-enable-gprof: See 4.3.12. (line 3009) --show-build-enable-instrument: See 4.3.13. (line 3016) --show-build-enable-mod-csound: See 4.3.14. (line 3023) --show-build-enable-mod-gl: See 4.3.15. (line 3031) --show-build-enable-mod-http: See 4.3.16. (line 3040) --show-build-enable-mod-ogg: See 4.3.17. (line 3048) --show-build-enable-optimize: See 4.3.18. (line 3057) --show-build-enable-paranoid: See 4.3.19. (line 3064) --show-build-enable-profiler: See 4.3.20. (line 3072) --show-build-enable-valgrind: See 4.3.21. (line 3079) --show-build-endianness: See 4.3.22. (line 3086) --show-build-gcc-version: See 4.3.23. (line 3093) --show-build-hostname: See 4.3.24. (line 3100) --show-build-includedir: See 4.3.25. (line 3106) --show-build-ldflags: See 4.3.26. (line 3114) --show-build-libdir: See 4.3.27. (line 3121) --show-build-license: See 4.3.28. (line 3132) --show-build-localedir: See 4.3.29. (line 3138) --show-build-mac-os-x: See 4.3.30. (line 3146) --show-build-md5sum: See 4.3.31. (line 3152) --show-build-ms-windows: See 4.3.32. (line 3159) --show-build-package-name: See 4.3.33. (line 3166) --show-build-package-string: See 4.3.34. (line 3172) --show-build-package-tarname: See 4.3.35. (line 3178) --show-build-pointer-size: See 4.3.36. (line 3184) --show-build-prefix: See 4.3.37. (line 3191) --show-build-stamp: See 4.3.38. (line 3199) --show-build-target-cpu: See 4.3.39. (line 3210) --show-build-target-os: See 4.3.40. (line 3216) --show-build-time: See 4.3.41. (line 3222) --show-build-top-srcdir: See 4.3.42. (line 3228) --show-build-version: See 4.3.43. (line 3235) --show-build-x86: See 4.3.44. (line 3244) --show-config-file: See 4.3.45. (line 3250) --show-cwd: See 4.3.46. (line 3257) --show-data-dir: See 4.3.47. (line 3264) --show-default-config-file: See 4.3.48. (line 3273) --show-default-data-dir: See 4.3.49. (line 3280) --show-default-log-file: See 4.3.50. (line 3289) --show-default-map-dir: See 4.3.51. (line 3296) --show-default-map-path: See 4.3.52. (line 3303) --show-default-mod-dir: See 4.3.53. (line 3312) --show-default-prefix: See 4.3.54. (line 3320) --show-default-script-file: See 4.3.55. (line 3329) --show-default-user-dir: See 4.3.56. (line 3339) --show-log-file: See 4.3.57. (line 3347) --show-map-dir: See 4.3.58. (line 3353) --show-map-path: See 4.3.59. (line 3360) --show-mod-dir: See 4.3.60. (line 3369) --show-prefix: See 4.3.61. (line 3377) --show-run-dir: See 4.3.62. (line 3385) --show-script-file: See 4.3.63. (line 3393) --show-user-dir: See 4.3.64. (line 3403) --side-attack-factor=: See 4.9.21. (line 4109) --side-defense-factor=: See 4.9.22. (line 4126) --single-army-size=: See 4.9.23. (line 4139) --snd-backend=: See 4.6.2. (line 3641) --sound-volume=: See 4.6.3. (line 3654) --spread-thread=: See 4.9.24. (line 4157) --spreads-per-round=: See 4.9.25. (line 4174) --start-blue-x=: See 4.9.26. (line 4193) --start-blue-y=: See 4.9.27. (line 4206) --start-cyan-x=: See 4.9.28. (line 4219) --start-cyan-y=: See 4.9.29. (line 4232) --start-green-x=: See 4.9.30. (line 4245) --start-green-y=: See 4.9.31. (line 4258) --start-lightblue-x=: See 4.9.32. (line 4271) --start-lightblue-y=: See 4.9.33. (line 4284) --start-magenta-x=: See 4.9.34. (line 4297) --start-magenta-y=: See 4.9.35. (line 4310) --start-orange-x=: See 4.9.36. (line 4323) --start-orange-y=: See 4.9.37. (line 4336) --start-pink-x=: See 4.9.38. (line 4349) --start-pink-y=: See 4.9.39. (line 4362) --start-position-mode=: See 4.9.40. (line 4375) --start-purple-x=: See 4.9.41. (line 4391) --start-purple-y=: See 4.9.42. (line 4404) --start-red-x=: See 4.9.43. (line 4417) --start-red-y=: See 4.9.44. (line 4430) --start-yellow-x=: See 4.9.45. (line 4443) --start-yellow-y=: See 4.9.46. (line 4456) --system-color-auto=: See 4.10.13. (line 4794) --system-color-bg=: See 4.11.29. (line 5241) --system-color-fg=: See 4.11.30. (line 5255) --target: See 4.12.40. (line 6062) --target-fps=: See 4.12.41. (line 6070) --team-color-blue=: See 4.11.31. (line 5269) --team-color-cyan=: See 4.11.32. (line 5282) --team-color-green=: See 4.11.33. (line 5295) --team-color-lightblue=: See 4.11.34. (line 5308) --team-color-magenta=: See 4.11.35. (line 5321) --team-color-orange=: See 4.11.36. (line 5334) --team-color-pink=: See 4.11.37. (line 5347) --team-color-purple=: See 4.11.38. (line 5360) --team-color-red=: See 4.11.39. (line 5373) --team-color-yellow=: See 4.11.40. (line 5386) --test: See 4.1.7. (line 2768) --total-armies-size=: See 4.9.47. (line 4469) --total-time=: See 4.9.48. (line 4490) --use-hints-xml=: See 4.8.3. (line 3705) --use-rules-xml=: See 4.8.4. (line 3718) --use-style-xml=: See 4.8.5. (line 3732) --use-texture=: See 4.8.6. (line 3747) --user-dir=: See 4.4.9. (line 3537) --version: See 4.1.8. (line 2777) --vertical-move=: See 4.9.49. (line 4508) --view-color-auto=: See 4.10.14. (line 4811) --view-color-cursor-bg=: See 4.11.41. (line 5399) --view-color-cursor-fg=: See 4.11.42. (line 5413) --view-color-map-bg=: See 4.11.43. (line 5427) --view-color-map-fg=: See 4.11.44. (line 5442) --view-style=: See 4.11.45. (line 5457) --width=: See 4.5.4. (line 3595) --windowed-mode-limit=: See 4.5.5. (line 3609) --x-polarity=: See 4.9.50. (line 4524) --x-wrap=: See 4.11.46. (line 5473) --y-polarity=: See 4.9.51. (line 4543) --y-wrap=: See 4.11.47. (line 5489) --z-polarity=: See 4.9.52. (line 4562) --zoom-max=: See 4.11.49. (line 5519) --zoom-min=: See 4.11.50. (line 5533) --zoom=: See 4.11.48. (line 5505) animation-density: See 4.11.1. (line 4834) animation-speed: See 4.11.2. (line 4849) background-color-auto: See 4.10.1. (line 4586) background-color-root-bg: See 4.11.3. (line 4864) background-color-root-fg: See 4.11.4. (line 4879) background-color-stuff-bg: See 4.11.5. (line 4896) background-color-stuff-fg: See 4.11.6. (line 4913) background-style: See 4.11.7. (line 4931) bot-iq: See 4.12.3. (line 5569) bot-speed: See 4.12.4. (line 5585) chosen-map: See 4.8.1. (line 3675) color-alternate-bg: See 4.11.8. (line 4946) color-alternate-fg: See 4.11.9. (line 4962) color-base-bg: See 4.11.10. (line 4978) color-base-fg: See 4.11.11. (line 4994) color-conflict-mode: See 4.9.1. (line 3769) colorize: See 4.11.12. (line 5010) commands-per-sec: See 4.12.5. (line 5599) cursor-pot-init: See 4.9.2. (line 3789) cursor-size: See 4.11.13. (line 5026) debug-layer-id: See 4.12.6. (line 5615) debug-team-id: See 4.12.7. (line 5628) dirty-read: See 4.12.9. (line 5649) display-background: See 4.12.10. (line 5666) display-console: See 4.12.11. (line 5679) display-cursors: See 4.12.12. (line 5694) display-debug-gradient: See 4.12.13. (line 5707) display-debug-zones: See 4.12.14. (line 5720) display-fighters: See 4.12.15. (line 5733) display-fps: See 4.12.16. (line 5746) display-hud: See 4.12.17. (line 5760) display-log: See 4.12.18. (line 5773) display-map: See 4.12.19. (line 5786) display-menu: See 4.12.20. (line 5799) display-mouse: See 4.12.21. (line 5812) display-preview: See 4.12.22. (line 5824) display-progress: See 4.12.23. (line 5837) display-rps: See 4.12.24. (line 5850) display-score: See 4.12.25. (line 5864) display-splash: See 4.12.26. (line 5876) fighter-attack: See 4.9.3. (line 3803) fighter-defense: See 4.9.4. (line 3820) fighter-new-health: See 4.9.5. (line 3836) fighter-regenerate: See 4.9.6. (line 3854) fighter-scale: See 4.10.2. (line 4603) force: See 4.8.2. (line 3689) fullscreen: See 4.5.1. (line 3557) gfx-backend: See 4.5.2. (line 3570) gfx-cpu-usage: See 4.12.27. (line 5889) guess-colors: See 4.10.3. (line 4629) height: See 4.5.3. (line 3583) hidden-layer-alpha: See 4.11.14. (line 5040) hud-color-auto: See 4.10.4. (line 4648) hud-color-frame-bg: See 4.11.15. (line 5057) hud-color-frame-fg: See 4.11.16. (line 5070) hud-color-text-bg: See 4.11.17. (line 5083) hud-color-text-fg: See 4.11.18. (line 5096) hud-style: See 4.11.19. (line 5109) io-per-sec: See 4.12.28. (line 5906) keep-ratio: See 4.11.20. (line 5123) loader-sleep: See 4.12.29. (line 5920) log-file: See 4.4.3. (line 3439) log-level: See 4.12.30. (line 5933) log-timeout: See 4.12.31. (line 5950) LW6_ANIMATION_DENSITY: See 4.11.1. (line 4833) LW6_ANIMATION_SPEED: See 4.11.2. (line 4848) LW6_AUDIT: See 4.12.1. (line 5550) LW6_BACKGROUND_COLOR_AUTO: See 4.10.1. (line 4585) LW6_BACKGROUND_COLOR_ROOT_BG: See 4.11.3. (line 4863) LW6_BACKGROUND_COLOR_ROOT_FG: See 4.11.4. (line 4878) LW6_BACKGROUND_COLOR_STUFF_BG: See 4.11.5. (line 4895) LW6_BACKGROUND_COLOR_STUFF_FG: See 4.11.6. (line 4912) LW6_BACKGROUND_STYLE: See 4.11.7. (line 4930) LW6_BENCH: See 4.12.2. (line 5560) LW6_BOT_IQ: See 4.12.3. (line 5568) LW6_BOT_SPEED: See 4.12.4. (line 5584) LW6_CHOSEN_MAP: See 4.8.1. (line 3674) LW6_COLOR_ALTERNATE_BG: See 4.11.8. (line 4945) LW6_COLOR_ALTERNATE_FG: See 4.11.9. (line 4961) LW6_COLOR_BASE_BG: See 4.11.10. (line 4977) LW6_COLOR_BASE_FG: See 4.11.11. (line 4993) LW6_COLOR_CONFLICT_MODE: See 4.9.1. (line 3768) LW6_COLORIZE: See 4.11.12. (line 5009) LW6_COMMANDS_PER_SEC: See 4.12.5. (line 5598) LW6_CONFIG_FILE: See 4.4.1. (line 3414) LW6_CURSOR_POT_INIT: See 4.9.2. (line 3788) LW6_CURSOR_SIZE: See 4.11.13. (line 5025) LW6_DATA_DIR: See 4.4.2. (line 3426) LW6_DEBUG_LAYER_ID: See 4.12.6. (line 5614) LW6_DEBUG_TEAM_ID: See 4.12.7. (line 5627) LW6_DEMO: See 4.12.8. (line 5640) LW6_DIRTY_READ: See 4.12.9. (line 5648) LW6_DISPLAY_BACKGROUND: See 4.12.10. (line 5665) LW6_DISPLAY_CONSOLE: See 4.12.11. (line 5678) LW6_DISPLAY_CURSORS: See 4.12.12. (line 5693) LW6_DISPLAY_DEBUG_GRADIENT: See 4.12.13. (line 5706) LW6_DISPLAY_DEBUG_ZONES: See 4.12.14. (line 5719) LW6_DISPLAY_FIGHTERS: See 4.12.15. (line 5732) LW6_DISPLAY_FPS: See 4.12.16. (line 5745) LW6_DISPLAY_HUD: See 4.12.17. (line 5759) LW6_DISPLAY_LOG: See 4.12.18. (line 5772) LW6_DISPLAY_MAP: See 4.12.19. (line 5785) LW6_DISPLAY_MENU: See 4.12.20. (line 5798) LW6_DISPLAY_MOUSE: See 4.12.21. (line 5811) LW6_DISPLAY_PREVIEW: See 4.12.22. (line 5823) LW6_DISPLAY_PROGRESS: See 4.12.23. (line 5836) LW6_DISPLAY_RPS: See 4.12.24. (line 5849) LW6_DISPLAY_SCORE: See 4.12.25. (line 5863) LW6_DISPLAY_SPLASH: See 4.12.26. (line 5875) lw6_exit: See 4.15.1. (line 6124) LW6_FIGHTER_ATTACK: See 4.9.3. (line 3802) LW6_FIGHTER_DEFENSE: See 4.9.4. (line 3819) LW6_FIGHTER_NEW_HEALTH: See 4.9.5. (line 3835) LW6_FIGHTER_REGENERATE: See 4.9.6. (line 3853) LW6_FIGHTER_SCALE: See 4.10.2. (line 4602) LW6_FORCE: See 4.8.2. (line 3688) LW6_FULLSCREEN: See 4.5.1. (line 3556) LW6_GFX_BACKEND: See 4.5.2. (line 3569) LW6_GFX_CPU_USAGE: See 4.12.27. (line 5888) LW6_GUESS_COLORS: See 4.10.3. (line 4628) LW6_HEIGHT: See 4.5.3. (line 3582) LW6_HIDDEN_LAYER_ALPHA: See 4.11.14. (line 5039) LW6_HUD_COLOR_AUTO: See 4.10.4. (line 4647) LW6_HUD_COLOR_FRAME_BG: See 4.11.15. (line 5056) LW6_HUD_COLOR_FRAME_FG: See 4.11.16. (line 5069) LW6_HUD_COLOR_TEXT_BG: See 4.11.17. (line 5082) LW6_HUD_COLOR_TEXT_FG: See 4.11.18. (line 5095) LW6_HUD_STYLE: See 4.11.19. (line 5108) LW6_IO_PER_SEC: See 4.12.28. (line 5905) LW6_KEEP_RATIO: See 4.11.20. (line 5122) LW6_LOADER_SLEEP: See 4.12.29. (line 5919) LW6_LOG_FILE: See 4.4.3. (line 3438) LW6_LOG_LEVEL: See 4.12.30. (line 5932) LW6_LOG_TIMEOUT: See 4.12.31. (line 5949) lw6_main: See 4.15.1. (line 6132) LW6_MAP_DIR: See 4.4.4. (line 3451) LW6_MAP_PATH: See 4.4.5. (line 3466) LW6_MAX_CURSOR_POT: See 4.9.7. (line 3868) LW6_MAX_CURSOR_POT_OFFSET: See 4.9.8. (line 3882) LW6_MAX_MAP_HEIGHT: See 4.10.5. (line 4664) LW6_MAX_MAP_SURFACE: See 4.10.6. (line 4681) LW6_MAX_MAP_WIDTH: See 4.10.7. (line 4696) LW6_MAX_NB_CURSORS: See 4.9.9. (line 3899) LW6_MAX_NB_SERVERS: See 4.9.10. (line 3913) LW6_MAX_NB_TEAMS: See 4.9.11. (line 3927) LW6_MAX_ROUND_DELTA: See 4.9.12. (line 3940) LW6_MAX_ZONE_SIZE: See 4.9.13. (line 3955) LW6_MEMORY_BAZOOKA_ERASER: See 4.12.32. (line 5962) LW6_MEMORY_BAZOOKA_SIZE: See 4.12.33. (line 5982) LW6_MENU_COLOR_AUTO: See 4.10.8. (line 4713) LW6_MENU_COLOR_DEFAULT_BG: See 4.11.21. (line 5135) LW6_MENU_COLOR_DEFAULT_FG: See 4.11.22. (line 5148) LW6_MENU_COLOR_DISABLED_BG: See 4.11.23. (line 5163) LW6_MENU_COLOR_DISABLED_FG: See 4.11.24. (line 5176) LW6_MENU_COLOR_SELECTED_BG: See 4.11.25. (line 5189) LW6_MENU_COLOR_SELECTED_FG: See 4.11.26. (line 5202) LW6_MENU_STYLE: See 4.11.27. (line 5215) LW6_MIN_MAP_HEIGHT: See 4.10.9. (line 4732) LW6_MIN_MAP_SURFACE: See 4.10.10. (line 4749) LW6_MIN_MAP_WIDTH: See 4.10.11. (line 4764) LW6_MOD_DIR: See 4.4.6. (line 3494) LW6_MODULES: See 4.12.34. (line 6004) LW6_MOVES_PER_ROUND: See 4.9.14. (line 3978) LW6_MUSIC_VOLUME: See 4.6.1. (line 3629) LW6_NB_ATTACK_TRIES: See 4.9.15. (line 3996) LW6_NB_DEFENSE_TRIES: See 4.9.16. (line 4014) LW6_NB_MOVE_TRIES: See 4.9.17. (line 4031) LW6_PEDIGREE: See 4.12.35. (line 6013) LW6_PILOT_LAG: See 4.12.36. (line 6023) LW6_PIXELIZE: See 4.11.28. (line 5228) LW6_PREFIX: See 4.4.7. (line 3509) lw6_process_non_run_options: See 4.15.1. (line 6153) LW6_QUICK_START: See 4.12.37. (line 6037) lw6_release: See 4.15.1. (line 6112) LW6_RESAMPLE: See 4.10.12. (line 4781) LW6_RESET: See 4.12.38. (line 6045) LW6_RESPAWN_TEAM: See 4.9.18. (line 4052) LW6_ROUND_DELTA: See 4.9.19. (line 4068) LW6_ROUNDS_PER_SEC: See 4.9.20. (line 4093) LW6_SCRIPT_FILE: See 4.4.8. (line 3524) LW6_SERVER: See 4.12.39. (line 6055) LW6_SIDE_ATTACK_FACTOR: See 4.9.21. (line 4110) LW6_SIDE_DEFENSE_FACTOR: See 4.9.22. (line 4127) LW6_SINGLE_ARMY_SIZE: See 4.9.23. (line 4140) LW6_SND_BACKEND: See 4.6.2. (line 3642) LW6_SOUND_VOLUME: See 4.6.3. (line 3655) LW6_SPREAD_THREAD: See 4.9.24. (line 4158) LW6_SPREADS_PER_ROUND: See 4.9.25. (line 4175) LW6_START_BLUE_X: See 4.9.26. (line 4194) LW6_START_BLUE_Y: See 4.9.27. (line 4207) LW6_START_CYAN_X: See 4.9.28. (line 4220) LW6_START_CYAN_Y: See 4.9.29. (line 4233) LW6_START_GREEN_X: See 4.9.30. (line 4246) LW6_START_GREEN_Y: See 4.9.31. (line 4259) LW6_START_LIGHTBLUE_X: See 4.9.32. (line 4272) LW6_START_LIGHTBLUE_Y: See 4.9.33. (line 4285) LW6_START_MAGENTA_X: See 4.9.34. (line 4298) LW6_START_MAGENTA_Y: See 4.9.35. (line 4311) LW6_START_ORANGE_X: See 4.9.36. (line 4324) LW6_START_ORANGE_Y: See 4.9.37. (line 4337) LW6_START_PINK_X: See 4.9.38. (line 4350) LW6_START_PINK_Y: See 4.9.39. (line 4363) LW6_START_POSITION_MODE: See 4.9.40. (line 4376) LW6_START_PURPLE_X: See 4.9.41. (line 4392) LW6_START_PURPLE_Y: See 4.9.42. (line 4405) LW6_START_RED_X: See 4.9.43. (line 4418) LW6_START_RED_Y: See 4.9.44. (line 4431) LW6_START_YELLOW_X: See 4.9.45. (line 4444) LW6_START_YELLOW_Y: See 4.9.46. (line 4457) LW6_SYSTEM_COLOR_AUTO: See 4.10.13. (line 4795) LW6_SYSTEM_COLOR_BG: See 4.11.29. (line 5242) LW6_SYSTEM_COLOR_FG: See 4.11.30. (line 5256) LW6_TARGET: See 4.12.40. (line 6063) LW6_TARGET_FPS: See 4.12.41. (line 6071) LW6_TEAM_COLOR_BLUE: See 4.11.31. (line 5270) LW6_TEAM_COLOR_CYAN: See 4.11.32. (line 5283) LW6_TEAM_COLOR_GREEN: See 4.11.33. (line 5296) LW6_TEAM_COLOR_LIGHTBLUE: See 4.11.34. (line 5309) LW6_TEAM_COLOR_MAGENTA: See 4.11.35. (line 5322) LW6_TEAM_COLOR_ORANGE: See 4.11.36. (line 5335) LW6_TEAM_COLOR_PINK: See 4.11.37. (line 5348) LW6_TEAM_COLOR_PURPLE: See 4.11.38. (line 5361) LW6_TEAM_COLOR_RED: See 4.11.39. (line 5374) LW6_TEAM_COLOR_YELLOW: See 4.11.40. (line 5387) LW6_TOTAL_ARMIES_SIZE: See 4.9.47. (line 4470) LW6_TOTAL_TIME: See 4.9.48. (line 4491) LW6_USE_HINTS_XML: See 4.8.3. (line 3706) LW6_USE_RULES_XML: See 4.8.4. (line 3719) LW6_USE_STYLE_XML: See 4.8.5. (line 3733) LW6_USE_TEXTURE: See 4.8.6. (line 3748) LW6_USER_DIR: See 4.4.9. (line 3538) LW6_VERTICAL_MOVE: See 4.9.49. (line 4509) LW6_VIEW_COLOR_AUTO: See 4.10.14. (line 4812) LW6_VIEW_COLOR_CURSOR_BG: See 4.11.41. (line 5400) LW6_VIEW_COLOR_CURSOR_FG: See 4.11.42. (line 5414) LW6_VIEW_COLOR_MAP_BG: See 4.11.43. (line 5428) LW6_VIEW_COLOR_MAP_FG: See 4.11.44. (line 5443) LW6_VIEW_STYLE: See 4.11.45. (line 5458) LW6_WIDTH: See 4.5.4. (line 3596) LW6_WINDOWED_MODE_LIMIT: See 4.5.5. (line 3610) LW6_X_POLARITY: See 4.9.50. (line 4525) LW6_X_WRAP: See 4.11.46. (line 5474) LW6_Y_POLARITY: See 4.9.51. (line 4544) LW6_Y_WRAP: See 4.11.47. (line 5490) LW6_Z_POLARITY: See 4.9.52. (line 4563) LW6_ZOOM: See 4.11.48. (line 5506) LW6_ZOOM_MAX: See 4.11.49. (line 5520) LW6_ZOOM_MIN: See 4.11.50. (line 5534) lw6cfg_defaults: See 4.15.3. (line 6179) lw6cfg_format: See 4.15.3. (line 6195) lw6cfg_format_guess_type: See 4.15.3. (line 6210) lw6cfg_init: See 4.15.3. (line 6248) lw6cfg_load: See 4.15.3. (line 6225) lw6cfg_merge_env: See 4.15.3. (line 6186) lw6cfg_parse_command_line: See 4.15.3. (line 6172) lw6cfg_quit: See 4.15.3. (line 6259) lw6cfg_reset: See 4.15.3. (line 6267) lw6cfg_save: See 4.15.3. (line 6236) lw6cfg_unified_get_log_file: See 4.15.3. (line 6310) lw6cfg_unified_get_map_path: See 4.15.3. (line 6322) lw6cfg_unified_get_user_dir: See 4.15.3. (line 6298) lw6cfg_unified_get_value: See 4.15.3. (line 6276) lw6dsp_create_backend: See 4.15.6. (line 6343) lw6dsp_destroy_backend: See 4.15.6. (line 6360) lw6dsp_get_average_fps: See 4.15.6. (line 6447) lw6dsp_get_fullscreen_modes: See 4.15.6. (line 6469) lw6dsp_get_instant_fps: See 4.15.6. (line 6438) lw6dsp_get_last_frame_rendering_time: See 4.15.6. (line 6429) lw6dsp_get_nb_frames: See 4.15.6. (line 6420) lw6dsp_get_video_mode: See 4.15.6. (line 6457) lw6dsp_init: See 4.15.6. (line 6377) lw6dsp_param_zero: See 4.15.6. (line 6482) lw6dsp_quit: See 4.15.6. (line 6393) lw6dsp_repr: See 4.15.6. (line 6368) lw6dsp_test: See 4.15.6. (line 6490) lw6dsp_update: See 4.15.6. (line 6402) lw6dyn_dlclose_backend: See 4.15.7. (line 6524) lw6dyn_dlopen_backend: See 4.15.7. (line 6507) lw6dyn_dlopen_backend_so: See 4.15.7. (line 6499) lw6dyn_dlsym: See 4.15.7. (line 6533) lw6dyn_list_backends: See 4.15.7. (line 6543) lw6dyn_path_find_backend: See 4.15.7. (line 6559) lw6dyn_test: See 4.15.7. (line 6579) lw6gfx_display: See 4.15.8. (line 6676) lw6gfx_get_fullscreen_modes: See 4.15.8. (line 6650) lw6gfx_get_video_mode: See 4.15.8. (line 6639) lw6gfx_init: See 4.15.8. (line 6591) lw6gfx_pump_events: See 4.15.8. (line 6661) lw6gfx_quit: See 4.15.8. (line 6606) lw6gfx_repr: See 4.15.8. (line 6614) lw6gfx_set_video_mode: See 4.15.8. (line 6622) lw6gui_button_is_pressed: See 4.15.9. (line 6735) lw6gui_button_pop_press: See 4.15.9. (line 6742) lw6gui_button_register_down: See 4.15.9. (line 6719) lw6gui_button_register_up: See 4.15.9. (line 6728) lw6gui_button_sync: See 4.15.9. (line 6770) lw6gui_button_update_repeat: See 4.15.9. (line 6757) lw6gui_coord_calc_xy: See 4.15.9. (line 6786) lw6gui_input_free: See 4.15.9. (line 6837) lw6gui_input_init: See 4.15.9. (line 6815) lw6gui_input_need_sync: See 4.15.9. (line 6874) lw6gui_input_new: See 4.15.9. (line 6831) lw6gui_input_poll_quit: See 4.15.9. (line 6899) lw6gui_input_quit: See 4.15.9. (line 6823) lw6gui_input_register_change: See 4.15.9. (line 6865) lw6gui_input_reset: See 4.15.9. (line 6844) lw6gui_input_send_quit: See 4.15.9. (line 6907) lw6gui_input_sync: See 4.15.9. (line 6883) lw6gui_input_update_repeat: See 4.15.9. (line 6853) lw6gui_joystick_check_index: See 4.15.9. (line 6915) lw6gui_joystick_get_move_pad: See 4.15.9. (line 6979) lw6gui_joystick_sync: See 4.15.9. (line 6968) lw6gui_joystick_update_axis_x: See 4.15.9. (line 6924) lw6gui_joystick_update_axis_y: See 4.15.9. (line 6940) lw6gui_joystick_update_repeat: See 4.15.9. (line 6955) lw6gui_keyboard_check_keysym: See 4.15.9. (line 6990) lw6gui_keyboard_get_move_pad: See 4.15.9. (line 7075) lw6gui_keyboard_is_pressed: See 4.15.9. (line 7008) lw6gui_keyboard_pop_keypress: See 4.15.9. (line 6998) lw6gui_keyboard_register_key_down: See 4.15.9. (line 7018) lw6gui_keyboard_register_key_up: See 4.15.9. (line 7039) lw6gui_keyboard_sync: See 4.15.9. (line 7063) lw6gui_keyboard_update_repeat: See 4.15.9. (line 7050) lw6gui_keypress_free: See 4.15.9. (line 7099) lw6gui_keypress_new: See 4.15.9. (line 7087) lw6gui_keypress_repr: See 4.15.9. (line 7106) lw6gui_menu_append: See 4.15.9. (line 7272) lw6gui_menu_append_for_id_use: See 4.15.9. (line 7347) lw6gui_menu_center: See 4.15.9. (line 7239) lw6gui_menu_dup: See 4.15.9. (line 7418) lw6gui_menu_enable_esc: See 4.15.9. (line 7208) lw6gui_menu_free: See 4.15.9. (line 7127) lw6gui_menu_get_item: See 4.15.9. (line 7167) lw6gui_menu_insert: See 4.15.9. (line 7252) lw6gui_menu_insert_for_id_use: See 4.15.9. (line 7315) lw6gui_menu_is_same: See 4.15.9. (line 7409) lw6gui_menu_memory_footprint: See 4.15.9. (line 7134) lw6gui_menu_new: See 4.15.9. (line 7114) lw6gui_menu_remove: See 4.15.9. (line 7286) lw6gui_menu_remove_using_id: See 4.15.9. (line 7373) lw6gui_menu_repr: See 4.15.9. (line 7143) lw6gui_menu_scroll_down: See 4.15.9. (line 7229) lw6gui_menu_scroll_up: See 4.15.9. (line 7220) lw6gui_menu_select: See 4.15.9. (line 7178) lw6gui_menu_select_esc: See 4.15.9. (line 7195) lw6gui_menu_set_title: See 4.15.9. (line 7154) lw6gui_menu_sync: See 4.15.9. (line 7426) lw6gui_menu_sync_using_id: See 4.15.9. (line 7390) lw6gui_menu_update_display_range: See 4.15.9. (line 7298) lw6gui_menuitem_checksum: See 4.15.9. (line 7555) lw6gui_menuitem_dup: See 4.15.9. (line 7574) lw6gui_menuitem_enable: See 4.15.9. (line 7540) lw6gui_menuitem_free: See 4.15.9. (line 7466) lw6gui_menuitem_is_same: See 4.15.9. (line 7564) lw6gui_menuitem_memory_footprint: See 4.15.9. (line 7474) lw6gui_menuitem_new: See 4.15.9. (line 7443) lw6gui_menuitem_repr: See 4.15.9. (line 7483) lw6gui_menuitem_select: See 4.15.9. (line 7525) lw6gui_menuitem_set_label: See 4.15.9. (line 7494) lw6gui_menuitem_set_value: See 4.15.9. (line 7511) lw6gui_menuitem_sync: See 4.15.9. (line 7582) lw6gui_mouse_poll_move: See 4.15.9. (line 7607) lw6gui_mouse_register_move: See 4.15.9. (line 7593) lw6gui_mouse_sync: See 4.15.9. (line 7634) lw6gui_mouse_update_repeat: See 4.15.9. (line 7621) lw6gui_smoother_get_value: See 4.15.9. (line 7683) lw6gui_smoother_immediate_force: See 4.15.9. (line 7660) lw6gui_smoother_init: See 4.15.9. (line 7646) lw6gui_smoother_set_target: See 4.15.9. (line 7670) lw6gui_test: See 4.15.9. (line 7692) lw6gui_video_mode_find_closest: See 4.15.9. (line 7699) lw6gui_video_mode_is_same: See 4.15.9. (line 7716) lw6gui_video_mode_sync_ratio: See 4.15.9. (line 7726) lw6gui_viewport_init: See 4.15.9. (line 7741) lw6gui_viewport_map_to_screen: See 4.15.9. (line 7785) lw6gui_viewport_screen_to_map: See 4.15.9. (line 7806) lw6gui_zone_clip: See 4.15.9. (line 7860) lw6gui_zone_init_x1y1x2y2: See 4.15.9. (line 7828) lw6gui_zone_init_xywh: See 4.15.9. (line 7844) lw6hlp_about: See 4.15.10. (line 7883) lw6hlp_get_default_value: See 4.15.10. (line 7913) lw6hlp_get_max_value: See 4.15.10. (line 7932) lw6hlp_get_min_value: See 4.15.10. (line 7923) lw6hlp_get_type: See 4.15.10. (line 7906) lw6hlp_is_documented: See 4.15.10. (line 7874) lw6hlp_list: See 4.15.10. (line 7952) lw6hlp_match: See 4.15.10. (line 7941) lw6hlp_print_content: See 4.15.10. (line 7968) lw6hlp_print_keyword: See 4.15.10. (line 7959) lw6hlp_reference_init: See 4.15.10. (line 7978) lw6hlp_reference_quit: See 4.15.10. (line 7984) lw6ldr_auto_colors: See 4.15.13. (line 8020) lw6ldr_body_read: See 4.15.13. (line 8002) lw6ldr_for_all_entries: See 4.15.13. (line 8056) lw6ldr_free_entry: See 4.15.13. (line 8033) lw6ldr_get_entries: See 4.15.13. (line 8041) lw6ldr_hints_read: See 4.15.13. (line 8074) lw6ldr_hints_set: See 4.15.13. (line 8084) lw6ldr_hints_update: See 4.15.13. (line 8100) lw6ldr_param_read: See 4.15.13. (line 8114) lw6ldr_param_update: See 4.15.13. (line 8127) lw6ldr_print_example_hints_xml: See 4.15.13. (line 8148) lw6ldr_print_example_rules_xml: See 4.15.13. (line 8141) lw6ldr_print_example_style_xml: See 4.15.13. (line 8155) lw6ldr_print_examples: See 4.15.13. (line 8162) lw6ldr_read: See 4.15.13. (line 8173) lw6ldr_read_relative: See 4.15.13. (line 8202) lw6ldr_rules_read: See 4.15.13. (line 8226) lw6ldr_rules_update: See 4.15.13. (line 8236) lw6ldr_style_read: See 4.15.13. (line 8250) lw6ldr_style_set: See 4.15.13. (line 8260) lw6ldr_style_update: See 4.15.13. (line 8276) lw6ldr_use_update: See 4.15.13. (line 8290) lw6map_builtin_defaults: See 4.15.14. (line 8374) lw6map_builtin_whd: See 4.15.14. (line 8380) lw6map_color_invert: See 4.15.14. (line 8306) lw6map_color_is_same: See 4.15.14. (line 8314) lw6map_dup: See 4.15.14. (line 8339) lw6map_free: See 4.15.14. (line 8393) lw6map_from_hexa: See 4.15.14. (line 8357) lw6map_is_same: See 4.15.14. (line 8412) lw6map_memory_footprint: See 4.15.14. (line 8398) lw6map_new: See 4.15.14. (line 8365) lw6map_param_clear: See 4.15.14. (line 8430) lw6map_param_copy: See 4.15.14. (line 8440) lw6map_param_defaults: See 4.15.14. (line 8422) lw6map_param_set: See 4.15.14. (line 8451) lw6map_repr: See 4.15.14. (line 8403) lw6map_team_color_index_to_key: See 4.15.14. (line 8323) lw6map_team_color_key_to_index: See 4.15.14. (line 8331) lw6map_to_hexa: See 4.15.14. (line 8349) lw6net_init: See 4.15.15. (line 8534) lw6net_last_error: See 4.15.15. (line 8468) lw6net_quit: See 4.15.15. (line 8541) lw6net_recv_line_tcp: See 4.15.15. (line 8476) lw6net_recv_line_udp: See 4.15.15. (line 8500) lw6net_send_line_tcp: See 4.15.15. (line 8488) lw6net_send_line_udp: See 4.15.15. (line 8519) lw6pil_bench: See 4.15.17. (line 8553) lw6pil_coords_fix: See 4.15.17. (line 8562) lw6pil_pilot_calibrate: See 4.15.17. (line 8712) lw6pil_pilot_can_sync: See 4.15.17. (line 8634) lw6pil_pilot_commit: See 4.15.17. (line 8615) lw6pil_pilot_dirty_read: See 4.15.17. (line 8694) lw6pil_pilot_free: See 4.15.17. (line 8595) lw6pil_pilot_get_last_commit_round: See 4.15.17. (line 8758) lw6pil_pilot_get_max_round: See 4.15.17. (line 8790) lw6pil_pilot_get_next_round: See 4.15.17. (line 8747) lw6pil_pilot_get_reference_current_round: See 4.15.17. (line 8780) lw6pil_pilot_get_reference_target_round: See 4.15.17. (line 8767) lw6pil_pilot_is_over: See 4.15.17. (line 8799) lw6pil_pilot_make_backup: See 4.15.17. (line 8625) lw6pil_pilot_new: See 4.15.17. (line 8580) lw6pil_pilot_repr: See 4.15.17. (line 8703) lw6pil_pilot_send_command: See 4.15.17. (line 8604) lw6pil_pilot_slow_down: See 4.15.17. (line 8736) lw6pil_pilot_speed_up: See 4.15.17. (line 8725) lw6pil_pilot_sync_from_backup: See 4.15.17. (line 8646) lw6pil_pilot_sync_from_draft: See 4.15.17. (line 8672) lw6pil_pilot_sync_from_reference: See 4.15.17. (line 8658) lw6pil_test: See 4.15.17. (line 8806) lw6sys_arg_exists: See 4.15.20. (line 8841) lw6sys_arg_get_value: See 4.15.20. (line 8854) lw6sys_arg_get_value_with_env: See 4.15.20. (line 8868) lw6sys_arg_match: See 4.15.20. (line 8820) lw6sys_assoc_dup: See 4.15.20. (line 9009) lw6sys_assoc_free: See 4.15.20. (line 8903) lw6sys_assoc_get: See 4.15.20. (line 8924) lw6sys_assoc_has_key: See 4.15.20. (line 8912) lw6sys_assoc_keys: See 4.15.20. (line 8966) lw6sys_assoc_map: See 4.15.20. (line 8978) lw6sys_assoc_new: See 4.15.20. (line 8887) lw6sys_assoc_set: See 4.15.20. (line 8936) lw6sys_assoc_sort_and_map: See 4.15.20. (line 8994) lw6sys_assoc_unset: See 4.15.20. (line 8955) lw6sys_atob: See 4.15.20. (line 9804) lw6sys_atof: See 4.15.20. (line 9812) lw6sys_atoi: See 4.15.20. (line 9797) lw6sys_btoa: See 4.15.20. (line 9830) lw6sys_build_get_cflags: See 4.15.20. (line 9221) lw6sys_build_get_codename: See 4.15.20. (line 9152) lw6sys_build_get_configure_args: See 4.15.20. (line 9206) lw6sys_build_get_copyright: See 4.15.20. (line 9194) lw6sys_build_get_datadir: See 4.15.20. (line 9326) lw6sys_build_get_date: See 4.15.20. (line 9246) lw6sys_build_get_docdir: See 4.15.20. (line 9366) lw6sys_build_get_enable_allinone: See 4.15.20. (line 9403) lw6sys_build_get_enable_console: See 4.15.20. (line 9373) lw6sys_build_get_enable_fullstatic: See 4.15.20. (line 9408) lw6sys_build_get_enable_gcov: See 4.15.20. (line 9436) lw6sys_build_get_enable_gprof: See 4.15.20. (line 9418) lw6sys_build_get_enable_instrument: See 4.15.20. (line 9424) lw6sys_build_get_enable_mod_csound: See 4.15.20. (line 9383) lw6sys_build_get_enable_mod_gl: See 4.15.20. (line 9378) lw6sys_build_get_enable_mod_http: See 4.15.20. (line 9393) lw6sys_build_get_enable_mod_ogg: See 4.15.20. (line 9388) lw6sys_build_get_enable_optimize: See 4.15.20. (line 9398) lw6sys_build_get_enable_paranoid: See 4.15.20. (line 9413) lw6sys_build_get_enable_profiler: See 4.15.20. (line 9430) lw6sys_build_get_enable_valgrind: See 4.15.20. (line 9442) lw6sys_build_get_endianness: See 4.15.20. (line 9269) lw6sys_build_get_gcc_version: See 4.15.20. (line 9215) lw6sys_build_get_hostname: See 4.15.20. (line 9239) lw6sys_build_get_includedir: See 4.15.20. (line 9348) lw6sys_build_get_ldflags: See 4.15.20. (line 9229) lw6sys_build_get_libdir: See 4.15.20. (line 9337) lw6sys_build_get_license: See 4.15.20. (line 9200) lw6sys_build_get_localedir: See 4.15.20. (line 9358) lw6sys_build_get_md5sum: See 4.15.20. (line 9180) lw6sys_build_get_package_name: See 4.15.20. (line 9116) lw6sys_build_get_package_string: See 4.15.20. (line 9128) lw6sys_build_get_package_tarname: See 4.15.20. (line 9106) lw6sys_build_get_pointer_size: See 4.15.20. (line 9275) lw6sys_build_get_prefix: See 4.15.20. (line 9318) lw6sys_build_get_stamp: See 4.15.20. (line 9162) lw6sys_build_get_target_cpu: See 4.15.20. (line 9262) lw6sys_build_get_target_os: See 4.15.20. (line 9285) lw6sys_build_get_time: See 4.15.20. (line 9254) lw6sys_build_get_top_srcdir: See 4.15.20. (line 9302) lw6sys_build_get_version: See 4.15.20. (line 9140) lw6sys_build_is_mac_os_x: See 4.15.20. (line 9297) lw6sys_build_is_ms_windows: See 4.15.20. (line 9291) lw6sys_build_is_x86: See 4.15.20. (line 9280) lw6sys_build_log_all: See 4.15.20. (line 9447) lw6sys_calloc: See 4.15.20. (line 10817) lw6sys_check_id: See 4.15.20. (line 10467) lw6sys_check_id_16: See 4.15.20. (line 10446) lw6sys_check_id_32: See 4.15.20. (line 10453) lw6sys_check_id_64: See 4.15.20. (line 10460) lw6sys_check_mutex_count: See 4.15.20. (line 10959) lw6sys_check_thread_count: See 4.15.20. (line 11840) lw6sys_check_types_size: See 4.15.20. (line 10902) lw6sys_checksum: See 4.15.20. (line 9454) lw6sys_checksum_int32: See 4.15.20. (line 9481) lw6sys_checksum_int64: See 4.15.20. (line 9492) lw6sys_checksum_str: See 4.15.20. (line 9472) lw6sys_checksum_update: See 4.15.20. (line 9523) lw6sys_checksum_update_int32: See 4.15.20. (line 9551) lw6sys_checksum_update_int64: See 4.15.20. (line 9564) lw6sys_checksum_update_str: See 4.15.20. (line 9538) lw6sys_checksum_update_whd: See 4.15.20. (line 9577) lw6sys_checksum_update_xyz: See 4.15.20. (line 9590) lw6sys_checksum_whd: See 4.15.20. (line 9502) lw6sys_checksum_xyz: See 4.15.20. (line 9512) lw6sys_clear_file: See 4.15.20. (line 9975) lw6sys_clear_memory_bazooka: See 4.15.20. (line 9030) lw6sys_color_8_solid: See 4.15.20. (line 9783) lw6sys_color_8_to_a: See 4.15.20. (line 9700) lw6sys_color_8_to_f: See 4.15.20. (line 9628) lw6sys_color_8_to_i: See 4.15.20. (line 9649) lw6sys_color_a_to_8: See 4.15.20. (line 9678) lw6sys_color_a_to_f: See 4.15.20. (line 9688) lw6sys_color_average: See 4.15.20. (line 9732) lw6sys_color_char2float: See 4.15.20. (line 9610) lw6sys_color_distance: See 4.15.20. (line 9760) lw6sys_color_f_solid: See 4.15.20. (line 9790) lw6sys_color_f_to_8: See 4.15.20. (line 9619) lw6sys_color_f_to_i: See 4.15.20. (line 9639) lw6sys_color_float2char: See 4.15.20. (line 9602) lw6sys_color_hsv_to_rgb: See 4.15.20. (line 9722) lw6sys_color_i_to_8: See 4.15.20. (line 9670) lw6sys_color_i_to_f: See 4.15.20. (line 9660) lw6sys_color_is_same: See 4.15.20. (line 9774) lw6sys_color_ponderate: See 4.15.20. (line 9744) lw6sys_color_rgb_to_hsv: See 4.15.20. (line 9710) lw6sys_create_dir: See 4.15.20. (line 11172) lw6sys_create_dir_silent: See 4.15.20. (line 11180) lw6sys_debug_get: See 4.15.20. (line 9848) lw6sys_debug_set: See 4.15.20. (line 9851) lw6sys_default_memory_bazooka: See 4.15.20. (line 9022) lw6sys_delay: See 4.15.20. (line 11879) lw6sys_dir_exists: See 4.15.20. (line 11165) lw6sys_dump: See 4.15.20. (line 9863) lw6sys_dump_clear: See 4.15.20. (line 9856) lw6sys_env_concat: See 4.15.20. (line 9890) lw6sys_env_exists: See 4.15.20. (line 9900) lw6sys_env_separator_char: See 4.15.20. (line 9875) lw6sys_env_separator_str: See 4.15.20. (line 9882) lw6sys_env_split: See 4.15.20. (line 9940) lw6sys_eol: See 4.15.20. (line 11732) lw6sys_false: See 4.15.20. (line 10969) lw6sys_file_exists: See 4.15.20. (line 11157) lw6sys_free: See 4.15.20. (line 10851) lw6sys_free_callback: See 4.15.20. (line 10867) lw6sys_ftoa: See 4.15.20. (line 9839) lw6sys_generate_id_16: See 4.15.20. (line 10425) lw6sys_generate_id_32: See 4.15.20. (line 10432) lw6sys_generate_id_64: See 4.15.20. (line 10439) lw6sys_get_config_file: See 4.15.20. (line 11060) lw6sys_get_cwd: See 4.15.20. (line 11033) lw6sys_get_data_dir: See 4.15.20. (line 11103) lw6sys_get_default_config_file: See 4.15.20. (line 10984) lw6sys_get_default_data_dir: See 4.15.20. (line 11008) lw6sys_get_default_log_file: See 4.15.20. (line 10991) lw6sys_get_default_map_dir: See 4.15.20. (line 11013) lw6sys_get_default_map_path: See 4.15.20. (line 11018) lw6sys_get_default_mod_dir: See 4.15.20. (line 11002) lw6sys_get_default_prefix: See 4.15.20. (line 10997) lw6sys_get_default_script_file: See 4.15.20. (line 11024) lw6sys_get_default_user_dir: See 4.15.20. (line 10977) lw6sys_get_home: See 4.15.20. (line 9949) lw6sys_get_hostname: See 4.15.20. (line 9968) lw6sys_get_log_file: See 4.15.20. (line 11071) lw6sys_get_map_dir: See 4.15.20. (line 11114) lw6sys_get_map_path: See 4.15.20. (line 11125) lw6sys_get_memory_bazooka_free_count: See 4.15.20. (line 9075) lw6sys_get_memory_bazooka_malloc_count: See 4.15.20. (line 9067) lw6sys_get_memory_bazooka_malloc_max: See 4.15.20. (line 9083) lw6sys_get_memory_bazooka_size: See 4.15.20. (line 9050) lw6sys_get_mod_dir: See 4.15.20. (line 11092) lw6sys_get_mutex_lock_count: See 4.15.20. (line 10947) lw6sys_get_mutex_unlock_count: See 4.15.20. (line 10953) lw6sys_get_prefix: See 4.15.20. (line 11082) lw6sys_get_run_dir: See 4.15.20. (line 11038) lw6sys_get_script_file: See 4.15.20. (line 11136) lw6sys_get_thread_create_count: See 4.15.20. (line 11828) lw6sys_get_thread_join_count: See 4.15.20. (line 11834) lw6sys_get_user_dir: See 4.15.20. (line 11049) lw6sys_get_username: See 4.15.20. (line 9958) lw6sys_getenv: See 4.15.20. (line 9913) lw6sys_hash_dup: See 4.15.20. (line 10128) lw6sys_hash_free: See 4.15.20. (line 10027) lw6sys_hash_get: See 4.15.20. (line 10046) lw6sys_hash_has_key: See 4.15.20. (line 10035) lw6sys_hash_keys: See 4.15.20. (line 10085) lw6sys_hash_map: See 4.15.20. (line 10097) lw6sys_hash_new: See 4.15.20. (line 10009) lw6sys_hash_set: See 4.15.20. (line 10058) lw6sys_hash_sort_and_map: See 4.15.20. (line 10113) lw6sys_hash_unset: See 4.15.20. (line 10075) lw6sys_hexa_serializer_as_string: See 4.15.20. (line 10181) lw6sys_hexa_serializer_eof: See 4.15.20. (line 10171) lw6sys_hexa_serializer_free: See 4.15.20. (line 10153) lw6sys_hexa_serializer_new: See 4.15.20. (line 10142) lw6sys_hexa_serializer_pop_color: See 4.15.20. (line 10376) lw6sys_hexa_serializer_pop_float: See 4.15.20. (line 10329) lw6sys_hexa_serializer_pop_int16: See 4.15.20. (line 10309) lw6sys_hexa_serializer_pop_int32: See 4.15.20. (line 10299) lw6sys_hexa_serializer_pop_int64: See 4.15.20. (line 10289) lw6sys_hexa_serializer_pop_int8: See 4.15.20. (line 10319) lw6sys_hexa_serializer_pop_str: See 4.15.20. (line 10339) lw6sys_hexa_serializer_pop_whd: See 4.15.20. (line 10364) lw6sys_hexa_serializer_pop_xyz: See 4.15.20. (line 10352) lw6sys_hexa_serializer_push_color: See 4.15.20. (line 10279) lw6sys_hexa_serializer_push_float: See 4.15.20. (line 10232) lw6sys_hexa_serializer_push_int16: See 4.15.20. (line 10212) lw6sys_hexa_serializer_push_int32: See 4.15.20. (line 10202) lw6sys_hexa_serializer_push_int64: See 4.15.20. (line 10192) lw6sys_hexa_serializer_push_int8: See 4.15.20. (line 10222) lw6sys_hexa_serializer_push_str: See 4.15.20. (line 10242) lw6sys_hexa_serializer_push_whd: See 4.15.20. (line 10267) lw6sys_hexa_serializer_push_xyz: See 4.15.20. (line 10255) lw6sys_hexa_serializer_rewind: See 4.15.20. (line 10161) lw6sys_history_free: See 4.15.20. (line 10406) lw6sys_history_get: See 4.15.20. (line 10398) lw6sys_history_init: See 4.15.20. (line 10385) lw6sys_history_register: See 4.15.20. (line 10391) lw6sys_id_atol: See 4.15.20. (line 10483) lw6sys_id_ltoa: See 4.15.20. (line 10474) lw6sys_idle: See 4.15.20. (line 11890) lw6sys_is_big_endian: See 4.15.20. (line 10890) lw6sys_is_little_endian: See 4.15.20. (line 10896) lw6sys_is_memory_bazooka_trustable: See 4.15.20. (line 9092) lw6sys_itoa: See 4.15.20. (line 9821) lw6sys_keyword_as_arg: See 4.15.20. (line 10503) lw6sys_keyword_as_env: See 4.15.20. (line 10511) lw6sys_keyword_as_key: See 4.15.20. (line 10493) lw6sys_keyword_as_xml: See 4.15.20. (line 10520) lw6sys_list_dup: See 4.15.20. (line 10668) lw6sys_list_free: See 4.15.20. (line 10540) lw6sys_list_is_empty: See 4.15.20. (line 10556) lw6sys_list_length: See 4.15.20. (line 10566) lw6sys_list_map: See 4.15.20. (line 10575) lw6sys_list_new: See 4.15.20. (line 10529) lw6sys_list_next: See 4.15.20. (line 10548) lw6sys_list_pop_back: See 4.15.20. (line 10648) lw6sys_list_pop_front: See 4.15.20. (line 10611) lw6sys_list_push_back: See 4.15.20. (line 10631) lw6sys_list_push_front: See 4.15.20. (line 10594) lw6sys_locale_to_utf8: See 4.15.20. (line 10413) lw6sys_log: See 4.15.20. (line 10701) lw6sys_log_clear: See 4.15.20. (line 10691) lw6sys_log_critical: See 4.15.20. (line 10725) lw6sys_log_get_level: See 4.15.20. (line 10737) lw6sys_log_set_file: See 4.15.20. (line 10682) lw6sys_log_set_level: See 4.15.20. (line 10739) lw6sys_malloc: See 4.15.20. (line 10800) lw6sys_math_angle_360: See 4.15.20. (line 10766) lw6sys_math_blink: See 4.15.20. (line 10790) lw6sys_math_heartbeat: See 4.15.20. (line 10778) lw6sys_math_poly_wy1y2s1: See 4.15.20. (line 10745) lw6sys_megabytes_available: See 4.15.20. (line 10883) lw6sys_memory_bazooka_report: See 4.15.20. (line 9098) lw6sys_mutex_create: See 4.15.20. (line 10909) lw6sys_mutex_destroy: See 4.15.20. (line 10914) lw6sys_mutex_lock: See 4.15.20. (line 10921) lw6sys_mutex_trylock: See 4.15.20. (line 10930) lw6sys_mutex_unlock: See 4.15.20. (line 10940) lw6sys_new_sprintf: See 4.15.20. (line 11665) lw6sys_options_log: See 4.15.20. (line 11147) lw6sys_options_log_defaults: See 4.15.20. (line 11029) lw6sys_path_add_slash: See 4.15.20. (line 11190) lw6sys_path_concat: See 4.15.20. (line 11208) lw6sys_path_is_cwd: See 4.15.20. (line 11236) lw6sys_path_is_relative: See 4.15.20. (line 11229) lw6sys_path_parent: See 4.15.20. (line 11243) lw6sys_path_split: See 4.15.20. (line 11219) lw6sys_path_strip_slash: See 4.15.20. (line 11199) lw6sys_path_unparent: See 4.15.20. (line 11251) lw6sys_path_unparent_no_malloc: See 4.15.20. (line 11259) lw6sys_print_xml_footer: See 4.15.20. (line 11278) lw6sys_print_xml_header: See 4.15.20. (line 11270) lw6sys_profiler_check: See 4.15.20. (line 11286) lw6sys_progress_begin: See 4.15.20. (line 11381) lw6sys_progress_default: See 4.15.20. (line 11297) lw6sys_progress_end: See 4.15.20. (line 11396) lw6sys_progress_half: See 4.15.20. (line 11388) lw6sys_progress_split: See 4.15.20. (line 11329) lw6sys_progress_split3: See 4.15.20. (line 11342) lw6sys_progress_split4: See 4.15.20. (line 11355) lw6sys_progress_split5: See 4.15.20. (line 11369) lw6sys_progress_update: See 4.15.20. (line 11308) lw6sys_random: See 4.15.20. (line 11403) lw6sys_random_float: See 4.15.20. (line 11414) lw6sys_read_file_content: See 4.15.20. (line 9984) lw6sys_realloc: See 4.15.20. (line 10835) lw6sys_sdl_register: See 4.15.20. (line 11422) lw6sys_sdl_unregister: See 4.15.20. (line 11429) lw6sys_serialize_int16: See 4.15.20. (line 11471) lw6sys_serialize_int32: See 4.15.20. (line 11454) lw6sys_serialize_int64: See 4.15.20. (line 11437) lw6sys_set_memory_bazooka_eraser: See 4.15.20. (line 9057) lw6sys_set_memory_bazooka_size: See 4.15.20. (line 9035) lw6sys_setenv: See 4.15.20. (line 9927) lw6sys_shape_check_min_max_whd: See 4.15.20. (line 11488) lw6sys_shape_check_pos: See 4.15.20. (line 11503) lw6sys_shape_is_same: See 4.15.20. (line 11513) lw6sys_skip_blanks: See 4.15.20. (line 11700) lw6sys_sleep: See 4.15.20. (line 11872) lw6sys_sort: See 4.15.20. (line 11597) lw6sys_sort_float_callback: See 4.15.20. (line 11547) lw6sys_sort_float_desc_callback: See 4.15.20. (line 11559) lw6sys_sort_int_callback: See 4.15.20. (line 11523) lw6sys_sort_int_desc_callback: See 4.15.20. (line 11535) lw6sys_sort_str_callback: See 4.15.20. (line 11572) lw6sys_sort_str_desc_callback: See 4.15.20. (line 11584) lw6sys_spinlock_create: See 4.15.20. (line 11608) lw6sys_spinlock_destroy: See 4.15.20. (line 11613) lw6sys_spinlock_lock: See 4.15.20. (line 11620) lw6sys_spinlock_trylock: See 4.15.20. (line 11629) lw6sys_spinlock_unlock: See 4.15.20. (line 11639) lw6sys_str_cleanup: See 4.15.20. (line 11708) lw6sys_str_concat: See 4.15.20. (line 11655) lw6sys_str_copy: See 4.15.20. (line 11646) lw6sys_str_is_blank: See 4.15.20. (line 11680) lw6sys_str_is_same: See 4.15.20. (line 11688) lw6sys_str_reformat: See 4.15.20. (line 11720) lw6sys_str_split: See 4.15.20. (line 11743) lw6sys_str_split_no_0: See 4.15.20. (line 11753) lw6sys_test: See 4.15.20. (line 11763) lw6sys_thread_create: See 4.15.20. (line 11774) lw6sys_thread_get_data: See 4.15.20. (line 11810) lw6sys_thread_get_id: See 4.15.20. (line 11802) lw6sys_thread_is_callback_done: See 4.15.20. (line 11794) lw6sys_thread_join: See 4.15.20. (line 11818) lw6sys_time_init: See 4.15.20. (line 11896) lw6sys_timer_update: See 4.15.20. (line 11863) lw6sys_timestamp: See 4.15.20. (line 11848) lw6sys_true: See 4.15.20. (line 10965) lw6sys_unserialize_int16: See 4.15.20. (line 11481) lw6sys_unserialize_int32: See 4.15.20. (line 11464) lw6sys_unserialize_int64: See 4.15.20. (line 11447) lw6sys_uptime: See 4.15.20. (line 11856) lw6sys_vthread_create: See 4.15.20. (line 11937) lw6sys_vthread_is_running: See 4.15.20. (line 11923) lw6sys_vthread_join: See 4.15.20. (line 11954) lw6sys_vthread_run: See 4.15.20. (line 11901) lw6sys_write_file_content: See 4.15.20. (line 9996) lw6tsk_loader_free: See 4.15.21. (line 11977) lw6tsk_loader_get_stage: See 4.15.21. (line 11992) lw6tsk_loader_new: See 4.15.21. (line 11967) lw6tsk_loader_repr: See 4.15.21. (line 11985) map-path: See 4.4.5. (line 3467) max-cursor-pot: See 4.9.7. (line 3869) max-cursor-pot-offset: See 4.9.8. (line 3883) max-map-height: See 4.10.5. (line 4665) max-map-surface: See 4.10.6. (line 4682) max-map-width: See 4.10.7. (line 4697) max-nb-cursors: See 4.9.9. (line 3900) max-nb-servers: See 4.9.10. (line 3914) max-nb-teams: See 4.9.11. (line 3928) max-round-delta: See 4.9.12. (line 3941) max-zone-size: See 4.9.13. (line 3956) memory-bazooka-eraser: See 4.12.32. (line 5963) memory-bazooka-size: See 4.12.33. (line 5983) menu-color-auto: See 4.10.8. (line 4714) menu-color-default-bg: See 4.11.21. (line 5136) menu-color-default-fg: See 4.11.22. (line 5149) menu-color-disabled-bg: See 4.11.23. (line 5164) menu-color-disabled-fg: See 4.11.24. (line 5177) menu-color-selected-bg: See 4.11.25. (line 5190) menu-color-selected-fg: See 4.11.26. (line 5203) menu-style: See 4.11.27. (line 5216) min-map-height: See 4.10.9. (line 4733) min-map-surface: See 4.10.10. (line 4750) min-map-width: See 4.10.11. (line 4765) moves-per-round: See 4.9.14. (line 3979) music-volume: See 4.6.1. (line 3630) nb-attack-tries: See 4.9.15. (line 3997) nb-defense-tries: See 4.9.16. (line 4015) nb-move-tries: See 4.9.17. (line 4032) pilot-lag: See 4.12.36. (line 6024) pixelize: See 4.11.28. (line 5229) resample: See 4.10.12. (line 4782) respawn-team: See 4.9.18. (line 4053) round-delta: See 4.9.19. (line 4069) rounds-per-sec: See 4.9.20. (line 4094) side-attack-factor: See 4.9.21. (line 4111) side-defense-factor: See 4.9.22. (line 4128) single-army-size: See 4.9.23. (line 4141) snd-backend: See 4.6.2. (line 3643) sound-volume: See 4.6.3. (line 3656) spread-thread: See 4.9.24. (line 4159) spreads-per-round: See 4.9.25. (line 4176) start-blue-x: See 4.9.26. (line 4195) start-blue-y: See 4.9.27. (line 4208) start-cyan-x: See 4.9.28. (line 4221) start-cyan-y: See 4.9.29. (line 4234) start-green-x: See 4.9.30. (line 4247) start-green-y: See 4.9.31. (line 4260) start-lightblue-x: See 4.9.32. (line 4273) start-lightblue-y: See 4.9.33. (line 4286) start-magenta-x: See 4.9.34. (line 4299) start-magenta-y: See 4.9.35. (line 4312) start-orange-x: See 4.9.36. (line 4325) start-orange-y: See 4.9.37. (line 4338) start-pink-x: See 4.9.38. (line 4351) start-pink-y: See 4.9.39. (line 4364) start-position-mode: See 4.9.40. (line 4377) start-purple-x: See 4.9.41. (line 4393) start-purple-y: See 4.9.42. (line 4406) start-red-x: See 4.9.43. (line 4419) start-red-y: See 4.9.44. (line 4432) start-yellow-x: See 4.9.45. (line 4445) start-yellow-y: See 4.9.46. (line 4458) system-color-auto: See 4.10.13. (line 4796) system-color-bg: See 4.11.29. (line 5243) system-color-fg: See 4.11.30. (line 5257) target-fps: See 4.12.41. (line 6072) team-color-blue: See 4.11.31. (line 5271) team-color-cyan: See 4.11.32. (line 5284) team-color-green: See 4.11.33. (line 5297) team-color-lightblue: See 4.11.34. (line 5310) team-color-magenta: See 4.11.35. (line 5323) team-color-orange: See 4.11.36. (line 5336) team-color-pink: See 4.11.37. (line 5349) team-color-purple: See 4.11.38. (line 5362) team-color-red: See 4.11.39. (line 5375) team-color-yellow: See 4.11.40. (line 5388) total-armies-size: See 4.9.47. (line 4471) total-time: See 4.9.48. (line 4492) use-hints-xml: See 4.8.3. (line 3707) use-rules-xml: See 4.8.4. (line 3720) use-style-xml: See 4.8.5. (line 3734) use-texture: See 4.8.6. (line 3749) user-dir: See 4.4.9. (line 3539) vertical-move: See 4.9.49. (line 4510) view-color-auto: See 4.10.14. (line 4813) view-color-cursor-bg: See 4.11.41. (line 5401) view-color-cursor-fg: See 4.11.42. (line 5415) view-color-map-bg: See 4.11.43. (line 5429) view-color-map-fg: See 4.11.44. (line 5444) view-style: See 4.11.45. (line 5459) width: See 4.5.4. (line 3597) windowed-mode-limit: See 4.5.5. (line 3611) x-polarity: See 4.9.50. (line 4526) x-wrap: See 4.11.46. (line 5475) y-polarity: See 4.9.51. (line 4545) y-wrap: See 4.11.47. (line 5491) z-polarity: See 4.9.52. (line 4564) zoom: See 4.11.48. (line 5507) zoom-max: See 4.11.49. (line 5521) zoom-min: See 4.11.50. (line 5535)