http://www.teaser.fr/~amajorel/yadex/yadex-1.6.0.diff.gz WHAT IS THIS This is a patch to turn Yadex 1.5.2 into Yadex 1.6.0. To apply, cd into the directory where the Yadex 1.5.2 source is and type gzip -d 3) zoom factor, sometimes the + sector actually appeared on the window, even though it was supposed + to be a few thousand pixels off-screen. I don't know if the + "oddity" is in Xlib, in the X server or in my video card but, + interestingly, the symptoms show up only when drawing horizontal or + vertical lines on the window, not when drawing oblique lines or on + the pixmap. + + Since it only occurs at high zoom factors, it must be some sort of + overflow error though it doesn't look like a 32-bit value being + truncated to 16 bits because the values are too small. Strange. I + dumbly worked around it by skipping off-screen objects. + + * Editing: A linedef, thing or vertex is highlighted if the pointer + is within 15 pixels of it. Previously, the threshold was 20 map + units which was too narrow at low zoom factors and too broad at + high zoom factors. This change makes drawing selection boxes in + crowded areas much easier than before. + + * Editing: Configuration variables thing_fudge and vertex_fudge are + gone, since they've been made irrelevant by changes in the + highlighting code. + + * Editing: If the pointer is within highlighting distance of more + than one thing, the one that is highlighted is the one in which the + pointer is, or the one that has the smallest radius, or the one + whose centre is nearest. Previously, the lowest-numbered one was + highlighted, making it impossible to select, say, a high numbered + baron standing in the same spot as an arachnotron. + + * Editing: Restored [Shift][Ins] that was inadvertently disabled + during the port to X. Thanks to Ingo van Lil for reporting this + bug. + + * Editing: If a linedef has a negative tag, tagged sectors are now + shown. + + * Editing: As per Ingo van Lil's suggestion, if a linedef is tagged + to more than one sector, a "+" is appended to the sector number in + the object info window. Similarly, if a sector is tagged to more + than one linedef, a "+" is appended to the linedef number in the + object info window. + + * Editing: In the object info window, tag 667 is now marked as + special. Yadex catches up with that newfangled Doom II thing. + + * Editing: The static text in the object info boxes is now a bit + dimmer to make the important information stand out. + + * Editing: Started working on a global mode, where you can work with + all types of objects at once, vertices, linedefs, sectors and + things. It's toggled by pressing [Ctrl][g] in the editing window. + Since it's an experimental feature, it comes with a big fat + warning, that you should take seriously. One known bug is that + selection is broken is this mode. Overhauled GetCurObject() to make + it able to cope with global mode. + + * Editing: [1] through [9] and [0] are now configurable through the + new variables "digit_zoom_base" and "digit_zoom_step". The default + values are set to roughly emulate the old behaviour but it's now + possible to have the zoom factor increase across the keyboard, for + instance. Patch by AJA. + + * Editing: New variable "blindly_swap_sidedefs" to prevent Yadex from + asking for confirmation when swapping sidedefs. Patch by AJA. + + * Editing: Placeat AJA, it's now possible to toggle the object info + boxes with [i]. Toggling the info bar is now bound to [Alt][i]. + + * Editing: The "Info bar" item has been moved from the "Help" menu to + the "View" menu. Fixed misplaced underscore in linedef "Misc" menu. + Fixed misplaced tick marks (thanks to Ingo van Lil) and added + separations in the "View" menu. Added missing ellipses here and + there. + + * Editing: Removed the sudden jump (down) in the size of the vertices + when zooming in. + + * Editing: Sectors are now shown in one of three colours : green for + sectors that have a tag, blue for sectors that have a type and cyan + for sectors that have both. Previously, all tagged sectors looked + the same, whether they had a type or not. + + * Editing: Integer entry: you can now enter hexadecimal or octal + numbers by prefixing them with "0x" or "0", as in C. This should + make it easier to enter Boom generalized types. You are now allowed + to start the number with an explicit plus sign ("+"). The lower + limit has been pushed from -32,749 to -32,768. The upper limit has + been pushed from +32,749 to +32,767. For consistency with the rest + of the interface, if the current entry is invalid, it is shown in + red instead of dim grey. You are allowed to type more characters, + even if the current entry is invalid ([Return] is still disabled, + however). The message in InputIntegerValue() has been changed from + "Enter a decimal number" to "Enter a number". + + * Editing: Fixed segfault on "Save as..." on a new level (i.e. opened + with the "create" command). This bug was there ever since 1.1. + + * Editing: On a new level (opened with the "create" command), the + level name and file name are now remembered so you don't have to + enter them again every time you save. + + * Editing: New function "cut a slice out of a sector" to easily split + doughnut-shaped sectors. Shortcut is [Ctrl][k]. See + users_guide.html for details. Thanks to Jim Flynn for writing a + similar function in DETH, which I used as a reference. + + * Editing: Setting things flags by value now allows any value between + 0 and 65,535 (instead of 1 through 31). The word "decimal" has been + removed from the menu item since you can now enter hexadecimal as + well. + + * Editing: [n], [p], [<] and [>] work properly even if no object was + highlighted. + + * Editing: In linedef mode, linedefs that have no first sidedef, or a + bad sidedef number are drawn in red. + + * Game/wad: MBF: changed the radius of the dog from 16 to 12. Thanks + to AJA for pointing it out. + + * Game/wad: Boom: added all of Boom's 130 non-generalized linedef + types to doom.ygd and doom2.ygd. New "elevator" linedef type group. + Many thanks to AJA for typing in the ygd data. + + * Game/wad: Linedef types 33 and 34 were incorrectly labelled "yel" + and "red" instead of the other way around. Thanks to Ingo van Lil + for pointing this out. + + * Game/wad: Linedef type 96 was incorrectly marked "W1" instead of + "WR". Spotted by IvL. + + * Game/wad: Hexen: added to hexen.ygd a couple of things types and + most sector and linedef types. Linedefs now have their tag set to + arg1. It used to be left uninitialized, which is why so many + linedefs were shown in red on the map. + + * Game/wad: Linedef types 105 and 111 had their descriptions + reversed. Don't blindly trust the UDS. Spotted by AJA. + + * Game/wad: Gave a sprite to Doom thing type 23 (dead lost soul), + SKULK. + + * Game/wad: Strife: definitions for thing types 10, 27, 46, 50, 81, + 137, 138, 2018, 2019 and 2026. + + * Game/wad: Hexen: definitions for things 122, 124 and 8004. + + * Misc: Flat/patch/sprite/texture viewer: restored ability to save to + file by pressing [Shift][F1]. + + * Misc: Flat/patch/sprite/texture viewer: not unnecessarily + refreshing the whole image window anymore when browsing patches or + sprites. + + * Misc: Texture viewer: new bindings [Ctrl][a] [Ctrl][x] to change + the number of patches shown. + + * Misc: Most I/O errors occurring while reading wads are now handled + gracefully (fewer gratuitous calls to fatal_error()). + + * Misc: The menu code (menu.cc and oldmenus.cc) has been partly + rewritten. Made the automatic shortcuts case-sensitive to allow up + to 61 entries instead of just 35. Option numbers shortcuts are + framed with dimmer square brackets, instead of parentheses. + Implemented separations. Two extra pixels of space between lines. + Tick marks now look like tick marks, not asterisks. Unticked + entries now have a dash in front of them. + + * Misc: The search paths for game definition files and configuration + files have changed in several ways. + + Some config file search directories have changed for conformance to + the FHS. If the prefix is "/usr/local", the path is now "/etc/ + yadex" instead of "/usr/local/etc/yadex". If the prefix is "/opt/ + something", the path is now "/etc/opt/something" instead of "/opt/ + something/etc/yadex". The practical consequence for the 90% of you + who install in /usr/local is that the system-wide config file has + moved from /usr/local/etc to /etc. + + Overriding the prefix now actually works for other prefixes than / + usr and /usr/local. The problem was that, even though the makefile + installed the files in the proper directories, the yadex binary + looked for them in /etc, /usr and /usr/local, regardless of the + prefix. Thanks to Oliver Kraus and Udo Munk for clueing me in. + + Yadex used to look for files in places where it shouldn't have. For + example, it looked for game definition files in /usr even if + compiled for /usr/local and vice-versa. Yadex now looks for files + only in the places corresponding to the prefix it was compiled for. + This makes it possible to have several builds of the same version + of Yadex on the same machine without unwanted interactions, as long + as they're compiled for different prefixes. Note, however, that / + etc/yadex is used by both /usr and /usr/local but that is mandated + by the FHS and there's nothing I can do. + + The search directories relative to $YADEX_DIR have been removed + from the Unix version (they were intended for DOS). + + See users_guide.html for the exact contents of the new search + paths. + + * Misc: Config file: bumped the config file version# from 3 to 4. + + * Misc: Fixed strange reactions to percent character ("%") in the + file name entry box. + + * Misc: Slightly less chaotic output in verbose mode. + + * Misc: Fixed a memory leak that occurred when repeatedly reloading a + wad. This log entry is particularly delightful because that leak + was introduced by me in version 1.5.0 while trying to fix a bug in + the same code that was, guess what, an fd leak. For the + historically minded, that fd leak goes back to at least DEU 5.21. + Try it. It's easily exercised by loading the same wad over and + over. After about 20 iterations, you are rewarded with "patch wad + file xxx doesn't exist. Ignored.". + + * Misc: Removed from the makefile unflattering comments on bzip2's + celerity that came from using an old version. + + * Misc: Decapitalised object type names (GetObjectTypeName()). + + * Misc: Fixed display bug in sector# and sidedef# entry box + (InputObjectXref()). + + * Misc: The config file search algorithm has been modified to support + multiple config files. The old algorithm was to walk the search + path front to back and stop at the first match. The new algorithm + is to walk the path back to front and use all the matches. Thus + local files inherit parameter settings from global files and still + have the possibility to selectively override them (i.e. you can + override some parameters and inherit the others). + + For example, assuming /etc/yadex/1.6.0/yadex.cfg contains : + + a = old + b = old + + and ./yadex.cfg contains : + + a = new + c = new + + the net effect is : + + a = new + b = old + c = new + + The motivation for the change was to allow users to put most of + their settings in global config files, either system wide or + per-user. When local files exist, they should contain only the + minimum, i.e. just those settings you want to override. This way of + doing has several advantages over the previous all-or-nothing + system. Obviously, you can now change a setting globally by editing + just one file, even if you have many local config files. Upgrades + are also smoother because any new variable definitions appearing in + global config files propagate even if local config files exist. + Finally, it's much easier to figure what local files are meant to + do because everything they contain is meaningful. + + * Misc: Removed the start-up message stating that "this program is + derived from DEU 5.21 by Raphaël Quinet and Brendon Wyber" (for + clarity, not because I'm in denial). + + * Platform: On DOS, the PPM files created by "make_palette_ppm" and + "mp2" now have correct CRLF line terminators instead of LFCR. + + * Platform: Wart in gfx.cc to cope with QNX where DisplayWidth() and + DisplayHeight() return silly values. + + * Platform: Added support for 16-colour displays. Tested with the + XFree86 VGA16 server which, when running in 640x480x16 (VGA mode + 12h), provides a PseudoColor or StaticColor visual with an 8 bits + per pixel pixmap format. If there are any servers that expect a + pixmap format with a number of bits per pixel that is not a + multiple of 8, they're still unsupported. + + * Platform: Reworked the pixmap format selection code. Should not + change anything for most people. + + * Platform: Compiles and runs on HP-UX 10.0 (with GCC 3.0.1). + + * Platform: Compiles on Linux PPC (with GCC 3.1). Thanks to Mark + Brown for the patch. - Changes - Yadex 1.5.2 (2001-06-30) - * Platform: Compiles with GCC 3.0 (added std:: qualifiers where they - were missing and removed #ifdef inside printf()). - + * Platform: Compiles with GCC 3.0 (added std:: qualifiers where they + were missing and removed #ifdef inside printf()). + Yadex 1.5.1 (2000-12-12) - * Platform: One-line fix in menu.cc to please GCC 2.96 (of Red Hat 7 - fame). Thanks to Zebediah C. McClure for reporting the problem. - + * Platform: One-line fix in menu.cc to please GCC 2.96 (of Red Hat 7 + fame). Thanks to Zebediah C. McClure for reporting the problem. + Yadex 1.5.0 (2000-08-27) - * Build: Changed the way the diffs are generated after reading more - carefully the patch(1) man page and learning the hard way that - it's a very bad idea to put absolute paths in patches. - * Build: Made it easier to add or remove individual options in - CFLAGS and friends. - * Command-line: New option -b to benchmark parts of Yadex. For - hackers only. - * Command-line: Removed option -e in prevision of reuse for another - function. - * Doc: Completed ygd.html. - * Doc: Documented the usage of the LINES and YADEX_DIR environment - variables. - * Editing: Things that have an illegal angle are now shown with the - angle Doom would see, instead of just a dot in the middle. The - emulation is believed to be accurate for angles comprised between - 0 and 359. Values outside that range have not been tested. - * Editing: Things flags and linedefs flags now grouped by 4 for - readability. For linedefs, the decimal value of the flags field is - not shown anymore. - * Editing: In the object info box, the type and description of the - current thing are now display in red if the type is invalid (i.e. - not defined in the .ygd). - * Editing: The things and linedefs flags operations ([a], [b], [c]) - now set MadeChanges as they should have from the start. - * Editing: The View menu now contains entries for "Show object - numbers" [&] and "Show grid" [h]. - * Editing: The Edit menu now contains entries for "Snap to grid" [y] - and "Loc grid step" [z]. - * Editing: Rearranged the sidedef object info windows so that the - textures are listed in a more intuitive order (upper, middle, - lower instead of middle, upper, lower). Made labels shorter in - preparation of the hypothetical inclusion of texture swatches in - the future. - * Editing: Fixed long-standing buglet with the sidedef info saying - there are missing upper/lower textures even though both sectors - have a "sky" ceiling/floor. - * Editing: Implemented showing object numbers for linedefs and - sectors. The placement of sector numbers is naive and inadequate - for sectors that don't have a simple convex shape, but it's still - better than nothing. Picked a somewhat brighter colour for object - numbers. - * Editing: Linedef object info box: if the first sidedef is missing, - the message "(no first sidedef)" is printed in red instead of dim - gray. Same thing for the second sidedef if the "2" flag is set. - * Editing: Removed careless dereferencing of SideDefs[] for bad - sidedef numbers in the sector selection code. I don't think this - is what caused the mysterious unreproducible segfault James - Caldwell reported, though. Made the object deletion function - paranoid (checks that the objects to delete actually exist). - * Editing: When found superimposed linedefs after merging vertices, - the dialog box that asks whether they should be merged now - mentions the numbers of the first two superimposed linedefs found - instead of a laconic "Some linedefs are superimposed". - * Editing: Zooming: the zoom factor is now displayed in percent, - 100% being 1/1. - * Editing: Zooming: the zoom factors are now regularly spaced, with - a ratio of 1.414 between them. This removes the annoying "jump" - between the zoom factors greater than 1/2. It also fixes the - oddities that happened when zooming in after [`]. The ratio - between zoom factors can be controlled through the new parameter - "zoom_step". - * Editing: Zooming: the "zoom" parameter has been replaced by the - new parameter "zoom_default". The latter is expressed in percent, - not in 1/n units. It's now possible to specify an initial zoom - factor of more than 1/1. When opening a new window, Yadex now - adjusts the zoom factor so that the level fills the window. Should - you want to revert to the old behaviour, you can do it by setting - zoom_default to 12. - * Editing: ['] and [`] now go to the current centre of the level - (they used to go to where the centre was when the level was opened - or created). - * Editing: [`] now has a menu item (View -> Whole level). - * Editing: The grid has changed. There are now dots every step map - units, dim lines every 4×step units, normal lines every 16×step - units and bold lines every 64×step units. The new grid is supposed - to be less obtrusive visually, faster to display and more distinct - when scrolling. - * Editing: New function to swap floor and ceiling flats of selected - sectors (Misc. operations -> Swap flats). - * Editing: When not in things mode, things are drawn in a dimmer - shade of gray and do not hide the linedefs anymore. - * Game/wad: Removed the "-g wolf" bit. [For those who still haven't - got it : the support for Wolfenstein 3D announced in the CHANGES - for version 1.4.0 was of course a hoax, 1.4.0 having been released - on April 1st.] Hope you've been having as much fun as I have. :-) - * Game/wad: Heretic: made the golem leader ghost, undead warrior - ghost and golem ghost look a little more ghostly. Made the - gargoyle leader, golem leader and golem leader ghost look - different from their vanilla counterparts by using sprites IMPXD - and MUMMY. Assigned a sprite to things 31 and 32 (enchanted - shield, SHD2 and mystic urn, SPHL). - * Game/wad: Heretic: corrected things radii in heretic.ygd, using - [1]info2ygd and the Heretic source as a reference. Almost all - radii were wrong, a few grossly so (maulotaur, ironlich and - gargoyle). - * Game/wad: Strife: many new things and linedef types thanks to - [2]Matt Miller. - * Game/wad: Doom alpha 0.4: definitions for thing types 2020, 2036, - 2038 and 2046. - * Game/wad: Updated format comments in *.ygd. - * Game/wad: Sprites in pwads now supported (between S_START/S_END or - SS_START/SS_END or SS_START/S_END). This fixes Yadex's failure to - show redefined sprites in [3]alitcsf.wad, [4]basilica.wad and - [5]strifed1.wad. A few Aliens TC sprites don't work yet but it's - for a different reason (DEH). - * Game/wad: Sprites now shown on the map when in things mode. You - can switch between sprites and squares with View -> Show sprites - [%]. New config file parameter "sprite_scale" to adjust the scale - at which sprites are displayed (default 100%). - * Game/wad: The right sprite is shown, even if the sprites are not - in alphabetical order in the wad (cf BARWA0 in Strife). - * Game/wad: The function to add pwads (be it from the command line - or with the "r" command) has been heavily reworked. It's more - robust and handles errors better. It does not leak file handles - anymore when you add the same pwad more than once. It also accepts - to add iwads, modulo a warning (though you should expect problems - later if you do that). The merging of the pwad directory into the - master directory is still lousy. - * Game/wad: Fixed duplicate entries in the flat selector. This bug - was found by "Ras2". It happened whenever you added the same flat - thrice or more. - * Game/wad: EDGE: added definitions for EDGE linedef types and - things types to doom.ygd and doom2.ygd. Thanks to [6]Andrew Apted - for providing the ygd data. - * Game/wad: EDGE: in sector mode, show information for EDGE - extrafloors if there are any. - * Misc: A couple of calls to fatal_error() were turned into calls to - report_error() (don't abort). - * Misc: New game definition file directive "sky_flat" to specify the - name of the "sky" flat. Replaced all occurrences of F_SKY1 by - references to this parameter. Fixes Check -> Check for missing - textures for Hexen and Strife. Bumped game definition file - version# to 4. - * Misc: Because it seems to disturb people (and for the pleasure of - proving Matt wrong), I've made the texture selector clip textures - to size. Since there's no scrolling/zooming system yet, I also - enlarged the viewing area from 256×128 to 512×256 to alleviate the - lossage on large textures. - * Misc: Removed the "Press Shift-F1 to save image to file" text in - the selector. It's been a no-op ever since 1.0, anyway. - * Misc: In the selectors, pressing [F1] prints the location of the - current item to stdout (file name and offset). Works with flats, - patches and sprites but not textures. It's there to help trace - Ras' bug. - * Misc: Made LoadPicture() nicer and safer. It gracefully bails out - if there are more than 20 errors on a single picture. It does not - make Yadex abort anymore on read errors in the header or column - offset table. I've done this by modifying wad_read_i16() and - wad_read_i32() so other functions might have been impacted. - * Misc: Config file: commented out most settings (this has no - visible effect since those settings were just reiterations of the - default values built into the executable). Also changed the - initialization code so that Yadex can run without a config file. - * Misc: Config file: unknown variables are ignored with a warning - instead of triggering a fatal error. The intent is to facilitate - sharing config files between versions. - * Misc: Config file: bumped version# to 3. - * Misc: Made Yadex use YADEX_GAME as documented and not Y_GAME. - Oops ! - * Misc: New feature in the flat/picture/sprite selector to show - where the current image comes from (file name and file offset). - For debugging. - * Misc: The window size (width/height and -w/-h) can now be - expressed in percent of the screen size, by appending a "%" to the - value. The default size, instead of being 640×480 in the - executable and 900×600 in the config file is now 90%×90%. It's - still possible to give absolute width and heights, of course. - * Misc: No tantrum thrown if the game definition file contains no - thing directive. - * Misc: Removed the check for sector headroom being < 1024 in Checks - -> Check for missing textures. It was sometimes annoying and - inaccurate anyway. - * Platform: Images display correctly on packed 24-bit X servers - (i.e. bits_per_pixel actually is 24 and not 32). The scanline_pad - member of the ScreenFormat structure is now honoured (not that - XFree86 seemed to mind much when it wasn't). - * Platform: Began to clean the code up to make porting less - difficult. - * Platform: Added patch to get Yadex to compile with GCC 2.7 - (patch/gcc-2.7.diff). GCC 2.7 is officially considered - unsupported, though. You're on your own. - + * Build: Changed the way the diffs are generated after reading more + carefully the patch(1) man page and learning the hard way that it's + a very bad idea to put absolute paths in patches. + + * Build: Made it easier to add or remove individual options in CFLAGS + and friends. + + * Command-line: New option -b to benchmark parts of Yadex. For + hackers only. + + * Command-line: Removed option -e in prevision of reuse for another + function. + + * Doc: Completed ygd.html. + + * Doc: Documented the usage of the LINES and YADEX_DIR environment + variables. + + * Editing: Things that have an illegal angle are now shown with the + angle Doom would see, instead of just a dot in the middle. The + emulation is believed to be accurate for angles comprised between 0 + and 359. Values outside that range have not been tested. + + * Editing: Things flags and linedefs flags now grouped by 4 for + readability. For linedefs, the decimal value of the flags field is + not shown anymore. + + * Editing: In the object info box, the type and description of the + current thing are now display in red if the type is invalid (i.e. + not defined in the .ygd). + + * Editing: The things and linedefs flags operations ([a], [b], [c]) + now set MadeChanges as they should have from the start. + + * Editing: The View menu now contains entries for "Show object + numbers" [&] and "Show grid" [h]. + + * Editing: The Edit menu now contains entries for "Snap to grid" [y] + and "Loc grid step" [z]. + + * Editing: Rearranged the sidedef object info windows so that the + textures are listed in a more intuitive order (upper, middle, lower + instead of middle, upper, lower). Made labels shorter in + preparation of the hypothetical inclusion of texture swatches in + the future. + + * Editing: Fixed long-standing buglet with the sidedef info saying + there are missing upper/lower textures even though both sectors + have a "sky" ceiling/floor. + + * Editing: Implemented showing object numbers for linedefs and + sectors. The placement of sector numbers is naive and inadequate + for sectors that don't have a simple convex shape, but it's still + better than nothing. Picked a somewhat brighter colour for object + numbers. + + * Editing: Linedef object info box: if the first sidedef is missing, + the message "(no first sidedef)" is printed in red instead of dim + gray. Same thing for the second sidedef if the "2" flag is set. + + * Editing: Removed careless dereferencing of SideDefs[] for bad + sidedef numbers in the sector selection code. I don't think this is + what caused the mysterious unreproducible segfault James Caldwell + reported, though. Made the object deletion function paranoid + (checks that the objects to delete actually exist). + + * Editing: When found superimposed linedefs after merging vertices, + the dialog box that asks whether they should be merged now mentions + the numbers of the first two superimposed linedefs found instead of + a laconic "Some linedefs are superimposed". + + * Editing: Zooming: the zoom factor is now displayed in percent, 100% + being 1/1. + + * Editing: Zooming: the zoom factors are now regularly spaced, with a + ratio of 1.414 between them. This removes the annoying "jump" + between the zoom factors greater than 1/2. It also fixes the + oddities that happened when zooming in after [`]. The ratio between + zoom factors can be controlled through the new parameter + "zoom_step". + + * Editing: Zooming: the "zoom" parameter has been replaced by the new + parameter "zoom_default". The latter is expressed in percent, not + in 1/n units. It's now possible to specify an initial zoom factor + of more than 1/1. When opening a new window, Yadex now adjusts the + zoom factor so that the level fills the window. Should you want to + revert to the old behaviour, you can do it by setting zoom_default + to 12. + + * Editing: ['] and [`] now go to the current centre of the level + (they used to go to where the centre was when the level was opened + or created). + + * Editing: [`] now has a menu item (View -> Whole level). + + * Editing: The grid has changed. There are now dots every step map + units, dim lines every 4×step units, normal lines every 16×step + units and bold lines every 64×step units. The new grid is supposed + to be less obtrusive visually, faster to display and more distinct + when scrolling. + + * Editing: New function to swap floor and ceiling flats of selected + sectors (Misc. operations -> Swap flats). + + * Editing: When not in things mode, things are drawn in a dimmer + shade of gray and do not hide the linedefs anymore. + + * Game/wad: Removed the "-g wolf" bit. [For those who still haven't + got it : the support for Wolfenstein 3D announced in the CHANGES + for version 1.4.0 was of course a hoax, 1.4.0 having been released + on April 1st.] Hope you've been having as much fun as I have. :-) + + * Game/wad: Heretic: made the golem leader ghost, undead warrior + ghost and golem ghost look a little more ghostly. Made the gargoyle + leader, golem leader and golem leader ghost look different from + their vanilla counterparts by using sprites IMPXD and MUMMY. + Assigned a sprite to things 31 and 32 (enchanted shield, SHD2 and + mystic urn, SPHL). + + * Game/wad: Heretic: corrected things radii in heretic.ygd, using + info2ygd and the Heretic source as a reference. Almost all radii + were wrong, a few grossly so (maulotaur, ironlich and gargoyle). + + * Game/wad: Strife: many new things and linedef types thanks to Matt + Miller. + + * Game/wad: Doom alpha 0.4: definitions for thing types 2020, 2036, + 2038 and 2046. + + * Game/wad: Updated format comments in *.ygd. + + * Game/wad: Sprites in pwads now supported (between S_START/S_END or + SS_START/SS_END or SS_START/S_END). This fixes Yadex's failure to + show redefined sprites in alitcsf.wad, basilica.wad and + strifed1.wad. A few Aliens TC sprites don't work yet but it's for a + different reason (DEH). + + * Game/wad: Sprites now shown on the map when in things mode. You can + switch between sprites and squares with View -> Show sprites [%]. + New config file parameter "sprite_scale" to adjust the scale at + which sprites are displayed (default 100%). + + * Game/wad: The right sprite is shown, even if the sprites are not in + alphabetical order in the wad (cf BARWA0 in Strife). + + * Game/wad: The function to add pwads (be it from the command line or + with the "r" command) has been heavily reworked. It's more robust + and handles errors better. It does not leak file handles anymore + when you add the same pwad more than once. It also accepts to add + iwads, modulo a warning (though you should expect problems later if + you do that). The merging of the pwad directory into the master + directory is still lousy. + + * Game/wad: Fixed duplicate entries in the flat selector. This bug + was found by "Ras2". It happened whenever you added the same flat + thrice or more. + + * Game/wad: EDGE: added definitions for EDGE linedef types and things + types to doom.ygd and doom2.ygd. Thanks to Andrew Apted for + providing the ygd data. + + * Game/wad: EDGE: in sector mode, show information for EDGE + extrafloors if there are any. + + * Misc: A couple of calls to fatal_error() were turned into calls to + report_error() (don't abort). + + * Misc: New game definition file directive "sky_flat" to specify the + name of the "sky" flat. Replaced all occurrences of F_SKY1 by + references to this parameter. Fixes Check -> Check for missing + textures for Hexen and Strife. Bumped game definition file version# + to 4. + + * Misc: Because it seems to disturb people (and for the pleasure of + proving Matt wrong), I've made the texture selector clip textures + to size. Since there's no scrolling/zooming system yet, I also + enlarged the viewing area from 256×128 to 512×256 to alleviate the + lossage on large textures. + + * Misc: Removed the "Press Shift-F1 to save image to file" text in + the selector. It's been a no-op ever since 1.0, anyway. + + * Misc: In the selectors, pressing [F1] prints the location of the + current item to stdout (file name and offset). Works with flats, + patches and sprites but not textures. It's there to help trace Ras' + bug. + + * Misc: Made LoadPicture() nicer and safer. It gracefully bails out + if there are more than 20 errors on a single picture. It does not + make Yadex abort anymore on read errors in the header or column + offset table. I've done this by modifying wad_read_i16() and + wad_read_i32() so other functions might have been impacted. + + * Misc: Config file: commented out most settings (this has no visible + effect since those settings were just reiterations of the default + values built into the executable). Also changed the initialization + code so that Yadex can run without a config file. + + * Misc: Config file: unknown variables are ignored with a warning + instead of triggering a fatal error. The intent is to facilitate + sharing config files between versions. + + * Misc: Config file: bumped version# to 3. + + * Misc: Made Yadex use YADEX_GAME as documented and not Y_GAME. + Oops ! + + * Misc: New feature in the flat/picture/sprite selector to show where + the current image comes from (file name and file offset). For + debugging. + + * Misc: The window size (width/height and -w/-h) can now be expressed + in percent of the screen size, by appending a "%" to the value. The + default size, instead of being 640×480 in the executable and 900× + 600 in the config file is now 90%×90%. It's still possible to give + absolute width and heights, of course. + + * Misc: No tantrum thrown if the game definition file contains no + thing directive. + + * Misc: Removed the check for sector headroom being < 1024 in Checks + -> Check for missing textures. It was sometimes annoying and + inaccurate anyway. + + * Platform: Images display correctly on packed 24-bit X servers (i.e. + bits_per_pixel actually is 24 and not 32). The scanline_pad member + of the ScreenFormat structure is now honoured (not that XFree86 + seemed to mind much when it wasn't). + + * Platform: Began to clean the code up to make porting less + difficult. + + * Platform: Added patch to get Yadex to compile with GCC 2.7 (patch/ + gcc-2.7.diff). GCC 2.7 is officially considered unsupported, + though. You're on your own. + Yadex 1.4.0 (2000-04-01) - * Command-line: The parsing of the command line arguments is now - case-sensitive. Yes, that's right, it used to be case-insensitive. - I never knew. I just realized it by accident. DOS is not dead. - * Doc: The man page now has an "OPTIONS" section. - * Doc: Three new makefile targets, man, dvi and ps, for people who - hack the doc. - * Editing: Made object numbers slightly more legible in crowded - areas. - * Game/wad: Added support for Wolfenstein 3D (-g wolf). - * Misc: The code that parses the configuration file is smarter and - its error messages are more informative. Doesn't choke anymore on - a line containing just spaces or on comments not starting on - column 1. Thanks to "Ras2" for reporting the bug. - * Misc: New commands "viewtex" and "viewflat" so that you can browse - textures and flats without having to open a level. This is - primarily useful to me, for testing purposes. - * Misc: More sanitization : the parsing of the configuration file is - now case-sensitive when matching option names and values - ("yes"/"no", "true"/"false", "on"/"off"). - * Misc: The flat/patch/sprite/texture viewer does not flicker - anymore, and is somewhat faster when viewing textures. The list of - names in the flat viewer has grown from 3 to 5 lines. - * Misc: The diffs are now in unified format (supposedly just as good - and IMHO clearer). - + * Command-line: The parsing of the command line arguments is now + case-sensitive. Yes, that's right, it used to be case-insensitive. + I never knew. I just realized it by accident. DOS is not dead. + + * Doc: The man page now has an "OPTIONS" section. + + * Doc: Three new makefile targets, man, dvi and ps, for people who + hack the doc. + + * Editing: Made object numbers slightly more legible in crowded + areas. + + * Game/wad: Added support for Wolfenstein 3D (-g wolf). + + * Misc: The code that parses the configuration file is smarter and + its error messages are more informative. Doesn't choke anymore on a + line containing just spaces or on comments not starting on + column 1. Thanks to "Ras2" for reporting the bug. + + * Misc: New commands "viewtex" and "viewflat" so that you can browse + textures and flats without having to open a level. This is + primarily useful to me, for testing purposes. + + * Misc: More sanitization : the parsing of the configuration file is + now case-sensitive when matching option names and values ("yes"/ + "no", "true"/"false", "on"/"off"). + + * Misc: The flat/patch/sprite/texture viewer does not flicker + anymore, and is somewhat faster when viewing textures. The list of + names in the flat viewer has grown from 3 to 5 lines. + + * Misc: The diffs are now in unified format (supposedly just as good + and IMHO clearer). + Yadex 1.3.2 (2000-01-14) - * Build: Oops ! I had forgotten to set CC and CXX back to their - "sane" values before cutting the 1.3.1 tarball. - * Code: "make dist" now also generates a diff. - + * Build: Oops ! I had forgotten to set CC and CXX back to their + "sane" values before cutting the 1.3.1 tarball. + + * Code: "make dist" now also generates a diff. + Yadex 1.3.1 (2000-01-12) - * Build: Fix for "Ras2"'s compile error with g++ 2.7.2.3 : - c++ src/disppic.cc - In file included from /usr/include/g++-2.7/defalloc.h:24, - from /usr/include/g++-2.7/map.h:21, - from /usr/include/g++-2.7/map:6, - from src/patchdir.h:35, - from src/disppic.cc:33: - /usr/include/g++-2.7/algobase.h:47: macro `min' used with too many (3) args - /usr/include/g++-2.7/algobase.h:57: macro `max' used with too many (3) args - make: *** [obj/0/disppic.o] Error 1 - * Build: Fix for HAVE_NANOSLEEP being always false. Thanks to "Ras2" - for pointing it out. - + * Build: Fix for "Ras2"'s compile error with g++ 2.7.2.3 : + c++ src/disppic.cc + In file included from /usr/include/g++-2.7/defalloc.h:24, + from /usr/include/g++-2.7/map.h:21, + from /usr/include/g++-2.7/map:6, + from src/patchdir.h:35, + from src/disppic.cc:33: + /usr/include/g++-2.7/algobase.h:47: macro `min' used with too many (3) args + /usr/include/g++-2.7/algobase.h:57: macro `max' used with too many (3) args + make: *** [obj/0/disppic.o] Error 1 + + * Build: Fix for HAVE_NANOSLEEP being always false. Thanks to "Ras2" + for pointing it out. + Yadex 1.3.0 (2000-01-11) - * Build: The makefile now honours the dependencies in yadex.dep. - * Build: Support for FHS-compliant systems: "make install" now - copies the man pages into /usr/local/share/man/man6/ if - /usr/local/share/man/ exists. If not, it still uses - /usr/local/man/man6/ (requested by Joseph Carter). - * Build: Added "#include " to fix compilation error on - wads.cc under Solaris. - * Build: Downgraded the makefile and scripts to use the old - backquote syntax for command substitution, because Oliver Kraus' - reports suggest that the Solaris sh does not understand the "$()" - syntax. Barfulation ! - * Build: New makefile target showconf that shows the value of all - the important macros as well as the output of certain commands. If - you have trouble compiling Yadex, mail me the output of "make - showconf". - * Build: A bunch of little changes in the makefile to try to make - build problems on Solaris go away. - * Doc: Fixed several discrepancies in README. - * Game/wad: Support for the german edition of Doom II (as the iwad - has no MAP31 and MAP32, Yadex 1.1.0 and 1.2.0 used to say "this is - the shareware version of the game"). - * Game/wad: Replacement patches in pwads are now supported, even if - between PP_START and PP_END. Fixes failure to see redefined - textures with mbfedit!.wad, alitcwad.wad and certainly many - others. Replacement patches in pwads not between P_START/P_END or - PP_START/PP_END are not recognized anymore. Many PNAMES errors - that would have made previous versions of Yadex abort now just - make it print warnings. - * Misc: Cleaned up the web page source and makefile. Added - documentation, should someone else take over maintainership. No - harm in dreaming. - * Misc: New command viewpat to browse through the patches. - * Misc: It's now possible to have several different versions of - Yadex installed simultaneously. Some paths have changed : - + $(PREFIX)/share/games/ is now - $(PREFIX)/share/games/yadex/$(VERSION)/ - + $(PREFIX)/etc/yadex.cfg is now - $(PREFIX)/etc/yadex/$(VERSION)/yadex.cfg - + ~/yadex.cfg is now ~/.yadex/$(VERSION)/yadex.cfg - + $(PREFIX)/bin/yadex changed to $(PREFIX)/bin/yadex-$(VERSION) - + $(PREFIX)/bin/ybsp changed to $(PREFIX)/bin/ybsp-$(VERSION) - + $(PREFIX)/bin/yadex is now a symlink pointing to - yadex-$(VERSION) - + $(PREFIX)/bin/ybsp is now a symlink pointing to - ybsp-$(VERSION) - The insertion of a yadex/ component in the paths was done for two - reasons. In the first place, it was requested by Joseph Carter for - game definition files, to reduce clutter in - $(PREFIX)/share/games/. I extended it to configuration files - because it I thought it was a nice way not to clutter - $(PREFIX)/etc/. On the other hand, it was not done for man pages - and executables because it would have interfered. - * Misc: Fixed bug where if you typed "yadex: c level", then created - or edited a level and then closed the editing window, you got a - dozen of messages like this one : "Warning: error freeing colour - 00005820h (BadAccess (attempt to access private resource - denied))". I hope this fixes the related item in TODO. - + * Build: The makefile now honours the dependencies in yadex.dep. + + * Build: Support for FHS-compliant systems: "make install" now copies + the man pages into /usr/local/share/man/man6/ if /usr/local/share/ + man/ exists. If not, it still uses /usr/local/man/man6/ (requested + by Joseph Carter). + + * Build: Added "#include " to fix compilation error on + wads.cc under Solaris. + + * Build: Downgraded the makefile and scripts to use the old backquote + syntax for command substitution, because Oliver Kraus' reports + suggest that the Solaris sh does not understand the "$()" syntax. + Barfulation ! + + * Build: New makefile target showconf that shows the value of all the + important macros as well as the output of certain commands. If you + have trouble compiling Yadex, mail me the output of "make + showconf". + + * Build: A bunch of little changes in the makefile to try to make + build problems on Solaris go away. + + * Doc: Fixed several discrepancies in README. + + * Game/wad: Support for the german edition of Doom II (as the iwad + has no MAP31 and MAP32, Yadex 1.1.0 and 1.2.0 used to say "this is + the shareware version of the game"). + + * Game/wad: Replacement patches in pwads are now supported, even if + between PP_START and PP_END. Fixes failure to see redefined + textures with mbfedit!.wad, alitcwad.wad and certainly many others. + Replacement patches in pwads not between P_START/P_END or PP_START/ + PP_END are not recognized anymore. Many PNAMES errors that would + have made previous versions of Yadex abort now just make it print + warnings. + + * Misc: Cleaned up the web page source and makefile. Added + documentation, should someone else take over maintainership. No + harm in dreaming. + + * Misc: New command viewpat to browse through the patches. + + * Misc: It's now possible to have several different versions of Yadex + installed simultaneously. Some paths have changed : + + $(PREFIX)/share/games/ is now $(PREFIX)/share/games/yadex/$ + (VERSION)/ + + $(PREFIX)/etc/yadex.cfg is now $(PREFIX)/etc/yadex/$(VERSION)/ + yadex.cfg + + ~/yadex.cfg is now ~/.yadex/$(VERSION)/yadex.cfg + + $(PREFIX)/bin/yadex changed to $(PREFIX)/bin/yadex-$(VERSION) + + $(PREFIX)/bin/ybsp changed to $(PREFIX)/bin/ybsp-$(VERSION) + + $(PREFIX)/bin/yadex is now a symlink pointing to yadex-$ + (VERSION) + + $(PREFIX)/bin/ybsp is now a symlink pointing to ybsp-$(VERSION) + + The insertion of a yadex/ component in the paths was done for two + reasons. In the first place, it was requested by Joseph Carter for + game definition files, to reduce clutter in $(PREFIX)/share/games/. + I extended it to configuration files because it I thought it was a + nice way not to clutter $(PREFIX)/etc/. On the other hand, it was + not done for man pages and executables because it would have + interfered. + + * Misc: Fixed bug where if you typed "yadex: c level", then created + or edited a level and then closed the editing window, you got a + dozen of messages like this one : "Warning: error freeing colour + 00005820h (BadAccess (attempt to access private resource denied))". + I hope this fixes the related item in TODO. + Yadex 1.2.0 (1999-11-23) - * BSP: Added missing newline in banner. - * BSP: Silenced GCC 2.95.2 warnings about implicit braces. - * Build: The makefile doesn't rebuild doc/ every time a source file - is changed anymore. - * Build: Can now be built on machines where Perl is not installed. - * Build: The doc can now be built on machines with a non-GNU find. - * Build: Fixed compilation errors with GCC 2.95.2 in src/infobar.cc. - * Build: Silenced most GCC warnings. - * Code: Fixed a typo in the legal notices at the beginning of the - source files. - * Doc: HISTORY renamed as CHANGES, since that seems to be a more - widespread convention. - * Editing: The checks don't beep for every error anymore, just the - first one. - * Editing: Object info window: the sprite and flats graphics don't - flicker anymore when the pointer moves from one object to another. - Besides, if the sprite is not found, displays the message - "sprite_name not found" instead of just a blank area. - * Game/wad: Doom alpha & press release versions: it's now possible - to save levels. Note: they're saved to regular Doom format, not - Doom alpha format. - * Game/wad: Doom II: The boss shooter thing now has a sprite - (BOSFB0). - * Game/wad: Hacx and Aliens TC: fixed a bug that made Yadex segfault - when trying to edit a Hacx level (or alitcsf.wad from - alntc19{a,b}.zip). - * Game/wad: For homogeneity with DeuTex, less confusion and to - reduce the risk of conflicts with other applications, the game - names for Doom alpha 0.2, Doom alpha 0.4, and Doom alpha 0.5 are - now "doom02", "doom04" and "doom05" respectively instead of - "alpha02", "alpha04" and "alpha05". It follows that some - command-line options have changed : - + "-g alpha02" is now "-g doom02", - + "-g alpha04" is now "-g doom04", - + "-g alpha05" is now "-g doom05". - Configuration file directives : - + "game = alpha02" is now "game = doom02", - + "game = alpha04" is now "game = doom04", - + "game = alpha05" is now "game = doom05". - Paths : - + /usr/local/share/games/alpha02/ is now - /usr/local/share/games/doom02/, - + /usr/local/share/games/alpha04/ is now - /usr/local/share/games/doom04/, - + /usr/local/share/games/alpha05/ is now - /usr/local/share/games/doom05/, - + /usr/local/share/games/alpha02.ygd is now - /usr/local/share/games/doom02.ygd, - + /usr/local/share/games/alpha04.ygd is now - /usr/local/share/games/doom04.ygd, - + /usr/local/share/games/alpha05.ygd is now - /usr/local/share/games/doom05.ygd. - * Game/wad: Fixed Yadex aborting when trying to view textures for - versions of Strife >= 1.1. The problem was that Strife 1.1 and - above use a different format for the TEXTURE1 and TEXTURE2 lumps - (Strife 1.0 uses the same format as Doom). New game definition - file directive "texture_format strife11" to support that format. - strife.ygd now contains "texture_format strife11". Added - strife10.ygd that is identical to strife.ygd except that it - contains "texture_format normal". Summary : - + if you have the Strife 1.0 iwad, use "-g strife10" or "game = - strife10", - + if you have Strife 1.1 or above, use "-g strife" or "game = - strife". - Thanks to Kim Parrott for reporting the bug and Len Pitre for - pointing me in the right direction. - * Misc: The "dump" command now prints correctly the last line even - if the length of the lump is not a multiple of 16. - * Misc: For homogeneity with DeuTex, the following game definition - file directives have changed : - + "texture_format alpha04" is now "texture_format nameless", - + "texture_lump texture1" is now "texture_lump normal", - + new choice "texture_lump none". - * Misc: For homogeneity with DeuTex, automatic texture names for - Doom alpha 0.4 are now "TEXnnnn" where nnnn is zero-based. - * Misc: Bumped game definition file version# to 3. - * Misc: When trying to use a pwad as iwad, emit a warning instead of - seeing this as a fatal error. - * Misc: Added a palette viewer (PLAYPAL and COLORMAP). Can be run - from the prompt with the viewpal command or from the level editing - window with [Ctrl][P]. - * Misc: The sometimes tedious pwad loading messages are not - displayed anymore, unless in verbose mode. By default, Yadex now - just prints which levels the pwad contains. - + * BSP: Added missing newline in banner. + + * BSP: Silenced GCC 2.95.2 warnings about implicit braces. + + * Build: The makefile doesn't rebuild doc/ every time a source file + is changed anymore. + + * Build: Can now be built on machines where Perl is not installed. + + * Build: The doc can now be built on machines with a non-GNU find. + + * Build: Fixed compilation errors with GCC 2.95.2 in src/infobar.cc. + + * Build: Silenced most GCC warnings. + + * Code: Fixed a typo in the legal notices at the beginning of the + source files. + + * Doc: HISTORY renamed as CHANGES, since that seems to be a more + widespread convention. + + * Editing: The checks don't beep for every error anymore, just the + first one. + + * Editing: Object info window: the sprite and flats graphics don't + flicker anymore when the pointer moves from one object to another. + Besides, if the sprite is not found, displays the message + "sprite_name not found" instead of just a blank area. + + * Game/wad: Doom alpha & press release versions: it's now possible to + save levels. Note: they're saved to regular Doom format, not Doom + alpha format. + + * Game/wad: Doom II: The boss shooter thing now has a sprite + (BOSFB0). + + * Game/wad: Hacx and Aliens TC: fixed a bug that made Yadex segfault + when trying to edit a Hacx level (or alitcsf.wad from alntc19 + {a,b}.zip). + + * Game/wad: For homogeneity with DeuTex, less confusion and to reduce + the risk of conflicts with other applications, the game names for + Doom alpha 0.2, Doom alpha 0.4, and Doom alpha 0.5 are now + "doom02", "doom04" and "doom05" respectively instead of "alpha02", + "alpha04" and "alpha05". It follows that some command-line options + have changed : + + "-g alpha02" is now "-g doom02", + + "-g alpha04" is now "-g doom04", + + "-g alpha05" is now "-g doom05". + + Configuration file directives : + + "game = alpha02" is now "game = doom02", + + "game = alpha04" is now "game = doom04", + + "game = alpha05" is now "game = doom05". + + Paths : + + /usr/local/share/games/alpha02/ is now /usr/local/share/games/ + doom02/, + + /usr/local/share/games/alpha04/ is now /usr/local/share/games/ + doom04/, + + /usr/local/share/games/alpha05/ is now /usr/local/share/games/ + doom05/, + + /usr/local/share/games/alpha02.ygd is now /usr/local/share/ + games/doom02.ygd, + + /usr/local/share/games/alpha04.ygd is now /usr/local/share/ + games/doom04.ygd, + + /usr/local/share/games/alpha05.ygd is now /usr/local/share/ + games/doom05.ygd. + + * Game/wad: Fixed Yadex aborting when trying to view textures for + versions of Strife >= 1.1. The problem was that Strife 1.1 and + above use a different format for the TEXTURE1 and TEXTURE2 lumps + (Strife 1.0 uses the same format as Doom). New game definition file + directive "texture_format strife11" to support that format. + strife.ygd now contains "texture_format strife11". Added + strife10.ygd that is identical to strife.ygd except that it + contains "texture_format normal". Summary : + + + if you have the Strife 1.0 iwad, use "-g strife10" or "game = + strife10", + + if you have Strife 1.1 or above, use "-g strife" or "game = + strife". + + Thanks to Kim Parrott for reporting the bug and Len Pitre for + pointing me in the right direction. + + * Misc: The "dump" command now prints correctly the last line even if + the length of the lump is not a multiple of 16. + + * Misc: For homogeneity with DeuTex, the following game definition + file directives have changed : + + "texture_format alpha04" is now "texture_format nameless", + + "texture_lump texture1" is now "texture_lump normal", + + new choice "texture_lump none". + + * Misc: For homogeneity with DeuTex, automatic texture names for Doom + alpha 0.4 are now "TEXnnnn" where nnnn is zero-based. + + * Misc: Bumped game definition file version# to 3. + + * Misc: When trying to use a pwad as iwad, emit a warning instead of + seeing this as a fatal error. + + * Misc: Added a palette viewer (PLAYPAL and COLORMAP). Can be run + from the prompt with the viewpal command or from the level editing + window with [Ctrl][P]. + + * Misc: The sometimes tedious pwad loading messages are not displayed + anymore, unless in verbose mode. By default, Yadex now just prints + which levels the pwad contains. + Yadex 1.1.0 (1999-08-22) - * BSP: Included Colin Phipps' [7]fix for the bugs in - [8]bsp23bug.zip. - * BSP: Renamed the executable and the man page as ybsp, to avoid - having Yadex and Xwadtools overwrite each other's BSP. - * BSP: The whirling baton is now disabled if stderr is not a TTY. - This is the same thing Udo Munk did for [9]Xwadtools' BSP with the - -noprog option except that here it's automatic. - * BSP: Made the man page spell out exactly which version of BSP this - is. - * BSP: Inserted notice in the banner that this is the version that - comes with Yadex. In the online help, replaced "TMP.WAD" by the - correct "tmp.wad". - * Building: Fixed compilation error on line 44 of bitvec.h. - * Code: Removed CR characters that remained in some of the source - files. - * Code: New function DrawScreenString(). Began to use it instead of - DrawScreenText(). This should squash some latent bugs, for example - regarding flat and texture names containing percent signs (%). - * Code: Fixed constness warnings in cfgfile.cc. - * Code: Replaced most occurrences of hard-coded 8 by one of - WAD_NAME, WAD_FLAT_NAME, WAD_PIC_NAME and WAD_TEX_NAME. - * Code: New directives level_format and level_name in the YGD files. - As a result, been able to remove most tests on specific values of - the game parameter. - * Doc: Too many changes and additions to list. Since the last - release, the HTML doc has doubled in size (from 80 kB to 160 kB). - Added a dozen of screenshots. - * Doc: In an attempt to make it easier to find what you're looking - for, I've split the doc in a larger number of files, referred to - by a top level index.html. - * Doc: Moved the HTML doc and the man pages to the doc/ directory, - so as not to clutter the base directory too much. - * Doc: Man pages: the first argument of the .TH macro (the name) is - now all caps since that's what (almost) everybody else does. - * Editing: Autoscroll is now off by default -- use "autoscroll = - true" in yadex.cfg if you want it back. - * Editing: New bindings [e] and [Ctrl][e] to select all linedefs - that belong to the same non-forked path. - * Editing: New bindings [E] and [Ctrl][Shift][e] to select all - single-sided linedefs that belong to the same non-forked path. - * Editing: New functions to flip and mirror linedefs, sectors, - things and vertices. - * Editing: Fixed the "string art" bug. That was a subtle bug that - happened only as a result of a rare chain of events. The recipe to - it is to render a vertex unused (for example by deleting all the - linedefs that use it), save the level, make a change that does not - call for a rebuilding of the nodes (for example, moving a thing or - changing an attribute of a sector), save the level, quit and load - again. At that point, a nice surprise awaits you: the linedefs are - all entangled (hence the name). Spectacular, and even beautiful, - but also very annoying if you don't have a backup copy of your - level. - This is the same bug I thought I had fixed in Yadex 1.0.0_alpha3. - In fact, I had cut one of the paths that led to it but the bug - itself was still there. It reappeared in february 1999. - * Editing: Fixed an old DEU bug where you sometimes couldn't select - a newly created sector to the west of the level until you saved. - * Editing: It's now possible to toggle linedef flags 8-15 and to - specify linedef flags field values greater than 511. - * Editing: It's now possible to set/clear/toggle things flags 7-15. - * Editing: Made the Not-enough-player-starts and - Not-enough-deathmatch-start dialogs on saving more intuitive (it - was about time). - * Editing: New function "Exchange objects numbers". - * Editing: Things types are now displayed in decimal, not in - hexadecimal. Other minor cosmetic changes. - * Editing: The focus-on-object function now works much better. It - does not land off-target or zoom in excessively anymore. - Superimposed things and sectors containing other sectors or not - containing their own centre don't confuse it anymore. It's still - fooled by unclosed sectors, though. - * Editing: Changed the meaning of [q]. It used to save and quit. Now - it just quits (same thing as [Esc]). - * Editing: The edit command can now edit levels of any name. If you - had a wad with a level named "FOO" in it, you could edit that - level by typing "edit foo". In case you're wondering, no there's - no practical application to this (beyond experimenting). - * Editing: Reminder to build nodes: the message is now more - specific. - * Editing: Command mode: typing ^D at the prompt now works. - * Editing: Insert linedef and split sector: the new linedef now goes - from the first selected vertex to the second and not the other way - around. - * Editing: Insert linedef and split sector: does not loop forever - anymore if there are forks in the edge of the sector (for example - like when trying to split between vertices 283 and 278 of MAP01 of - Doom II). - * Editing: [n], [p], [>] and [<] now move the view so that the - object to highlight is under the pointer. - * Editing: The messages displayed when loading pwads are more - compact (several lumps are printed on the same line and groups of - sprites are collapsed). The end marker for groups of flats, - patches and sprites is now printed. - * Editing: Flat/sprite/texture viewer : added bindings [Ctrl][u] and - [Ctrl][w] to erase to start of line, [Ctrl][f] and [Ctrl][v] to - page down and [Ctrl][b] to page up. - * Editing: Flat/sprite/texture viewer : added bindings [Ctrl][PgUp] - and [Ctrl][PgDn] to move to top and bottom of list, because [Home] - and [End] will eventually cease to be available for that (they - will be bound to SOL and EOL). - * Editing: Flat/sprite/texture viewer : made [Up] and [Down] work - even when there are duplicate names. - * Editing: Flat/sprite/texture viewer : InputNameFromListWithFunc() - is now genuinely case insensitive. The positioning in the list of - names is now correct, even if the name given is lower-case. - * Editing: Flat/sprite/texture viewer : reduced flickering (still - room for improvement, though). - * Editing: Flat/sprite/texture viewer : the current name was way too - dim if not in the list. Fixed. - * Editing: Flat/sprite/texture viewer : made image window 320x200 - instead of 256x128. - * Editing: Sprite viewer : new bindings [Ctrl][n] and [Ctrl][p] to - go to start of next/previous group of sprites. - * Editing: Sprite viewer : fixed display bug. - * Editing: Spectres now look more like spectres. - * Editing: Confirm-or-cancel dialogs: more intuitive. You can now - confirm with [y] or [Return] and cancel with [n] or [Esc]. All - other keys are ignored (previously, [y] confirmed and all other - keys cancelled). Expose events are now handled (previously they - were ignored). - * Editing: Some abnormal conditions that used to trigger fatal - errors now just cause a message error to be printed. The current - operation is aborted but not the whole program anymore. - * Game/wad: Fixed segfault on levels containing a thing of type 0 - (like Eternal MAP25 and some Final Doom maps). - * Game/wad: When reading a level from a wad, now verifies that the - SECTORS, THINGS, VERTEXES, LINEDEFS and SIDEDEFS lumps have - correct sizes and that sidedefs, sectors and vertices references - are correct. - * Game/wad: Final Doom : should be supported now. Yadex does not - assume anymore that F1_START is always present, which caused it to - segfault on either or both Final Doom iwads. - * Game/wad: Heretic : added sprite names for 58 thing types. - * Game/wad: Hexen : added very partial support (-g hexen). You can - edit levels but not save them. Hexen-specific linedef and things - fields are ignored, and so is the BEHAVIOR lump. Most definitions - are missing. - * Game/wad: Strife : added partial support (-g strife). Yadex now - knows about the translucent linedef flag and the new sector types. - Thanks to Len Pitre for the help. Still missing : the new things - flags, most things types and linedefs types. Anybody wants to work - on strife.ygd ? - * Game/wad: MBF : supported. Yadex now knows about the friendly - thing flag, thing type 888 (Dog) and linedef types 271 and 272 - (transfer sky texture). - * Game/wad: Doom press release pre-beta : supported (-g doompr). - Added support for the PR picture format and the definitions for - things 2016 (evil sceptre) and 2017 (unholy bible). - * Game/wad: Doom alpha : read-only support (-g - alpha02|alpha04|alpha05). Added support for the alpha picture - format, the TEXTURES lump, the different level format and the - incompatible level names (E1M10 through E1M13). - * Game/wad: Added support for FF_START/FF_END in addition of - FF_START/F_END. As a result, Yadex does not barf anymore on - basilica.wad (but issue a warning). F?_START is not supported - anymore ; it has to be FF_START. - * Game/wad: Made "Post too long. Wad file might be corrupt" a - warning, not a fatal error anymore. - * Game/wad: New directives picture_format, texture_format and - texture_lump in the YGD files, to support Doom alpha and Doom PR. - * Misc: New command make_palette_ppm to generate a raw PPM file - containing all the colours of the palette. - * Misc: Cosmetic changes in the prompt and character mode interface. - * Misc: make_gimp_palette : the generated palette files now include - RGB values in the comments. - * Misc: Removed from the menus the functions that were not - implemented (File->Print, Edit->Find, View->3D preview). - * Misc: Failure to load the specified X font is not a fatal error - anymore. - * Misc: New command line options --help and --version. - * Misc: Bumped game definition file version# to 2. - * Platform: Removed dependency on nanosleep(), strcasecmp() and - strncasecmp(). Thanks to Udo Munk for pointing out that - nanosleep() is not always available. - * Platform: Now compiles with other compilers than GCC/EGCS without - modifying the makefile. - * Platform: New parameter idle_sleep_ms to set the time in ms - between polls of the X server when the input queue is empty. - * Platform: Previously, if the CPU and the X server had different - endiannesses and the screen depth was more than 8 bits, sprites, - flats and textures were displayed with wrong colours. This is now - fixed. - * Platform: The build, group, insert and save commands should now - work correctly on big-endian machines. - * Platform: The bell has been resurrected on X. - * Platform: Should now compile on X11R5 systems (to be verified). - Thanks to Udo Munk for the fix. - + * BSP: Included Colin Phipps' fix for the bugs in bsp23bug.zip. + + * BSP: Renamed the executable and the man page as ybsp, to avoid + having Yadex and Xwadtools overwrite each other's BSP. + + * BSP: The whirling baton is now disabled if stderr is not a TTY. + This is the same thing Udo Munk did for Xwadtools' BSP with the + -noprog option except that here it's automatic. + + * BSP: Made the man page spell out exactly which version of BSP this + is. + + * BSP: Inserted notice in the banner that this is the version that + comes with Yadex. In the online help, replaced "TMP.WAD" by the + correct "tmp.wad". + + * Building: Fixed compilation error on line 44 of bitvec.h. + + * Code: Removed CR characters that remained in some of the source + files. + + * Code: New function DrawScreenString(). Began to use it instead of + DrawScreenText(). This should squash some latent bugs, for example + regarding flat and texture names containing percent signs (%). + + * Code: Fixed constness warnings in cfgfile.cc. + + * Code: Replaced most occurrences of hard-coded 8 by one of WAD_NAME, + WAD_FLAT_NAME, WAD_PIC_NAME and WAD_TEX_NAME. + + * Code: New directives level_format and level_name in the YGD files. + As a result, been able to remove most tests on specific values of + the game parameter. + + * Doc: Too many changes and additions to list. Since the last + release, the HTML doc has doubled in size (from 80 kB to 160 kB). + Added a dozen of screenshots. + + * Doc: In an attempt to make it easier to find what you're looking + for, I've split the doc in a larger number of files, referred to by + a top level index.html. + + * Doc: Moved the HTML doc and the man pages to the doc/ directory, so + as not to clutter the base directory too much. + + * Doc: Man pages: the first argument of the .TH macro (the name) is + now all caps since that's what (almost) everybody else does. + + * Editing: Autoscroll is now off by default -- use "autoscroll = + true" in yadex.cfg if you want it back. + + * Editing: New bindings [e] and [Ctrl][e] to select all linedefs that + belong to the same non-forked path. + + * Editing: New bindings [E] and [Ctrl][Shift][e] to select all + single-sided linedefs that belong to the same non-forked path. + + * Editing: New functions to flip and mirror linedefs, sectors, things + and vertices. + + * Editing: Fixed the "string art" bug. That was a subtle bug that + happened only as a result of a rare chain of events. The recipe to + it is to render a vertex unused (for example by deleting all the + linedefs that use it), save the level, make a change that does not + call for a rebuilding of the nodes (for example, moving a thing or + changing an attribute of a sector), save the level, quit and load + again. At that point, a nice surprise awaits you: the linedefs are + all entangled (hence the name). Spectacular, and even beautiful, + but also very annoying if you don't have a backup copy of your + level. + + This is the same bug I thought I had fixed in Yadex 1.0.0_alpha3. + In fact, I had cut one of the paths that led to it but the bug + itself was still there. It reappeared in february 1999. + + * Editing: Fixed an old DEU bug where you sometimes couldn't select a + newly created sector to the west of the level until you saved. + + * Editing: It's now possible to toggle linedef flags 8-15 and to + specify linedef flags field values greater than 511. + + * Editing: It's now possible to set/clear/toggle things flags 7-15. + + * Editing: Made the Not-enough-player-starts and + Not-enough-deathmatch-start dialogs on saving more intuitive (it + was about time). + + * Editing: New function "Exchange objects numbers". + + * Editing: Things types are now displayed in decimal, not in + hexadecimal. Other minor cosmetic changes. + + * Editing: The focus-on-object function now works much better. It + does not land off-target or zoom in excessively anymore. + Superimposed things and sectors containing other sectors or not + containing their own centre don't confuse it anymore. It's still + fooled by unclosed sectors, though. + + * Editing: Changed the meaning of [q]. It used to save and quit. Now + it just quits (same thing as [Esc]). + + * Editing: The edit command can now edit levels of any name. If you + had a wad with a level named "FOO" in it, you could edit that level + by typing "edit foo". In case you're wondering, no there's no + practical application to this (beyond experimenting). + + * Editing: Reminder to build nodes: the message is now more specific. + + * Editing: Command mode: typing ^D at the prompt now works. + + * Editing: Insert linedef and split sector: the new linedef now goes + from the first selected vertex to the second and not the other way + around. + + * Editing: Insert linedef and split sector: does not loop forever + anymore if there are forks in the edge of the sector (for example + like when trying to split between vertices 283 and 278 of MAP01 of + Doom II). + + * Editing: [n], [p], [>] and [<] now move the view so that the object + to highlight is under the pointer. + + * Editing: The messages displayed when loading pwads are more compact + (several lumps are printed on the same line and groups of sprites + are collapsed). The end marker for groups of flats, patches and + sprites is now printed. + + * Editing: Flat/sprite/texture viewer : added bindings [Ctrl][u] and + [Ctrl][w] to erase to start of line, [Ctrl][f] and [Ctrl][v] to + page down and [Ctrl][b] to page up. + + * Editing: Flat/sprite/texture viewer : added bindings [Ctrl][PgUp] + and [Ctrl][PgDn] to move to top and bottom of list, because [Home] + and [End] will eventually cease to be available for that (they will + be bound to SOL and EOL). + + * Editing: Flat/sprite/texture viewer : made [Up] and [Down] work + even when there are duplicate names. + + * Editing: Flat/sprite/texture viewer : InputNameFromListWithFunc() + is now genuinely case insensitive. The positioning in the list of + names is now correct, even if the name given is lower-case. + + * Editing: Flat/sprite/texture viewer : reduced flickering (still + room for improvement, though). + + * Editing: Flat/sprite/texture viewer : the current name was way too + dim if not in the list. Fixed. + + * Editing: Flat/sprite/texture viewer : made image window 320x200 + instead of 256x128. + + * Editing: Sprite viewer : new bindings [Ctrl][n] and [Ctrl][p] to go + to start of next/previous group of sprites. + + * Editing: Sprite viewer : fixed display bug. + + * Editing: Spectres now look more like spectres. + + * Editing: Confirm-or-cancel dialogs: more intuitive. You can now + confirm with [y] or [Return] and cancel with [n] or [Esc]. All + other keys are ignored (previously, [y] confirmed and all other + keys cancelled). Expose events are now handled (previously they + were ignored). + + * Editing: Some abnormal conditions that used to trigger fatal errors + now just cause a message error to be printed. The current operation + is aborted but not the whole program anymore. + + * Game/wad: Fixed segfault on levels containing a thing of type 0 + (like Eternal MAP25 and some Final Doom maps). + + * Game/wad: When reading a level from a wad, now verifies that the + SECTORS, THINGS, VERTEXES, LINEDEFS and SIDEDEFS lumps have correct + sizes and that sidedefs, sectors and vertices references are + correct. + + * Game/wad: Final Doom : should be supported now. Yadex does not + assume anymore that F1_START is always present, which caused it to + segfault on either or both Final Doom iwads. + + * Game/wad: Heretic : added sprite names for 58 thing types. + + * Game/wad: Hexen : added very partial support (-g hexen). You can + edit levels but not save them. Hexen-specific linedef and things + fields are ignored, and so is the BEHAVIOR lump. Most definitions + are missing. + + * Game/wad: Strife : added partial support (-g strife). Yadex now + knows about the translucent linedef flag and the new sector types. + Thanks to Len Pitre for the help. Still missing : the new things + flags, most things types and linedefs types. Anybody wants to work + on strife.ygd ? + + * Game/wad: MBF : supported. Yadex now knows about the friendly thing + flag, thing type 888 (Dog) and linedef types 271 and 272 (transfer + sky texture). + + * Game/wad: Doom press release pre-beta : supported (-g doompr). + Added support for the PR picture format and the definitions for + things 2016 (evil sceptre) and 2017 (unholy bible). + + * Game/wad: Doom alpha : read-only support (-g alpha02|alpha04| + alpha05). Added support for the alpha picture format, the TEXTURES + lump, the different level format and the incompatible level names + (E1M10 through E1M13). + + * Game/wad: Added support for FF_START/FF_END in addition of FF_START + /F_END. As a result, Yadex does not barf anymore on basilica.wad + (but issue a warning). F?_START is not supported anymore ; it has + to be FF_START. + + * Game/wad: Made "Post too long. Wad file might be corrupt" a + warning, not a fatal error anymore. + + * Game/wad: New directives picture_format, texture_format and + texture_lump in the YGD files, to support Doom alpha and Doom PR. + + * Misc: New command make_palette_ppm to generate a raw PPM file + containing all the colours of the palette. + + * Misc: Cosmetic changes in the prompt and character mode interface. + + * Misc: make_gimp_palette : the generated palette files now include + RGB values in the comments. + + * Misc: Removed from the menus the functions that were not + implemented (File->Print, Edit->Find, View->3D preview). + + * Misc: Failure to load the specified X font is not a fatal error + anymore. + + * Misc: New command line options --help and --version. + + * Misc: Bumped game definition file version# to 2. + + * Platform: Removed dependency on nanosleep(), strcasecmp() and + strncasecmp(). Thanks to Udo Munk for pointing out that nanosleep() + is not always available. + + * Platform: Now compiles with other compilers than GCC/EGCS without + modifying the makefile. + + * Platform: New parameter idle_sleep_ms to set the time in ms between + polls of the X server when the input queue is empty. + + * Platform: Previously, if the CPU and the X server had different + endiannesses and the screen depth was more than 8 bits, sprites, + flats and textures were displayed with wrong colours. This is now + fixed. + + * Platform: The build, group, insert and save commands should now + work correctly on big-endian machines. + + * Platform: The bell has been resurrected on X. + + * Platform: Should now compile on X11R5 systems (to be verified). + Thanks to Udo Munk for the fix. + Yadex 1.0.1 (1999-01-02) - * Doc: New sections "Moving around" and "Other credits" in the - user's guide. - * Editing: Split linedefs and sector: new linedef now goes from 1 to - 2 and not the other way around. - * Editing: Added scrolling with the arrow keys. - * Editing: [Pgup], [Pgdn], [Home] and [End] now scroll one page at a - time. - * Editing: New variable autoscroll to disable autoscrolling. - * Editing: New variables autoscroll_amp and autoscroll_edge to tweak - autoscrolling. - * Editing: New shortcut [x] to "Split linedef (insert new vertex)". - * Editing: New shortcut [w] to "Split linedefs and sector". - * Misc: Fixed segfault on trying to edit MAPnm in Doom/Heretic mode - or EnMm in Doom II mode. - * Misc: New prompt command make_gimp_palette to generate a gimp - palette file from PLAYPAL. - * Misc: Bumped configuration file version# to 2. - + * Doc: New sections "Moving around" and "Other credits" in the user's + guide. + + * Editing: Split linedefs and sector: new linedef now goes from 1 to + 2 and not the other way around. + + * Editing: Added scrolling with the arrow keys. + + * Editing: [Pgup], [Pgdn], [Home] and [End] now scroll one page at a + time. + + * Editing: New variable autoscroll to disable autoscrolling. + + * Editing: New variables autoscroll_amp and autoscroll_edge to tweak + autoscrolling. + + * Editing: New shortcut [x] to "Split linedef (insert new vertex)". + + * Editing: New shortcut [w] to "Split linedefs and sector". + + * Misc: Fixed segfault on trying to edit MAPnm in Doom/Heretic mode + or EnMm in Doom II mode. + + * Misc: New prompt command make_gimp_palette to generate a gimp + palette file from PLAYPAL. + + * Misc: Bumped configuration file version# to 2. + Yadex 1.0.0 (1998-12-26) - * Code: Moved the source files to a subdirectory. - * Doc: A few additions in the user's guide - * Editing: Fixed buglet in positioning of newly copied objects. - * Game/wad: Game support: added definitions for Boom's things 5001 - and 5002 (point pusher and puller). - * Misc: Added reminder to build nodes after making changes. - * Misc: Added magic string to configuration file. - * Misc: Added magic string to game definition file. - + * Code: Moved the source files to a subdirectory. + + * Doc: A few additions in the user's guide + + * Editing: Fixed buglet in positioning of newly copied objects. + + * Game/wad: Game support: added definitions for Boom's things 5001 + and 5002 (point pusher and puller). + + * Misc: Added reminder to build nodes after making changes. + + * Misc: Added magic string to configuration file. + + * Misc: Added magic string to game definition file. + Yadex 1.0.0_alpha3 (1998-12-23) - * Doc: A few additions/corrections in the hacker's guide. - * Editing: Fixed spectacular corruption of linedefs (string art bug) - that occurred if all you did during a given session was deleting - vertices. - + * Doc: A few additions/corrections in the hacker's guide. + + * Editing: Fixed spectacular corruption of linedefs (string art bug) + that occurred if all you did during a given session was deleting + vertices. + Yadex 1.0.0_alpha2 (1998-12-22) - * BSP: Included BSP 2.3 (thanks to Lee Killough). - * Doc: Improved user's guide. - * Editing: Added new commands [a], [b] and [c] to set, toggle and - clear things and linedefs flags. - + * BSP: Included BSP 2.3 (thanks to Lee Killough). + + * Doc: Improved user's guide. + + * Editing: Added new commands [a], [b] and [c] to set, toggle and + clear things and linedefs flags. + Yadex 1.0.0_alpha1 (1998-12-17) - * Code: Removed dereferencing of NULL pointer in - ParseCommandLineOptions() (DEU). - * Code: Replaced occurrences of "x==TRUE" and "x==FALSE" by "x" and - "!x". - * Code: Replaced occurrences of "x=TRUE" and "x=FALSE" by "x=1" and - "x=0". - * Command-line: You don't have anymore to put "-file" or "-pwad" in - front of pwads names on the command line. E.G. you can type "yadex - foo.wad". - * Command-line: Deleted a few little-used or DOS-specific options. - * Editing: Menu bar and pop-up menus much improved. - * Editing: Info bar reworked. - * Editing: When prompted to "Press a key to continue", you can now - also press the left mouse button. - * Editing: Grid: the grid step can now adapt automatically as you - zoom in/out. - * Editing: Grid: whether dragging is snapped to grid is now - independent of whether the grid is shown or not (added flags - grid_snap and grid_shown). - * Editing: Added finer-grained confirmation options. - * Editing: General editing: you can now scroll the map further from - the centre of the level. - * Editing: Added ['] to re-centre the window around the centre of - the map. - * Editing: Added [`] to re-centre the window around the centre of - the map and adjust the zoom so that the map fills the screen. - * Editing: Added [&] to show things and vertices numbers. - * Editing: Autoscroll: scroll speed is now progressive. - * Editing: Autoscroll: easier to use near the top of the window. - * Editing: [Left], [Right], [Up], [Down] do nothing. - * Editing: [Space] does not toggle move fast/slow anymore; it - toggles between nominal zoom and x 4. - * Editing: Highlighting of things, vertices and linedefs much - improved. - * Editing: Dragging objects is now done with the left mouse button - instead of the right button. - * Editing: Editing object properties is now done by double-clicking - on the object. - * Editing: Selection and drag-and-drop have changed a lot. - * Editing: Selection box: removed the -a option and the addselbox - parameter. Whether the selection box is additive or not is now - controlled dynamically by the user (with [Ctrl]). - * Editing: Sprite viewer: sprites are now centred. - * Editing: Linedef info: shortened flags names to one character. - * Editing: Linedef info: a missing normal texture on a 1-sided - linedef is now flagged in red. - * Editing: Linedefs copy: you now have the choice between - duplicating the sidedefs too and reusing the same sidedefs. DEU - left the new linedefs sidedef-less and, so far, Yadex used to - reuse the same sidedefs. - * Editing: Linedefs: added function to "unlink" sidedefs. - * Editing: Linedefs: dragging linedefs is much faster than before. - * Editing: Sectors: in the object info window, added display of - floor and ceiling height delta with respect to previous sector. - * Editing: Sectors: in the object info window, added display of - floor and ceiling texture. - * Editing: Sectors: dragging sectors is much faster than before. - * Editing: Things: now drawn as squares so that it's easier to see - whether they are stuck in a wall or another thing. And you don't - have to highlight them to see their angle. Note: the old shape is - still available by defining ROUND_THINGS at compile-time. - * Editing: Things: changed the colours again. Tried to make - important things stand out and conversely. Bonuses are now dark - green and player/ deathmatch starts bright green. Keys are - magenta. Decoration is dim blue instead of white. Unknown objects - are cyan instead of white. Weapons are orange instead of brownish. - Heretic sound source things and Boom point pushers are dim - turquoise-ish. - * Editing: Things: the sprite is now shown in the object info - window. - * Editing: Vertices: deciding whether a vertex is on a linedef is - now done on the distance in pixels, not in map units. So you can - now work on very fine details (E.G. vertices only 2 map units - away) provided that the zoom factor is high enough. - * Editing: Fixed minor glitch in texture viewer that showed with - BIGDOOR7, SKY1, TEKWALL1, TEKWALL5 and others (DEU). - * Editing: When highlighting a sector, compared - SideDefs[LineDef[n].sidedef1].sector with ObjNum even though - .sector was -1. Somehow it always tested false (DEU). - * Editing: "Check textures names": the name of the offending texture - is now printed correctly even if it is 8 characters long (DEU). - * Editing: "Check textures names": if you fixed a missing texture, - the editor was not made aware that you had made changes to the - level (DEU). - * Editing: Unused sectors are not selected anymore (DEU). - * Editing: Changing the preferences could overwrite other variables - (DEU). - * Editing: InputNameFromListWithFunc() used to segfault if you - pressed [Pgdn] on a list shorter than (listdisp + 1) elements - (DEU). - * Editing: Removed segfault in AlignTexturesX() (DEU). - * Game/wad: Heretic is now supported. - * Game/wad: Added support for Boom's new thing flags - not-in-deathmatch and not-in-coop. - * Game/wad: Added support for Boom's new linedef flag pass-through. - * Misc: Renamed as Yadex to avoid confusion with Yet Another Diagram - Editor. - * Misc: Loading pwads: implemented standard directories. If the pwad - to load is in one of the standard directories (or a subdirectory) - you don't have to type the whole name. - * Misc: Loading pwads: added standard directories and made the - messages less verbose for pwads that contain patches - (PP_START/PP_END). - * Misc: Removed segfault during fatal_error() on failure to open the - iwad (DEU). - * Misc: The prompt now groks TTYs with a number of lines other than - 25. - * Misc: Changed the welcome message (a.k.a. "reminder"). - * Misc: Added an "About Yadex..." window. - * Misc: Don't copy SEGS, SSECTORS, NODES, REJECT and BLOCKMAP from - the original file anymore when the map has changed. Makes smaller - wad files. Nice for archival. - * Misc: Added environment variable YADEX_GAME. - * Platform: Ported to X (plain Xlib). This version is not available - for DOS. - * Platform: Now works on big-endian machines. - * Platform: Removed several DOS-isms from file name handling code. - -References - - 1. http://www.teaser.fr/~amajorel/info2ygd/ - 2. http://my.ohio.voyager.net/~mattm/ - 3. ftp://ftp.cdrom.com/pub/idgames/themes/aliens/alntc19a.zip - 4. ftp://ftp.cdrom.com/pub/idgames/levels/doom/a-c/basilica.zip - 5. ftp://ftp.cdrom.com/pub/idgames/levels/doom2/Ports/s-u/strifed1.zip - 6. http://www.netspace.net.au/~ajapted/ - 7. http://lxdoom.linuxgames.com/notes.html#bsp - 8. http://www.teaser.fr/~amajorel/doom/bsp23bug.zip - 9. ftp://ftp.cdrom.com/pub/idgames/source/ + * Code: Removed dereferencing of NULL pointer in + ParseCommandLineOptions() (DEU). + + * Code: Replaced occurrences of "x==TRUE" and "x==FALSE" by "x" and + "!x". + + * Code: Replaced occurrences of "x=TRUE" and "x=FALSE" by "x=1" and + "x=0". + + * Command-line: You don't have anymore to put "-file" or "-pwad" in + front of pwads names on the command line. E.G. you can type "yadex + foo.wad". + + * Command-line: Deleted a few little-used or DOS-specific options. + + * Editing: Menu bar and pop-up menus much improved. + + * Editing: Info bar reworked. + + * Editing: When prompted to "Press a key to continue", you can now + also press the left mouse button. + + * Editing: Grid: the grid step can now adapt automatically as you + zoom in/out. + + * Editing: Grid: whether dragging is snapped to grid is now + independent of whether the grid is shown or not (added flags + grid_snap and grid_shown). + + * Editing: Added finer-grained confirmation options. + + * Editing: General editing: you can now scroll the map further from + the centre of the level. + + * Editing: Added ['] to re-centre the window around the centre of the + map. + + * Editing: Added [`] to re-centre the window around the centre of the + map and adjust the zoom so that the map fills the screen. + + * Editing: Added [&] to show things and vertices numbers. + + * Editing: Autoscroll: scroll speed is now progressive. + + * Editing: Autoscroll: easier to use near the top of the window. + + * Editing: [Left], [Right], [Up], [Down] do nothing. + + * Editing: [Space] does not toggle move fast/slow anymore; it toggles + between nominal zoom and x 4. + + * Editing: Highlighting of things, vertices and linedefs much + improved. + + * Editing: Dragging objects is now done with the left mouse button + instead of the right button. + + * Editing: Editing object properties is now done by double-clicking + on the object. + + * Editing: Selection and drag-and-drop have changed a lot. + + * Editing: Selection box: removed the -a option and the addselbox + parameter. Whether the selection box is additive or not is now + controlled dynamically by the user (with [Ctrl]). + + * Editing: Sprite viewer: sprites are now centred. + + * Editing: Linedef info: shortened flags names to one character. + + * Editing: Linedef info: a missing normal texture on a 1-sided + linedef is now flagged in red. + + * Editing: Linedefs copy: you now have the choice between duplicating + the sidedefs too and reusing the same sidedefs. DEU left the new + linedefs sidedef-less and, so far, Yadex used to reuse the same + sidedefs. + + * Editing: Linedefs: added function to "unlink" sidedefs. + + * Editing: Linedefs: dragging linedefs is much faster than before. + + * Editing: Sectors: in the object info window, added display of floor + and ceiling height delta with respect to previous sector. + + * Editing: Sectors: in the object info window, added display of floor + and ceiling texture. + + * Editing: Sectors: dragging sectors is much faster than before. + + * Editing: Things: now drawn as squares so that it's easier to see + whether they are stuck in a wall or another thing. And you don't + have to highlight them to see their angle. Note: the old shape is + still available by defining ROUND_THINGS at compile-time. + + * Editing: Things: changed the colours again. Tried to make important + things stand out and conversely. Bonuses are now dark green and + player/ deathmatch starts bright green. Keys are magenta. + Decoration is dim blue instead of white. Unknown objects are cyan + instead of white. Weapons are orange instead of brownish. Heretic + sound source things and Boom point pushers are dim turquoise-ish. + + * Editing: Things: the sprite is now shown in the object info window. + + * Editing: Vertices: deciding whether a vertex is on a linedef is now + done on the distance in pixels, not in map units. So you can now + work on very fine details (E.G. vertices only 2 map units away) + provided that the zoom factor is high enough. + + * Editing: Fixed minor glitch in texture viewer that showed with + BIGDOOR7, SKY1, TEKWALL1, TEKWALL5 and others (DEU). + + * Editing: When highlighting a sector, compared SideDefs[LineDef + [n].sidedef1].sector with ObjNum even though .sector was -1. + Somehow it always tested false (DEU). + + * Editing: "Check textures names": the name of the offending texture + is now printed correctly even if it is 8 characters long (DEU). + + * Editing: "Check textures names": if you fixed a missing texture, + the editor was not made aware that you had made changes to the + level (DEU). + + * Editing: Unused sectors are not selected anymore (DEU). + + * Editing: Changing the preferences could overwrite other variables + (DEU). + + * Editing: InputNameFromListWithFunc() used to segfault if you + pressed [Pgdn] on a list shorter than (listdisp + 1) elements + (DEU). + + * Editing: Removed segfault in AlignTexturesX() (DEU). + + * Game/wad: Heretic is now supported. + + * Game/wad: Added support for Boom's new thing flags + not-in-deathmatch and not-in-coop. + + * Game/wad: Added support for Boom's new linedef flag pass-through. + + * Misc: Renamed as Yadex to avoid confusion with Yet Another Diagram + Editor. + + * Misc: Loading pwads: implemented standard directories. If the pwad + to load is in one of the standard directories (or a subdirectory) + you don't have to type the whole name. + + * Misc: Loading pwads: added standard directories and made the + messages less verbose for pwads that contain patches (PP_START/ + PP_END). + + * Misc: Removed segfault during fatal_error() on failure to open the + iwad (DEU). + + * Misc: The prompt now groks TTYs with a number of lines other than + 25. + + * Misc: Changed the welcome message (a.k.a. "reminder"). + + * Misc: Added an "About Yadex..." window. + + * Misc: Don't copy SEGS, SSECTORS, NODES, REJECT and BLOCKMAP from + the original file anymore when the map has changed. Makes smaller + wad files. Nice for archival. + + * Misc: Added environment variable YADEX_GAME. + + * Platform: Ported to X (plain Xlib). This version is not available + for DOS. + + * Platform: Now works on big-endian machines. + + * Platform: Removed several DOS-isms from file name handling code. + diff -uaNr yadex-1.5.2/FAQ yadex-1.6.0/FAQ --- yadex-1.5.2/FAQ 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/FAQ 2001-07-01 11:12:13.000000000 +0200 @@ -0,0 +1,125 @@ + + Fancy logo + Yadex 1.6.0 (2001-06-27) + + Yadex FAQ + +Compilation problems + + warning: comparison between signed and unsigned + Not a problem. GCC is over-sensitive to signedness mismatches. + + In sanity.cc, + warning: decimal integer constant is so large that it is + unsigned + Not a problem. It's a bug in GCC. + + c++: command not found + Are you sure you have a C++ compiler ? If not, install one. If + you do have one, find out how it's called and change the "CXX + =" line in GNUmakefile accordingly. + + X11/Xlib.h: No such file or directory + Are you sure you have the Xlib headers ? If not, install them. + If you already have them, then find out where they are and + change the "X11INCLUDEDIR =" line in GNUmakefile accordingly. + + The compiler chokes on the Xlib headers + This happens on Solaris 2.6 with GCC 2.95.2. Oliver Kraus says + that the solution is to add "-fpermissive" to "CXXFLAGS =" in + GNUmakefile. + + /usr/X11R6/lib/libX11.so: undefined reference to `recv' + /usr/X11R6/lib/libX11.so: undefined reference to `connect' + /usr/X11R6/lib/libX11.so: undefined reference to `socket' + /usr/X11R6/lib/libX11.so: undefined reference to `setsockopt' + /usr/X11R6/lib/libX11.so: undefined reference to `shutdown' + /usr/X11R6/lib/libX11.so: undefined reference to + `gethostbyname' + /usr/X11R6/lib/libX11.so: undefined reference to + `getservbyname' + /usr/X11R6/lib/libX11.so: undefined reference to `getpeername' + /usr/X11R6/lib/libX11.so: undefined reference to `getsockname' + This happens with QNX 6 and other Unices. Add "-lsocket" to + "LDFLAGS =" in GNUmakefile. + + I have GCC 3.0 and Yadex 1.5.1 doesn't compile + Get Yadex 1.5.2 or later. + + I have GCC 2.96 and Yadex 1.5.0 doesn't compile + Get Yadex 1.5.1 or later. + + I have GCC 2.7 and I get lots of errors + GCC 2.7 is a very old compiler, it does not implement the + current C++ standard and I don't support it. If you must, try + applying patch/gcc-2.7.diff that's included in the archive but + don't complain to me if it doesn't work. + + I have EGCS 1.1.2 / SuSE 6.2 and I get + "no matching function for call to `menu_c::menu_c (...)'" + Apparently, there is a bug in certain EGCS 1.1.2 installations + that makes them choke on src/editloop.cc. I know no workaround. + I'd suggest that you try to get a fix from your distributor or + use another compiler. EGCS 1.0.3, EGCS 1.1.1 and GCC 2.95.2 are + known to work. + + Yadex 1.3.1 doesn't compile + There's a thinko in the makefile. It's fixed in version 1.3.2. + + Yadex 1.1.0 doesn't compile + In src/infobar.cc, lines 48 and 49, replace + + const char infobar_c::FILE_NAME_UNSET[1]; // A special pointer value + const char infobar_c::LEVEL_NAME_UNSET[1]; // A special pointer value + + by + + const char infobar_c::FILE_NAME_UNSET[1] = { ' ' }; + const char infobar_c::LEVEL_NAME_UNSET[1] = { ' ' }; + + Yadex 1.0.1 doesn't compile + In src/vector.h, delete line 44 ("return this;") and compile + again. + +Misc. + + I don't have an iwad + You can download certain iwads for free ; + + + [1]Doom 1.8 shareware iwad + + [2]Heretic shareware version + + [3]Hexen demo + + [4]Strife demo + + What about a 3D preview ? + Unless I suddenly become interested in 3D graphics, that is not + going to happen. Besides, I suspect that a better and easier + way to achieve what you're after might be to implement a + reload-level in your favourite Doom port. + + Yadex is slow, particularly when dragging objects + Yes. I plan to replace the current implementation (pixmap) by + drawing directly to the window. The difficulty lies in making + that without generating a lot of flicker. In the meantime, try + the -P option. + + How many people use Yadex ? + I don't know for sure. Each new release gets a few hundred + downloads. + + Why didn't you use ? + I used plain Xlib and not a toolkit for several reasons. + Firstly, I wanted to learn Xlib. Secondly, I reckoned it would + be easier to translate the existing BGI calls to Xlib than to + some higher level toolkit. Thirdly, I feared that depending on + a toolkit would hurt portability. + _________________________________________________________________ + + AYM 2001-06-29 + +References + + 1. ftp://ftp.idsoftware.com/idstuff/doom/doom-1.8.wad.gz + 2. ftp://ftp.idsoftware.com/idstuff/heretic/htic_v12.zip + 3. ftp://ftp.idsoftware.com/idstuff/hexen/hexndemo.zip + 4. http://www.rogue-ent.com/sfiles.html diff -uaNr yadex-1.5.2/GNUmakefile yadex-1.6.0/GNUmakefile --- yadex-1.5.2/GNUmakefile 2001-06-30 23:31:28.000000000 +0200 +++ yadex-1.6.0/GNUmakefile 2003-03-31 18:57:59.000000000 +0200 @@ -1,6 +1,6 @@ # # Makefile for Yadex -# Copyright © André Majorel 1998-2000. +# Copyright © André Majorel 1998-2003. # AYM 1998-06-10 # @@ -8,52 +8,51 @@ # rules, addprefix, addsuffix, etc. It's not named "GNUmakefile" # for nothing. -# Don't change these lines. -DEFINES = -VERSION := $(shell cat VERSION) -VERPREV := $(shell test -f VERSION~ && cat VERSION~) - ######################################################################## # -# Definitions that end users +# Definitions that only hackers # might want to change # ######################################################################## -# Where you want "make install" to put things. -# Typical values : "/usr", "/usr/local" and "/opt". -PREFIX = /usr/local - -# Which OS ? -OS := $(shell uname -s | tr A-Z a-z) - -# Can we use GCC to compile BSP ? -HAVE_GCC := $(shell if gcc --version; then echo OK; fi) +# The name of the directory where objects and +# binaries are put. I include the output of +# "uname -a" to make it easier for me to build +# Yadex for different platforms from the same +# source tree. +SYSTEM := $(shell echo `uname -n`_`uname -a | cksum` | tr -dc '[:alnum:]._-') +OBJDIR = obj/0 +DOBJDIR = dobj/0 +OBJPHYSDIR = obj/$(SYSTEM) +DOBJPHYSDIR = dobj/$(SYSTEM) +OBJDIR_ATCLIB = $(OBJDIR)/atclib +DOBJDIR_ATCLIB = $(DOBJDIR)/atclib +OBJPHYSDIR_ATCLIB = $(OBJPHYSDIR)/atclib +DOBJPHYSDIR_ATCLIB = $(DOBJPHYSDIR)/atclib -# Is that /usr/man or /usr/share/man ? -FHS_MAN := $(shell if [ -d $(PREFIX)/share/man ]; then echo OK; fi) +# Create all directories and make symlinks to +# config.cc and config.h. Doing it at the start +# makes things much simpler later on. +DUMMY := $(shell \ + mkdir -p $(OBJPHYSDIR) $(OBJPHYSDIR_ATCLIB); \ + mkdir -p $(DOBJPHYSDIR) $(DOBJPHYSDIR_ATCLIB); \ + [ ! -h $(OBJDIR) ] || rm $(OBJDIR); \ + [ ! -h $(DOBJDIR) ] || rm $(DOBJDIR); \ + ln -s $(SYSTEM) $(OBJDIR); \ + ln -s $(SYSTEM) $(DOBJDIR); \ + ) -# Does your system have gettimeofday() ? -# Current rule: all systems have it. -HAVE_GETTIMEOFDAY = 1 - -# Does your system have nanosleep() ? -# Current rule: only Linux has it. -ifneq (,$(findstring $(OS), linux)) - HAVE_NANOSLEEP = 1 -endif +include $(OBJDIR)/Makefile.config -# Does your system have snprintf() ? -# Current rule: only Linux has it. -ifneq (,$(findstring $(OS), linux)) - HAVE_SNPRINTF = 1 -endif +######################################################################## +# +# Definitions that end users +# might want to change +# +######################################################################## -# Does your system have usleep() ? -# Current rule: all unices have it. -ifdef OS - HAVE_USLEEP = 1 -endif +# Which OS ? +OS := $(shell uname -s | tr A-Z a-z) # Where your X11 libraries and headers reside. # Current rule: @@ -73,25 +72,25 @@ endif endif -# Your C and C++ compilers. -CC = cc -CXX = c++ +# C and C++ compiler +#CC = cc +#CXX = c++ # Options used when compiling Atclib. CFLAGS = -O # Options used when compiling and linking Yadex. -# ld is invoked through the C++ compiler -# so LDFLAGS should not contain options that mean +# ld is invoked through the C++ compiler so +# LDFLAGS should not contain options that mean # something to the C++ compiler. -CXXFLAGS = -O -I$(X11INCLUDEDIR) -LDFLAGS = +CXXFLAGS = -O +#LDFLAGS = # Options used to compile and link the debugging # targets. Not used by normal end-user targets. # Unlike CFLAGS, CXXFLAGS and LDFLAGS, assume # GCC/EGCS. -DCFLAGS = -g -O -I$(X11INCLUDEDIR) +DCFLAGS = -g -O DCFLAGS += -Wall # GCC warnings DCFLAGS += -pedantic # GCC warnings DCFLAGS += -Wno-parentheses # GCC warnings @@ -104,7 +103,7 @@ DCFLAGS += -Winline # GCC warnings DCFLAGS += -pg # Profiling -DCXXFLAGS = -g -O -I$(X11INCLUDEDIR) +DCXXFLAGS = -g -O DCXXFLAGS += -Wall # GCC warnings DCXXFLAGS += -pedantic # GCC warnings DCXXFLAGS += -Wno-parentheses # GCC warnings @@ -130,13 +129,15 @@ ######################################################################## MAKEFILE = GNUmakefile +VERSION := $(shell cat VERSION) +VERPREV := $(shell test -f VERPREV && cat VERPREV) # All the modules of Yadex without path or extension. -MODULES_YADEX =\ +MODULES_YADEX = \ acolours aym bench bitvec \ - cfgfile checks colour1 \ - colour2 colour3 colour4 dependcy \ - dialog disppic drawmap \ + cfgfile checks colour1 colour2 \ + colour3 colour4 config credits \ + dependcy dialog disppic drawmap \ edisplay editgrid editlev editloop \ editobj editsave endian editzoom \ entry entry2 events flats \ @@ -146,28 +147,27 @@ img imgscale imgspect infobar \ input l_align l_centre l_flags \ l_misc l_prop l_unlink l_vertices \ - levels lists lumpdir macro \ - memory menubar menu mkpalette \ - mouse names nop objects \ - objinfo oldmenus palview patchdir \ - pic2img prefer s_centre s_door \ - s_lift s_linedefs s_merge s_misc \ - s_prop s_split s_swapf s_vertices \ - sanity \ - savepic scrnshot selbox selectn \ - selpath selrect serialnum spritdir \ - sticker swapmem t_centre t_flags \ - t_prop \ - t_spin textures things trace \ - v_centre v_merge v_polyg vectext \ - verbmsg \ - version wadnamec wadres wads \ - wads2 warn windim x_centre \ - x_exchng x_mirror x_rotate x11 \ - xref yadex ytime + levels lists locate lumpdir \ + macro memory menubar menu \ + mkpalette mouse names nop \ + objects objinfo oldmenus palview \ + patchdir pic2img prefer s_centre \ + s_door s_lift s_linedefs s_merge \ + s_misc s_prop s_slice s_split \ + s_swapf s_vertices sanity scrnshot \ + selbox selectn selpath selrect \ + serialnum spritdir sticker swapmem \ + t_centre t_flags t_prop t_spin \ + textures things trace v_centre \ + v_merge v_polyg vectext verbmsg \ + version wadfile wadlist wadnamec \ + wadres wads wads2 warn \ + windim x_centre x_exchng x_hover \ + x_mirror x_rotate x11 xref \ + yadex ytime # All the modules of Atclib without path or extension. -MODULES_ATCLIB =\ +MODULES_ATCLIB = \ al_adigits al_aerrno al_astrerror al_fana \ al_fnature al_lateol al_lcount al_lcreate \ al_ldelete al_ldiscard al_lgetpos al_linsert \ @@ -178,68 +178,32 @@ al_sapc al_saps al_scps al_scpslower \ al_sdup al_sisnum al_strolc -# All the modules of BSP without path or extension. -MODULES_BSP =\ - bsp funcs makenode picknode - -# The source files of Yadex, Atclib and BSP +# The source files of Yadex and Atclib SRC_YADEX = $(addprefix src/, $(addsuffix .cc, $(MODULES_YADEX))) SRC_ATCLIB = $(addprefix atclib/, $(addsuffix .c, $(MODULES_ATCLIB))) -SRC_BSP = $(addprefix bsp-2.3/, $(addsuffix .c, $(MODULES_BSP))) -# The headers of Yadex, Atclib and BSP +# The headers of Yadex and Atclib HEADERS_YADEX := $(wildcard src/*.h) HEADERS_ATCLIB = atclib/atclib.h -HEADERS_BSP = bsp-2.3/bsp.h bsp-2.3/structs.h # All the source files, including the headers. -SRC = $(SRC_YADEX) $(HEADERS_YADEX)\ - $(SRC_ATCLIB) $(HEADERS_ATCLIB)\ - $(SRC_BSP) $(HEADERS_BSP) +SRC = $(filter-out src/config.cc, $(SRC_YADEX)) \ + $(filter-out src/config.h, $(HEADERS_YADEX)) \ + $(SRC_ATCLIB) $(HEADERS_ATCLIB) # The files on which youngest is run. -SRC_NON_GEN = $(filter-out src/version.cc, $(SRC)) - -# Defines used when compiling Yadex. -# If you change Y_UNIX for Y_DOS or Y_X11 for Y_BGI, -# don't even expect it to compile. As of this release, -# the DOS/BGI version is _broken_. -DEFINES += -DY_UNIX -DY_X11 -#DEFINES += -DY_ALPHA -#DEFINES += -DY_BETA -ifdef HAVE_GETTIMEOFDAY - DEFINES += -DY_GETTIMEOFDAY -endif -ifdef HAVE_NANOSLEEP - DEFINES += -DY_NANOSLEEP -endif -ifdef HAVE_SNPRINTF - DEFINES += -DY_SNPRINTF -endif -ifdef HAVE_USLEEP - DEFINES += -DY_USLEEP -endif +SRC_NON_GEN = $(filter-out src/credits.cc src/prefix.cc src/version.cc, $(SRC)) -# The name of the directory where objects and binaries -# are put. I include the output of "uname -a" to make -# it easier for me to build Yadex for different platforms -# from the same source tree. -OBJSUBDIR := $(shell uname -a | tr -c "[:alnum:]._-" "[_*]") -OBJDIR = obj/0 -DOBJDIR = dobj/0 -OBJPHYSDIR = obj/$(OBJSUBDIR) -DOBJPHYSDIR = dobj/$(OBJSUBDIR) -OBJDIR_ATCLIB = $(OBJDIR)/atclib -DOBJDIR_ATCLIB = $(DOBJDIR)/atclib -OBJPHYSDIR_ATCLIB = $(OBJPHYSDIR)/atclib -DOBJPHYSDIR_ATCLIB = $(DOBJPHYSDIR)/atclib +# The object files +OBJ_CONFIG =# $(OBJDIR)/config.o +DOBJ_CONFIG =# $(DOBJDIR)/config.o OBJ_YADEX = $(addprefix $(OBJDIR)/, $(addsuffix .o, $(MODULES_YADEX))) DOBJ_YADEX = $(addprefix $(DOBJDIR)/, $(addsuffix .o, $(MODULES_YADEX))) -OBJ_ATCLIB = $(addprefix $(OBJDIR_ATCLIB)/, $(addsuffix .o, $(MODULES_ATCLIB))) -DOBJ_ATCLIB = $(addprefix $(DOBJDIR_ATCLIB)/, $(addsuffix .o, $(MODULES_ATCLIB))) +OBJ_ATCLIB = $(addprefix $(OBJDIR_ATCLIB)/, $(addsuffix .o,$(MODULES_ATCLIB))) +DOBJ_ATCLIB = $(addprefix $(DOBJDIR_ATCLIB)/, $(addsuffix .o,$(MODULES_ATCLIB))) # The game definition files. -YGD = $(addprefix ygd/,\ +YGD = $(addprefix ygd/, \ doom.ygd doom02.ygd doom04.ygd doom05.ygd \ doom2.ygd doompr.ygd heretic.ygd hexen.ygd \ strife.ygd strife10.ygd) @@ -247,14 +211,14 @@ # Files that are used with scripts/process to # generate files that are included in the # distribution archive. -DOC1_SRC =\ +DOC1_SRC = \ docsrc/README \ docsrc/README.doc # Files that are used with scripts/process to # generate files that go in the doc/ directory # and are NOT included in the archive. -DOC2_SRC_HTML =\ +DOC2_SRC_HTML = \ docsrc/advanced.html \ docsrc/contact.html \ docsrc/credits.html \ @@ -268,6 +232,7 @@ docsrc/index.html \ docsrc/keeping_up.html \ docsrc/legal.html \ + docsrc/packagers_guide.html \ docsrc/palette.html \ docsrc/reporting.html \ docsrc/tips.html \ @@ -277,15 +242,14 @@ docsrc/wad_specs.html \ docsrc/ygd.html -DOC2_SRC_MISC =\ - bsp-2.3/ybsp.6 \ +DOC2_SRC_MISC = \ docsrc/yadex.6 \ # docsrc/yadex.lsm\ # Files that must be put in the distribution # archive. Most (but not all) are generated from # $(DOC1_SRC_*) into the base directory. -DOC1 = README doc/README +DOC1 = FAQ README doc/README # Files that go in the doc/ directory and must # NOT be put in the distribution archive. Most @@ -295,69 +259,108 @@ # Misc. other files that must be put in the # distribution archive. -MISC_FILES =\ - src/.srcdate \ - src/.uptodate \ - CHANGES \ - COPYING \ - COPYING.LIB \ - GNUmakefile \ - Makefile \ - TODO \ - VERSION \ - bsp-2.3/bsp23x.txt \ - bsp-2.3/transdor.wad \ - docsrc/.pixlist \ - yadex.cfg \ +MISC_FILES = \ + boost/boost/config.hpp \ + boost/boost/config/compiler/borland.hpp \ + boost/boost/config/compiler/comeau.hpp \ + boost/boost/config/compiler/common_edg.hpp \ + boost/boost/config/compiler/compaq_cxx.hpp \ + boost/boost/config/compiler/gcc.hpp \ + boost/boost/config/compiler/greenhills.hpp \ + boost/boost/config/compiler/hp_acc.hpp \ + boost/boost/config/compiler/intel.hpp \ + boost/boost/config/compiler/kai.hpp \ + boost/boost/config/compiler/metrowerks.hpp \ + boost/boost/config/compiler/mpw.hpp \ + boost/boost/config/compiler/sgi_mipspro.hpp \ + boost/boost/config/compiler/sunpro_cc.hpp \ + boost/boost/config/compiler/vacpp.hpp \ + boost/boost/config/compiler/visualc.hpp \ + boost/boost/config/platform/aix.hpp \ + boost/boost/config/platform/beos.hpp \ + boost/boost/config/platform/bsd.hpp \ + boost/boost/config/platform/cygwin.hpp \ + boost/boost/config/platform/hpux.hpp \ + boost/boost/config/platform/irix.hpp \ + boost/boost/config/platform/linux.hpp \ + boost/boost/config/platform/macos.hpp \ + boost/boost/config/platform/solaris.hpp \ + boost/boost/config/platform/win32.hpp \ + boost/boost/config/posix_features.hpp \ + boost/boost/config/select_compiler_config.hpp \ + boost/boost/config/select_platform_config.hpp \ + boost/boost/config/select_stdlib_config.hpp \ + boost/boost/config/stdlib/dinkumware.hpp \ + boost/boost/config/stdlib/libstdcpp3.hpp \ + boost/boost/config/stdlib/modena.hpp \ + boost/boost/config/stdlib/msl.hpp \ + boost/boost/config/stdlib/roguewave.hpp \ + boost/boost/config/stdlib/sgi.hpp \ + boost/boost/config/stdlib/stlport.hpp \ + boost/boost/config/stdlib/vacpp.hpp \ + boost/boost/config/suffix.hpp \ + boost/boost/config/user.hpp \ + boost/boost/smart_ptr.hpp \ + boost/boost/static_assert.hpp \ + boost/boost/utility.hpp \ + boost/boost/utility/base_from_member.hpp \ + boost/boost/utility_fwd.hpp \ + cache/copyright.man \ + cache/copyright.txt \ + cache/pixlist \ + cache/srcdate \ + cache/uptodate \ + configure \ + docsrc/copyright \ + CHANGES \ + COPYING \ + COPYING.LIB \ + GNUmakefile \ + Makefile \ + TODO \ + VERSION \ + yadex.cfg \ yadex.dep # The images used in the HTML doc. FIXME: "&1 - -.PHONY: ybsp -ybsp: $(BINDIR)/ybsp - -$(BINDIR)/ybsp: $(SRC_BSP) $(HEADERS_BSP) $(MAKEFILE) - @echo -ifdef HAVE_GCC - @echo Compiling and linking BSP with gcc - @gcc bsp-2.3/bsp.c -DYADEX_VERSION=\"$(VERSION)\" \ - -O2 -Wall -Winline -finline-functions -ffast-math -lm -o $@ -else - @echo Compiling and linking BSP with cc - @$(CC) bsp-2.3/bsp.c -DYADEX_VERSION=\"$(VERSION)\" -O2 -lm -o $@ -endif +$(OBJDIR)/yadex: $(OBJ_CONFIG) $(OBJ_YADEX) $(OBJ_ATCLIB) $(MAKEFILE) + @echo "** Linking Yadex" + $(CXX) $(OBJ_CONFIG) $(OBJ_YADEX) $(OBJ_ATCLIB) -o $@ \ + -L$(X11LIBDIR) -lX11 -lm -lc $(LDFLAGS) .PHONY: test test: - $(BINDIR)/yadex $(A) + $(OBJDIR)/yadex $(A) .PHONY: install -install: - @echo - @scripts/mkinstalldirs $(INST_BINDIR) - @scripts/mkinstalldirs $(INST_CFGDIR) - @scripts/mkinstalldirs $(INST_MANDIR) - @scripts/mkinstalldirs $(INST_YGDDIR) - @echo Installing yadex and ybsp in $(INST_BINDIR) - cp -p $(BINDIR)/yadex $(INST_BINDIR)/yadex-$(VERSION) 2>&1 - ln -sf yadex-$(VERSION) $(INST_BINDIR)/yadex 2>&1 - cp -p $(BINDIR)/ybsp $(INST_BINDIR)/ybsp-$(VERSION) 2>&1 - ln -sf ybsp-$(VERSION) $(INST_BINDIR)/ybsp 2>&1 - @echo Installing man pages in $(INST_MANDIR) - cp -p doc/yadex.6 $(INST_MANDIR) 2>&1 - cp -p doc/ybsp.6 $(INST_MANDIR) 2>&1 - @echo Installing game definition files in $(INST_YGDDIR) - cp -p $(YGD) $(INST_YGDDIR) 2>&1 - @echo Installing configuration file in $(INST_CFGDIR) - cp -p yadex.cfg $(INST_CFGDIR) 2>&1 - chmod a+w $(INST_CFGDIR)/yadex.cfg 2>&1 +install: $(OBJDIR)/install + @scripts/mkinstalldirs $(BINDIR) + @scripts/mkinstalldirs $(ETCDIR) + @scripts/mkinstalldirs $(MANDIR) + @scripts/mkinstalldirs $(MANDIR)/man6 + @scripts/mkinstalldirs $(SHAREDIR) + $(OBJDIR)/install -m 755 $(OBJDIR)/yadex $(BINDIR)/yadex-$(VERSION) + rm -f $(BINDIR)/yadex + ln -s yadex-$(VERSION) $(BINDIR)/yadex + $(OBJDIR)/install -m 644 doc/yadex.6 $(MANDIR)/man6/yadex-$(VERSION).6 + rm -f $(MANDIR)/man6/yadex.6 + ln -s yadex-$(VERSION).6 $(MANDIR)/man6/yadex.6 + $(OBJDIR)/install -m 644 -d $(SHAREDIR) $(YGD) + $(OBJDIR)/install -m 644 -d $(ETCDIR) yadex.cfg @echo "---------------------------------------------------------------" @echo " Yadex is now installed." @echo @echo " Before you run it, enter the paths to your iwads in" - @echo " $(INST_CFGDIR)/yadex.cfg." + @echo " $(ETCDIR)/yadex.cfg or ~/.yadex/yadex.cfg." @echo " When you're done, type \"yadex\" to start." - @echo " If you're confused, take a look at index.html." + @echo " If you're confused, take a look at doc/index.html." @echo - @echo " Good editing !" + @echo " Happy editing !" @echo "---------------------------------------------------------------" .PHONY: clean clean: - rm -r $(OBJPHYSDIR) + rm -f $(OBJ_CONFIG) $(OBJ_YADEX) $(OBJ_ATCLIB) $(OBJDIR)/yadex + rm -f $(DOBJ_CONFIG) $(DOBJ_YADEX) $(DOBJ_ATCLIB) $(DOBJDIR)/yadex + rm -f $(OBJDIR)/ftime + rm -f $(OBJDIR)/install + rm -f $(OBJDIR)/notexist + rm -f $(OBJDIR) + rm -f $(DOBJDIR) + rm -rf doc .PHONY: dclean dclean: - rm -r $(DOBJPHYSDIR) + rm -rf $(DOBJPHYSDIR) + rm -f $(DOBJDIR) .PHONY: doc -doc: docsrc/.pixlist docdirs $(DOC1) doc2 +doc: cache/pixlist docdirs $(DOC1) doc2 # Have to put it separately because evaluation -# of $(DOC2) requires docsrc/.pixlist to exist. +# of $(DOC2) requires cache/pixlist to exist. .PHONY: doc2 doc2: $(DOC2) .PHONY: help help: @echo User targets: - @echo "make [all] Build Yadex and BSP" - @echo "make yadex Build Yadex" - @echo "make ybsp Build BSP" - @echo "make test [A=args] Test Yadex" - @echo "make install [PREFIX=dir] Install Yadex and BSP" + @echo "make [all] Build everything" + @echo "make yadex Build Yadex" + @echo "make test [A=args] Test Yadex" + @echo "make install Install everything" + @echo "make showconf Show current configuration" @echo @echo Hacker targets: - @echo "make dall Build debug version of Yadex and BSP" + @echo "make dall Build debug version of everything" @echo "make dyadex Build debug version of Yadex" - @echo "make dybsp Build debug version of BSP" @echo "make dtest [A=args] Test debug version of Yadex" @echo "make dg Run debug version of Yadex through gdb" @echo "make dd Run debug version of Yadex through ddd" @@ -466,7 +456,6 @@ @echo "make ps View man page with gv" @echo "make dist Create distribution archive" @echo "make save Create backup archive" - @echo "make showconf Show current configuration" ######################################################################## @@ -482,142 +471,130 @@ .PHONY: save save: - tar -zcvf yadex-$$(date '+%Y%m%d').tgz\ - --exclude "*.wad"\ - --exclude "*.zip"\ - --exclude "core"\ - --exclude "dos/*"\ - --exclude "obj"\ - --exclude "dobj"\ - --exclude "old/*"\ - --exclude "*~"\ - --exclude "*.bak"\ - --exclude "web/arc"\ - --exclude yadex-$$(date '+%Y%m%d').tgz\ + tar -Icvf yadex-$$(date '+%Y%m%d').tar.bz2 \ + --exclude "*.wad" \ + --exclude "*.zip" \ + --exclude "core" \ + --exclude "dos/*" \ + --exclude "obj" \ + --exclude "dobj" \ + --exclude "old/*" \ + --exclude "*~" \ + --exclude "*.bak" \ + --exclude "web/arc" \ + --exclude yadex-$$(date '+%Y%m%d').tar.bz2 \ . .PHONY: dall -dall: yadex.dep ddirs dyadex dybsp $(YGD) +dall: yadex.dep dyadex $(YGD) .PHONY: dyadex -dyadex: ddirs $(DBINDIR)/yadex +dyadex: $(DOBJDIR)/yadex -$(DBINDIR)/yadex: $(DOBJ_YADEX) $(DOBJ_ATCLIB) $(MAKEFILE) - @echo - @echo Linking Yadex - @$(CXX) $(DOBJ_YADEX) $(DOBJ_ATCLIB) -o $@\ - -L$(X11LIBDIR) -lc -lm -lX11 $(DLDFLAGS) 2>&1 - -.PHONY: dybsp -dybsp: ddirs $(DBINDIR)/ybsp - -$(DBINDIR)/ybsp: $(SRC_BSP) $(HEADERS_BSP) $(MAKEFILE) - @echo - @echo Compiling and linking BSP - @$(CC) bsp-2.3/bsp.c -Wall -Winline -O2 -finline-functions\ - -ffast-math -lm -o $@ +$(DOBJDIR)/yadex: $(DOBJ_CONFIG) $(DOBJ_YADEX) $(DOBJ_ATCLIB) $(MAKEFILE) + @echo "** Linking Yadex" + $(CXX) $(DOBJ_CONFIG) $(DOBJ_YADEX) $(DOBJ_ATCLIB) -o $@ \ + -L$(X11LIBDIR) -lX11 -lm -lc $(DLDFLAGS) .PHONY: dtest dtest: - $(DBINDIR)/yadex $(A) - gprof $(DBINDIR)/yadex >gprof.out + $(DOBJDIR)/yadex $(A) + gprof $(DOBJDIR)/yadex >gprof.out .PHONY: dg dg: - gdb $(DBINDIR)/yadex + gdb $(DOBJDIR)/yadex .PHONY: dd dd: - ddd $(DBINDIR)/yadex + ddd $(DOBJDIR)/yadex + +.PHONY: asm +asm: $(addprefix $(OBJDIR)/, $(addsuffix .S, $(MODULES_YADEX))) # Generate the distribution archives. Requires GNU tar, -# GNU cp, gzip and optionally bzip2. bzip2 is cool but, -# in this case, it's 900% slower than gzip while being -# only 15% more efficient. That's why the creation -# of the .tar.bz2 archive is commented out. +# GNU cp, gzip and optionally bzip2 (if distbz2 is +# uncommented). .PHONY: dist dist: changes distimage distgz distdiff #distbz2 - @echo "> Removing distribution image tree $(ARCHIVE)" + @echo "** Removing distribution image tree $(ARCHIVE)" rm -r $(ARCHIVE) .PHONY: distimage distimage: all $(ARC_FILES) - @echo "> Creating distribution image tree $(ARCHIVE)" - @[ ! -e $(ARCHIVE) ] || (echo "Error: $(ARCHIVE) already exists"; false) + @echo "** Creating distribution image tree $(ARCHIVE)" + rm -rf $(ARCHIVE) scripts/mkinstalldirs $(ARCHIVE) @tar -cf - $(ARC_FILES) | (cd $(ARCHIVE); tar -xf -) .PHONY: distgz distgz: distimage - @echo "> Creating gzipped distribution" + @echo "** Creating tar.gz distribution" tar -czf $(ARCHIVE).tar.gz $(ARCHIVE) .PHONY: distbz2 distbz2: distimage - @echo "> Creating bzip2'd distribution" + @echo "** Creating .tar.bz2 distribution" tar -cIf $(ARCHIVE).tar.bz2 $(ARCHIVE) .PHONY: distdiff TMP0 = $$HOME/tmp TMPPREV = $(TMP0)/$(ARCPREV) TMPCURR = $(TMP0)/$(ARCHIVE) -TMPDIFF = $(TMP0)/$(ARCDIFF) -DIFF = $(TMP0)/$(ARCDIFF)/$(ARCDIFF) distdiff: - @echo "> Building the diff distribution" - @echo ">> Creating the diff" - @[ ! -e $(TMPPREV) ] || (echo "Error: $(TMPPREV) already exists"; false) - @[ ! -e $(TMPCURR) ] || (echo "Error: $(TMPCURR) already exists"; false) - @[ ! -e $(TMPDIFF) ] || (echo "Error: $(TMPDIFF) already exists"; false) - tar -xzf $(ARCHIVE).tar.gz -C $(TMP0) + @echo "** Building the diff distribution" + @echo "Creating the diff" + rm -rf $(TMPPREV) $(TMPCURR) $(TMPDIFF) + mkdir -p $(TMP0) + tar -xzf $(ARCHIVE).tar.gz -C $(TMP0) tar -xzf ../yadex-arc/pub/$(ARCPREV).tar.gz -C $(TMP0) - mkdir -p $(TMPDIFF) - cd $(TMP0) && (diff -uNr $(ARCPREV) $(ARCHIVE) >$(DIFF) || true) - #! grep "Binary files y.* and .* differ" $(DIFF) - scripts/process docsrc/README.diff >$(TMPDIFF)/README - cd $(TMP0) && tar -czf $(ARCDIFF).tar.gz $(ARCDIFF) - cd $(TMPO) && rm -rf $(ARCDIFF) - cd $(TMP0) && tar -xzf $(ARCDIFF).tar.gz - @echo ">> Verifying the diff" - cd $(TMPPREV) && patch -p1 <../$(ARCDIFF)/$(ARCDIFF) - cd $(TMP0) && diff -r $(ARCPREV) $(ARCHIVE) - mv $(TMPDIFF).tar.gz . - @echo ">> Cleaning up" + scripts/process docsrc/README.diff >$(TMP0)/$(ARCDIFF) + echo >>$(TMP0)/$(ARCDIFF) + cd $(TMP0) && (diff -uaNr $(ARCPREV) $(ARCHIVE) >>$(ARCDIFF) || true) + @# KLUDGE - On my system, just "! grep" makes make choke + true; ! grep "^Binary files .* and .* differ" $(TMP0)/$(ARCDIFF) + gzip -f $(TMP0)/$(ARCDIFF) + @echo "Verifying the diff" + cd $(TMPPREV) && gzip -d <../$(ARCDIFF).gz | patch -p1 + @# FIXME remove -N after 1.6 is done, it's there because + @# uptodate has been moved between 1.5 and 1.6 and since + @# it's empty it remains in $(ARCPREV). + cd $(TMP0) && diff -rP $(ARCHIVE) $(ARCPREV) + mv $(TMP0)/$(ARCDIFF).gz . + @echo "Cleaning up" cd $(TMP0) && rm -rf $(ARCPREV) cd $(TMP0) && rm -rf $(ARCHIVE) - cd $(TMP0) && rm -rf $(ARCDIFF) .PHONY: showconf showconf: @echo "ARCHIVE \"$(ARCHIVE)\"" + @echo "BINDIR \"$(BINDIR)\"" @echo "CC \"$(CC)\"" @echo "CFLAGS \"$(CFLAGS)\"" @echo "CXX \"$(CXX)\"" @echo "CXXFLAGS \"$(CXXFLAGS)\"" @echo "DCFLAGS \"$(DCFLAGS)\"" @echo "DCXXFLAGS \"$(DCXXFLAGS)\"" - @echo "DEFINES \"$(DEFINES)\"" @echo "DLDFLAGS \"$(DLDFLAGS)\"" - @echo "FHS_MAN \"$(FHS_MAN)\"" - @echo "HAVE_GCC \"$(HAVE_GCC)\"" + @echo "ETCDIR \"$(ETCDIR)\"" + @echo "ETCDIRNV \"$(ETCDIRNV)\"" @echo "HAVE_GETTIMEOFDAY \"$(HAVE_GETTIMEOFDAY)\"" @echo "HAVE_NANOSLEEP \"$(HAVE_NANOSLEEP)\"" @echo "HAVE_SNPRINTF \"$(HAVE_SNPRINTF)\"" @echo "HAVE_USLEEP \"$(HAVE_USLEEP)\"" - @echo "INST_BINDIR \"$(INST_BINDIR)\"" - @echo "INST_CFGDIR \"$(INST_CFGDIR)\"" - @echo "INST_MANDIR \"$(INST_MANDIR)\"" - @echo "INST_YGDDIR \"$(INST_YGDDIR)\"" @echo "LDFLAGS \"$(LDFLAGS)\"" - @echo "OBJSUBDIR \"$(OBJSUBDIR)\"" + @echo "MANDIR \"$(MANDIR)\"" @echo "OS \"$(OS)\"" @echo "PREFIX \"$(PREFIX)\"" + @echo "SHAREDIR \"$(SHAREDIR)\"" + @echo "SHAREDIRNV \"$(SHAREDIRNV)\"" @echo "SHELL \"$(SHELL)\"" + @echo "SYSTEM \"$(SYSTEM)\"" @echo "VERSION \"$(VERSION)\"" @echo "X11INCLUDEDIR \"$(X11INCLUDEDIR)\"" @echo "X11LIBDIR \"$(X11LIBDIR)\"" - @echo "c++ --version \"`c++ --version`\"" - @echo "cc --version \"`cc --version`\"" + @echo "CXX --version \"`$(CXX) --version`\"" + @echo "CC --version \"`$(CC) --version`\"" @echo "shell \"$$SHELL\"" @echo "uname \"`uname`\"" @@ -629,6 +606,17 @@ # ######################################################################## +# If Makefile.config doesn't exist, give a hint... +$(OBJDIR)/Makefile.config: + @echo "Sorry guv'nor, but... did you run ./configure ?" >&2 + @false + +$(OBJDIR)/files_etc.man: $(OBJDIR)/config.etc $(MAKEFILE) + sed 's/%v/$(VERSION)/g; s,.*,.B &/yadex.cfg,' $< >$@ + +$(OBJDIR)/files_share.man: $(OBJDIR)/config.share $(MAKEFILE) + sed 's/%v/$(VERSION)/g; s,.*,.BI &/ game .ygd,' $< >$@ + # Dependencies of the modules of Yadex # -Y is here to prevent the inclusion of dependencies on # /usr/include/*.h etc. As a side-effect, it generates many @@ -646,162 +634,152 @@ # Note: the modules of Atclib are not scanned as they all # depend on $(HEADERS_ATCLIB) and nothing else. -yadex.dep: $(SRC_YADEX) - @echo - @echo makedepend - @makedepend -f- -Y -Iatclib $(DEFINES) $(SRC_YADEX) 2>/dev/null\ - | awk 'sub (/^src/, "") == 1 {\ - print "'$(OBJDIR)'" $$0;\ - print "'$(DOBJDIR)'" $$0;\ - next;\ +yadex.dep: $(SRC_NON_GEN) + @echo "Generating $@" + @makedepend -f- -Y -Iatclib $(SRC_NON_GEN) 2>/dev/null \ + | awk 'sub (/^src/, "") == 1 { \ + print "'$(OBJDIR)'" $$0; \ + print "'$(DOBJDIR)'" $$0; \ + next; \ }' >$@ +cache/copyright.man: $(MAKEFILE) scripts/copyright docsrc/copyright + scripts/copyright -m docsrc/copyright >$@ + +cache/copyright.txt: $(MAKEFILE) scripts/copyright docsrc/copyright + scripts/copyright -t docsrc/copyright | sed 's/^./ &/' >$@ + # The YYYY-MM-DD date indicated in the parentheses after the # version number is the mtime of the most recent source file # (where "being a source file" is defined as "being listed in # $(SRC_NON_GEN)"). That string is the output of a perl script, # scripts/youngest. Since perl is not necessarily installed on -# all machines, we cache that string in the file src/.srcdate +# all machines, we cache that string in the file cache/srcdate # and include that file in the distribution archive. If we # didn't do that, people who don't have perl would be unable to # build Yadex. # -# Conceptually, src/.srcdate depends on $(SRC_NON_GEN) and -# doc/*.html depend on src/.srcdate. However, we can't write the +# Conceptually, cache/srcdate depends on $(SRC_NON_GEN) and +# doc/*.html depend on cache/srcdate. However, we can't write the # makefile that way because if we did, that would cause two # problems. Firstly every time a source file is changed, # scripts/youngest would be ran, most of the time for nothing # since its output is always the same, unless it's never been -# run today. Secondly, src/.srcdate being just generated, it's +# run today. Secondly, cache/srcdate being just generated, it's # more recent than the content of the doc/ directory. The result # would be that the entire doc/ directory would be rebuilt every # time a single source file is changed, which is guaranteed to # have an unnerving effect on the hacker at the keyboard. # # Part of the solution is to systematically force the mtime of -# src/.srcdate to 00:00, today. Thus, src/.srcdate always looks +# cache/srcdate to 00:00, today. Thus, cache/srcdate always looks # older than the content of the doc/ directory, unless it's not # been refreshed yet today. # -# But that's not enough because then src/.srcdate also looks +# But that's not enough because then cache/srcdate also looks # always older than the source files it depends on, and thus # make attempts to regenerate it every time make is invoked at -# all, which would render the very existence of src/.srcdate -# useless. That's why we have another file, src/.uptodate, that +# all, which would render the very existence of cache/srcdate +# useless. That's why we have another file, cache/uptodate, that # we touch to keep track of the time when we last generated -# src/.srcdate. +# cache/srcdate. # # If there was a such thing as _date-only_ dependencies, I could # get away with just this : # -# src/.srcdate: scripts/youngest -# src/.srcdate $(SRC_NON_GEN) +# cache/srcdate: scripts/youngest +# cache/srcdate $(SRC_NON_GEN) # if perl -v >/dev/null 2>&1; then\ # scripts/youngest >$@;\ # else\ # blah... -# doc/*.html src/.srcdate +# doc/*.html cache/srcdate # blah... # # That would save two calls to "touch", one intermediary -# dependency (src/.uptodate) and a lot of obfuscation. - -src/.srcdate: src/.uptodate +# dependency (cache/uptodate) and a lot of obfuscation. +cache/srcdate: cache/uptodate -src/.uptodate: scripts/youngest $(SRC_NON_GEN) - @if perl -v >/dev/null 2>&1; then\ - echo Generating src/.srcdate;\ - scripts/youngest $(SRC_NON_GEN) >src/.srcdate;\ - touch -t `date '+%m%d'`0000 src/.srcdate;\ - elif [ -f src/.srcdate ]; then\ - echo Perl not available. Keeping old src/.srcdate;\ - else\ - echo Perl not available. Creating bogus src/.srcdate;\ - date '+%Y-%m-%d' >src/.srcdate;\ +cache/uptodate: scripts/youngest $(SRC_NON_GEN) + @mkdir -p cache + @if perl -v >/dev/null 2>&1; then \ + echo Generating cache/srcdate; \ + scripts/youngest $(SRC_NON_GEN) >cache/srcdate; \ + touch -t `date '+%m%d'`0000 cache/srcdate; \ + elif [ -r cache/srcdate ]; then \ + echo Perl not available. Keeping old cache/srcdate; \ + else \ + echo Perl not available. Creating bogus cache/srcdate; \ + date '+%Y-%m-%d' >cache/srcdate; \ fi @touch $@; -# Directories where objects and binaries are put. +# To compile the modules of Yadex # (normal and debugging versions) +include yadex.dep -.PHONY: dirs -dirs: - @if [ ! -d $(OBJPHYSDIR)\ - -o ! -d $(OBJPHYSDIR_ATCLIB) ];\ - then\ - echo Creating object directories;\ - scripts/mkinstalldirs $(OBJPHYSDIR) 2>&1;\ - scripts/mkinstalldirs $(OBJPHYSDIR_ATCLIB) 2>&1;\ - fi - @if [ -e $(OBJDIR) ]; then rm $(OBJDIR) 2>&1; fi - @ln -sf $(OBJSUBDIR) $(OBJDIR) 2>&1 - -.PHONY: ddirs -ddirs: - @if [ ! -d $(DOBJPHYSDIR)\ - -o ! -d $(DOBJPHYSDIR_ATCLIB) ];\ - then\ - echo Creating object directories;\ - scripts/mkinstalldirs $(DOBJPHYSDIR) 2>&1;\ - scripts/mkinstalldirs $(DOBJPHYSDIR_ATCLIB) 2>&1;\ - fi - @if [ -e $(DOBJDIR) ]; then rm $(DOBJDIR) 2>&1; fi - @ln -sf $(OBJSUBDIR) $(DOBJDIR) 2>&1 +# It's simpler to copy config.cc into src/ than to have a +# compilation rule for just one file. +src/config.cc: $(OBJDIR)/config.cc + cp -p $< $@ -# To compile the modules of Yadex -# (normal and debugging versions) +src/config.h: $(OBJDIR)/config.h + cp -p $< $@ -include yadex.dep $(OBJDIR)/%.o: src/%.cc - @echo - @echo $(CXX) $< - @$(CXX) $(CXXFLAGS) -c -Iatclib $(DEFINES) $< -o $@ 2>&1 + $(CXX) -c -Iatclib -Iboost -I$(X11INCLUDEDIR) $(CXXFLAGS) $< -o $@ $(DOBJDIR)/%.o: src/%.cc - @echo - @echo $(CXX) $< - @$(CXX) $(DCXXFLAGS) -c -Iatclib $(DEFINES) $< -o $@ 2>&1 + $(CXX) -c -Iatclib -Iboost -I$(X11INCLUDEDIR) $(DCXXFLAGS) $< -o $@ # To compile the modules of Atclib # (normal and debugging versions) - $(OBJDIR_ATCLIB)/%.o: atclib/%.c $(HEADERS_ATCLIB) - @echo - @echo $(CC) $< - @$(CC) $(CFLAGS) -c $< -o $@ 2>&1 + $(CC) -c $(CFLAGS) $< -o $@ $(DOBJDIR_ATCLIB)/%.o: atclib/%.c $(HEADERS_ATCLIB) - @echo - @echo $(CC) $< - @$(CC) $(DCFLAGS) -c $< -o $@ 2>&1 + $(CC) -c $(DCFLAGS) $< -o $@ + +# To see the generated assembly code +# for the modules of Yadex +$(OBJDIR)/%.S: src/%.cc $(MAKEFILE) + $(CXX) $(CXXFLAGS) -S -fverbose-asm -Iatclib -Iboost -I$(X11INCLUDEDIR)\ + $< -o $@ + +# A source file containing the credits +src/credits.cc: $(MAKEFILE) docsrc/copyright scripts/copyright + @echo Generating $@ + @echo '// DO NOT EDIT -- generated from docsrc/copyright' >$@ + scripts/copyright -c docsrc/copyright >>$@ # A source file containing just the date of the # most recent source file and the version number -# (found in ./VERSION). - -src/version.cc: $(SRC_NON_GEN) VERSION src/.srcdate - @echo +# (found in ./VERSION) +src/version.cc: $(SRC_NON_GEN) VERSION cache/srcdate $(MAKEFILE) @echo Generating $@ + @printf '// DO NOT EDIT -- generated from VERSION\n\n' >$@ @printf "extern const char *const yadex_source_date = \"%s\";\n" \ - `cat src/.srcdate` >$@ - @printf "extern const char *const yadex_version = \"%s\";\n" \ - $(VERSION) >>$@ + `cat cache/srcdate` >>$@ + @printf "extern const char *const yadex_version = \"%s\";\n" \ + "$(VERSION)" >>$@ + # -------- Doc-related stuff -------- docdirs: @if [ ! -d doc ]; then mkdir doc; fi -docsrc/.pixlist: $(DOC2_SRC_HTML) +cache/pixlist: $(DOC2_SRC_HTML) @echo Generating $@ - @if perl -v >/dev/null; then\ - perl -ne '@l = m/]*src="?([^\s">]+)/io;\ - print "@l\n" if @l;' $(DOC2_SRC_HTML) | sort | uniq >$@;\ - elif [ -e $@ ]; then\ - echo "Sorry, you need Perl to refresh $@. Keeping old $@.";\ - else\ - echo "Sorry, you need Perl to create $@. Creating empty $@.";\ - touch $@;\ + @mkdir -p cache + @if perl -v >/dev/null 2>/dev/null; then \ + perl -ne '@l = m/]*src="?([^\s">]+)/io; \ + print "@l\n" if @l;' $(DOC2_SRC_HTML) | sort | uniq >$@; \ + elif [ -f $@ ]; then \ + echo "Sorry, you need Perl to refresh $@. Keeping old $@."; \ + else \ + echo "Sorry, you need Perl to create $@. Creating empty $@."; \ + touch $@; \ fi events.html: ev evhtml @@ -810,13 +788,13 @@ events.txt: events.html lynx -dump $< >$@ -changes/changes.html: changes/*.log log2html - ./log2html -- $$(ls -r changes/*.log) >$@ +changes/changes.html: changes/*.log log2html RELEASE + ./log2html -- -r `cat RELEASE` -- $$(ls -r changes/*.log) >$@ # changes - update the changelog .PHONY: changes changes: changes/changes.html - lynx -dump $< >CHANGES + w3m -dump -cols 72 $< >CHANGES # cns - view the changelog with Netscape .PHONY: cns @@ -848,6 +826,14 @@ ps: doc/yadex.ps gv $^ +# Use docsrc/faq.html and not directly +# doc/faq.html because we don't want FAQ to be +# remade at first build time. +FAQ: docsrc/faq.html + scripts/process $< >cache/faq.html + lynx -dump cache/faq.html >$@ + rm cache/faq.html + doc/yadex.dvi: doc/yadex.6 groff -Tdvi -man $^ >$@ @@ -856,43 +842,45 @@ # Generate the doc by filtering them through scripts/process - -PROCESS = VERSION src/.srcdate scripts/process scripts/ftime - -doc/ybsp.6: bsp-2.3/ybsp.6 $(PROCESS) - @echo - @echo Generating $@ - @scripts/process $< >$@ +PROCESS = \ + VERSION \ + cache/copyright.man \ + cache/copyright.txt \ + cache/srcdate \ + scripts/process \ + $(OBJDIR)/ftime \ + $(OBJDIR)/files_etc.man \ + $(OBJDIR)/files_share.man \ + $(OBJDIR)/notexist doc/yadex.6: docsrc/yadex.6 $(PROCESS) - @echo @echo Generating $@ @scripts/process $< >$@ doc/README: docsrc/README.doc $(PROCESS) - @echo @echo Generating $@ @scripts/process $< >$@ %: docsrc/% $(PROCESS) - @echo @echo Generating $@ @scripts/process $< >$@ doc/%.html: docsrc/%.html $(PROCESS) - @echo @echo Generating $@ @scripts/process $< >$@ # The images are just symlinked from docsrc/ to doc/ - doc/%.png: docsrc/%.png - @ln -sf ../$< $@ + @rm -f $@ + @ln -s ../$< $@ -#scripts/mdate: scripts/mdate.c -# $(CC) $< -o $@ +$(OBJDIR)/ftime: scripts/ftime.c + $(CC) $< -o $@ + +$(OBJDIR)/install: scripts/install.c + $(CC) $< -o $@ -scripts/ftime: scripts/ftime.c +$(OBJDIR)/notexist: scripts/notexist.c $(CC) $< -o $@ diff -uaNr yadex-1.5.2/README yadex-1.6.0/README --- yadex-1.5.2/README 2001-06-30 21:17:46.000000000 +0200 +++ yadex-1.6.0/README 2003-04-01 02:30:42.000000000 +0200 @@ -1,4 +1,4 @@ -Yadex 1.5.2 (2001-06-30) +Yadex 1.6.0 (2003-04-01) WHAT IS YADEX ? Yadex is a Doom level (wad) editor for Unix systems running X, @@ -9,8 +9,9 @@ PREREQUISITES You need : - - Some flavour of Unix, - - X11R6 or X11R5 and a display of at least 640x480x256, + - Some flavour of Unix (known to work with AIX, FreeBSD, HP-UX, + Irix, Linux, NetBSD, OpenBSD, OpenUnix, QNX and Solaris), + - X11R6 or X11R5 and a display of at least 640x480, - a Doom/Doom II/Heretic/Strife iwad (shareware/demo is OK), - GNU make (vanilla make won't do), - a standard C compiler (ISO 9899:1990), @@ -18,46 +19,46 @@ - hypot() and either nanosleep() or usleep(). BUILDING AND INSTALLING - Type this : + To install in /usr/local : - make - su -c 'make install' + ./configure + make + su -c 'make install' - Notes : - 1) If you get an error on -lX11, add X11LIBDIR= to the make - command line, where is the path to your libX11* files. - E.G. "make X11LIBDIR=/usr/lpp/X11/lib" + To install somewhere else, for example in ~/yadex : + + ./configure --prefix ~/yadex + make + make install + + Got problems getting Yadex to compile ? See doc/faq.html. + Got no problem ? Read the FAQ anyway. See doc/faq.html. - 2) If you want to install somewhere else than in /usr/local/bin, - add PREFIX= to the "make install" command line. - E.G. "su -c 'make install PREFIX=/opt/yadex'" - or "make install PREFIX=~" - - 3) Beware, the installation OVERWRITES the following files: - /usr/local/bin/ybsp - /usr/local/bin/ybsp-1.5.2 - /usr/local/bin/yadex - /usr/local/bin/yadex-1.5.2 - /usr/local/etc/yadex/1.5.2/yadex.cfg - /usr/local/share/games/yadex/1.5.2/doom.ygd - /usr/local/share/games/yadex/1.5.2/doom02.ygd - /usr/local/share/games/yadex/1.5.2/doom04.ygd - /usr/local/share/games/yadex/1.5.2/doom05.ygd - /usr/local/share/games/yadex/1.5.2/doom2.ygd - /usr/local/share/games/yadex/1.5.2/doompr.ygd - /usr/local/share/games/yadex/1.5.2/heretic.ygd - /usr/local/share/games/yadex/1.5.2/hexen.ygd - /usr/local/share/games/yadex/1.5.2/strife.ygd - /usr/local/share/games/yadex/1.5.2/strife10.ygd - /usr/local/[share/]man/man6/ybsp.6 - /usr/local/[share/]man/man6/yadex.6 + Beware, the installation OVERWRITES the following files (assuming + you're installing in /usr/local) : + /etc/yadex/1.6.0/yadex.cfg + /usr/local/bin/yadex + /usr/local/bin/yadex-1.6.0 + /usr/local/man/man6/yadex.6 + /usr/local/man/man6/yadex-1.6.0.6 + /usr/local/share/games/yadex/1.6.0/doom.ygd + /usr/local/share/games/yadex/1.6.0/doom02.ygd + /usr/local/share/games/yadex/1.6.0/doom04.ygd + /usr/local/share/games/yadex/1.6.0/doom05.ygd + /usr/local/share/games/yadex/1.6.0/doom2.ygd + /usr/local/share/games/yadex/1.6.0/doompr.ygd + /usr/local/share/games/yadex/1.6.0/heretic.ygd + /usr/local/share/games/yadex/1.6.0/hexen.ygd + /usr/local/share/games/yadex/1.6.0/strife.ygd + /usr/local/share/games/yadex/1.6.0/strife10.ygd CONFIGURING AND RUNNING Before you run Yadex, you need to tell it where to find your iwads. - Open /usr/local/etc/yadex/1.5.2/yadex.cfg with your favourite - text editor and insert the appropriate values for the parameters - "iwad1", "iwad2", etc. If you don't want Doom II to be the default - iwad, also change the value of the "game" parameter. + Assuming you have installed in /usr/local, open + /etc/yadex/1.6.0/yadex.cfg with your favourite text editor and + insert the appropriate values for the parameters "iwad1", "iwad2", + etc. If you don't want Doom II to be the default iwad, also change + the value of the "game" parameter. You can now run Yadex by typing : @@ -74,11 +75,14 @@ Have fun ! DOCUMENTATION - There are man pages and quite a lot of documentation, most of it in + There is a man page and quite a lot of documentation, most of it in HTML format. Start at : doc/index.html + If you're upgrading from a previous version of Yadex, please read + carefully CHANGES. + STATUS Yadex is work in progress. It still lacks important features like a better interface, cut-and-paste, undo/redo, support for Boom and @@ -86,25 +90,46 @@ code is a horrible mess. I'm not proud of it. Be indulgent. LEGAL - Yadex is GPL'd libre software. It incorporates code from DEU 5.21 - that was put in the public domain in 1994 by Raphaël Quinet and - Brendon Wyber. The rest is Copyright © 1997-2000 André Majorel. - - Now comes the part I like best : This program is free software; you - can redistribute it and/or modify it under the terms of the GNU - General Public License as published by the Free Software Foundation; - either version 2 of the License, or (at your option) any later - version. This program is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. You should have received a - copy of the GNU General Public License along with this program; if - not, write to the Free Software Foundation, Inc., 675 Mass Ave, - Cambridge, MA 02139, USA. + 1. Yadex + + Parts copyright Andrew Apted 2000-2001, GNU GPL v2 + Parts copyright André Majorel 1997-2003, GNU GPL v2 + Parts copyright Matthew W. Miller 2000, GNU GPL v2 + Parts written by Raphaël Quinet, public domain + Parts written by Brendon Wyber, public domain + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + 2. Atclib + + The Yadex distribution includes a subset of Atclib. + + Atclib is copyright André Majorel 1995-1999 and distributed under + the terms of version 2 of the GNU Library General Public License. + + 3. Boost - All trademarks are the propriety of their owners. + The Yadex distribution includes a subset of Boost 1.25.0. Boost + 1.25.0 is copyright various authors and released under the following + terms : Permission to copy, use, modify, sell and distribute this + software is granted provided this copyright notice appears in all + copies. This software is provided "as is" without express or + implied warranty, and with no claim as to its suitability for any + purpose. CONTACT See doc/contact.html for addresses. -AYM 2000-01-10 +AYM 2003-02-15 diff -uaNr yadex-1.5.2/TODO yadex-1.6.0/TODO --- yadex-1.5.2/TODO 2000-08-26 00:32:19.000000000 +0200 +++ yadex-1.6.0/TODO 2003-03-28 21:12:16.000000000 +0100 @@ -14,10 +14,14 @@ Command line - Add option -e like in sed and Perl. Auto quit at end or not ? - Add option -f like in sed ? +- Unix version recognizes -V but does not list it in the usage. Configuration file - Add operator ".=" (E.G. "iwad_dir .= ,/foo/bar"). Perhaps implement real lists. Perhaps not. +- Comments are not allowed if not at the beginning of a line +- New option --print-config-path or --cfg-dirs to print the config file + search path and exit Variables - Make variables objects instead of C++ variables. It should not be @@ -38,10 +42,6 @@ different sections of the .cfg. - Fix TranslateToDoomColor(). - -g should accept anything as long as .ygd exists. -- Have to think of how to handle different games : Doom, Doom II and - Boom all have a lot in common. Try not to duplicate all this, perhaps - by _include_ing a "generic_doom" block, which contains _if_s before - features not common to all versions. - It is prob. possible to crash the program by entering weird things in LoadGameDefs. For example, shortdesc is not truncated and the current number of "raise floor" types will probably make the menu "overflow" @@ -61,8 +61,6 @@ - Move the definition of special sector tags out of the exe and into the ygd files. - Gadget: add level names (E.G. "E1M1" -> "Hangar"). -- An attempt to define twice the same thing/linedef/sector type - should be detected and reported. - The basename need not be in the configuration file; it should be in the ygd (E.G. iwad_base = "doom.wad,doom1.wad") - The .ygd collection has grown so large that it has become difficult to @@ -100,17 +98,22 @@ one that has the appropriate magic (but warn). If an include was not found just print a warning and continue ? - Allow overriding of a previous linedef type / thing type / sector type - definition (currently it just *adds*). + definition (currently it just *adds* and, since the new definition is + at the end the of list, it's *ignored*). Possibly with an option to + warn about such redefinitions. +- New option -Y (or -y or -G ?) to insert a directory at the beginning + of the .ygd files search path. Perhaps -Y- to clear the path (think + -I-). Add it to "make test" and "make dtest". +- New option --print-ygd-path or --ygd-dirs to print the ygd file search + path and exit. Game and wad support - Some wads have sidedefs with a sector# of -1. Apparently, those are always unused sidedefs but perhaps there is something to do about it. dyst3, mm, mm2 map13,28, wads2/1kill (e2m2,6,7,8,9), wads2/adieu wads2/ebola, wads2/requiem (map03,08,etc). -- Some wads generating a flurry of messages "updating entry ''" when +- Some wads generate a flurry of messages "updating entry ''" when loaded (11fortko, 1_on_1, chase21). Fix that. -- Support Boom extensions, at least by allowing to enter hexadecimal - linedef types etc. - Some working pwads are not pwads. 1sthell is an iwad. - Some wads have a large number of unused vertices in the middle. base, phobos, 2wad/dks_e1l1, 2wad/dks_e1l3, amanda2 (no tail !), atica, @@ -156,15 +159,29 @@ replacement patches but not the new ones of course. - Now that wad_read_i16() and wad_read_i32() don't abort anymore, check the code that uses them. -- Add definition for sector tag 667 (MAP07). - Colin wants to be able to use the Final Doom iwads without having to type "yadex -iwad2 /foo/bar/tnt.wad". He suggests either (1) adding a new game or (2) changing the code so that "yadex -iwad2 tnt.wad" looks for tnt.wad in the iwad2 directory defined in the config file. - Graphics: Yadex uses no COLORMAP, instead of COLORMAP 0. In practice COLORMAP 0 is very close to no COLORMAP but... +- Graphics: Yadex uses colour index IMG_TRANSP = 0 to represent + transparent pixels and remaps index 0 to the closest index (247 in the + case of Doom). Because we save in PPM format, it doesn't matter. But + if we wanted to save in BMP format, many pixels would have their value + changed, which I'd rather avoid. If Yadex used IMG_TRANSP = 255, no + remapping would be necessary because that index is not used in Doom, + Doom II, Heretic and Hexen. For Strife, it's the other way around : + index 255 is used quite a lot and index 0 is not. - Be able to edit levels with silly names like "QD2" (cf. qdoomtst.wad). This implies not replacing entries in the master directory anymore ! +- When "saving as" a create'd level, NODES, SEGS, SSECTORS, REJECT, + BLOCKMAP and VERTEXES are not empty. Recipe : yadex: c [Return] [F3] + [y] [Return] beurk.wad q yadex: q $ lswad -l beurk.wad. +- Bug: there is a small memory leak in that can be seen when repeatedly + loading two wads that contain the same level (E.G. while true; do echo + r tmp.wad; echo r 11.wad; done | yadex). I suspect the leak is in + ReadLevelData(). Doom alpha - Fix wrong things definitions and add missing ones. @@ -178,6 +195,7 @@ - Hexen has some flats with a size of 8 kB. - Generate the "thing" directives by either parsing info.c or ripping off the one in DETH. +- Hexen: add linedef types and check Heretic - Heretic has some flats with a size of 4160. Is this why DeuTex accepts @@ -189,6 +207,24 @@ - Matt wonders what RIFLB0 is and what's the difference with RIFLA0. - Incorporate what's only in the USS. +Boom +- convenient way of entering generalized types. +- Decode generalized types. +- Allow WATERMAP pseudo-texture (frankc@srv.net). + +XDoom +- Write or get someone to write xdoom.ygd. +- Check XDoom linedef types +- Copy XDoom linedefs types to doom.ygd + +ZDoom +- Allow AARRGGBB pseudo-texture ? (frankc@srv.net) + +EDGE +- Abstract away extrafloor linedef types. +- Parse DDF and RTS. +- Function to jump to n-th extrafloor for this sector. + Messages and reports The reason for emitting messages : - Bug (internal error, unexpected condition in the program that @@ -242,6 +278,15 @@ - When moving a bunch of vertices, do not check for vertex-on-linedef condition if both vertices of the linedef were part of the vertices that are being moved. + AJA 2000-09-21: (d) when moving a large bunch of vertices or linedefs + that are very close together (e.g. 2 units), there often pops up a + message to confirm merging vertices or splitting a linedef. (This + would be worse with the 1.5.0 config file which makes merges/splits + happen automatically). + I guess the solution would be making Yadex to skip checks for + overlapping vertex/linedef _between_ all the vertices/lines that are + being moved at once (i.e. only check a moving V/L against a non-moving + V/L). Old bugs to fix - When splitting and merging sectors, some of the sidedefs in the split @@ -250,14 +295,10 @@ "vertices A and B not on the same sector" or "cannot find a closed path", etc. I have already got "no sector between vertex A and vertex B" ; save, quit, edit and try again : it works ! -- Let RIGHT work after SPACE (works if no mouse driver!) +- DOS: Let [right] work after [space] (works if no mouse driver!) - DOS: understand why mouse pointer moves 8 pixels at a time and fix that. -- I already got erroneous "sector not closed" messages. The last time I - remember, it was on a tiny triangular sector (base=16, height=2). - When merging sectors, linedefs sometimes get only 1 sidedef... -- InputInteger limits numbers to [-32749,+32749]. -- InputInteger doesn't accept hexadecimal numbers. - If you do "delete linedef and merge sectors" when it's the same sector on both sides of the linedef, the sector is deleted. - Check that all sectors are closed : chokes on pseudo sectors (s1=s2). @@ -268,9 +309,6 @@ Editing in general - Implement undo and redo. -- Move things along with vertexes -- Add a "global" or "everything" editing mode. In that mode, moving, - deleting, duplicating affects all objects (things, vertexes...) - Move cursor : jump to next object in direction ... - Move objects n grid steps in direction ... - Move objects n Grid steps in direction ... @@ -296,9 +334,6 @@ (E.G. segfault upon switching to sector mode). - For very large levels, the lower limit on the zoom factor is too high to allow showing the whole level. -- Bug: for very large levels, the automatic zoom factor setting is hosed - (instead of using the lowest allowed zoom factor, it falls back on a - rather high value). - Bug: for very large levels (very low zoom factors), the upper limit on the grid step is too restrictive. - Strife's MAP29 is so much to the west (-23,000 or so) that the current @@ -308,8 +343,177 @@ adding the number of such items already existing. E.G. if there are already 50 vertices, increment the vertex numbers in all the linedefs by 50. Same thing for sidedefs numbers in linedefs, sector tags (DON'T - increment those above 900!). increment sector# in sidedefs too. that's - all ? + increment those that have a special meaning like 666 or 667 or those + above 900!). increment sector# in sidedefs too. that's all ? +- Andy Baker wants a don't-drag toggle. I'd rather just add some initial + resistance. +- For the two widest grids, display the coordinates along the edges. +- There is something that sucks in the edit loop ; when you scroll + without moving the mouse, the selection box always "lags behind" + because its map coordinates are updated only _after_ the next screen + refresh. +- Select all. +- Reverse selection (select everything that's not selected and unselect + everything that's selected). +- Edit functions : copy, cut, paste. +- Crop (delete all unselected objects). +- Persistent box for cropping ? +- BD suggests sector creation à la DCK ([r] then draw box). +- When there are several objects under the pointer, report it and give a + way to access any one of them. Or maybe implement planes ? +- When doing drag-n-drop, should the snap-to-grid be applied to A. + relative position since started dragging B. or to the highlighted + object ? If A, you can't use drag-n-drop to snap-to-grid objects that + aren't. If B, you can't drag correctly objects that are not aligned on + grid. +- Object number: the type should be "i16", not "int" (cf. SelPtr). +- Object number: the test for "none" should not be hard-coded "< 0". +- While dragging or drawing a selbox, prevent Del, Ins, etc. from + working. E.G. Del would suppress the object being dragged ! +- Add config file parameters for initial snap_to_grid and + lock_grid_step. +- Scale: make it local to an edit window. +- MadeChanges: make it local to an edit window. +- MadeMapChanges: make it local to an edit window. +- When saving with [F2], ".wad" should be appended automatically. +- Save ([F2]): should not ask for the file name every time. +- Save ([F2]): I swear I've seen the file name dialog open with + "nase.bak" in it ! +- Save ([F2]): should use the Save as... ([F3]) code, not duplicate it. +- Get rid of the Level variable. +- The file name should be a member of edit-session or level-data, not + retrieved by looking up the master directory. +- A function that would be really very useful would be the possibility + to change the start/end vertex of a linedef. That could be done by + holding, say, [Alt], down and dragging the start/end until on top of + another vertex. When the button is released, the linedef start/end is + changed and the sector references of the impacted linedefs are + updated. +- Displaying pointer coords; should look into using PutImageFont(). +- [Ctrl][Click]: Press button: do nothing. Release button: select or + unselect IF STILL ON TOP OF OBJECT. Thus we can use [Ctrl] + drag to + copy :-). +- Dragging with [Ctrl] on duplicates ? +- Vertex on linedef: lower tolerance when zoom factor is high. [partly + done as of 1998-12-20 but still needs work]. +- Check self-consistency of level data: for each linedef, v1 and v2 must + be either OBJ_NO_NONE or between 0 and NumVertexes and s1 and s2 must + be either OBJ_NO_NONE or between 0 and NumSideDefs. +- Goto function: takes as an argument either the centre of the level or + a previously set mark. Like in vi: m, '. Maybe '' to go to + centre ? +- Clicking and superimposed objects: if n1 and n2 (n1 < n2) are + superimposed, n1 is not selected but n2 is selected and you click on + them, Yadex thinks you are starting a new selection because + is_selected (highlight) is false. +- objects.cc: GetObjectCoords(): should use center_of_objects() instead. +- Permanently show a 64-wide object to scale ? +- Right-button menus: access to many different menus (no modifier, + [Shift], [Ctrl], [Alt], several of them). + - Cut, copy, paste + - Show properties + - Misc. operations + - Frequently used properties (toggle bit of linedef...) + - Change tool +- Menus: when you move the pointer over a pulled down menu is, you can + highlight the objects it hides. +- Replace "insert rectangle"/"insert polygon" by : + - insert pillar (nb. of sides, size) + - insert subsector Differences in floor/ceiling height/textures and + lighting level could be set by predefined styles : + - pedestal (floor + 48, ceiling - ...) + - hanging from ceiling + - teleporters +- In addition of make nook/make boss, + - insert protruding subsector + - insert recessed subsector +- Minor glitch: when a popup menu is active, the spot is still shown +- Object info box: if the box is already drawn, don't draw it again; it + makes the strings flicker slightly. +- [Alt] alone should highlight the menu bar. +- Split linedefs and sector: if there is no sector between the linedefs, + they shouldn't be split. +- Split linedefs and sector: if only one linedef is + selected/highlighted, assume that the other linedef is the one + opposite. +- Moving/scrolling: centre view around spot under pointer (binding : + perhaps [Ctrl][But2]). +- James Caldwell says that, with v1.4, if you create a polygon, delete + the sector inside it and try to draw a selection box around the + linedefs, Yadex segfaults. James was not able to give me a backtrace + and, apparently, no one has been able to reproduce that bug. After + upgrading to 1.5 and a new version of Red Hat, the problem + disappeared. A bug in GCC 2.96 ? +- Linedef type/sector type/thing type selector : the current + implementation (cascaded menus) has certain shortcomings : + - No scrollbars for long lists. + - It's not possible to associate a bitmap to an item, which would be + very useful for thing types. + - There doesn't seem to be a good way to specify which fields are to + be printed, especially not dynamically. This could be useful in some + occasions (thing types : sprite root). + - There doesn't seem to be a good way to change the sorting order, + especially not dynamically. Still it would be nice to be able to + sort linedef types by either (function, trigger) or (trigger, + function) or (number), etc. + - There doesn't seem to be a good way to restrict which items are + shown. For example, one might wish to hide all linedef types that + are not available in plain Doom 1.666. Arguably, that should be done + by chosing the right game specification in the first place, but + there *might* be good reasons to do otherwise. + It seems that ldt/st/tt selection is an operation that calls for more + complex interactions than a simple list menu can do. We should + probably use a specialised widget, perhaps like this one : + _________________________________________________________________ + | _____________________________ | + | Group ( ) Door | 0 -- None |^| | + | ( ) Door (red key) | 1 DR Open door | | | + | ... | 2 W1 Open door (stays op| | | + | ( ) Misc | 3 ... | | | + | (o) All | 4 | | | + | | 5 | | | + | Sort ( ) Group, desc, trig | 6 | | | + | ( ) Group, trig, desc | 7 | | | + | ( ) Desc, trig, group | 8 | | | + | ( ) Trig, desc, group | 9 | | | + | ( ) Desc, trig, number | 10 | | | + | ( ) Trig, desc, number | 11 | | | + | (o) Number | 12 | | | + | | 13 | | | + | Show [x] Boom | 14 | | | + | [x] EDGE | 15 | | | + | [x] MBF | 16 | | | + | [x] PR | 17 |_| | + | [x] XDoom |_18________________________|v| | + | [x] v1.6 |<_________________________>| | + | _________________ | + | |___OK___|_Cancel_| | + |_________________________________________________________________| + + Note #1: how do we enter linedef types by number ? + Note #2: the "Show" items are not hard coded but unique values of a + field that does not yet exist (alternatively "from which ygd file the + definition comes from"). + Note #3: instead of hard-coding "Sort" items, one could make this + group a collection of special widgets, one for each field. Each widget + has two buttons : up and down. By clicking on said button, you move + the widget up down the list. More flexible, but also more confusing + when you're not used to it. Promises to be awkward to use with the + keyboard. + Note #4: it might be useful to have two descriptions : an internal one + that sorts well (door open, door close) and an external one that's + human readable (Open door, Close door). + +Editing, global mode: +- Editing properties (double-clicking or [Return]), selecting by + clicking and selecting with a box still care about the mode. Selection + in general is broken, because only the number is remembered. +- Autosplit linedef by dragging vertex doesn't work unless in vertex + mode. +- draw_map(): linedefs are still shown according to mode. +- draw_map(): need another representation for sectors (conflicts with + linedefs). +- draw_map(): always show right side of linedefs ? Editing things: - Thing info box: @@ -330,12 +534,6 @@ be spinned. - Thing properties -> type : on selecting group with 0 things, fatal error PTD1. -- Maintain a list of all things on the level, sorted by increasing - radius. To determine which thing is under the pointer, scan that list - and highlight the first thing such that the pointer in inside the - square of half-side (scale x radius + slack). Possible refinement ; if - several things would be highlighted, highlight the one whose centre is - closest to the pointer. - Check Doom's behaviour w.r.t. negative angles. - On the map, if the thing has a root but no sprite by that root was found, display the root ? (instead of the type) @@ -343,13 +541,15 @@ - On the map, switch between displaying the sprite, the type in decimal, the type in hex, the root, etc. - Option to show both the sprite and the square. Or maybe the sprite and - a cross, à la WinDEU ? + a cross, à la WinDEU/DETH ? - Perhaps choose between sprite and square automatically depending on zoom factor ? +- Things: the name is sometimes too long and cut off. It looks bad. +- Unknown things (i.e. thing numbers for which there's no record in the + ygd) should be displayed in red, to distinguish them from things that + just don't have a root. Editing vertices: -- Change the highlighting algorithm so that it's more bearable at low - zoom factors. Editing linedefs and sidedefs - Linedef type : show long name. @@ -438,8 +638,105 @@ - Linedef tag : same thing. - Linedef flags : give choice between string, signed decimal, unsigned decimal and hexadecimal. -- If a linedef has a type that requires a tag but its tag is set to 0, - draw the linedef in red. +- AJA 2000-09-21: (b) the texture checker only gives you two choices + when it encounters missing textures: stop, or make it STARTAN3 and + continue. When using some Doom tricks using missing uppers/lowers, + this is a pain, ideally (IMHO) there would be four options: + + Press ESC to see the object, + or `y' to fix the texture and continue, + or `A' to fix all remaining textures, + or any other key to leave it and continue + +- Look into texture alignment. Look at what's been done with DETH. + AJA 2000-09-21: (e) I wanted to horizontally align a bunch of lower + textures on some two-sided lines, but the X alignment functions only + work on middle textures. + + This is how I would prefer it to work: well, pseudo-code would + explain it best: + + AlignX(sidedef_t S[], int NUM) + { + int i, x_offset; + + // initial x offset comes from first sidedef + int x_offset = S[0].x_offset; + + for (i=1; i < NUM; i++) + { + // ... check if S[i] contiguous with S[i-1] ... + + x_offset += LineLength(S[i-1]); + x_offset &= 4095; + + S[i].x_offset = x_offset; + } + } + + That would collapse the 8 alignment choices into 2 (sidedef1 or + sidedef2). Well, 4 if you keep the texture checking versions. + + It should work fine in practice since all Doom textures are powers + of two. If one wasn't, it wouldn't be drawn properly since the + R_GetColumn() routine in the Doom source does this: + + column &= (width-1) + + Do you think this "texture-independent" version is better ? + +- Highlighting linedefs: the test "tag > 0" is arguable. Shouldn't it be + "tag != 0" ? +- When merging superimposed 1S linedefs, the resulting 2S linedef often + has the middle textures the 1S linedefs had. +- Showing linedef textures: several solutions: + - easiest: show raw middle texture, + - easy: show raw upper, middle and lower textures, + - hardest: show as Doom would render it, with offsets, LTU, UTU and + all. Scale it down so as to fit in the window that has a fixed size. + Optionally apply brightness. Maybe show the edge of the neighbouring + walls, it might help for alignment. ISSUE: it might not be a good + thing to respect the length of the linedef as, for long linedefs, it + will force us to scale down too much. For textures that don't + exist, show background with cross. For texture "-", show background + only. For transparent texture, background sees through. It's + probably better to use a special colour (like black) for background + as the user might want to use a bright colour for window + backgrounds, which wouldn't look too good with Doom's dark textures. +- Split linedef: if pointer is somewhere on top of linedef, split it + there (not in the middle). +- Split linedef: buglet: the new vertex is initially put at (0,0) and + MapMaxX and friends are updated accordingly. So if the centre of the + map is way off (0,0), the next centre-map command will appear to put + the map off-centre. +- Highlighting linedefs: same problem when some of the linedefs to + highlight have a non-zero tag. IMO, the key of the problem is the O(2) + part in the highlighting of sectors. Should restructure + HighlightObject() and HighlightObjects(). Build a bit vector of all + linedefs that should be highlighted and do them all in a loop, without + recursion. And thus we would not highlight the same linedef more than + once anymore. +- Warn if W? linedef type used on single-sided linedef. +- Show all linedefs that have errors in red. That includes : + 1. bad type, + 2. type requires a tag but its tag is set to 0, + 3. type requires a tag but no sector uses that tag, + 4. door type on a single-sided linedef, + 5. missing texture (HOM) (though this is normal for some tricks), + 6. tx with multi-patch columns on a double-sided linedef (medusa), + 7. bad flag, + 8. misaligned (bad X-offset), + 9. superimposed linedefs. + Notes: + - For (3), you probably need a bit vector of tags used by at least one + sector. When should it be refreshed ? It's perhaps safer to do it + from scratch before displaying, than trying to keep track... + - (7) is another reason to move the definition of flags out of the + executable and into the .ygd. + - (6), (8) and (9) are not too easy. + - The colour of the linedef should probably be reset to normal before + highlighting and selecting. Having lines of many different colour is + just going to be confusing. Editing sectors - Set floor height to ceiling height - headroom. @@ -454,6 +751,12 @@ be because of the overhead incurred by highlighting all the linedefs. - Sectors are sometimes mistakenly considered unclosed and don't highlight properly. E.G. in ss27bet2.wad, sector #66. + Also: I already got erroneous "sector not closed" messages. The last + time I remember, it was on a tiny triangular sector (base=16, + height=2). + AJA 2000-09-21: two linedefs meeting at a vertex, and the other ends + are very close to each other (like 2 units) causes spurious + Sector-not-closed messages in the consistency check. - A DCK-like philosophy could be used when moving sectors : | | @@ -478,6 +781,12 @@ vertices on one side. One strategy that comes to mind is placing it at the centre of the largest area (where "largeness" is a compound of "surface" and "squareness"). +- Showing sector textures: optionally apply brightness. +- Andy Baker reported than when merging linedefs, Yadex sometimes + deleted the wrong linedef. +- Highlighting sectors: for a constant number of sectors to highlight, + gets slower as the total number of sectors increases. Might have to do + with the search for tagged linedefs. Keyboard interface - Proposition: in linedef mode, gives access to @@ -489,6 +798,13 @@ - Document screenshot. - faq.html should be included in the distribution. - Some entries in the FAQ should also be in trouble.html and vice-versa. +- In TODO, entries should be numbered. +- The following should be externalized: + - the URL of the homepage (when it's done, update web/readme.html) + - the URLs of the mirrors + - the names of the copyright holders (contributors et al.) + - the name of the maintainer +- Each file should have its own copyright statement. Unimportant : - If bgi= or -bgi specifies a path for the .bgi driver, handle it. @@ -498,7 +814,11 @@ Flat/sprite/texture viewer - Use other palettes than #0 (also when saving). - Use COLORMAPs (also when saving). -- Reimplement "save image to file" with PPM, PNG and perhaps XPM. +- Save bug: should save entire image, not clipped. Requires implementing + Sticker::load (Img, int oxfs, int yofs, int width, int height). And + changing textures.cc so that it does not clip the width and height. +- Save: will never be able to save all arch-vile frame under MS-DOS + (contain "[", "\", "]"). Use DeuTex's translation scheme ? - Zoom and scrollbars. - Add binding to toggle between SW1* and SW2*, cycle through the frames of an animation. For Hexen, it's much more complicated (3-frame @@ -510,9 +830,23 @@ - Support pictures higher than 255 and textures higher than 128. - If the "view" command is given a lower case argument, the positionning in the list of sprite names is wrong. -- When viewing patches or sprites, the entire view window is refreshed - even though, in most of the cases, the picture to display is much - smaller than that. + +Build: +- Document somewhere what RELEASE does and why it's important. +- Makefile: after changing DEFINES in the makefile, running make does + nothing ! (have to delete manually wads.o and sanity.o) +- Makefile: after hacking for two days on a machine, some objects are + not rebuilt on another machine. Even though yadex.h has changed ! +- Should not build yadex.dep from scratch every time you type "make". +- "make clean all" fails because clean removes obj/0 but does not create + it again. +- Some configuration items are not detected by configure but by the + makefile. This is confusing (there's no simple rule). +- It would be nice to automatically detect when -fpermissive is needed + (GCC >= 3 + "extern XSetTransientForHint" in /usr/include/X11/Xlib.h) +- It would be nice to automatically detect where the X11 headers and + library are. And omit -I/usr/X11R6/include from the command line when + it's not needed. DOS/BGI port - Do more modules splitting (deu.c, ReadConfigFile, menus.c). In @@ -580,6 +914,18 @@ Sprite::make_bitmap, scale_img and, above all, Sprite::make_ximage. Making sprites persistent across iterations helps enormously. Do it. +Unix port +- Basenames are truncated to 8 characters. The DOS approach of fixed + size al_f* types does not scale on Unix. Should probably modify + al_fana() to use dynamically allocated buffers. + +Platforms/Portability +- Solaris 2.7: bad X11/Xlib.h. With GCC, need -fpermissive + and/or -isystem /usr/openwin/include +- Solaris 2.7: don't assume that having gcc implies that cc is + gcc. cc might be the native compiler in which case -Wall might + no be appreciated. + Prompt - Add access to the prompt from an editing window (":" like in vi). - Use readline. @@ -589,46 +935,16 @@ Misc. - Implement several windows at once ? - Replace all occurrences of BLACK, WHITE, ... by logical colours. -- The highlight proximity should always match the apparent size of the - object (done for things, to be done for vertices and linedefs). -- GetCurObject(): the radius should not be expressed in map units but in - screen units and should depend on the apparent size of the object. - Indeed, 20 is too much for linedefs at high zoom factors and too - little for vertexes at low zoom factors. -- Highlighthing things: if there is a small thing and a large thing in - the same spot, when you're "in" the small thing, it should be - highlighted, even if it's higher-numbered. At the moment, it's the - lowest-numbered thing that's highlighted. - Externalize occurrences of ".wad". - Externalize occurrences of ".bak". -- Let the selection include objects of different types. -- There is something that sucks in the edit loop ; when you scroll - without moving the mouse, the selection box always "lags behind" - because its map coordinates are updated only _after_ the next screen - refresh. -- Select all. -- Reverse selection (select everything that's not selected and unselect - everything that's selected). -- Edit functions : copy, cut, paste. -- Crop (delete all unselected objects). -- Persistent box for cropping ? -- BD suggests sector creation à la DCK ([r] then draw box). -- Be able to select objects of several types at once. -- Modelessness ? -- When there are several objects under the pointer, report it and give a - way to access any one of them. Or maybe implement planes ? -- When doing drag-n-drop, should the snap-to-grid be applied to A. - relative position since started dragging B. or to the highlighted - object ? If A, you can't use drag-n-drop to snap-to-grid objects that - aren't. If B, you can't drag correctly objects that are not aligned on - grid. -- Object number: the type should be "i16", not "int" (cf. SelPtr). -- Object number: the test for "none" should not be hard-coded "< 0". - Browse mode, as in xv and psp, to browse through a large number of wads. - Be able to open zipped files ? -- On ProgError(), save current data to a file named yadexcrash.wad. On +- On ProgError(), save current data to a file named yadexcrash.wad. On startup, if that file exists, propose to use it. +- Add a handler for the SIGSEGV signal to, on segfault (SIGSEGV), save + current data to a file named yadexcrash.wad. On startup, if that file + exists, propose to use it. - If DOOMWADDIR exists, use it ? But overridden by yadex.cfg & -iwad - Texture browser : it's so slow that, even on a K6/200, some textures are slow to come (AMRIBS). Should cache patches ? 1999-11-28: after @@ -637,134 +953,22 @@ - colour# used to represent transparent colour when saving textures, - rgb used to represent transparent colour when saving textures, - rgb used to represent transparent colour when displaying textures, -- While dragging or drawing a selbox, prevent Del, Ins, etc. from - working. E.G. Del would suppress the object being dragged ! -- Add config file parameters for initial snap_to_grid and - lock_grid_step. -- Scale: make it local to an edit window. -- MadeChanges: make it local to an edit window. -- MadeMapChanges: make it local to an edit window. -- When saving with [F2], ".wad" should be appended automatically. - Log file: create/update it iff the pwad file is modified. -- Things: the name is sometimes too long and cut off. It looks bad. -- A function that would be really very useful would be the possibility - to change the start/end vertex of a linedef. That could be done by - holding, say, [Alt], down and dragging the start/end until on top of - another vertex. When the button is released, the linedef start/end is - changed and the sector references of the impacted linedefs are - updated. - Events; generalize internal events and hold refresh until all events have been processed. Though autoscroll could bite me. - Delete all those "huge" qualifiers ; means nothing for Unix and the DOS version should be compiled with -mh anyway. Update: 1999-11-25: Ha! Ha! Ha! Ha! Ho! Ho! ... I was so young and naive... -- Displaying pointer coords; should look into using PutImageFont(). -- [Ctrl][Click]: Press button: do nothing. Release button: select or - unselect IF STILL ON TOP OF OBJECT. Thus we can use [Ctrl] + drag to - copy :-). -- Vertex on linedef: lower tolerance when zoom factor is high. [partly - done as of 1998-12-20 but still needs work]. -- Check self-consistency of level data: for each linedef, v1 and v2 must - be either OBJ_NO_NONE or between 0 and NumVertexes and s1 and s2 must - be either OBJ_NO_NONE or between 0 and NumSideDefs. -- Showing linedef textures: several solutions: - - easiest: show raw middle texture, - - easy: show raw upper, middle and lower textures, - - hardest: show as Doom would render it, with offsets, LTU, UTU and - all. Scale it down so as to fit in the window that has a fixed size. - Optionally apply brightness. Maybe show the edge of the neighbouring - walls, it might help for alignment. ISSUE: it might not be a good - thing to respect the length of the linedef as, for long linedefs, it - will force us to scale down too much. For textures that don't - exist, show background with cross. For texture "-", show background - only. For transparent texture, background sees through. It's - probably better to use a special colour (like black) for background - as the user might want to use a bright colour for window - backgrounds, which wouldn't look too good with Doom's dark textures. -- Showing sector textures: optionally apply brightness. -- Goto function: takes as an argument either the centre of the level or - a previously set mark. Like in vi: m, '. Maybe '' to go to - centre ? -- Clicking and superimposed objects: if n1 and n2 (n1 < n2) are - superimposed, n1 is not selected but n2 is selected and you click on - them, Yadex thinks you are starting a new selection because - is_selected (highlight) is false. -- objects.cc: GetObjectCoords(): should use center_of_objects() instead. -- Permanently show a 64-wide object to scale ? -- Right-button menus: access to many different menus (no modifier, - [Shift], [Ctrl], [Alt], several of them). - - Cut, copy, paste - - Show properties - - Misc. operations - - Frequently used properties (toggle bit of linedef...) - - Change tool -- Dragging with [Ctrl] on duplicates ? -- Makefile: after changing DEFINES in the makefile, running make does - nothing ! (have to delete manually wads.o and sanity.o) -- Makefile: after hacking for two days on a machine, some objects are - not rebuilt on another machine. Even though yadex.h has changed ! -- Menus: when you move the pointer over a pulled down menu is, you can - highlight the objects it hides. -- Replace "insert rectangle"/"insert polygon" by : - - insert pillar (nb. of sides, size) - - insert subsector Differences in floor/ceiling height/textures and - lighting level could be set by predefined styles : - - pedestal (floor + 48, ceiling - ...) - - hanging from ceiling - - teleporters -- In addition of make nook/make boss, - - insert protruding subsector - - insert recessed subsector -- Force the event type to 16 bit. Would make us save a few kB in the - menus (shortcut_key and cooked_shortcut). -- Change the way the menu_c class is defined so that it wastes less - space. Should probably look into other classes too. Why not using - bitvectors instead of arrays of ints used as booleans ? - The popup menus should get the pointer position event when there is no motion event. It's an issue when, to close a submenu, you click on the parent menu; until you move, the parent menu still highlights the old line. -- Object info box: if the box is already drawn, don't draw it again; it - makes the strings flicker slightly. -- [Alt] alone should highlight the menu bar. -- Minor glitch: when a popup menu is active, the spot is still shown -- Minor glitch: when a popup menu becomes active (active again) it does - not try to check if the pointer is over it. It waits for the first - motion event. I'm not sure whether this is the right thing. - Popup menus: that code is brittle because the same menu_c object is used for popups and pull-downs. For example, if a menu was pulled down before the same menu (that was previously popped up) was undrawn, weird things might happen. I don't like the idea of duplicating the whole menus, though. It would be cleaner to split the menu_c class into a constant part and a dynamic part but it would be a lot of work. -- Highlighting sectors: for a constant number of sectors to highlight, - gets slower as the total number of sectors increases. Might have to do - with the search for tagged linedefs. -- Highlighting linedefs: same problem when some of the linedefs to - highlight have a non-zero tag. IMO, the key of the problem is the O(2) - part in the highlighting of sectors. Should restructure - HighlightObject() and HighlightObjects(). Build a bit vector of all - linedefs that should be highlighted and do them all in a loop, without - recursion. And thus we would not highlight the same linedef more than - once anymore. -- Highlighting linedefs: the test "tag > 0" is arguable. Shouldn't it be - "tag != 0" ? -- When merging superimposed 1S linedefs, the resulting 2S linedef often - has the middle textures the 1S linedefs had. -- [Shift][Ins] doesn't work. -- Split linedefs and sector: if there is no sector between the linedefs, - they shouldn't be split. -- Split linedefs and sector: if only one linedef is - selected/highlighted, assume that the other linedef is the one - opposite. -- Split linedef: if pointer is somewhere on top of linedef, split it - there (not in the middle). -- Split linedef: buglet: the new vertex is initially put at (0,0) and - MapMaxX and friends are updated accordingly. So if the centre of the - map is way off (0,0), the next centre-map command will appear to put - the map off-centre. -- Moving/scrolling: centre view around spot under pointer (binding : - perhaps [Ctrl][But2]). - Instead of { Beep(); Notify (); }, should have a specialized function. - Somehow unify configuration variables and game definition variables, at least so that "set" displays both. AYM 2000-07-11: mmm... @@ -776,18 +980,21 @@ - There is a way to trigger the "Callback %p did not set disp_" bug message. Don't remember where. Perphaps in the texture viewer. Had to do with missing patches ? -- James Caldwell says that, with v1.4, if you create a polygon, delete - the sector inside it and try to draw a selection box around the - linedefs, Yadex segfaults. James was not able to give me a backtrace - and, apparently, no one has been able to reproduce that bug. Does it - still occur with v1.5 ? + + yadex: viewflat checkers + Yadex: Bug: Callback 0x805a770 did not set disp_ + REPORT ALL "Bug:" MESSAGES TO THE MAINTAINER ! + +- Certain calls to InputInteger() should use different bounds so that + one can enter E.G. 0xffff as well as -1. +- InputInteger() should be objectified so that it doesn't force the + number back to decimal every time the user hits [Tab], [Down] and + friends. +- Wad_file has too many friends. +- Do not include so much of the Boost library in the distribution + archive. To do soon -- Try to restore the "save image to file" function. The data should - not be taken from the window, since clipping could occur, but directly - from the buffer. -- Talk about the above in the doc. Mention that ppm files are always - created with NL = LF. - Finish window_to_rgbbmp() - Transfer rgbbmp_to_rawppm() in another file (rgbppm2.cc ?) - Rename rgbbmp_to_rawppm() -> _ppm(), and add a parameter to choose @@ -798,12 +1005,32 @@ - Test XK_*_ISO_* on SCO X11R5. - Test on Final Doom. - Add option to let Yadex tell you with which options it was compiled. -- Generate text announcement (yadex-announce, freshmeat, rgcde, cola) - Fix any remaining problems that might remain in saving. - "create": Fix the problem with levelname being NULL in EditLoop(). Check [F3]. - "create": every time you [F2], the wad name is reset to the default (E.G. "map01.wad"). +- Replace Patch_dir by Lump_dir. + +Web +- Announce to cola automatically. +- Generate LSM and upload to ftp.metalab.edu. +- Upload to ftp.cdrom.com. +- faq.html bears the wrong version number. +- Bcc announcements to Oliver Kraus too. +- Add patches/ +- patches/README: on the version included with the distribution archive, + mention that the latest patches can be found in + http://www.teaser.fr/~amajorel/yadex/patches/. +- patches/README: mention the fate of the patches (some have already + made in into the dev version, some will have not because I haven't + decided yet or haven't even looked into them and some will never make + it). +- Have an index page for patches/ ready, in case the web server does not + support automatic indexing. Use dldir for that. +- Should all patches in the web page be also included in the + distribution, and vice-versa ? + ---------------------------------------- @@ -847,6 +1074,7 @@ (E.G. "startx -- -bpp 16"), - restart Yadex with -privatecmap. + WIDGETS A widget should have the following methods : - create: @@ -883,6 +1111,7 @@ Attribute: title Attribute: a list of widgets with placement information. + GEOMETRY MANAGER The geometry manager is passed a list of widgets with placement information. @@ -902,6 +1131,7 @@ - "^" place to the top - "v" place to the bottom + DRAG-AND-DROP When dragging a group of objects, I see two possible policies: 1. snap position of current object @@ -909,6 +1139,7 @@ The inconvenient of (1) is that, if no object was aligned, it is difficult to move the group by a whole number of grid steps. + MOVING AND DRAGGING WITH THE KEYBOARD From main mode: [c] move cursor @@ -930,6 +1161,7 @@ [c] coarser (grid step *= 4) Any other key returns to main mode. + FASTER DISPLAY I think that screen refreshes could be sped up a lot by avoiding to clear the pixmap but instead redrawing every widget as black. It would @@ -959,9 +1191,1151 @@ If it works well, I might even get be able to do without a pixmap :-). + FILE SELECTION BOX It would be nice to have a file selection box with a small window that shows a preview of the level(s) and also a few indicators for textures, flats and other lumps. +FUNCTIONS AND BINDINGS +As of version 1.6, there is a number of problems: +- There is no way to get a list of all the bindings in use. Because of + that, neither the user's guide nor the man page document them and the + [F1] online help is incomplete and often out of date. There is also no + way to detect conflicts (i.e. two functions having the same binding). +- It would be nice to be able to change the bindings for a function + without recompiling. +- It would be nice to be able to define aliases or macros for the + functions you use often. +- Adding a new function involves redundant changes to add it in both the + menus and in EditorLoop(). +- MiscOperations() makes me want to laugh. +- EditorLoop() makes me want to cry. +- Some functions are defined inside EditorLoop(). +- There is no simple way to define bindings using a sequence of keys + like g? and z? in vi. +- The mechanism used to override the selection operation is awkward. +- There is no support for a count prefix. +- There is no command mode as in vi so you can't script and you can't + add a function without assigning it a binding first. + +The solution: +All actions should, as far as possible be functions. A function is a +piece of code that acts on editing session. It's identified by its name +(E.G. "split_sector"). It can take parameters, such a count, the working +set, a texture name, etc. + +There are three ways to invoke functions : +- through the bindings, +- through the menus, +- in command mode. + +There should be a --list-functions option to print the list of functions +to stdout. The output of this command would be included, after some +massaging, into the man page and users guide. + +Bindings: a binding is a sequence of keystrokes, a function name and +directives which define how the parameters of the function are set. +There should be a --list-bindings option to print the list of bindings +to stdout. This option would be used to generated the .cfg and the doc. + +Keys: keys that have no corresponding character in ASCII should be +representable with something like "[keyname]": [ctrl], [alt], [shift], +[return], [left], [pageup], [home], [end], [f1], [tab], [backtab]. To +what KeySyms these map should be documented. There should be a +--list-keys option to list all those codes to stdout. FIXME: How do we +make the difference simultaneous and disjoint keystrokes ? Or do we just +assume that modifiers (ctrl/alt/shift) are always simultaneous and the +rest never are ? + +Command mode: by typing [:], you enter command mode. This is similar to +vi's. Any function name can be used as a command. Parameters such as +object numbers are entered literally (E.G. ":delete_vertex 69"). It +should be possible to use the selection and highlight, either implicitly +(E.G. ":delete_vertex") or explicitly (E.G. ":delete_vertex $S"). There +should be shortcuts for function names (E.G. "dv" for "delete_vertex"). +I'd like to unify the command mode and the .cfg syntax so that you can +call function in a .cfg, that sort of stuff. + +Interactivity: functions should probably refrain from popping up dialog +boxes when called from command mode (it could be script). Either the +caller should pass a "don't-be-interactive" flag or it's the caller that +should pop up the dialog boxes, in which case it would have to be aware +of an awful lot of things. + +Arguments 1: FIXME: named arguments ? Unix-style options ? Purely +positional ? + +Arguments 2: FIXME: if there are any commands that take more than one +list, arguments must be typed (is it a list or not) and command mode +must provide a syntax for lists, E.G. "item1,item2,item3". + +Arguments 3: FIXME: cardinality checks in the caller ? (E.G. "need +exactly two linedefs selected"). + +Movement functions: movement commands are used in several ways: +- to select everything between the current pointer position to where + destination position without actually moving the pointer, +- to move the pointer. +How ? + +Modifiers: some functions don't do anything by themselves but change the +way the next function behaves : +- ["] followed by a register name, causes the next cut or paste function + to used that register instead of the unnamed register +- Modifiers for selection operations. By default a selection function + replaces the current selection. With the following modifiers, the + output of the function is combined with the current selection by the + means of a selop : [^] xor (sel = sel ^ func), [&] intersection (sel = + sel & func), [|] union (sel = sel | func), [~] subtraction (sel = sel + & ~func). +- +- something to make the next command use a movement selection as its + working set (vi can afford the luxury of duplicating commands (c vs. s + and d vs. x, but Yadex cannot because it has too many commands). + +It is desirable that these modifiers be implemented as functions, so +that they use the same binding system as everything else. + +A problem with modifiers is who resets the default settings ? If it's +EditorLoop(), how does it know which functions trigger resetting and +which don't ? If it's the functions, isn't it a bit bletcherous ? Should +functions have to declare that they use, say, the working set and +EditorLoop() reset the working set only after such functions ? + +FIXME: at the moment, certain keys are bound to several different +functions, depending on the mode. How do we do that ? Does it make any +sense now that global mode is in sight ? + +Current functions: +- [!] _debug_info +- [#] move_num +- [%] toggle_show_things_sprites +- [&] toggle_show_object_numbers +- ['] view_centre +- [+] zoom_in +- [-] zoom_out +- [0]..[9] zoom_set +- [<] move_prev +- [=] zoom_in +- [>] move_next +- [@] pop up font window +- [E] select_linedefs_ss +- [G] grid_inc +- [H] grid_reset +- [_] zoom_out +- [`] view_centre_zoom_fit +- [a] pop up "Set flag" +- [alt][a] pop up "About" +- [alt][i] info_bar_toggle +- [b] pop up "Toggle flag" +- [backtab] mode_prev +- [c] pop up "Clear flag" +- [ctrl][E] ^select_linedefs_ss +- [ctrl][b] select_linedefs_whose_sidedefs_reference_non_existant_sector +- [ctrl][e] ^select_linedefs_nf +- [ctrl][g] mode_global_toggle +- [ctrl][k] sector_slice +- [ctrl][l] force_redraw +- [ctrl][p] pop up palette window +- [ctrl][r] print sidedef xref +- [ctrl][s] print secret sectors +- [ctrl][t] print tagged linedefs or sectors +- [ctrl][u] select linedefs with unknown type +- [ctrl][v] toggle snap vertex tool +- [ctrl][x] obj_exchange_numbers +- [del] obj_delete +- [down] scroll_down +- [e] select_linedefs_nf +- [end] scroll_down_page +- [esc] quit +- [f10] pop up "Checks" +- [f1] pop up "Help" +- [f2] save +- [f3] save_as +- [f5] pop up "Preferences" +- [f8] pop up "Misc. operations" +- [f9] pop up "Insert a standard object" +- [g] grid_dec +- [h] grid_toggle +- [home] scroll_up_page +- [i] info_box_toggle +- [ins] obj_insert +- [j] move_num +- [l] mode_linedefs +- [left] scroll_left +- [n] move_next +- [o] copy +- [p] move_prev +- [pagedown] scroll_right_page +- [pageup] scroll_left_page +- [q] quit +- [r] rulers_toggle +- [return] pop up "Properties" +- [right] scroll_right +- [s] mode_sectors +- [shift][f1] screenshot +- [shift][f2] test_entry2 +- [space] zoom_toggle +- [t] mode_things +- [tab] mode_next +- [up] scroll_up +- [v] mode_vertices +- [w] linedef_split_sector_split +- [w] thing_spin_ccw +- [x] linedef_split +- [x] thing_spin_cw +- [y] snap_toggle +- [z] grid_lock_toggle +- [|] pop up colour window + +Possible new functions: +- go to {start,end,middle,other end} of linedef +- go pixels toward the {start,end} of this linedef +- go to the {next,previous} angle along this path of linedefs (how are + "next" and "previous" defined ? what happens if you're on a vertex + that's shared by several linedefs ?) +- move {left,right,up,down} to the edge of the selection +- go to the centre of the rectangle that contains the selection +- go to the nearest vertex +- go to the nearest vertex to the {north,south,east,west} +- make sector from linedefs, adding linedefs if necessary +- select shortest closed linedef path +- raise or lower the {ceiling,floor} of a sector by units +- [e][space] select_clear +- [e][~] select_invert (in same class of objects ?) + +Implementation: Functions are C++ functions (FIXME: what about aliases +and macros ?). There is a global map named "function" whose key is the +name of the function and the value a pointer on the corresponding C++ +function. FIXME: How is this map filled ? Hard coded ? Is is possible to +insert new elements dynamically ? It should probably be forbidden to +modify an existing element. + +There is a global map named "binding" whose key is the key sequence and +whose value is a structure containing the function name and the binding +information. FIXME: How is this map filled ? Are the default binding +hard coded ? + +FIXME: what the syntax to modify the bindings from the .cfg ? A separate +keyword (bind [shift][f9] fart \$@) or a pseudo hash +(binding["[shift][f9]"] = fart \$@) ? The interesting feature of the +pseudo hash is that it can be read, not just written to. + +Functions that modify the selection: They do not necessarily operate on +the main selection but perhaps on a copy of it. If we want to implement +env_push and env_pop, it is necessary to be able to dissociate the +selection from the editing session. + +FIXME do we implement the selop in EditorLoop() or in the selection +functions ? The obvious drawback of doing it in the functions is +redundant code and more bugs. The advantage is that it permits certain +optimisations. For example, if selop is intersect, there is no need to +scan the objects that are not already in the selection. Is the +performance gain worth the ugliness ? A O(1) scan is fast and if we need +a O(2) scan (for example to get the list of linedefs tagged to a list a +sectors), we can make it O(1) again by using a temporary table. It's +also a more general way to improve performance ; what if the selection +contains everything ? + +I'm tempted to go for the clean, easy solution (having the functions +return a selection of their own and having EditorLoop() combine it with +the existing list). If performance is a problem, it can be changed +later. One thing that will not be possible with this approach, though, +is to write a function that inserts items in the selection a certain +places (silly example : a function that takes a list of linedefs and +inserts after each linedef the sectors it is tagged to). But I guess we +can do without such a feature for the time being. + +Combining code: + (*function) (old_list, new_list); + if (selop == replace) { + old_list = new_list; + } + else { + if (selop == intersection) { + // Make bitvector new_bv from new_list + for each item in old_list + if not in new_bv + remove it from old_list + } + else if (selop == union) { + // Make bitvector old_bv from old_list + for each item in new_list + if not in old_bv + append in to old_list + } + else if (selop == xor) { + // Make bitvector new_bv from new_list + for each item in old_list + if in new_bv + remove it from old_list and from new_bv + for each item in new_list + if in new_bv + append it to old_list + } + else if (selop == subtraction) { + // Make bitvector new_bv from new_list + for each item in old_list + if in new_bv + remove it from old_list + } + } + +In any case, it should be possible for functions to modify the input +selection because select_clear is going to be implemented as a function. + +There should be a way to override the selop until further notice. + +EditorLoop() algorithm: +1. Get keystroke +2. Append to buffer +3. Is there a binding that is exactly equal to the buffer ? If yes, call + the corresponding function, empty the buffer and go to 1. +4. Is there a binding of which the contents of the buffer is an initial + substring ? If no, beep and empty the buffer. +5. Go to 1. +Also accumulate count. + + +AJA PATCH +Below is a patch that implements two other things that I would've +liked. Firstly, being able to turn off the warning message for the +"Swap Sidedefs" functions for lines. I find that I often need to flip +a line but keep the sidedefs where they were. The patch adds a +"blindly_swap_sidedefs" field to the config file. Incidentally I +found it strange that using "Add a 2nd Sidedef" onto a fresh line +(with no sidedefs already) put it as the first, yet flipping a single +sided line happily swaps the sidedefs, making a line with no right +side. + +Secondly, the patch lets the zoom factors of the number keys be +configurable. + +Cheers, +__ +\/ Andrew Apted + + +=========================================================================== + +diff -u ./src/editloop.cc.prev ./src/editloop.cc +--- ./src/editloop.cc.prev Tue Sep 19 16:20:03 2000 ++++ ./src/editloop.cc Tue Sep 19 17:38:52 2000 +@@ -247,6 +247,8 @@ + OrigX = 0; + OrigY = 0; + ++edit_zoom_init (); ++ + if (zoom_default == 0) + { + zoom_fit (e); +@@ -1370,7 +1372,7 @@ + // [0], [1], ... [9]: set the zoom factor + else if (is.key >= '0' && is.key <= '9') + { +- int r = edit_set_zoom (&e, is.key == '0' ? 0.1 : 1.0 / dectoi(is.key)); ++ int r = edit_set_zoom (&e, digit_zoom_factors[dectoi(is.key)]); + if (r == 0) + RedrawMap = 1; + } +diff -u ./src/cfgfile.cc.prev ./src/cfgfile.cc +--- ./src/cfgfile.cc.prev Tue Sep 19 16:20:24 2000 ++++ ./src/cfgfile.cc Tue Sep 19 18:33:03 2000 +@@ -345,6 +345,13 @@ + "Merge vertices after ins. vertex", + &insert_vertex_merge_vertices }, + ++{ "blindly_swap_sidedefs", ++ NULL, ++ OPT_BOOLEAN, ++ NULL, ++ "Blindly swap sidedefs on a linedef", ++ &blindly_swap_sidedefs }, ++ + { "iwad1", + "i1", + OPT_STRINGPTR, +@@ -556,6 +563,20 @@ + NULL, + "Step between zoom factors (in %)", + &zoom_step }, ++ ++{ "digit_zoom_base", ++ NULL, ++ OPT_INTEGER, ++ NULL, ++ "Base zoom factor of digit keys (in %)", ++ &digit_zoom_base }, ++ ++{ "digit_zoom_step", ++ NULL, ++ OPT_INTEGER, ++ NULL, ++ "Step between zoom factors of digit keys (in %)", ++ &digit_zoom_step }, + + { NULL, + NULL, +diff -u ./src/yadex.cc.prev ./src/yadex.cc +--- ./src/yadex.cc.prev Tue Sep 19 16:21:16 2000 ++++ ./src/yadex.cc Tue Sep 19 18:33:03 2000 +@@ -109,8 +109,11 @@ + bool InfoShown = true; + int zoom_default = 0; // 0 means fit + int zoom_step = 0; // 0 means sqrt(2) ++int digit_zoom_base = 100; ++int digit_zoom_step = 30; + confirm_t insert_vertex_split_linedef = YC_ASK_ONCE; + confirm_t insert_vertex_merge_vertices = YC_ASK_ONCE; ++bool blindly_swap_sidedefs = false; + const char *Iwad1 = NULL; + const char *Iwad2 = NULL; + const char *Iwad3 = NULL; +diff -u ./src/yadex.h.prev ./src/yadex.h +--- ./src/yadex.h.prev Tue Sep 19 16:21:20 2000 ++++ ./src/yadex.h Tue Sep 19 18:33:03 2000 +@@ -396,8 +396,11 @@ + extern int idle_sleep_ms; // Time to sleep after empty XPending() + extern int zoom_default; // Initial zoom factor for map + extern int zoom_step; // Step between zoom factors in percent ++extern int digit_zoom_base; // Zoom factor of `1' key, in percent ++extern int digit_zoom_step; // Step between digit keys, in percent + extern confirm_t insert_vertex_merge_vertices; + extern confirm_t insert_vertex_split_linedef; ++extern bool blindly_swap_sidedefs; + extern const char *Iwad1; // Name of the Doom iwad + extern const char *Iwad2; // Name of the Doom II iwad + extern const char *Iwad3; // Name of the Heretic iwad +diff -u ./src/editobj.cc.prev ./src/editobj.cc +--- ./src/editobj.cc.prev Tue Sep 19 18:29:40 2000 ++++ ./src/editobj.cc Tue Sep 19 18:29:53 2000 +@@ -747,6 +747,7 @@ + if (objtype == OBJ_LINEDEFS) + { + if (Expert ++ || blindly_swap_sidedefs + || Confirm (-1, -1, + "Warning: the sector references are also swapped", + "You may get strange results if you don't know what you are doing...")) +diff -u ./src/editzoom.cc.prev ./src/editzoom.cc +--- ./src/editzoom.cc.prev Tue Sep 19 17:15:54 2000 ++++ ./src/editzoom.cc Tue Sep 19 17:42:57 2000 +@@ -36,6 +36,21 @@ + #include "gfx.h" + + ++double digit_zoom_factors[10]; ++ ++ ++void edit_zoom_init () ++{ ++ int i; ++ ++ double current = digit_zoom_base / 100.0; ++ double step = (digit_zoom_step + 100.0) / 100.0; ++ ++ for (i=1; i <= 10; i++, current /= step) ++ digit_zoom_factors[i % 10] = current; ++} ++ ++ + int edit_zoom_in (edit_t *e) + { + if (! e) return 1; // Prevent compiler warning about unused .p. +diff -u ./src/editzoom.h.prev ./src/editzoom.h +--- ./src/editzoom.h.prev Tue Sep 19 17:15:58 2000 ++++ ./src/editzoom.h Tue Sep 19 17:39:03 2000 +@@ -4,6 +4,17 @@ + */ + + ++/* zoom factors for the digit keys ++ */ ++extern double digit_zoom_factors[10]; ++ ++ ++/* ++ * edit_zoom_init - initialise ++ */ ++void edit_zoom_init (void); ++ ++ + /* + * edit_zoom_in - zoom_in + * +diff -u ./yadex.cfg.prev ./yadex.cfg +--- ./yadex.cfg.prev Tue Sep 19 16:30:47 2000 ++++ ./yadex.cfg Tue Sep 19 18:41:14 2000 +@@ -78,6 +78,11 @@ + + insert_vertex_split_linedef = yes + ++# Blindly swaps the sidedefs on a linedef, i.e. without any warning ++# prompt. Default is false. ++ ++ #blindly_swap_sidedefs = false ++ + # Is the infobar shown ? On by default. + + #info_bar = true +@@ -111,8 +116,8 @@ + #default_light_level = 144 + #default_lower_texture = STARTAN3 + #default_middle_texture = STARTAN3 +- #default_thing = 3004 + #default_upper_texture = STARTAN3 ++ #default_thing = 3004 + + # Initial zoom factor when opening a new edit window, in + # percent. The special value 0 causes Yadex to adjust the zoom +@@ -127,6 +132,12 @@ + # two (slightly above 41% increase). It's the default. + + #zoom_step = 0 ++ ++# Base zoom factor and step for the digit keys, in percent. They work ++# like zoom_default and zoom_step above, but no special values. ++ ++ #digit_zoom_base = 100 ++ #digit_zoom_step = 30 + + + # + + +AJA PATCH #2 +Hey all, + +One feature I've really wanted in Yadex is the ability to point to an +area, press a key, and have all the linedefs that face into that area +updated so that it forms a new sector. If the lines don't have a +sidedef on that side, it is added, otherwise the existing sidedef is +updated. + +Well I've implemented it, below is the patch :-). The key is capital +`Z'. I tried `S' initially but it was easy to get mixed up with the +sector mode switch key `s'. It hasn't gotten heavy testing yet, but +so far so good. One limitation is that it doesn't handle islands +within the chosen area -- for example the pillars near the start of +MAP01 of DOOM 2. Oh yeah if you're in sector mode and press the 'Z' +key while another sector is selected, that sector reference is used on +the updated sidedefs rather than making a new sector. + +Cheers, +__ +\/ Andrew Apted + + +diff -r -u src_aja/editloop.cc src/editloop.cc +--- src_aja/editloop.cc Tue Aug 15 11:14:25 2000 ++++ src/editloop.cc Wed May 9 17:19:27 2001 +@@ -2123,6 +2123,21 @@ + RedrawMap = 1; + } + ++ // [Z] Set sector on surrounding linedefs (AJA) ++ else if (is.key == 'Z' && e.pointer_in_window) ++ { ++ if (e.obj_type == OBJ_SECTORS && e.Selected) ++ { ++ SuperSectorSelector (e.pointer_x, e.pointer_y, ++ e.Selected->objnum); ++ } ++ else ++ { ++ SuperSectorSelector (e.pointer_x, e.pointer_y, OBJ_NO_NONE); ++ } ++ RedrawMap = 1; ++ } ++ + // [!] Debug info (not documented) + else if (is.key == '!') + { +diff -r -u src_aja/s_misc.cc src/s_misc.cc +--- src_aja/s_misc.cc Mon Aug 28 07:33:51 2000 ++++ src/s_misc.cc Thu May 10 22:16:49 2001 +@@ -29,10 +29,13 @@ + + + #include "yadex.h" ++#include ++ + #include "entry.h" + #include "gfx.h" + #include "levels.h" + #include "selectn.h" ++#include "dialog.h" + + + /* +@@ -176,6 +179,342 @@ + Sectors[cur->objnum].light = light; + } + MadeChanges = 1; ++} ++ ++ ++static int find_linedef_for_area (int x, int y, int& side) ++{ ++ int n, m, curx; ++ int best_match = -1; ++ ++ curx = 32767; // Oh yes, one more hard-coded constant! ++ ++ for (n = 0; n < NumLineDefs; n++) ++ if ((Vertices[LineDefs[n].start].y > y) ++ != (Vertices[LineDefs[n].end].y > y)) ++ { ++ int lx0 = Vertices[LineDefs[n].start].x; ++ int ly0 = Vertices[LineDefs[n].start].y; ++ int lx1 = Vertices[LineDefs[n].end].x; ++ int ly1 = Vertices[LineDefs[n].end].y; ++ m = lx0 + (int) ((long) (y - ly0) * (long) (lx1 - lx0) ++ / (long) (ly1 - ly0)); ++ if (m >= x && m < curx) ++ { ++ curx = m; ++ best_match = n; ++ } ++ } ++ ++ /* now look if this linedef has a sidedef bound to one sector */ ++ if (best_match < 0) ++ return OBJ_NO_NONE; ++ ++ if (Vertices[LineDefs[best_match].start].y ++ > Vertices[LineDefs[best_match].end].y) ++ side = 1; ++ else ++ side = 2; ++ ++ return best_match; ++} ++ ++/* ++ compute the angle between lines AB and BC, going anticlockwise. ++ result is in degrees 0 - 359. A, B and C are vertex indices. ++ -AJA- 2001-05-09 ++ */ ++#define DEBUG_ANGLE 0 ++ ++static double angle_between_linedefs (int A, int B, int C) ++{ ++ int a_dx = Vertices[B].x - Vertices[A].x; ++ int a_dy = Vertices[B].y - Vertices[A].y; ++ ++ int c_dx = Vertices[B].x - Vertices[C].x; ++ int c_dy = Vertices[B].y - Vertices[C].y; ++ ++ double AB_angle = (a_dx == 0) ? (a_dy >= 0 ? 90 : -90) : ++ atan2 (a_dy, a_dx) * 180 / M_PI; ++ ++ double CB_angle = (c_dx == 0) ? (c_dy >= 0 ? 90 : -90) : ++ atan2 (c_dy, c_dx) * 180 / M_PI; ++ ++ double result = CB_angle - AB_angle; ++ ++ if (result >= 360) ++ result -= 360; ++ ++ while (result < 0) ++ result += 360; ++ ++#if (DEBUG_ANGLE) ++ fprintf(stderr, "ANGLE %1.6f (%d,%d) -> (%d,%d) -> (%d,%d)\n", ++ result, Vertices[A].x, Vertices[A].y, ++ Vertices[B].x, Vertices[B].y, Vertices[C].x, Vertices[C].y); ++#endif ++ ++ return result; ++} ++ ++/* ++ follows the path clockwise from the given start line, adding each ++ line into the appropriate set. If the path is not closed, zero is ++ returned. ++ ++ -AJA- 2001-05-09 ++ */ ++#define DEBUG_PATH 0 ++ ++static int select_sides_in_closed_path (bitvec_c& ld_side1, ++ bitvec_c& ld_side2, int line, int side) ++{ ++ int cur_vert, prev_vert, final_vert; ++ ++ if (side == 1) ++ { ++ ld_side1.set (line); ++ cur_vert = LineDefs[line].end; ++ prev_vert = final_vert = LineDefs[line].start; ++ } ++ else ++ { ++ ld_side2.set (line); ++ cur_vert = LineDefs[line].start; ++ prev_vert = final_vert = LineDefs[line].end; ++ } ++ ++#if (DEBUG_PATH) ++ fprintf(stderr, "PATH: line %d side %d cur %d final %d\n", ++ line, side, cur_vert, final_vert); ++#endif ++ ++ while (cur_vert != final_vert) ++ { ++ int next_line = OBJ_NO_NONE; ++ int next_vert = OBJ_NO_NONE; ++ int next_side; ++ double best_angle = 999; ++ ++ // Look for the next linedef in the path. It's the linedef that ++ // uses the current vertex and is not the current one. ++ ++ for (int n = 0; n < NumLineDefs; n++) ++ { ++ if (n == line) ++ continue; ++ ++ int other_vert; ++ int which_side; ++ ++ if (LineDefs[n].start == cur_vert) ++ { ++ other_vert = LineDefs[n].end; ++ which_side = 1; ++ } ++ else if (LineDefs[n].end == cur_vert) ++ { ++ other_vert = LineDefs[n].start; ++ which_side = 2; ++ } ++ else ++ continue; ++ ++ // found adjoining linedef ++ ++ double angle = angle_between_linedefs (prev_vert, cur_vert, ++ other_vert); ++ ++ if (! is_obj (next_line) || angle < best_angle) ++ { ++ next_line = n; ++ next_vert = other_vert; ++ next_side = which_side; ++ ++ best_angle = angle; ++ } ++ ++ // Continue the search ++ } ++ ++ line = next_line; ++ side = next_side; ++ ++#if (DEBUG_PATH) ++ fprintf(stderr, "PATH NEXT: line %d side %d vert %d angle %1.6f\n", ++ line, side, next_vert, best_angle); ++#endif ++ ++ // None ? Path cannot be closed ++ if (! is_obj (line)) ++ return 0; ++ ++ // Line already seen ? Under normal circumstances this won't ++ // happen, but it _can_ happen and indicates a non-closed ++ // structure ++ if (ld_side1.get (line) || ld_side2.get (line)) ++ return 0; ++ ++ if (side == 1) ++ ld_side1.set (line); ++ else ++ ld_side2.set (line); ++ ++ prev_vert = cur_vert; ++ cur_vert = next_vert; ++ } ++ ++#if (DEBUG_PATH) ++ fprintf(stderr, "PATH CLOSED !\n"); ++#endif ++ ++ return 1; ++} ++ ++/* ++ update the side on a single linedef, using the given sector ++ reference. Will create a new sidedef if necessary. ++ */ ++static void super_set_sector_on_side (int line, wad_sdn_t& side, ++ wad_sdn_t& other, int side_no, int sector) ++{ ++ if (is_obj (side) && SideDefs[side].sector == sector) ++ { ++ // there was no change. ++ return; ++ } ++ ++ int must_flip = 0; ++ ++ if (! is_obj (side)) ++ { ++ // if we're adding a sidedef to a line that has no sides, and ++ // the sidedef would be the 2nd one, then flip the linedef. ++ // Thus we don't end up with invalid lines -- i.e. ones with a ++ // left side but no right side. ++ ++ if (! is_obj (other) && side_no == 2) ++ must_flip = 1; ++ ++ InsertObject (OBJ_SIDEDEFS, OBJ_NO_NONE, 0, 0); ++ side = NumSideDefs - 1; ++ ++ // if we're adding a second side to the linedef, clear out some ++ // of the properties that aren't needed anymore: middle texture, ++ // two-sided flag, and impassible flag. ++ ++ if (is_obj (other)) ++ { ++ strncpy (SideDefs[side].tex3, "-", WAD_TEX_NAME); ++ strncpy (SideDefs[other].tex3, "-", WAD_TEX_NAME); ++ ++ LineDefs[line].flags |= 4; // Set the 2S bit ++ LineDefs[line].flags &= ~1; // Clear the Im bit ++ } ++ } ++ ++ SideDefs[side].sector = sector; ++ ++ if (must_flip) ++ { ++ int temp = LineDefs[line].start; ++ LineDefs[line].start = LineDefs[line].end; ++ LineDefs[line].end = temp; ++ ++ temp = side; ++ side = other; ++ other = temp; ++ } ++ ++ MadeChanges = 1; ++ MadeMapChanges = 1; ++} ++ ++static int super_find_sector_model (bitvec_c& ld_side1, ++ bitvec_c& ld_side2) ++{ ++ for (int line=0; line < NumLineDefs; line++) ++ { ++ int side1 = LineDefs[line].sidedef1; ++ int side2 = LineDefs[line].sidedef2; ++ ++ if (ld_side1.get (line)) ++ if (is_obj (side2)) ++ return SideDefs[side2].sector; ++ ++ if (ld_side2.get (line)) ++ if (is_obj (side1)) ++ return SideDefs[side1].sector; ++ } ++ ++ return OBJ_NO_NONE; ++} ++ ++ ++/* ++ Change the closed sector at the pointer ++ ++ "sector" here really means a bunch of sidedefs that all face ++ inward to the current area under the mouse cursor. Two basic ++ operations: (a) set the sidedef sector references to a completely ++ new sector, or (b) set them to an existing sector. This is ++ controlled by the `new_sec' parameter. ++ ++ -AJA- 2001-05-08 ++ */ ++ ++void SuperSectorSelector (int map_x, int map_y, int new_sec) ++{ ++ int line, side; ++ char msg_buf[200]; ++ ++ line = find_linedef_for_area (map_x, map_y, side); ++ ++ if (! is_obj (line)) ++ { ++ Beep (); ++ sprintf (msg_buf, "Chosen area is not closed"); ++ Notify (-1, -1, msg_buf, NULL); ++ return; ++ } ++ ++ bitvec_c ld_side1 (NumLineDefs); ++ bitvec_c ld_side2 (NumLineDefs); ++ ++ int closed = select_sides_in_closed_path (ld_side1, ld_side2, ++ line, side); ++ ++ if (! closed) ++ { ++ Beep (); ++ sprintf (msg_buf, "Area chosen is not closed"); ++ Notify (-1, -1, msg_buf, NULL); ++ return; ++ } ++ ++ // -AJA- FIXME: look for "islands", closed linedef paths that lie ++ // completely inside the area, i.e. not connected to the main path. ++ // Example: the two pillars at the start of MAP01 of DOOM 2. See ++ // GetOppositeSector() and the end of SplitSector() for a possible ++ // algorithm. ++ ++ if (! is_obj (new_sec)) ++ { ++ int model = super_find_sector_model (ld_side1, ld_side2); ++ InsertObject (OBJ_SECTORS, model, 0, 0); ++ new_sec = NumSectors - 1; ++ } ++ ++ for (line=0; line < NumLineDefs; line++) ++ { ++ if (ld_side1.get (line)) ++ super_set_sector_on_side (line, LineDefs[line].sidedef1, ++ LineDefs[line].sidedef2, 1, new_sec); ++ ++ else if (ld_side2.get (line)) ++ super_set_sector_on_side (line, LineDefs[line].sidedef2, ++ LineDefs[line].sidedef1, 2, new_sec); ++ } + } + + /* end of file */ +diff -r -u src_aja/yadex.h src/yadex.h +--- src_aja/yadex.h Wed Aug 16 07:22:40 2000 ++++ src/yadex.h Tue May 8 20:32:53 2001 +@@ -584,6 +584,7 @@ + void DistributeSectorCeilings (SelPtr); /* SWAP! */ + void RaiseOrLowerSectors (SelPtr obj); + void BrightenOrDarkenSectors (SelPtr obj); ++void SuperSectorSelector (int map_x, int map_y, int new_sec); + + /* s_prop.cc (previously in editobj.cc) */ + void SectorProperties (int x0, int y0, SelPtr obj); + + +AJA PATCH #3 +Here is a patch that implements two features I mentioned before: + + (a) the 'w' key in vertex mode doing "split sector" function. + It's quite handy. (code was a doddle). + + (b) the 'T' key doing property transfer from highlighted object + to all selected objects. + +Patch is against 1.5.1 (like the SuperSector one, which BTW has been +extremely useful -- I use it all the time and wouldn't want to edit +without it. Plus it hasn't crashed or fouled up yet). I've tried to +keep both patches independent -- might cause a reject against yadex.h +though. Andre, if you'd rather one big patch, will do. + +Cheers, +__ +\/ Andrew Apted + + +diff -u -r src_aja/editloop.cc src/editloop.cc +--- src_aja/editloop.cc Tue Aug 15 11:14:25 2000 ++++ src/editloop.cc Sun May 27 15:46:12 2001 +@@ -1853,6 +1853,17 @@ + StretchSelBox = false; + } + ++ // [w]: split sector between vertices ++ else if (is.key == 'w' && e.obj_type == OBJ_VERTICES ++ && e.Selected && e.Selected->next && ! e.Selected->next->next) ++ { ++ SplitSector (e.Selected->next->objnum, e.Selected->objnum); ++ ForgetSelection (&e.Selected); ++ RedrawMap = 1; ++ DragObject = false; ++ StretchSelBox = false; ++ } ++ + // [x]: spin things 1/8 turn clockwise + else if (is.key == 'x' && e.obj_type == OBJ_THINGS + && (e.Selected || is_obj (e.highlight_obj_no))) +@@ -2134,6 +2160,30 @@ + { + show_font (); + RedrawMap = 1; ++ } ++ ++ // [T] Transfer properties to selected objects (AJA) ++ else if (is.key == 'T' && e.Selected ++ && e.highlight_obj_no >= 0) ++ { ++ switch (e.obj_type) ++ { ++ case OBJ_SECTORS: ++ TransferSectorProperties (e.highlight_obj_no, e.Selected); ++ RedrawMap = 1; ++ break; ++ case OBJ_THINGS: ++ TransferThingProperties (e.highlight_obj_no, e.Selected); ++ RedrawMap = 1; ++ break; ++ case OBJ_LINEDEFS: ++ TransferLinedefProperties (e.highlight_obj_no, e.Selected); ++ RedrawMap = 1; ++ break; ++ default: ++ Beep (); ++ break; ++ } + } + + // [|] Show colours (not documented) +diff -u -r src_aja/l_prop.cc src/l_prop.cc +--- src_aja/l_prop.cc Sun Apr 30 06:37:12 2000 ++++ src/l_prop.cc Sun May 27 15:41:37 2001 +@@ -477,3 +477,37 @@ + } + + ++/* ++ * TransferLinedefProperties ++ * ++ * Note: right now nothing is done about sidedefs. Being able to ++ * (intelligently) transfer sidedef properties from source line to ++ * destination linedefs could be a useful feature -- though it is ++ * unclear the best way to do it. OTOH not touching sidedefs might ++ * be useful too. ++ * ++ * -AJA- 2001-05-27 ++ */ ++#define LINEDEF_FLAG_KEEP (1 + 4) ++ ++void TransferLinedefProperties (int src_linedef, SelPtr linedefs) ++{ ++ SelPtr cur; ++ wad_ldflags_t src_flags = LineDefs[src_linedef].flags & ~LINEDEF_FLAG_KEEP; ++ ++ for (cur=linedefs; cur; cur=cur->next) ++ { ++ if (! is_obj(cur->objnum)) ++ continue; ++ ++ // don't transfer certain flags ++ LineDefs[cur->objnum].flags &= LINEDEF_FLAG_KEEP; ++ LineDefs[cur->objnum].flags |= src_flags; ++ ++ LineDefs[cur->objnum].type = LineDefs[src_linedef].type; ++ LineDefs[cur->objnum].tag = LineDefs[src_linedef].tag; ++ ++ MadeChanges = 1; ++ } ++} ++ +diff -u -r src_aja/s_prop.cc src/s_prop.cc +--- src_aja/s_prop.cc Tue Jan 11 00:40:11 2000 ++++ src/s_prop.cc Sun May 27 13:29:27 2001 +@@ -208,3 +208,32 @@ + } + + ++/* ++ * TransferSectorProperties ++ * ++ * -AJA- 2001-05-27 ++ */ ++void TransferSectorProperties (int src_sector, SelPtr sectors) ++{ ++ SelPtr cur; ++ ++ for (cur=sectors; cur; cur=cur->next) ++ { ++ if (! is_obj(cur->objnum)) ++ continue; ++ ++ strncpy (Sectors[cur->objnum].floort, Sectors[src_sector].floort, ++ WAD_FLAT_NAME); ++ strncpy (Sectors[cur->objnum].ceilt, Sectors[src_sector].ceilt, ++ WAD_FLAT_NAME); ++ ++ Sectors[cur->objnum].floorh = Sectors[src_sector].floorh; ++ Sectors[cur->objnum].ceilh = Sectors[src_sector].ceilh; ++ Sectors[cur->objnum].light = Sectors[src_sector].light; ++ Sectors[cur->objnum].special = Sectors[src_sector].special; ++ Sectors[cur->objnum].tag = Sectors[src_sector].tag; ++ ++ MadeChanges = 1; ++ } ++} ++ +diff -u -r src_aja/t_prop.cc src/t_prop.cc +--- src_aja/t_prop.cc Tue Jul 25 08:46:49 2000 ++++ src/t_prop.cc Sun May 27 15:22:29 2001 +@@ -315,4 +315,30 @@ + } + + ++/* ++ * TransferThingProperties ++ * ++ * -AJA- 2001-05-27 ++ */ ++void TransferThingProperties (int src_thing, SelPtr things) ++{ ++ SelPtr cur; ++ ++ for (cur=things; cur; cur=cur->next) ++ { ++ if (! is_obj(cur->objnum)) ++ continue; ++ ++ Things[cur->objnum].angle = Things[src_thing].angle; ++ Things[cur->objnum].type = Things[src_thing].type; ++ Things[cur->objnum].when = Things[src_thing].when; ++ ++ MadeChanges = 1; ++ ++ things_types++; ++ things_angles++; ++ } ++} ++ ++ + /* end of file */ +diff -u -r src_aja/yadex.h src/yadex.h +--- src_aja/yadex.h Wed Aug 16 07:22:40 2000 ++++ src/yadex.h Sun May 27 15:45:18 2001 +@@ -506,6 +506,7 @@ + + /* l_prop.cc (previously in editobj.cc) */ + void LinedefProperties (int x0, int y0, SelPtr obj); ++void TransferLinedefProperties (int src_linedef, SelPtr linedefs); + + /* l_unlink.cc */ + void unlink_sidedef (SelPtr linedefs, int side1, int side2); +@@ -587,6 +589,7 @@ + + /* s_prop.cc (previously in editobj.cc) */ + void SectorProperties (int x0, int y0, SelPtr obj); ++void TransferSectorProperties (int src_sector, SelPtr sectors); + + /* s_split.cc (previously in objects.cc) */ + void SplitSector (int, int); /* SWAP! */ +@@ -603,6 +606,7 @@ + /* selrect.cc */ + /* t_prop.c (previously in editobj.c) */ + void ThingProperties (int x0, int y0, SelPtr obj); ++void TransferThingProperties (int src_thing, SelPtr things); + + /* v_merge.cc */ + void DeleteVerticesJoinLineDefs (SelPtr ); /* SWAP! */ + + diff -uaNr yadex-1.5.2/VERSION yadex-1.6.0/VERSION --- yadex-1.5.2/VERSION 2001-06-21 16:05:44.000000000 +0200 +++ yadex-1.6.0/VERSION 2003-03-30 14:18:03.000000000 +0200 @@ -1 +1 @@ -1.5.2 +1.6.0 diff -uaNr yadex-1.5.2/atclib/al_sdup.c yadex-1.6.0/atclib/al_sdup.c --- yadex-1.5.2/atclib/al_sdup.c 1999-08-01 17:23:50.000000000 +0200 +++ yadex-1.6.0/atclib/al_sdup.c 2001-06-21 16:22:13.000000000 +0200 @@ -27,6 +27,7 @@ #include +#include #include "atclib.h" diff -uaNr yadex-1.5.2/boost/boost/config/compiler/borland.hpp yadex-1.6.0/boost/boost/config/compiler/borland.hpp --- yadex-1.5.2/boost/boost/config/compiler/borland.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/borland.hpp 2001-10-01 19:26:33.000000000 +0200 @@ -0,0 +1,55 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Borland C++ compiler setup: + +# if __BORLANDC__ <= 0x0550 +// Borland C++ Builder 4 and 5: +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# if __BORLANDC__ == 0x0550 +// Borland C++ Builder 5, command-line compiler 5.5: +# define BOOST_NO_OPERATORS_IN_NAMESPACE +# endif +# endif + +#if (__BORLANDC__ >= 0x550) +// is partly broken, some macos define symbols that are really in +// namespace std, so you end up having to use illegal constructs like +// std::DBL_MAX, as a fix we'll just include float.h and have done with: +#include +#endif + +// Version 5.51: +#if (__BORLANDC__ <= 0x551) || !defined(BOOST_STRICT_CONFIG) +# define BOOST_NO_CV_SPECIALIZATIONS +# define BOOST_NO_CV_VOID_SPECIALIZATIONS +# define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_PRIVATE_IN_AGGREGATE +# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS +# define BOOST_NO_SWPRINTF +# define BOOST_NO_USING_TEMPLATE +#endif + +#define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__) + +// +// versions check: +// we don't support Borland prior to version 5.4: +#if __BORLANDC__ < 0x540 +# error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 5.51: +#if (__BORLANDC__ > 0x551) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# else +# pragma message( "Unknown compiler version - please run the configure tests and report the results") +# endif +#endif + + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/comeau.hpp yadex-1.6.0/boost/boost/config/compiler/comeau.hpp --- yadex-1.5.2/boost/boost/config/compiler/comeau.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/comeau.hpp 2001-10-01 19:26:33.000000000 +0200 @@ -0,0 +1,38 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Comeau C++ compiler setup: + +#include "boost/config/compiler/common_edg.hpp" + +#if (__COMO_VERSION__ <= 4245) || !defined(BOOST_STRICT_CONFIG) +# define BOOST_FUNCTION_USE_VIRTUAL_FUNCTIONS +# if defined(_MSC_VER) && _MSC_VER <= 1300 +# define BOOST_NO_STDC_NAMESPACE +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# define BOOST_NO_SWPRINTF +# endif +#endif + +#define BOOST_COMPILER "Comeau compiler version " BOOST_STRINGIZE(__COMO_VERSION__) + +// +// versions check: +// we don't know Comeau prior to version 4245: +#if __COMO_VERSION__ < 4245 +# error "Compiler not configured - please reconfigure" +#endif +// +// last known and checked version is 4245: +#if (__COMO_VERSION__ > 4245) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/common_edg.hpp yadex-1.6.0/boost/boost/config/compiler/common_edg.hpp --- yadex-1.5.2/boost/boost/config/compiler/common_edg.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/common_edg.hpp 2001-10-01 19:26:35.000000000 +0200 @@ -0,0 +1,25 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// +// Options common to all edg based compilers. +// +// This is included from within the individual compiler mini-configs. + +#ifndef __EDG_VERSION__ +# error This file requires that __EDG_VERSION__ be defined. +#endif + +#if (__EDG_VERSION__ <= 238) +# define BOOST_NO_VOID_RETURNS +#endif + +#if (__EDG_VERSION__ <= 241) && !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +#endif + + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/compaq_cxx.hpp yadex-1.6.0/boost/boost/config/compiler/compaq_cxx.hpp --- yadex-1.5.2/boost/boost/config/compiler/compaq_cxx.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/compaq_cxx.hpp 2001-10-01 19:26:33.000000000 +0200 @@ -0,0 +1,18 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Dec Alpha True64 C++ compiler setup: + +#define BOOST_COMPILER "Dec Alpha True64 " BOOST_STRINGIZE(__DECCXX_VER) + +#include "boost/config/compiler/common_edg.hpp" + +// +// versions check: +// Nothing to do here? + + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/gcc.hpp yadex-1.6.0/boost/boost/config/compiler/gcc.hpp --- yadex-1.5.2/boost/boost/config/compiler/gcc.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/gcc.hpp 2001-10-01 19:26:33.000000000 +0200 @@ -0,0 +1,54 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// GNU C++ compiler setup: + +# if __GNUC__ == 2 && __GNUC_MINOR__ == 91 + // egcs 1.1 won't parse smart_ptr.hpp without this: +# define BOOST_NO_AUTO_PTR +# endif +# if __GNUC__ == 2 && __GNUC_MINOR__ < 95 + // + // Prior to gcc 2.95 member templates only partly + // work - define BOOST_MSVC6_MEMBER_TEMPLATES + // instead since inline member templates mostly work. + // +# define BOOST_NO_MEMBER_TEMPLATES +# if __GNUC_MINOR__ >= 9 +# define BOOST_MSVC6_MEMBER_TEMPLATES +# endif +# endif + +# if __GNUC__ == 2 && __GNUC_MINOR__ <= 97 +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_OPERATORS_IN_NAMESPACE +# endif + +// +// Threading support: +// Turn this on unconditionally here, it will get turned off again later +// if no threading API is detected. +// +#define BOOST_HAS_THREADS + +#define BOOST_COMPILER "GNU C++ version " BOOST_STRINGIZE(__GNUC__) "." BOOST_STRINGIZE(__GNUC_MINOR__) + +// +// versions check: +// we don't know gcc prior to version 2.90: +#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90) +# error "Compiler not configured - please reconfigure" +#endif +// +// last known and checked version is 3.0: +#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 0)) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# else +# warning "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif diff -uaNr yadex-1.5.2/boost/boost/config/compiler/greenhills.hpp yadex-1.6.0/boost/boost/config/compiler/greenhills.hpp --- yadex-1.5.2/boost/boost/config/compiler/greenhills.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/greenhills.hpp 2001-10-01 19:26:33.000000000 +0200 @@ -0,0 +1,27 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Greenhills C++ compiler setup: + +#define BOOST_COMPILER "Greenhills C++ version " BOOST_STRINGIZE(__ghs) + +#include "boost/config/compiler/common_edg.hpp" + +// +// versions check: +// we don't support Greenhills prior to version 0: +#if __ghs < 0 +# error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 0: +#if (__ghs > 0) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/hp_acc.hpp yadex-1.6.0/boost/boost/config/compiler/hp_acc.hpp --- yadex-1.5.2/boost/boost/config/compiler/hp_acc.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/hp_acc.hpp 2001-10-01 19:26:34.000000000 +0200 @@ -0,0 +1,36 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// HP aCC C++ compiler setup: + +// THIS FILE IS INCOMPLETE: WE NEED THE CORRECT VERSION CHECKS ADDING!!! +#if (__HP_aCC <= 0) || !defined(BOOST_STRICT_CONFIG) +# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS +# define BOOST_NO_OPERATORS_IN_NAMESPACE +# if !defined(_NAMESPACE_STD) +# define BOOST_NO_STD_LOCALE +# define BOOST_NO_STRINGSTREAM +# endif +#endif + + +#define BOOST_COMPILER "HP aCC version " BOOST_STRINGIZE(__HP_aCC) + +// +// versions check: +// we don't support HP aCC prior to version 0: +#if __HP_aCC < 0 +# error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 0: +#if (__HP_aCC > 0) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/intel.hpp yadex-1.6.0/boost/boost/config/compiler/intel.hpp --- yadex-1.5.2/boost/boost/config/compiler/intel.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/intel.hpp 2001-10-01 19:26:34.000000000 +0200 @@ -0,0 +1,61 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Intel compiler setup: + +#include "boost/config/compiler/common_edg.hpp" + +#ifdef __ICL +# define BOOST_COMPILER "Intel C++ version " BOOST_STRINGIZE(__ICL) +# define BOOST_INTEL_CXX_VERSION __ICL +#else +# define BOOST_COMPILER "Intel C++ version " BOOST_STRINGIZE(__ICC) +# define BOOST_INTEL_CXX_VERSION __ICC +#endif + +#if (BOOST_INTEL_CXX_VERSION <= 600) || !defined(BOOST_STRICT_CONFIG) + +# if defined(_MSC_VER) + // Intel C++ 5.0.1 uses EDG 2.45, but fails to activate Koenig lookup + // in the frontend even in "strict" mode. (reported by Kirk Klobe) + // Intel C++ 6.0 (currently in Beta test) doesn't have any front-end + // changes at all. (reported by Kirk Klobe) +# ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# endif +# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +# define BOOST_NO_SWPRINTF +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# endif + +#endif + +#ifdef _MSC_VER +# ifndef _NATIVE_WCHAR_T_DEFINED +# define BOOST_NO_INTRINSIC_WCHAR_T +# endif +# define BOOST_NO_SWPRINTF +#endif + + +// +// versions check: +// we don't support Intel prior to version 5.0: +#if BOOST_INTEL_CXX_VERSION < 500 +# error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 500: +#if (BOOST_INTEL_CXX_VERSION > 500) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# elif defined(_MSC_VER) +# warning "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/kai.hpp yadex-1.6.0/boost/boost/config/compiler/kai.hpp --- yadex-1.5.2/boost/boost/config/compiler/kai.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/kai.hpp 2001-10-01 19:26:34.000000000 +0200 @@ -0,0 +1,27 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Kai C++ compiler setup: + +#include "boost/config/compiler/common_edg.hpp" + +# if (__KCC_VERSION <= 4001) || !defined(BOOST_STRICT_CONFIG) + // at least on Sun, the contents of is not in namespace std +# define BOOST_NO_STDC_NAMESPACE +# endif + +#define BOOST_COMPILER "Kai C++ version " BOOST_STRINGIZE(__KCC_VERSION) + +// +// last known and checked version is 4001: +#if (__KCC_VERSION > 4001) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/metrowerks.hpp yadex-1.6.0/boost/boost/config/compiler/metrowerks.hpp --- yadex-1.5.2/boost/boost/config/compiler/metrowerks.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/metrowerks.hpp 2001-10-01 19:26:34.000000000 +0200 @@ -0,0 +1,50 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Metrowerks C++ compiler setup: + +# if __MWERKS__ <= 0x2301 // 5.3 +# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING +# define BOOST_NO_POINTER_TO_MEMBER_CONST +# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS +# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD +# endif + +# if __MWERKS__ <= 0x2401 // 6.2 +//# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING +# endif + +# if(__MWERKS__ <= 0x2405) || !defined(BOOST_STRICT_CONFIG) // 7.0 +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# endif + +#if !__option(wchar_type) +# define BOOST_NO_INTRINSIC_WCHAR_T +#endif + + +#define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(__MWERKS__) + +// +// versions check: +// we don't support Metrowerks prior to version 5.3: +#if __MWERKS__ < 0x2301 +# error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 0x2405: +#if (__MWERKS__ > 0x2405) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + + + + + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/mpw.hpp yadex-1.6.0/boost/boost/config/compiler/mpw.hpp --- yadex-1.5.2/boost/boost/config/compiler/mpw.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/mpw.hpp 2001-10-01 19:26:34.000000000 +0200 @@ -0,0 +1,49 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// MPW C++ compilers setup: + +# if defined(__SC__) +# define BOOST_COMPILER "MPW SCpp version " BOOST_STRINGIZE(__SC__) +# elif defined(__MRC__) +# define BOOST_COMPILER "MPW MrCpp version " BOOST_STRINGIZE(__MRC__) +# else +# error "Using MPW compiler configuration by mistake. Please update." +# endif + +// +// MPW 8.90: +// +#if (MPW_CPLUS <= 0x890) || !defined(BOOST_STRICT_CONFIG) +# define BOOST_NO_CV_SPECIALIZATIONS +# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS +# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_NO_INTRINSIC_WCHAR_T +# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# define BOOST_NO_USING_TEMPLATE + +# define BOOST_NO_CWCHAR +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + +# define BOOST_NO_STD_ALLOCATOR /* actually a bug with const reference overloading */ +#endif + +// +// versions check: +// we don't support MPW prior to version 8.9: +#if MPW_CPLUS < 0x890 +# error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 0x890: +#if (MPW_CPLUS > 0x890) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/sgi_mipspro.hpp yadex-1.6.0/boost/boost/config/compiler/sgi_mipspro.hpp --- yadex-1.5.2/boost/boost/config/compiler/sgi_mipspro.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/sgi_mipspro.hpp 2001-10-01 19:26:34.000000000 +0200 @@ -0,0 +1,16 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// SGI C++ compiler setup: + +#define BOOST_COMPILER "SGI Irix compiler version " BOOST_STRINGIZE(_COMPILER_VERSION) + +#include "boost/config/compiler/common_edg.hpp" + +// +// version check: +// probably nothing to do here? diff -uaNr yadex-1.5.2/boost/boost/config/compiler/sunpro_cc.hpp yadex-1.6.0/boost/boost/config/compiler/sunpro_cc.hpp --- yadex-1.5.2/boost/boost/config/compiler/sunpro_cc.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/sunpro_cc.hpp 2001-10-01 19:26:34.000000000 +0200 @@ -0,0 +1,50 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Sun C++ compiler setup: + +# if __SUNPRO_CC >= 0x520 + // + // Sunpro 5.1 and later: + // + // although sunpro 5.1 supports the syntax for + // inline initialization it often gets the value + // wrong, especially where the value is computed + // from other constants (J Maddock 6th May 2001) +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION + // although sunpro 5.1 supports the syntax for + // partial specialization, it often seems to + // bind to the wrong specialization. Better + // to disable it until suppport becomes more stable + // (J Maddock 6th May 2001). +# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // integral constant expressions with 64 bit numbers fail +# define BOOST_NO_INTEGRAL_INT64_T +# endif +# if __SUNPRO_CC <= 0x500 +# define BOOST_NO_MEMBER_TEMPLATES +# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# endif + +#define BOOST_COMPILER "Sun compiler version " BOOST_STRINGIZE(__SUNPRO_CC) + +// +// versions check: +// we don't support sunpro prior to version 4: +#if __SUNPRO_CC < 0x400 +#error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 0x520: +#if (__SUNPRO_CC > 0x520) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/vacpp.hpp yadex-1.6.0/boost/boost/config/compiler/vacpp.hpp --- yadex-1.5.2/boost/boost/config/compiler/vacpp.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/vacpp.hpp 2001-10-01 19:26:34.000000000 +0200 @@ -0,0 +1,37 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Visual Age (IBM) C++ compiler setup: + +#define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +#define BOOST_NO_INCLASS_MEMBER_INITIALIZATION + +// +// On AIX thread support seems to be indicated by _THREAD_SAFE: +// +#ifdef _THREAD_SAFE +# define BOOST_HAS_THREADS +#endif + +#define BOOST_COMPILER "IBM Visual Age" BOOST_STRINGIZE(__IBMCPP__) + +// +// versions check: +// we don't support Visual age prior to version 5: +#if __IBMCPP__ < 500 +#error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 500: +#if (__IBMCPP__ > 500) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + + + diff -uaNr yadex-1.5.2/boost/boost/config/compiler/visualc.hpp yadex-1.6.0/boost/boost/config/compiler/visualc.hpp --- yadex-1.5.2/boost/boost/config/compiler/visualc.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/compiler/visualc.hpp 2001-10-01 19:26:34.000000000 +0200 @@ -0,0 +1,76 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Microsoft Visual C++ compiler setup: + +#define BOOST_MSVC _MSC_VER + +// turn off the warnings before we #include anything +#pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info +#pragma warning( disable : 4503 ) // warning: decorated name length exceeded + +#if _MSC_VER <= 1200 // 1200 == VC++ 6.0 +# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS +# define BOOST_NO_VOID_RETURNS +#endif + +#if (_MSC_VER <= 1300) || !defined(BOOST_STRICT_CONFIG) // VC7 Beta 2 or later +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_NO_PRIVATE_IN_AGGREGATE +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# define BOOST_NO_INTEGRAL_INT64_T + +// VC++ 6/7 has member templates but they have numerous problems including +// cases of silent failure, so for safety we define: +# define BOOST_NO_MEMBER_TEMPLATES +// For VC++ experts wishing to attempt workarounds, we define: +# define BOOST_MSVC6_MEMBER_TEMPLATES + +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# define BOOST_NO_CV_VOID_SPECIALIZATIONS +# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING +# define BOOST_NO_USING_TEMPLATE +# define BOOST_NO_SWPRINTF +//# define BOOST_NO_POINTER_TO_MEMBER_CONST + // + // disable min/max macros if defined: + // +# ifdef min +# undef min +# endif +# ifdef max +# undef max +# endif + // disable min/max macro defines on vc6: + // +# define NOMINMAX +#endif + +#ifndef _NATIVE_WCHAR_T_DEFINED +# define BOOST_NO_INTRINSIC_WCHAR_T +#endif + +#define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(_MSC_VER) + +// +// versions check: +// we don't support Visual C++ prior to version 6: +#if _MSC_VER < 1200 +#error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is 1300: +#if (_MSC_VER > 1300) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# else +# warning "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif + diff -uaNr yadex-1.5.2/boost/boost/config/platform/aix.hpp yadex-1.6.0/boost/boost/config/platform/aix.hpp --- yadex-1.5.2/boost/boost/config/platform/aix.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/platform/aix.hpp 2001-10-01 19:26:35.000000000 +0200 @@ -0,0 +1,20 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// IBM/Aix specific config options: + +#define BOOST_PLATFORM "IBM Aix" + +#define BOOST_HAS_UNISTD_H +#define BOOST_HAS_PTHREADS +#define BOOST_HAS_NL_TYPES_H + +// Threading API's: +#define BOOST_HAS_PTHREAD_DELAY_NP +#define BOOST_HAS_PTHREAD_YIELD + + diff -uaNr yadex-1.5.2/boost/boost/config/platform/beos.hpp yadex-1.6.0/boost/boost/config/platform/beos.hpp --- yadex-1.5.2/boost/boost/config/platform/beos.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/platform/beos.hpp 2001-10-01 19:26:35.000000000 +0200 @@ -0,0 +1,23 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// BeOS specific config options: + +#define BOOST_PLATFORM "BeOS" + +#define BOOST_NO_CWCHAR +#define BOOST_NO_CWCTYPE +#define BOOST_HAS_UNISTD_H + +#define BOOST_HAS_BETHREADS + +#ifndef BOOST_DISABLE_THREADS +# define BOOST_HAS_THREADS +#endif + + + diff -uaNr yadex-1.5.2/boost/boost/config/platform/bsd.hpp yadex-1.6.0/boost/boost/config/platform/bsd.hpp --- yadex-1.5.2/boost/boost/config/platform/bsd.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/platform/bsd.hpp 2001-10-01 19:26:35.000000000 +0200 @@ -0,0 +1,39 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// generic BSD config options: + +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) +#error "This platform is not BSD" +#endif + +#ifdef __FreeBSD__ +#define BOOST_PLATFORM "FreeBSD " BOOST_STRINGIZE(__FreeBSD__) +#elif defined(__NetBSD__) +#define BOOST_PLATFORM "NetBSD " BOOST_STRINGIZE(__NetBSD__) +#elif defined(__OpenBSD__) +#define BOOST_PLATFORM "OpenBSD " BOOST_STRINGIZE(__OpenBSD__) +#endif + +// +// is this the correct version check? +// FreeBSD has but does not +// advertise the fact in : +// +#if defined(__FreeBSD__) && (__FreeBSD__ >= 4) +# define BOOST_HAS_NL_TYPES_H +#endif + +// +// No wide character support in the BSD header files: +// +#define BOOST_NO_CWCHAR + +// +// The BSD has macros only, no functions: +// +#define BOOST_NO_CTYPE_FUNCTIONS diff -uaNr yadex-1.5.2/boost/boost/config/platform/cygwin.hpp yadex-1.6.0/boost/boost/config/platform/cygwin.hpp --- yadex-1.5.2/boost/boost/config/platform/cygwin.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/platform/cygwin.hpp 2001-10-01 19:26:35.000000000 +0200 @@ -0,0 +1,30 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// cygwin specific config options: + +#define BOOST_PLATFORM "Cygwin" +#define BOOST_NO_CWCTYPE +#define BOOST_NO_CWCHAR +#define BOOST_NO_SWPRINTF + +// +// Threading API: +// See if we have POSIX threads, if we do use them, otherwise +// revert to native Win threads. +#include +#if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) +# define BOOST_HAS_PTHREADS +# define BOOST_HAS_SCHED_YIELD +# define BOOST_HAS_GETTIMEOFDAY +#else +# define BOOST_HAS_WINTHREADS +# define BOOST_HAS_FTIME +#endif + + + diff -uaNr yadex-1.5.2/boost/boost/config/platform/hpux.hpp yadex-1.6.0/boost/boost/config/platform/hpux.hpp --- yadex-1.5.2/boost/boost/config/platform/hpux.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/platform/hpux.hpp 2001-10-01 19:26:35.000000000 +0200 @@ -0,0 +1,19 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// hpux specific config options: + +#define BOOST_PLATFORM "HP-UX" + +// In principle, HP-UX has a nice under the name +// However, it has the following problem: +// Use of UINT32_C(0) results in "0u l" for the preprocessed source +// (verifyable with gcc 2.95.3, assumed for HP aCC) +// #define BOOST_HAS_STDINT_H + +#define BOOST_NO_SWPRINTF +#define BOOST_NO_CWCTYPE diff -uaNr yadex-1.5.2/boost/boost/config/platform/irix.hpp yadex-1.6.0/boost/boost/config/platform/irix.hpp --- yadex-1.5.2/boost/boost/config/platform/irix.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/platform/irix.hpp 2001-10-01 19:26:36.000000000 +0200 @@ -0,0 +1,13 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// SGI Irix specific config options: + +#define BOOST_PLATFORM "SGI Irix" + +#define BOOST_NO_SWPRINTF + diff -uaNr yadex-1.5.2/boost/boost/config/platform/linux.hpp yadex-1.6.0/boost/boost/config/platform/linux.hpp --- yadex-1.5.2/boost/boost/config/platform/linux.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/platform/linux.hpp 2001-10-01 19:26:36.000000000 +0200 @@ -0,0 +1,64 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// linux specific config options: + +#define BOOST_PLATFORM "linux" + +// make sure we have __GLIBC_PREREQ if available at all +#include + +// +// added to glibc 2.1.1 +// We can only test for 2.1 though: +// +#if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) + // defines int64_t unconditionally, but defines + // int64_t only if __GNUC__. Thus, assume a fully usable + // only when using GCC. +# if defined __GNUC__ +# define BOOST_HAS_STDINT_H +# endif +#endif + +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) +// __GLIBC_PREREQ is available since 2.1.2 + + // swprintf is available since glibc 2.2.0 +# if !__GLIBC_PREREQ(2,2) || (!defined(__USE_ISOC99) && !defined(__USE_UNIX98)) +# define BOOST_NO_SWPRINTF +# endif +#else +# define BOOST_NO_SWPRINTF +#endif + +#ifndef __GNUC__ +// +// if the compiler is not gcc we still need to be able to parse +// the GNU system headers, some of which (mainly ) +// use GNU specific extensions: +// +# ifndef __extension__ +# define __extension__ +# endif +# ifndef __const__ +# define __const__ const +# endif +# ifndef __volatile__ +# define __volatile__ volatile +# endif +# ifndef __signed__ +# define __signed__ signed +# endif +# ifndef __typeof__ +# define __typeof__ typeof +# endif +# ifndef __inline__ +# define __inline__ inline +# endif +#endif + diff -uaNr yadex-1.5.2/boost/boost/config/platform/macos.hpp yadex-1.6.0/boost/boost/config/platform/macos.hpp --- yadex-1.5.2/boost/boost/config/platform/macos.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/platform/macos.hpp 2001-10-01 19:26:36.000000000 +0200 @@ -0,0 +1,32 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Mac OS specific config options: + +#define BOOST_PLATFORM "Mac OS" + +// If __MACH__, we're using the BSD standard C library, not the MSL: +#if defined(__MACH__) + +# define BOOST_NO_CTYPE_FUNCTIONS +# define BOOST_NO_CWCHAR +# ifndef BOOST_HAS_UNISTD_H +# define BOOST_HAS_UNISTD_H +# endif +# ifndef BOOST_HAS_STDINT_H +# define BOOST_HAS_STDINT_H +# endif + +# ifndef __APPLE_CC__ + +// GCC strange "ignore std" mode works better if you pretend everything +// is in the std namespace, for the most part. + +# define BOOST_NO_STDC_NAMESPACE +# endif + +#endif diff -uaNr yadex-1.5.2/boost/boost/config/platform/solaris.hpp yadex-1.6.0/boost/boost/config/platform/solaris.hpp --- yadex-1.5.2/boost/boost/config/platform/solaris.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/platform/solaris.hpp 2001-10-01 19:26:36.000000000 +0200 @@ -0,0 +1,13 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// sun specific config options: + +#define BOOST_PLATFORM "sun" + + + diff -uaNr yadex-1.5.2/boost/boost/config/platform/win32.hpp yadex-1.6.0/boost/boost/config/platform/win32.hpp --- yadex-1.5.2/boost/boost/config/platform/win32.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/platform/win32.hpp 2001-10-01 19:26:36.000000000 +0200 @@ -0,0 +1,36 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Win32 specific config options: + +#define BOOST_PLATFORM "Win32" + +#if defined BOOST_DECL_EXPORTS +# if defined BOOST_DECL_IMPORTS +# error Not valid to define both BOOST_DECL_EXPORTS and BOOST_DECL_IMPORTS +# endif +# define BOOST_DECL __declspec(dllexport) +#elif defined BOOST_DECL_IMPORTS +# define BOOST_DECL __declspec(dllimport) +#else +# define BOOST_DECL +#endif + +#if defined(__GNUC__) && !defined(BOOST_NO_SWPRINTF) +# define BOOST_NO_SWPRINTF +#endif + +// +// Win32 will normally be using native Win32 threads, +// but there is a pthread library avaliable as an option: +// +#ifndef BOOST_HAS_PTHREADS +# define BOOST_HAS_WINTHREADS +#endif + +// WEK: Added +#define BOOST_HAS_FTIME diff -uaNr yadex-1.5.2/boost/boost/config/posix_features.hpp yadex-1.6.0/boost/boost/config/posix_features.hpp --- yadex-1.5.2/boost/boost/config/posix_features.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/posix_features.hpp 2001-10-01 19:26:32.000000000 +0200 @@ -0,0 +1,65 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// All POSIX feature tests go in this file: + +# ifdef BOOST_HAS_UNISTD_H +# include + + // XOpen has , but is this the correct version check? +# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 3) +# define BOOST_HAS_NL_TYPES_H +# endif + + // POSIX version 6 requires +# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100) +# define BOOST_HAS_STDINT_H +# endif + + // POSIX defines _POSIX_THREADS > 0 for pthread support, + // however some platforms define _POSIX_THREADS without + // a value, hence the (_POSIX_THREADS+0 >= 0) check. + // Strictly speaking this may catch platforms with a + // non-functioning stub , but such occurrences should + // occur very rarely if at all. +# if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) +# define BOOST_HAS_PTHREADS +# endif + + // BOOST_HAS_NANOSLEEP: + // This is predicated on _POSIX_TIMERS: +# if defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0) +# define BOOST_HAS_NANOSLEEP +# endif + + // BOOST_HAS_SCHED_YIELD: + // This is predicated on _POSIX_PRIORITY_SCHEDULING or + // on _POSIX_THREAD_PRIORITY_SCHEDULING. +# if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING+0 > 0) +# define BOOST_HAS_SCHED_YIELD +# endif +# if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0) +# define BOOST_HAS_SCHED_YIELD +# endif + + // BOOST_HAS_GETTIMEOFDAY: + // BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE: + // These are predicated on _XOPEN_VERSION, and appears to be first released + // in issue 4, version 2 (_XOPEN_VERSION > 500). +# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 > 500) +# define BOOST_HAS_GETTIMEOFDAY +# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +# endif + + // BOOST_HAS_CLOCK_GETTIME: + // This is predicated on _POSIX_TIMERS. +# if defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 > 0) +# define BOOST_HAS_CLOCK_GETTIME +# endif + + +# endif diff -uaNr yadex-1.5.2/boost/boost/config/select_compiler_config.hpp yadex-1.6.0/boost/boost/config/select_compiler_config.hpp --- yadex-1.5.2/boost/boost/config/select_compiler_config.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/select_compiler_config.hpp 2001-10-01 19:26:32.000000000 +0200 @@ -0,0 +1,77 @@ +// Boost compiler configuration selection header file + +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// locate which compiler we are using and define +// BOOST_COMPILER_CONFIG as needed: + +#if defined __GNUC__ +// GNU C++: +# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc.hpp" + +#elif defined __KCC +// Kai C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/kai.hpp" + +#elif defined __sgi +// SGI MIPSpro C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/sgi_mipspro.hpp" + +#elif defined __DECCXX +// Compaq Tru64 Unix cxx +# define BOOST_COMPILER_CONFIG "boost/config/compiler/compaq_cxx.hpp" + +#elif defined __ghs +// Greenhills C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/greenhills.hpp" + +#elif defined __BORLANDC__ +// Borland +# define BOOST_COMPILER_CONFIG "boost/config/compiler/borland.hpp" + +#elif defined(__ICL) || defined(__ICC) +// Intel +# define BOOST_COMPILER_CONFIG "boost/config/compiler/intel.hpp" + +#elif defined __MWERKS__ +// Metrowerks CodeWarrior +# define BOOST_COMPILER_CONFIG "boost/config/compiler/metrowerks.hpp" + +#elif defined __SUNPRO_CC +// Sun Workshop Compiler C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/sunpro_cc.hpp" + +#elif defined __HP_aCC +// HP aCC +# define BOOST_COMPILER_CONFIG "boost/config/compiler/hp_acc.hpp" + +#elif defined(__MRC__) || defined(__SC__) +// MPW MrCpp or SCpp +# define BOOST_COMPILER_CONFIG "boost/config/compiler/mpw.hpp" + +#elif defined(__IBMCPP__) +// IBM Visual Age +# define BOOST_COMPILER_CONFIG "boost/config/compiler/vacpp.hpp" + +# elif defined __COMO__ +// Comeau C++ +# define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp" + +#elif defined _MSC_VER +// Microsoft Visual C++ +// +// Must remain the last #elif since some other vendors (Metrowerks, for +// example) also #define _MSC_VER +# define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp" + +#elif defined (BOOST_ASSERT_CONFIG) +// this must come last - generate an error if we don't +// recognise the compiler: +# error "Unknown compiler - please configure and report the results to boost.org" + +#endif diff -uaNr yadex-1.5.2/boost/boost/config/select_platform_config.hpp yadex-1.6.0/boost/boost/config/select_platform_config.hpp --- yadex-1.5.2/boost/boost/config/select_platform_config.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/select_platform_config.hpp 2001-10-01 19:26:32.000000000 +0200 @@ -0,0 +1,62 @@ +// Boost compiler configuration selection header file + +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// locate which platform we are on and define BOOST_PLATFORM_CONFIG as needed. +// Note that we define the headers to include using "header_name" not +// in order to prevent macro expansion within the header +// name (for example "linux" is a macro on linux systems). + +#if defined(linux) || defined(__linux) || defined(__linux__) +// linux: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/linux.hpp" + +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +// BSD: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/bsd.hpp" + +#elif defined(sun) || defined(__sun) +// solaris: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/solaris.hpp" + +#elif defined(__sgi) +// SGI Irix: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/irix.hpp" + +#elif defined(__hpux) +// hp unix: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/hpux.hpp" + +#elif defined(__CYGWIN__) +// cygwin is not win32: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/cygwin.hpp" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +// win32: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/win32.hpp" + +#elif defined(__BEOS__) +// BeOS +# define BOOST_PLATFORM_CONFIG "boost/config/platform/beos.hpp" + +#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) +// MacOS +# define BOOST_PLATFORM_CONFIG "boost/config/platform/macos.hpp" + +#elif defined(__IBMCPP__) +// IBM +# define BOOST_PLATFORM_CONFIG "boost/config/platform/aix.hpp" + +#elif defined (BOOST_ASSERT_CONFIG) +// this must come last - generate an error if we don't +// recognise the platform: +# error "Unknown platform - please configure and report the results to boost.org" + +#endif + + diff -uaNr yadex-1.5.2/boost/boost/config/select_stdlib_config.hpp yadex-1.6.0/boost/boost/config/select_stdlib_config.hpp --- yadex-1.5.2/boost/boost/config/select_stdlib_config.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/select_stdlib_config.hpp 2001-10-01 19:26:32.000000000 +0200 @@ -0,0 +1,61 @@ +// Boost compiler configuration selection header file + +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed: + +// we need to include a std lib header here in order to detect which +// library is in use, use as it's about the smallest +// of the std lib headers - do not rely on this header being included - +// users can short-circuit this header if they know whose std lib +// they are using. + +#include + +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +// STLPort library; this _must_ come first, otherwise since +// STLport typically sits on top of some other library, we +// can end up detecting that first rather than STLport: +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp" + +#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) +// Rogue Wave library: +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/roguewave.hpp" + +#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) +// Dinkumware Library: +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/dinkumware.hpp" + +#elif defined(__GLIBCPP__) +// GNU libstdc++ 3 +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/libstdcpp3.hpp" + +#elif defined(__STL_CONFIG_H) +// generic SGI STL +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/sgi.hpp" + +#elif defined(__MSL_CPP__) +// MSL standard lib: +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/msl.hpp" + +#elif defined(__IBMCPP__) +// take the default VACPP std lib +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/vacpp.hpp" + +#elif defined(MSIPL_COMPILE_H) +// Modena C++ standard library +# define BOOST_STDLIB_CONFIG "boost/config/stdlib/modena.hpp" + +#elif defined (BOOST_ASSERT_CONFIG) +// this must come last - generate an error if we don't +// recognise the library: +# error "Unknown standard library - please configure and report the results to boost.org" + +#endif + + diff -uaNr yadex-1.5.2/boost/boost/config/stdlib/dinkumware.hpp yadex-1.6.0/boost/boost/config/stdlib/dinkumware.hpp --- yadex-1.5.2/boost/boost/config/stdlib/dinkumware.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/stdlib/dinkumware.hpp 2001-10-01 19:26:37.000000000 +0200 @@ -0,0 +1,71 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Dinkumware standard library config: + +#if !defined(_YVALS) && !defined(_CPPLIB_VER) +#include +#if !defined(_YVALS) && !defined(_CPPLIB_VER) +#error This is not the Dinkumware lib! +#endif +#endif + + +#if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306) + // full dinkumware 3.06 and above + // fully conforming provided the compiler supports it: +# if !(defined(_GLOBAL_USING) && (_GLOBAL_USING+0 > 0)) && !defined(_STD) // can be defined in yvals.h +# define BOOST_NO_STDC_NAMESPACE +# endif +# if !(defined(_HAS_MEMBER_TEMPLATES_REBIND) && (_HAS_MEMBER_TEMPLATES_REBIND+0 > 0)) +# define BOOST_NO_STD_ALLOCATOR +# endif +# if defined(_MSC_VER) && (_MSC_VER < 1300) + // if this lib version is set up for vc6 then there is no std::use_facet: +# define BOOST_NO_STD_USE_FACET +# define BOOST_HAS_TWO_ARG_USE_FACET +# endif +// 3.06 appears to have (non-sgi versions of) & , +// and no at all +#else +# define BOOST_MSVC_STD_ITERATOR 1 +# define BOOST_NO_STD_ITERATOR +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# define BOOST_NO_STD_ALLOCATOR +# define BOOST_NO_STDC_NAMESPACE +# define BOOST_NO_STD_USE_FACET +# define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN +# define BOOST_HAS_MACRO_USE_FACET +# ifndef _CPPLIB_VER + // Updated Dinkum library defines this, and provides + // its own min and max definitions. +# define BOOST_NO_STD_MIN_MAX +# undef min +# undef max +# endif +# ifndef NOMINMAX + // avoid spurious NOMINMAX redefinition warning +# define NOMINMAX +# endif +#endif + +#if defined(_MSC_VER) && (_MSC_VER <= 1200) + // if we're using a dinkum lib that's + // been configured for VC6 then there is + // no iterator traits (true even for icl) +# define BOOST_NO_STD_ITERATOR_TRAITS +#endif + +#ifdef _CPPLIB_VER +# define BOOST_STDLIB "Dinkumware standard library version " BOOST_STRINGIZE(_CPPLIB_VER) +#else +# define BOOST_STDLIB "Dinkumware standard library version 1.x" +#endif + + + + diff -uaNr yadex-1.5.2/boost/boost/config/stdlib/libstdcpp3.hpp yadex-1.6.0/boost/boost/config/stdlib/libstdcpp3.hpp --- yadex-1.5.2/boost/boost/config/stdlib/libstdcpp3.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/stdlib/libstdcpp3.hpp 2001-10-01 19:26:37.000000000 +0200 @@ -0,0 +1,20 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// config for libstdc++ v3 +// not much to go in here: + +#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCPP__) + +#ifndef _GLIBCPP_USE_WCHAR_T +# define BOOST_NO_CWCHAR +# define BOOST_NO_CWCTYPE +# define BOOST_NO_STD_WSTRING +#endif + + + diff -uaNr yadex-1.5.2/boost/boost/config/stdlib/modena.hpp yadex-1.6.0/boost/boost/config/stdlib/modena.hpp --- yadex-1.5.2/boost/boost/config/stdlib/modena.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/stdlib/modena.hpp 2001-10-01 19:26:37.000000000 +0200 @@ -0,0 +1,29 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Modena C++ standard library (comes with KAI C++) + +#if !defined(MSIPL_COMPILE_H) +# include +# if !defined(__MSIPL_COMPILE_H) +# error "This is not the Modena C++ library!" +# endif +#endif + +#ifndef MSIPL_NL_TYPES +#define BOOST_NO_STD_MESSAGES +#endif + +#ifndef MSIPL_WCHART +#define BOOST_NO_STD_WSTRING +#endif + +#define BOOST_STDLIB "Modena C++ standard library" + + + + diff -uaNr yadex-1.5.2/boost/boost/config/stdlib/msl.hpp yadex-1.6.0/boost/boost/config/stdlib/msl.hpp --- yadex-1.5.2/boost/boost/config/stdlib/msl.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/stdlib/msl.hpp 2001-10-01 19:26:37.000000000 +0200 @@ -0,0 +1,44 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Metrowerks standard library: + +#ifndef __MSL_CPP__ +# include +# ifndef __MSL_CPP__ +# error This is not the MSL standard library! +# endif +#endif + +#if __MSL_CPP__ >= 0x6000 // Pro 6 +# define BOOST_HAS_HASH +# define BOOST_STD_EXTENSION_NAMESPACE Metrowerks +#endif +#define BOOST_HAS_SLIST + +#if __MSL_CPP__ < 0x6209 +# define BOOST_NO_STD_MESSAGES +#endif + +// check C lib version for +#include + +#if defined(__MSL__) && (__MSL__ >= 0x5000) +# define BOOST_HAS_STDINT_H +# define BOOST_HAS_UNISTD_H +#endif + + +#define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) + + + + + + + + diff -uaNr yadex-1.5.2/boost/boost/config/stdlib/roguewave.hpp yadex-1.6.0/boost/boost/config/stdlib/roguewave.hpp --- yadex-1.5.2/boost/boost/config/stdlib/roguewave.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/stdlib/roguewave.hpp 2001-10-01 19:26:37.000000000 +0200 @@ -0,0 +1,106 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Rogue Wave std lib: + +#if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) +# include +# if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) +# error This is not the Rogue Wave standard library +# endif +#endif +// +// figure out a consistent version number: +// +#ifndef _RWSTD_VER +# define BOOST_RWSTD_VER 0x010000 +#elif _RWSTD_VER < 0x010000 +# define BOOST_RWSTD_VER (_RWSTD_VER << 8) +#else +# define BOOST_RWSTD_VER _RWSTD_VER +#endif + +#ifndef _RWSTD_VER +# define BOOST_STDLIB "Rogue Wave standard library version (Unknown version)" +#else +# define BOOST_STDLIB "Rogue Wave standard library version " BOOST_STRINGIZE(_RWSTD_VER) +#endif + +// +// Prior to version 2.2.0 the primary template for std::numeric_limits +// does not have compile time constants, even though specializations of that +// template do: +// +#if BOOST_RWSTD_VER < 0x020200 +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +#endif + +// +// No std::iterator if it can't figure out default template args: +// +#if defined(_RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || defined(RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || (BOOST_RWSTD_VER < 0x020000) +# define BOOST_NO_STD_ITERATOR +#endif + +// +// No iterator traits without partial specialization: +// +#if defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) || defined(RWSTD_NO_CLASS_PARTIAL_SPEC) +# define BOOST_NO_STD_ITERATOR_TRAITS +#endif + +// +// Prior to version 2.0, std::auto_ptr was buggy, and there were no +// new-style iostreams, and no conformant std::allocator: +// +#if (BOOST_RWSTD_VER < 0x020000) +# define BOOST_NO_AUTO_PTR +# define BOOST_NO_STRINGSTREAM +# define BOOST_NO_STD_ALLOCATOR +# define BOOST_NO_STD_LOCALE +#endif + +// +// No template iterator constructors without member template support: +// +#if defined(RWSTD_NO_MEMBER_TEMPLATES) || defined(_RWSTD_NO_MEMBER_TEMPLATES) +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +#endif + +// +// RW defines _RWSTD_ALLOCATOR if the allocator is conformant and in use +// (the or _HPACC_ part is a hack - the library seems to define _RWSTD_ALLOCATOR +// on HP aCC systems even though the allocator is in fact broken): +// +#if !defined(_RWSTD_ALLOCATOR) || defined(_HPACC_) || defined(__HP_aCC) +# define BOOST_NO_STD_ALLOCATOR +#endif + +// +// If we have a std::locale, we still may not have std::use_facet: +// +#if defined(_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE) && !defined(BOOST_NO_STD_LOCALE) +# define BOOST_NO_STD_USE_FACET +# define BOOST_HAS_TWO_ARG_USE_FACET +#endif + +// +// There's no std::distance prior to version 2, or without +// partial specialization support: +// +#if (BOOST_RWSTD_VER < 0x020000) || defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + #define BOOST_NO_STD_DISTANCE +#endif + +// +// Some versions of the rogue wave library don't have assignable +// OutputIterators: +// +#if BOOST_RWSTD_VER < 0x020100 +# define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN +#endif + diff -uaNr yadex-1.5.2/boost/boost/config/stdlib/sgi.hpp yadex-1.6.0/boost/boost/config/stdlib/sgi.hpp --- yadex-1.5.2/boost/boost/config/stdlib/sgi.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/stdlib/sgi.hpp 2001-10-01 19:26:37.000000000 +0200 @@ -0,0 +1,77 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// generic SGI STL: + +#if !defined(__STL_CONFIG_H) +# include +# if !defined(__STL_CONFIG_H) +# error "This is not the SGI STL!" +# endif +#endif + +// +// No std::iterator traits without partial specialisation: +// +#if !defined(__STL_CLASS_PARTIAL_SPECIALIZATION) +# define BOOST_NO_STD_ITERATOR_TRAITS +#endif + +// +// No std::stringstream with gcc < 3 +// +#if defined(__GNUC__) && (__GNUC__ < 3) && (__GNUC_MINOR__ < 95) && !defined(__STL_USE_NEW_IOSTREAMS) || defined(__APPLE_CC__) + // Note that we only set this for gnu C++ prior to 2.95 since the + // latest patches for that release do contain a minimal + // If you are running a 2.95 release prior to 2.95.3 then this will need + // setting, but there is no way to detect that automatically (other + // than by running the configure script). +# define BOOST_NO_STRINGSTREAM +#endif + +// +// Assume no std::locale without own iostreams (this may be an +// incorrect assumption in some cases): +// +#if !defined(__SGI_STL_OWN_IOSTREAMS) && !defined(__STL_USE_NEW_IOSTREAMS) +# define BOOST_NO_STD_LOCALE +#endif + +// +// No template iterator constructors, or std::allocator +// without member templates: +// +#if !defined(__STL_MEMBER_TEMPLATES) +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# define BOOST_NO_STD_ALLOCATOR +#endif + +// +// We always have SGI style hash_set, hash_map, and slist: +// +#define BOOST_HAS_HASH +#define BOOST_HAS_SLIST + +// +// If this is GNU libstdc++2, then no and no std::wstring: +// +#if (defined(__GNUC__) && (__GNUC__ < 3)) +# include +# if defined(__BASTRING__) +# define BOOST_NO_LIMITS +# define BOOST_NO_STD_WSTRING +# endif +#endif + +// +// There is no standard iterator unless we have namespace support: +// +#if !defined(__STL_USE_NAMESPACES) +# define BOOST_NO_STD_ITERATOR +#endif + +#define BOOST_STDLIB "SGI standard library" diff -uaNr yadex-1.5.2/boost/boost/config/stdlib/stlport.hpp yadex-1.6.0/boost/boost/config/stdlib/stlport.hpp --- yadex-1.5.2/boost/boost/config/stdlib/stlport.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/stdlib/stlport.hpp 2001-10-01 19:26:37.000000000 +0200 @@ -0,0 +1,105 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// STLPort standard library config: + +#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +# include +# if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +# error "This is not STLPort!" +# endif +#endif + +// +// __STL_STATIC_CONST_INIT_BUG implies BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +// for versions prior to 4.1(beta) +// +#if (defined(__STL_STATIC_CONST_INIT_BUG) || defined(_STLP_STATIC_CONST_INIT_BUG)) && (__SGI_STL_PORT <= 0x400) +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +#endif + +// +// If STLport thinks that there is no partial specialisation, then there is no +// std::iterator traits: +// +#if !(defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined(__STL_CLASS_PARTIAL_SPECIALIZATION)) +# define BOOST_NO_STD_ITERATOR_TRAITS +#endif + +// +// No new style iostreams on GCC without STLport's iostreams enabled: +// +#if (defined(__GNUC__) && (__GNUC__ < 3)) && !(defined(__SGI_STL_OWN_IOSTREAMS) || defined(_STLP_OWN_IOSTREAMS)) +# define BOOST_NO_STRINGSTREAM +#endif + +// +// No new iostreams implies no std::locale, and no std::stringstream: +// +#if defined(__STL_NO_IOSTREAMS) || defined(__STL_NO_NEW_IOSTREAMS) || defined(_STLP_NO_IOSTREAMS) || defined(_STLP_NO_NEW_IOSTREAMS) +# define BOOST_NO_STD_LOCALE +# define BOOST_NO_STRINGSTREAM +#endif + +// +// Without member template support enabled, their are no template +// iterate constructors, and no std::allocator: +// +#if !(defined(__STL_MEMBER_TEMPLATES) || defined(_STLP_MEMBER_TEMPLATES)) +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# define BOOST_NO_STD_ALLOCATOR +#endif + +#if !defined(_STLP_MEMBER_TEMPLATE_CLASSES) +# define BOOST_NO_STD_ALLOCATOR +#endif + +// +// We always have SGI style hash_set, hash_map, and slist: +// +#define BOOST_HAS_HASH +#define BOOST_HAS_SLIST + +// +// STLport does a good job of importing names into namespace std::, +// but doesn't always get them all, define BOOST_NO_STDC_NAMESPACE, since our +// workaround does not conflict with STLports: +// +#if defined(__STL_IMPORT_VENDOR_CSTD) || defined(__STL_USE_OWN_NAMESPACE) || defined(_STLP_IMPORT_VENDOR_CSTD) || defined(_STLP_USE_OWN_NAMESPACE) +# define BOOST_NO_STDC_NAMESPACE +#endif + +// +// std::reverse_iterate behaves like VC6's under some circumstances: +// +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) || defined (__STL_USE_OLD_HP_ITERATOR_QUERIES)\ + || (!defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) && !defined ( __STL_CLASS_PARTIAL_SPECIALIZATION )) +// disable this for now, it causes too many problems, we need a better +// fix for broken reverse iterators: +// # define BOOST_MSVC_STD_ITERATOR +#endif + +// +// std::use_facet may be non-standard, uses a class instead: +// +#if defined(__STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS) || defined(_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) +# define BOOST_NO_STD_USE_FACET +# define BOOST_HAS_STLP_USE_FACET +#endif + +// +// If STLport thinks there are no wide functions, etc. is not working. +// +#if defined(_STLP_NO_NATIVE_WIDE_FUNCTIONS) +# define BOOST_NO_CWCHAR +# define BOOST_NO_CWTYPE +#endif + + +#define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) + + diff -uaNr yadex-1.5.2/boost/boost/config/stdlib/vacpp.hpp yadex-1.6.0/boost/boost/config/stdlib/vacpp.hpp --- yadex-1.5.2/boost/boost/config/stdlib/vacpp.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/stdlib/vacpp.hpp 2001-10-01 19:26:37.000000000 +0200 @@ -0,0 +1,13 @@ +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +#define BOOST_HAS_MACRO_USE_FACET +#define BOOST_NO_STD_ALLOCATOR + +#define BOOST_STDLIB "Visual Age default standard library" + + diff -uaNr yadex-1.5.2/boost/boost/config/suffix.hpp yadex-1.6.0/boost/boost/config/suffix.hpp --- yadex-1.5.2/boost/boost/config/suffix.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/suffix.hpp 2001-10-01 19:26:32.000000000 +0200 @@ -0,0 +1,311 @@ +// Boost config.hpp configuration header file ------------------------------// + +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Boost config.hpp policy and rationale documentation has been moved to +// http://www.boost.org/libs/config +// +// This file is intended to be stable, and relatively unchanging. +// It should contain boilerplate code only - no compiler specific +// code unless it is unavoidable - no changes unless unavoidable. + +#ifndef BOOST_CONFIG_SUFFIX_HPP +#define BOOST_CONFIG_SUFFIX_HPP + +# ifndef BOOST_DECL +# define BOOST_DECL // default for compilers not needing this decoration. +# endif + +// +// Assume any extensions are in namespace std:: unless stated otherwise: +// +# ifndef BOOST_STD_EXTENSION_NAMESPACE +# define BOOST_STD_EXTENSION_NAMESPACE std +# endif + +// +// If cv-qualified specializations are not allowed, then neither are cv-void ones: +// +# if defined(BOOST_NO_CV_SPECIALIZATIONS) \ + && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) +# define BOOST_NO_CV_VOID_SPECIALIZATIONS +# endif + +// +// If there is no numeric_limits template, then it can't have any compile time +// constants either! +// +# if defined(BOOST_NO_LIMITS) \ + && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# endif + +// +// if member templates are supported then so is the +// VC6 subset of member templates: +// +# if !defined(BOOST_NO_MEMBER_TEMPLATES) \ + && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) +# define BOOST_MSVC6_MEMBER_TEMPLATES +# endif + +// +// Without partial specialization, std::iterator_traits can't work: +// +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_NO_STD_ITERATOR_TRAITS) +# define BOOST_NO_STD_ITERATOR_TRAITS +# endif + +// +// Without member template support, we can't have template constructors +// in the standard library either: +// +# if defined(BOOST_NO_MEMBER_TEMPLATES) \ + && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ + && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# endif + +// +// Without member template support, we can't have a conforming +// std::allocator template either: +// +# if defined(BOOST_NO_MEMBER_TEMPLATES) \ + && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ + && !defined(BOOST_NO_STD_ALLOCATOR) +# define BOOST_NO_STD_ALLOCATOR +# endif + +// +// We can't have a working std::use_facet if there is no std::locale: +// +# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET) +# define BOOST_NO_STD_USE_FACET +# endif + +// +// We can't have a std::messages facet if there is no std::locale: +// +# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES) +# define BOOST_NO_STD_MESSAGES +# endif + +// +// We can't have a if there is no : +// +# if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE) +# define BOOST_NO_CWCTYPE +# endif + +// +// We can't have a swprintf if there is no : +// +# if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF) +# define BOOST_NO_SWPRINTF +# endif + +// +// If the platform claims to be Unix, then it had better behave like Unix! +// +# if defined(unix) \ + || defined(__unix) \ + || defined(_XOPEN_SOURCE) \ + || defined(_POSIX_SOURCE) + +# ifndef BOOST_HAS_UNISTD_H +# define BOOST_HAS_UNISTD_H +# endif +# endif + +// +// If we have a then some options can be deduced from it: +// +# ifdef BOOST_HAS_UNISTD_H +# include +# endif + +// +// Turn on threading support if the compiler thinks that it's in +// multithreaded mode. We put this here because there are only a +// limited number of macros that identify this (if there's any missing +// from here then add to the appropriate compiler section): +// +#if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \ + || defined(_PTHREADS)) && !defined(BOOST_HAS_THREADS) +# define BOOST_HAS_THREADS +#endif + +// +// Turn threading support off if BOOST_DISABLE_THREADS is defined: +// +#if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS) +# undef BOOST_HAS_THREADS +#endif + +// +// Turn threading support off if we don't recognise the threading API: +// +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\ + && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS) +# undef BOOST_HAS_THREADS +#endif + +// +// If the compiler claims to be C99 conformant, then it had better +// have a : +// +# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) +# define BOOST_HAS_STDINT_H +# endif + +// +// Define BOOST_NO_SLIST and BOOST_NO_HASH if required. +// Note that this is for backwards compatibility only. +// +# ifndef BOOST_HAS_SLIST +# define BOOST_NO_SLIST +# endif + +# ifndef BOOST_HAS_HASH +# define BOOST_NO_HASH +# endif + +// BOOST_NO_STDC_NAMESPACE workaround --------------------------------------// +// Because std::size_t usage is so common, even in boost headers which do not +// otherwise use the C library, the workaround is included here so +// that ugly workaround code need not appear in many other boost headers. +// NOTE WELL: This is a workaround for non-conforming compilers; +// must still be #included in the usual places so that inclusion +// works as expected with standard conforming compilers. The resulting +// double inclusion of is harmless. + +# ifdef BOOST_NO_STDC_NAMESPACE +# include + namespace std { using ::ptrdiff_t; using ::size_t; } +# endif + +// BOOST_NO_STD_MIN_MAX workaround -----------------------------------------// + +# ifdef BOOST_NO_STD_MIN_MAX + +namespace std { + template + inline const _Tp& min(const _Tp& __a, const _Tp& __b) { + return __b < __a ? __b : __a; + } + template + inline const _Tp& max(const _Tp& __a, const _Tp& __b) { + return __a < __b ? __b : __a; + } +# ifdef BOOST_MSVC + inline long min(long __a, long __b) { + return __b < __a ? __b : __a; + } + inline long max(long __a, long __b) { + return __a < __b ? __b : __a; + } +# endif +} + +# endif + +// BOOST_STATIC_CONSTANT workaround --------------------------------------- // +// On compilers which don't allow in-class initialization of static integral +// constant members, we must use enums as a workaround if we want the constants +// to be available at compile-time. This macro gives us a convenient way to +// declare such constants. + +# ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment } +# else +# define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment +# endif + +// BOOST_USE_FACET workaround ----------------------------------------------// +// When the standard library does not have a conforming std::use_facet there +// are various workarounds available, but they differ from library to library. +// This macro provides a consistent way to access a locale's facets. +// Usage: +// replace +// std::use_facet(loc); +// with +// BOOST_USE_FACET(Type, loc); +// Note do not add a std:: prefix to the front of BOOST_USE_FACET! + +#if defined(BOOST_NO_STD_USE_FACET) +# ifdef BOOST_HAS_TWO_ARG_USE_FACET +# define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast(0)) +# elif defined(BOOST_HAS_MACRO_USE_FACET) +# define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type) +# elif defined(BOOST_HAS_STLP_USE_FACET) +# define BOOST_USE_FACET(Type, loc) (*std::_Use_facet(loc)) +# endif +#else +# define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc) +#endif + +// BOOST_NESTED_TEMPLATE workaround ------------------------------------------// +// Member templates are supported by some compilers even though they can't use +// the A::template member syntax, as a workaround replace: +// +// typedef typename A::template rebind binder; +// +// with: +// +// typedef typename A::BOOST_NESTED_TEMPLATE rebind binder; + +#ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD +# define BOOST_NESTED_TEMPLATE template +#else +# define BOOST_NESTED_TEMPLATE +#endif + +// ---------------------------------------------------------------------------// + +// +// Helper macro BOOST_STRINGIZE: +// Converts the parameter X to a string after macro replacement +// on X has been performed. +// +#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) +#define BOOST_DO_STRINGIZE(X) #X + +// +// Helper macro BOOST_JOIN: +// The following piece of macro magic joins the two +// arguments together, even when one of the arguments is +// itself a macro (see 16.3.1 in C++ standard). The key +// is that macro expansion of macro arguments does not +// occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN. +// +#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y ) +#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) +#define BOOST_DO_JOIN2( X, Y ) X##Y + +// +// Set some default values for compiler/library/platform names. +// These are for debugging config setup only: +// +# ifndef BOOST_COMPILER +# define BOOST_COMPILER "Unknown ISO C++ Compiler" +# endif +# ifndef BOOST_STDLIB +# define BOOST_STDLIB "Unknown ISO standard library" +# endif +# ifndef BOOST_PLATFORM +# if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \ + || defined(_POSIX_SOURCE) +# define BOOST_PLATFORM "Generic Unix" +# else +# define BOOST_PLATFORM "Unknown" +# endif +# endif + +#endif + diff -uaNr yadex-1.5.2/boost/boost/config/user.hpp yadex-1.6.0/boost/boost/config/user.hpp --- yadex-1.5.2/boost/boost/config/user.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config/user.hpp 2001-10-01 19:26:32.000000000 +0200 @@ -0,0 +1,58 @@ +// (C) Copyright Boost.org 2001. +// Do not check in modified versions of this file, +// This file may be customized by the end user, but not by boost. + +// +// Use this file to define a site and compiler specific +// configuration policy: +// + +// define this to locate a compiler config file: +// #define BOOST_COMPILER_CONFIG + +// define this to locate a stdlib config file: +// #define BOOST_STDLIB_CONFIG + +// define this to locate a platform config file: +// #define BOOST_PLATFORM_CONFIG + +// define this to disable compiler config, +// use if your compiler config has nothing to set: +// #define BOOST_NO_COMPILER_CONFIG + +// define this to disable stdlib config, +// use if your stdlib config has nothing to set: +// #define BOOST_NO_STDLIB_CONFIG + +// define this to disable platform config, +// use if your platform config has nothing to set: +// #define BOOST_NO_PLATFORM_CONFIG + +// define this to disable all config options, +// excluding the user config. Use if your +// setup is fully ISO compliant, and has no +// useful extensions, or for autoconf generated +// setups: +// #define BOOST_NO_CONFIG + +// define this to make the config "optimistic" +// about unknown compiler versions. Normally +// unknown compiler versions are assumed to have +// all the defects of the last known version, however +// setting this flag, causes the config to assume +// that unknown compiler versions are fully conformant +// with the standard: +// #define BOOST_STRICT_CONFIG + +// define this to cause the config to halt compilation +// with an #error if it encounters anything unknown -- +// either an unknown compiler version or an unknown +// compiler/platform/library: +// #define BOOST_ASSERT_CONFIG + + +// define if you want to disable threading support, even +// when available: +// #define BOOST_DISABLE_THREADS + + diff -uaNr yadex-1.5.2/boost/boost/config.hpp yadex-1.6.0/boost/boost/config.hpp --- yadex-1.5.2/boost/boost/config.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/config.hpp 2001-10-01 19:25:36.000000000 +0200 @@ -0,0 +1,69 @@ +// Boost config.hpp configuration header file ------------------------------// + +// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version. + +// Boost config.hpp policy and rationale documentation has been moved to +// http://www.boost.org/libs/config +// +// CAUTION: This file is intended to be completely stable - +// DO NOT MODIFY THIS FILE! +// + +#ifndef BOOST_CONFIG_HPP +#define BOOST_CONFIG_HPP + +// if we don't have a user config, then use the default location: +#if !defined(BOOST_USER_CONFIG) && !defined(BOOST_NO_USER_CONFIG) +# define BOOST_USER_CONFIG +#endif +// include it first: +#ifdef BOOST_USER_CONFIG +# include BOOST_USER_CONFIG +#endif + +// if we don't have a compiler config set, try and find one: +#if !defined(BOOST_COMPILER_CONFIG) && !defined(BOOST_NO_COMPILER_CONFIG) && !defined(BOOST_NO_CONFIG) +# include +#endif +// if we don't have a std library config set, try and find one: +#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) +# include +#endif +// if we don't have a platform config set, try and find one: +#if !defined(BOOST_PLATFORM_CONFIG) && !defined(BOOST_NO_PLATFORM_CONFIG) && !defined(BOOST_NO_CONFIG) +# include +#endif + + +// if we have a compiler config, include it now: +#ifdef BOOST_COMPILER_CONFIG +# include BOOST_COMPILER_CONFIG +#endif +// if we have a std library config, include it now: +#ifdef BOOST_STDLIB_CONFIG +# include BOOST_STDLIB_CONFIG +#endif +// if we have a platform config, include it now: +#ifdef BOOST_PLATFORM_CONFIG +# include BOOST_PLATFORM_CONFIG +#endif + +// get config suffix code: +#include + +#endif // BOOST_CONFIG_HPP + + + + + + + + + + diff -uaNr yadex-1.5.2/boost/boost/smart_ptr.hpp yadex-1.6.0/boost/boost/smart_ptr.hpp --- yadex-1.5.2/boost/boost/smart_ptr.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/smart_ptr.hpp 2001-10-01 19:25:39.000000000 +0200 @@ -0,0 +1,402 @@ +// Boost smart_ptr.hpp header file -----------------------------------------// + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. Permission to copy, +// use, modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided "as is" +// without express or implied warranty, and with no claim as to its +// suitability for any purpose. + +// See http://www.boost.org for most recent version including documentation. + +// Revision History +// 6 Jul 01 Reorder shared_ptr code so VC++ 6 member templates work, allowing +// polymorphic pointers to now work with that compiler (Gary Powell) +// 21 May 01 Require complete type where incomplete type is unsafe. +// (suggested by Vladimir Prus) +// 21 May 01 operator= fails if operand transitively owned by *this, as in a +// linked list (report by Ken Johnson, fix by Beman Dawes) +// 21 Jan 01 Suppress some useless warnings with MSVC (David Abrahams) +// 19 Oct 00 Make shared_ptr ctor from auto_ptr explicit. (Robert Vugts) +// 24 Jul 00 Change throw() to // never throws. See lib guidelines +// Exception-specification rationale. (Beman Dawes) +// 22 Jun 00 Remove #if continuations to fix GCC 2.95.2 problem (Beman Dawes) +// 1 Feb 00 Additional shared_ptr BOOST_NO_MEMBER_TEMPLATES workarounds +// (Dave Abrahams) +// 31 Dec 99 Condition tightened for no member template friend workaround +// (Dave Abrahams) +// 30 Dec 99 Moved BOOST_NMEMBER_TEMPLATES compatibility code to config.hpp +// (Dave Abrahams) +// 30 Nov 99 added operator ==, operator !=, and std::swap and std::less +// specializations for shared types (Darin Adler) +// 11 Oct 99 replaced op[](int) with op[](std::size_t) (Ed Brey, Valentin +// Bonnard), added shared_ptr workaround for no member template +// friends (Matthew Langston) +// 25 Sep 99 added shared_ptr::swap and shared_array::swap (Luis Coelho). +// 20 Jul 99 changed name to smart_ptr.hpp, #include , +// #include and use boost::noncopyable +// 17 May 99 remove scoped_array and shared_array operator*() as +// unnecessary (Beman Dawes) +// 14 May 99 reorder code so no effects when bad_alloc thrown (Abrahams/Dawes) +// 13 May 99 remove certain throw() specifiers to avoid generated try/catch +// code cost (Beman Dawes) +// 11 May 99 get() added, conversion to T* placed in macro guard (Valentin +// Bonnard, Dave Abrahams, and others argued for elimination +// of the automatic conversion) +// 28 Apr 99 #include fix (Valentin Bonnard) +// 28 Apr 99 rename transfer() to share() for clarity (Dave Abrahams) +// 28 Apr 99 remove unsafe shared_array template conversions(Valentin Bonnard) +// 28 Apr 99 p(r) changed to p(r.px) for clarity (Dave Abrahams) +// 21 Apr 99 reset() self assignment fix (Valentin Bonnard) +// 21 Apr 99 dispose() provided to improve clarity (Valentin Bonnard) +// 27 Apr 99 leak when new throws fixes (Dave Abrahams) +// 21 Oct 98 initial Version (Greg Colvin/Beman Dawes) + +#ifndef BOOST_SMART_PTR_HPP +#define BOOST_SMART_PTR_HPP + +#include // for broken compiler workarounds +#include // for std::size_t +#include // for std::auto_ptr +#include // for std::swap +#include // for boost::noncopyable, checked_delete, checked_array_delete +#include // for std::less +#include // for BOOST_STATIC_ASSERT + +#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash +# pragma warning(push) +# pragma warning(disable:4284) // return type for 'identifier::operator->' is not a UDT or reference to a UDT. Will produce errors if applied using infix notation +#endif + +namespace boost { + +// scoped_ptr --------------------------------------------------------------// + +// scoped_ptr mimics a built-in pointer except that it guarantees deletion +// of the object pointed to, either on destruction of the scoped_ptr or via +// an explicit reset(). scoped_ptr is a simple solution for simple needs; +// see shared_ptr (below) or std::auto_ptr if your needs are more complex. + +template class scoped_ptr : noncopyable { + + T* ptr; + + public: + typedef T element_type; + + explicit scoped_ptr( T* p=0 ) : ptr(p) {} // never throws + ~scoped_ptr() { checked_delete(ptr); } + void reset( T* p=0 ) { if ( ptr != p ) { checked_delete(ptr); ptr = p; } } + T& operator*() const { return *ptr; } // never throws + T* operator->() const { return ptr; } // never throws + T* get() const { return ptr; } // never throws +#ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return ptr; } // never throws +#endif + }; // scoped_ptr + +// scoped_array ------------------------------------------------------------// + +// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to +// is guaranteed, either on destruction of the scoped_array or via an explicit +// reset(). See shared_array or std::vector if your needs are more complex. + +template class scoped_array : noncopyable { + + T* ptr; + + public: + typedef T element_type; + + explicit scoped_array( T* p=0 ) : ptr(p) {} // never throws + ~scoped_array() { checked_array_delete(ptr); } + + void reset( T* p=0 ) { if ( ptr != p ) + {checked_array_delete(ptr); ptr=p;} } + + T* get() const { return ptr; } // never throws +#ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return ptr; } // never throws +#else + T& operator[](std::size_t i) const { return ptr[i]; } // never throws +#endif + }; // scoped_array + +// shared_ptr --------------------------------------------------------------// + +// An enhanced relative of scoped_ptr with reference counted copy semantics. +// The object pointed to is deleted when the last shared_ptr pointing to it +// is destroyed or reset. + +template class shared_ptr { + public: + typedef T element_type; + + explicit shared_ptr(T* p =0) : px(p) { + try { pn = new long(1); } // fix: prevent leak if new throws + catch (...) { checked_delete(p); throw; } + } + + ~shared_ptr() { dispose(); } + +#if !defined( BOOST_NO_MEMBER_TEMPLATES ) || defined (BOOST_MSVC6_MEMBER_TEMPLATES) + template + shared_ptr(const shared_ptr& r) : px(r.px) { // never throws + ++*(pn = r.pn); + } +#ifndef BOOST_NO_AUTO_PTR + template + explicit shared_ptr(std::auto_ptr& r) { + pn = new long(1); // may throw + px = r.release(); // fix: moved here to stop leak if new throws + } +#endif + + template + shared_ptr& operator=(const shared_ptr& r) { + share(r.px,r.pn); + return *this; + } + +#ifndef BOOST_NO_AUTO_PTR + template + shared_ptr& operator=(std::auto_ptr& r) { + // code choice driven by guarantee of "no effect if new throws" + if (*pn == 1) { checked_delete(px); } + else { // allocate new reference counter + long * tmp = new long(1); // may throw + --*pn; // only decrement once danger of new throwing is past + pn = tmp; + } // allocate new reference counter + px = r.release(); // fix: moved here so doesn't leak if new throws + return *this; + } +#endif +#else +#ifndef BOOST_NO_AUTO_PTR + explicit shared_ptr(std::auto_ptr& r) { + pn = new long(1); // may throw + px = r.release(); // fix: moved here to stop leak if new throws + } + + shared_ptr& operator=(std::auto_ptr& r) { + // code choice driven by guarantee of "no effect if new throws" + if (*pn == 1) { checked_delete(px); } + else { // allocate new reference counter + long * tmp = new long(1); // may throw + --*pn; // only decrement once danger of new throwing is past + pn = tmp; + } // allocate new reference counter + px = r.release(); // fix: moved here so doesn't leak if new throws + return *this; + } +#endif +#endif + + // The assignment operator and the copy constructor must come after + // the templated versions for MSVC6 to work. (Gary Powell) + shared_ptr(const shared_ptr& r) : px(r.px) { ++*(pn = r.pn); } // never throws + + shared_ptr& operator=(const shared_ptr& r) { + share(r.px,r.pn); + return *this; + } + + void reset(T* p=0) { + if ( px == p ) return; // fix: self-assignment safe + if (--*pn == 0) { checked_delete(px); } + else { // allocate new reference counter + try { pn = new long; } // fix: prevent leak if new throws + catch (...) { + ++*pn; // undo effect of --*pn above to meet effects guarantee + checked_delete(p); + throw; + } // catch + } // allocate new reference counter + *pn = 1; + px = p; + } // reset + + T& operator*() const { return *px; } // never throws + T* operator->() const { return px; } // never throws + T* get() const { return px; } // never throws + #ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return px; } // never throws + #endif + + long use_count() const { return *pn; } // never throws + bool unique() const { return *pn == 1; } // never throws + + void swap(shared_ptr& other) // never throws + { std::swap(px,other.px); std::swap(pn,other.pn); } + +// Tasteless as this may seem, making all members public allows member templates +// to work in the absence of member template friends. (Matthew Langston) +// Don't split this line into two; that causes problems for some GCC 2.95.2 builds +#if ( defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) ) || !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) + private: +#endif + + T* px; // contained pointer + long* pn; // ptr to reference counter + +// Don't split this line into two; that causes problems for some GCC 2.95.2 builds +#if !defined( BOOST_NO_MEMBER_TEMPLATES ) && !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) + template friend class shared_ptr; +#endif + + void dispose() { if (--*pn == 0) { checked_delete(px); delete pn; } } + + void share(T* rpx, long* rpn) { + if (pn != rpn) { // Q: why not px != rpx? A: fails when both == 0 + ++*rpn; // done before dispose() in case rpn transitively + // dependent on *this (bug reported by Ken Johnson) + dispose(); + px = rpx; + pn = rpn; + } + } // share +}; // shared_ptr + +template + inline bool operator==(const shared_ptr& a, const shared_ptr& b) + { return a.get() == b.get(); } + +template + inline bool operator!=(const shared_ptr& a, const shared_ptr& b) + { return a.get() != b.get(); } + +// shared_array ------------------------------------------------------------// + +// shared_array extends shared_ptr to arrays. +// The array pointed to is deleted when the last shared_array pointing to it +// is destroyed or reset. + +template class shared_array { + public: + typedef T element_type; + + explicit shared_array(T* p =0) : px(p) { + try { pn = new long(1); } // fix: prevent leak if new throws + catch (...) { checked_array_delete(p); throw; } + } + + shared_array(const shared_array& r) : px(r.px) // never throws + { ++*(pn = r.pn); } + + ~shared_array() { dispose(); } + + shared_array& operator=(const shared_array& r) { + if (pn != r.pn) { // Q: why not px != r.px? A: fails when both px == 0 + ++*r.pn; // done before dispose() in case r.pn transitively + // dependent on *this (bug reported by Ken Johnson) + dispose(); + px = r.px; + pn = r.pn; + } + return *this; + } // operator= + + void reset(T* p=0) { + if ( px == p ) return; // fix: self-assignment safe + if (--*pn == 0) { checked_array_delete(px); } + else { // allocate new reference counter + try { pn = new long; } // fix: prevent leak if new throws + catch (...) { + ++*pn; // undo effect of --*pn above to meet effects guarantee + checked_array_delete(p); + throw; + } // catch + } // allocate new reference counter + *pn = 1; + px = p; + } // reset + + T* get() const { return px; } // never throws + #ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return px; } // never throws + #else + T& operator[](std::size_t i) const { return px[i]; } // never throws + #endif + + long use_count() const { return *pn; } // never throws + bool unique() const { return *pn == 1; } // never throws + + void swap(shared_array& other) // never throws + { std::swap(px,other.px); std::swap(pn,other.pn); } + + private: + + T* px; // contained pointer + long* pn; // ptr to reference counter + + void dispose() { if (--*pn == 0) { checked_array_delete(px); delete pn; } } + +}; // shared_array + +template + inline bool operator==(const shared_array& a, const shared_array& b) + { return a.get() == b.get(); } + +template + inline bool operator!=(const shared_array& a, const shared_array& b) + { return a.get() != b.get(); } + +} // namespace boost + +// specializations for things in namespace std -----------------------------// + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +namespace std { + +// Specialize std::swap to use the fast, non-throwing swap that's provided +// as a member function instead of using the default algorithm which creates +// a temporary and uses assignment. + +template + inline void swap(boost::shared_ptr& a, boost::shared_ptr& b) + { a.swap(b); } + +template + inline void swap(boost::shared_array& a, boost::shared_array& b) + { a.swap(b); } + +// Specialize std::less so we can use shared pointers and arrays as keys in +// associative collections. + +// It's still a controversial question whether this is better than supplying +// a full range of comparison operators (<, >, <=, >=). + +template + struct less< boost::shared_ptr > + : binary_function, boost::shared_ptr, bool> + { + bool operator()(const boost::shared_ptr& a, + const boost::shared_ptr& b) const + { return less()(a.get(),b.get()); } + }; + +template + struct less< boost::shared_array > + : binary_function, boost::shared_array, bool> + { + bool operator()(const boost::shared_array& a, + const boost::shared_array& b) const + { return less()(a.get(),b.get()); } + }; + +} // namespace std + +#endif // ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // BOOST_SMART_PTR_HPP + + diff -uaNr yadex-1.5.2/boost/boost/static_assert.hpp yadex-1.6.0/boost/boost/static_assert.hpp --- yadex-1.5.2/boost/boost/static_assert.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/static_assert.hpp 2001-10-01 19:25:40.000000000 +0200 @@ -0,0 +1,86 @@ +// (C) Copyright John Maddock 2000. +// Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// See http://www.boost.org for most recent version including documentation. + +/* + Revision history: + 02 August 2000 + Initial version. +*/ + +#ifndef BOOST_STATIC_ASSERT_HPP +#define BOOST_STATIC_ASSERT_HPP + +#include + +#ifdef __BORLANDC__ +// +// workaround for buggy integral-constant expression support: +#define BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS +#endif + +namespace boost{ + +// HP aCC cannot deal with missing names for template value parameters +template struct STATIC_ASSERTION_FAILURE; + +template <> struct STATIC_ASSERTION_FAILURE{}; + +// HP aCC cannot deal with missing names for template value parameters +template struct static_assert_test{}; + +} + +// +// Implicit instantiation requires that all member declarations be +// instantiated, but that the definitions are *not* instantiated. +// +// It's not particularly clear how this applies to enum's or typedefs; +// both are described as declarations [7.1.3] and [7.2] in the standard, +// however some compilers use "delayed evaluation" of one or more of +// these when implicitly instantiating templates. We use typedef declarations +// by default, but try defining BOOST_USE_ENUM_STATIC_ASSERT if the enum +// version gets better results from your compiler... +// +// Implementation: +// Both of these versions rely on sizeof(incomplete_type) generating an error +// message containing the name of the incomplete type. We use +// "STATIC_ASSERTION_FAILURE" as the type name here to generate +// an eye catching error message. The result of the sizeof expression is either +// used as an enum initialiser, or as a template argument depending which version +// is in use... +// Note that the argument to the assert is explicitly cast to bool using old- +// style casts: too many compilers currently have problems with static_cast +// when used inside integral constant expressions. +// +#if !defined(BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS) && !defined(__MWERKS__) +#ifndef BOOST_MSVC +#define BOOST_STATIC_ASSERT( B ) \ + typedef ::boost::static_assert_test<\ + sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\ + BOOST_JOIN(boost_static_assert_typedef_, __LINE__) +#else +// __LINE__ macro broken when -ZI is used see Q199057 +// fortunately MSVC ignores duplicate typedef's. +#define BOOST_STATIC_ASSERT( B ) \ + typedef ::boost::static_assert_test<\ + sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)\ + > boost_static_assert_typedef_ +#endif +#else +// alternative enum based implementation: +#define BOOST_STATIC_ASSERT( B ) \ + enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \ + = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) } +#endif + + +#endif // BOOST_STATIC_ASSERT_HPP + + + + diff -uaNr yadex-1.5.2/boost/boost/utility/base_from_member.hpp yadex-1.6.0/boost/boost/utility/base_from_member.hpp --- yadex-1.5.2/boost/boost/utility/base_from_member.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/utility/base_from_member.hpp 2001-10-01 19:26:31.000000000 +0200 @@ -0,0 +1,59 @@ +// boost utility/base_from_member.hpp header file --------------------------// + +// (C) Copyright Daryle Walker 2001. Permission to copy, use, modify, sell +// and distribute this software is granted provided this copyright +// notice appears in all copies. This software is provided "as is" without +// express or implied warranty, and with no claim as to its suitability for +// any purpose. + +// See http://www.boost.org for most recent version including documentation. + +#ifndef BOOST_UTILITY_BASE_FROM_MEMBER_HPP +#define BOOST_UTILITY_BASE_FROM_MEMBER_HPP + +#include // required for parameter defaults + + +namespace boost +{ + +// Base-from-member class template -----------------------------------------// + +// Helper to initialize a base object so a derived class can use this +// object in the initialization of another base class. Used by +// Dietmar Kuehl from ideas by Ron Klatcho to solve the problem of a +// base class needing to be initialized by a member. + +// Contributed by Daryle Walker + +template < typename MemberType, int UniqueID > +class base_from_member +{ +protected: + MemberType member; + + explicit base_from_member() + : member() + {} + + template< typename T1 > + explicit base_from_member( T1 x1 ) + : member( x1 ) + {} + + template< typename T1, typename T2 > + base_from_member( T1 x1, T2 x2 ) + : member( x1, x2 ) + {} + + template< typename T1, typename T2, typename T3 > + base_from_member( T1 x1, T2 x2, T3 x3 ) + : member( x1, x2, x3 ) + {} + +}; // boost::base_from_member + +} // namespace boost + + +#endif // BOOST_UTILITY_BASE_FROM_MEMBER_HPP diff -uaNr yadex-1.5.2/boost/boost/utility.hpp yadex-1.6.0/boost/boost/utility.hpp --- yadex-1.5.2/boost/boost/utility.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/utility.hpp 2001-10-01 19:25:40.000000000 +0200 @@ -0,0 +1,86 @@ +// boost utility.hpp header file -------------------------------------------// + +// (C) Copyright boost.org 1999. Permission to copy, use, modify, sell +// and distribute this software is granted provided this copyright +// notice appears in all copies. This software is provided "as is" without +// express or implied warranty, and with no claim as to its suitability for +// any purpose. + +// See http://www.boost.org for most recent version including documentation. + +// Classes appear in alphabetical order + +#ifndef BOOST_UTILITY_HPP +#define BOOST_UTILITY_HPP + +#include // broken compiler workarounds +#include + +// certain headers are part of the interface +#include + +#include // for size_t +#include // for std::pair + +namespace boost +{ +// checked_delete() and checked_array_delete() -----------------------------// + + // verify that types are complete for increased safety + + template< typename T > + inline void checked_delete(T * x) + { + BOOST_STATIC_ASSERT( sizeof(T) != 0 ); // assert type complete at point + // of instantiation + delete x; + } + + template< typename T > + inline void checked_array_delete(T * x) + { + BOOST_STATIC_ASSERT( sizeof(T) != 0 ); // assert type complete at point + // of instantiation + delete [] x; + } + +// next() and prior() template functions -----------------------------------// + + // Helper functions for classes like bidirectional iterators not supporting + // operator+ and operator-. + // + // Usage: + // const std::list::iterator p = get_some_iterator(); + // const std::list::iterator prev = boost::prior(p); + + // Contributed by Dave Abrahams + + template + inline T next(T x) { return ++x; } + + template + inline T prior(T x) { return --x; } + + +// class noncopyable -------------------------------------------------------// + + // Private copy constructor and copy assignment ensure classes derived from + // class noncopyable cannot be copied. + + // Contributed by Dave Abrahams + + class noncopyable + { + protected: + noncopyable(){} + ~noncopyable(){} + private: // emphasize the following members are private + noncopyable( const noncopyable& ); + const noncopyable& operator=( const noncopyable& ); + }; // noncopyable + + +} // namespace boost + +#endif // BOOST_UTILITY_HPP + diff -uaNr yadex-1.5.2/boost/boost/utility_fwd.hpp yadex-1.6.0/boost/boost/utility_fwd.hpp --- yadex-1.5.2/boost/boost/utility_fwd.hpp 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/boost/boost/utility_fwd.hpp 2001-10-01 19:25:41.000000000 +0200 @@ -0,0 +1,38 @@ +// Boost utility_fwd.hpp header file ---------------------------------------// + +// (C) Copyright boost.org 2001. Permission to copy, use, modify, sell +// and distribute this software is granted provided this copyright +// notice appears in all copies. This software is provided "as is" without +// express or implied warranty, and with no claim as to its suitability for +// any purpose. + +// See http://www.boost.org for most recent version including documentation. + +#ifndef BOOST_UTILITY_FWD_HPP +#define BOOST_UTILITY_FWD_HPP + + +namespace boost +{ + + +// From -------------------------------// + +template < typename MemberType, int UniqueID = 0 > + class base_from_member; + + +// From ------------------------------------------------// + +class noncopyable; + +template < class A, class B > + class tied; + +// Also has a few function templates + + +} // namespace boost + + +#endif // BOOST_UTILITY_FWD_HPP diff -uaNr yadex-1.5.2/bsp-2.3/bsp.c yadex-1.6.0/bsp-2.3/bsp.c --- yadex-1.5.2/bsp-2.3/bsp.c 2001-06-30 23:34:36.000000000 +0200 +++ yadex-1.6.0/bsp-2.3/bsp.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,923 +0,0 @@ -/*- BSP.C -------------------------------------------------------------------* - - Node builder for DOOM levels (c) 1998 Colin Reed, version 2.3 (dos extended) - - Performance increased 200% over 1.2x - - Many thanks to Mark Harrison for finding a bug in 1.1 which caused some - texture align problems when a flipped SEG was split. - - Credit to:- - - Raphael Quinet (A very small amount of code has been borrowed from DEU). - - Matt Fell for the doom specs. - - Lee Killough for performance tuning, support for multilevel wads, special - effects, and wads with lumps besides levels. - - Also, the original idea for some of the techniques where also taken from the - comment at the bottom of OBJECTS.C in DEU, and the doc by Matt Fell about - the nodes. - - Use this code for your own editors, but please credit me. - -*---------------------------------------------------------------------------*/ - -#include "bsp.h" -#include "structs.h" - -/*- Global Vars ------------------------------------------------------------*/ - -static FILE *outfile; -static char *testwad; -static char *outwad; - -static struct directory *direc = NULL; - -static struct Thing *things; -static long num_things = 0; - -static struct Vertex *vertices; -static long num_verts = 0; - -static struct LineDef *linedefs; -static long num_lines = 0; - -static struct SideDef *sidedefs; -static long num_sides = 0; - -static struct Sector *sectors; -static long num_sects = 0; - -static struct SSector *ssectors; -static long num_ssectors = 0; - -static struct Pseg *psegs = NULL; -static long num_psegs = 0; - -static struct Pnode *pnodes = NULL; -static long num_pnodes = 0; -static long pnode_indx = 0; -static long num_nodes = 0; - -static struct Block blockhead; -static short int *blockptrs; -static short int *blocklists=NULL; -static long blockptrs_size; - -unsigned char *SectorHits; - -static short lminx; -static short lmaxx; -static short lminy; -static short lmaxy; - -static short mapminx; -static short mapmaxx; -static short mapminy; -static short mapmaxy; - -static int show_progress = 1; -static unsigned char pcnt; - -static struct Seg *PickNode_traditional(struct Seg *); -static struct Seg *PickNode_visplane(struct Seg *); -static struct Seg *(*PickNode)(struct Seg *)=PickNode_traditional; -static int visplane,visplane_warning,mark_visplanes,threshold=128; -static int noreject; - -static struct lumplist { - struct lumplist *next; - struct directory *dir; - void *data; - char islevel; -} *lumplist,*current_level; - -static char current_level_name[9]; - -static struct wad_header wad; - -/*- Prototypes -------------------------------------------------------------*/ - -static void OpenWadFile(char *); -static struct lumplist *FindDir(const char *); -static void GetThings(void); -static void GetVertexes(void); -static void GetLinedefs(void); -static void GetSidedefs(void); -static void GetSectors(void); -static void FindLimits(struct Seg *); - -static struct Seg *CreateSegs(); - -static struct Node *CreateNode(struct Seg *); -static int IsItConvex(const struct Seg *); -static void DelSegs(struct Seg *); - -static void ReverseNodes(struct Node *); -static long CreateBlockmap(void); - -static void progress(void); -static int IsLineDefInside(int, int, int, int, int); -static int CreateSSector(struct Seg *); - -/*--------------------------------------------------------------------------*/ - -static void progress() -{ - if(show_progress) - if(!((++pcnt)&31)) - fprintf(stderr,"%c\b","/-\\|"[((pcnt)>>5)&3]); -} - -/*--------------------------------------------------------------------------*/ -/* Find limits from a list of segs, does this by stepping through the segs*/ -/* and comparing the vertices at both ends.*/ -/*--------------------------------------------------------------------------*/ - -static void FindLimits(struct Seg *ts) -{ - int minx=INT_MAX,miny=INT_MAX,maxx=INT_MIN,maxy=INT_MIN; - int fv,tv; - - for(;;) { - fv = ts->start; - tv = ts->end; -/* printf("%d : %d,%d\n",n,vertices[n].x,vertices[n].y);*/ - if(vertices[fv].x < minx) minx = vertices[fv].x; - if(vertices[fv].x > maxx) maxx = vertices[fv].x; - if(vertices[fv].y < miny) miny = vertices[fv].y; - if(vertices[fv].y > maxy) maxy = vertices[fv].y; - if(vertices[tv].x < minx) minx = vertices[tv].x; - if(vertices[tv].x > maxx) maxx = vertices[tv].x; - if(vertices[tv].y < miny) miny = vertices[tv].y; - if(vertices[tv].y > maxy) maxy = vertices[tv].y; - if(ts->next == NULL) break; - ts = ts->next; - } - lminx = minx; - lmaxx = maxx; - lminy = miny; - lmaxy = maxy; -} - - -/*--------------------------------------------------------------------------*/ -#include "funcs.c" -#include "picknode.c" -#include "makenode.c" - - -static struct Seg *add_seg(struct Seg *cs, int n, int fv, int tv, - struct Seg **fs, struct SideDef *sd) -{ - struct Seg *ts = GetMemory( sizeof( struct Seg)); /* get mem for Seg*/ - cs = cs ? (cs->next = ts) : (*fs = ts); - cs->next = NULL; - cs->start = fv; - cs->end = tv; - cs->pdx = (long) (cs->pex = vertices[tv].x) - - (cs->psx = vertices[fv].x); - cs->pdy = (long) (cs->pey = vertices[tv].y) - - (cs->psy = vertices[fv].y); - cs->ptmp = cs->pdx*cs->psy-cs->psx*cs->pdy; - cs->len = (long) sqrt( (double) cs->pdx * cs->pdx + - (double) cs->pdy * cs->pdy); - - if ((cs->sector=sd->sector)==-1) - printf("\nWarning: Bad sidedef in linedef %d (Z_CheckHeap error)\n",n); - - cs->angle = ComputeAngle(cs->pdx,cs->pdy); - - if (linedefs[n].tag==999) - cs->angle=(cs->angle + (unsigned)(sd->xoff*(65536.0/360.0))) & 65535u; - - cs->linedef = n; - cs->dist = 0; - return cs; -} - -/*- initially creates all segs, one for each line def ----------------------*/ - -static struct Seg *CreateSegs() -{ - struct Seg *cs = NULL; /* current Seg */ - struct Seg *fs = NULL; /* first Seg in list */ - struct LineDef *l = linedefs; - int n; - - puts("Creating Segs .........."); - - for (n=0;nsidedef1 != -1) - (cs=add_seg(cs,n,l->start,l->end,&fs,sidedefs+l->sidedef1))->flip=0; - else - printf("\nWarning: Linedef %d has no right sidedef\n",n); - - if (l->sidedef2 != -1) - (cs=add_seg(cs,n,l->end,l->start,&fs,sidedefs+l->sidedef2))->flip=1; - else - if (l->flags & 4) - printf("\nWarning: Linedef %d is 2s but has no left sidedef\n",n); - } - return fs; -} - -/*- get the directory from a wad file --------------------------------------*/ -/* rewritten by Lee Killough to support multiple levels and extra lumps */ - -static void OpenWadFile(char *filename) -{ - long i; - register struct directory *dir; - struct lumplist *levelp=NULL; - FILE *infile; - - if (!(infile = fopen(filename,"rb"))) - ProgError("Error: Cannot open WAD file %s", filename); - - if (fread(&wad,1,sizeof(wad),infile)!=sizeof(wad) || - (wad.type[0]!='I' && wad.type[0]!='P') || wad.type[1]!='W' - || wad.type[2]!='A' || wad.type[3]!='D') - ProgError("%s does not appear to be a wad file -- bad magic", filename); - - printf("Opened %cWAD file : %s. %lu dir entries at 0x%lX.\n", - wad.type[0],filename,wad.num_entries,wad.dir_start); - - direc = GetMemory(sizeof(struct directory) * wad.num_entries); - - fseek(infile,wad.dir_start,0); - fread(direc,sizeof(struct directory),wad.num_entries,infile); - - current_level=NULL; - dir = direc; - for (i=wad.num_entries;i--;dir++) - { - register struct lumplist *l=GetMemory(sizeof(*l)); - l->dir=dir; - l->data=NULL; - l->next=NULL; - l->islevel=0; - - if ((dir->name[0]=='E' && dir->name[2]=='M' && - dir->name[1]>='1' && dir->name[1]<='9' && - dir->name[3]>='1' && dir->name[3]<='9' && - (!dir->name[4] || (dir->name[4]>='0' && - dir->name[4]<='9' && - !dir->name[5]) )) || ( - dir->name[0]=='M' && dir->name[1]=='A' && - dir->name[2]=='P' && !dir->name[5] && - dir->name[3]>='0' && dir->name[3]<='9' && - dir->name[4]>='0' && dir->name[4]<='9')) - { - dir->length=0; - l->islevel=1; /* Begin new level */ - } - else - { - if (levelp && (!strncmp(dir->name,"SEGS",8) || - !strncmp(dir->name,"SSECTORS",8) || - !strncmp(dir->name,"NODES",8) || - !strncmp(dir->name,"BLOCKMAP",8) || - (!noreject && !strncmp(dir->name,"REJECT",8)) || - FindDir(dir->name))) - continue; /* Ignore these since we're rebuilding them anyway */ - - if (levelp && FindDir(dir->name)) - { - printf("Warning: Duplicate entry \"%-8.8s\" ignored in %-.8s\n", - dir->name, current_level->dir->name); - continue; - } - - if (dir->length) - { - l->data=GetMemory(dir->length); - if (fseek(infile,dir->start,0) || - fread(l->data,1,dir->length,infile) != dir->length) - printf("Warning: Trouble reading wad directory entry \"%-8.8s\" in %-.8s\n", - dir->name, current_level->dir->name); - } - - if (levelp && (!strncmp(dir->name,"THINGS",8) || - !strncmp(dir->name,"LINEDEFS",8) || - !strncmp(dir->name,"SIDEDEFS",8) || - !strncmp(dir->name,"VERTEXES",8) || - !strncmp(dir->name,"SECTORS",8) || - (noreject && !strncmp(dir->name,"REJECT",8)))) - { /* Store in current level */ - levelp->next=l; - levelp=l; - continue; - } - } - - /* Mark end of level and advance one main lump entry */ - - if (levelp && !(current_level->data=current_level->next)) - current_level->islevel=0; /* Ignore oddly formed levels */ - - levelp = l->islevel ? l : NULL; - - if (current_level) - current_level->next=l; - else - lumplist=l; - current_level=l; - } - - if (levelp) - { - if (!(current_level->data=current_level->next)) - current_level->islevel=0; /* Ignore oddly formed levels */ - current_level->next=NULL; - } - fclose(infile); -} - -/*- find the pointer to a resource -----------------------*/ - -static struct lumplist *FindDir(const char *name) -{ - struct lumplist *l = current_level; - while (l && strncmp(l->dir->name,name,8)) - l=l->next; - return l; -} - -/*- read the things from the wad file and place in 'things' ----------------*/ -static void GetThings(void) -{ - struct lumplist *l; - - l = FindDir("THINGS"); - - if (!l || !(num_things = l->dir->length / sizeof( struct Thing))) - ProgError("Must have at least 1 Thing"); - - things = l->data; -} - -/*- read the vertices from the wad file and place in 'vertices' ------------ - Rewritten by Lee Killough, to speed up performance */ - -static struct lumplist *vertlmp; - -static void GetVertexes(void) -{ - long n,used_verts,i; - int *translate; - struct lumplist *l = FindDir("VERTEXES"); - - if(!l || !(num_verts = l->dir->length / sizeof(struct Vertex))) - ProgError("Couldn't find any Vertices"); - - vertlmp = l; - - vertices = l->data; - - translate = GetMemory(num_verts*sizeof(*translate)); - - for (n=0;n=num_verts || e<0 || e>=num_verts) - ProgError("Linedef %ld has vertex out of range\n",i); - if (vertices[s].x!=vertices[e].x || vertices[s].y!=vertices[e].y) - { - linedefs[n++]=linedefs[i]; - translate[s]=translate[e]=0; - } - } - i-=num_lines=n; - used_verts=0; - for (n=0;n= used_verts || e < 0 || e >= used_verts) - ProgError("Trouble in GetVertexes: Renumbering\n"); - linedefs[n].start=s; - linedefs[n].end=e; - } - - free(translate); - - printf("Loaded %ld vertices",num_verts); - if (num_verts>used_verts) - printf(", but %ld were unused\n(this is normal if the nodes were built before).\n", - num_verts-used_verts); - else - puts("."); - printf(i ? "%ld zero-length lines were removed.\n" : "\n",i); - num_verts = used_verts; - if (!num_verts) - ProgError("Couldn't find any used Vertices"); -} - -/*- read the linedefs from the wad file and place in 'linedefs' ------------*/ - -static void GetLinedefs(void) -{ - struct lumplist *l = FindDir("LINEDEFS"); - - if (!l || !(num_lines = l->dir->length / sizeof(struct LineDef))) - ProgError("Couldn't find any Linedefs"); - - linedefs = l->data; -} - -/*- read the sidedefs from the wad file and place in 'sidedefs' ------------*/ - -static void GetSidedefs(void) -{ - struct lumplist *l = FindDir("SIDEDEFS"); - - if (!l || !(num_sides = l->dir->length / sizeof(struct SideDef))) - ProgError("Couldn't find any Sidedefs"); - - sidedefs = l->data; -} - -/*- read the sectors from the wad file and place count in 'num_sectors' ----*/ - -static void GetSectors(void) -{ - struct lumplist *l = FindDir("SECTORS"); - - if (!l || !(num_sects = l->dir->length / sizeof(struct Sector))) - ProgError("Couldn't find any Sectors"); - - sectors = l->data; -} - -/*--------------------------------------------------------------------------*/ - -static int IsLineDefInside(int ldnum, int xmin, int ymin, int xmax, int ymax ) -{ - int x1 = vertices[ linedefs[ ldnum].start].x; - int y1 = vertices[ linedefs[ ldnum].start].y; - int x2 = vertices[ linedefs[ ldnum].end].x; - int y2 = vertices[ linedefs[ ldnum].end].y; - int count=2; - - for (;;) - if (y1>ymax) - { - if (y2>ymax) - return(FALSE); - x1=x1+(x2-x1)*(double)(ymax-y1)/(y2-y1); - y1=ymax; - count=2; - } - else - if (y1xmax) - { - if (x2>xmax) - return(FALSE); - y1=y1+(y2-y1)*(double)(xmax-x1)/(x2-x1); - x1=xmax; - count=2; - } - else - if (x1chright = tn->nextr ? ReverseNodes(tn->nextr), tn->nextr->node_num : - tn->chright | 0x8000; - - tn->chleft = tn->nextl ? ReverseNodes(tn->nextl), tn->nextl->node_num : - tn->chleft | 0x8000; - - pn = pnodes + pnode_indx++; - - pn->x = tn->x; - pn->y = tn->y; - pn->dx = tn->dx; - pn->dy = tn->dy; - pn->maxy1 = tn->maxy1; - pn->miny1 = tn->miny1; - pn->minx1 = tn->minx1; - pn->maxx1 = tn->maxx1; - pn->maxy2 = tn->maxy2; - pn->miny2 = tn->miny2; - pn->minx2 = tn->minx2; - pn->maxx2 = tn->maxx2; - pn->chright = tn->chright; - pn->chleft = tn->chleft; - tn->node_num = num_pnodes++; -} - -/* Add a lump to current level - by Lee Killough */ - -static void add_lump(const char *name, void *data, size_t length) -{ - struct lumplist *l; - for (l=current_level;l;l=l->next) - if (!strncmp(name,l->dir->name,8)) - break; - if (!l) - { - l=current_level; - while (l->next) - l=l->next; - l->next = GetMemory(sizeof(*l)); - l = l->next; - l->next=NULL; - l->dir = GetMemory(sizeof(struct directory)); - strncpy(l->dir->name,name,8); - } - l->dir->length=length; - l->islevel=0; - l->data=data; -} - -static struct directory write_lump(struct lumplist *lump) -{ - if (ftell(outfile)!=lump->dir->start || (lump->dir->length && - fwrite(lump->data, 1, lump->dir->length, outfile) != lump->dir->length)) - printf("Warning: Consistency check failure writing %-.8s\n", lump->dir->name); - return *lump->dir; -} - -static void sortlump(struct lumplist **link) -{ - static const char *const lumps[10]={"THINGS", "LINEDEFS", "SIDEDEFS", - "VERTEXES", "SEGS", "SSECTORS", "NODES", "SECTORS", "REJECT", "BLOCKMAP"}; - int i=sizeof(lumps)/sizeof(*lumps)-1; - struct lumplist **l; - do - for (l=link;*l;l=&(*l)->next) - if (!strncmp(lumps[i],(*l)->dir->name,8)) - { - struct lumplist *t=(*l)->next; - (*l)->next=*link; - *link=*l; - *l=t; - break; - } - while (--i>=0); -} - - -void usage(void) -{ - fprintf(stdout, - "\nThis Node builder was created from the basic theory stated in DEU5 (OBJECTS.C)\n" - "Credits should go to :-\n" - "Matt Fell (msfell@aol.com) for the Doom Specs.\n" - "Raphael Quinet (Raphael.Quinet@eed.ericsson.se) for DEU and the original idea.\n" - "Mark Harrison (harrison@lclark.edu) for finding a bug in 1.1x\n" - "Jim Flynn (jflynn@pacbell.net) for many good ideas and encouragement.\n" - "Jan Van der Veken for finding invisible barrier bug.\n" - "Colin Phipps for two bug fixes (http://lxdoom.linuxgames.com/notes.html#bsp).\n" -#ifdef MSDOS - "\nUsage: BSP [options] input.wad [[-o] ]\n" -#else - "\nUsage: BSP [options] input.wad [-o ]\n" -#endif - " (If no output.wad is specified, \"tmp.wad\" is written)\n\n" - "Options:\n\n" - " -factor Changes the cost assigned to SEG splits\n" - " -vp Attempts to prevent visplane overflows\n" - " -vpwarn Warns about potential visplane overflows\n" - " -vpmark Marks visplane overflows with player starts\n" - " -thold Threshold for visplane overflow (default 128)\n" - " -noreject Does not clobber reject map\n" - ); - exit(1); -} - -static void parse_options(int argc, char *argv[]) -{ - static char *fnames[2]; - static const struct { - const char *option; - void *var; - enum {NONE, STRING, INT} arg; - } tab[]= { {"-vp", &visplane, NONE}, - {"-vpwarn", &visplane_warning, NONE}, - {"-warnvp", &visplane_warning, NONE}, - {"-noreject", &noreject, NONE}, - {"-vpmark", &mark_visplanes, NONE}, - {"-markvp", &mark_visplanes, NONE}, - {"-factor", &factor, INT}, - {"-thold", &threshold, INT}, - {"-o", fnames+1, STRING}, - }; - int nf=0; - - while (--argc) - if (**++argv=='-') - { - int i=sizeof(tab)/sizeof(*tab); - for (;;) - if (!strcmp(*argv,tab[--i].option)) - { - if (tab[i].arg==INT) - if (--argc) - { - char *end; - *(int *) tab[i].var=strtol(*++argv,&end,0); - if (*end || factor<0) - usage(); - } - else - usage(); - else - if (tab[i].arg==STRING) - if (--argc) - *(char **) tab[i].var = *++argv; - else - usage(); - else - ++*(int *) tab[i].var; - break; - } - else - if (!i) - { - usage(); - break; - } - } - else -#ifdef MSDOS - if (nf<2) -#else - if (nf<1) -#endif - fnames[nf++]=*argv; - else - usage(); - - testwad = fnames[0]; /* Get input name*/ - - if (!testwad || factor<0 || threshold<0) - usage(); - - outwad = fnames[1] ? fnames[1] : "tmp.wad"; /* Get output name*/ -} - -/*- Main Program -----------------------------------------------------------*/ - -int main(int argc,char *argv[]) -{ - struct lumplist *lump,*l; - struct directory *newdirec; - - setbuf(stdout,NULL); -#ifndef MSDOS /* Unix: no whirling baton if stderr is redirected */ - if(!isatty(2)) - show_progress=0; -#endif - - puts("* Doom BSP node builder ver 2.3 (c) 1998 Colin Reed, Lee Killough *"); - printf("* This is the modified version that comes with Yadex %s. *\n", - YADEX_VERSION); - - parse_options(argc,argv); - - OpenWadFile(testwad); /* Opens and reads directory*/ - - printf("\nCreating nodes using tunable factor of %d\n",factor); - - if (visplane) - { - puts("\nTaking special measures to reduce the chances of visplane overflow"); - PickNode=PickNode_visplane; - } - - for (lump=lumplist; lump; lump=lump->next) - if (lump->islevel) - { - struct Seg *tsegs; - static struct Node *nodelist; - - current_level=lump->data; - strncpy(current_level_name,lump->dir->name,8); - printf("\nBuilding nodes on %-.8s\n\n",current_level_name); - - blockptrs=NULL; - blocklists=NULL; - blockptrs_size=0; - num_ssectors=0; - num_psegs=0; - num_nodes=0; - - GetThings(); - GetLinedefs(); /* Get linedefs and vertices*/ - GetVertexes(); /* and delete redundant.*/ - GetSidedefs(); - GetSectors(); - - tsegs = CreateSegs(); /* Initially create segs*/ - - FindLimits(tsegs); /* Find limits of vertices*/ - - mapminx = lminx; /* store as map limits*/ - mapmaxx = lmaxx; - mapminy = lminy; - mapmaxy = lmaxy; - - printf("Map goes from (%d,%d) to (%d,%d)\n",lminx,lminy,lmaxx,lmaxy); - - SectorHits = GetMemory(num_sects); - - nodelist = CreateNode(tsegs); /* recursively create nodes*/ - - fputs(" \n",stderr); - - printf("%lu NODES created, with %lu SSECTORS.\n",num_nodes,num_ssectors); - - printf("Found %lu used vertices\n",num_verts); - - printf("Heights of left and right subtrees = (%u,%u)\n", - height(nodelist->nextl), height(nodelist->nextr)); - - vertlmp->dir->length=num_verts * sizeof(struct Vertex); - vertlmp->data=vertices; - - add_lump("SEGS", psegs, sizeof(struct Pseg)*num_psegs); - - add_lump("SSECTORS", ssectors, sizeof(struct SSector)*num_ssectors); - - if (!FindDir("REJECT")) - { - long reject_size = (num_sects*num_sects+7)/8; - void *data = GetMemory(reject_size); - memset(data,0,reject_size); - add_lump("REJECT", data, reject_size); - } - - { - long blockmap_size = CreateBlockmap(); - char *data = GetMemory(blockmap_size+blockptrs_size+8); - memcpy(data,&blockhead,8); - memcpy(data+8,blockptrs,blockptrs_size); - memcpy(data+8+blockptrs_size,blocklists,blockmap_size); - free(blockptrs); - free(blocklists); - add_lump("BLOCKMAP",data,blockmap_size+blockptrs_size+8); - puts("Completed blockmap building"); - } - - if (visplane_warning || mark_visplanes) - warn_visplanes(nodelist); - - if (mark_visplanes) - add_lump("THINGS", things, sizeof(struct Thing)*num_things); - - pnodes = GetMemory(sizeof(struct Pnode)*num_nodes); - num_pnodes = 0; - pnode_indx = 0; - ReverseNodes(nodelist); - add_lump("NODES", pnodes, sizeof(struct Pnode)*num_pnodes); - - free(SectorHits); - - } /* if (lump->islevel) */ - - - { - long offs=12; - wad.num_entries=0; - for (lump=lumplist; lump; lump=lump->next) - { - lump->dir->start=offs; - offs+=lump->dir->length; - wad.num_entries++; - if (lump->islevel) - { - sortlump((struct lumplist **) &lump->data); - for (l=lump->data; l; l=l->next) - { - l->dir->start=offs; - offs+=l->dir->length; - wad.num_entries++; - } - } - } - - newdirec = GetMemory(wad.num_entries*sizeof(struct directory)); - - if (!(outfile=fopen(outwad,"wb"))) - { - fputs("Error: Could not open output PWAD file ",stderr); - perror(outwad); - exit(1); - } - - wad.dir_start=offs; - if (fwrite(&wad,1,12,outfile)!=12) - puts("Warning: Consistency check failure writing wad header"); - - for (offs=0,lump=lumplist; lump; lump=lump->next) - { - newdirec[offs++]=write_lump(lump); - if (lump->islevel) - for (l=lump->data; l; l=l->next) - newdirec[offs++]=write_lump(l); - } - - if (ftell(outfile)!=wad.dir_start || - fwrite(newdirec,sizeof(struct directory),wad.num_entries,outfile)!=wad.num_entries) - puts("Warning: Consistency check failure writing lump directory"); - fclose(outfile); - - if (offs!=wad.num_entries) - puts("Warning: Lump directory count consistency check failure"); - printf("\nSaved WAD as %s\n",outwad); - } - return 0; -} - -/*- end of file ------------------------------------------------------------*/ diff -uaNr yadex-1.5.2/bsp-2.3/bsp.h yadex-1.6.0/bsp-2.3/bsp.h --- yadex-1.5.2/bsp-2.3/bsp.h 1999-08-10 18:49:21.000000000 +0200 +++ yadex-1.6.0/bsp-2.3/bsp.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,41 +0,0 @@ -/*- BSP.H ------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(MSDOS) || defined(__MSDOS__) -#include -#endif -#ifdef __TURBOC__ -#include -#endif -#ifndef MSDOS -#include /* Unix: isatty() */ -#endif - -/*- boolean constants ------------------------------------------------------*/ - -#define TRUE 1 -#define FALSE 0 - -/*- The function prototypes ------------------------------------------------*/ - -static void ProgError( char *, ...); -static void *GetMemory(size_t); -static void *ResizeMemory(void *, size_t); -static unsigned ComputeAngle(long,long); - -#undef max -#define max(a,b) (((a)>(b))?(a):(b)) - -/*- print a resource name by printing first 8 characters --*/ - -#define Printname(dir) printf("%-8.8s",(dir)->name) - -/*------------------------------- end of file ------------------------------*/ diff -uaNr yadex-1.5.2/bsp-2.3/bsp23x.txt yadex-1.6.0/bsp-2.3/bsp23x.txt --- yadex-1.5.2/bsp-2.3/bsp23x.txt 1998-12-19 13:18:16.000000000 +0100 +++ yadex-1.6.0/bsp-2.3/bsp23x.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,190 +0,0 @@ -This is BSP version 2.3 dos extended, written by Colin Reed, Lee Killough - -Please send all comments and/or questions about BSP to Lee Killough -(killough@rsn.hp.com). - ------------------------------------------------------------ -Changes in 2.3x: - -Lee Killough 2/98: - -Fixed a minor bug which caused textures to bleed sometimes. -Thanks to Jonathan Campbell (joncamp@tiac.net) for finding it. - -Switched from djgpp v1.12 to v2.01. - -Linux builds now supported (thanks to Andre Majorel for the port). - -Possible future enhancement: - ->64K blockmap support (requires changes in Doom source code as well). - ------------------------------------------------------------ -Changes in 2.2x: - -Lee Killough 10/97: - -Added -vp option to reduce the chances of visplane overflows, without loss -of detail. Using -vp causes node line picker to choose node lines in a way -that is empirically known to reduce or eliminate visplane overflows (see -visplane.txt). No guarantees, though!!! - -Added -vpwarn option to warn about possible visplane overflows (see -visplane.txt). - --vpmark option also added, which leaves permanent marks in the form of player -1 starts. It's a good idea to write to a separate output file when using this -option!!! You can then use an editor, play each alternate player start, and -see if each one causes visplane overflows, and then remove it. Usually no- -clipping must be used, at least to step out from the wall, since it inserts -player starts without regard to collisions, and it uses walls as a basis for -visplane calculations. - -Added -noreject option, to allow building nodes without messing up an -already-built reject map. - -Added -thold option to change the visplane threshold. May be used to report -more potential visplane overflows if the -vpwarn or -vpmark approximations -estimate too few visplanes. Default threshold is 128. - -Changed the way level markers in the lump directory are handled, to -accomodate DCK3.61, EdMap, and perhaps other editors. Some editors, such -as DCK3.61, do not always set the length field in a level marker to 0, and -EdMap requires that the offset field in a level marker be equal to the -offset of the first resource. - ------------------------------------------------------------ -Changes in 2.1x: - -Lee Killough 06/97 - -Fixed design bug which caused invisible barriers or disappearing Things. -Problem was in how segs incident to a partitioning node line were -partitioned -- they were partitioned according to sidedef, rather than -vertex, orientation w.r.t. the node line. Flipping the affected seg's -linedef usually fixed the problem. Now an incident seg is properly -partitioned either on the left or right side of a node line depending -on whether the two segs are in the same direction or not, not whether -they are both flipped or not. - -Added special effects features: - -If a linedef has a sector tag >= 900, then it is treated as "precious" -and will not be split unless absolutely necessary. This is good to use -around borders of deep water, invisible stairs, etc. - -Furthermore, just for grins, if the linedef's tag is 999, then the sidedefs' -x-offsets set an angle adjustment in degrees to be applied -- you can look -straight at a wall, but it might come right at you on both sides and -"stretch". - ------------------------------------------------------------ - -New to 2.0x: - -Multilevel support!!! Automatically builds all levels in wad. - -Does not strip textures or other lumps from wads anymore!!! - -Supports HOM-free transparent doors: - - Simply make the sector referenced by the doortracks have a - sector tag of >= 900. No need to remember sector numbers - and type them in on a command line -- just use any sector - tag >= 900 to permanently mark the sector special. - - See TRANSDOR.WAD for an example of sector tags in the 900's - being used to create HOM-free transparent door effects. - ------------------------------------------------------------ - -Changes from 1.4x to 1.5x: - -Replaced GO32.EXE with newer version, to support Windows -and DPMI. - ------------------------------------------------------------ - -Changes from 1.3x to 1.4x: - -Lee Killough: - -Fixed bug which caused BSP to "do nothing" on systems where -GO32.EXE was not in the user's path. - -Added -factor option to allow changing the heuristic used by the -node picker. Factor can be any positive integer, and the larger -the factor, the more costly seg splits are. A factor of 17 is the -default and behaves just like earlier versions of BSP. Changing the -factor can sometimes prevent visplane overflows in wads. But then -again, some wads have just too many visible 2s linedefs for the -node builder to make a difference. If you have visplane overflows, -experiment with the -factor option before giving up. - ------------------------------------------------------------ - -Changes from 1.2x to 1.3x: - -New version due to performance enhancements by Lee Killough -(killough@rsn.hp.com). - -Runs at least 3 times as fast as before, due to changes in PickNode. -Same results are obtained, but with greater speed. Differences from -1.2x: - - PickNode() rewritten to maximize performance. New PickNode() - algorithm features pruning strategy which allows inner loop - to exit as soon as a seg is detected as being worse than the - best so far. - - All floating-point arithmetic inside inner loop has been eliminated. - - GetVertexes() changed and Reference() removed, replaced with a - faster vertex renumbering algorithm which also removes lines of - length zero. - - IsLineDefInside() tuned by eliminating bit mask variable. - - Functions are static, to reduce code size by permitting total - inlining. - - Various other minor performance enhancements - ------------------------------------------------------------ - -Changes from 1.1 to 1.2x: - -New version 1.2 due to bug found by Mark Harrison that caused some -problems with flipped segs having their textures buggered up. - -The GO32 dos extender has been pre-pended to the executable. - ------------------------------------------------------------ - -This builds a BSP node tree for your DOOM wad files. - -Usage: - -BSP [-factor nnn] [] - -If no output file is specified 'tmp.wad' is written. - ------------------------------------------------------------ - -This ZIP includes the fullly commented source code for all you -Doom editor/utility writers out there. - ------------------------------------------------------------ - -A known problem is a conflict between the GO32 dos extender -and QEMM's DPMI... put 'set GO32=nodpmi' in your autoexec.bat -to avoid problems. - ------------------------------------------------------------ - -Future enhancements (possibly, depending on demand): - -* Ability to specify level(s) to build separately - -* Reject map build - diff -uaNr yadex-1.5.2/bsp-2.3/funcs.c yadex-1.6.0/bsp-2.3/funcs.c --- yadex-1.5.2/bsp-2.3/funcs.c 1998-12-19 13:18:16.000000000 +0100 +++ yadex-1.6.0/bsp-2.3/funcs.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,38 +0,0 @@ -/*- FUNCS.C ----------------------------------------------------------------*/ -/*- terminate the program reporting an error -------------------------------*/ - -static void ProgError( char *errstr, ...) -{ - va_list args; - - va_start( args, errstr); - fprintf(stderr, "\nProgram Error: *** "); - vfprintf( stderr, errstr, args); - fprintf(stderr, " ***\n"); - va_end( args); - exit( 5); -} - -/*- allocate memory with error checking ------------------------------------*/ - -static __inline__ void *GetMemory( size_t size) -{ - void *ret = malloc( size); - if (!ret) - ProgError( "out of memory (cannot allocate %u bytes)", size); - return ret; -} - -/*- reallocate memory with error checking ----------------------------------*/ - -static __inline__ void *ResizeMemory( void *old, size_t size) -{ - void *ret = realloc( old, size); - if (!ret) - ProgError( "out of memory (cannot reallocate %u bytes)", size); - return ret; -} - - -/*--------------------------------------------------------------------------*/ - diff -uaNr yadex-1.5.2/bsp-2.3/makenode.c yadex-1.6.0/bsp-2.3/makenode.c --- yadex-1.5.2/bsp-2.3/makenode.c 1999-11-23 22:22:22.000000000 +0100 +++ yadex-1.6.0/bsp-2.3/makenode.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,469 +0,0 @@ -/*- MAKENODE.C --------------------------------------------------------------* - Recursively create nodes and return the pointers. -*---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - Split a list of segs (ts) into two using the method described at bottom of - file, this was taken from OBJECTS.C in the DEU5beta source. - - This is done by scanning all of the segs and finding the one that does - the least splitting and has the least difference in numbers of segs on either - side. - If the ones on the left side make a SSector, then create another SSector - else put the segs into lefts list. - If the ones on the right side make a SSector, then create another SSector - else put the segs into rights list. -*---------------------------------------------------------------------------*/ - -static int DivideSegs(struct Seg *ts,struct Seg *best,struct Seg **rs,struct Seg **ls) -{ - struct Seg *rights=NULL,*lefts=NULL; - struct Seg *tmps,*news,*prev; - struct Seg *add_to_rs,*add_to_ls; - struct Seg *new_best=NULL,*new_rs,*new_ls; - struct Seg *strights=NULL,*stlefts=NULL; - - *rs=*ls=NULL; - -/* - printf("Picked linedef %d (%d,%d) (%d) as node line\n", - best->linedef, best->start, best->end, best->flip); -*/ - -/* When we get to here, best is a pointer to the partition seg. - Using this partition line, we must split any lines that are intersected - into a left and right half, flagging them to be put their respective sides - Ok, now we have the best line to use as a partitioning line, we must - split all of the segs into two lists (rightside & leftside). */ - - for(tmps=ts;tmps;tmps=tmps->next) - { - long a = best->pdy * tmps->psx - best->pdx * tmps->psy + best->ptmp; - long b = best->pdy * tmps->pex - best->pdx * tmps->pey + best->ptmp; - - if ((a^b) < 0) - if (a && b) - { /* Seg is split */ - double ds = (double) a / (a-b); /* 0 = start, 1 = end */ - int x = tmps->psx + tmps->pdx * ds + 0.5; - int y = tmps->psy + tmps->pdy * ds + 0.5; - - if (x==tmps->psx && y==tmps->psy) - { - if (b<0) - goto leftside; - else - goto rightside; - } - - if (x==tmps->pex && y==tmps->pey) - { - if (a<0) - goto leftside; - else - goto rightside; - } - -/* printf("Splitting Linedef %d at %d,%d\n",tmps->linedef,x,y); */ - - vertices = ResizeMemory(vertices, sizeof(struct Vertex) * (num_verts+1)); - - vertices[num_verts].x = x; - vertices[num_verts].y = y; - news = GetMemory(sizeof( struct Seg)); - - *news = *tmps; - tmps->next = news; - news->start = num_verts; - tmps->end = num_verts; - - news->pdx = (long) (news->pex = vertices[news->end].x) - - (news->psx = x); - news->pdy = (long) (news->pey = vertices[news->end].y) - - (news->psy = y); - news->ptmp = news->pdx*news->psy - news->psx*news->pdy; - news->len = (long) sqrt((double) news->pdx*news->pdx + - (double) news->pdy*news->pdy); - - tmps->pdx = (long) (tmps->pex = x) - - (tmps->psx = vertices[tmps->start].x); - tmps->pdy = (long) (tmps->pey = y) - - (tmps->psy = vertices[tmps->start].y); - tmps->ptmp = tmps->pdx*tmps->psy - tmps->psx*tmps->pdy; - tmps->len = (long) sqrt((double) tmps->pdx*tmps->pdx + - (double) tmps->pdy*tmps->pdy); - - { - long dx,dy; - if (news->flip) - { - dx = vertices[linedefs[news->linedef].end].x; - dy = vertices[linedefs[news->linedef].end].y; - } - else - { - dx = vertices[linedefs[news->linedef].start].x; - dy = vertices[linedefs[news->linedef].start].y; - } - dx -= news->psx; - dy -= news->psy; - news->dist = (int)(sqrt((double) dx*dx + (double) dy*dy)); - } - -/* printf("splitting dist = %d\n",news->dist);*/ -/* printf("splitting vertices = %d,%d,%d,%d\n",tmps->start,tmps->end,news->start,news->end);*/ - - if (a<0) - { - add_to_rs=news; - add_to_ls=tmps; - } - else - { - add_to_ls=news; - add_to_rs=tmps; - } - tmps = news; - num_verts++; - } - else - goto leftside; - else - if (a<=0 && (a || (!b && tmps->pdx*best->pdx+tmps->pdy*best->pdy < 0 ))) - { - leftside: - add_to_ls=tmps; /* Seg is on left side */ - add_to_rs=NULL; - } - else - { - rightside: - add_to_rs=tmps; /* Seg is on right side */ - add_to_ls=NULL; - } - - if (add_to_rs) /* CHECK IF SHOULD ADD RIGHT ONE */ - { -/* - printf("Adding linedef %d (%d,%d) (%d) to right side\n", - add_to_rs->linedef, add_to_rs->start, add_to_rs->end, - add_to_rs->flip); -*/ - new_rs = GetMemory(sizeof(struct Seg)); - if (add_to_rs == best) - new_best = new_rs; - *new_rs = *add_to_rs; - new_rs->next = NULL; - if (!rights) - strights = rights = new_rs; - else - { - rights->next = new_rs; - rights = new_rs; - } - } - - if (add_to_ls) /* CHECK IF SHOULD ADD LEFT ONE */ - { -/* - printf("Adding linedef %d (%d,%d) (%d) to left side\n", - add_to_ls->linedef, add_to_ls->start, add_to_ls->end, - add_to_ls->flip); -*/ - new_ls = GetMemory(sizeof(struct Seg)); - if (add_to_ls == best) - new_best = new_ls; - *new_ls = *add_to_ls; - new_ls->next = NULL; - if (!lefts) - stlefts = lefts = new_ls; - else - { - lefts->next = new_ls; - lefts = new_ls; - } - } - } - - if(strights == NULL) - { -/* printf("No right side, moving partition into right side\n"); */ - strights = rights = new_best; - prev = NULL; - for(tmps=stlefts;tmps;tmps=tmps->next) - { - if(tmps == new_best) - { - if(prev != NULL) prev->next=tmps->next; - else stlefts=tmps->next; - } - prev=tmps; - } - prev->next = NULL; - } - - if(stlefts == NULL) - { -/* printf("No left side, moving partition into left side\n"); */ - stlefts = lefts = new_best; - prev = NULL; - for(tmps=strights;tmps;tmps=tmps->next) - { - if(tmps == new_best) - { - if(prev != NULL) prev->next=tmps->next; - else strights=tmps->next; - } - prev=tmps; - } - stlefts->next = NULL; - prev->next = NULL; /* Make sure end of list = NULL*/ - } - - rights->next = NULL; - lefts->next = NULL; - - *rs = strights; - *ls = stlefts; - return 0; -} - -/*--------------------------------------------------------------------------*/ - -static int IsItConvex(const struct Seg *ts) -{ - const struct Seg *line; - register const struct Seg *check; - int sector; - - for (line=ts; line; line=line->next) - if (linedefs[line->linedef].tag >= 900 && - linedefs[line->linedef].flags & 4 && - sidedefs[linedefs[line->linedef].sidedef1].sector== - sidedefs[linedefs[line->linedef].sidedef2].sector) - for (check=line->next;check;check=check->next) - if (check->linedef==line->linedef && check->flip!=line->flip) - return FALSE; - - /* All ssectors must come from same sector unless it's marked - "special" with sector tag >= 900. Original idea, Lee Killough */ - - for (check=ts; check; check=check->next) - if (linedefs[check->linedef].tag < 900 && - sectors[sector=check->sector].tag < 900) - { - while ((check=check->next)!=NULL) - if (check->sector != sector && - sectors[check->sector].tag < 900 && - linedefs[check->linedef].tag < 900 ) - return FALSE; - break; - } - - /* all of the segs must be < 180 degrees apart */ - - for (line=ts;line;line=line->next) - for (check=ts;check;check=check->next) /* Check partition against all Segs*/ - { /* get state of lines' relation to each other */ - long a = line->pdy * check->psx - line->pdx * check->psy + line->ptmp; - long b = line->pdy * check->pex - line->pdx * check->pey + line->ptmp; - - if ((a^b)>=0 ? a<0 || b<0 || (!a && !b && check->pdx*line->pdx + - check->pdy*line->pdy < 0 && - (check->linedef != line->linedef || - !(linedefs[line->linedef].flags & 4) || - linedefs[line->linedef].sidedef1==-1 || - *sidedefs[linedefs[line->linedef].sidedef1].tex3-'-' || - linedefs[line->linedef].sidedef2==-1 || - *sidedefs[linedefs[line->linedef].sidedef2].tex3-'-' - ) - ) - : (b<0 || check->len*a/(a-b)>=2) && (a<0 || check->len*b/(b-a)>=2)) - return FALSE; - } - /* no need to split the list: these Segs can be put in a SSector */ - return TRUE; -} - -/*--------------------------------------------------------------------------*/ - -static int CreateSSector(struct Seg *tmps) -{ - int n=0; - struct Seg *ts; - - for (ts=tmps;ts;ts=ts->next) - n++; - - ssectors = num_ssectors ? ResizeMemory(ssectors,sizeof(struct SSector)*(num_ssectors+1)) - : GetMemory(sizeof(struct SSector)); - - ssectors[num_ssectors].num = n; - - ssectors[num_ssectors].first = num_psegs; - - psegs = num_psegs ? ResizeMemory(psegs,sizeof(struct Pseg)*(num_psegs+n)) - : GetMemory(sizeof(struct Pseg)*n); - - for (;tmps;tmps=tmps->next) - { - psegs[num_psegs].start = tmps->start; - psegs[num_psegs].end = tmps->end; - psegs[num_psegs].angle = tmps->angle; - psegs[num_psegs].linedef = tmps->linedef; - psegs[num_psegs].flip = tmps->flip; - psegs[num_psegs++].dist = tmps->dist; - } - - return num_ssectors++; -} - -/*- translate (dx, dy) into an integer angle value (0-65535) ---------------*/ - -static unsigned ComputeAngle(long dx, long dy) -{ - double w = atan2( (double) dy , (double) dx ) * (32768.0/M_PI); - if (w<0) w+=65536.0; - return (unsigned) w; -} - -static void DelSegs(struct Seg *ts) -{ - while (ts) - { - struct Seg *t=ts->next; - free(ts); - ts=t; - } -} - -static unsigned height(const struct Node *tn) -{ - if (tn) - { - unsigned l=height(tn->nextl),r=height(tn->nextr); - return l>r ? l+1 : r+1; - } - return 1; -} - -static struct Node *CreateNode(struct Seg *ts) -{ - struct Node node, *tn=&node; - struct Seg *rights,*lefts,*best; - - best = PickNode(ts); /* Pick best node to use.*/ - - if (!best) /* Failsafe measure */ - best=ts; - - DivideSegs(ts,best,&rights,&lefts); - - if (!rights || !lefts) /* Failsafe measure */ - return NULL; - - FindLimits(lefts); /* Find limits of vertices */ - tn->maxy2 = lmaxy; - tn->miny2 = lminy; - tn->minx2 = lminx; - tn->maxx2 = lmaxx; - - tn->nextl = IsItConvex(lefts) ? NULL : CreateNode(lefts); - - FindLimits(rights); /* Find limits of vertices*/ - tn->maxy1 = lmaxy; - tn->miny1 = lminy; - tn->minx1 = lminx; - tn->maxx1 = lmaxx; - - tn->nextr = IsItConvex(rights) ? NULL : CreateNode(rights); - - if (!tn->nextl) - tn->chleft = CreateSSector(lefts); - - if (!tn->nextr) - tn->chright = CreateSSector(rights); - - tn->x = best->psx; - tn->y = best->psy; - tn->dx = best->pdx; - tn->dy = best->pdy; - - tn->ptmp=tn->dx*tn->y-tn->dy*tn->x; - - DelSegs(ts); - - num_nodes++; - tn = GetMemory(sizeof(*tn)); /* Create a node*/ - *tn = node; - return tn; -} - -/* - * $Log: makenode.c,v $ - * Revision 1.2 1999/06/21 14:40:26 cphipps - * Make rounding better in DivideSegs() - * Fix logic errors in IsItConvex: - * - Even if both ends of a seg are the same side of a possible dividing seg, - * we must check that both are not on the wrong side still (one could be on the - * line) - * - Even if a split would be near the end of a line, the other end must be on - * the right side still - * - */ - -/*---------------------------------------------------------------------------* - - This message has been taken, complete, from OBJECTS.C in DEU5beta source. - It outlines the method used here to pick the nodelines. - - IF YOU ARE WRITING A DOOM EDITOR, PLEASE READ THIS: - - I spent a lot of time writing the Nodes builder. There are some bugs in - it, but most of the code is OK. If you steal any ideas from this program, - put a prominent message in your own editor to make it CLEAR that some - original ideas were taken from DEU. Thanks. - - While everyone was talking about LineDefs, I had the idea of taking only - the Segs into account, and creating the Segs directly from the SideDefs. - Also, dividing the list of Segs in two after each call to CreateNodes makes - the algorithm faster. I use several other tricks, such as looking at the - two ends of a Seg to see on which side of the nodeline it lies or if it - should be split in two. I took me a lot of time and efforts to do this. - - I give this algorithm to whoever wants to use it, but with this condition: - if your program uses some of the ideas from DEU or the whole algorithm, you - MUST tell it to the user. And if you post a message with all or parts of - this algorithm in it, please post this notice also. I don't want to speak - legalese; I hope that you understand me... I kindly give the sources of my - program to you: please be kind with me... - - If you need more information about this, here is my E-mail address: - Raphael.Quinet@eed.ericsson.se (Rapha‰l Quinet). - - Short description of the algorithm: - 1 - Create one Seg for each SideDef: pick each LineDef in turn. If it - has a "first" SideDef, then create a normal Seg. If it has a - "second" SideDef, then create a flipped Seg. - 2 - Call CreateNodes with the current list of Segs. The list of Segs is - the only argument to CreateNodes. - 3 - Save the Nodes, Segs and SSectors to disk. Start with the leaves of - the Nodes tree and continue up to the root (last Node). - - CreateNodes does the following: - 1 - Pick a nodeline amongst the Segs (minimize the number of splits and - keep the tree as balanced as possible). - 2 - Move all Segs on the right of the nodeline in a list (segs1) and do - the same for all Segs on the left of the nodeline (in segs2). - 3 - If the first list (segs1) contains references to more than one - Sector or if the angle between two adjacent Segs is greater than - 180ø, then call CreateNodes with this (smaller) list. Else, create - a SubSector with all these Segs. - 4 - Do the same for the second list (segs2). - 5 - Return the new node (its two children are already OK). - - Each time CreateSSector is called, the Segs are put in a global list. - When there is no more Seg in CreateNodes' list, then they are all in the - global list and ready to be saved to disk. - -*---------------------------------------------------------------------------*/ diff -uaNr yadex-1.5.2/bsp-2.3/picknode.c yadex-1.6.0/bsp-2.3/picknode.c --- yadex-1.5.2/bsp-2.3/picknode.c 1999-11-23 22:24:32.000000000 +0100 +++ yadex-1.6.0/bsp-2.3/picknode.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,1216 +0,0 @@ -/*- PICKNODE.C --------------------------------------------------------------* - To be able to divide the nodes down, this routine must decide which is the - best Seg to use as a nodeline. It does this by selecting the line with least - splits and has least difference of Segs on either side of it. - - Credit to Raphael Quinet and DEU, this routine is a copy of the nodeline - picker used in DEU5beta. I am using this method because the method I - originally used was not so good. - - Rewritten by Lee Killough to significantly improve performance, while - not affecting results one bit in >99% of cases (some tiny differences - due to roundoff error may occur, but they are insignificant). -*---------------------------------------------------------------------------*/ - -#define FACTOR 8 /* This is the original "factor" used by previous versions - of the code -- it must be maintained in a macro to avoid - mistakes if we are to keep the tradition of using it, - and being able to modify it. - */ - -static int factor=2*FACTOR+1; - -static struct Seg *PickNode_traditional(struct Seg *ts) -{ - struct Seg *best=NULL; - long bestcost=LONG_MAX; - struct Seg *part; - int cnt=0; - - for (part=ts;part;part=part->next) /* Count once and for all */ - cnt++; - - for (part=ts;part;part = part->next) /* Use each Seg as partition*/ - { - struct Seg *check; - long cost=0,tot=0,diff=cnt; - - progress(); /* Something for the user to look at.*/ - - for (check=ts;check;check=check->next) /* Check partition against all Segs*/ - { /* get state of lines' relation to each other */ - long a = part->pdy * check->psx - part->pdx * check->psy + part->ptmp; - long b = part->pdy * check->pex - part->pdx * check->pey + part->ptmp; - if ((a^b) < 0) - if (a && b) - { /* Line is split; a,b nonzero, opposite sign */ - long l=check->len; - long d=(l*a)/(a-b); /* Distance from start of intersection */ - if (d>=2) - { - /* If the linedef associated with this seg has a sector tag >= 900, - treat it as precious; i.e. don't split it unless all other options - are exhausted. This is used to protect deep water and invisible - lifts/stairs from being messed up accidentally by splits. */ - - if (linedefs[check->linedef].tag >= 900) - cost += factor*64; - - cost += factor; - - if (cost > bestcost) /* This is the heart of my pruning idea - */ - goto prune; /* it catches bad segs early on. Killough */ - - tot++; - } - else - if (l-d<2 ? check->pdx*part->pdx+check->pdy*part->pdy<0 : b<0) - goto leftside; - } - else - goto leftside; - else - if (a<=0 && (a || (!b && check->pdx*part->pdx+check->pdy*part->pdy<0))) - { - leftside: - diff-=2; - } - } - - if ((diff-=tot) < 0) /* Take absolute value. diff is being used to obtain the */ - diff= -diff; /* min/max values by way of: min(a,b)=(a+b-abs(a-b))/2 */ - - /* Make sure at least one Seg is on each side of the partition*/ - - if (tot+cnt > diff && (cost+=diff) < bestcost) - { /* We have a new better choice */ - bestcost = cost; - best = part; /* Remember which Seg*/ - } - prune:; /* Early exit and skip past the tests above */ - } - return best; /* All finished, return best Seg*/ -} - - -/* Lee Killough 06/1997: - - The chances of visplane overflows can be reduced by attemping to - balance the number of distinct sector references (as opposed to - SEGS) that are on each side of the node line, and by rejecting - node lines that cut across wide open space, as measured by the - proportion of the node line which is incident with segs, inside - the bounding box. - - Node lines which are extensions of linedefs whose vertices are - on the boundary of the bounding box, are therefore preferable, - as long as the number of sectors referenced on either side is - not too unbalanced. - - Contrary to what many say, visplane overflows are not simply - caused by too many sidedefs, linedefs, light levels, etc. All - of those factors are correlated with visplane overflows, but - most importantly, so is how the node builder selects node - lines. The number of visible changes in flats is the main - cause of visplane overflows, with visible changes not being - counted if only invisible regions separate the visible areas. -*/ - -static struct Seg *PickNode_visplane(struct Seg *ts) -{ - struct Seg *best=NULL; - long bestcost=LONG_MAX; - struct Seg *part; - int cnt=0; - - for (part=ts;part;part=part->next) /* Count once and for all */ - cnt++; - - FindLimits(ts); - - for (part=ts;part;part=part->next) /* Use each Seg as partition*/ - { - struct Seg *check; - long cost=0,slen=0; - int tot=0,diff=cnt; - memset(SectorHits,0,num_sects); - progress(); /* Something for the user to look at.*/ - - for (check=ts;check;check=check->next) /* Check partition against all Segs*/ - { - /* get state of lines' relation to each other */ - long a = part->pdy * check->psx - part->pdx * check->psy + part->ptmp; - long b = part->pdy * check->pex - part->pdx * check->pey + part->ptmp; - unsigned char mask=2; - - if ((a^b) < 0) - if (a && b) - { /* Line is split; a,b nonzero, opposite sign */ - long l=check->len; - long d=(l*a)/(a-b); /* Distance from start of intersection */ - if (d>=2) - { - /* If the linedef associated with this seg has a sector tag >= 900, - treat it as precious; i.e. don't split it unless all other options - are exhausted. This is used to protect deep water and invisible - lifts/stairs from being messed up accidentally by splits. */ - - if (linedefs[check->linedef].tag >= 900) - cost += factor*64; - - cost += factor; - - if (cost > bestcost) /* This is the heart of my pruning idea - */ - goto prune; /* it catches bad segs early on. Killough */ - - tot++; /* Seg is clearly split */ - mask=4; - } - else /* Distance from start < 2; check distance from end */ - if (l-d<2 ? check->pdx*part->pdx+check->pdy*part->pdy<0 : b<0) - goto leftside; - } - else - goto leftside; - else - if (a<=0 && (a || (!b && (slen+=check->len, - check->pdx*part->pdx+check->pdy*part->pdy<0)))) - { - leftside: - diff-=2; - mask=1; - } - SectorHits[check->sector] |= mask; - } - - if ((diff-=tot) < 0) /* Take absolute value. diff is being used to obtain the */ - diff= -diff; /* min/max values by way of: min(a,b)=(a+b-abs(a-b))/2 */ - - /* Make sure at least one Seg is on each side of the partition*/ - - if (tot+cnt <= diff) - continue; - - /* Compute difference in number of sector - references on each side of node line */ - - for (diff=tot=0;tot= bestcost) - continue; - - /* If the node line is incident with SEGS in less than 1/2th of its - length inside the bounding box, increase the cost since this is - likely a node line cutting across a large room but only sharing - space with a tiny SEG in the middle -- this is another contributor - to visplane overflows. */ - - { - long l; - if (!part->pdx) - l=lmaxy-lminy; - else - if (!part->pdy) - l=lmaxx-lminx; - else - { - double t1=(part->psx-lmaxx)/(double) part->pdx; - double t2=(part->psx-lminx)/(double) part->pdx; - double t3=(part->psy-lmaxy)/(double) part->pdy; - double t4=(part->psy-lminy)/(double) part->pdy; - if (part->pdx>0) - { - double t=t1; - t1=t2; - t2=t; - } - if (part->pdy>0) - { - double t=t3; - t3=t4; - t4=t; - } - l=((t1 > t3 ? t3 : t1) - (t2 < t4 ? t4 : t2))*part->len; - } - if (slen < l && (cost+=factor) >= bestcost) - continue; - } - - /* We have a new better choice */ - - bestcost = cost; - best = part; /* Remember which Seg*/ - prune:; /* Early exit and skip past the tests above */ - } - return best; /* All finished, return best Seg*/ -} - -struct halfplane { - long pdx,pdy,ptmp; -}; - -struct triangle { - long pdx1,pdy1,ptmp1; - long pdx2,pdy2,ptmp2; - long pdx3,pdy3,ptmp3; -}; - -struct polygon { - struct triangle tri; - long pdx1,pdy1,pdz1,ptmp1; - long pdx2,pdy2,pdz2,ptmp2; -}; - -struct view { - long pdx,pdy,ptmp; /* Used for 90 degree vertical view */ - double distr; - long x,y,z; /* Position */ - unsigned angle; /* Angle 0-65535 */ - const struct Pseg *ps; /* Seg the player is looking from */ - int sector; /* Sector player is in */ - void (*func)(int, struct view *); /* Function used in BSP traversal */ - int polarity; /* 1=back-to-front, 0=front-to-back traversal */ - struct triangle *poly; /* Polygon limiting all visible areas */ - int num_poly,num_poly_alloc; - struct halfplane *convex_hull; /* Convex hull limiting all visible areas */ - int num_convex_hull,num_convex_hull_alloc; - struct polygon *poly_3d; /* Polygon limiting floors & ceilings */ - int num_poly_3d,num_poly_3d_alloc; - unsigned char *hitlist; /* Used in searching algorithms */ - int visplanes; /* Visplane count */ - int max_visplanes,max_visplanes_linedef,max_visplanes_sector; - int start_markers; -}; - -static struct sector_limit { - struct { - long min,max; - short moves; - } floorh,ceilh; -} *sector_limits; - -static int light_changes(int type) -{ - return (type>=1 && type<=4) || type==8 || type==12 || type==13 || type==17; -} - -/* Whether two sectors' lighting is similar. - - Note: I've observed that even though lighting can only - be seen in multiples of 8, visplane overflows can be - caused by any difference in lighting, even if it's not - visible. killough */ - -static int lighting_similar(const struct Sector *s1, const struct Sector *s2) -{ - return - s1==s2 || - ( /* If initial lighting same, and tags are same */ - s1->light==s2->light && s1->tag==s2->tag - && - ( /* And both are the same synchronized lighting */ - (s1->special==s2->special && (s1->special==12 || s1->special==13)) - || /* Or neither one changes in lighting based on sector type */ - (!light_changes(s1->special) && !light_changes(s2->special)) - ) - ) - ; -} - -static int floor_similar(const struct Sector *s1, const struct Sector *s2) -{ - return s1==s2 || - (!strncmp(s1->floort,s2->floort,8) && (!strncmp(s1->floort,"F_SKY1",8) || - (s1->floorh==s2->floorh && (s1->tag==s2->tag || - (!sector_limits[s1-sectors].floorh.moves && - !sector_limits[s2-sectors].floorh.moves ))))); -} - -static int ceil_similar(const struct Sector *s1, const struct Sector *s2) -{ - return s1==s2 || - (!strncmp(s1->ceilt,s2->ceilt,8) && (!strncmp(s1->ceilt,"F_SKY1",8) || - (s1->ceilh==s2->ceilh && (s1->tag==s2->tag || - (!sector_limits[s1-sectors].ceilh.moves && - !sector_limits[s2-sectors].ceilh.moves ))))); -} - -/* Find blocking linedefs and create polygons representing view. - - This is perhaps the most important function. For each ssector - whose bounding box is contained within the convex hull of the - visibilty region, all segs in the ssector are examined and - any segs that face the viewer have their linedefs analyzed - for visibility-blocking properties. - - 4 structures are maintained for the view: - - A 2-d convex hull of the visible region - A set of 2-d triangles for 1s linedefs blocking visibility - A set of halfplanes for 2s linedefs blocking visibility - Two 3-d halfplanes limiting the player's vertical visibility - - Having these separate structures allows greater - optimization due to the 2-d nature of Doom. -*/ - -static void add_blocking_linedefs(int ss, struct view *v) -{ - const struct Pseg *ps=psegs+ssectors[ss].first; - int num; - - /* Go through every seg in the ssector and if the seg is facing - at all towards the player, and if its associated linedef has - not been seen before, process the linedef for its effect on - the view. - - This is more complicated, but faster, than going through all - linedefs once, since it allows us to skip entire ssectors and - nodes which are not in the player's view. - */ - - for (num=ssectors[ss].num;num--;ps++) - if (!v->hitlist[ps->linedef]) - { - const struct LineDef *l = ps->linedef+linedefs; - long psx=vertices[ps->flip ? l->end : l->start].x; - long psy=vertices[ps->flip ? l->end : l->start].y; - long pex=vertices[ps->flip ? l->start : l->end].x; - long pey=vertices[ps->flip ? l->start : l->end].y; - long pdx=pex-psx,pdy=pey-psy; - - if ((psx-v->x)*pdy < (psy-v->y)*pdx) - { /* Only consider segs facing towards player */ - struct triangle *tri; - - v->hitlist[ps->linedef]=1; /* Mark linedef as having been seen */ - - /* If a linedef does not have the 2s flag set, then regardless of - whether it has a second sidedef, it cannot be seen through. It - may be shot through with projectiles (rockets, plasma, monster - fire), but not bullets. Monsters cannot see through it either, - and will not intentionally attack through it, although they can - walk and hear through it, and fire through it if they fire at a - thing they can see which is in the same direction. killough */ - - if (!(l->flags & 4)) - { - struct halfplane *ch; - int num,start_is_out; - -onesided: - num=v->num_convex_hull; - start_is_out=0; - ch=v->convex_hull; - - /* If the starting and ending vertices are both outside any single - halfplane, ignore the line completely. */ - - do - if (ch->pdx*psy - ch->pdy*psx > ch->ptmp) /* Start */ - { - if (ch->pdx*pey - ch->pdy*pex > ch->ptmp) /* End */ - goto skip; - else - start_is_out=1; /* Mark starting vertex as outside */ - } - while (ch++,--num); - - /* If the starting and vertices are both outside of the convex hull, - but are not both outside of any single halfplane, then add the - line to the convex hull. */ - - if (start_is_out) - { /* Starting vertex is outside convex hull; check ending vertex */ - ch=v->convex_hull; - num=v->num_convex_hull; - do /* If ending vertex is outside of convex hull */ - if (ch->pdx*pey - ch->pdy*pex > ch->ptmp) - { /* Add the line to convex hull */ - - /* Add the extension of the linedef to the convex hull. - If it is totally outside of the convex hull, it has - no effect since the viewer is always inside its - halfplane. If it cuts across the convex hull, then - it restricts the visible area some more. */ - - if (v->num_convex_hull >= v->num_convex_hull_alloc) - v->convex_hull = ResizeMemory(v->convex_hull, - (v->num_convex_hull_alloc*=2)*sizeof(*v->convex_hull)); - ch=v->convex_hull+v->num_convex_hull++; - ch->ptmp=(ch->pdx=pdx)*psy-(ch->pdy=pdy)*psx; - goto skip; /* Skip to next seg */ - } - while (ch++,--num); - } - - /* At least one vertex is inside convex hull; add - triangle between viewer and linedef to polygon - (eye clipping could be used, to remove parts of - the triangle that have no effect, but I prefer - to stay simple). */ - - if (v->num_poly >= v->num_poly_alloc) - v->poly = ResizeMemory(v->poly, - (v->num_poly_alloc=v->num_poly_alloc*2+2)* - sizeof(*v->poly)); - tri = v->poly+v->num_poly++; - } - else /* Line is 2s, possibly see-through depending on sector heights */ - { - int s1 = sidedefs[ps->flip ? l->sidedef2 : l->sidedef1].sector; /* front */ - int s2 = sidedefs[ps->flip ? l->sidedef1 : l->sidedef2].sector; /* back */ - const long *lower_blocks=NULL, *upper_blocks=NULL; - - if (s1==s2) /* Skip linedefs with the same sector on both sides */ - goto skip; - - if (sector_limits[s2].floorh.min >= sector_limits[s2].ceilh.max) - goto onesided; /* If floor always touches ceiling, treat as 1s */ - - if (sector_limits[s1].floorh.min < sector_limits[s2].floorh.min) - lower_blocks=§or_limits[s2].floorh.min; - - if (sector_limits[s1].ceilh.max > sector_limits[s2].ceilh.max) - upper_blocks=§or_limits[s2].ceilh.max; - - if (!lower_blocks && !upper_blocks) - goto skip; /* Neither upper nor lower texture blocks */ - - /* Allocate a new 3d polygon to represent the view halfplanes */ - - if (v->num_poly_3d >= v->num_poly_3d_alloc) - v->poly_3d = ResizeMemory(v->poly_3d, - (v->num_poly_3d_alloc=v->num_poly_3d_alloc*2+1) * - sizeof(*v->poly_3d)); - - { - struct polygon *p = v->poly_3d + v->num_poly_3d++; - - long t1,t2=(t1=v->x*pdy+(psy-v->y)*pex+(v->y-pey)*psx)*v->z; - - /* Where to put triangle between player and linedef (irrespective of z) */ - - tri = &p->tri; - - /* Everything above triangle between the higher of the - two sectors' floors and the viewer is unblocked */ - - if (lower_blocks) - { - p->pdz1=t1; - p->ptmp1=(p->pdx1=(*lower_blocks-v->z)*pdy)*v->x+ - (p->pdy1=(v->z-*lower_blocks)*pdx)*v->y+t2; - - /* Everything below triangle between the lower of the - two sectors' ceilings and the viewer is unblocked */ - - if (upper_blocks) - { - p->pdz2= -t1; - p->ptmp2=(p->pdx2=(v->z-*upper_blocks)*pdy)*v->x+ - (p->pdy2=(*upper_blocks-v->z)*pdx)*v->y-t2; - } - else - p->ptmp2=p->pdx2=p->pdy2=p->pdz2=0; - } - else /* Lower texture does not block => upper blocks */ - { - /* Everything below triangle between the lower of the - two sectors' ceilings and the viewer is unblocked - (put in first entry for performance) */ - - p->pdz1= -t1; - p->ptmp1=(p->pdx1=(v->z-*upper_blocks)*pdy)*v->x+ - (p->pdy1=(*upper_blocks-v->z)*pdx)*v->y-t2; - p->ptmp2=p->pdx2=p->pdy2=p->pdz2=0; - } - } - } - - /* We form a triangle between the viewer and the linedef, - to indicate anything behind it is blocked (unless it's - in the visible area between two planes formed between - the viewer and the floor and ceiling, in which case the - linedef is 2s and this is part of a larger disjunction). */ - - /* Everything to the right of the linedef is unblocked */ - - tri->ptmp1 = (tri->pdx1=pdx )*psy-(tri->pdy1=pdy )*psx; - - /* Everything to the right of line between start and viewer is unblocked */ - - tri->ptmp2 = (tri->pdx2=v->x-psx)*psy-(tri->pdy2=v->y-psy)*psx; - - /* Everything to the right of line between viewer and end is unblocked */ - - tri->ptmp3 = (tri->pdx3=pex-v->x)*pey-(tri->pdy3=pey-v->y)*pex; - } -skip:; - } -} - -enum {FLOOR=1, CEILING=2}; - -/* Whether a seg is visible in the current view, at the heights indicated - by the sector. 0=totally invisible, 1=floor visible, 2=ceiling visible, - 3=both visible. Only the right side of a seg is considered, so if a - seg is incident with a closed halfplane, its right side must face - into the halfplane. - - Note: this is just an approximation; the exact way to tell visibility - is to compute the area of the intersection of the polygon and the - triangle between the viewer and the seg, which is more difficult. */ - -static int seg_is_visible(const struct Pseg *ps, - const struct Sector *sector, - const struct view *v) -{ - long psx=vertices[ps->start].x; - long psy=vertices[ps->start].y; - long pex=vertices[ps->end].x; - long pey=vertices[ps->end].y; - long pdx=pex-psx,pdy=pey-psy; /* (dx,dy) vector */ - - if ((psx-v->x)*pdy >= (psy-v->y)*pdx) /* backface cull */ - return 0; - else - { - int floorh=sector->floorh, ceilh=sector->ceilh; - int floor_blocked, ceil_blocked; - - /* Player's 90-degree vertical camera angle. - Limits how far up and down a player can see. */ - - { - long s=v->pdy*psx-v->pdx*psy-v->ptmp; - long e=v->pdy*pex-v->pdx*pey-v->ptmp; - double t; - if (e>s) - s=e; - if (s<0) - return 0; - t=s*v->distr; - floor_blocked = (e=v->z-floorh) > t || -e > t; - ceil_blocked = (e=v->z-ceilh) > t || -e > t; - if (floor_blocked && ceil_blocked) - return 0; - } - - /* If the starting or ending vertices are inside a 2-halfplane, - then the seg is at least partially inside the 2-halfplane. - If they are both incident to the 2-halfplane then one side - of the seg is inside the 2-halfplane and the other is not, - as determined by the dot product. Otherwise (if one vertex - is outside of the 2-halfplane and the other is outside or - incident to it), the seg is totally outside of the - 2-halfplane. We are only interested in whether the right - side is in the 2-halfplane. */ - - { - struct halfplane *ch=v->convex_hull; - int i=v->num_convex_hull; - do - { - long s,e; - if ( (s=ch->pdx*psy-ch->pdy*psx-ch->ptmp) >=0 && - (e=ch->pdx*pey-ch->pdy*pex-ch->ptmp) >=0 && - (e || s || ch->pdx*pdx+ch->pdy*pdy<0) ) - return 0; - ch++; - } - while (--i); - } - - /* Same as above, except that each triangle is an union - (OR) of three 2-halfplanes, and so if the seg is inside - any one of them it is considered unblocked. */ - - { - int i=v->num_poly; - if (i) - { - struct triangle *tri=v->poly; - do - { - long s1,e1,s2,e2,s3,e3; - if ( (s1=tri->pdx1*psy-tri->pdy1*psx-tri->ptmp1) >=0 && - (e1=tri->pdx1*pey-tri->pdy1*pex-tri->ptmp1) >=0 && - (s2=tri->pdx2*psy-tri->pdy2*psx-tri->ptmp2) >=0 && - (e2=tri->pdx2*pey-tri->pdy2*pex-tri->ptmp2) >=0 && - (s3=tri->pdx3*psy-tri->pdy3*psx-tri->ptmp3) >=0 && - (e3=tri->pdx3*pey-tri->pdy3*pex-tri->ptmp3) >=0 && - (e3 || s3 || tri->pdx3*pdx+tri->pdy3*pdy < 0) && - (e2 || s2 || tri->pdx2*pdx+tri->pdy2*pdy < 0) && - (e1 || s1 || tri->pdx1*pdx+tri->pdy1*pdy < 0) ) - return 0; - tri++; - } - while (--i); - } - } - - { - register struct polygon *p=v->poly_3d; - int i; - - for (i=v->num_poly_3d;i--;p++) - { - long s1,e1,s2,e2,s3,e3; - if ( (s1=p->tri.pdx1*psy-p->tri.pdy1*psx-p->tri.ptmp1) >= 0 && - (e1=p->tri.pdx1*pey-p->tri.pdy1*pex-p->tri.ptmp1) >= 0 && - (s2=p->tri.pdx2*psy-p->tri.pdy2*psx-p->tri.ptmp2) >= 0 && - (e2=p->tri.pdx2*pey-p->tri.pdy2*pex-p->tri.ptmp2) >= 0 && - (s3=p->tri.pdx3*psy-p->tri.pdy3*psx-p->tri.ptmp3) >= 0 && - (e3=p->tri.pdx3*pey-p->tri.pdy3*pex-p->tri.ptmp3) >= 0 && - (e3 || s3 || p->tri.pdx3*pdx+p->tri.pdy3*pdy < 0) && - (e2 || s2 || p->tri.pdx2*pdx+p->tri.pdy2*pdy < 0) && - (e1 || s1 || p->tri.pdx1*pdx+p->tri.pdy1*pdy < 0) ) - { - long as=p->pdx1*psx+p->pdy1*psy-p->ptmp1; - long ae=p->pdx1*pex+p->pdy1*pey-p->ptmp1; - long bs=p->pdx2*psx+p->pdy2*psy-p->ptmp2; - long be=p->pdx2*pex+p->pdy2*pey-p->ptmp2; - long dotax=p->pdx1*pdy, dotay=p->pdy1*pdx; - long dotbx=p->pdx2*pdy, dotby=p->pdy2*pdy; - register long t; - if (!floor_blocked && (((t=p->pdz1*floorh)+as<=0 && t+ae<=0 && - (t+ae || t+as || dotaxpdz2*floorh)+bs<=0 && t+be<=0 && - (t+be || t+bs || dotbxpdz1*ceilh)+as<=0 && t+ae<=0 && - (t+ae || t+as || dotaxpdz2*ceilh)+bs<=0 && t+be<=0 && - (t+be || t+bs || dotbxnum_convex_hull; - const struct halfplane *p=v->convex_hull; - do - { - long t1,t2,t3; - if ( (t1=p->pdx*maxy-p->ptmp) > (t2=p->pdy*minx) && - (t3=p->pdy*maxx) < t1 && - (t1=p->pdx*miny-p->ptmp) > t3 && - t1 > t2) - return FALSE; - p++; - } - while (--i); - return TRUE; -} - -/* This is the main BSP traversal. We find the viewer's position - by doing a binary search for the viewer's ssector. We process - it first, and then go back up the BSP tree after processing - the parent node's other child. Each time we reach a node, we - decide whether to render the left child first or the right - child first depending on the viewer's position w.r.t. that - node's line. This is essentially an inorder traversal of the - BSP tree. If the bounding box for a node or a ssector is - totally invisible based on the (possibly dynamic) convex - hull, we skip it, which is the main performance boost. killough */ - -static void bsp_traverse(const struct Node *tn, struct view *v) -{ - int lr=(tn->dx*v->y-tn->dy*v->x > tn->ptmp) ^ v->polarity; - if (lr) - goto leftside; - do - { - if (box_is_visible(tn->minx1,tn->miny1,tn->maxx1,tn->maxy1,v)) - { - if (tn->nextr) /* Process only if bounding box is visible */ - bsp_traverse(tn->nextr,v); - else /* Process right side */ - v->func(tn->chright,v); - } - if (lr) break; - -leftside: - if (box_is_visible(tn->minx2,tn->miny2,tn->maxx2,tn->maxy2,v)) - { - if (tn->nextl) /* Process only if bounding box is visible */ - bsp_traverse(tn->nextl,v); - else /* Process left side */ - v->func(tn->chleft,v); - } - } - while (lr); -} - -/* We compute the player's view, limited by left and right side - lines that are 90 degrees apart and centered at the player's - angle, and by planes 45 degrees above and below. */ - -static int setup_view(struct view *v, const struct Pseg *ps, const double *adj) -{ /* Compute the player's view to be */ - long psx=vertices[ps->start].x; /* Looking away from the seg, into */ - long psy=vertices[ps->start].y; /* the corresponding ssector. */ - long pdx=vertices[ps->end].x-psx; - long pdy=vertices[ps->end].y-psy; - - v->sector=sidedefs[ps->flip ? linedefs[ps->linedef].sidedef2 : - linedefs[ps->linedef].sidedef1].sector; - - v->ps=ps; - - v->x=(psx*2+pdx)/2; /* Midpoint */ - v->y=(psy*2+pdy)/2; - - v->z=sectors[v->sector].floorh+48; /* Player sees 48 units above floor level */ - - { - long temp=pdx*adj[0]+pdy*adj[1]; - pdx=pdx*adj[1]-pdy*adj[0]; - pdy=temp; - } - if (!pdy && !pdx) return 0; - v->angle=ComputeAngle(pdx,pdy); - - if (v->num_convex_hull_alloc<2) - { - v->num_convex_hull_alloc=2; - v->convex_hull = ResizeMemory(v->convex_hull,2*sizeof(*v->convex_hull)); - } - - v->num_convex_hull=2; - - v->convex_hull[0].ptmp=(v->convex_hull[0].pdx=pdy+pdx)*v->y- - (v->convex_hull[0].pdy=pdy-pdx)*v->x; - - v->convex_hull[1].ptmp=(v->convex_hull[1].pdx=pdx-pdy)*v->y- - (v->convex_hull[1].pdy=pdy+pdx)*v->x; - - v->num_poly_3d=v->num_poly=0; - - v->ptmp=pdy*psx-pdx*psy; - v->distr=1.618/sqrt((double) pdy*pdy + (double) pdx*pdx); - v->pdx=pdx; - v->pdy=pdy; - - /* No visplanes initially */ - v->visplanes=0; - return 1; -} - -static void R_DrawPlanes(int ss, struct view *v) -{ - const struct Pseg *ps=ssectors[ss].first+psegs; /* First seg in ssector */ - - /* The first seg in an ssector determines which sector describes its flats */ - - const struct Sector *sector=sectors+sidedefs[ps->flip ? - linedefs[ps->linedef].sidedef2 : - linedefs[ps->linedef].sidedef1 ].sector; - int num; - - for (num=ssectors[ss].num;num--;ps++) - { - if ((ps->angle-v->angle) & 0x8000) /* Backface cull the way Doom does it */ - { - const struct LineDef *l=linedefs+ps->linedef; /* linedef this seg's along */ - if (l->flags & 4) /* If linedef is 2s */ - { - const struct Sector *s1=sectors+sidedefs[l->sidedef1].sector; - const struct Sector *s2=sectors+sidedefs[l->sidedef2].sector; - - if (s1!=s2) /* If same sector, ignore */ - { - unsigned vp_mask = ~(v->hitlist[s1-sectors] & v->hitlist[s2-sectors]) & (FLOOR | CEILING); - - if (vp_mask) - { - - /* If a 2s linedef has identical floor or ceiling properties on - either side of it, then a new triangle is not drawn for it - (in the respective floor or ceiling), even if the two sectors - on either side of it are not the same sector. This is well-known - to those who have constructed invisible platforms or deep water. - Note that neither of these two sectors is necessarily the one - that governs flats drawing for this seg, if it is drawn at all -- - that is controlled by the sector of the first seg in the ssector. */ - - if (lighting_similar(s1,s2)) /* If lighting is similar */ - { - if (floor_similar(s1,s2)) /* If floor is similar */ - vp_mask &= ~FLOOR; /* Then ignore floor */ - if (ceil_similar(s1,s2)) /* If ceiling is similar */ - vp_mask &= ~CEILING; /* Then ignore ceiling */ - } - - if (vp_mask) - { - vp_mask &= seg_is_visible(ps, sector, v); - v->hitlist[s1-sectors] |= vp_mask; - v->hitlist[s2-sectors] |= vp_mask; - if (vp_mask & FLOOR) - v->visplanes++; - if (vp_mask & CEILING) - v->visplanes++; - } - } - } - } - } - } -} - -static int visplanes(const struct Node *tn, const struct Pseg *ps, struct view *v) -{ - int maxvp=INT_MIN,i; - double adj[][2]={{0,1},{-.7071067812,.7071067812}, - {.7071067812,.7071067812}}; - - for (i=0;ihitlist, 0, num_lines); - - /* Form the polygons that define the current view */ - - v->func=add_blocking_linedefs; - v->polarity=0; /* front-to-back */ - bsp_traverse(tn, v); - - /* Find the segs which are visible in the current view */ - v->polarity=1; /* back-to-front */ - v->func=R_DrawPlanes; - - memset(v->hitlist, 0, num_sects); - - bsp_traverse(tn, v); - - if (v->visplanes > maxvp) - maxvp=v->visplanes; - } - - if (maxvp > v->max_visplanes) - { - v->max_visplanes=maxvp; - v->max_visplanes_sector=v->sector; - v->max_visplanes_linedef=v->ps->linedef; - } - - return maxvp; -} - - -static void init_view(struct view *v) -{ - v->hitlist = GetMemory(num_sects > num_lines ? num_sects : num_lines); - v->max_visplanes=INT_MIN; - v->start_markers=num_things; -} - -/* Clean up view. */ - -static void free_view(struct view *v) -{ - free(v->convex_hull); - free(v->poly); - free(v->poly_3d); - free(v->hitlist); - - v->hitlist=NULL; - v->convex_hull=NULL; - v->poly=NULL; - v->poly_3d=NULL; - - v->num_convex_hull= - v->num_convex_hull_alloc= - v->num_poly= - v->num_poly_alloc= - v->num_poly_3d= - v->num_poly_3d_alloc= - 0; -} - -static void raise_ceil(int s, int depth) -{ - int i; - long l=LONG_MAX; - sector_limits[s].ceilh.moves=1; - for (i=0;i sector_limits[s].ceilh.max) - sector_limits[s].ceilh.max=l; -} - -static void lower_floor(int s) -{ - int i; - long l=LONG_MAX; - sector_limits[s].floorh.moves=1; - for (i=0;il) - l=sectors[s2].floorh; - } - if (l > LONG_MIN && (l+=depth) < sector_limits[s].floorh.min) - sector_limits[s].floorh.min=l; -} - -static void build_stairs(int s, int step, int h) -{ - int k; - -top: - if ((h+=step) < sector_limits[s].floorh.min) - sector_limits[s].floorh.min=h; - sector_limits[s].floorh.moves=3; - for (k=0;k= 0) /* normal door open */ - raise_ceil(sidedefs[linedefs[i].sidedef2].sector,4); - break; - case 4: case 29: case 90: case 63: - case 2: case 103: case 86: case 61: case 108: - case 111: case 105: case 114: case 109: case 112: - case 106: case 115: case 133: case 99: case 135: - case 134: case 136: case 137: case 40: - for (j=0;j=100 ? 16 : 8,sector_limits[j].floorh.min); - break; - - case 3: case 50: case 75: case 42: case 16: case 76: - case 110: case 113: case 107: case 116: case 41: - case 43: case 44: case 49: case 72: case 6: case 25: - case 73: case 77: case 141: - for (j=0;jstart_markers; - struct Thing *tp=things+i; - for (;ix-tp->xpos; - long dy=v->y-tp->ypos; - if (dx<0) dx=-dx; - if (dy<0) dy=-dy; - if (dx<=64 && dy<=64) return; - } - things = ResizeMemory(things,(num_things+1)*sizeof(*things)); - tp=things + num_things++; - tp->xpos=v->x; - tp->ypos=v->y; - tp->angle=(unsigned)(v->angle*(1.0/8192.0))*45; - tp->type=1; /* player 1 start (voodoo doll) */ - tp->when=7; /* all levels */ -} - -#define VPOF_MAX_SECTOR 2 /* Maximum number of visplane warnings per sector */ - -void warn_visplanes(const struct Node *tn) -{ - static struct view v; - int i; - unsigned char *sector_vp_hitlist=NULL; - - puts("\nLooking for visplane overflows\n"); - - sector_limits=GetMemory(num_sects*sizeof(*sector_limits)); - - find_sector_limits(); - - init_view(&v); - - for (i=0;ithreshold) - { - int sector=sidedefs[psegs[i].flip ? linedefs[l].sidedef2 : - linedefs[l].sidedef1 ].sector; - if (mark_visplanes) - mark_visplane(&v); - if (!sector_vp_hitlist) - memset( (sector_vp_hitlist = GetMemory(num_sects)), 0, num_sects); - - if (sector_vp_hitlist[sector] <= VPOF_MAX_SECTOR) - { - if (sector_vp_hitlist[sector]++ < VPOF_MAX_SECTOR) - { - printf( - "Warning: VPOF (%d) near linedef %4d, sector %d, (%ld,%ld) angle %d\n", - vp, l, sector, v.x, v.y, (int)(v.angle*(360.0/65536.0)+.5) - ); - } - else - printf("Further visplane overflow warnings suppressed in sector %d\n",sector); - } - } - } - printf(" \nMaximum number of visplanes=%d, near linedef %d, sector %d\n", - v.max_visplanes, v.max_visplanes_linedef, v.max_visplanes_sector); - free(sector_vp_hitlist); - free(sector_limits); - sector_limits=NULL; - free_view(&v); /* Free the view structures */ -} diff -uaNr yadex-1.5.2/bsp-2.3/structs.h yadex-1.6.0/bsp-2.3/structs.h --- yadex-1.5.2/bsp-2.3/structs.h 1998-12-19 13:18:16.000000000 +0100 +++ yadex-1.6.0/bsp-2.3/structs.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,130 +0,0 @@ -/*- Doom Structures .. Colin Reed 1994 -------------------------------------*/ - -struct wad_header /* Linked wad files list.*/ -{ - char type[4]; - long int num_entries; - long int dir_start; -}; - -struct directory /* The directory entry header*/ -{ - long int start; - long int length; - char name[8]; -}; - -struct Block -{ - short minx; - short miny; - short xblocks; - short yblocks; -}; - -/*- The level structures ---------------------------------------------------*/ - -struct Thing -{ - short xpos; /* x position */ - short ypos; /* y position */ - short angle; /* facing angle */ - short type; /* thing type */ - short when; /* appears when? */ -}; - -struct Vertex -{ - short int x; /* X coordinate */ - short int y; /* Y coordinate */ -}; - -struct LineDef -{ - short int start; /* from this vertex ... */ - short int end; /* ... to this vertex */ - short int flags; /* see NAMES.C for more info */ - short int type; /* see NAMES.C for more info */ - short int tag; /* crossing this linedef activates the sector with the same tag */ - short int sidedef1; /* sidedef */ - short int sidedef2; /* only if this line adjoins 2 sectors */ -}; - -struct SideDef -{ - short int xoff; /* X offset for texture */ - short int yoff; /* Y offset for texture */ - char tex1[8]; /* texture name for the part above */ - char tex2[8]; /* texture name for the part below */ - char tex3[8]; /* texture name for the regular part */ - short int sector; /* adjacent sector */ -}; - -struct Sector -{ - short int floorh; /* floor height */ - short int ceilh; /* ceiling height */ - char floort[8];/* floor texture */ - char ceilt[8]; /* ceiling texture */ - short int light; /* light level (0-255) */ - short int special; /* special behaviour (0 = normal, 9 = secret, ...) */ - short int tag; /* sector activated by a linedef with the same tag */ -}; - -/*--------------------------------------------------------------------------*/ -/* These are the structure used for creating the NODE bsp tree. */ -/*--------------------------------------------------------------------------*/ - -struct Seg -{ - short int start; /* from this vertex ... */ - short int end; /* ... to this vertex */ - unsigned short angle;/* angle (0 = east, 16384 = north, ...) */ - short int linedef; /* linedef that this seg goes along*/ - short int flip; /* true if not the same direction as linedef */ - unsigned short dist; /* distance from starting point */ - struct Seg *next; - short psx,psy,pex,pey; /* Start, end coordinates */ - long pdx,pdy,ptmp; /* Used in intersection calculations */ - long len; - short sector; -}; - -struct Pseg -{ - short int start; /* from this vertex ... */ - short int end; /* ... to this vertex */ - unsigned short angle;/* angle (0 = east, 16384 = north, ...) */ - short int linedef; /* linedef that this seg goes along*/ - short int flip; /* true if not the same direction as linedef */ - unsigned short dist; /* distance from starting point */ -}; - -struct Node -{ - short int x, y; /* starting point*/ - short int dx, dy; /* offset to ending point*/ - short int maxy1, miny1, minx1, maxx1; /* bounding rectangle 1*/ - short int maxy2, miny2, minx2, maxx2; /* bounding rectangle 2*/ - short int chright, chleft; /* Node or SSector (if high bit is set)*/ - struct Node *nextr,*nextl; - short int node_num; /* starting at 0 (but reversed when done)*/ - long ptmp; -}; - -struct Pnode -{ - short int x, y; /* starting point*/ - short int dx, dy; /* offset to ending point*/ - short int maxy1, miny1, minx1, maxx1; /* bounding rectangle 1*/ - short int maxy2, miny2, minx2, maxx2; /* bounding rectangle 2*/ - short int chright, chleft; /* Node or SSector (if high bit is set)*/ -}; - -struct SSector -{ - short int num; /* number of Segs in this Sub-Sector */ - short int first; /* first Seg */ -}; - -/*--------------------------------------------------------------------------*/ diff -uaNr yadex-1.5.2/bsp-2.3/transdor.wad yadex-1.6.0/bsp-2.3/transdor.wad --- yadex-1.5.2/bsp-2.3/transdor.wad 1998-12-19 13:19:41.000000000 +0100 +++ yadex-1.6.0/bsp-2.3/transdor.wad 1970-01-01 01:00:00.000000000 +0100 @@ -1,19 +0,0 @@ -PWADd@@Zÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿ -ÿÿ  ÿÿ -  ÿÿ -ÿÿ ÿÿ ÿÿ ÿÿÿÿ ÿÿ--WOOD1--WOOD1--WOOD1--WOOD1-----WOOD1--WOOD1€--MIDGRATE€--MIDGRATE--WOOD1--WOOD1-----GSTONE1--GSTONE1--GSTONE1--GSTONE1--GSTONE1--GSTONE1--GSTONE1--GSTONE1Àþ€ÀþÀÀ€ÀþPÀPÀþ@À@€€€€€ý€€ýþþ€ @ €ÿ¿  @ - - € -ÿ¿  ÿ¿@€ @€ÿ¿ ÿ¿@€ Àþ@@ÀþÀP@ÀþÀ€€ÀPý€PÀþÀPÀþÀ€À€Ðþ€ÀþÀ€€€Àþ@€Àþ€€ýþ€€DEM1_5FLOOR7_1 €DEM1_5FLOOR7_1 DEM1_5FLOOR7_1 DEM1_5FLOOR7_1 „€ý LNPTWZ]`cgikmoqtvxz|~ƒ…‡‹–šž¢¦ª±³·»¿ÃÆÈÊÌÎÐÓÕÙÝßáäæèêìîñóõ÷ùûÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿ ÿÿ ÿÿ ÿÿ ÿÿ ÿÿ ÿÿÿÿ - ÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ - ÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ@@Zÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿ -ÿÿ  ÿÿ -  ÿÿ -ÿÿ ÿÿ ÿÿ ÿÿÿÿ ÿÿ--WOOD1--WOOD1--WOOD1--WOOD1-----WOOD1--WOOD1€--MIDGRATE€--MIDGRATE--WOOD1--WOOD1-----GSTONE1--GSTONE1--GSTONE1--GSTONE1--GSTONE1--GSTONE1--GSTONE1--GSTONE1Àþ€ÀþÀÀ€ÀþPÀPÀþ@À@€€€€€ý€€ýþþ€ @ €ÿ¿  @ - - € -ÿ¿  ÿ¿@€ @€ÿ¿ ÿ¿@€ Àþ@@ÀþÀP@ÀþÀ€€ÀPý€PÀþÀPÀþÀ€À€Ðþ€ÀþÀ€€€Àþ@€Àþ€€ýþ€€DEM1_5FLOOR7_1 €DEM1_5FLOOR7_1 DEM1_5FLOOR7_1 DEM1_5FLOOR7_1 „€ý LNPTWZ]`cgikmoqtvxz|~ƒ…‡‹–šž¢¦ª±³·»¿ÃÆÈÊÌÎÐÓÕÙÝßáäæèêìîñóõ÷ùûÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿ ÿÿ ÿÿ ÿÿ ÿÿ ÿÿ ÿÿÿÿ - ÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ - ÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿE1M1 -THINGSüLINEDEFSXSIDEDEFSj@VERTEXESªðSEGSšSSECTORS®pNODEShSECTORS†REJECTˆ0BLOCKMAPMAP01¸ -THINGSÂüLINEDEFS¾XSIDEDEFS @VERTEXESV ðSEGSF SSECTORSZ pNODESÊ hSECTORS2 REJECT4 0BLOCKMAP \ No newline at end of file diff -uaNr yadex-1.5.2/bsp-2.3/ybsp.6 yadex-1.6.0/bsp-2.3/ybsp.6 --- yadex-1.5.2/bsp-2.3/ybsp.6 2000-01-10 17:01:52.000000000 +0100 +++ yadex-1.6.0/bsp-2.3/ybsp.6 1970-01-01 01:00:00.000000000 +0100 @@ -1,146 +0,0 @@ -.TH YBSP 6 1998-02-23 "Yadex $VERSION" - -.SH NAME -ybsp \- node builder for Doom wad files - -.SH SYNOPSIS -\fBybsp\fP [\fIoptions\fP] [\fB\-o \fP\fIfile\fP] \fIfile\fP - -.SH ATTENTION -This (\fBybsp\fP) is BSP 2.3 with the following changes: -.br -- includes man page written by Udo Munk and André Majorel, -.br -- includes automatic disabling of whirling baton if piped, -.br -- includes Colin Phipps' fix for the bugs in bsp23bug.zip, -.br -- renamed to \fBybsp\fP to avoid collision with xwadtools. - -This version of BSP is NOT quite the same as the one that comes -with Xwadtools or the one you would get by compiling bsp23x.zip. -It is not the same as bsp30x.zip either. - -Xwadtools' BSP has the \fB\-noprog\fP option. Zdoom's BSP has -support for Hexen. Yadex's BSP has Colin's bugfix and automatic -disabling of progress indicator. Please bear with us until we -get our acts together and release a common version that includes -all the above (and more ?). - -.SH DESCRIPTION -BSP builds the node and blockmap resources for a level map in -a wad file. Level maps created with level editors and level -compilers won't run without this resources build by a node builder. -The program supports multilevel building, means it automatically -builds the resources for all levels found in the input wad file. -.LP -If the program is used without the \fB\-o\fP option it will create an output -wad file with the name \fBtmp.wad\fP. -.LP -BSP has some special effect features: -.LP -If a linedef has a sector tag >= 900, then it is treated as "precious" -and will not be split unless absolutely necessary. This is good to use -around borders of deep water, invisible stairs, etc. -.LP -Furthermore, just for a grin, if the linedef's tag is 999, then the -sidedef's x-offset set an angle adjustment in degrees to be -applied\(emyou can look straight at a wall, but it might come -right at you on both sides and "stretch". -.LP -BSP supports HOM-free transparent doors. Simply make the sector -referenced by the doortracks have a sector tag of >= 900. No need to -remember sector numbers and type them in on a command line\(emjust use -any sector tag >= 900 to permanently mark the sector special. - -.SH OPTIONS -.TP -.BI "\-factor " number -Changes the cost assigned to seg splits. Factor can be any positive -integer, and the larger the factor, the more costly seg splits are. -A factor of 17 is the default and behaves just like earlier versions -of BSP. -Changing the factor can sometimes prevent visplane overflows in wads. -But then again, some wads have just too many visplane overflows, -experiment with the \fB\-factor\fP option before giving up. -.TP -.B \-noreject -Does not clobber already existing reject map. -.TP -.BI "\-o " file -Write output to \fIfile\fP instead of \fBtmp.wad\fP. -.TP -.BI "\-thold " number -Threshold for visplane overflow. May be used to report -more potential visplane overflows -if the \fB\-vpwarn\fP or \fB\-vpmark\fP options -estimate too few visplanes. Default threshold is 128. -.TP -.B \-vp -Attempts to prevent visplane overflows without loss of detail. Using the -option causes node line picker to choose node lines in a way that is -empirically known to reduce or eliminate visplane overflows. -.TP -.B \-vpmark -Marks visplane overflows with player starts. It's a good idea to write -to a separate output file when using this option! One can use an editor -then, play each alternate player start, and see if each one causes -visplane overflows, and then remove it. Usually no-clipping must be used, -at least to step out of walls, since it inserts player starts without -regards to collisions, and it uses walls as a basis for visplane -calculation. -.TP -.B \-vpwarn -Warns about potential visplane overflows. - -.SH BUGS -Will only work on little endian systems. - -We should integrate Randy Heit's modifications to handle Hexen -format wads. - -.SH AUTHOR -BSP was written by Colin Reed and Lee Killough -(killough@rsn.hp.com). André Majorel did the Unix port and wrote -the man page based on the one written by Udo Munk. Colin Phipps -contributed bug fixes. - -.SH SEE ALSO -.BR idbsp (6), -.BR warm (6), -.BR wreject (6), -.BR xwadtools (6) -.br -The Unofficial Doom Specs by Matthew S Fell. -.br -.B bsp23x.txt -.br -.B http://www.teaser.fr/~amajorel/doom/bsp23bug.zip -.br -.B http://lxdoom.linuxgames.com/notes.html#bsp - -.SH BUGS/ERRORS -This program will \fBNOT\fR built a reject map, it will build a zero-ed one, -where every sector is visible from any other sector, or with the appropriate -option it won't touch an existing reject map. So if this node builder is used -the WAD reject resource should be build with other tools. - -.SH AUTHOR -.B Bsp -was written by Colin Reed and Lee Killough (killough@rsn.hp.com), -based on the node builder included in DEU5 by Raphael Quinet -(Raphael.Quinet@eed.ericsson.se). -.LP -Linux port was done by Andre Majorel (amajorel@teaser.fr). -.LP -Port to other UNIX flavors and some minor modifications by -Udo Munk (um@compuserve.com) -.LP -Big endian support for Solaris SPARC done by Oliver Kraus -(kraus@lw010.e-technik.uni-erlangen.de) -.LP -Disabling progress indicator if stderr redirected done by -Andre Majorel (amajorel@teaser.fr). -.LP -Two bug fixes done by Colin Phipps (cph@lxdoom.linuxgames.com). - diff -uaNr yadex-1.5.2/cache/copyright.man yadex-1.6.0/cache/copyright.man --- yadex-1.5.2/cache/copyright.man 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/cache/copyright.man 2003-03-31 18:58:32.000000000 +0200 @@ -0,0 +1,10 @@ +Parts copyright Andrew Apted 2000-2001, GNU GPL v2 +.br +Parts copyright André Majorel 1997-2003, GNU GPL v2 +.br +Parts copyright Matthew W. Miller 2000, GNU GPL v2 +.br +Parts written by Raphaël Quinet, public domain +.br +Parts written by Brendon Wyber, public domain +.br diff -uaNr yadex-1.5.2/cache/copyright.txt yadex-1.6.0/cache/copyright.txt --- yadex-1.5.2/cache/copyright.txt 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/cache/copyright.txt 2003-03-31 18:58:32.000000000 +0200 @@ -0,0 +1,5 @@ + Parts copyright Andrew Apted 2000-2001, GNU GPL v2 + Parts copyright André Majorel 1997-2003, GNU GPL v2 + Parts copyright Matthew W. Miller 2000, GNU GPL v2 + Parts written by Raphaël Quinet, public domain + Parts written by Brendon Wyber, public domain diff -uaNr yadex-1.5.2/cache/pixlist yadex-1.6.0/cache/pixlist --- yadex-1.5.2/cache/pixlist 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/cache/pixlist 2003-04-01 00:00:01.000000000 +0200 @@ -0,0 +1,18 @@ +002f2f.png +E1.png +E2.png +e1.png +e2.png +logo.png +logo_small.png +mirror0.png +mirrorh.png +mirrorv.png +nook1.png +nook2.png +slice1.png +slice2.png +vflat.png +vsprite.png +vtexture.png +yadex1.png diff -uaNr yadex-1.5.2/cache/srcdate yadex-1.6.0/cache/srcdate --- yadex-1.5.2/cache/srcdate 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/cache/srcdate 2003-04-01 00:00:00.000000000 +0200 @@ -0,0 +1 @@ +2003-04-01 \ No newline at end of file diff -uaNr yadex-1.5.2/cache/uptodate yadex-1.6.0/cache/uptodate --- yadex-1.5.2/cache/uptodate 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/cache/uptodate 2003-04-01 00:00:01.000000000 +0200 @@ -0,0 +1 @@ +x diff -uaNr yadex-1.5.2/configure yadex-1.6.0/configure --- yadex-1.5.2/configure 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/configure 2003-03-05 22:09:25.000000000 +0100 @@ -0,0 +1,374 @@ +#!/bin/sh +# +# configure - configure script for Yadex +# AYM 2002-09-15 +# + +# This file is copyright André Majorel 2002-2003. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307, USA. + + +set -e + +APPNAME=yadex +VERSION=`cat VERSION` + +HAVE_GETTIMEOFDAY= +HAVE_NANOSLEEP= +HAVE_SNPRINTF= +HAVE_USLEEP= +INTERFACE=x11 # "bgi" or "x11" +PLATFORM=unix # "dos" or "unix" +PREFIX=/usr/local + + +# +# check - perform a test +# +check () { + cdir=/tmp + cbasename=${APPNAME}_$$.c + cout=${APPNAME}_$$.out + + printf '%s' "$3" >$cdir/$cbasename + printf 'checking %s...' "$1" + if (cd $cdir && cc -c $cbasename >$cout 2>&1) + then + echo " yes" + eval "$2=1" + return 0 + else + echo " no" + sed 's/^/> /' $cdir/$cout + eval "$2=" + return 1 + fi +} + + +# +# genc - generate config.cc +# +genc () { + pathname=$BUILDDIR/config.cc + echo generating $pathname + ( + set -e + echo '// DO NOT EDIT -- generated by ./configure' + echo + echo '#include "config.h"' + echo + echo 'extern const char *yadex_etc_path[] =' + echo '{' + sed 's/\\/\\\\/g; s/"/\\"/g; s/^.*/ "&",/;' $BUILDDIR/config.etc + echo ' 0' + echo '};' + echo + echo 'extern const char *yadex_share_path[] =' + echo '{' + sed 's/\\/\\\\/g; s/"/\\"/g; s/^.*/ "&",/;' $BUILDDIR/config.share + echo ' 0' + echo '};' + echo + ) >$pathname +} + + +# +# genbool - generate a boolean macro definition +# +genbool () { + name=$1 + if [ -n "`eval echo \\$HAVE_"$name"`" ]; then + echo "#define Y_$name" + else + echo "//#define Y_$name" + fi +} + + +# +# genh - generate config.h +# +genh () { + pathname=$BUILDDIR/config.h + echo generating $pathname + ( + set -e + echo '// DO NOT EDIT -- generated by ./configure' + echo + case "$PLATFORM" in + dos) + echo '#define Y_DOS' + echo '//#define Y_UNIX';; + unix) + echo '//#define Y_DOS' + echo '#define Y_UNIX';; + *) + echo "configure: bad \$PLATFORM \"$PLATFORM\"" >&2 + exit 1;; + esac + case "$INTERFACE" in + bgi) + echo '#define Y_BGI' + echo '//#define Y_X11';; + x11) + echo '//#define Y_BGI' + echo '#define Y_X11';; + *) + echo "configure: bad \$INTERFACE \"$INTERFACE\"" >&2 + exit 1;; + esac + genbool GETTIMEOFDAY + genbool NANOSLEEP + genbool SNPRINTF + genbool USLEEP + echo + echo 'extern const char *yadex_etc_path[];' + echo 'extern const char *yadex_share_path[];' + echo + ) >$pathname +} + + + +# +# Parse the command line +# +while [ "$#" -ge 1 ] +do + case "$1" in + --help) + echo "Usage:" + echo " configure --help" + echo " configure --prefix path" + exit 0 + ;; + + --prefix) + shift + if [ "$#" -lt 1 ] + then + echo "configure: --prefix requires an argument" 1>&2 + exit 1 + fi + PREFIX="$1" + ;; + + --prefix=*) # Support the funky GNU syntax + PREFIX=`expr "$1" : '--prefix=\(.*\)'` + ;; + + -*) + echo "configure: bad argument \"$1\"" 1>&2 + exit 1 + ;; + + *) + echo "configure: too many arguments" 1>&2 + exit 1 + esac + shift +done + +# +# Sanity checks +# +if expr "x$PREFIX" : x/ >/dev/null +then + true +else + echo "configure: --prefix: argument is not an absolute path" 1>&2 + exit 1 +fi + +# Solaris /bin/grep doesn't know about -Fx. +GREP=/usr/xpg4/bin/grep +[ -x $GREP ] || GREP=grep + +# +# Do we have a C compiler ? +# +cdir=/tmp +cbasename=${APPNAME}_$$.c +cout=${APPNAME}_$$.out +printf "checking whether the cc command works..." +echo 'int n;' >$cdir/$cbasename +if (cd $cdir && cc -c $cbasename >$cout 2>&1) +then + echo " yes" +else + echo " no" + sed 's/^/> /' $cdir/$cout + echo "error: looks like the cc command is not working" 1>&2 + exit 1 +fi + +# +# Do we have gettimeofday() ? +# +check "for gettimeofday" HAVE_GETTIMEOFDAY ' +#include +#include +int main (int argc, char *argv[]) +{ + struct timeval tv; + struct timezone tz; + int n = gettimeofday (&tv, &tz); + return n; +} +' || true + +# +# Do we have nanosleep() ? +# +check "for nanosleep" HAVE_NANOSLEEP ' +#include +int main (int argc, char *argv[]) +{ + struct timespec ts; + ts.tv_sec = 1; + ts.tv_nsec = 1; + nanosleep (&ts, &ts); + return 0; +} +' || true + +# +# Do we have snprintf() ? +# +check "for snprintf" HAVE_SNPRINTF ' +#include +int main (int argc, char *argv[]) +{ + char buf[1]; + int n = snprintf (buf, sizeof buf, "%d", 42); + return n; +} +' || true + +# +# Do we have usleep() ? +# +check "for usleep" HAVE_USLEEP ' +#include +int main (int argc, char *argv[]) +{ + unsigned long usec = 1; + usleep (usec); + return 0; +} +' || true + +# +# Create the directory where the build-specific files go +# +SYSTEM_RAW="`uname -n`_`uname -a | cksum`" +SYSTEM="`echo "$SYSTEM_RAW" | tr -dc '[:alnum:]._-'`" +BUILDDIR=obj/$SYSTEM +echo "build directory is $BUILDDIR" +mkdir -p $BUILDDIR + +# +# FHS paths +# +if expr "$PREFIX" : '//*usr/*$' >/dev/null +then + BINDIR=/usr/bin # FHS-ly correct is /usr/games + ETCDIR=/etc/$APPNAME/%v + ETCDIRNV=/etc/$APPNAME + MANDIR=/usr/share/man + SHAREDIR=/usr/share/games/$APPNAME/%v + SHAREDIRNV=/usr/share/games/$APPNAME +elif expr "$PREFIX" : '//*usr//*local/*$' >/dev/null +then + BINDIR=/usr/local/bin # FHS-ly correct is /usr/local/games + ETCDIR=/etc/$APPNAME/%v + ETCDIRNV=/etc/$APPNAME + MANDIR=/usr/local/man + SHAREDIR=/usr/local/share/games/$APPNAME/%v + SHAREDIRNV=/usr/local/share/games/$APPNAME +elif expr "$PREFIX" : '//*opt/*$' >/dev/null +then + echo '/opt ? Surely you mean /opt/something, Mr. Feynman !' 1>&2 + exit 1 +elif expr "$PREFIX" : '//*opt//*[^/]' >/dev/null +then + BINDIR=$PREFIX/bin + ETCDIR=/etc/opt/`expr "$PREFIX" : '//*opt//*\(.*\)'` + ETCDIRNV= + MANDIR=$PREFIX/man + SHAREDIR=$PREFIX/share + SHAREDIRNV= +else # Probably /home/joe/* + BINDIR=$PREFIX/bin + ETCDIR=$PREFIX/etc + ETCDIRNV= + MANDIR=$PREFIX/man + SHAREDIR=$PREFIX/share + SHAREDIRNV= +fi + +# +# Write Makefile.config +# +echo generating $BUILDDIR/Makefile.config +( + echo "# DO NOT EDIT -- generated by ./configure" + echo + echo "BINDIR = $BINDIR" + echo "ETCDIR = $ETCDIR" | sed "s/%v/$VERSION/g" + echo "ETCDIRNV = $ETCDIRNV" + echo "HAVE_GETTIMEOFDAY = $HAVE_GETTIMEOFDAY" + echo "HAVE_NANOSLEEP = $HAVE_NANOSLEEP" + echo "HAVE_SNPRINTF = $HAVE_SNPRINTF" + echo "HAVE_USLEEP = $HAVE_USLEEP" + echo "INTERFACE = $INTERFACE" + echo "MANDIR = $MANDIR" + echo "PLATFORM = $PLATFORM" + echo "SHAREDIR = $SHAREDIR" | sed "s/%v/$VERSION/g" + echo "SHAREDIRNV = $SHAREDIRNV" +) >$BUILDDIR/Makefile.config + +# +# YGD files search path +# +echo generating $BUILDDIR/config.share +$GREP -Fvx '' <"$BUILDDIR/config.share" +. +~/.$APPNAME/%v +~/.$APPNAME +$SHAREDIR +$SHAREDIRNV +EOF + +# +# Config files search path +# +echo generating $BUILDDIR/config.etc +$GREP -Fvx '' <"$BUILDDIR/config.etc" +. +~/.$APPNAME/%v +~/.$APPNAME +$ETCDIR +$ETCDIRNV +EOF + +# +# Write config.h and config.cc +# +genc +genh + +exit 0 diff -uaNr yadex-1.5.2/docsrc/.pixlist yadex-1.6.0/docsrc/.pixlist --- yadex-1.5.2/docsrc/.pixlist 2000-08-27 23:18:29.000000000 +0200 +++ yadex-1.6.0/docsrc/.pixlist 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -E1.png -E2.png -e1.png -e2.png -logo.png -logo_small.png -mirror0.png -mirrorh.png -mirrorv.png -nook1.png -nook2.png -vflat.png -vsprite.png -vtexture.png -yadex1.png diff -uaNr yadex-1.5.2/docsrc/002f2f.png yadex-1.6.0/docsrc/002f2f.png --- yadex-1.5.2/docsrc/002f2f.png 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/docsrc/002f2f.png 2000-01-06 13:09:33.000000000 +0100 @@ -0,0 +1,3 @@ +‰PNG + + IHDRKm)ÜgAMA† 1è–_IDATxÚcdÐ×gÀ˜p€Á)OnžŒ7ºIEND®B`‚ \ No newline at end of file diff -uaNr yadex-1.5.2/docsrc/README yadex-1.6.0/docsrc/README --- yadex-1.5.2/docsrc/README 2000-01-10 15:35:44.000000000 +0100 +++ yadex-1.6.0/docsrc/README 2003-02-15 16:17:11.000000000 +0100 @@ -9,8 +9,9 @@ PREREQUISITES You need : - - Some flavour of Unix, - - X11R6 or X11R5 and a display of at least 640x480x256, + - Some flavour of Unix (known to work with AIX, FreeBSD, HP-UX, + Irix, Linux, NetBSD, OpenBSD, OpenUnix, QNX and Solaris), + - X11R6 or X11R5 and a display of at least 640x480, - a Doom/Doom II/Heretic/Strife iwad (shareware/demo is OK), - GNU make (vanilla make won't do), - a standard C compiler (ISO 9899:1990), @@ -18,46 +19,46 @@ - hypot() and either nanosleep() or usleep(). BUILDING AND INSTALLING - Type this : + To install in /usr/local : - make - su -c 'make install' + ./configure + make + su -c 'make install' - Notes : - 1) If you get an error on -lX11, add X11LIBDIR= to the make - command line, where is the path to your libX11* files. - E.G. "make X11LIBDIR=/usr/lpp/X11/lib" + To install somewhere else, for example in ~/yadex : + + ./configure --prefix ~/yadex + make + make install + + Got problems getting Yadex to compile ? See doc/faq.html. + Got no problem ? Read the FAQ anyway. See doc/faq.html. - 2) If you want to install somewhere else than in /usr/local/bin, - add PREFIX= to the "make install" command line. - E.G. "su -c 'make install PREFIX=/opt/yadex'" - or "make install PREFIX=~" - - 3) Beware, the installation OVERWRITES the following files: - /usr/local/bin/ybsp - /usr/local/bin/ybsp-$VERSION - /usr/local/bin/yadex - /usr/local/bin/yadex-$VERSION - /usr/local/etc/yadex/$VERSION/yadex.cfg - /usr/local/share/games/yadex/$VERSION/doom.ygd - /usr/local/share/games/yadex/$VERSION/doom02.ygd - /usr/local/share/games/yadex/$VERSION/doom04.ygd - /usr/local/share/games/yadex/$VERSION/doom05.ygd - /usr/local/share/games/yadex/$VERSION/doom2.ygd - /usr/local/share/games/yadex/$VERSION/doompr.ygd - /usr/local/share/games/yadex/$VERSION/heretic.ygd - /usr/local/share/games/yadex/$VERSION/hexen.ygd - /usr/local/share/games/yadex/$VERSION/strife.ygd - /usr/local/share/games/yadex/$VERSION/strife10.ygd - /usr/local/[share/]man/man6/ybsp.6 - /usr/local/[share/]man/man6/yadex.6 + Beware, the installation OVERWRITES the following files (assuming + you're installing in /usr/local) : + /etc/yadex/$VERSION/yadex.cfg + /usr/local/bin/yadex + /usr/local/bin/yadex-$VERSION + /usr/local/man/man6/yadex.6 + /usr/local/man/man6/yadex-$VERSION.6 + /usr/local/share/games/yadex/$VERSION/doom.ygd + /usr/local/share/games/yadex/$VERSION/doom02.ygd + /usr/local/share/games/yadex/$VERSION/doom04.ygd + /usr/local/share/games/yadex/$VERSION/doom05.ygd + /usr/local/share/games/yadex/$VERSION/doom2.ygd + /usr/local/share/games/yadex/$VERSION/doompr.ygd + /usr/local/share/games/yadex/$VERSION/heretic.ygd + /usr/local/share/games/yadex/$VERSION/hexen.ygd + /usr/local/share/games/yadex/$VERSION/strife.ygd + /usr/local/share/games/yadex/$VERSION/strife10.ygd CONFIGURING AND RUNNING Before you run Yadex, you need to tell it where to find your iwads. - Open /usr/local/etc/yadex/$VERSION/yadex.cfg with your favourite - text editor and insert the appropriate values for the parameters - "iwad1", "iwad2", etc. If you don't want Doom II to be the default - iwad, also change the value of the "game" parameter. + Assuming you have installed in /usr/local, open + /etc/yadex/$VERSION/yadex.cfg with your favourite text editor and + insert the appropriate values for the parameters "iwad1", "iwad2", + etc. If you don't want Doom II to be the default iwad, also change + the value of the "game" parameter. You can now run Yadex by typing : @@ -74,11 +75,14 @@ Have fun ! DOCUMENTATION - There are man pages and quite a lot of documentation, most of it in + There is a man page and quite a lot of documentation, most of it in HTML format. Start at : doc/index.html + If you're upgrading from a previous version of Yadex, please read + carefully CHANGES. + STATUS Yadex is work in progress. It still lacks important features like a better interface, cut-and-paste, undo/redo, support for Boom and @@ -86,23 +90,40 @@ code is a horrible mess. I'm not proud of it. Be indulgent. LEGAL - Yadex is GPL'd libre software. It incorporates code from DEU 5.21 - that was put in the public domain in 1994 by Raphaël Quinet and - Brendon Wyber. The rest is Copyright © 1997-2000 André Majorel. - - Now comes the part I like best : This program is free software; you - can redistribute it and/or modify it under the terms of the GNU - General Public License as published by the Free Software Foundation; - either version 2 of the License, or (at your option) any later - version. This program is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. You should have received a - copy of the GNU General Public License along with this program; if - not, write to the Free Software Foundation, Inc., 675 Mass Ave, - Cambridge, MA 02139, USA. + 1. Yadex + + $COPYRIGHT_TXT + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + 2. Atclib + + The Yadex distribution includes a subset of Atclib. + + Atclib is copyright André Majorel 1995-1999 and distributed under + the terms of version 2 of the GNU Library General Public License. + + 3. Boost - All trademarks are the propriety of their owners. + The Yadex distribution includes a subset of Boost 1.25.0. Boost + 1.25.0 is copyright various authors and released under the following + terms : Permission to copy, use, modify, sell and distribute this + software is granted provided this copyright notice appears in all + copies. This software is provided "as is" without express or + implied warranty, and with no claim as to its suitability for any + purpose. CONTACT See doc/contact.html for addresses. diff -uaNr yadex-1.5.2/docsrc/contact.html yadex-1.6.0/docsrc/contact.html --- yadex-1.5.2/docsrc/contact.html 1999-08-13 19:05:09.000000000 +0200 +++ yadex-1.6.0/docsrc/contact.html 2003-03-26 19:34:18.000000000 +0100 @@ -24,25 +24,25 @@

Mailing lists

-

yadex-announce
Announcements regarding Yadex. This is a very low-volume list.

To subscribe to yadex-announce, send a message -to listar@middleearth.telefragged.com with +to ecartis@freelists.org with "subscribe yadex-announce" as the subject.

To unsubscribe from yadex-announce, send a -message to listar@middleearth.telefragged.com with +message to ecartis@freelists.org with "unsubscribe yadex-announce" as the subject.

You cannot post to this list. -

yadex +
yadex
General discussions about Yadex. On-topic subjects include questions, bug reports, suggesting and discussing features, @@ -52,18 +52,18 @@ href="help.html">somewhere else.

To subscribe to yadex, send a message to listar@middleearth.telefragged.com with +href="mailto:ecartis@freelists.org" +>ecartis@freelists.org with "subscribe yadex" as the subject.

To unsubscribe from yadex, send a message to listar@middleearth.telefragged.com with +href="mailto:ecartis@freelists.org" +>ecartis@freelists.org with "unsubscribe yadex" as the subject. -

To post to yadex, send mail to yadex@middleearth.telefragged.com. +

To post to yadex, send mail to +spambait@freelists.org (except that it's +yadex, not spambait).

When following up to the list, quote only the relevant parts of the original message. Your efforts to keep the signal/noise @@ -74,8 +74,16 @@

Maintainer

-The current maintainer is André Majorel <amajorel@teaser.fr> +

Send all email to spambait@freelists.org, +not to me.

+ +

The current maintainer is André Majorel http://www.teaser.fr/~amajorel/.

+ +

Send all email to spambait@freelists.org, +not to me.

+ +(It's really yadex, not spambait).


AYM $SELF_DATE diff -uaNr yadex-1.5.2/docsrc/copyright yadex-1.6.0/docsrc/copyright --- yadex-1.5.2/docsrc/copyright 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/docsrc/copyright 2003-02-11 14:17:59.000000000 +0100 @@ -0,0 +1,5 @@ +Apted Andrew 2000-2001 GPL +Majorel André 1997-2003 GPL +Miller Matthew W. 2000 GPL +Quinet Raphaël 1993-1994 PD +Wyber Brendon 1993-1994 PD diff -uaNr yadex-1.5.2/docsrc/credits.html yadex-1.6.0/docsrc/credits.html --- yadex-1.5.2/docsrc/credits.html 2000-08-19 16:41:30.000000000 +0200 +++ yadex-1.6.0/docsrc/credits.html 2003-03-28 18:57:49.000000000 +0100 @@ -153,16 +153,20 @@

As for Yadex per se, the contributors are :

-
Andrew Apted -
Wrote the ygd for EDGE. Final Doom testing. +
Andrew J. Apted (AJA) +
Wrote the ygd for Boom and EDGE. Variables digit_zoom_base, + digit_zoom_step and blindly_swap_sidedefs. Final + Doom testing.

Jean Forget (JF)
Provided the base of the "youngest" perl script.

Matthew W. Miller + (MWM) +
Wrote most of strife.ygd. -

André Majorel (AYM) +

André Majorel (AYM)
Did the rest ;-).
@@ -173,13 +177,7 @@ include, by alphabetical order :

-

Pierre Baillargeon <pb@artquest.net> -
C++ help. - -

Carl Barron <cbarron3@ix.netcom.com> -
C++ help. - -

Joseph Carter <knghtbrd@debian.org> +
Joseph Carter <knghtbrd@debian.org>
Debian package. Convinced me to support /usr/local/share/man/. Put up with my sick makefiles. @@ -187,8 +185,8 @@
A post by him and another one by Nathan Lucas in r.g.c.d.e. led to the development of the "save image to a file" feature. Gave thorough reports. -

David Ferguson <DavidFerguson@NOcsiSPAM.com> -
C++ help. +

Max Heijndijk +
RPM package.

Joe Koperski <joekoperski@hotmail.com> (JK)
Encouragements. @@ -196,32 +194,35 @@

Oliver Kraus <lrs.e-technik.uni-erlangen.de>
Helped with Solaris port. +

Ingo van Lil +
Bug reports and suggestions. +

Udo Munk <um@compuserve.com> (UM)
Requested scrolling with arrow keys and possibility to disable the autoscrolling. Helped a lot with Final Doom compatibility and porting - issues. Wrote XDoom - and Xwadtools. + issues. Wrote XDoom and Xwadtools.

Kim "Sparky" Parrott <kelm@eisa.net.au>
Indirect bug report.

Colin Phipps -
Encouragements. Wrote the FreeBSD testing. Wrote the fix for two bugs in - BSP 2.3. Wrote LxDoom. + BSP 2.3. Wrote LxDoom. Now + maintains BSP.

Len Pitre
Helped with Strife support. -

John Potter <jpotter@falcon.lhup.edu> -
C++ help. +

Jérôme Raciazek +
Let me play with his QNX machine.

"Ras2" -
More bug reports than everybody else combined. - -

Atgeirr F. Rasmussen <atgeirr@sintef.no> -
C++ help. +
More bug reports than everybody else combined. Provides a mirror of the + web page.

Josh R. Ray <joshray@prodigy.net> (JRR)
Encouragements. @@ -239,9 +240,6 @@ splitting, single-key linedefs of sector splitting and scrolling with arrow keys. -

Ivan Vecerina <ivec@mail.com> -
C++ help. -

The Wildman
Encouragements. @@ -249,6 +247,19 @@
Figured out the picture format for the Doom alpha and press release versions and told us about it on rgcde. Without him, Yadex probably wouldn't support them. + +

Pierre Baillargeon <pb@artquest.net> +
Carl Barron <cbarron3@ix.netcom.com> +
David Ferguson <DavidFerguson@NOcsiSPAM.com> +
John Potter <jpotter@falcon.lhup.edu> +
Atgeirr F. Rasmussen <atgeirr@sintef.no> +
Ivan Vecerina <ivec@mail.com> +
C++ help. + +

Benjamin Bayart +
Ouafae Kotby +
diff consulting. +

If I'm forgetting you, pardon my mistake and please send me a @@ -277,7 +288,7 @@ The rgcders for their interesting answers and questions. The level designers who have made all the wonderful levels and graphics I've been admiring. -Linuxgames for providing the mailing list. +Linuxgames and freelists.org for providing the mailing lists. The makers of the internet for connecting us all. All the other people who help making this world bearable. diff -uaNr yadex-1.5.2/docsrc/editing_docs.html yadex-1.6.0/docsrc/editing_docs.html --- yadex-1.5.2/docsrc/editing_docs.html 1999-08-13 19:05:53.000000000 +0200 +++ yadex-1.6.0/docsrc/editing_docs.html 2003-03-27 20:20:16.000000000 +0100 @@ -22,27 +22,27 @@

General editing

@@ -58,11 +58,11 @@

Special effects


AYM $SELF_DATE diff -uaNr yadex-1.5.2/docsrc/feedback.html yadex-1.6.0/docsrc/feedback.html --- yadex-1.5.2/docsrc/feedback.html 1999-08-13 18:24:30.000000000 +0200 +++ yadex-1.6.0/docsrc/feedback.html 2003-04-01 00:00:00.000000000 +0200 @@ -29,23 +29,16 @@ yadex mailing list. +

Yes, suggestions to switch to toolkit x have +already been offered for most values of x. +There even is a FAQ item. +

For a list of known issues and solutions that have been considered, see TODO.

Contributions

-

Contributions are welcome. Should you ever get short of ideas, -you'll find plenty in TODO :-). -Guidelines for contributors : - -

    -
  • read TODO, -
  • talk to the the current maintainer first ! The -job you want to do might be already underway, or might be -conflicting with something else, -
  • read the hacker's guide. -
+

See the hacker's guide.


AYM $SELF_DATE diff -uaNr yadex-1.5.2/docsrc/getting_started.html yadex-1.6.0/docsrc/getting_started.html --- yadex-1.5.2/docsrc/getting_started.html 2000-01-10 21:47:35.000000000 +0100 +++ yadex-1.6.0/docsrc/getting_started.html 2003-03-31 19:28:26.000000000 +0200 @@ -59,12 +59,12 @@ The installation procedure will try to copy files in the following directories, creating the directories if they don't exist ;
    +
  • /etc/yadex/$VERSION
  • /usr/local/bin -
  • /usr/local/etc/yadex -
  • /usr/local/share/games/yadex +
  • /usr/local/share/games/yadex/$VERSION

So make sure you have the necessary rights before installing -(or change the makefile). +(or install in a different location).

Display

@@ -99,9 +99,11 @@

Don't forget to tell Yadex where your iwads are by changing the lines "iwad1 =", "iwad2 =" etc. in -/usr/local/etc/version/yadex.cfg. If -there is an iwad you don't have, you can just comment out the -corresponding line. +~/.yadex/yadex.cfg or +/etc/yadex/$VERSION/yadex.cfg (the actual location +might be different if you compiled with another prefix than the +default). If there is an iwad you don't have, you can just +comment out the corresponding line.

2. Quick start

@@ -324,13 +326,14 @@ strange results or you'll crash the game.

There are several nodes builders around. One of the best is -BSP 2.3. Lee Killough kindly allowed me to include it with the -Yadex distribution. To build the nodes on your level with BSP -and then test it with Doom, type something along the lines -of : +BSP, which you can download from http://doombsp.sourceforge.net/. To build the nodes +on your level with BSP and then test it with Doom, type +something along the lines of :

-$ ybsp mywad.wad -o final.wad
+$ bsp -o final.wad mywad.wad
 $ doom -file final.wad
 
diff -uaNr yadex-1.5.2/docsrc/hackers_guide.html yadex-1.6.0/docsrc/hackers_guide.html --- yadex-1.5.2/docsrc/hackers_guide.html 2000-07-23 23:03:44.000000000 +0200 +++ yadex-1.6.0/docsrc/hackers_guide.html 2003-04-01 00:00:00.000000000 +0200 @@ -1,6 +1,21 @@ Yadex hacker's guide + + @@ -13,6 +28,69 @@

+

Read this first

+ +Before you start hacking—no, before you even +think about hacking—Yadex, you should do +this : + +
+
Read the TODO file + +
+ Many possible improvements and fixes have been identified + and sometimes a particular approach has already been decided + on and written down in TODO. Yes it's tedious + reading. But if you skip it, you run the risk of seeing your + work go to waste because it's in conflict with an earlier + plan. + +
Read the hacker's guide + +
+ Patches that don't at the minimum abide by the + coding standards and other guidelines in this document are + not very likely to be accepted. + +
Subscribe to the yadex list + +
+ The mailing list is the way by which users and developers + communicate. Subscribe to the list and do all communication + through the list. It allows developers to coordinate and to + benefit from the feedback of all other developers and users. + +

+ For whatever reason, some contributors seem to think they + don't need to subscribe to the list. But the need for + coordination remains. Each contributor needs a + communication channel with the rest of the project. If + it's not the mailing list, it'll probably be the + maintainer (me) and I don't want to have to play the role + of a mailing list digest server. +

+ +

+ Having a single many-to-many communication channel is + better than having many one-to-one channels because you + don't have to repeat the same thing n times to + n people. +

+ +

+ The mailing list is archived and the archives are publicly + accessible by anyone at any time. Private mail isn't. +

+ +
Post on the list about your plans + +
+ The job you want to do might be already underway, or might + be conflicting with something else. + +
+

Blah

Foreword

@@ -877,15 +955,18 @@

Indent style

-I use the Whitesmiths style with an indent width of 3. +BSD style with an indent width of 2.
  • tab stops every 8 characters, -
  • indent width is 3 spaces, +
  • indent width is 2 spaces,
  • line width limited to 80 characters,
  • the braces have the same indentation as the text they contain,
  • the body of a function is not indented.
+Many files still use Whitesmiths with an indent width of 3. They +will be reformatted. + Whitespace :
  • one space between the name of the function/statement and the "(", @@ -907,15 +988,15 @@

    static const char *foo (int n)
     {
    -for (stuff; stuff; stuff)
    -   {
    -   if (thingie || gadget ())
    +  for (stuff; stuff; stuff)
    +  {
    +    if (thingie || gadget ())
           call_this_one (with, three, exactly[arguments]);
    -   else
    +    else
           dont ();
    -   call_that_one ();
    -   }
    -return NULL;
    +    call_that_one ();
    +  }
    +  return NULL;
     }

    Identifiers

    @@ -928,6 +1009,50 @@

    I consistently use the English spelling (E.G. "colour", not "color"). +

    Conditionals

    + +The argument of if and while and the +second argument of for are booleans, not integers, +so you should provide a boolean expression. The following +expressions are not booleans : + +
      +
    • pointers, +
    • the return value of strcmp(), +
    • the return value of functions to return 0 to indicate + success and non-zero to indicate failure, +
    + +Therefore, don't write + +

    +if (! fopen (filename, "r"))  // Test for failure
    +  ...
    +if (strcmp (str1, str2))  // Test for non-equality
    +  ...
    +if (! strcmp (str1, str2))  // Test for equality
    +  ...
    +if (remove (filename))  // Test for failure
    +  ...
    +

    + +but + +

    +if (fopen (filename, "r") == NULL)
    +  ...
    +if (strcmp (str1, str2) != 0)
    +  ...
    +if (strcmp (str1, str2) == 0)
    +  ...
    +if (remove (filename) != 0)
    +  ...
    +

    + +On the other hand, when an expression is a boolean, you don't +need to add anything. Don't write if (boolvar == +true). +

    General style

    My general style is to try to make it look clear and pretty. If there diff -uaNr yadex-1.5.2/docsrc/help.html yadex-1.6.0/docsrc/help.html --- yadex-1.5.2/docsrc/help.html 1999-08-13 18:24:39.000000000 +0200 +++ yadex-1.6.0/docsrc/help.html 2003-03-26 19:19:53.000000000 +0100 @@ -15,11 +15,10 @@

    The preferred place to put a question about Yadex is the yadex mailing -list. Alternatively, you can mail the maintainer (me). I'll be -happy to help you if I can. Just be nice with me by not making -me answer the same questions over and over. Many common -questions are already answered in the documentation. +list. + +

    Do not mail the maintainer. Yes, this means you. +Send all mail to the list.

    General Doom editing questions are better answered on diff -uaNr yadex-1.5.2/docsrc/index.html yadex-1.6.0/docsrc/index.html --- yadex-1.5.2/docsrc/index.html 1999-12-10 23:32:14.000000000 +0100 +++ yadex-1.6.0/docsrc/index.html 2002-05-09 15:36:06.000000000 +0200 @@ -18,6 +18,7 @@

  • Getting started
  • User's guide
  • Tips +
  • FAQ

Any trouble ?

@@ -26,6 +27,7 @@
  • Troubleshooting
  • Reporting bugs
  • Getting help +
  • FAQ

    Additional documents

    @@ -35,10 +37,10 @@
  • Advanced user's guide
  • TODO
  • The man page for Yadex -
  • The man page for BSP
  • Yadex game definition files
  • Wad specs
  • Hacker's guide +
  • Packager's guide
  • Differences between Yadex and DEU 5.21 diff -uaNr yadex-1.5.2/docsrc/keeping_up.html yadex-1.6.0/docsrc/keeping_up.html --- yadex-1.5.2/docsrc/keeping_up.html 1999-08-13 18:24:45.000000000 +0200 +++ yadex-1.6.0/docsrc/keeping_up.html 2003-03-31 23:48:46.000000000 +0200 @@ -27,10 +27,12 @@ href="news:rec.games.computer.doom.editing" >rec.games.computer.doom.editing and Freshmeat. Several news sites -such as Doomworld, Linux Game Tome -and Linuxgames have -been witnessed to echo the announcements. +such as Doom center, Doomworld, Linux Game Tome, New Doom and Linuxgames have been +witnessed to echo the announcements.

    To download the latest version, see the Yadex home page. diff -uaNr yadex-1.5.2/docsrc/packagers_guide.html yadex-1.6.0/docsrc/packagers_guide.html --- yadex-1.5.2/docsrc/packagers_guide.html 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/docsrc/packagers_guide.html 2003-04-01 00:00:00.000000000 +0200 @@ -0,0 +1,79 @@ + + + Yadex packager's guide + + +

    + Fancy logo +
    Yadex $VERSION ($SOURCE_DATE) +

    Packager's guide

    + + + + + + +
    + + This is for people who plan to package Yadex. + +
    +
    + +
    +
    +
    + +

    So you want to package Yadex ? Here is a list of things you should + probably know :

    + +

    +

      +

    • To make it install in /usr instead of + /usr/local, re-run configure with the right + --prefix option, type make clean && make + all. That's all there is to it.

      + +

      You shouldn't have to make any manual changes ; most + references to the prefix in the documentation and elsewhere use the + files generated by configure (you'll have to make + clean, however). One possibly undesirable consequence of this + is that the doc from your package and the doc that one would get + after installing from the source will not be identical. I suppose it + doesn't matter.

      + +

    • From version 1.6 on, alternative prefixes are better supported + but the behaviour has changed somewhat. Instead of looking for files + in both /usr and /usr/local, Yadex uses + only the prefix directory. The goal was to reduce the unwanted + interactions between Yadexes installed with different prefixes on the + same system. Since packagers typically use /usr, users + should be able to have on their system both the original and the + packaged version of Yadex. (Incidentally, that's not true for + /etc/yadex/$VERSION/yadex.cfg but the FHS is to + blame).

      + +

    • To allow one to have several different versions installed at the + same time on the same system, Yadex uses a somewhat unusual scheme + where each file installed has the version number somewhere in its + pathname. If your packaging system allows version n + 1 to + have a different set of files than version n of the same + package, this should cause no problem. In fact, if the package + manager allows that, two different versions of the package could + coexist (except that they would overwrite each other's symlinks in + bin/ and man/, but that's what they're + for). + +

      If you have problems with that scheme, let me know.

      + +

    • If you actually try to understand the makefile, you're going to + end up hating me.

      + +
    +

    + +


    AYM $SELF_DATE

    + + + + diff -uaNr yadex-1.5.2/docsrc/reporting.html yadex-1.6.0/docsrc/reporting.html --- yadex-1.5.2/docsrc/reporting.html 2000-08-27 23:18:02.000000000 +0200 +++ yadex-1.6.0/docsrc/reporting.html 2003-04-01 00:00:00.000000000 +0200 @@ -13,9 +13,10 @@

    -

    If you find a bug, tell me about it. It's important. Especially -if it makes Yadex crash or lose data. However, there are a few -things to bear in mind : +

    If you find a bug, tell the list about it. It's +important. Especially if it makes Yadex crash or lose data. +However, there are a few things to bear in mind :

    -

    Iwad

    +

    1.2.1. Iwad

    A shareware Doom or Heretic iwad or a demo Hexen or Strife iwad is okay but you need a registered iwad if you want to be able to save your changes. -

    Directories

    +

    1.2.2. Directories

    + +

    Yadex mostly conforms to the FHS (filesystem hierarchy +standard). By default, the installation procedure will try +to copy files in the following directories, creating the +directories if they don't exist ; -

    Yadex conforms to the -FHS (filesystem hierarchy standard). -The installation procedure will try to copy files in the following -directories, creating the directories if they don't exist ;

    • /usr/local/bin -
    • /usr/local/etc +
    • /etc/yadex/$VERSION
    • /usr/local/man/man6 -
    • /usr/local/share/games +
    • /usr/local/share/games/yadex/$VERSION
    -

    So make sure you have the necessary rights before installing -(or change the makefile). -

    Display

    +

    So make sure you have the necessary rights before installing. +If you don't, install in a different directory by running +./configure with the --prefix option. + +

    1.2.3. Display

    Yadex uses about 270 different colours. In most cases, on PseudoColor displays, there aren't that many free colour cells. So, if it detects a PseudoColor display, Yadex uses a private colormap so as to get as many free colour cells as possible. -The inconvenient of this method is that, when you're in the -Yadex window, all other windows are displayed with wrong colours -and vice-versa. +The drawback of this method is that, when you're in the Yadex +window, all other windows are displayed with wrong colours and +vice-versa.

    What's more, as PseudoColor displays typically have 256 colours (at least on PC), which is less than the number of @@ -173,8 +230,6 @@ to render the colours of the game accurately at the expense of the application colours. -

    Monochrome displays might work but they have not been tested. -

    Executive summary: if you can, use a TrueColor or DirectColor display and a depth of more than 8 bits per pixel (E.G. by launching X with "startx -- -bpp 16"). @@ -182,22 +237,21 @@

    A 640x480 screen is okay though, of course, a larger display is better. -

    Compiling and installing Yadex

    +

    1.3. Compiling and installing Yadex

    See README.

    Don't forget to tell Yadex where your iwads are by changing the lines "iwad1 =", "iwad2 =" etc. in -/usr/local/etc/yadex/version/yadex.cfg. +/etc/yadex/$VERSION/yadex.cfg. If there is an iwad you don't have, you can just comment out the corresponding line. -


    -

    - 2. Running Yadex

    +
    +

    2. Running Yadex

    -

    The command line arguments

    +

    2.1. The command line arguments

    Yadex takes two sorts of command line arguments : parameters and options. An option is a command line argument @@ -236,7 +290,7 @@ of specifying pwad names are discussed there. -

    Options

    +

    2.2. Options

    To know about the command line options that Yadex understands, type @@ -245,7 +299,7 @@

    You'll get this: -

    +
     -b                 string     Run benchmark and exit successfully
     -f  -config_file   string     Config file
     -d  -debug                    Debug mode
    @@ -285,8 +339,8 @@
     compatibility with previous versions of Yadex/Yade/DEU. Don't
     use them. They might go away one day.
     
    -		

    - Specifying the game for which you want to edit

    +

    2.3. Specifying the game for which + you want to edit

    Yadex can handle several games (Doom, Doom II, Heretic, etc.) but only one at a time. Unfortunately, that game can't be @@ -334,15 +388,16 @@

    Not all those games are fully supported. For details, see there. -

    - Specifying the names of pwads to load

    + +

    2.4. Specifying the names of + pwads to load

    When you have to specify the name of a pwad to load, for example in the r command, or as a command line argument, you don't always have to spell it all out.

      -

    • The .wad extension can be omitted, it will +
    • The .wad extension can be omitted, it will be added automatically. For example, specifying the name "foo" is equivalent to specifying "foo.wad". An unfortunate consequence of this @@ -351,11 +406,15 @@ can still work around this limitation by specifying the name with a trailing dot, ("foo."). -

    • The path can sometimes be omitted too, if the wad is in - one of the standard directories, or one of their - subdirectories. If no file of the name you specified is - found in the current directory, Yadex will look for a file - of that name in the standard directories, which are : +
    • +

      + The path can sometimes be omitted too, if the wad is in + one of the standard directories, or one of + their subdirectories. If no file of the name you + specified is found in the current directory, Yadex will + look for a file of that name in the standard directories, + which are : +

      1. your home directory, @@ -365,8 +424,8 @@
      2. /usr/share/games/wads,
      - (where game is the name of the game). +

      (where game is the name of the game).

      On the other hand, if you give an absolute file name, that is one that begins with a "/", the @@ -375,7 +434,7 @@

      For example, if you type "yadex -g doom2 foo/bar", Yadex will look for the following files in - order : + order :

      1. ~/foo/bar.wad, @@ -385,7 +444,7 @@
      2. /usr/share/games/wads/foo/bar.wad,
      - and open the first it finds. +

      and open the first it finds.

      But if you type "yadex -g doom2 /foo/bar" (note @@ -406,7 +465,7 @@ always have to specify the exact name, with the full path and extension. -

      Environment variables

      +

      2.5. Environment variables

      DOOMWADDIR @@ -417,17 +476,29 @@
      Unix only. The name of the X display that Yadex will try to connect to. +
      HOME +
      Used to expand ~ when locating configuration + and game definition files. + +
      LINES +
      If set, Yadex assumes the tty has that many lines instead + of 24. The value must be an unsigned, non-zero decimal + integer. + +
      TMPDIR +
      If set, swap files are created there. Otherwise, in + /tmp. +
      YADEX_GAME
      Indicates the game to use. Overrides the game parameter in the config file, is overridden by the -g command line option.
      -


      -

      - 3. Editing levels with Yadex

      +
      +

      3. Editing levels with Yadex

      -

      Using external textures, flats, etc.

      +

      3.1. Using external textures, flats, etc.

      Like Doom, Yadex accepts the addition and replacement of resources from a pwad. In general, if the same resource is @@ -435,10 +506,10 @@ also true if the same resource is defined several times in the same wad. It's not recommended that you use lower case names in your wads; sometimes it's handled but sometimes it's not. So -always use upper-case names. +always use upper-case names.

      -

      Flats +
      Flats
      New or replacement flats are recognized iff they're placed between FF_START/F_END or FF_START/FF_END labels. There can @@ -447,12 +518,12 @@ don't have to be in the same pwad. If there are several lumps for the same flat, the last one is used. -

      Palette +
      Palette
      If there is a replacement PLAYPAL lump, it's used. If there are several PLAYPAL lumps, the last one is used. -

      Patches +
      Patches
      New or replacement patches are recognized iff they're between P_START and P_END or PP_START and PP_END. Within a @@ -466,7 +537,7 @@ lumps, the last one is used. If there are several lumps for the same flat, the last one is used. -

      Sprites +
      Sprites
      New or replacement sprites are recognized iff they're between one of the following pair of labels : S_START/S_END, @@ -476,7 +547,7 @@ pwad. If there are several lumps for the same sprite, the last one is used. -

      Textures +
      Textures
      New or replacement textures are recognized iff they're in a TEXTURE1 or TEXTURE2 lump. If the same texture happens to be defined in both @@ -490,7 +561,7 @@ supposed to exist, like Doom II.
      -

      Logging of time spent

      +

      3.2. Logging of time spent

      If you edit a level from a file and there exists a file in the same directory with the same name but with the extension @@ -507,19 +578,19 @@ logging, you need to manually create the log file first with a command such as "touch name.yl". -

      The prompt commands

      +

      3.3. The prompt commands

      You can get a summary of the prompt commands by typing "?" at the Yadex prompt. -

      Moving around

      +

      3.4. Moving around

      -

      Moving the pointer

      +

      3.4.1. Moving the pointer

      In the X11 version, the only way to do that is to move the pointer device (i.e. the mouse). -

      Scrolling

      +

      3.4.2. Scrolling

      The arrow keys [Left], [Right], [Up] and [Down] scroll a little at a time, @@ -533,7 +604,7 @@ the exact amount by setting the variable scroll_more in the configuration file. -

      Autoscrolling

      +

      3.4.3. Autoscrolling

      By default, autoscrolling is disabled. You can enable it by setting autoscroll to true in the @@ -548,7 +619,7 @@

      You can fine tune autoscrolling by changing the variables autoscroll_amp and autoscroll_edge. -

      Jumping

      +

      3.4.4. Jumping

      I plan to develop a full set-mark/jump-to-mark system similar to the one in vi, with @@ -564,32 +635,40 @@ is adjusted so that the whole map is visible and almost fills the screen/window. -

      Zooming in and out

      +

      3.5. Zooming in and out

      The current zoom factor is shown on the info bar, after the word "Scale:". It is shown in pixels per map -units. The indication "Scale: 1/2" means that one +units. The indication "Scale: 50%" means that one pixel of the display corresponds to 2 map units.

      You can zoom in by pressing [+] or [=] -or the 4th mouse button or by moving the mouse wheel "up". +or the 4th mouse button or by moving the mouse wheel "up". See +the zoom_default and zoom_step +variables.

      You can zoom out by pressing [-] or [_] or the 5th mouse button or by moving the mouse -wheel "down". +wheel "down". See the zoom_default and +zoom_step variables.

      You can also set the zoom factor directly with the keys -[0] through [9]. +[1] through [9] and [0]. +[1] sets the zoom factor to a value that is +controlled by the digit_zoom_base variable (by +default, 100%). Each successive key down the keyboard sets the +zoom factor digit_zoom_step percents higher than +the previous one (by default, -29%). -

      The grid

      +

      3.6. The grid

      -

      The grid is a square mesh of blue lines in the -background. It's here to help you aligning your objects +

      The grid is a square mesh of blue dots and lines +in the background. It's here to help you aligning your objects correctly with regard to Doom's metrics, which will save you a lot of textures misalignments.

      When you insert or drag objects, they are snapped to -grid. That is Yadex prevents you from placing them +grid. That is, Yadex prevents you from placing them off the grid. You can toggle the snap_to_grid flag by pressing [y]. @@ -613,7 +692,7 @@

      You can also use [H] to reset the grid step. -

      Inserting objects

      +

      3.7. Inserting objects

      By pressing [Ins], you insert a new object under the pointer. @@ -624,13 +703,13 @@ always true, particularly if some objects are already selected : -

        +
        • If you are in vertices mode and there are two or more vertices selected, pressing [Ins] will insert a linedef from the first vertex to the second, another one from the second to the third and so on. That is, a path of linedefs is created from the first to the last vertex. The path is not - closed. + closed (but see [Shift][Ins] below).
        • If you are in linedefs mode and there are selected linedefs, pressing [Ins] will create a new sector @@ -649,9 +728,9 @@ you press [Ins], the properties of the new object are copied from the highlighted object. In other words, the highlighted object serves as a "model". Else the properties of -the new object are set to default values. +the new object are set to default values.

          -

          +
          Object type Property @@ -756,9 +835,15 @@
          Vertex Coordinates +
          -

          Copying objects

          +

          In vertex mode, pressing [Shift][Ins] +is the same as pressing [Ins] except that the path is +closed (an additional linedef is created from the last to the +first vertex). + +

          3.8. Copying objects

          When you press [o], the selected or highlighted object(s) is(are) copied. If only one object has been copied, @@ -808,26 +893,26 @@ special precautions to take when duplicating them. Except for the position, the copy is exactly identical to the original. -

          Deleting objects

          +

          3.9. Deleting objects

          To be written. There is already a concise description in the getting started document.
          Basically, use [Del]. -

          Changing the properties of objects

          +

          3.10. Changing the properties of objects

          To be written. There is already a concise description in the getting started document.
          Executive summary: use [Return] and double-click. -

          Moving objects a.k.a. drag-and-drop

          +

          3.11. Moving objects a.k.a. drag-and-drop

          To be written. There is already a concise description in the getting started document. -

          Renumbering objects

          +

          3.12. Renumbering objects

          Normally, you don't have to worry very much about the actual numbers of the linedefs, sectors, sidedefs, things and vertices @@ -840,29 +925,29 @@
          • if you have several player 1 starts in your level (which - is how the voodoo doll trick is done), it's the - lowest-numbered one that the player incarnates in at level - start, - -
          • if there are several teleport exits in the same sector, I - think only the lowest-numbered one is used (but I don't know - of any interesting application of this fact), + is how the voodoo doll trick is done), it's the + highest-numbered one that the player incarnates in at level + start, + +
          • if there are several teleport exits in the same sector, + only the lowest-numbered one is used (but I don't know of + any interesting application of this fact),
          • if there are several superimposed linedefs, the - lowest-numbered one is drawn like it was in front, + lowest-numbered one is drawn like it was in front,
          • BSP's transparent doors need one of the door tracks to be - the lowest-numbered linedef, + the lowest-numbered linedef,
          • certain linedef types apply only to the lowest-numbered of - the tagged sectors (IIRC), + the tagged sectors (IIRC),
          • raising stairs use the lowest-numbered linedef.

          So how do you control the ordering of objects ? -

          Exchanging objects numbers

          +

          3.12.1. Exchanging objects numbers

          This function works the same way in all modes. If you select exactly two objects and press [Ctrl-x] (or use @@ -886,7 +971,7 @@ it by replacing true by false in the call to exchange_objects_numbers().) -

          Selecting objects

          +

          3.13. Selecting objects

          There are several ways to select objects. The simplest is to click on an object with the left mouse button. By default, when @@ -913,19 +998,21 @@

          To use the first, you must first highlight a linedef. Then press [e]. All the linedefs that belong to the same non-forked path as the highlighted linedef are selected. For -example : +example :

          -

          +
          - + + - + +
          Before pressing [e] - After pressing [e] + Before pressing [e]After pressing [e]
          Before pressing [e] - After pressing [e] + Before pressing [e]After pressing [e]
          -

          Note how the selection stop at the first fork in the -path. That kind a path selection is good to select a path of +

          Note how the selection stop at the first fork in the +path. That kind a path selection is good to select a path of single- or double-sided linedefs that belong to the same sector.

          The other variant of path selection is better to select all @@ -933,18 +1020,20 @@ sides face the same sector. To use it, highlight a single-sided linedef and press [E]. All the single-sided linedefs that belong to the same path as the original one are -highlighted. For example : +highlighted. For example :

          -

          +
          - + + -
          Before pressing [E] - After pressing [E] + Before pressing [E]After pressing [E]
          Before pressing [E] - After pressing [E] -
          + Before pressing [E] + After pressing [E] + + -

          Note that the selection is not stopped by the forks in +

          Note that the selection is not stopped by the forks in the path. Also note that the double-sided linedefs are not selected. @@ -958,7 +1047,7 @@ selection (if they weren't). This is actually simpler than it sounds. -

          The use of [Shift]

          +

          3.14. The use of [Shift]

          The [Shift] key has an interesting property ; as long as you hold it down, the highlight is locked. If an object @@ -966,57 +1055,68 @@ pointer over it. Likewise, if an object is already highlighted, it remains so, even if you move the pointer away from it. -

          This can be useful in certain occasions, such as when you +

          This can be useful in certain occasions, such as when you want to compare two sectors that have other sectors between them. -

          Sector miscellaneous operations

          +

          3.15. Sector miscellaneous operations

          + +

          Unless otherwise specified, all the operation below act on +all the objects in the working set. If there is at +least one selected object, the working set is equal to the +selection. If there is no selected object, the working set is +the currently highlighted object (the object under the pointer). +If there is no selection and no highlighted object, the +selection is empty, of course. If there is a selection and an +object outside the selection, the latter is not part of +the working set.

          -

          Find first free tag number +
          Find first free tag number
          Displays the smallest tag number greater than 0 and not used by any linedef or sector. -

          Rotate and scale sectors +
          Rotate and scale sectors
          (description to be written) -

          Make door from sector +
          Make door from sector
          (description to be written) -

          Make lift from sector +
          Make lift from sector
          (description to be written) -

          Distribute sector floor heights +
          Distribute sector floor heights
          (description to be written) -

          Distribute sector ceiling heights +
          Distribute sector ceiling heights
          (description to be written) -

          Raise or lower sectors... +
          Raise or lower sectors...
          Prompts you for a number (N) and adds that number to the - floor and ceiling heights of all selected sectors. If N is - positive, this results in raising the sectors by N units. If - N is negative, this results in lowering the sectors by -N - units. + floor and ceiling heights of all the sectors in the working + set. If N is positive, this results in raising the sectors + by N units. If N is negative, this results in lowering the + sectors by -N units. -

          Brighten or darken sectors... +
          Brighten or darken sectors...
          Prompts you for a number (N) and adds that number to the - light level of all selected sectors. If N is positive, this - results in sectors becoming brighter. If N is positive, this - results in sectors becoming darker. No light level is - decreased below 0 or increased above 255. + light level of all the sectors in the working set. If N is + positive, this results in sectors becoming brighter. If N is + positive, this results in sectors becoming darker. No light + level is decreased below 0 or increased above 255. -

          Unlink room +
          Unlink room
          This function is not implemented yet. -

          Mirror horizontally +
          Mirror horizontally
          This function starts by determining the set S - of vertices that are used by the selected sectors. Then all - the vertices in S have their x-coordinate changed - so that they're "mirrored" around the vertical axis that - intersects the geometric centre of S. Finally, - all the linedefs whose both vertices belong to S - are flipped so that the sector references remain correct. + of vertices that are used by the sectors in the working set. + Then all the vertices in S have their + x-coordinate changed so that they're "mirrored" around the + vertical axis that intersects the geometric centre of + S. Finally, all the linedefs whose both vertices + belong to S are flipped so that the sector + references remain correct.

          This function is designed to be used on either the whole level or a group of isolated sectors (like in the @@ -1034,14 +1134,15 @@

          See the "Mirror horizontally" linedef function. -

          Mirror vertically +
          Mirror vertically
          This function starts by determining the set S - of vertices that are used by the selected sectors. Then all - the vertices in S have their y-coordinate changed - so that they're "mirrored" around the horizontal axis that - intersects the geometric centre of S. Finally, - all the linedefs whose both vertices belong to S - are flipped so that the sector references remain correct. + of vertices that are used by the sectors in the working set. + Then all the vertices in S have their + y-coordinate changed so that they're "mirrored" around the + horizontal axis that intersects the geometric centre of + S. Finally, all the linedefs whose both vertices + belong to S are flipped so that the sector + references remain correct.

          This function is designed to be used on either the whole level or a group of isolated sectors (like in the @@ -1059,132 +1160,163 @@

          See the "Mirror vertically" linedef function. -

          Swap flats -
          For each selected sector (or the highlighted sector if the - selection is empty), exchange the floor texture with the - ceiling texture. +
          Swap flats +
          For each sector in the working set, exchange the floor + texture with the ceiling texture.
          -

          Thing miscellaneous operations

          +

          3.16. Thing miscellaneous operations

          + +

          Unless otherwise specified, all the operation below act on +all the objects in the working set. If there is at +least one selected object, the working set is equal to the +selection. If there is no selected object, the working set is +the currently highlighted object (the object under the pointer). +If there is no selection and no highlighted object, the +selection is empty, of course. If there is a selection and an +object outside the selection, the latter is not part of +the working set.

          -

          Find first free tag number +
          Find first free tag number
          Displays the smallest tag number greater than 0 and not - used by any linedef or sector. + used by any linedef or sector. -

          Rotate and scale things +
          Rotate and scale things
          (description to be written) -

          Spin things 45° clockwise -
          Subtract 45 to the angle of all selected things. This is - not to be confused with "Rotate and scale things" where it's - the position of the things that is changed. - -

          Spin things 45° counter-clockwise -
          Add 45 to the angle of all selected things. This is not to - be confused with "Rotate and scale things" where it's the - position of the things that is changed. - -

          Mirror horizontally -
          All the selected things have their x-coordinate changed so - that they're "mirrored" around the horizontal axis that - intersects the geometric centre of the selected things. - Their angle is also adjusted. +
          Spin things 45° clockwise +
          Subtract 45 to the angle of all the things in the working + set. This is not to be confused with "Rotate and scale + things" where it's the position of the things that + is changed. + +
          Spin things 45° counter-clockwise +
          Add 45 to the angle of all the things in the working set. + This is not to be confused with "Rotate and scale things" + where it's the position of the things that is + changed. + +
          Mirror horizontally +
          All the things in the working set have their x-coordinate + changed so that they're "mirrored" around the horizontal + axis that intersects the geometric centre of the things in + the working set. Their angle is also adjusted.

          It is not possible to mirror things without changing their angle (short of commenting out a couple of lines in x_mirror.cc and recompiling, of course). -

          Mirror vertically -
          All the selected things have their y-coordinate changed so - that they're "mirrored" around the horizontal axis that - intersects the geometric centre of the selected things. - Their angle is also adjusted. +
          Mirror vertically +
          All the things in the working set have their y-coordinate + changed so that they're "mirrored" around the horizontal + axis that intersects the geometric centre of the things in + the working set. Their angle is also adjusted.

          It is not possible to mirror things without changing their angle (short of commenting out a couple of lines in x_mirror.cc and recompiling, of course).

          -

          Setting/toggling/clearing thing flags

          +

          3.17. Setting/toggling/clearing thing flags

          In things mode, press [a] to open the "set thing flags" popup menu.
          Press [b] to open the "toggle thing flags" popup menu.
          Press [c] to open the "clear thing flags" popup menu. -

          Vertex miscellaneous operations

          +

          3.18. Vertex miscellaneous operations

          + +

          Unless otherwise specified, all the operation below act on +all the objects in the working set. If there is at +least one selected object, the working set is equal to the +selection. If there is no selected object, the working set is +the currently highlighted object (the object under the pointer). +If there is no selection and no highlighted object, the +selection is empty, of course. If there is a selection and an +object outside the selection, the latter is not part of +the working set.

          -

          Find first free tag number +
          Find first free tag number
          Displays the smallest tag number greater than 0 and not used by any linedef or sector. -

          Rotate and scale vertices +
          Rotate and scale vertices
          (description to be written) -

          Delete vertex and join linedefs +
          Delete vertex and join linedefs
          (description to be written) -

          Merge several vertices into one +
          Merge several vertices into one
          (description to be written) -

          Add a linedef and split sector +
          Add a linedef and split sector
          To perform this operation, you must have exactly two - vertices selected and there must be an uninterrupted path of - linedefs that face a common sector between them. A new - linedef is inserted from the first vertex you selected to - the second. The newly created sector is put on the left - side of the new linedef. - -

          Mirror horizontally -
          All the selected vertices have their x-coordinate changed - so that they're "mirrored" around the vertical axis that - intersects the geometric centre of the selected vertices. - Then all the linedefs whose both vertices belong to the - group of selected vertices are flipped so that the sector - references remain correct. + vertices in the working set and there must be an + uninterrupted path of linedefs that face a common sector + between them. A new linedef is inserted from the first + vertex to the second. The newly created sector is put on the + left side of the new linedef. + +
          Mirror horizontally +
          All the vertices in the working set have their + x-coordinate changed so that they're "mirrored" around the + vertical axis that intersects the geometric centre of the + selected vertices. Then all the linedefs whose both + vertices belong to the group of selected vertices are + flipped so that the sector references remain correct.

          See the "Mirror horizontally" linedef function. -

          Mirror vertically -
          All the selected vertices have their y-coordinate changed - so that they're "mirrored" around the horizontal axis that - intersects the geometric centre of the the selected - vertices. Then all the linedefs whose both vertices belong - to the group of selected vertices are flipped so that the - sector references remain correct. +
          Mirror vertically +
          All the vertices in the working set have their + y-coordinate changed so that they're "mirrored" around the + horizontal axis that intersects the geometric centre of the + the selected vertices. Then all the linedefs whose both + vertices belong to the group of selected vertices are + flipped so that the sector references remain correct.

          See the "Mirror vertically" linedef function.

          -

          Linedef miscellaneous operations

          +

          3.19. Linedef miscellaneous operations

          + +

          Unless otherwise specified, all the operation below act on +all the objects in the working set. If there is at +least one selected object, the working set is equal to the +selection. If there is no selected object, the working set is +the currently highlighted object (the object under the pointer). +If there is no selection and no highlighted object, the +selection is empty, of course. If there is a selection and an +object outside the selection, the latter is not part of +the working set.

          Find first free tag number
          Displays the smallest tag number greater than 0 and not used by any linedef or sector. -

          Rotate and scale LD & SD... +
          Rotate and scale LD & SD...
          (description to be written) -

          Split linedefs (add new vertex) -
          Split all selected linedefs, by adding a vertex in the - middle. +
          Split linedefs (add new vertex) +
          Split all linedefs in the working set, by adding a vertex + in the middle.

          The key [x] is a shortcut to this function. -

          Split linedefs and sector -
          Split both selected linedefs in the middle by adding a - vertex for each, create a linedef between the two new - vertices and split the sector with this new linedef. There - must be exactly 2 selected linedefs and they must face a - common sector. - -

          The new linedef goes from the first selected linedef to - the second selected linedef. The new sector is on the second - sidedef of the new linedef. +

          Split linedefs and sector +
          Split both linedefs in the working set in the middle by + adding a vertex for each, create a linedef between the two + new vertices and split the sector with this new linedef. + There must be exactly 2 linedefs in the working set and they + must face a common sector. + +

          The new linedef goes from the first linedef in the + working set to the second linedef in the working set. The + new sector is on the second sidedef of the new linedef.

          There is a bug in this function ; if the sector contains other sectors, some sidedefs are given the wrong sector @@ -1193,69 +1325,74 @@

          The key [w] is a shortcut to this function. -

          Delete linedefs and join sector +
          Delete linedefs and join sector
          (description to be written) -

          Flip linedefs -
          The start and end vertices of the selected linedefs are - swapped. Their sidedefs are also swapped, so that the sector - references remain correct. +
          Flip linedefs +
          The start and end vertices of the linedefs in the working + set are swapped. Their sidedefs are also swapped, so that + the sector references remain correct.

          If you want to flip linedefs without swapping their sidedefs, you have to use "Flip linedefs" then "Swap sidedefs" on them. -

          Swap sidedefs -
          Swap the sidedefs of the selected linedefs +
          Swap sidedefs +
          Swap the sidedefs of the linedefs in the working set without flipping the linedefs. This means that the sector references are also swapped. If you don't understand what this implies, don't use this function. -

          Align textures (Y offset) +
          Align textures (Y offset)
          This function is buggy. -

          Align textures (X offset) +
          Align textures (X offset)
          This function is buggy. -

          Remove 2nd sidedef (make single-sided) +
          Remove 2nd sidedef (make single-sided)
          When two superimposed linedefs are merged, the result is often a two-sided linedefs, even though the second sidedef faces no sector. Use this function to fix the mess. -

          It sets the I flag, clears the 2 flag and sets the second - sidedef to -1. +

          It sets the I flag, clears the 2 flag, sets the second + sidedef to -1, clears the upper and lower texture and + resets the middle texture to the default (as defined in + the preferences). -

          Make rectangular nook (32x16) +
          Make rectangular nook (32x16)
          This is a single-key function to make a rectangular nook in the middle of a linedef. "Nook" means that, seen from the first side of the original linedef, the resulting 5 linedefs form a concave figure.

          If the linedef is not long enough, the length of the nook - is one third of the length of the linedef. + is one third of the length of the linedef.

          -

          +
          Before After +
          Before After +
          -

          Make rectangular boss (32x16) +
          Make rectangular boss (32x16)
          Same thing as "Make rectangular nook" but the resulting - figure is convex. + figure is convex. -

          Set length (move 1st vertex) +
          Set length (move 1st vertex)
          Prompts you for a length and moves the 1st vertex of the - selected linedefs so that they have the length you specified. + linedefs in the working set so that they have the length you + specified. -

          Set length (move 2nd vertex) +
          Set length (move 2nd vertex)
          Same thing as "Set length (move 1st vertex) but moves the - 2nd vertex. + 2nd vertex. -

          Unlink 1st sidedef +
          Unlink 1st sidedef
          This function is used when you have several linedefs sharing common sidedefs and you don't want them to share any sidedefs anymore so that you can, for instance, change the @@ -1263,43 +1400,45 @@ independently from the others.

          Here is how it works : all sidedefs that are used on - the first side of any linedef in the selection and on any - side of any linedef not in the selection are + the first side of any linedef in the working set and on any + side of any linedef not in the working set are duplicated and the first side of the concerned linedefs in - the selection is set to use the copy instead of the + the working set is set to use the copy instead of the original. -

          Gotcha : note that the selected linedefs are not - "unlinked" from each other. They are only "unlinked" from - any other (i.e. non-selected) linedefs. Thus, if you have - n linedefs that you want to unlink from each other, - you have to unlink every one of them separately. This is so - that, if you have, say, two square pillars (2 x 4 linedefs - that all use the same sidedef), you can easily unlink one - pillar from the other while still having its 4 linedefs all - use the same sidedef. +

          Gotcha : note that the linedefs in the working set + are not "unlinked" from each other. They are only "unlinked" + from any other (i.e. not in the working set) linedefs. + Thus, if you have n linedefs that you want to + unlink from each other, you have to unlink every one of them + separately. This is so that, if you have, say, two square + pillars (2 x 4 linedefs that all use the same sidedef), you + can easily unlink one pillar from the other while still + having its 4 linedefs all use the same sidedef. -

          Unlink 2nd sidedef +
          Unlink 2nd sidedef
          Same as "Unlink 1st sidedef" but with second sidedef - instead of first sidedef. + instead of first sidedef. -

          Mirror horizontally -
          This function starts by determining the set S - of vertices that are used by any of the selected linedefs. - Then all the vertices in S have their - x-coordinate changed so that they're "mirrored" around the - vertical axis that intersects the geometric centre of +
          Mirror horizontally +

          This function starts by determining the set S + of vertices that are used by any of the linedefs in the + working set. Then all the vertices in S have + their x-coordinate changed so that they're "mirrored" around + the vertical axis that intersects the geometric centre of S. Finally, all the linedefs whose both vertices belong to S are flipped so that the sector - references remain correct. + references remain correct.

          -

          - - -
          Before - After -
          Before - After + + + + +
          Before + After +
          Before + After +

          This function is designed to be used on either the whole @@ -1316,23 +1455,25 @@ copy of it, mirror the copy and paste it on the other side of the room. -

          Mirror vertically -
          This function starts by determining the set S - of vertices that are used by any of the selected linedefs. - Then all the vertices in S have their - y-coordinate changed so that they're "mirrored" around the - horizontal axis that intersects the geometric centre of +
          Mirror vertically +

          This function starts by determining the set S + of vertices that are used by any of the linedefs in the + working set. Then all the vertices in S have + their y-coordinate changed so that they're "mirrored" around + the horizontal axis that intersects the geometric centre of S. Finally, all the linedefs whose both vertices belong to S are flipped so that the sector - references remain correct. + references remain correct.

          -

          +
          Before After +
          Before After +

          This function is designed to be used on either the whole @@ -1348,24 +1489,90 @@ of the axis of symmetry. You can build one staircase, make a copy of it, mirror the copy and paste it on the other side of the room. + +

          Cut a slice out of a sector +

          You must select exactly two linedefs that face the same + sector S. This function creates a linedef A that goes from + the first selected linedef to the second and a linedef B + that goes from the second to the first. A new sector is + created between those four linedefs, with attributes + identical to those of S.

          + + + + + + +
          Before + After +
          Before + After +
          + +

          This function is somewhat similar to + "split-linedefs-and-sector" except that it creates two + linedefs instead of one and that it works on doughnut-shaped + sectors. In fact, this function is the only one that can + split a sector when there is no linedef path between the + split points (which is the case when splitting a + doughnut-shaped sector between its inner and outer borders). + +

          If there is a linedef path between the selected linedefs, + this function is equivalent to using + "add-linedefs-and-split-sector" twice, except that you end + up with two sectors, not three. FIXME - need a figure. + +

          If the selected linedefs happen to share a vertex, only + one linedef is created and the new sector is triangular. The + linedefs must not be the same or superimposed. FIXME - need + a figure. + +

          Linedefs A and B are created with all their attributes + set to zero and their middle textures set to "-". + They're oriented so that their right sidedefs face the new + sector. Linedef A is the lowest-numbered one. + +

          The following restrictions apply : + +

            +
          • selected linedefs must not have two sidedefs in the same sector, +
          • selected linedefs must not share more than one sector, +
          • there must be no linedef that would be superimposed with A or B. +
          + +

          These restrictions are stricter than necessary. They may + be lifted in the future if time and brain power permit. + +

          Because this function is not aware of the geometry of the + selected linedefs, but only of the sectors they face, it can + be used to split sectors in impossible ways. FIXME - need a + figure. + +

          This function assumes the space between the selected + linedefs is empty. If there are any other linedefs there, + you will have to fix their sector references manually + afterwards. + +

          The key [Ctrl-k] is a shortcut to this + function. -

          Setting/toggling/clearing linedef flags

          +

          3.20. Setting/toggling/clearing linedef flags

          In linedefs mode, press [a] to open the "set linedef flags" popup menu.
          Press [b] to open the "toggle linedef flags" popup menu.
          Press [c] to open the "clear linedef flags" popup menu. -

          Undoing

          +

          3.21. Undoing

          As of this release, undoing is not implemented. -

          Cut-and-paste from one level to another

          +

          3.22. Cut-and-paste from one level to another

          As of this release, it's not possible. -

          Using the flat/patch/sprite/texture viewer

          +

          3.23. Using the flat/patch/sprite/texture viewer

          Flats, patches, sprites and textures are browsed and selected with the same basic tool, snappily named the @@ -1420,16 +1627,34 @@ (invalid), [Return] does not work. To cancel, press [Esc]. -

          In the DOS version, pressing [Shift-F1] used to -save the current flat/patch/sprite/texture to a GIF file. -However, in the X11 version, this function is currently a no-op -because I've not taken the time to port the Gifsave library to -Unix yet. Besides, I'd rather use PPM and/or PNG than GIF. +

          [Shift-F1] saves the current image to file, in +packed PPM (P6) format. This can be useful for +textures, that cannot be directly extracted from wads. +Transparent areas are represented according to the DeuTex +convention by colour rgb:0/2f/2f (). The file is created in the +working directory and its name is the name of the image +lowercased and suffixed by ".ppm". For example, flat +"FLOOR0_7" would be saved as "./floor0_7.ppm". +If the file already exists, it's mercilessly overwritten. + +

          Note that under MS-DOS, newlines in the PPM header are in +Unix format (LF, not CR LF).

          + +

          There are a few bugs left in this function. Textures are +clipped to the dimension of the viewer window. Under MS-DOS, +some "VILE*" sprites will not save, because their names +contain characters that are not allowed in file names +("[", "\" and "]").

          [F1] prints to stdout the location (file name and offset) of the current flat, patch or sprite. For debugging purposes. +

          When viewing textures, you may press [Ctrl-a] and +[Ctrl-x] to cycle through the patches that make up +the texture. +

          Finally when viewing sprites, two other useful commands are [Ctrl-n] and [Ctrl-p]. These go respectively to the next and previous group of sprites (all @@ -1437,12 +1662,12 @@ group). It's handy to skip the 69 animation frames of the heavy weapon dude at once. -

          Saving

          +

          3.24. Saving

          There are two ways to save : -

            -
          • Press [F2] or do "File->Save". If the level +
              +
            • Press [F2] or do "File->Save". If the level comes from the iwad or if its level name or file name is unknown (because it's a new level), you are prompted for a level name (EnMn or MAPnm) and a file name first. If the @@ -1453,7 +1678,7 @@

              The level in the window is saved in the specified file, in the pwad format, under the specified . -

            • Press [F3] or do "File->Save as". +
            • Press [F3] or do "File->Save as". This procedure is identical to the "Save" procedure except that the query for a level name and file name is unconditional. @@ -1466,16 +1691,16 @@ -

              Closing a window

              +

              3.25. Closing a window

              There are two ways to close a window : -

                -
              • Press [Esc]. If you have made changes since the +
                  +
                • Press [Esc]. If you have made changes since the last time you saved, or if you have never saved, Yadex requires confirmation before closing the window. -

                • Press [q] or do "File->Quit". If +
                • Press [q] or do "File->Quit". If you have made changes since the last time you saved, or if you have never saved, Yadex first saves the level, using the same procedure as when you press [F2]. After that @@ -1485,171 +1710,578 @@

                -


                -

                - 4. Configuring and customizing Yadex

                +
                +

                4. Variables and configuration

                -

                There are several ways to configure Yadex : -the configuration file, the environment variables, -the command line options and the Preferences menu. +

                + Yadex has internal variables that serve to configure its + behaviour. Variables have a name (a string of letters, digits + and underscores), a type and a value. The type constraints + the value (boolean, integer, strings, etc.). +

                -

                The choices made in the Preferences menu override all others -but they are lost when you exit Yadex. +

                + Variables can be set in four ways : +

                + +
                  +
                • from the Preferences menu, +
                • from the command line, +
                • through environment variables. +
                • from the configuration files, +
                -

                The command line options override the environment variables -which in turn override the configuration file. +

                + The settings from the Preferences menu override those from the + command line options which in turn override those from the + environment variables which in turn override those from the + configuration files. +

                -

                The details of command line options and environment -variables are explained elsewhere. +

                4.1. Variables

                -

                Preferences

                +

                + You can get a list of variables with their description and value + by typing set at the yadex: prompt. +

                -

                When you create objects, their properties are automatically -given default values. Some of those default values can be set -from the configuration file or from the command line but also -through the Preferences menu, that pops up when you press -[F5]. +

                4.1.1. The font

                -

                The settings entered through the Preferences menu are lost -when you exit Yadex. +

                + By default, Yadex uses the default font of your system (that + is often "fixed" a.k.a. "6x13"). But + you can use the font of your choice by using the "-fn + font_name" option or setting + "font = font_name" in + yadex.cfg. You should use a fixed-width font and + not one that is too large for the size of your Yadex window or + the display will look ugly. If Yadex does not find the + specified font, it emits a warning and falls back on the + default system font. +

                -

                Configuration file

                +

                + You can get a list of all available fonts on your system with + the command xlsfonts. +

                -

                If you don't specify "-f" on the command line, -Yadex tries to open the following files in order : +

                4.1.2. Mouse wheel and other mouse issues

                -

                  -
                1. ./yadex.cfg -
                2. ~/.yadex/version/yadex.cfg -
                3. ~/.yadex/yadex.cfg -
                4. install_dir/yadex.cfg -
                5. /usr/local/etc/yadex/version/yadex.cfg -
                6. /usr/local/etc/yadex/yadex.cfg -
                7. /etc/yadex/version/yadex.cfg +

                  + The 3rd mouse button (middle button) is not used yet but you + can bet it will a future version. So a 3-button mouse is of + course recommended. +

                  + +

                  + You can swap the left and right buttons by setting the swap_buttons + variable. +

                  + +

                  + Buttons 4 and 5 are used for zooming in and out. Wheel mice + typically have the wheel mapped to buttons 4 and 5 in such a + way that when you roll the wheel "up" (forwards), button4 + press events are generated and when you roll the wheel "down" + (backwards), button5 press events are generated. +

                  + +

                  + To configure your X server in the way described above, check + the vendor documentation. I have XFree86 and a Logitech Pilot + Mouse + and this is what I put in my XF86Config + file : +

                  + +
                  +
                  Section "Pointer"
                  +    Protocol      "Intellimouse"
                  +    Device        "/dev/mouse"
                  +    Buttons       5
                  +    ZAxisMapping  4 5
                  +
                  + +

                  4.2. Preferences

                  + +

                  + When you create objects, their properties are automatically + given default values. Some of those default values can be set + from the configuration file or from the command line but also + through the Preferences menu, that pops up when you press + [F5]. +

                  + +

                  + The Preferences menu lets you set the default_* + variables interactively. The settings made from the + Preferences menu are lost when you exit Yadex. +

                  + +

                  4.3. Command line

                  + +

                  + See the Options section. +

                  + +

                  4.4. Environment variables

                  + +

                  + See the Environment variables section. +

                  + +

                  4.5. Configuration files

                  + +

                  4.5.1. Contents of configuration files

                  + +

                  Configuration files are text files. White space at the +beginning of a line is ignored. There are three kinds of +lines : + +

                  +
                  Empty lines (lines containing only white space) +
                  +

                  + No effect. +

                  + +
                  Comments (lines whose first non white space character is a + #) +
                  +

                  + No effect. +

                  + +
                  Variable assignments (lines of the form "name + = value") +
                  +

                  The effect is to assign value to the variable + name. name is a string of one or more + identifier characters i.e. letters, digits and + underscores. value is a string of zero or more + non white space characters. There may be any amount of + white space around and between the three tokens, including + none at all. +

                  + +

                  + Please note that : +

                  + +
                    +
                  • +

                    + # is special only at the beginning of a + line. Therefore you can't put a comment on the same + line as a variable assignment. +

                    +
                  • + +
                  • +

                    + Because white space is a token delimiter and there's + no way to quote or escape it, including white space in + a value is impossible. +

                    +
                  • + +
                  • +

                    + Yadex's idea of what is a letter or digit is + deliberately locale-independent. Whether it's white + space or not, on the other hand, is locale-dependent + (isspace(3)). +

                    +
                  • +
                  +
                  + +

                  + Parse errors are not fatal. In general, they cause a warning + message to be printed and the entire line to be ignored. This + is to facilitate the sharing of configuration files across + versions of Yadex. +

                  + +

                  + The configuration file is self-documenting. Look at the sample + configuration file in the Yadex distribution to see what + options are available. +

                  + +

                  4.5.2. Locating + configuration files

                  + +

                  + This is the process by which Yadex turns a configuration file + name into one or more actual pathnames. +

                  + +

                  + If the specified name is absolute, the location yields exactly + that. A name is considered absolute if and only if it begins + with a /. +

                  + +

                  + If the specified name is relative, Yadex uses a search path, + much like the shell uses $PATH to locate + commands. The composition of the search path depends on the + installation prefix (the argument to ./configure + --prefix). +

                  + +
                  +
                  /usr/local or /usr : +
                  +
                    +
                  1. . +
                  2. ~/.yadex/$VERSION +
                  3. ~/.yadex +
                  4. /etc/yadex/$VERSION +
                  5. /etc/yadex +
                  + +
                  /opt/some/path : +
                  +
                    +
                  1. . +
                  2. ~/.yadex/$VERSION +
                  3. ~/.yadex +
                  4. /etc/opt/some/path +
                  + +
                  /some/path : +
                  +
                    +
                  1. . +
                  2. ~/.yadex/$VERSION +
                  3. ~/.yadex +
                  4. /some/path/etc +
                  +
                  + +

                  + The search path may be walked in either direction, depending + on the application. For each element in the search path, a + pathname is made by concatenating the path and the specified + name. The pathname is tested with stat(2). The + result of the location is the list of the pathnames that exist + and are not directories. +

                  + +

                  + For example, assuming Yadex was compiled with the + /usr/local prefix, a front-to-back search for a + file named foo/bar.cfg would return those of the + following pathnames that exist and are not directories : +

                  + +
                    +
                  1. ./foo/bar.cfg +
                  2. ~/.yadex/$VERSION/foo/bar.cfg +
                  3. ~/.yadex/foo/bar.cfg +
                  4. /etc/yadex/$VERSION/foo/bar.cfg +
                  5. /etc/yadex/foo/bar.cfg +
                  + +

                  4.5.3. Default configuration files

                  + +

                  + By default, Yadex performs a back-to-front search for files + named yadex.cfg and reads all the matches in + order. For example, assuming Yadex was compiled with the + /usr/local prefix, the following configuration + files will be read if they exist : +

                  + +
                  1. /etc/yadex/yadex.cfg +
                  2. /etc/yadex/$VERSION/yadex.cfg +
                  3. ~/.yadex/yadex.cfg +
                  4. ~/.yadex/$VERSION/yadex.cfg +
                  5. ./yadex.cfg
                  -

                  The first file found is used. +

                  + Because the search path is walked back-to-front, any parameter + settings in a local configuration file override the settings + inherited from less local configuration files. For example, + assuming /etc/yadex/$VERSION/yadex.cfg + contains : +

                  + +
                  + + a = old
                  + b = old +
                  +
                  + +

                  + and ./yadex.cfg contains : +

                  + +
                  + + a = new
                  + c = new +
                  +
                  + +

                  + the net effect is : +

                  + +
                  + + a = new
                  + b = old
                  + c = new +
                  +
                  + +

                  4.5.4. User-specified configuration files

                  + +

                  + The -f option can be used to override Yadex's + default choice of configuration files. +

                  + +

                  + If Yadex is started with the -f option, the + default configuration files are not used. Instead, Yadex + performs a front-to-back search for the argument of the + -f option, according to the algorithm described + in Locating configuration files. + The first match is used as a configuration file. Any other + matches are ignored. +

                  -

                  If you use "-f file" and -"file" is an absolute name (i.e. it -starts with "/"), only that name is used. - -

                  If "file" is a relative name, the -standard directories will be searched for a file of that name -instead of "yadex.cfg". For example, if you -specify "-f foo/bar", Yadex will try to open -"./foo/bar", -"~/.yadex/version/foo/bar", and so on. - -

                  For Yadex to recognize the file as a configuration file, its -first line must contain exactly the following characters : -"# Yadex configuration file version 2" -(without the double quotes). If it doesn't, Yadex will print an -error message and bail out. The reason for being so fussy is to -avoid headaches when the configuration file format changes and -there are old configuration files lying around in your -directories. - -

                  The configuration file is self-documenting. Look at the -sample configuration file in the Yadex distribution to see what -options are available. - -

                  Game definition files

                  - -

                  A lot of Yadex's knowledge about thing numbers and names, -linedef types etc. is stored in so-called game definition files. -When you specify "-g foo", it in fact means that -Yadex should use the game definition file named -"foo.ygd". +

                  + For example, assuming Yadex was built with the + /usr/local prefix and run with the + -f myown.cfg option, it will use the first + file in this list that exists and is not a directory : +

                  -

                  When looking for the game definition file, Yadex tries those -names in order :

                    -
                  1. ./game.ygd -
                  2. ~/.yadex/version/game.ygd -
                  3. install_dir/game.ygd -
                  4. /usr/local/share/games/yadex/version/game.ygd -
                  5. /usr/share/games/yadex/version/game.ygd +
                  6. ./myown.cfg +
                  7. ~/.yadex/$VERSION/myown.cfg +
                  8. ~/.yadex/myown.cfg +
                  9. /etc/yadex/$VERSION/myown.cfg +
                  10. /etc/yadex/myown.cfg
                  -

                  For Yadex to recognize the file as a game definition file, -they must begin with a certain magic string. If they don't, -Yadex will print an error message an bail out. The reason for -being so fussy is to avoid headaches when the game definition -file format changes and there are old game definition files -lying around in your directories. +

                  4.5.5. Organising your configuration files

                  + +

                  + As Yadex looks for its configuration files in several places, + you are put in the situation of having to decide which one to + use. Here are a few guidelines to help you make a decision. +

                  + +
                  +
                  Avoid redundancy +
                  +

                  + Take advantage of Yadex's ability to use more than one + config file. Put each setting in the right place. Your + config files will be easier to read and maintain. +

                  + +
                  Versionless vs. versionful files +
                  +

                  + Versionful files + (/etc/yadex/$VERSION/yadex.cfg and + ~/.yadex/$VERSION/yadex.cfg) are useful to + store settings that only work with a particular version of + Yadex. But remember that the versionful system-wide file + can be clobbered by a reinstallation. +

                  + +

                  + Versionless files (/etc/yadex/yadex.cfg and + ~/.yadex/yadex.cfg) have the advantage of + being seen by all versions of Yadex. If you enter your + settings there, you won't have to enter them again when + you install a new version of Yadex, as long as the config + file syntax remains compatible. +

                  + +
                  System-wide vs. user vs. local files +
                  +

                  + System-wide configuration files have the theoretical + advantage of being seen by all users, which makes them a + good place to put settings that apply to everybody, such + as the pathnames of the iwads. Of course, it doesn't make + any difference for the typical (single-user) Yadex + installation. +

                  + +

                  + Per-user files (the ones in ~/.yadex) are + appropriate for settings that have to do with personal + preferences (fonts etc.). They also have the advantage + over system-wide files of not being overwritten by the + installation procedure (typing make install a + second time will wipe the versionful system file). +

                  + +

                  + Local files (./yadex.cfg) are well suited to + settings that vary from project to project, such as + default textures. +

                  +
                  + +

                  + Concrete application : Yadex was compiled with + /usr/local as the prefix. You are the only user + on your system. All your levels are for Doom 2, except + the one in ~/herewad which is for Heretic. One of + your Doom 2 levels (~/cave) is quite dark + and requires a different default light level. You usually run + Yadex from the directory where the pwad is. +

                  -

                  Game definition files are not supposed to be modified in -normal use. Their format is described there. +

                  + There are several ways to configure Yadex for this setup. + Here's a solution in accordance with the above + guidelines : +

                  +

                  + ~/.yadex/yadex.cfg : +

                  -

                  The font

                  +
                  +
                  iwad2 = /somewhere/doom2.wad
                  +iwad3 = /somewhere/else/heretic.wad
                  +game  = doom2
                  +
                  -

                  By default, Yadex uses the default font of your system (that -is often "fixed" a.k.a. "6x13"). But -you can use the font of your choice by using the "-fn -font_name" option or setting -"font = font_name" in -yadex.cfg. You should use a fixed-width font and -not one that is too large for the size of your Yadex window or -the display will look ugly. If Yadex does not find the specified -font, it emits a warning and falls back on the default system -font. +

                  + ~/herewad/yadex.cfg : +

                  -

                  You can get a list of all available fonts on your system -with the command xlsfonts. +

                  +
                  game                    = heretic
                  +default_floor_texture   = floor11
                  +default_ceiling_texture = floor06
                  +default_lower_texture   = sandsq2
                  +default_middle_texture  = sandsq2
                  +default_upper_texture   = sandsq2
                  +default_thing           = 66
                  +
                  -

                  Mouse wheel and other mouse issues

                  +

                  + ~/cave/yadex.cfg : +

                  -

                  Button 3

                  +
                  +
                  default_light_level = 112
                  +
                  -

                  The mouse 3rd button is not used yet but you can bet it will -a future version. So a 3-button mouse is of course recommended. +

                  + Note how game is set in the per-user config file + (the general case) and overridden in the local config file for + Heretic level (the exception). +

                  -

                  Buttons 4 and 5

                  +
                  +

                  5. Game definition files

                  -

                  People who have a mouse with more than 3 buttons, -rejoyce ! Buttons 4 and 5 are used (for zooming in and -out). See the paragraph on mice wheels below. +

                  + Most of Yadex's knowledge about thing numbers and names, + linedef types etc. is retrieved from so-called game definition + files. When you specify "-g foo", it in + fact means that Yadex should use the game definition file + named "foo.ygd". +

                  -

                  Swapping buttons

                  +

                  5.1. Contents of game definition files

                  -

                  You can swap the left and right buttons by setting the swap_buttons -variable. +

                  + For Yadex to recognize the file as a game definition file, it + must begin with a certain magic string. If it doesn't, Yadex + will print an error message an bail out. The reason for being + so fussy is to avoid headaches when the game definition file + format changes and there are old game definition files lying + around in your directories. +

                  -

                  Wheel

                  +

                  + Game definition files are not supposed to be modified in + normal use. Their format is described in ygd.html. +

                  -

                  The wheel that certain recent mice have is supported. But to -be able to use it, you need to first make X aware that your -mouse has a wheel. There are several ways to do that and they -might vary depending on which X server you have. I have XFree86 -and a Logitech Pilot Mouse + and this is what I put in my -XF86Config file : +

                  5.2. Locating game definition + files

                  -

                  Section "Pointer"
                  -    Protocol      "Intellimouse"                                      
                  -    Device        "/dev/mouse"                                      
                  -    Buttons       5                                                 
                  -    ZAxisMapping  4 5
                  + The algorithm used to locate game definition files is exactly + the same as the one described in Locating configuration files. Only + the search path is different. As is the case for config files, + it depends on the prefix for which Yadex was compiled. +

                  -

                  This means that the wheel is mapped to buttons 4 and 5. When -you roll the wheel "up" (forwards), button4 press events are -generated. When you roll the wheel "down" (backwards), button5 -press events are generated. - -

                  Once you have done that, not only you can use the wheel in -Yadex to zoom in and out but can also use it in all other X -applications. That is, those that have bindings for buttons 4 -and 5. One such application is xterm : the wheel -scrolls the window up and down through the scrolling region. - -


                  -

                  - Annex A: known bugs

                  +
                  +
                  /usr : +
                  +
                    +
                  1. . +
                  2. ~/.yadex/$VERSION +
                  3. ~/.yadex +
                  4. /usr/share/games/yadex/$VERSION +
                  5. /usr/share/games/yadex +
                  + +
                  /usr/local : +
                  +
                    +
                  1. . +
                  2. ~/.yadex/$VERSION +
                  3. ~/.yadex +
                  4. /usr/local/share/games/yadex/$VERSION +
                  5. /usr/local/share/games/yadex +
                  + +
                  /opt/some/path : +
                  +
                    +
                  1. . +
                  2. ~/.yadex/$VERSION +
                  3. ~/.yadex +
                  4. /opt/some/path/share +
                  + +
                  /some/path : +
                  +
                    +
                  1. . +
                  2. ~/.yadex/$VERSION +
                  3. ~/.yadex +
                  4. /some/path/share +
                  +
                  + +

                  5.3. Use of game definition files

                  + +

                  + On startup, Yadex loads the game definition file corresponding + to the game variable. It performs a front-to-back + search (see Locating game definition + files) for a file named game.ygd. + The first match is used. +

                  + +
                  +

                  6. Known bugs

                  Though Yadex has quite a few bugs, most of them are inconsequential, i.e. not likely to make Yadex unusable or @@ -1657,43 +2289,63 @@ bite. Those are the ones you should know about :

                    -
                  • Command line options that take an argument need to have a - space between their argument and themselves. +
                  • +

                    Command line options that take an argument need to have + a space between their argument and themselves.

                    + +
                  • +

                    Exposure events are not always handled. If the Yadex + window turns black, back out by pressing [Esc], + several times if necessary.

                    + +
                  • +

                    If you edit a level from a file that contains several and + save it, all the other levels, textures, flats, etc. from + that file are lost.

                    + +
                  • +

                    Out-of-memory conditions and certain wad I/O errors are + handled in a very ungraceful manner. Basically, + Yadex aborts and if you haven't saved, you've lost all your + work. My advice :

                    -
                  • Exposure events are not always handled. If the Yadex - window turns black, back out by pressing [Esc], - several times if necessary. - -
                  • If you edit a level from a file that contains several and - save it, all the other levels, textures, flats, etc. from that - file are lost. +
                      +
                    • Make sure you have at least a couple of megs of free + memory. +
                    • Save often and make backups. +
                    • Don't use wads that contain errors. +
                    • Make sure you have enough disk space and adequate + permissions. +
                    • Don't modify files with an external program while + Yadex uses them. For example, if you use a texture wad, + don't rebuild it without quitting Yadex first. +
                  -Check TODO for a complete list -of things to fix. +

                  Check TODO for a complete +list of things to fix. -


                  -

                  - Annex B: Which games are supported ?

                  +
                  +

                  7. Supported games

                  -

                  Doom

                  +

                  7.1. Doom

                  Supported. Linedef types and sector types added in v. 1.666 are supported and marked with "[v1.6]". -

                  Doom II

                  +

                  7.2. Doom II

                  Supported. -

                  Doom alpha

                  +

                  7.3. Doom alpha

                  Mostly supported. There are three Doom alpha versions that I know of : 0.2, +href="ftp://3darchives.in-span.net/pub/idgames/historic/doom0_2.zip">0.2, 0.4 +href="ftp://3darchives.in-span.net/pub/idgames/historic/doom0_4.zip">0.4 and 0.5. +href="ftp://3darchives.in-span.net/pub/idgames/historic/doom0_5.zip">0.5. They're supported to varying degrees of completeness. All graphics resources (flats, patches, PLAYPAL, sprites and textures) are supported for all versions with the @@ -1722,7 +2374,7 @@ of it. If you want to do it, I won't discourage you and I will gladly accept patches. -

                  Doom press release pre-beta

                  +

                  7.4. Doom press release pre-beta

                  Supported. The different picture format is handled. Things type 2016 (evil sceptre) and 2017 (unholy bible) are defined in @@ -1735,34 +2387,47 @@ does not support sprites in pwads (yet). To see the sprites for the evil sceptre and the unholy bible as well as the alternate versions of the other sprites, you need to use the iwad from doomprbt.zip. -

                  Final Doom

                  +

                  7.5. Final Doom

                  Supported, AFAIK. The iwads have no F1_START/F1_END labels and some levels contain a thing of type 0 which made older versions of Yadex crash. This has been fixed in version 1.1.0. -

                  Heretic

                  +

                  7.6. Heretic

                  -

                  Supported. Still missing: the sprite names for a couple of -thing types. If there is a Heretic hacker out there willing to -help, he/she is welcome. See "heretic.ygd". +

                  Supported. -

                  Hexen

                  +

                  7.7. Hexen

                  Very rudimentary support. You can load Hexen wads and edit -the maps. But the things types are not all there. And the -special features of Hexen (BEHAVIOR lump, new thing -and linedef fields) are stripped off on reading. So don't try to -save a Hexen level after editing it, you won't be able to use it -with Hexen. And if you're saving it to the file it comes from, -you'll lose your file. Don't save when in Hexen -mode. +the maps but most of Hexen's special features are stripped off +on reading. So don't try to save a Hexen level after editing it, +you won't be able to use it with Hexen. And if you're saving it +to the file it comes from, you'll lose your file. Don't +save when in Hexen mode.. Here's the breakdown : -

                  Strife

                  +
                    +
                  • Most thing types, and some sector and linedef types are + missing from hexen.ygd. +
                  • For things, tid, z, + special and arg1 through + arg5 are discarded. There is currently no way + to examine or manipulate them from Yadex. +
                  • For linedefs, arg1 is put into + tag. arg2 through + arg5 are discarded and there is currently no way + to examine or manipulate them from Yadex. +
                  • The Hexen-specific thing and linedef flags are not + recognized (but you can manipulate them). +
                  • BEHAVIOR is ignored. +
                  • MAPINFO is ignored. +
                  + +

                  7.8. Strife

                  Supported, except that : @@ -1782,11 +2447,11 @@ format as Doom for textures, Strife 1.1 and later use a different format. -

                  Ultimate Doom

                  +

                  7.9. Ultimate Doom

                  Supported. -

                  Boom

                  +

                  7.10. Boom

                  Kind of supported, only very inconvenient to use <g>. @@ -1812,43 +2477,31 @@ In progress... -

                  MBF

                  +

                  7.11. EDGE

                  + +

                  The default DDF definitions included in EDGE 1.24 have been +added to doom.ygd and doom2.ygd, +marked with "[EDGE]". When the pointer moves over a +sector that has extrafloors, the object info window shows the +information relevant to those. To see the sprite for the night +vision goggles (thing #7000), you must load +edge.wad. + +

                  As of 1.5.0, the support for DDF is static : custom DDF +files or DDF lumps are ignored. In other words, you are limited +to the default DDF definitions. + +

                  7.12. MBF

                  -Mostly supported, I think. Thing 888 (dog), thing flag 80h +

                  Mostly supported, I think. Thing 888 (dog), thing flag 80h (friendly), linedef types 271 and 272 are all in. You can't see the sprite for the dog because it's embedded in the MBF executable. -

                  Other derivatives

                  - -

                  Not supported so far. - -


                  -

                  - Annex C: Legal

                  - -

                  Yadex is GPL'd libre software. It incorporates code from DEU -5.21 that was put in the public domain in 1994 by Raphaël Quinet -and Brendon Wyber. The rest is Copyright © 1997-2000 André -Majorel. - -

                  This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of -the License, or (at your option) any later version. - -

                  This program is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied -warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -See the GNU General Public License for more details. - -

                  You should have received a copy of the GNU General Public -License along with this program; if not, write to the Free -Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, -USA. +

                  7.13. Other derivatives

                  -

                  All trademarks are the propriety of their owners. +

                  Not supported so far.

                  -


                  AYM $SELF_DATE +
                  AYM $SELF_DATE diff -uaNr yadex-1.5.2/docsrc/yadex.6 yadex-1.6.0/docsrc/yadex.6 --- yadex-1.5.2/docsrc/yadex.6 2000-08-13 20:21:12.000000000 +0200 +++ yadex-1.6.0/docsrc/yadex.6 2003-03-31 19:05:07.000000000 +0200 @@ -227,8 +227,8 @@ ("\fB$VERSION\fP"). The third field is the release date, between parentheses ("\fB($SOURCE_DATE)\fP"). -The second line contains the magic string that this version -requires at the beginning of configuration files. +The second line contains a configuration file magic string (not +used). The third line contains the magic string that this version requires at the beginning of game definition files. @@ -250,49 +250,30 @@ This option is equivalent to and overrides the \fBzoom_default\fP directive of the configuration file. .SH FILES -.TP -.B Configuration file -.B ./yadex.cfg -.br -.B ~/.yadex/$VERSION/yadex.cfg -.br -.B ~/.yadex/yadex.cfg -.br -.IB install_dir /yadex.cfg -.br -.B /usr/local/etc/yadex/$VERSION/yadex.cfg -.br -.B /usr/local/etc/yadex/yadex.cfg -.br -.B /etc/yadex/$VERSION/yadex.cfg -.br -.B /etc/yadex/yadex.cfg -.TP -.B Game definition file -.BI ./ game .ygd -.br -.BI ~/.yadex/$VERSION/ game .ygd -.br -.IB install_dir / game .ygd +.SS Configuration files +.nf +$FILES_ETC +.fi +.SS Game definition files +.nf +$FILES_SHARE +.fi +.SS Swap files +.B $TMPDIR/yadexswp?????? .br -.BI /usr/local/share/games/yadex/$VERSION/ game .ygd -.br -.BI /usr/share/games/yadex/$VERSION/ game .ygd -.br -.BI /usr/local/share/games/yadex/ game .ygd -.br -.BI /usr/share/games/yadex/ game .ygd +.B /tmp/yadexswp?????? .SH ENVIRONMENT VARIABLES .IP \fBDISPLAY\fP X11 only. The name of the X display that Yadex will try to connect to. +.IP \fBHOME\fP +Used to expand \fB~\fP when locating configuration and game +definition files. .IP \fBLINES\fP If set, Yadex assumes the tty has that many lines instead of 24. The value must be an unsigned, non-zero decimal integer. -.IP \fBYADEX_DIR\fP -Unix only. Where Yadex is installed. Can be used to look for the -configuration file and friends. For testing purposes only. Not -needed in normal use. +.IP \fBTMPDIR\fP +If set, swap files are created there. Otherwise, in \fB/tmp\fP. .IP \fBYADEX_GAME\fP Indicates the game to use. Overrides the \fBgame\fP parameter in the config file, is overridden by the \fB\-g\fP command line @@ -316,17 +297,23 @@ And many more. See \fBTODO\fP. .SH AUTHOR -André Majorel . +André Majorel (http://www.teaser.fr/~amajorel/) + +.nf +Contributors: +Andrew J. Apted (http://www.netspace.net.au/~ajapted/) +Matthew W. Miller (mwmiller@columbus.rr.com) +.fi Yadex is derived from DEU 5.21 that was written by Raphaël Quinet, Brendon Wyber and others. See the HTML documentation for detailed credits. .SH LEGAL -Yadex incorporates code from DEU 5.21 that was put in the public -domain in 1994 by Raphaël Quinet and Brendon Wyber. - -The rest of Yadex is Copyright © 1997-2000 André Majorel. +.SS Yadex +.nf +$COPYRIGHT_MAN +.fi 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 @@ -342,20 +329,46 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +.SS Atclib +The Yadex distribution includes a subset of Atclib. + +Atclib is copyright André Majorel 1995-1999 and distributed under the terms of +version 2 of the GNU Library General Public License. -All trademarks are the propriety of their owners. +This library is free software; you can redistribute it and/or +modify it under the terms of version 2 of the GNU Library General Public +License as published by the Free Software Foundation. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free +Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +MA 02111-1307, USA +.SS Boost +The Yadex distribution includes a subset of Boost 1.25.0. + +Boost 1.25.0 is copyright various authors and released under the following +terms\ : Permission to copy, use, modify, sell and distribute this software is +granted provided this copyright notice appears in all copies. +This software is provided "as is" without express or implied warranty, and with +no claim as to its suitability for any purpose. .SH SEE ALSO .BR bsp (6), .BR idbsp (6), .BR tkwadcad (6), .BR warm (6), -.BR xwadtools (6), -.BR ybsp (6) +.BR xwadtools (6) .IP LDE -http://www-unix.oit.umass.edu/~tetron/lde/ +http://interreality.org/~tetron/technology/lde/ .IP PFME http://www.purplefrog.com/~thoth/purplefrog/editor.html +.IP Why +http://www.hut.fi/~jpakkane/why/ .IP "Xwad (part of Dumb)" http://stekt.oulu.fi/~tosi/dumb/dumb.html .IP Xwadtools -ftp://ftp.cdrom.com/pub/idgames/source/ +ftp://3darchives.in-span.net/pub/idgames/source/ diff -uaNr yadex-1.5.2/docsrc/ygd.html yadex-1.6.0/docsrc/ygd.html --- yadex-1.5.2/docsrc/ygd.html 2000-06-03 14:20:19.000000000 +0200 +++ yadex-1.6.0/docsrc/ygd.html 2003-02-21 23:34:55.000000000 +0100 @@ -448,7 +448,7 @@ colour desc

                  -

                  Defines a group of thing types. Takes exactly 4 arguments.

                  +

                  Defines a group of thing types. Takes exactly 3 arguments.

                  diff -uaNr yadex-1.5.2/patch/README yadex-1.6.0/patch/README --- yadex-1.5.2/patch/README 2000-08-27 21:08:48.000000000 +0200 +++ yadex-1.6.0/patch/README 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -Patches for Yadex ------------------ - -gcc-2.7.diff To compile Yadex 1.5.0 with GCC 2.7. To apply, - - cd yadex-1.5.0 - patch -p1 . - It barfs if you use -> on the right hand of an - iterator. It's a pain. - - I consider GCC 2.7 obsolete, and not a supported - compiler for Yadex. This patch will rot or go - away. Please upgrade. More recent versions of - EGCS and GCC work fine. - --- AYM 2000-08-27 diff -uaNr yadex-1.5.2/patch/gcc-2.7.diff yadex-1.6.0/patch/gcc-2.7.diff --- yadex-1.5.2/patch/gcc-2.7.diff 2000-08-27 20:20:14.000000000 +0200 +++ yadex-1.6.0/patch/gcc-2.7.diff 1970-01-01 01:00:00.000000000 +0100 @@ -1,220 +0,0 @@ -diff -ur yadex-1.5.0/src/bench.cc yadex-1.5.0-gcc27/src/bench.cc ---- yadex-1.5.0/src/bench.cc Sun Aug 13 16:43:11 2000 -+++ yadex-1.5.0-gcc27/src/bench.cc Sun Aug 27 17:41:26 2000 -@@ -33,10 +33,12 @@ - #include - #include - -+#define times FOOBAR - #include "gfx.h" - #include "img.h" - #include "pic2img.h" - #include "wadres.h" -+#undef times - - - -diff -ur yadex-1.5.0/src/drawmap.cc yadex-1.5.0-gcc27/src/drawmap.cc ---- yadex-1.5.0/src/drawmap.cc Thu Aug 24 15:36:36 2000 -+++ yadex-1.5.0-gcc27/src/drawmap.cc Sun Aug 27 18:03:49 2000 -@@ -518,6 +518,7 @@ - class Thing_npixels - { - public : -+ Thing_npixels () : thing_no (0), npixels (0), type (0) { } - Thing_npixels (i16 thing_no, unsigned long npixels, wad_ttype_t type) - : thing_no (thing_no), npixels (npixels), type (type) { } - bool operator< (const Thing_npixels& other) const -@@ -541,7 +542,7 @@ - const Thing_npixels& operator[] (int n) { return a[n]; } - void refresh () - { -- a.clear (); -+ a.erase (a.begin (), a.end ()); - a.reserve (NumThings); - for (int n = 0; n < NumThings; n++) - { -@@ -576,7 +577,20 @@ - unsigned short height; - }; - --typedef map dim_map_t; -+class Dim_map_key -+{ -+ public : -+ Dim_map_key () { value = 0; } -+ Dim_map_key (i16 v) { value = v; } -+ i16 value; -+}; -+ -+bool operator< (Dim_map_key a, Dim_map_key b) -+{ -+ return a.value - b.value; -+} -+ -+typedef map > dim_map_t; - static dim_map_t dim_map; // FIXME there should be one for each game - - -@@ -638,10 +652,10 @@ - } - else - { -- mapx0 = MAPX (0) - dim->second.width / 2; -- mapx9 = MAPX (ScrMaxX) + dim->second.width / 2; -- mapy0 = MAPY (ScrMaxY) - dim->second.height / 2; -- mapy9 = MAPY (0) + dim->second.height / 2; -+ mapx0 = MAPX (0) - (*dim).second.width / 2; -+ mapx9 = MAPX (ScrMaxX) + (*dim).second.width / 2; -+ mapy0 = MAPY (ScrMaxY) - (*dim).second.height / 2; -+ mapy9 = MAPY (0) + (*dim).second.height / 2; - } - } - int mapx = Things[t.thing_no].xpos; -diff -ur yadex-1.5.0/src/lumpdir.cc yadex-1.5.0-gcc27/src/lumpdir.cc ---- yadex-1.5.0/src/lumpdir.cc Mon Jun 5 13:46:40 2000 -+++ yadex-1.5.0-gcc27/src/lumpdir.cc Sun Aug 27 17:38:44 2000 -@@ -64,7 +64,7 @@ - if (dependency) - delete dependency; - if (! lump_map.empty ()) -- lump_map.clear (); -+ lump_map.erase (lump_map.begin (), lump_map.end ()); - } - - -@@ -92,7 +92,7 @@ - if (i == lump_map.end ()) - loc.wad = loc_prev.wad = 0; - else -- loc = loc_prev = i->second; -+ loc = loc_prev = (*i).second; - } - - -@@ -122,7 +122,7 @@ - And usually is ! */ - have_prev = false; - if (! lump_map.empty ()) -- lump_map.clear (); -+ lump_map.erase (lump_map.begin (), lump_map.end ()); - - /* Get list of lumps in the master directory. Everything - that is between X_START/X_END or XX_START/XX_END and that -@@ -231,7 +231,8 @@ - { - array[n] = new char[WAD_NAME + 1]; - *array[n] = '\0'; -- strncat (array[n], i++->first.name, WAD_NAME); -+ strncat (array[n], (*i).first.name, WAD_NAME); -+ i++; - } - } - -diff -ur yadex-1.5.0/src/lumpdir.h yadex-1.5.0-gcc27/src/lumpdir.h ---- yadex-1.5.0/src/lumpdir.h Thu Jun 1 14:25:30 2000 -+++ yadex-1.5.0-gcc27/src/lumpdir.h Sun Aug 27 17:38:44 2000 -@@ -34,10 +34,11 @@ - - #include - -+#include "wadname.h" -+ - - class Dependency; - class Serial_num; --class Wad_name; - - - /* -diff -ur yadex-1.5.0/src/objinfo.cc yadex-1.5.0-gcc27/src/objinfo.cc ---- yadex-1.5.0/src/objinfo.cc Sat Aug 26 16:22:37 2000 -+++ yadex-1.5.0-gcc27/src/objinfo.cc Sun Aug 27 18:07:51 2000 -@@ -56,6 +56,12 @@ - class Extraf - { - public : -+ Extraf () -+ { -+ sector = 0; -+ memset (tex, '\0', sizeof tex); -+ height = 0; -+ } - Extraf (obj_no_t sector, wad_name_t& tex, wad_z_t height) - { - this->sector = sector; -@@ -683,7 +689,7 @@ - */ - static void get_extrafloors (vector& v, wad_tag_t tag) - { -- v.clear (); -+ v.erase (v.begin (), v.end ()); - for (obj_no_t l = 0; l < NumLineDefs; l++) - { - if (LineDefs[l].tag == tag -diff -ur yadex-1.5.0/src/patchdir.cc yadex-1.5.0-gcc27/src/patchdir.cc ---- yadex-1.5.0/src/patchdir.cc Sat Apr 29 00:57:39 2000 -+++ yadex-1.5.0-gcc27/src/patchdir.cc Sun Aug 27 17:38:44 2000 -@@ -60,7 +60,7 @@ - if (pnames != 0) - FreeMemory (pnames); - if (! patch_lumps.empty ()) -- patch_lumps.clear (); -+ patch_lumps.erase (patch_lumps.begin (), patch_lumps.end ()); - } - - -@@ -78,7 +78,7 @@ - npnames = 0; - } - if (! patch_lumps.empty ()) -- patch_lumps.clear (); -+ patch_lumps.erase (patch_lumps.begin (), patch_lumps.end ()); - - /* First load PNAMES so that we known in which order we should - put the patches in the array. */ -@@ -221,7 +221,7 @@ - loc.wad = 0; - return; - } -- loc = i->second; -+ loc = (*i).second; - } - - -@@ -293,7 +293,8 @@ - { - array[n] = new char[WAD_PIC_NAME + 1]; - *array[n] = '\0'; -- strncat (array[n], i++->first._name, WAD_PIC_NAME); -+ strncat (array[n], (*i).first._name, WAD_PIC_NAME); -+ i++; - } - } - -diff -ur yadex-1.5.0/src/patchdir.h yadex-1.5.0-gcc27/src/patchdir.h ---- yadex-1.5.0/src/patchdir.h Mon Jan 10 13:40:12 2000 -+++ yadex-1.5.0-gcc27/src/patchdir.h Sun Aug 27 17:38:44 2000 -@@ -76,6 +76,7 @@ - - struct Pllik - { -+ Pllik () { memset (_name, '\0', sizeof _name); } - Pllik (const char *name); - wad_pic_name_t _name; - }; -diff -ur yadex-1.5.0/src/spritdir.cc yadex-1.5.0-gcc27/src/spritdir.cc ---- yadex-1.5.0/src/spritdir.cc Sun Jul 9 23:04:18 2000 -+++ yadex-1.5.0-gcc27/src/spritdir.cc Sun Aug 27 17:38:44 2000 -@@ -58,9 +58,9 @@ - - Lump_map::const_iterator i = lump_map.lower_bound (name); - have_prev = true; -- if (i == lump_map.end () || y_strnicmp (name, i->first.name, strlen (name))) -+ if (i == lump_map.end () || y_strnicmp (name, (*i).first.name, strlen (name))) - loc.wad = loc_prev.wad = 0; - else -- loc = loc_prev = i->second; -+ loc = loc_prev = (*i).second; - } - diff -uaNr yadex-1.5.2/patches/1.5.0_gcc27.diff yadex-1.6.0/patches/1.5.0_gcc27.diff --- yadex-1.5.2/patches/1.5.0_gcc27.diff 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/patches/1.5.0_gcc27.diff 2000-08-27 20:20:14.000000000 +0200 @@ -0,0 +1,240 @@ +yadex-1.5.0_gcc-2.7.diff - make compile Yadex 1.5.0 with GCC 2.7 + +To apply, + + cd yadex-1.5.0 + patch -p1 . It barfs if you use -> on the right hand +of an iterator. It's a pain. + +I consider GCC 2.7 obsolete, and not a supported compiler for +Yadex. This patch will rot or go away. Please upgrade. More +recent versions of EGCS and GCC work fine. + +-- AYM 2000-08-27 + +diff -ur yadex-1.5.0/src/bench.cc yadex-1.5.0-gcc27/src/bench.cc +--- yadex-1.5.0/src/bench.cc Sun Aug 13 16:43:11 2000 ++++ yadex-1.5.0-gcc27/src/bench.cc Sun Aug 27 17:41:26 2000 +@@ -33,10 +33,12 @@ + #include + #include + ++#define times FOOBAR + #include "gfx.h" + #include "img.h" + #include "pic2img.h" + #include "wadres.h" ++#undef times + + + +diff -ur yadex-1.5.0/src/drawmap.cc yadex-1.5.0-gcc27/src/drawmap.cc +--- yadex-1.5.0/src/drawmap.cc Thu Aug 24 15:36:36 2000 ++++ yadex-1.5.0-gcc27/src/drawmap.cc Sun Aug 27 18:03:49 2000 +@@ -518,6 +518,7 @@ + class Thing_npixels + { + public : ++ Thing_npixels () : thing_no (0), npixels (0), type (0) { } + Thing_npixels (i16 thing_no, unsigned long npixels, wad_ttype_t type) + : thing_no (thing_no), npixels (npixels), type (type) { } + bool operator< (const Thing_npixels& other) const +@@ -541,7 +542,7 @@ + const Thing_npixels& operator[] (int n) { return a[n]; } + void refresh () + { +- a.clear (); ++ a.erase (a.begin (), a.end ()); + a.reserve (NumThings); + for (int n = 0; n < NumThings; n++) + { +@@ -576,7 +577,20 @@ + unsigned short height; + }; + +-typedef map dim_map_t; ++class Dim_map_key ++{ ++ public : ++ Dim_map_key () { value = 0; } ++ Dim_map_key (i16 v) { value = v; } ++ i16 value; ++}; ++ ++bool operator< (Dim_map_key a, Dim_map_key b) ++{ ++ return a.value - b.value; ++} ++ ++typedef map > dim_map_t; + static dim_map_t dim_map; // FIXME there should be one for each game + + +@@ -638,10 +652,10 @@ + } + else + { +- mapx0 = MAPX (0) - dim->second.width / 2; +- mapx9 = MAPX (ScrMaxX) + dim->second.width / 2; +- mapy0 = MAPY (ScrMaxY) - dim->second.height / 2; +- mapy9 = MAPY (0) + dim->second.height / 2; ++ mapx0 = MAPX (0) - (*dim).second.width / 2; ++ mapx9 = MAPX (ScrMaxX) + (*dim).second.width / 2; ++ mapy0 = MAPY (ScrMaxY) - (*dim).second.height / 2; ++ mapy9 = MAPY (0) + (*dim).second.height / 2; + } + } + int mapx = Things[t.thing_no].xpos; +diff -ur yadex-1.5.0/src/lumpdir.cc yadex-1.5.0-gcc27/src/lumpdir.cc +--- yadex-1.5.0/src/lumpdir.cc Mon Jun 5 13:46:40 2000 ++++ yadex-1.5.0-gcc27/src/lumpdir.cc Sun Aug 27 17:38:44 2000 +@@ -64,7 +64,7 @@ + if (dependency) + delete dependency; + if (! lump_map.empty ()) +- lump_map.clear (); ++ lump_map.erase (lump_map.begin (), lump_map.end ()); + } + + +@@ -92,7 +92,7 @@ + if (i == lump_map.end ()) + loc.wad = loc_prev.wad = 0; + else +- loc = loc_prev = i->second; ++ loc = loc_prev = (*i).second; + } + + +@@ -122,7 +122,7 @@ + And usually is ! */ + have_prev = false; + if (! lump_map.empty ()) +- lump_map.clear (); ++ lump_map.erase (lump_map.begin (), lump_map.end ()); + + /* Get list of lumps in the master directory. Everything + that is between X_START/X_END or XX_START/XX_END and that +@@ -231,7 +231,8 @@ + { + array[n] = new char[WAD_NAME + 1]; + *array[n] = '\0'; +- strncat (array[n], i++->first.name, WAD_NAME); ++ strncat (array[n], (*i).first.name, WAD_NAME); ++ i++; + } + } + +diff -ur yadex-1.5.0/src/lumpdir.h yadex-1.5.0-gcc27/src/lumpdir.h +--- yadex-1.5.0/src/lumpdir.h Thu Jun 1 14:25:30 2000 ++++ yadex-1.5.0-gcc27/src/lumpdir.h Sun Aug 27 17:38:44 2000 +@@ -34,10 +34,11 @@ + + #include + ++#include "wadname.h" ++ + + class Dependency; + class Serial_num; +-class Wad_name; + + + /* +diff -ur yadex-1.5.0/src/objinfo.cc yadex-1.5.0-gcc27/src/objinfo.cc +--- yadex-1.5.0/src/objinfo.cc Sat Aug 26 16:22:37 2000 ++++ yadex-1.5.0-gcc27/src/objinfo.cc Sun Aug 27 18:07:51 2000 +@@ -56,6 +56,12 @@ + class Extraf + { + public : ++ Extraf () ++ { ++ sector = 0; ++ memset (tex, '\0', sizeof tex); ++ height = 0; ++ } + Extraf (obj_no_t sector, wad_name_t& tex, wad_z_t height) + { + this->sector = sector; +@@ -683,7 +689,7 @@ + */ + static void get_extrafloors (vector& v, wad_tag_t tag) + { +- v.clear (); ++ v.erase (v.begin (), v.end ()); + for (obj_no_t l = 0; l < NumLineDefs; l++) + { + if (LineDefs[l].tag == tag +diff -ur yadex-1.5.0/src/patchdir.cc yadex-1.5.0-gcc27/src/patchdir.cc +--- yadex-1.5.0/src/patchdir.cc Sat Apr 29 00:57:39 2000 ++++ yadex-1.5.0-gcc27/src/patchdir.cc Sun Aug 27 17:38:44 2000 +@@ -60,7 +60,7 @@ + if (pnames != 0) + FreeMemory (pnames); + if (! patch_lumps.empty ()) +- patch_lumps.clear (); ++ patch_lumps.erase (patch_lumps.begin (), patch_lumps.end ()); + } + + +@@ -78,7 +78,7 @@ + npnames = 0; + } + if (! patch_lumps.empty ()) +- patch_lumps.clear (); ++ patch_lumps.erase (patch_lumps.begin (), patch_lumps.end ()); + + /* First load PNAMES so that we known in which order we should + put the patches in the array. */ +@@ -221,7 +221,7 @@ + loc.wad = 0; + return; + } +- loc = i->second; ++ loc = (*i).second; + } + + +@@ -293,7 +293,8 @@ + { + array[n] = new char[WAD_PIC_NAME + 1]; + *array[n] = '\0'; +- strncat (array[n], i++->first._name, WAD_PIC_NAME); ++ strncat (array[n], (*i).first._name, WAD_PIC_NAME); ++ i++; + } + } + +diff -ur yadex-1.5.0/src/patchdir.h yadex-1.5.0-gcc27/src/patchdir.h +--- yadex-1.5.0/src/patchdir.h Mon Jan 10 13:40:12 2000 ++++ yadex-1.5.0-gcc27/src/patchdir.h Sun Aug 27 17:38:44 2000 +@@ -76,6 +76,7 @@ + + struct Pllik + { ++ Pllik () { memset (_name, '\0', sizeof _name); } + Pllik (const char *name); + wad_pic_name_t _name; + }; +diff -ur yadex-1.5.0/src/spritdir.cc yadex-1.5.0-gcc27/src/spritdir.cc +--- yadex-1.5.0/src/spritdir.cc Sun Jul 9 23:04:18 2000 ++++ yadex-1.5.0-gcc27/src/spritdir.cc Sun Aug 27 17:38:44 2000 +@@ -58,9 +58,9 @@ + + Lump_map::const_iterator i = lump_map.lower_bound (name); + have_prev = true; +- if (i == lump_map.end () || y_strnicmp (name, i->first.name, strlen (name))) ++ if (i == lump_map.end () || y_strnicmp (name, (*i).first.name, strlen (name))) + loc.wad = loc_prev.wad = 0; + else +- loc = loc_prev = i->second; ++ loc = loc_prev = (*i).second; + } + diff -uaNr yadex-1.5.2/patches/README yadex-1.6.0/patches/README --- yadex-1.5.2/patches/README 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/patches/README 2001-07-01 15:57:05.000000000 +0200 @@ -0,0 +1,26 @@ +These are patches for Yadex that have for some reason not made +it in the stable version. Some were written by me, some by +others. + +Please note : + +- These patches are not part of the stable version; they come + with NO WARRANTY (as if the stable version came with any sort + of warranty). They may not have been given even the slightest + amount of testing. How long since your last backup ? + +- These diffs are against various versions of Yadex, not + necessarily the latest one or the one you have. Sometimes a + patch against version X works against version Y, sometimes + not. While patching, keep an eye open for error messages such + as "Hunk #n FAILED". + +- To apply, try this : + + $ cd yadex-$VERSION + $ patch -p1 'GNU GPL v2', + 'LGPL' => 'GNU LGPL v2', + 'PD' => 'public domain' +); + + +my @items; +my $what = 'copyright'; +my $format = undef; + + +# +# Parse the command line +# +{ + Getopt::Long::Configure 'bundling', 'noignorecase'; + die "copyright: syntax error\n" + if ! GetOptions + 'a' => sub { $what = 'authors'; }, + 'c' => sub { $format = 'c'; }, + 'h' => sub { $format = 'html'; }, + 'm' => sub { $format = 'troff'; }, + 't' => sub { $format = 'text'; }; + die "copyright: use one of -chmt\n" if ! defined $format; +} + + +# +# Load the AUTHORS file +# +while (defined (my $line = <>)) +{ + chomp $line; + my @fields = split "\t", $line; + die "copyright: $ARGV($.): wrong number of fields\n" if (@fields != 4); + my %authinfo; + $authinfo{name} = $fields[0]; + $authinfo{firstname} = $fields[1]; + $authinfo{years} = $fields[2]; + $authinfo{licence} = $fields[3]; + push @items, \%authinfo; +} + + +# +# Write the output into @output (one line per element) +# +my @output; +if ($what eq 'authors') # Print the list of authors +{ + foreach my $item (sort byname @items) + { + push @output, "$item->{firstname} $item->{name}"; + } +} +elsif ($what eq 'copyright') # Print the list of copyright holders +{ + foreach my $item (sort byname @items) + { + my $licence; + die "copyright: bad licence \"$item->{licence}\"\n" + if ! exists $licences{$item->{licence}}; + $licence = $licences{$item->{licence}}; + + my $string; + if ($item->{licence} eq 'PD') + { + $string = "Parts written by" + . " $item->{firstname} $item->{name}" + . ", $licence"; + } + else + { + $string = "Parts copyright" + . " $item->{firstname} $item->{name}" + . " $item->{years}" + . ", $licence"; + } + push @output, $string; + } +} +else +{ + die "copyright: bad \$what \"$what\""; +} + + +# +# Dump @output to stdout using the specified format +# (text, troff, HTML, C) +# +if ($format eq 'c') +{ + print "\n"; + print "extern const char *const yadex_copyright[] =\n"; + print "{\n"; +} +foreach my $string (@output) +{ + if ($format eq 'c') + { + $string =~ s/\\/\\\\/g; # Escape backslashes + $string =~ s/"/\"/g; # Escape double quotes + print " \"$string\",\n"; + } + elsif ($format eq 'html') + { + $string =~ s/\n"; + } + elsif ($format eq 'text') + { + print "$string\n"; + } + elsif ($format eq 'troff') + { + $string =~ s/\\/\\\\/g; # Escape backslashes + $string =~ s/©/\\(co/g; # Encode the copyright symbol + print "$string\n"; + print ".br\n"; + } + else + { + die "copyright: bad format \"$format\"\n"; + } +} +if ($format eq 'c') +{ + print " 0\n"; + print "};\n"; + print "\n"; +} + +exit 0; + + +# +# byname - sort() callback to sort by (lastname, firstname) +# +sub byname ($$) +{ + my ($a, $b) = @_; + return "$a->{name}\01$a->{firstname}" cmp "$b->{name}\01$b->{firstname}"; +} + diff -uaNr yadex-1.5.2/scripts/ftime.1 yadex-1.6.0/scripts/ftime.1 --- yadex-1.5.2/scripts/ftime.1 1999-08-31 15:37:21.000000000 +0200 +++ yadex-1.6.0/scripts/ftime.1 2000-09-07 05:17:42.000000000 +0200 @@ -7,7 +7,7 @@ Amazingly, there does not seem to exist any simple and portable way to retrieve the last modification time of a file from the shell. GNU awk, GNU find, perl and stat allow to do it but they're not part of the standard. -Parsing the output ls \-l could do, but it would be disgustingly complicated +Parsing the output of ls \-l could do, but it would be disgustingly complicated and the time of day is lost anyway. This program was written to plug that hole. diff -uaNr yadex-1.5.2/scripts/install.c yadex-1.6.0/scripts/install.c --- yadex-1.5.2/scripts/install.c 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/scripts/install.c 2001-04-11 00:25:16.000000000 +0200 @@ -0,0 +1,239 @@ +/* + * install - install files + * AYM 2001-04-10 + */ + + +/* +This file is Copyright © 2001 André Majorel. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307, USA. +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +static void usage (void); +static int install_file (const char ifile[], const char ofile[], mode_t omode); +static void err (const char *fmt, ...); + + +int main (int argc, char *argv[]) +{ + int rc = 0; + const char *target_dir = NULL; + mode_t mode = 0; + int help = 0; + + /* Parse the command line */ + if (argc == 2 && strcmp (argv[1], "--help") == 0) + { + usage (); + exit (0); + } + else + { + int g; + while ((g = getopt (argc, argv, "d:m:")) != EOF) + { + if (g == 'd') + target_dir = optarg; + else if (g == 'm') + mode = (mode_t) strtol (optarg, NULL, 8); + else + { + err ("syntax error"); + exit (1); + } + } + } + if (target_dir == NULL && argc - optind != 2) + { + err ("syntax error"); + exit (1); + } + + /* Copy all files */ + if (target_dir == NULL) + { + if (install_file (argv[optind], argv[optind + 1], mode) != 0) + rc = 1; + } + else + { + int n; + + for (n = optind; n < argc; n++) + { + char *ofile = NULL; + char *ibasename; + + ibasename = strrchr (argv[n], '/'); /* FIXME unixism */ + if (ibasename == NULL) + ibasename = argv[n]; + ofile = malloc (strlen (target_dir) + strlen (ibasename) + 2); + if (ofile == NULL) + { + err (strerror (ENOMEM)); + exit (1); + } + strcpy (ofile, target_dir); + if (strlen (ofile) > 0 && ofile[strlen (ofile) - 1] != '/') /* FIXME */ + strcat (ofile, "/"); + strcat (ofile, ibasename); + if (install_file (argv[n], ofile, mode) != 0) + rc = 1; + free (ofile); + } + } + + return rc; +} + + +static void usage (void) +{ + puts ("Usage:"); + puts (" install --help"); + puts (" install [-m mode] ifile ofile"); + puts (" install [-m mode] [-d dir] [file ...]"); +} + + +static int install_file (const char ifile[], const char ofile[], mode_t omode) +{ + int rc = 0; + FILE *ifp = NULL; + FILE *ofp = NULL; + char *buf = NULL; + size_t bufsz = 0x4000; + + ifp = fopen (ifile, "rb"); + if (ifp == NULL) + { + err ("%s: %s", ifile, strerror (errno)); + rc = 1; + goto byebye; + } + ofp = fopen (ofile, "wb"); + if (ofp == NULL) + { + err ("%s: %s", ofile, strerror (errno)); + rc = 1; + goto byebye; + } + buf = malloc (bufsz); + if (buf == NULL) + { + err (strerror (ENOMEM)); + rc = 1; + goto byebye; + } + + /* Copy the data */ + { + size_t nbytes; + + while ((nbytes = fread (buf, 1, bufsz, ifp)) != 0) + { + if (fwrite (buf, 1, nbytes, ofp) != nbytes) + { + err ("%s: write error", ofile); + rc = 1; + goto byebye; + } + } + if (ferror (ifp)) + { + err ("%s: read error", ifile); + rc = 1; + } + } + + /* Force the ownership to EUID:EGID. Useful if the targets + already exist. */ + if (chown (ofile, geteuid (), getegid ()) != 0) + { + err ("%s: %s", ofile, strerror (errno)); + rc = 1; + goto byebye; + } + + /* Set the mode */ + if (chmod (ofile, omode) != 0) + { + err ("%s: %s", ofile, strerror (errno)); + rc = 1; + goto byebye; + } + + /* Copy the mtime */ + { + struct stat s; + struct utimbuf u; + + if (stat (ifile, &s) != 0) + { + err ("%s: %s", ifile, strerror (errno)); + rc = 1; + goto byebye; + } + u.actime = s.st_atime; + u.modtime = s.st_mtime; + if (utime (ofile, &u) != 0) + { + err ("%s: %s", ofile, strerror (errno)); + rc = 1; + goto byebye; + } + } + + +byebye: + if (ifp != NULL) + fclose (ifp); + if (ofp != NULL) + if (fclose (ofp) != 0) + { + err ("%s: %s", ofile, strerror (errno)); + rc = 1; + } + if (buf != NULL) + free (buf); + return rc; +} + + +static void err (const char *fmt, ...) +{ + va_list argp; + + fflush (stdout); + fputs ("install: ", stderr); + va_start (argp, fmt); + vfprintf (stderr, fmt, argp); + va_end (argp); + fputc ('\n', stderr); +} + diff -uaNr yadex-1.5.2/scripts/notexist.c yadex-1.6.0/scripts/notexist.c --- yadex-1.5.2/scripts/notexist.c 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/scripts/notexist.c 2001-04-10 15:31:26.000000000 +0200 @@ -0,0 +1,68 @@ +/* + * notexist - complain if given directory entries exist + * AYM 2000-09-06 + */ + + +/* +This file is Copyright © 2000 André Majorel. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free +Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307, USA. +*/ + + +#include +#include +#include +#include +#include +#include +#include + + +int main (int argc, char *argv[]) +{ + int n; + + for (n = 1; n < argc; n++) + { + struct stat s; + + if (lstat (argv[n], &s) == 0) + { + fprintf (stderr, "%s already exists. Delete it.\n", argv[n]); + exit (1); + } + else if (errno != ENOENT) + { + fprintf (stderr, "%s: can't lstat (%s)\n", argv[n], strerror (errno)); + exit (1); + } + if (stat (argv[n], &s) == 0) + { + fprintf (stderr, "%s already exists. Delete it.\n", argv[n]); + exit (1); + } + else if (errno != ENOENT) + { + fprintf (stderr, "%s: can't stat (%s)\n", argv[n], strerror (errno)); + exit (1); + } + } + exit (0); +} + + diff -uaNr yadex-1.5.2/scripts/process yadex-1.6.0/scripts/process --- yadex-1.5.2/scripts/process 2000-01-14 14:56:54.000000000 +0100 +++ yadex-1.6.0/scripts/process 2003-03-31 18:58:25.000000000 +0200 @@ -6,17 +6,37 @@ # # In , replace occurrences of -# - "$DATE" by the YYYY-MM-DD current time, -# - "$SELF_DATE" by the YYYY-MM-DD mtime of , -# - "$SOURCE_DATE" by the contents of the file ./.srcdate, -# - "$VERPREV" by the contents of the file ./VERSION~. -# - "$VERSION" by the contents of the file ./VERSION. +# - "$COPYRIGHT_MAN" by the contents of the file cache/copyright.man. +# - "$COPYRIGHT_TXT" by the contents of the file cache/copyright.txt. +# - "$DATE" by the YYYY-MM-DD current time, +# - "$FILES_ETC" by the contents of the file obj/0/file_etc.man +# - "$FILES_SHARE" by the contents of the file obj/0/file_share.man +# - "$SELF_DATE" by the YYYY-MM-DD mtime of , +# - "$SOURCE_DATE" by the contents of the file cache/srcdate, +# - "$VERPREV" by the contents of the file ./VERPREV. +# - "$VERSION" by the contents of the file ./VERSION. # Output is written on stdout. file=$1 shift -sed -e "s/\$DATE/`date +%Y-%m-%d`/; - s/\$SELF_DATE/`scripts/ftime -d $file`/; - s/\$SOURCE_DATE/`cat src/.srcdate`/; - s/\$VERPREV/`test -f VERSION~ && cat VERSION~`/; - s/\$VERSION/`cat VERSION`/;" $file +sed -e "/\$COPYRIGHT_MAN/ { + r cache/copyright.man + d + } + /\$COPYRIGHT_TXT/ { + r cache/copyright.txt + d + } + /\$FILES_ETC/ { + r obj/0/files_etc.man + d + } + /\$FILES_SHARE/ { + r obj/0/files_share.man + d + } + s/\$DATE/`date +%Y-%m-%d`/g + s/\$SELF_DATE/`obj/0/ftime -d $file`/g + s/\$SOURCE_DATE/`cat cache/srcdate`/g + s/\$VERPREV/`test -r VERPREV && cat VERPREV`/g + s/\$VERSION/`cat VERSION`/g" $file diff -uaNr yadex-1.5.2/src/.srcdate yadex-1.6.0/src/.srcdate --- yadex-1.5.2/src/.srcdate 2001-06-30 00:00:00.000000000 +0200 +++ yadex-1.6.0/src/.srcdate 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -2001-06-30 \ No newline at end of file diff -uaNr yadex-1.5.2/src/_edit.h yadex-1.6.0/src/_edit.h --- yadex-1.5.2/src/_edit.h 2000-06-23 00:24:31.000000000 +0200 +++ yadex-1.6.0/src/_edit.h 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -27,12 +27,15 @@ */ -#ifndef YH__EDIT /* Prevent multiple inclusion */ +#ifndef YH__EDIT /* DO NOT INSERT ANYTHING BEFORE THIS LINE */ #define YH__EDIT +#include "objid.h" + + class edisplay_c; -class menu_c; +class Menu; class menubar_c; class modpopup_c; class selbox_c; @@ -41,87 +44,88 @@ // The numbers of the items on the menu bar enum - { - MBI_FILE, - MBI_EDIT, - MBI_VIEW, - MBI_SEARCH, - MBI_MISC, - MBI_OBJECTS, - MBI_CHECK, - MBI_HELP, - MBI_COUNT - }; +{ + MBI_FILE, + MBI_EDIT, + MBI_VIEW, + MBI_SEARCH, + MBI_MISC, + MBI_OBJECTS, + MBI_CHECK, + MBI_HELP, + MBI_COUNT +}; -// The numbers of the actual menus (menu_c objects) +// The numbers of the actual menus (Menu objects) enum - { - MBM_FILE, - MBM_EDIT, - MBM_VIEW, - MBM_SEARCH, - MBM_MISC_L, // The "Misc. operations" menus changes with the mode - MBM_MISC_S, - MBM_MISC_T, - MBM_MISC_V, - MBM_OBJECTS, - MBM_CHECK, - MBM_HELP, - MBM_COUNT - }; +{ + MBM_FILE, + MBM_EDIT, + MBM_VIEW, + MBM_SEARCH, + MBM_MISC_L, // The "Misc. operations" menus changes with the mode + MBM_MISC_S, + MBM_MISC_T, + MBM_MISC_V, + MBM_OBJECTS, + MBM_CHECK, + MBM_HELP, + MBM_COUNT +}; typedef enum - { - TOOL_NORMAL, - TOOL_SNAP_VERTEX - } tool_t; +{ + TOOL_NORMAL, + TOOL_SNAP_VERTEX +} tool_t; /* This structure holds all the data necessary to an edit window. */ // FIXME: make a class of it. typedef struct - { - int mb_ino[MBI_COUNT]; // The numbers of the items on the menu bar - menu_c *mb_menu[MBM_COUNT]; // The actual menu objects - - int move_speed; // Movement speed. - int extra_zoom; // Act like the zoom was 4 times what it is - int obj_type; // The mode (OBJ_LINEDEF, OBJ_SECTOR...) - tool_t tool; // The current tool - int grid_step; // The grid step - int grid_step_min; // The floor of the grid step - int grid_step_max; // The ceiling of the grid step - int grid_step_locked; // Whether the grid step is locked - int grid_shown; // Whether the grid is shown - int grid_snap; // Whether objects forced to be on the grid - int infobar_shown; // Whether the info bar is shown - bool show_object_numbers; // Whether the object numbers are shown - bool show_things_squares; // Whether the things squares are shown - bool show_things_sprites; // Whether the things sprites are shown - int rulers_shown; // Whether the rulers are shown (unused ?) - int pointer_x; // Map coordinates of pointer - int pointer_y; - int pointer_in_window; // If false, pointer_[xy] are not meaningful. - int click_obj_no; // The no. and type of the object the pointer - int click_obj_type; // was on top of when the left click occured - // (*obj_no = -1 if clicked on empty space). - int click_ctrl; // Was Ctrl pressed at the moment of the click? - unsigned long click_time; // Date of last left click in ms - int highlight_obj_no; // The no. and type of the highlighted object - int highlight_obj_type; // (obj_no = -1 if no object is highlighted). - SelPtr Selected; // Linked list of selected objects (or NULL) - - selbox_c *selbox; // The selection box - edisplay_c *edisplay; // The display manager - menubar_c *menubar; // The menu bar - spot_c *spot; // The insertion spot - - modpopup_c *modpopup; // The modal popup menu (only one at a time!) - char modal; - } edit_t; - +{ + public : + int mb_ino[MBI_COUNT]; // The numbers of the items on the menu bar + Menu *mb_menu[MBM_COUNT]; // The actual menu objects + + int move_speed; // Movement speed. + int extra_zoom; // Act like the zoom was 4 times what it is + int obj_type; // The mode (OBJ_LINEDEF, OBJ_SECTOR...) + bool global; // Global mode (experimental) + tool_t tool; // The current tool + int grid_step; // The grid step + int grid_step_min; // The floor of the grid step + int grid_step_max; // The ceiling of the grid step + int grid_step_locked; // Whether the grid step is locked + int grid_shown; // Whether the grid is shown + int grid_snap; // Whether objects forced to be on the grid + bool infobar_shown; // Whether the info bar is shown + bool objinfo_shown; // Whether the object info boxes are shown + bool show_object_numbers; // Whether the object numbers are shown + bool show_things_squares; // Whether the things squares are shown + bool show_things_sprites; // Whether the things sprites are shown + int rulers_shown; // Whether the rulers are shown (unused ?) + int pointer_x; // Map coordinates of pointer + int pointer_y; + int pointer_in_window; // If false, pointer_[xy] are not meaningful. + Objid clicked; // The object that was under the pointer when + // when the left click occurred. If clicked on + // empty space, == CANVAS. + int click_ctrl; // Was Ctrl pressed at the moment of the click? + unsigned long click_time; // Date of last left click in ms + Objid highlighted; // The highlighted object + SelPtr Selected; // Linked list of selected objects (or NULL) + + selbox_c *selbox; // The selection box + edisplay_c *edisplay; // The display manager + menubar_c *menubar; // The menu bar + spot_c *spot; // The insertion spot + + modpopup_c *modpopup; // The modal popup menu (only one at a time!) + char modal; +} edit_t; -#endif /* Prevent multiple inclusion */ +#endif /* DO NOT ADD ANYTHING AFTER THIS LINE */ diff -uaNr yadex-1.5.2/src/acolours.cc yadex-1.6.0/src/acolours.cc --- yadex-1.5.2/src/acolours.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/acolours.cc 2003-03-28 13:37:32.000000000 +0100 @@ -20,7 +20,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -44,10 +44,10 @@ typedef struct - { - rgb_c rgb; - char deleted; - } ac_table_entry_t; +{ + rgb_c rgb; + char deleted; +} ac_table_entry_t; static ac_table_entry_t *table = 0; // The list static acolour_t table_size = 0; // The size of the list @@ -61,24 +61,23 @@ */ pcolour_t add_app_colour (rgb_c rgb) { -size_t i; - + size_t i; -for (i = 0; i < table_size; i++) - if (table[i].deleted) + for (i = 0; i < table_size; i++) + if (table[i].deleted) break; -if (i == table_size) - { - table_size++; - table = (ac_table_entry_t *) realloc (table, table_size * sizeof *table); - if (table == NULL) + if (i == table_size) + { + table_size++; + table = (ac_table_entry_t *) realloc (table, table_size * sizeof *table); + if (table == NULL) fatal_error (msg_nomem); - } -ac_count++; -table[i].rgb = rgb; -table[i].deleted = 0; -return i; + } + ac_count++; + table[i].rgb = rgb; + table[i].deleted = 0; + return i; } @@ -88,18 +87,18 @@ */ void delete_app_colour (acolour_t acn) { -if (acn >= table_size) - fatal_error ("delete_app_colour called with non-existent colour %d", acn); -if (table[acn].deleted) - fatal_error ("colour %d deleted twice", acn); -ac_count--; -table[acn].deleted = 1; + if (acn >= table_size) + fatal_error ("delete_app_colour called with non-existent colour %d", acn); + if (table[acn].deleted) + fatal_error ("colour %d deleted twice", acn); + ac_count--; + table[acn].deleted = 1; } -// FIXME a very quick-and-dirty way of preventing -// changes to the list done between commit_() and -// uncommit_() to corrupt things. +/* FIXME a very quick-and-dirty way of preventing + changes to the list done between commit_() and + uncommit_() to corrupt things. */ static size_t committed_colours = 0; @@ -110,26 +109,35 @@ */ pcolour_t *commit_app_colours () { -verbmsg ("committing %d colours\n", ac_count); + verbmsg ("colours: committing %d colours\n", ac_count); -// First create an array of RGB values -// for all the colours in the list. -verbmsg ("rgb_values=%p\n"); -rgb_c *rgb_values = new rgb_c[ac_count]; -rgb_c *rgb = rgb_values; -for (size_t n = 0; n < table_size; n++) - if (! table[n].deleted) - { - verbmsg ("%p ", rgb - rgb_values); + /* First create an array of RGB values + for all the colours in the list. */ + verbmsg ("colours: rgb_values %p\n"); + rgb_c *rgb_values = new rgb_c[ac_count]; + rgb_c *rgb = rgb_values; + int items_on_line = 0; + for (size_t n = 0; n < table_size; n++) + if (! table[n].deleted) + { + if (items_on_line == 0) + verbmsg ("colours: committing: "); + verbmsg ("%d ", int (rgb - rgb_values)); *rgb++ = table[n].rgb; + if (++items_on_line == 16) + { + verbmsg ("\n"); + items_on_line = 0; } -verbmsg ("\n"); - -// Then do the actual allocation. -committed_colours = ac_count; -pcolour_t *app_colours = alloc_colours (rgb_values, committed_colours); -delete[] rgb_values; -return app_colours; + } + if (items_on_line != 0) + verbmsg ("\n"); + + // Then do the actual allocation. + committed_colours = ac_count; + pcolour_t *app_colours = alloc_colours (rgb_values, committed_colours); + delete[] rgb_values; + return app_colours; } @@ -140,8 +148,8 @@ */ void uncommit_app_colours (pcolour_t *app_colours) { -free_colours (app_colours, committed_colours); -committed_colours = 0; + free_colours (app_colours, committed_colours); + committed_colours = 0; } diff -uaNr yadex-1.5.2/src/aym.cc yadex-1.6.0/src/aym.cc --- yadex-1.5.2/src/aym.cc 2000-05-12 22:41:05.000000000 +0200 +++ yadex-1.6.0/src/aym.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -44,33 +44,33 @@ */ int levelname2levelno (const char *name) { -const unsigned char *s = (const unsigned char *) name; -if (toupper (s[0]) == 'E' - && isdigit (s[1]) - && s[1] != '0' - && toupper (s[2]) == 'M' - && isdigit (s[3]) - && s[3] != '0' - && s[4] == '\0') - return 10 * dectoi (s[1]) + dectoi (s[3]); -if (yg_level_name == YGLN_E1M10 - && toupper (s[0]) == 'E' - && isdigit (s[1]) - && s[1] != '0' - && toupper (s[2]) == 'M' - && isdigit (s[3]) - && s[3] != '0' - && isdigit (s[4]) - && s[5] == '\0') - return 100 * dectoi (s[1]) + 10 * dectoi (s[3]) + dectoi (s[4]); -if (toupper (s[0]) == 'M' - && toupper (s[1]) == 'A' - && toupper (s[2]) == 'P' - && isdigit (s[3]) - && isdigit (s[4]) - && s[5] == '\0') - return 1000 + 10 * dectoi (s[3]) + dectoi (s[4]); -return 0; + const unsigned char *s = (const unsigned char *) name; + if (toupper (s[0]) == 'E' + && isdigit (s[1]) + && s[1] != '0' + && toupper (s[2]) == 'M' + && isdigit (s[3]) + && s[3] != '0' + && s[4] == '\0') + return 10 * dectoi (s[1]) + dectoi (s[3]); + if (yg_level_name == YGLN_E1M10 + && toupper (s[0]) == 'E' + && isdigit (s[1]) + && s[1] != '0' + && toupper (s[2]) == 'M' + && isdigit (s[3]) + && s[3] != '0' + && isdigit (s[4]) + && s[5] == '\0') + return 100 * dectoi (s[1]) + 10 * dectoi (s[3]) + dectoi (s[4]); + if (toupper (s[0]) == 'M' + && toupper (s[1]) == 'A' + && toupper (s[2]) == 'P' + && isdigit (s[3]) + && isdigit (s[4]) + && s[5] == '\0') + return 1000 + 10 * dectoi (s[3]) + dectoi (s[4]); + return 0; } @@ -87,33 +87,33 @@ */ int levelname2rank (const char *name) { -const unsigned char *s = (const unsigned char *) name; -if (toupper (s[0]) == 'E' - && isdigit (s[1]) - && s[1] != '0' - && toupper (s[2]) == 'M' - && isdigit (s[3]) - && s[3] != '0' - && s[4] == '\0') - return 100 * dectoi (s[1]) + dectoi (s[3]); -if (yg_level_name == YGLN_E1M10 - && toupper (s[0]) == 'E' - && isdigit (s[1]) - && s[1] != '0' - && toupper (s[2]) == 'M' - && isdigit (s[3]) - && s[3] != '0' - && isdigit (s[4]) - && s[5] == '\0') - return 100 * dectoi (s[1]) + 10 * dectoi (s[3]) + dectoi (s[4]); -if (toupper (s[0]) == 'M' - && toupper (s[1]) == 'A' - && toupper (s[2]) == 'P' - && isdigit (s[3]) - && isdigit (s[4]) - && s[5] == '\0') - return 1000 + 10 * dectoi (s[3]) + dectoi (s[4]); -return 0; + const unsigned char *s = (const unsigned char *) name; + if (toupper (s[0]) == 'E' + && isdigit (s[1]) + && s[1] != '0' + && toupper (s[2]) == 'M' + && isdigit (s[3]) + && s[3] != '0' + && s[4] == '\0') + return 100 * dectoi (s[1]) + dectoi (s[3]); + if (yg_level_name == YGLN_E1M10 + && toupper (s[0]) == 'E' + && isdigit (s[1]) + && s[1] != '0' + && toupper (s[2]) == 'M' + && isdigit (s[3]) + && s[3] != '0' + && isdigit (s[4]) + && s[5] == '\0') + return 100 * dectoi (s[1]) + 10 * dectoi (s[3]) + dectoi (s[4]); + if (toupper (s[0]) == 'M' + && toupper (s[1]) == 'A' + && toupper (s[2]) == 'P' + && isdigit (s[3]) + && isdigit (s[4]) + && s[5] == '\0') + return 1000 + 10 * dectoi (s[3]) + dectoi (s[4]); + return 0; } @@ -123,15 +123,15 @@ */ const char *spec_path (const char *spec) { -static char path[Y_PATH + 1]; -size_t n; + static char path[Y_PATH + 1]; + size_t n; -*path = '\0'; -strncat (path, spec, sizeof path - 1); -for (n = strlen (path); n > 0 && ! al_fisps (path[n-1]); n--) - ; -path[n] = '\0'; -return path; + *path = '\0'; + strncat (path, spec, sizeof path - 1); + for (n = strlen (path); n > 0 && ! al_fisps (path[n-1]); n--) + ; + path[n] = '\0'; + return path; } @@ -145,22 +145,22 @@ int fncmp (const char *name1, const char *name2) { #if defined Y_DOS -char c1, c2; -for (;;) - { - c1 = tolower ((unsigned char) *name1++); - c2 = tolower ((unsigned char) *name2++); - if (c1=='\\') + char c1, c2; + for (;;) + { + c1 = tolower ((unsigned char) *name1++); + c2 = tolower ((unsigned char) *name2++); + if (c1=='\\') c1 = '/'; - if (c2=='\\') + if (c2=='\\') c2 = '/'; - if (c1 != c2) + if (c1 != c2) return c1-c2; - if (!c1) + if (!c1) return 0; - } + } #elif defined Y_UNIX -return strcmp (name1, name2); + return strcmp (name1, name2); #endif } @@ -307,16 +307,16 @@ /* * file_exists * Check whether a file exists and is readable. - * Returns non-zero if it is, 0 if it isn't. + * Returns true if it is, false if it isn't. */ bool file_exists (const char *filename) { -FILE *test; + FILE *test; -if ((test = fopen (filename, "rb")) == NULL) - return 0; -fclose (test); -return 1; + if ((test = fopen (filename, "rb")) == NULL) + return 0; + fclose (test); + return 1; } @@ -374,4 +374,5 @@ } *p++ = '\0'; } + diff -uaNr yadex-1.5.2/src/aym.h yadex-1.6.0/src/aym.h --- yadex-1.5.2/src/aym.h 2000-05-11 00:23:27.000000000 +0200 +++ yadex-1.6.0/src/aym.h 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -93,13 +93,67 @@ else if (c >= 'a' && c <= 'f') return c - 'a' + 10; else if (c >= 'A' && c <= 'F') - return c = 'A' + 10; + return c - 'A' + 10; else return -1; } /* + * b36toi + * If is a base 36 digit ("[0-9A-Za-z]"), return its value. + * Else, return a negative number. + */ +inline int b36toi (char c) +{ + if (isdigit ((unsigned char) c)) + return c - '0'; + else if (islower (c)) + return c - 'a' + 10; + else if (isupper (c)) + return c - 'A' + 10; + else + return -1; +} + + +/* + * y_isident - return true iff is one of a-z, A-Z, 0-9 or "_". + * + * Intentionally not using isalpha() and co. because I + * don't want the results to depend on the locale. + */ +inline bool y_isident (char c) +{ + switch (c) + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': + case 's': case 't': case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + + case '_': + + return true; + + default: + + return false; + } +} + + +/* * fnewline * Write a newline to a binary file. For Unix, LF. For * other platforms, CR LF. @@ -110,7 +164,7 @@ #ifdef Y_UNIX return putc ('\n', fd); #else - return putc ('\n', fd), putc ('\r', fd); + return putc ('\r', fd), putc ('\n', fd); #endif } diff -uaNr yadex-1.5.2/src/bench.cc yadex-1.6.0/src/bench.cc --- yadex-1.5.2/src/bench.cc 2001-06-21 15:55:01.000000000 +0200 +++ yadex-1.6.0/src/bench.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -69,7 +69,7 @@ if (sprite_loc.wad == 0) fprintf (stderr, "Could not locate sprite %s\n", sprite_name); - Img img (width, height); + Img img (width, height, false); struct tms t0; times (&t0); for (unsigned long n = 0; n < iterations; n++) @@ -77,11 +77,11 @@ struct tms t1; times (&t1); - // Have to use CLK_TCK because glibc has a broken CLOCKS_PER_SEC. - const char *unit = "s"; +// Glibc 2.1 (?) has a broken CLOCKS_PER_SEC. #ifndef CLOCKS_PER_SEC #define CLOCKS_PER_SEC CLK_TCK #endif + const char *unit = "s"; double value = (double) (t1.tms_utime - t0.tms_utime) / CLOCKS_PER_SEC / iterations; if (value < 1E-3) @@ -97,5 +97,3 @@ printf ("LoadPicture: %f %s per call\n", value, unit); } - - diff -uaNr yadex-1.5.2/src/bitvec.h yadex-1.6.0/src/bitvec.h --- yadex-1.5.2/src/bitvec.h 2000-04-15 16:20:54.000000000 +0200 +++ yadex-1.6.0/src/bitvec.h 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/cfgfile.cc yadex-1.6.0/src/cfgfile.cc --- yadex-1.5.2/src/cfgfile.cc 2000-08-26 22:21:12.000000000 +0200 +++ yadex-1.6.0/src/cfgfile.cc 2003-04-01 00:00:00.000000000 +0200 @@ -3,14 +3,13 @@ * AYM 1998-09-30 */ - /* This file is part of Yadex. Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel. 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 @@ -28,824 +27,957 @@ #include "yadex.h" + +#include +#include + #include "cfgfile.h" #include "gfx.h" #include "help1.h" #include "levels.h" -#include "macro.h" +#include "locate.h" #include "trace.h" #include "windim.h" -const char config_file_magic[] = "# Yadex configuration file version 3"; +const char config_file_magic[] = "# Yadex configuration file version 4"; /* * Description of the command line arguments and config file keywords */ typedef enum - { - // Boolean (toggle) - // Receptacle is of type bool - // data_ptr is of type (bool *) - OPT_BOOLEAN, - - // "yes", "no", "ask" - // Receptacle is of type confirm_t - // data_ptr is of type confirm_t - OPT_CONFIRM, - - // Integer number, - // Receptacle is of type int - // data_ptr is of type (int *) - OPT_INTEGER, - - // Window dimension, either integer (pixels) or integer% - // (percentage of total display dimension) - // Receptacle is of type ... - // data_ptr is of type ... - OPT_WINDIM, - - // String - // Receptacle is of type (char[9]) - // data_ptr is of type (char *) - OPT_STRINGBUF8, - - // String - // Receptacle is of type (const char *) - // data_ptr is of type (const char **) - OPT_STRINGPTR, - - // String, but store in a list - // Receptacle is of type ?? - // data_ptr is of type ?? - OPT_STRINGPTRACC, - - // List of strings - // Receptacle is of type (const char *[]) - // data_ptr is of type (const char ***) - OPT_STRINGPTRLIST, - - // End of the options description - OPT_END - } opt_type_t; -typedef struct - { - const char *long_name; // Command line arg. or keyword - const char *short_name; // Abbreviated command line argument - opt_type_t opt_type; // Type of this option - const char *flags; // Flags for this option : - // "1" = process only on pass 1 of - // parse_command_line_options() - // "b" = BGI only (ignored ifndef Y_BGI) - // "x" = X only (ignored ifndef Y_X11) - const char *desc; // Description of the option - void *data_ptr; // Pointer to the data - } opt_desc_t; - -/* The first option has neither long name nor short name. - It is used for "lonely" arguments (i.e. file names). */ -opt_desc_t options[] = /* description of the command line options */ { -{ NULL, - NULL, - OPT_STRINGPTRACC, - NULL, - "Patch wad file", - &PatchWads }, - -{ "autoscroll", - NULL, + // Boolean (toggle) + // Receptacle is of type bool + // data_ptr is of type (bool *) OPT_BOOLEAN, - NULL, - "Enable autoscrolling", - &autoscroll }, - -{ "autoscroll_amp", - NULL, - OPT_INTEGER, - NULL, - "Amp. of scrolling (% of screen size)", - &autoscroll_amp }, - -{ "autoscroll_edge", - NULL, - OPT_INTEGER, - NULL, - "Max. dist. to edge (pixels)", - &autoscroll_edge }, - -{ NULL, - "b", - OPT_STRINGPTR, - NULL, - "Run benchmark and exit successfully", - &bench }, - -{ "bgi", - NULL, - OPT_STRINGPTR, - "b", - "(BGI only) BGI video driver", - &BGIDriver }, - -{ "cirrus_cursor", - "cc", - OPT_BOOLEAN, - "b", - "(BGI only) Cirrus hardware cursor", - &CirrusCursor }, - -{ "config_file", - "f", - OPT_STRINGPTR, - "1", - "Config file", - &config_file }, - -{ "copy_linedef_reuse_sidedefs", - NULL, - OPT_BOOLEAN, - NULL, - "Use same sidedefs as original linedef", - ©_linedef_reuse_sidedefs }, - -{ "debug", - "d", - OPT_BOOLEAN, - NULL, - "Debug mode", - &Debug }, - -{ "default_ceiling_height", - NULL, - OPT_INTEGER, - NULL, - "Default ceiling height", - &default_ceiling_height }, - -{ "default_ceiling_texture", - NULL, - OPT_STRINGBUF8, - NULL, - "Default ceiling texture", - default_ceiling_texture }, -{ "default_floor_height", - NULL, - OPT_INTEGER, - NULL, - "Default floor height", - &default_floor_height }, - -{ "default_floor_texture", - NULL, - OPT_STRINGBUF8, - NULL, - "Default floor texture", - default_floor_texture }, - -{ "default_light_level", - NULL, - OPT_INTEGER, - NULL, - "Default light level", - &default_light_level }, - -{ "default_lower_texture", - NULL, - OPT_STRINGBUF8, - NULL, - "Default lower texture", - default_lower_texture }, - -{ "default_middle_texture", - NULL, - OPT_STRINGBUF8, - NULL, - "Default middle texture", - default_middle_texture }, - -{ "default_thing", - NULL, - OPT_INTEGER, - NULL, - "Default thing number", - &default_thing }, - -{ "default_upper_texture", - NULL, - OPT_STRINGBUF8, - NULL, - "Default upper texture", - default_upper_texture }, + // "yes", "no", "ask" + // Receptacle is of type confirm_t + // data_ptr is of type confirm_t + OPT_CONFIRM, -{ "double_click_timeout", - NULL, + // Integer number, + // Receptacle is of type int + // data_ptr is of type (int *) OPT_INTEGER, - NULL, - "Max delay in ms between clicks", - &double_click_timeout }, - -{ "expert", - NULL, - OPT_BOOLEAN, - NULL, - "Expert mode", - &Expert }, -{ "fake_cursor", - "fc", - OPT_BOOLEAN, - NULL, - "(X11 only) Fake cursor", - &FakeCursor }, - -{ "file", - NULL, - OPT_STRINGPTRLIST, - NULL, - "Patch wad file", - &PatchWads }, - -{ "font", - "fn", - OPT_STRINGPTR, - NULL, - "(X11 only) Font name", - &font_name }, - -{ "game", - "g", - OPT_STRINGPTR, - NULL, - "Game", - &Game }, - -{ "height", - "h", + // Unsigned long integer + // Receptacle is of type unsigned + // data_ptr is of type (unsigned long *) + OPT_UNSIGNED, + + // Window dimension, either integer (pixels) or integer% + // (percentage of total display dimension) + // Receptacle is of type ... + // data_ptr is of type ... OPT_WINDIM, - "x", - "(X11 only) Initial window height", - &initial_window_height }, - -{ "help", - "?", - OPT_BOOLEAN, - "1", - "Show usage summary", - &show_help }, - -{ "grid_max", - NULL, - OPT_INTEGER, - NULL, - "Max grid step (map units)", - &GridMax }, - -{ "grid_min", - NULL, - OPT_INTEGER, - NULL, - "Min grid step (map units)", - &GridMin }, - -{ "grid_pixels_min", - NULL, - OPT_INTEGER, - NULL, - "Min grid step (pixels)", - &grid_pixels_min }, - -{ "idle_sleep_ms", - NULL, - OPT_INTEGER, - NULL, - "ms to sleep before XPending()", - &idle_sleep_ms }, - -{ "info_bar", - NULL, - OPT_BOOLEAN, - NULL, - "Show the info bar", - &InfoShown }, - -{ "insert_vertex_split_linedef", - NULL, - OPT_CONFIRM, - NULL, - "Split ld after ins. vertex", - &insert_vertex_split_linedef }, - -{ "insert_vertex_merge_vertices", - NULL, - OPT_CONFIRM, - NULL, - "Merge vertices after ins. vertex", - &insert_vertex_merge_vertices }, - -{ "iwad1", - "i1", - OPT_STRINGPTR, - NULL, - "The name of the Doom/Ultimate D. iwad", - &Iwad1 }, -{ "iwad2", - "i2", - OPT_STRINGPTR, - NULL, - "The name of the Doom II/Final D. iwad", - &Iwad2 }, - -{ "iwad3", - "i3", - OPT_STRINGPTR, - NULL, - "The name of the Heretic iwad", - &Iwad3 }, - -{ "iwad4", - "i4", - OPT_STRINGPTR, - NULL, - "The name of the Hexen iwad", - &Iwad4 }, + // String + // Receptacle is of type (char[9]) + // data_ptr is of type (char *) + OPT_STRINGBUF8, -{ "iwad5", - "i5", + // String + // Receptacle is of type (const char *) + // data_ptr is of type (const char **) OPT_STRINGPTR, - NULL, - "The name of the Strife iwad", - &Iwad5 }, -{ "iwad6", - "i6", - OPT_STRINGPTR, - NULL, - "The name of the Doom alpha 0.2 iwad", - &Iwad6 }, + // String, but store in a list + // Receptacle is of type ?? + // data_ptr is of type ?? + OPT_STRINGPTRACC, -{ "iwad7", - "i7", - OPT_STRINGPTR, - NULL, - "The name of the Doom alpha 0.4 iwad", - &Iwad7 }, + // List of strings + // Receptacle is of type (const char *[]) + // data_ptr is of type (const char ***) + OPT_STRINGPTRLIST, -{ "iwad8", - "i8", - OPT_STRINGPTR, - NULL, - "The name of the Doom alpha 0.5 iwad", - &Iwad8 }, + // End of the options description + OPT_END +} opt_type_t; -{ "iwad9", - "i9", - OPT_STRINGPTR, - NULL, - "The name of the Doom press rel. iwad", - &Iwad9 }, +typedef struct +{ + const char *long_name; // Command line arg. or keyword + const char *short_name; // Abbreviated command line argument + opt_type_t opt_type; // Type of this option + const char *flags; // Flags for this option : + // "1" = process only on pass 1 of + // parse_command_line_options() + // "b" = BGI only (ignored ifndef Y_BGI) + // "x" = X only (ignored ifndef Y_X11) + const char *desc; // Description of the option + void *data_ptr; // Pointer to the data +} opt_desc_t; -{ "iwad10", - "i10", - OPT_STRINGPTR, - NULL, - "The name of the Strife 1.0 iwad", - &Iwad10 }, +/* The first option has neither long name nor short name. + It is used for "lonely" arguments (i.e. file names). */ +opt_desc_t options[] = // Description of the command line options +{ + { 0, + 0, + OPT_STRINGPTRACC, + 0, + "Patch wad file", + &PatchWads }, + + { "autoscroll", + 0, + OPT_BOOLEAN, + 0, + "Enable autoscrolling", + &autoscroll }, + + { "autoscroll_amp", + 0, + OPT_UNSIGNED, + 0, + "Amp. of scrolling (% of screen size)", + &autoscroll_amp }, + + { "autoscroll_edge", + 0, + OPT_UNSIGNED, + 0, + "Max. dist. to edge (pixels)", + &autoscroll_edge }, + + { 0, + "b", + OPT_STRINGPTR, + 0, + "Run benchmark and exit successfully", + &bench }, + + { "bgi", + 0, + OPT_STRINGPTR, + "b", + "(BGI only) BGI video driver", + &BGIDriver }, + + { "blindly_swap_sidedefs", + 0, + OPT_BOOLEAN, + 0, + "Blindly swap sidedefs on a linedef", + &blindly_swap_sidedefs }, + + { "cirrus_cursor", + "cc", + OPT_BOOLEAN, + "b", + "(BGI only) Cirrus hardware cursor", + &CirrusCursor }, + + { "config_file", + "f", + OPT_STRINGPTR, + "1", + "Config file", + &config_file }, + + { "copy_linedef_reuse_sidedefs", + 0, + OPT_BOOLEAN, + 0, + "Use same sidedefs as original linedef", + ©_linedef_reuse_sidedefs }, + + { "debug", + "d", + OPT_BOOLEAN, + 0, + "Debug mode", + &Debug }, + + { "default_ceiling_height", + 0, + OPT_INTEGER, + 0, + "Default ceiling height", + &default_ceiling_height }, + + { "default_ceiling_texture", + 0, + OPT_STRINGBUF8, + 0, + "Default ceiling texture", + default_ceiling_texture }, + + { "default_floor_height", + 0, + OPT_INTEGER, + 0, + "Default floor height", + &default_floor_height }, + + { "default_floor_texture", + 0, + OPT_STRINGBUF8, + 0, + "Default floor texture", + default_floor_texture }, + + { "default_light_level", + 0, + OPT_INTEGER, + 0, + "Default light level", + &default_light_level }, + + { "default_lower_texture", + 0, + OPT_STRINGBUF8, + 0, + "Default lower texture", + default_lower_texture }, + + { "default_middle_texture", + 0, + OPT_STRINGBUF8, + 0, + "Default middle texture", + default_middle_texture }, + + { "default_thing", + 0, + OPT_INTEGER, + 0, + "Default thing number", + &default_thing }, + + { "default_upper_texture", + 0, + OPT_STRINGBUF8, + 0, + "Default upper texture", + default_upper_texture }, + + { "digit_zoom_base", + 0, + OPT_INTEGER, + 0, + "[0]-[9]: base zoom factor (in %)", + &digit_zoom_base }, + + { "digit_zoom_step", + 0, + OPT_INTEGER, + 0, + "[0]-[9]: step between factors (in %)", + &digit_zoom_step }, + + { "double_click_timeout", + 0, + OPT_INTEGER, + 0, + "Max delay in ms between clicks", + &double_click_timeout }, + + { "expert", + 0, + OPT_BOOLEAN, + 0, + "Expert mode", + &Expert }, + + { "fake_cursor", + "fc", + OPT_BOOLEAN, + 0, + "(X11 only) Fake cursor", + &FakeCursor }, + + { "file", + 0, + OPT_STRINGPTRLIST, + 0, + "Patch wad file", + &PatchWads }, + + { "font", + "fn", + OPT_STRINGPTR, + 0, + "(X11 only) Font name", + &font_name }, + + { "game", + "g", + OPT_STRINGPTR, + 0, + "Game", + &Game }, + + { "grid_max", + 0, + OPT_INTEGER, + 0, + "Max grid step (map units)", + &GridMax }, + + { "grid_min", + 0, + OPT_INTEGER, + 0, + "Min grid step (map units)", + &GridMin }, + + { "grid_pixels_min", + 0, + OPT_INTEGER, + 0, + "Min grid step (pixels)", + &grid_pixels_min }, + + { "height", + "h", + OPT_WINDIM, + "x", + "(X11 only) Initial window height", + &initial_window_height }, + + { "help", + "?", + OPT_BOOLEAN, + "1", + "Show usage summary", + &show_help }, + + { "idle_sleep_ms", + 0, + OPT_INTEGER, + 0, + "ms to sleep before XPending()", + &idle_sleep_ms }, + + { "info_bar", + 0, + OPT_BOOLEAN, + 0, + "Show the info bar", + &InfoShown }, + + { "insert_vertex_split_linedef", + 0, + OPT_CONFIRM, + 0, + "Split ld after ins. vertex", + &insert_vertex_split_linedef }, + + { "insert_vertex_merge_vertices", + 0, + OPT_CONFIRM, + 0, + "Merge vertices after ins. vertex", + &insert_vertex_merge_vertices }, + + { "iwad1", + "i1", + OPT_STRINGPTR, + 0, + "The name of the Doom/Ultimate D. iwad", + &Iwad1 }, + + { "iwad2", + "i2", + OPT_STRINGPTR, + 0, + "The name of the Doom II/Final D. iwad", + &Iwad2 }, + + { "iwad3", + "i3", + OPT_STRINGPTR, + 0, + "The name of the Heretic iwad", + &Iwad3 }, + + { "iwad4", + "i4", + OPT_STRINGPTR, + 0, + "The name of the Hexen iwad", + &Iwad4 }, + + { "iwad5", + "i5", + OPT_STRINGPTR, + 0, + "The name of the Strife iwad", + &Iwad5 }, + + { "iwad6", + "i6", + OPT_STRINGPTR, + 0, + "The name of the Doom alpha 0.2 iwad", + &Iwad6 }, + + { "iwad7", + "i7", + OPT_STRINGPTR, + 0, + "The name of the Doom alpha 0.4 iwad", + &Iwad7 }, + + { "iwad8", + "i8", + OPT_STRINGPTR, + 0, + "The name of the Doom alpha 0.5 iwad", + &Iwad8 }, + + { "iwad9", + "i9", + OPT_STRINGPTR, + 0, + "The name of the Doom press rel. iwad", + &Iwad9 }, + + { "iwad10", + "i10", + OPT_STRINGPTR, + 0, + "The name of the Strife 1.0 iwad", + &Iwad10 }, #ifdef AYM_MOUSE_HACKS -{ "mouse_horizontal_sens", - "mh", - OPT_INTEGER, - "b", - "(BGI only) Mouse horizontal sensitivity", - &MouseMickeysH }, - -{ "mouse_vertical_sens", - "mv", - OPT_INTEGER, - "b", - "(BGI only) Mouse vertical sensitivity", - &MouseMickeysV }, + { "mouse_horizontal_sens", + "mh", + OPT_INTEGER, + "b", + "(BGI only) Mouse horizontal sensitivity", + &MouseMickeysH }, + + { "mouse_vertical_sens", + "mv", + OPT_INTEGER, + "b", + "(BGI only) Mouse vertical sensitivity", + &MouseMickeysV }, #endif -{ "pwad", - "pw", - OPT_STRINGPTRACC, - NULL, - "Pwad file to load", - &PatchWads }, - -{ "no_pixmap", - "P", - OPT_BOOLEAN, - NULL, - "(X11 only) Use no pixmap", - &no_pixmap }, - -{ "quiet", - "q", - OPT_BOOLEAN, - NULL, - "Quiet mode", - &Quiet }, - -{ "quieter", - "qq", - OPT_BOOLEAN, - NULL, - "Quieter mode", - &Quieter }, - -{ "scroll_less", - NULL, - OPT_INTEGER, - NULL, - "Amp. of scrolling (% of screen size)", - &scroll_less }, - -{ "scroll_more", - NULL, - OPT_INTEGER, - NULL, - "Amp. of scrolling (% of screen size)", - &scroll_more }, - -{ "select0", - "s0", - OPT_BOOLEAN, - NULL, - "Automatic selection of 0th object", - &Select0 }, - -{ "sprite_scale", - NULL, - OPT_INTEGER, - NULL, - "Relative scale of sprites", - &sprite_scale }, - -{ "swap_buttons", - "sb", - OPT_BOOLEAN, - NULL, - "Swap mouse buttons", - &SwapButtons }, - -{ "text_dot", - "td", - OPT_BOOLEAN, - NULL, - "DrawScreenText debug flag", - &text_dot }, - -{ "thing_fudge", - NULL, - OPT_INTEGER, - NULL, - "Radius to highlight things", - &thing_fudge }, - -{ "verbose", - "v", - OPT_BOOLEAN, - NULL, - "Verbose mode", - &verbose }, - -{ "vertex_fudge", - NULL, - OPT_INTEGER, - NULL, - "Radius to highlight vertices", - &vertex_fudge }, - -{ "video", - "V", - OPT_INTEGER, - "b", - "(BGI only) Video mode", - &VideoMode }, - -{ "welcome_message", - NULL, - OPT_BOOLEAN, - NULL, - "Print welcome message", - &welcome_message }, - -{ "width", - "w", - OPT_WINDIM, - "x", - "(X11 only) Initial window width", - &initial_window_width }, - -{ "zoom_default", - "z", - OPT_INTEGER, - NULL, - "Initial zoom factor", - &zoom_default }, - -{ "zoom_step", - NULL, - OPT_INTEGER, - NULL, - "Step between zoom factors (in %)", - &zoom_step }, - -{ NULL, - NULL, - OPT_END, - NULL, - NULL, - NULL } + { "no_pixmap", + "P", + OPT_BOOLEAN, + 0, + "(X11 only) Use no pixmap", + &no_pixmap }, + + { "pwad", + "pw", + OPT_STRINGPTRACC, + 0, + "Pwad file to load", + &PatchWads }, + + { "quiet", + "q", + OPT_BOOLEAN, + 0, + "Quiet mode", + &Quiet }, + + { "quieter", + "qq", + OPT_BOOLEAN, + 0, + "Quieter mode", + &Quieter }, + + { "scroll_less", + 0, + OPT_UNSIGNED, + 0, + "Amp. of scrolling (% of screen size)", + &scroll_less }, + + { "scroll_more", + 0, + OPT_UNSIGNED, + 0, + "Amp. of scrolling (% of screen size)", + &scroll_more }, + + { "select0", + "s0", + OPT_BOOLEAN, + 0, + "Automatic selection of 0th object", + &Select0 }, + + { "sprite_scale", + 0, + OPT_INTEGER, + 0, + "Relative scale of sprites", + &sprite_scale }, + + { "swap_buttons", + "sb", + OPT_BOOLEAN, + 0, + "Swap mouse buttons", + &SwapButtons }, + + { "text_dot", + "td", + OPT_BOOLEAN, + 0, + "DrawScreenText debug flag", + &text_dot }, + + { "verbose", + "v", + OPT_BOOLEAN, + "1", + "Verbose mode", + &verbose }, + + { "video", + "V", + OPT_INTEGER, + "b", + "(BGI only) Video mode", + &VideoMode }, + + { "welcome_message", + 0, + OPT_BOOLEAN, + 0, + "Print welcome message", + &welcome_message }, + + { "width", + "w", + OPT_WINDIM, + "x", + "(X11 only) Initial window width", + &initial_window_width }, + + { "zoom_default", + "z", + OPT_INTEGER, + 0, + "Initial zoom factor", + &zoom_default }, + + { "zoom_step", + 0, + OPT_INTEGER, + 0, + "Step between zoom factors (in %)", + &zoom_step }, + + { 0, + 0, + OPT_END, + 0, + 0, + 0 } }; -static const char *standard_directories[] = - { - "./%b", - "~/.yadex/%v/%b", - "~/.yadex/%b", - "%i/%b", - "/usr/local/etc/yadex/%v/%b", - "/usr/local/etc/yadex/%b", - "/etc/yadex/%v/%b", - "/etc/yadex/%b", - 0 - }; +typedef enum +{ + CFG_PARSE_ = 0x00, + CFG_PARSE_MAGIC_ERROR = 0x01, + CFG_PARSE_MAGIC_WARN = 0x02, + CFG_PARSE_ANAL_NAME = 0x04, + CFG_PARSE_ANAL_SYNTAX = 0x08 +} cfg_parse_flags_t; static void append_item_to_list (const char ***list, const char *item); -int parse_one_config_file (const char *filename); +static int parse_config_file (const char *filename, + cfg_parse_flags_t flags = CFG_PARSE_); static confirm_t confirm_e2i (const char *external); static const char *confirm_i2e (confirm_t internal); /* - * parse_config_file + * parse_config_file_default - parse the default config file(s) * - * If is NULL, the standard directories are searched - * for a file named "yadex.cfg". - * - * If is not NULL and is not an absolute name (i.e. - * does not start with a "/"), the standard directories are - * searched for a file named . may contain - * slashes, E.G. if you use "-f foo/bar", the function will search - * for "./yadex//foo/bar", "~/.yadex/foo/bar", - * "/usr/local/etc/yadex/foo/bar", and so on. - * - * If is not NULL but is an absolute name, only that - * file is searched. - * - * Return 0 on success, non-zero on failure. + * Return non-zero if parse error occurred (i.e. at least + * one call to parse_config_file() returned non-zero), zero + * otherwise. */ -int parse_config_file (const char *filename) +int parse_config_file_default () { -bool absolute = filename && is_absolute (filename); + int rc = 0; + int matches; + const char *pathname; + const char *name = "yadex.cfg"; + Locate locate (yadex_etc_path, name, true); + + for (matches = 0; (pathname = locate.get_next ()) != NULL; matches++) + { + printf ("Reading config file \"%s\".\n", pathname); + int r = parse_config_file (pathname); + if (r != 0) + rc = 1; + } + if (matches == 0) + warn ("%s: not found\n", name); + return rc; +} -if (absolute) - { - printf ("Using config file \"%s\".\n", filename); - int failure = parse_one_config_file (filename); - return failure; - } -else - { - char name[257]; - const char *home = getenv ("HOME"); - for (const char **dirname = standard_directories; *dirname; dirname++) - { - int r = macro_expand (name, sizeof name - 1, *dirname, - "%b", filename ? filename : "yadex.cfg", - "%i", install_dir, - "%v", yadex_version, - "~", home, - (const char *) 0); - if (r) - { - trace ("cfgloc", "%s: Could not expand macro #%d", *dirname, r); - continue; - } - if (file_exists (name)) - { - trace ("cfgloc", "%s: hit", name); - printf ("Using config file \"%s\".\n", name); - int failure = parse_one_config_file (name); - return failure; - } - trace ("cfgloc", "%s: miss (%s)", name, strerror (errno)); - } - warn ("No config file found.\n"); - return 0; - } + +/* + * parse_config_file_user - parse a user-specified config file + * + * Return non-zero if the file couldn't be found or if + * parse error occurred (i.e. parse_config_file() returned + * non-zero), zero otherwise. + */ +int parse_config_file_user (const char *name) +{ + const char *pathname; + Locate locate (yadex_etc_path, name, false); + + pathname = locate.get_next (); + if (pathname == NULL) + { + err ("%s: not found", name); + return 1; + } + printf ("Reading config file \"%s\".\n", pathname); + return parse_config_file (pathname); } /* - * parse_one_config_file - * Try to parse one particular config file. + * parse_config_file - try to parse a config file by pathname. + * + * If (flags & CFG_PARSE_MAGIC_ERROR) is true, the file must + * begin with config_file_magic on a line by itself or the + * function will exit immediately with a non-zero value. + * + * If (flags & CFG_PARSE_MAGIC_WARN) is true, the file must + * begin with config_file_magic on a line by itself or the + * function will print a warning. + * + * If (flags & CFG_PARSE_ANAL_NAME) is true, unknown + * variables name cause the function to return immediately + * with a non-zero value. Otherwise, unknown variables + * cause the line to be skipped with a warning and do not + * cause the return value to be non-zero. + * + * If (flags & CFG_PARSE_ANAL_SYNTAX) is true, lines that + * do not follow the = syntax cause the + * function to emit an error message and return immediately + * with a non-zero value. Otherwise, such lines are simply + * ignored with a warning message and do not cause the + * return value to be non-zero. + * * Return 0 on success, <>0 on failure. */ #define RETURN_FAILURE do { rc = 1; goto byebye; } while (0) -int parse_one_config_file (const char *filename) +static int parse_config_file (const char *filename, cfg_parse_flags_t flags) { -int rc = 0; -FILE *cfgfile; -char line[1024]; -char *value; -char *p; -const opt_desc_t *o; - -cfgfile = fopen (filename, "r"); -if (cfgfile == NULL) - { - report_error ("Can't open config file \"%s\" (%s)\n.", - filename, strerror (errno)); - RETURN_FAILURE; - } - -/* The first line of the configuration file must - contain exactly config_file_magic. */ -if (fgets (line, sizeof line, cfgfile) == NULL - || memcmp (line, config_file_magic, sizeof config_file_magic - 1) - || line[sizeof config_file_magic - 1] != '\n' - || line[sizeof config_file_magic] != '\0') - { - report_error ("%s is not a valid Yadex configuration file", filename); - report_error ("Perhaps a leftover from a previous version of Yadex ?"); - RETURN_FAILURE; - } - -/* Execute one line on each iteration. */ -for (unsigned lnum = 2; fgets (line, sizeof line, cfgfile) != NULL; lnum++) - { - /* Skip leading whitespace */ - char *option = line; - while (isspace (*option)) - option++; - - /* Skip comments */ - if (*option == '#') - continue; - - /* Remove trailing newline */ - { - size_t len = strlen (option); - if (len >= 1 && option[len - 1] == '\n') - option[len - 1] = '\0'; - } + int rc = 0; + FILE *cfgfile; + char line[1024]; + + cfgfile = fopen (filename, "r"); + if (cfgfile == NULL) + { + err ("Can't open config file \"%s\" (%s)", filename, strerror (errno)); + RETURN_FAILURE; + } + + /* The first line of the configuration file must + contain exactly config_file_magic. */ + if (fgets (line, sizeof line, cfgfile) == NULL + || memcmp (line, config_file_magic, sizeof config_file_magic - 1) + || line[sizeof config_file_magic - 1] != '\n' + || line[sizeof config_file_magic] != '\0') + { + if (flags & CFG_PARSE_MAGIC_ERROR) + { + err ("%s(1): bad magic, not a valid Yadex configuration file", filename); + err ("Perhaps a leftover from a previous version of Yadex ?"); + RETURN_FAILURE; + } + if (flags & CFG_PARSE_MAGIC_WARN) + warn ("%s(1): bad magic, perhaps from a different version of Yadex\n", + filename); + rewind (cfgfile); + } + + // Execute one line on each iteration + for (unsigned lnum = 1; fgets (line, sizeof line, cfgfile) != NULL; lnum++) + { + char *name = 0; + char *op = 0; + char *value = 0; + char *p = line; + + // Skip leading whitespace + while (isspace (*p)) + p++; - /* Skip empty lines */ - if (! *option) + // Skip comments + if (*p == '#') continue; - /* Skip the option name */ - value = option; - while (*value && *value != '=' && !isspace ((unsigned char) *value)) - value++; - if (! *value) + // Remove trailing newline + { + size_t len = strlen (p); + if (len >= 1 && p[len - 1] == '\n') + p[len - 1] = '\0'; + } + + // Skip empty lines + if (*p == '\0') + continue; + + // Make point on the field + name = p; + while (y_isident (*p)) + p++; + if (*p == '\0') + { + if (flags & CFG_PARSE_ANAL_SYNTAX) { - report_error ("%s(%u): line ends prematurely", filename, lnum); - RETURN_FAILURE; + err ("%s(%u): expected an \"=\"", filename, lnum); + RETURN_FAILURE; } - if (*value == '=') + else { - /* mark the end of the option name */ - *value = '\0'; + warn ("%s(%u): expected an \"=\", skipping\n", filename, lnum); + goto next_line; } - else + } + if (*p == '=') + { + // Mark the end of the option name + *p = '\0'; + } + else + { + // Mark the end of the option name + *p = '\0'; + p++; + // Skip blanks after the option name + while (isspace ((unsigned char) *p)) + p++; + if (*p != '=') { - /* mark the end of the option name */ - *value = '\0'; - value++; - /* skip blanks after the option name */ - while (isspace ((unsigned char) *value)) - value++; - if (*value != '=') - { - report_error ("%s(%u,%d): expected an \"=\"", - filename, lnum, (int) (value - line) + 1); - RETURN_FAILURE; - } + if (flags & CFG_PARSE_ANAL_SYNTAX) + { + err ("%s(%u,%d): expected an \"=\"", + filename, lnum, 1 + (int) (p - line)); + RETURN_FAILURE; + } + else + { + warn ("%s(%u,%d): expected an \"=\", skipping\n", + filename, lnum, 1 + (int) (p - line)); + goto next_line; + } } - value++; - /* skip blanks after the equal sign */ - while (isspace ((unsigned char) *value)) - value++; - for (o = options + 1; ; o++) + } + p++; + + /* First parameter : points on the first character. + Put a NUL at the end. If there is a second parameter, + holler. */ + while (isspace ((unsigned char) *p)) + p++; + value = p; + { + unsigned char *p2 = (unsigned char *) value; + while (*p2 != '\0' && ! isspace (*p2)) + p2++; + if (*p2 != '\0') // There's trailing whitespace after 1st parameter { + for (unsigned char *p3 = p2; *p3 != '\0'; p3++) + if (! isspace (*p3)) + { + err ("%s(%u,%d): extraneous argument", + filename, lnum, 1 + (int) ((char *) p3 - line)); + RETURN_FAILURE; + } + } + *p2 = '\0'; + } + + for (const opt_desc_t *o = options + 1; ; o++) + { if (o->opt_type == OPT_END) - { - warn ("%s(%u): invalid variable \"%s\" - skipping\n", - filename, lnum, option); - goto next_line; - } - if (o->long_name && ! strcmp (option, o->long_name)) - { - if (o->flags != NULL && strchr (o->flags, '1')) - break; + { + if (flags & CFG_PARSE_ANAL_NAME) + { + err ("%s(%u): invalid variable \"%s\"", filename, lnum, name); + RETURN_FAILURE; + } + else + { + warn ("%s(%u): invalid variable \"%s\", skipping\n", + filename, lnum, name); + goto next_line; + } + } + if (! o->long_name || strcmp (name, o->long_name) != 0) + continue; + + if (o->flags != NULL && strchr (o->flags, '1')) + break; #if ! defined Y_BGI - if (o->flags != NULL && strchr (o->flags, 'b')) - break; + if (o->flags != NULL && strchr (o->flags, 'b')) + break; #endif #if ! defined Y_X11 - if (o->flags != NULL && strchr (o->flags, 'x')) - break; + if (o->flags != NULL && strchr (o->flags, 'x')) + break; #endif - switch (o->opt_type) + switch (o->opt_type) + { + case OPT_BOOLEAN: + if (! strcmp (value, "yes") || ! strcmp (value, "true") + || ! strcmp (value, "on") || ! strcmp (value, "1")) + { + if (o->data_ptr) + *((bool *) (o->data_ptr)) = true; + } + else if (! strcmp (value, "no") || ! strcmp (value, "false") + || ! strcmp (value, "off") || ! strcmp (value, "0")) + { + if (o->data_ptr) + *((bool *) (o->data_ptr)) = false; + } + else + { + err ("%s(%u): invalid value for option %s: \"%s\"", + filename, lnum, name, value); + RETURN_FAILURE; + } + break; + + case OPT_CONFIRM: + if (o->data_ptr) + *((confirm_t *) o->data_ptr) = confirm_e2i (value); + break; + + case OPT_INTEGER: + if (o->data_ptr) + *((int *) (o->data_ptr)) = atoi (value); + break; + + case OPT_UNSIGNED: + if (o->data_ptr) + { + if (*value == '\0') { - case OPT_BOOLEAN: - if (! strcmp (value, "yes") || ! strcmp (value, "true") - || ! strcmp (value, "on") || ! strcmp (value, "1")) - { - if (o->data_ptr) - *((bool *) (o->data_ptr)) = true; - } - else if (! strcmp (value, "no") || ! strcmp (value, "false") - || ! strcmp (value, "off") || ! strcmp (value, "0")) - { - if (o->data_ptr) - *((bool *) (o->data_ptr)) = false; - } - else - { - report_error ("%s(%u): invalid value for option %s: \"%s\"", - filename, lnum, option, value); - RETURN_FAILURE; - } - break; - case OPT_CONFIRM: - if (o->data_ptr) - *((confirm_t *) o->data_ptr) = confirm_e2i (value); - break; - case OPT_INTEGER: - if (o->data_ptr) - *((int *) (o->data_ptr)) = atoi (value); - break; - case OPT_WINDIM: - if (o->data_ptr) - if (((Win_dim *) (o->data_ptr))->set (value)) - { - report_error ("%s(%u): bad dimension spec \"%s\"", - filename, lnum, value); - RETURN_FAILURE; - } - break; - case OPT_STRINGBUF8: - if (o->data_ptr) - al_scps ((char *) o->data_ptr, value, 8); - break; - case OPT_STRINGPTR: - p = (char *) GetMemory (strlen (value) + 1); - strcpy (p, value); - if (o->data_ptr) - *((char **) (o->data_ptr)) = p; - break; - case OPT_STRINGPTRACC: - p = (char *) GetMemory (strlen (value) + 1); - strcpy (p, value); - if (o->data_ptr) - append_item_to_list ((const char ***) o->data_ptr, p); - break; - case OPT_STRINGPTRLIST: - while (value[0]) - { - option = value; - while (option[0] && !isspace ((unsigned char) option[0])) - option++; - option[0] = '\0'; - option++; - while (isspace (option[0])) - option++; - p = (char *) GetMemory (strlen (value) + 1); - strcpy (p, value); - if (o->data_ptr) - append_item_to_list ((const char ***) o->data_ptr, p); - value = option; - } - break; - default: - { - report_error ("%s(%u): unknown option type %d (BUG!)", - filename, lnum, (int) o->opt_type); - RETURN_FAILURE; - } + err ("%s(%u,%d): missing argument", + filename, lnum, 1 + (int) (value - line)); + RETURN_FAILURE; } - break; - } - } - next_line:; - } + bool neg = false; + if (value[0] == '-') + neg = true; + char *endptr; + errno = 0; + *((unsigned long *) (o->data_ptr)) = strtoul (value, &endptr, 0); + if (*endptr != '\0' && ! isspace (*endptr)) + { + err ("%s(%u,%d): illegal character in unsigned integer", + filename, lnum, 1 + (int) (endptr - line)); + RETURN_FAILURE; + } + /* strtoul() sets errno to ERANGE if overflow. In + addition, we don't want any non-zero negative + numbers. In terms of regexp, /^(0x)?0*$/i. */ + if + ( + errno != 0 + || neg + && ! + ( + strspn (value + 1, "0") == strlen (value + 1) + || value[1] == '0' + && tolower (value[2]) == 'x' + && strspn (value + 3, "0") == strlen (value + 3) + ) + ) + { + err ("%s(%u,%d): unsigned integer out of range", + filename, lnum, 1 + (int) (value - line)); + RETURN_FAILURE; + } + } + break; -byebye: -if (cfgfile != 0) - fclose (cfgfile); -return rc; + case OPT_WINDIM: + if (o->data_ptr) + if (((Win_dim *) (o->data_ptr))->set (value)) + { + err ("%s(%u): bad dimension spec \"%s\"", filename, lnum, value); + RETURN_FAILURE; + } + break; + + case OPT_STRINGBUF8: + if (o->data_ptr) + al_scps ((char *) o->data_ptr, value, 8); + break; + + case OPT_STRINGPTR: + { + char *dup = (char *) GetMemory (strlen (value) + 1); + strcpy (dup, value); + if (o->data_ptr) + *((char **) (o->data_ptr)) = dup; + break; + } + + case OPT_STRINGPTRACC: + { + char *dup = (char *) GetMemory (strlen (value) + 1); + strcpy (dup, value); + if (o->data_ptr) + append_item_to_list ((const char ***) o->data_ptr, dup); + break; + } + + case OPT_STRINGPTRLIST: + while (*value != '\0') + { + char *v = value; + while (*v != '\0' && ! isspace ((unsigned char) *v)) + v++; + char *dup = (char *) GetMemory (v - value + 1); + memcpy (dup, value, v - value); + dup[v - value] = '\0'; + if (o->data_ptr) + append_item_to_list ((const char ***) o->data_ptr, dup); + while (isspace (*v)) + v++; + value = v; + } + break; + + default: + { + nf_bug ("%s(%u): unknown option type %d", + filename, lnum, (int) o->opt_type); + RETURN_FAILURE; + } + } + break; + } + next_line:; + } + + byebye: + if (cfgfile != 0) + fclose (cfgfile); + return rc; } @@ -854,149 +986,208 @@ * If is set to 1, ignores all options except those * that have the "1" flag. * Else, ignores all options that have the "1" flag. - * If an error occurs, report it with report_error() + * If an error occurs, report it with err() * and returns non-zero. Else, returns 0. */ int parse_command_line_options (int argc, const char *const *argv, int pass) { -const opt_desc_t *o; + const opt_desc_t *o; -while (argc > 0) - { - int ignore; - - // Which option is this ? - if (**argv != '-' && **argv != '+') - { + while (argc > 0) + { + int ignore; + + // Which option is this ? + if (**argv != '-' && **argv != '+') + { o = options; argc++; argv--; - } - else + } + else for (o = options + 1; ; o++) - { - if (o->opt_type == OPT_END) - { - report_error ("invalid option: \"%s\"", argv[0]); - return 1; - } - if (o->short_name && ! strcmp (argv[0]+1, o->short_name) - || o->long_name && ! strcmp (argv[0]+1, o->long_name)) - break; - } - - // If this option has the "1" flag but pass is not 1 - // or it doesn't but pass is 1, ignore it. - ignore = (o->flags != NULL && strchr (o->flags, '1')) != (pass == 1); - - switch (o->opt_type) { + if (o->opt_type == OPT_END) + { + err ("invalid option: \"%s\"", argv[0]); + return 1; + } + if (o->short_name && ! strcmp (argv[0]+1, o->short_name) + || o->long_name && ! strcmp (argv[0]+1, o->long_name)) + break; + } + + // If this option has the "1" flag but pass is not 1 + // or it doesn't but pass is 1, ignore it. + ignore = (o->flags != NULL && strchr (o->flags, '1')) != (pass == 1); + + switch (o->opt_type) + { case OPT_BOOLEAN: - if (argv[0][0] == '-') - { - if (o->data_ptr && ! ignore) - *((bool *) (o->data_ptr)) = true; - } - else - { - if (o->data_ptr && ! ignore) - *((bool *) (o->data_ptr)) = false; - } - break; + if (argv[0][0] == '-') + { + if (o->data_ptr && ! ignore) + *((bool *) (o->data_ptr)) = true; + } + else + { + if (o->data_ptr && ! ignore) + *((bool *) (o->data_ptr)) = false; + } + break; + case OPT_CONFIRM: - if (argc <= 1) - { - report_error ("missing argument after \"%s\"", argv[0]); - return 1; - } - argv++; - argc--; - if (o->data_ptr && ! ignore) - *((confirm_t *) o->data_ptr) = confirm_e2i (argv[0]); - break; + if (argc <= 1) + { + err ("missing argument after \"%s\"", argv[0]); + return 1; + } + argv++; + argc--; + if (o->data_ptr && ! ignore) + *((confirm_t *) o->data_ptr) = confirm_e2i (argv[0]); + break; + case OPT_INTEGER: - if (argc <= 1) - { - report_error ("missing argument after \"%s\"", argv[0]); + if (argc <= 1) + { + err ("missing argument after \"%s\"", argv[0]); + return 1; + } + argv++; + argc--; + if (o->data_ptr && ! ignore) + *((int *) (o->data_ptr)) = atoi (argv[0]); + break; + + case OPT_UNSIGNED: + if (argc <= 1) + { + err ("missing argument after \"%s\"", argv[0]); + return 1; + } + argv++; + argc--; + if (o->data_ptr && ! ignore) + { + const char *value = argv[0]; + if (*value == '\0') + { + err ("not an unsigned integer \"%s\"", value); return 1; - } - argv++; - argc--; - if (o->data_ptr && ! ignore) - *((int *) (o->data_ptr)) = atoi (argv[0]); - break; + } + bool neg = false; + if (*value == '-') + neg = true; + char *endptr; + errno = 0; + *((unsigned long *) (o->data_ptr)) = strtoul (value, &endptr, 0); + while (*endptr != '\0' && isspace (*endptr)) + endptr++; + if (*endptr != '\0') + { + err ("illegal characters in unsigned int \"%s\"", endptr); + return 1; + } + /* strtoul() sets errno to ERANGE if overflow. In + addition, we don't want any non-zero negative + numbers. In terms of regexp, /^(0x)?0*$/i. */ + if + ( + errno != 0 + || neg + && ! + ( + strspn (value + 1, "0") == strlen (value + 1) + || value[1] == '0' + && tolower (value[2]) == 'x' + && strspn (value + 3, "0") == strlen (value + 3) + ) + ) + { + err ("unsigned integer out of range \"%s\"", value); + return 1; + } + } + break; + case OPT_WINDIM: - if (argc <= 1) - { - report_error ("missing argument after \"%s\"", argv[0]); + if (argc <= 1) + { + err ("missing argument after \"%s\"", argv[0]); + return 1; + } + argv++; + argc--; + if (o->data_ptr && ! ignore) + if (((Win_dim *) (o->data_ptr))->set (argv[0])) + { + err ("bad dimension spec \"%s\"", argv[0]); return 1; - } - argv++; - argc--; - if (o->data_ptr && ! ignore) - if (((Win_dim *) (o->data_ptr))->set (argv[0])) - { - report_error ("bad dimension spec \"%s\"", argv[0]); - return 1; - } - break; + } + break; + case OPT_STRINGBUF8: - if (argc <= 1) - { - report_error ("missing argument after \"%s\"", argv[0]); - return 1; - } - argv++; - argc--; - if (o->data_ptr && ! ignore) - al_scps ((char *) o->data_ptr, argv[0], 8); - break; + if (argc <= 1) + { + err ("missing argument after \"%s\"", argv[0]); + return 1; + } + argv++; + argc--; + if (o->data_ptr && ! ignore) + al_scps ((char *) o->data_ptr, argv[0], 8); + break; + case OPT_STRINGPTR: - if (argc <= 1) - { - report_error ("missing argument after \"%s\"", argv[0]); - return 1; - } - argv++; - argc--; - if (o->data_ptr && ! ignore) - *((const char **) (o->data_ptr)) = argv[0]; - break; + if (argc <= 1) + { + err ("missing argument after \"%s\"", argv[0]); + return 1; + } + argv++; + argc--; + if (o->data_ptr && ! ignore) + *((const char **) (o->data_ptr)) = argv[0]; + break; + case OPT_STRINGPTRACC: - if (argc <= 1) - { - report_error ("missing argument after \"%s\"", argv[0]); - return 1; - } - argv++; - argc--; - if (o->data_ptr && ! ignore) - append_item_to_list ((const char ***) o->data_ptr, argv[0]); - break; + if (argc <= 1) + { + err ("missing argument after \"%s\"", argv[0]); + return 1; + } + argv++; + argc--; + if (o->data_ptr && ! ignore) + append_item_to_list ((const char ***) o->data_ptr, argv[0]); + break; + case OPT_STRINGPTRLIST: - if (argc <= 1) - { - report_error ("missing argument after \"%s\"", argv[0]); - return 1; - } - while (argc > 1 && argv[1][0] != '-' && argv[1][0] != '+') - { - argv++; - argc--; - if (o->data_ptr && ! ignore) - append_item_to_list ((const char ***) o->data_ptr, argv[0]); - } - break; + if (argc <= 1) + { + err ("missing argument after \"%s\"", argv[0]); + return 1; + } + while (argc > 1 && argv[1][0] != '-' && argv[1][0] != '+') + { + argv++; + argc--; + if (o->data_ptr && ! ignore) + append_item_to_list ((const char ***) o->data_ptr, argv[0]); + } + break; + default: - { - report_error ("unknown option type (BUG!)"); - return 1; - } - } - argv++; - argc--; - } -return 0; + { + nf_bug ("unknown option type (%d)", (int) o->opt_type); + return 1; + } + } + argv++; + argc--; + } + return 0; } @@ -1006,63 +1197,65 @@ */ void dump_parameters (FILE *fp) { -const opt_desc_t *o; -int desc_maxlen = 0; -int name_maxlen = 0; - -for (o = options + 1; o->opt_type != OPT_END; o++) - { - int len = strlen (o->desc); - desc_maxlen = al_amax (desc_maxlen, len); - if (o->long_name) - { + const opt_desc_t *o; + int desc_maxlen = 0; + int name_maxlen = 0; + + for (o = options + 1; o->opt_type != OPT_END; o++) + { + int len = strlen (o->desc); + desc_maxlen = al_amax (desc_maxlen, len); + if (o->long_name) + { len = strlen (o->long_name); name_maxlen = al_amax (name_maxlen, len); - } - } + } + } -for (o = options + 1; o->opt_type != OPT_END; o++) - { - if (! o->long_name) + for (o = options + 1; o->opt_type != OPT_END; o++) + { + if (! o->long_name) continue; - fprintf (fp, "%-*s %-*s ",name_maxlen, o->long_name, desc_maxlen, o->desc); - if (o->opt_type == OPT_BOOLEAN) - fprintf (fp, "%s", *((int *)o->data_ptr) ? "enabled" : "disabled"); - else if (o->opt_type == OPT_CONFIRM) + fprintf (fp, "%-*s %-*s ",name_maxlen, o->long_name, desc_maxlen, o->desc); + if (o->opt_type == OPT_BOOLEAN) + fprintf (fp, "%s", *((bool *) o->data_ptr) ? "enabled" : "disabled"); + else if (o->opt_type == OPT_CONFIRM) fputs (confirm_i2e (*((confirm_t *) o->data_ptr)), fp); - else if (o->opt_type == OPT_STRINGBUF8) + else if (o->opt_type == OPT_STRINGBUF8) fprintf (fp, "\"%s\"", (char *) o->data_ptr); - else if (o->opt_type == OPT_STRINGPTR) - { + else if (o->opt_type == OPT_STRINGPTR) + { if (o->data_ptr) - fprintf (fp, "\"%s\"", *((char **) o->data_ptr)); + fprintf (fp, "\"%s\"", *((char **) o->data_ptr)); else - fprintf (fp, "--none--"); - } - else if (o->opt_type == OPT_INTEGER) - fprintf (fp, "%d", *((int *)o->data_ptr)); - else if (o->opt_type == OPT_WINDIM) - { + fprintf (fp, "--none--"); + } + else if (o->opt_type == OPT_INTEGER) + fprintf (fp, "%d", *((int *) o->data_ptr)); + else if (o->opt_type == OPT_UNSIGNED) + fprintf (fp, "%lu", *((unsigned long *) o->data_ptr)); + else if (o->opt_type == OPT_WINDIM) + { char buf[50]; // Much slack ((Win_dim *) (o->data_ptr))->string (buf, sizeof buf); fputs (buf, fp); - } - else if (o->opt_type == OPT_STRINGPTRACC - || o->opt_type == OPT_STRINGPTRLIST) - { + } + else if (o->opt_type == OPT_STRINGPTRACC + || o->opt_type == OPT_STRINGPTRLIST) + { if (o->data_ptr) - { - char **list; - for (list = *((char ***) o->data_ptr); list && *list; list++) - fprintf (fp, "\"%s\" ", *list); - if (list == *((char ***) o->data_ptr)) - fprintf (fp, "--none--"); - } - else - fprintf (fp, "--none--"); + { + char **list; + for (list = *((char ***) o->data_ptr); list && *list; list++) + fprintf (fp, "\"%s\" ", *list); + if (list == *((char ***) o->data_ptr)) + fprintf (fp, "--none--"); } - fputc ('\n', fp); - } + else + fprintf (fp, "--none--"); + } + fputc ('\n', fp); + } } @@ -1072,58 +1265,59 @@ */ void dump_command_line_options (FILE *fd) { -const opt_desc_t *o; -int desc_maxlen = 0; -int name_maxlen = 0; - -for (o = options + 1; o->opt_type != OPT_END; o++) - { - int len; - if (! o->short_name) + const opt_desc_t *o; + int desc_maxlen = 0; + int name_maxlen = 0; + + for (o = options + 1; o->opt_type != OPT_END; o++) + { + int len; + if (! o->short_name) continue; - len = strlen (o->desc); - desc_maxlen = al_amax (desc_maxlen, len); - if (o->long_name) - { + len = strlen (o->desc); + desc_maxlen = al_amax (desc_maxlen, len); + if (o->long_name) + { len = strlen (o->long_name); name_maxlen = al_amax (name_maxlen, len); - } - } + } + } -for (o = options; o->opt_type != OPT_END; o++) - { - if (! o->short_name) + for (o = options; o->opt_type != OPT_END; o++) + { + if (! o->short_name) continue; #if ! defined Y_BGI - if (o->flags && strchr (o->flags, 'b')) + if (o->flags && strchr (o->flags, 'b')) continue; #endif #if ! defined Y_X11 - if (o->flags && strchr (o->flags, 'x')) + if (o->flags && strchr (o->flags, 'x')) continue; #endif - if (o->short_name) + if (o->short_name) fprintf (fd, " -%-3s ", o->short_name); - else + else fprintf (fd, " "); - if (o->long_name) + if (o->long_name) fprintf (fd, "-%-*s ", name_maxlen, o->long_name); - else + else fprintf (fd, "%*s", name_maxlen + 2, ""); - switch (o->opt_type) - { + switch (o->opt_type) + { case OPT_BOOLEAN: fprintf (fd, " "); break; case OPT_CONFIRM: fprintf (fd, "yes|no|ask "); break; case OPT_STRINGBUF8: case OPT_STRINGPTR: case OPT_STRINGPTRACC: fprintf (fd, " "); break; case OPT_INTEGER: fprintf (fd, " "); break; + case OPT_UNSIGNED: fprintf (fd, " "); break; case OPT_WINDIM: fprintf (fd, "[%%]"); break; case OPT_STRINGPTRLIST: fprintf (fd, " ..."); break; case OPT_END: ; // This line is here only to silence a GCC warning. - } - fprintf (fd, " %s\n", o->desc); - } + } + fprintf (fd, " %s\n", o->desc); + } } @@ -1136,18 +1330,18 @@ */ static confirm_t confirm_e2i (const char *external) { -if (external != NULL) - { - if (! strcmp (external, "yes")) + if (external != NULL) + { + if (! strcmp (external, "yes")) return YC_YES; - if (! strcmp (external, "no")) + if (! strcmp (external, "no")) return YC_NO; - if (! strcmp (external, "ask")) + if (! strcmp (external, "ask")) return YC_ASK; - if (! strcmp (external, "ask_once")) + if (! strcmp (external, "ask_once")) return YC_ASK_ONCE; - } -return YC_ASK; + } + return YC_ASK; } @@ -1159,15 +1353,15 @@ */ static const char *confirm_i2e (confirm_t internal) { -if (internal == YC_YES) - return "yes"; -if (internal == YC_NO) - return "no"; -if (internal == YC_ASK) - return "ask"; -if (internal == YC_ASK_ONCE) - return "ask_once"; -return "?"; + if (internal == YC_YES) + return "yes"; + if (internal == YC_NO) + return "no"; + if (internal == YC_ASK) + return "ask"; + if (internal == YC_ASK_ONCE) + return "ask_once"; + return "?"; } @@ -1177,24 +1371,81 @@ */ static void append_item_to_list (const char ***list, const char *item) { -int i; + int i; -i = 0; -if (*list != NULL) - { - /* count the number of elements in the list (last = null) */ - while ((*list)[i] != NULL) + i = 0; + if (*list != 0) + { + // Count the number of elements in the list (last = null) + while ((*list)[i] != 0) i++; - /* expand the list */ - *list = (const char **) ResizeMemory (*list, (i + 2) * sizeof **list); - } -else - { - /* create a new list */ - *list = (const char **) GetMemory (2 * sizeof **list); - } -/* append the new element */ -(*list)[i] = item; -(*list)[i + 1] = NULL; + // Expand the list + *list = (const char **) ResizeMemory (*list, (i + 2) * sizeof **list); + } + else + { + // Create a new list + *list = (const char **) GetMemory (2 * sizeof **list); + } + // Append the new element + (*list)[i] = item; + (*list)[i + 1] = 0; +} + + +#include +#include + +const size_t MAX_TOKENS = 10; + +/* + * word_splitting - perform word splitting on a string + */ +int word_splitting (std::vector& tokens, const char *string) +{ + size_t ntokens = 0; + const char *iptr = string; + const char *token_start = 0; + bool in_token = false; + bool quoted = false; + + /* break the line into whitespace-separated tokens. + whitespace can be enclosed in double quotes. */ + for (; ; iptr++) + { + if (*iptr == '\n' || *iptr == '\0') + break; + + else if (*iptr == '"') + quoted = ! quoted; + + // "#" at the beginning of a token + else if (! in_token && ! quoted && *iptr == '#') + break; + + // First character of token + else if (! in_token && (quoted || ! isspace (*iptr))) + { + ntokens++; + if (ntokens > MAX_TOKENS) + return 2; // Too many tokens + in_token = true; + } + + // First space between two tokens + else if (in_token && ! quoted && isspace (*iptr)) + { + tokens.push_back (std::string (token_start, iptr - token_start)); + in_token = false; + } + } + + if (in_token) + tokens.push_back (std::string (token_start, iptr - token_start)); + + if (quoted) + return 1; // Unmatched double quote + return 0; } + diff -uaNr yadex-1.5.2/src/cfgfile.h yadex-1.6.0/src/cfgfile.h --- yadex-1.5.2/src/cfgfile.h 2000-01-10 14:40:12.000000000 +0100 +++ yadex-1.6.0/src/cfgfile.h 2003-03-24 17:52:19.000000000 +0100 @@ -4,7 +4,8 @@ */ -int parse_config_file (const char *); +int parse_config_file_default (); +int parse_config_file_user (const char *name); int parse_command_line_options (int argc, const char *const *argv, int pass); void dump_parameters (FILE *fd); void dump_command_line_options (FILE *fd); diff -uaNr yadex-1.5.2/src/checks.cc yadex-1.6.0/src/checks.cc --- yadex-1.5.2/src/checks.cc 2000-08-13 17:15:17.000000000 +0200 +++ yadex-1.6.0/src/checks.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -35,6 +35,8 @@ #include "gfx.h" #include "gotoobj.h" #include "levels.h" +#include "objects.h" +#include "objid.h" #include "oldmenus.h" #include "selectn.h" @@ -60,12 +62,12 @@ */ line5 = "Check texture names"; } -switch (DisplayMenu (x0, y0, "Check level consistency", - "Number of objects", - "Check if all Sectors are closed", - "Check all cross-references", - "Check for missing textures", - line5, +switch (vDisplayMenu (x0, y0, "Check level consistency", + "Number of objects", YK_, 0, + "Check if all Sectors are closed", YK_, 0, + "Check all cross-references", YK_, 0, + "Check for missing textures", YK_, 0, + line5, YK_, 0, NULL)) { case 1: @@ -282,7 +284,7 @@ sprintf (msg2, "There is no sidedef ending at Vertex #%d", n); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_VERTICES, n); + GoToObject (Objid (OBJ_VERTICES, n)); return; } } @@ -292,7 +294,7 @@ sprintf (msg2, "There is no sidedef starting at Vertex #%d", n); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_VERTICES, n); + GoToObject (Objid (OBJ_VERTICES, n)); return; } } @@ -341,7 +343,7 @@ } if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_LINEDEFS, n); + GoToObject (Objid (OBJ_LINEDEFS, n)); return; } } @@ -368,7 +370,7 @@ } if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_LINEDEFS, n); + GoToObject (Objid (OBJ_LINEDEFS, n)); return; } } @@ -398,7 +400,7 @@ { sprintf (msg, "ERROR: linedef #%d has no first sidedef!", n); CheckFailed (-1, -1, msg, 0, 1, first_time); - GoToObject (OBJ_LINEDEFS, n); + GoToObject (Objid (OBJ_LINEDEFS, n)); return; } @@ -410,7 +412,7 @@ sprintf (msg, "ERROR: linedef #%d uses the same sidedef twice (#%d)", n, LineDefs[n].sidedef1); CheckFailed (-1, -1, msg, 0, 1, first_time); - GoToObject (OBJ_LINEDEFS, n); + GoToObject (Objid (OBJ_LINEDEFS, n)); return; } #endif @@ -421,7 +423,7 @@ sprintf (msg, "ERROR: linedef #%d uses the same vertex twice (#%d)", n, LineDefs[n].start); CheckFailed (-1, -1, msg, 0, 1, first_time); - GoToObject (OBJ_LINEDEFS, n); + GoToObject (Objid (OBJ_LINEDEFS, n)); return; } } @@ -611,7 +613,7 @@ sprintf (msg1, "Error: sector #%d has no ceiling texture", n); sprintf (msg2, "You probably used a brain-damaged editor to do that..."); CheckFailed (-1, -1, msg1, msg2, 1, first_time); - GoToObject (OBJ_SECTORS, n); + GoToObject (Objid (OBJ_SECTORS, n)); return; } if (strcmp (Sectors[n].floort, "-") == 0 @@ -621,7 +623,7 @@ sprintf (msg1, "Error: sector #%d has no floor texture", n); sprintf (msg2, "You probably used a brain-damaged editor to do that..."); CheckFailed (-1, -1, msg1, msg2, 1, first_time); - GoToObject (OBJ_SECTORS, n); + GoToObject (Objid (OBJ_SECTORS, n)); return; } if (Sectors[n].ceilh < Sectors[n].floorh) @@ -631,7 +633,7 @@ sprintf (msg2, "The textures will never be displayed if you cannot go there"); CheckFailed (-1, -1, msg1, msg2, 1, first_time); - GoToObject (OBJ_SECTORS, n); + GoToObject (Objid (OBJ_SECTORS, n)); return; } #if 0 /* AYM 2000-08-13 */ @@ -640,7 +642,7 @@ sprintf (msg1, "Error: sector #%d has its ceiling too high", n); sprintf (msg2, "The maximum difference allowed is 1023 (ceiling - floor)"); CheckFailed (-1, -1, msg1, msg2, 1, first_time); - GoToObject (OBJ_SECTORS, n); + GoToObject (Objid (OBJ_SECTORS, n)); return; } #endif @@ -670,7 +672,7 @@ " and continue?", default_middle_texture); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_LINEDEFS, n); + GoToObject (Objid (OBJ_LINEDEFS, n)); return; } strncpy (SideDefs[sd1].tex3, default_middle_texture, WAD_TEX_NAME); @@ -689,7 +691,7 @@ " and continue?", default_upper_texture); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_LINEDEFS, n); + GoToObject (Objid (OBJ_LINEDEFS, n)); return; } strncpy (SideDefs[sd1].tex1, default_upper_texture, WAD_TEX_NAME); @@ -707,7 +709,7 @@ " and continue?", default_lower_texture); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_LINEDEFS, n); + GoToObject (Objid (OBJ_LINEDEFS, n)); return; } strncpy (SideDefs[sd1].tex2, default_lower_texture, WAD_TEX_NAME); @@ -726,7 +728,7 @@ " and continue?", default_upper_texture); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_LINEDEFS, n); + GoToObject (Objid (OBJ_LINEDEFS, n)); return; } strncpy (SideDefs[sd2].tex1, default_upper_texture, WAD_TEX_NAME); @@ -744,7 +746,7 @@ " and continue?", default_lower_texture); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_LINEDEFS, n); + GoToObject (Objid (OBJ_LINEDEFS, n)); return; } strncpy (SideDefs[sd2].tex2, default_lower_texture, WAD_TEX_NAME); @@ -798,7 +800,7 @@ (int) WAD_FLAT_NAME, Sectors[n].ceilt); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_SECTORS, n); + GoToObject (Objid (OBJ_SECTORS, n)); return; } CheckingObjects (); @@ -810,7 +812,7 @@ (int) WAD_FLAT_NAME, Sectors[n].floort); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_SECTORS, n); + GoToObject (Objid (OBJ_SECTORS, n)); return; } CheckingObjects (); @@ -826,7 +828,7 @@ (int) WAD_TEX_NAME, SideDefs[n].tex1); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_SIDEDEFS, n); + GoToObject (Objid (OBJ_SIDEDEFS, n)); return; } CheckingObjects (); @@ -838,7 +840,7 @@ (int) WAD_TEX_NAME, SideDefs[n].tex2); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_SIDEDEFS, n); + GoToObject (Objid (OBJ_SIDEDEFS, n)); return; } CheckingObjects (); @@ -850,7 +852,7 @@ (int) WAD_TEX_NAME, SideDefs[n].tex3); if (CheckFailed (-1, -1, msg1, msg2, 0, first_time)) { - GoToObject (OBJ_SIDEDEFS, n); + GoToObject (Objid (OBJ_SIDEDEFS, n)); return; } CheckingObjects (); diff -uaNr yadex-1.5.2/src/colour1.cc yadex-1.6.0/src/colour1.cc --- yadex-1.5.2/src/colour1.cc 2000-01-12 22:45:50.000000000 +0100 +++ yadex-1.6.0/src/colour1.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -44,52 +44,52 @@ */ int getcolour (const char *s, rgb_c *rgb) { -int i; -int digit; -int rdigits; -int gdigits; -int bdigits; -unsigned r; -unsigned g; -unsigned b; -int globaldigits; - -if (strncmp (s, "rgb:", 4)) - return 1; - -for (i = 4, r = 0, rdigits = 0; (digit = hextoi (s[i])) >= 0; i++, rdigits++) - r = (r << 4) | digit; -if (s[i++] != '/') - return 2; - -for (g = 0, gdigits = 0; (digit = hextoi (s[i])) >= 0; i++, gdigits++) - g = (g << 4) | digit; -if (s[i++] != '/') - return 3; - -for (b = 0, bdigits = 0; (digit = hextoi (s[i])) >= 0; i++, bdigits++) - b = (b << 4) | digit; -if (s[i++] != '\0') - return 4; - -/* force to 8 bits (RGB_DIGITS hex digits) by scaling up or down */ -globaldigits = rdigits; -globaldigits = y_max (globaldigits, gdigits); -globaldigits = y_max (globaldigits, bdigits); -for (; globaldigits < RGB_DIGITS; globaldigits++) - { - r <<= 4; - g <<= 4; - b <<= 4; - } -for (; globaldigits > RGB_DIGITS; globaldigits--) - { - r >>= 4; - g >>= 4; - b >>= 4; - } -rgb->set (r, g, b); -return 0; + int i; + int digit; + int rdigits; + int gdigits; + int bdigits; + unsigned r; + unsigned g; + unsigned b; + int globaldigits; + + if (strncmp (s, "rgb:", 4)) + return 1; + + for (i = 4, r = 0, rdigits = 0; (digit = hextoi (s[i])) >= 0; i++, rdigits++) + r = (r << 4) | digit; + if (s[i++] != '/') + return 2; + + for (g = 0, gdigits = 0; (digit = hextoi (s[i])) >= 0; i++, gdigits++) + g = (g << 4) | digit; + if (s[i++] != '/') + return 3; + + for (b = 0, bdigits = 0; (digit = hextoi (s[i])) >= 0; i++, bdigits++) + b = (b << 4) | digit; + if (s[i++] != '\0') + return 4; + + // Force to 8 bits (RGB_DIGITS hex digits) by scaling up or down + globaldigits = rdigits; + globaldigits = y_max (globaldigits, gdigits); + globaldigits = y_max (globaldigits, bdigits); + for (; globaldigits < RGB_DIGITS; globaldigits++) + { + r <<= 4; + g <<= 4; + b <<= 4; + } + for (; globaldigits > RGB_DIGITS; globaldigits--) + { + r >>= 4; + g >>= 4; + b >>= 4; + } + rgb->set (r, g, b); + return 0; } diff -uaNr yadex-1.5.2/src/colour2.cc yadex-1.6.0/src/colour2.cc --- yadex-1.5.2/src/colour2.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/colour2.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -37,11 +37,11 @@ */ int rgb2irgb (int r, int g, int b) { -int c; + int c; -c = 4*!!r + 2*!!g + 1*!!b; -if (r > 128 || g > 128 || b > 128) - c += 8; /* Set high intensity bit */ -return c; + c = 4*!!r + 2*!!g + 1*!!b; + if (r > 128 || g > 128 || b > 128) + c += 8; // Set high intensity bit + return c; } diff -uaNr yadex-1.5.2/src/colour3.cc yadex-1.6.0/src/colour3.cc --- yadex-1.5.2/src/colour3.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/colour3.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -39,13 +39,13 @@ */ void irgb2rgb (int c, rgb_c *rgb) { -if (c == 8) /* Special case for DARKGRAY */ - rgb->r = rgb->g = rgb->b = 0x40; -else - { - rgb->r = (c & 4) ? ((c & 8) ? 0xff : 0x80) : 0; - rgb->g = (c & 2) ? ((c & 8) ? 0xff : 0x80) : 0; - rgb->b = (c & 1) ? ((c & 8) ? 0xff : 0x80) : 0; - } + if (c == 8) // Special case for DARKGREY + rgb->r = rgb->g = rgb->b = 0x40; + else + { + rgb->r = (c & 4) ? ((c & 8) ? 0xff : 0x80) : 0; + rgb->g = (c & 2) ? ((c & 8) ? 0xff : 0x80) : 0; + rgb->b = (c & 1) ? ((c & 8) ? 0xff : 0x80) : 0; + } } diff -uaNr yadex-1.5.2/src/colour4.cc yadex-1.6.0/src/colour4.cc --- yadex-1.5.2/src/colour4.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/colour4.cc 2003-03-28 13:37:32.000000000 +0100 @@ -1,4 +1,3 @@ - /* * colour4.cc * Allocate and free physical colours. @@ -12,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -42,11 +41,11 @@ /* This table contains all the physical colours allocated, with their rgb value and usage count. */ typedef struct - { - pcolour_t pcn; // The physical colour# (pixel value). - rgb_c rgb; // Its RGB value. - int usage_count; // Number of logical colours that use it. - } pcolours_table_entry_t; +{ + pcolour_t pcn; // The physical colour# (pixel value). + rgb_c rgb; // Its RGB value. + int usage_count; // Number of logical colours that use it. +} pcolours_table_entry_t; pcolours_table_entry_t *pcolours = 0; size_t physical_colours = 0; // Number of entries in @@ -61,7 +60,7 @@ */ inline u16 eight2sixteen (u8 v) { -return (v << 8) | v; + return (v << 8) | v; } @@ -72,81 +71,81 @@ */ pcolour_t *alloc_colours (rgb_c rgb_values[], size_t count) { -verbmsg ("alloc_colours count=%d\n", count); + verbmsg ("colours: alloc_colours: count %d\n", count); -pcolour_t *pcn_table = (pcolour_t *) malloc (count * sizeof *pcn_table); -if (pcn_table == NULL) - fatal_error (msg_nomem); - -// Allocate the physical colours if necessary. -// Should not do it for static visuals (StaticColor, TrueColor). -// It doesn't harm but it's useless. -for (size_t n = 0; n < count; n++) - { - // Is there already a physical colour for this RGB value ? - pcn_table[n] = PCOLOUR_NONE; - for (size_t i = 0; i < physical_colours; i++) - { + pcolour_t *pcn_table = (pcolour_t *) malloc (count * sizeof *pcn_table); + if (pcn_table == NULL) + fatal_error (msg_nomem); + + /* Allocate the physical colours if necessary. Should not do + it for static visuals (StaticColor, TrueColor). It does no + harm but it's useless. */ + for (size_t n = 0; n < count; n++) + { + // Is there already a physical colour for this RGB value ? + pcn_table[n] = PCOLOUR_NONE; + for (size_t i = 0; i < physical_colours; i++) + { if (pcolours[i].rgb == rgb_values[n]) - { - // There is. Reuse it. - pcn_table[n] = pcolours[i].pcn; - pcolours[i].usage_count++; - break; - } + { + // There is. Reuse it. + pcn_table[n] = pcolours[i].pcn; + pcolours[i].usage_count++; + break; } + } - // There isn't. Try to create a new physical colour. - if (pcn_table[n] == PCOLOUR_NONE) - { + // There isn't. Try to create a new physical colour. + if (pcn_table[n] == PCOLOUR_NONE) + { XColor xc; xc.red = eight2sixteen (rgb_values[n].r); xc.green = eight2sixteen (rgb_values[n].g); xc.blue = eight2sixteen (rgb_values[n].b); Status r = XAllocColor (dpy, cmap, &xc); - // Allocation successful. Add a new entry to - // the table of physical colours. + /* Allocation successful. Add a new entry to + the table of physical colours. */ if (r != 0) - { - pcn_table[n] = (pcolour_t) xc.pixel; - physical_colours++; - pcolours = (pcolours_table_entry_t *) - realloc (pcolours, physical_colours * sizeof *pcolours); - if (pcolours == NULL) - fatal_error (msg_nomem); - pcolours[physical_colours - 1].pcn = (pcolour_t) xc.pixel; - pcolours[physical_colours - 1].rgb = rgb_values[n]; - pcolours[physical_colours - 1].usage_count = 1; - } + { + pcn_table[n] = (pcolour_t) xc.pixel; + physical_colours++; + pcolours = (pcolours_table_entry_t *) + realloc (pcolours, physical_colours * sizeof *pcolours); + if (pcolours == NULL) + fatal_error (msg_nomem); + pcolours[physical_colours - 1].pcn = (pcolour_t) xc.pixel; + pcolours[physical_colours - 1].rgb = rgb_values[n]; + pcolours[physical_colours - 1].usage_count = 1; + } - // Couldn't allocate (the colormap is full). - // Reuse the nearest existing physical colour. + /* Couldn't allocate (the colormap is full). + Reuse the nearest existing physical colour. */ else - { - size_t best_fit = 0; - int best_delta = INT_MAX; - - for (size_t m = 0; m < physical_colours; m++) - { - int delta = pcolours[m].rgb - rgb_values[n]; - if (delta < best_delta) - { - best_fit = m; - best_delta = delta; - } - } - verbmsg ("alloc_colours %d/%d/%d: reused %d/%d/%d, delta=%d\n", - rgb_values[n].r, rgb_values[n].g, rgb_values[n].b, - pcolours[best_fit].rgb.r, pcolours[best_fit].rgb.g, - pcolours[best_fit].rgb.b, - best_delta); - pcn_table[n] = pcolours[best_fit].pcn; - pcolours[best_fit].usage_count++; - } + { + size_t best_fit = 0; + int best_delta = INT_MAX; + + for (size_t m = 0; m < physical_colours; m++) + { + int delta = pcolours[m].rgb - rgb_values[n]; + if (delta < best_delta) + { + best_fit = m; + best_delta = delta; + } + } + verbmsg ("colours: alloc_colours %d/%d/%d: reused %d/%d/%d, delta=%d\n", + rgb_values[n].r, rgb_values[n].g, rgb_values[n].b, + pcolours[best_fit].rgb.r, pcolours[best_fit].rgb.g, + pcolours[best_fit].rgb.b, + best_delta); + pcn_table[n] = pcolours[best_fit].pcn; + pcolours[best_fit].usage_count++; } - } -return pcn_table; + } + } + return pcn_table; } @@ -156,33 +155,33 @@ */ void free_colours (pcolour_t *pcn_table, size_t count) { -verbmsg ("free_colours count=%d:\n", count); -if (verbose) - dump_pcolours (); - -if (pcn_table == NULL) // Sanity - return; - -// Decrement the usage count for all those physical colours. -// If the usage count reaches 0, actually free them. -for (pcolour_t *pcn = pcn_table; count; count--, pcn++) - { - size_t i; + verbmsg ("colours: free_colours: count %d\n", count); + if (verbose) + dump_pcolours (); + + if (pcn_table == NULL) // Sanity + return; + + /* Decrement the usage count for all those physical colours. + If the usage count reaches 0, actually free them. */ + for (pcolour_t *pcn = pcn_table; count; count--, pcn++) + { + size_t i; - for (i = 0; i < physical_colours; i++) + for (i = 0; i < physical_colours; i++) if (pcolours[i].pcn == *pcn) - break; - - if (i == physical_colours) + break; + + if (i == physical_colours) fatal_error ("Trying to free pc[%d]=%ld that does not exist", - (int) i, (long) *pcn); + (int) i, (long) *pcn); - if (pcolours[i].usage_count < 1) + if (pcolours[i].usage_count < 1) fatal_error ("Freeing unused colour %ld", (long) *pcn); - pcolours[i].usage_count--; - if (pcolours[i].usage_count == 0) - { + pcolours[i].usage_count--; + if (pcolours[i].usage_count == 0) + { unsigned long pixel = (unsigned long) *pcn; x_catch_on (); XFreeColors (dpy, cmap, &pixel, 1, 0); @@ -191,47 +190,47 @@ warn ("error freeing colour %08lXh (%s).\n", pixel, err_msg); x_catch_off (); pcolours[i].pcn = PCOLOUR_NONE; - } - } + } + } -// If physical colours have actually been freed, -// remove them from the table of physical colours. -size_t new_physical_colours = 0; + /* If physical colours have actually been freed, + remove them from the table of physical colours. */ + size_t new_physical_colours = 0; -{ -for (size_t i = 0; i < physical_colours; i++) - if (pcolours[i].pcn != PCOLOUR_NONE) - new_physical_colours++; // Number of phys. colours still in use. -} + { + for (size_t i = 0; i < physical_colours; i++) + if (pcolours[i].pcn != PCOLOUR_NONE) + new_physical_colours++; // Number of physical colours still in use. + } -verbmsg ("freed %d physical colours of %d\n", - physical_colours - new_physical_colours, physical_colours); + verbmsg ("colours: freed %d of %d physical colours\n", + physical_colours - new_physical_colours, physical_colours); -if (new_physical_colours == 0) - { - free (pcolours); - pcolours = 0; - } -else - { - pcolours_table_entry_t *new_item; - pcolours_table_entry_t *new_pcolours = (pcolours_table_entry_t *) + if (new_physical_colours == 0) + { + free (pcolours); + pcolours = 0; + } + else + { + pcolours_table_entry_t *new_item; + pcolours_table_entry_t *new_pcolours = (pcolours_table_entry_t *) malloc (new_physical_colours * sizeof *new_pcolours); - if (new_pcolours == NULL) + if (new_pcolours == NULL) fatal_error (msg_nomem); - new_item = new_pcolours; - for (size_t i = 0; i < physical_colours; i++) + new_item = new_pcolours; + for (size_t i = 0; i < physical_colours; i++) if (pcolours[i].pcn != PCOLOUR_NONE) - memcpy (new_item++, pcolours + i, sizeof *new_pcolours); - free (pcolours); - pcolours = new_pcolours; - } -physical_colours = new_physical_colours; + memcpy (new_item++, pcolours + i, sizeof *new_pcolours); + free (pcolours); + pcolours = new_pcolours; + } + physical_colours = new_physical_colours; -//if (verbose) -// dump_pcolours (); + //if (verbose) + // dump_pcolours (); -free (pcn_table); + free (pcn_table); } @@ -241,7 +240,7 @@ */ size_t get_pcolours_count () { -return physical_colours; + return physical_colours; } @@ -252,12 +251,12 @@ */ pcolour_t get_pcolour_pcn (size_t i) { -if (i >= physical_colours) - { - nf_bug ("get_pcolour_pcn: i=%d\n", (int) i); - return ULONG_MAX; - } -return pcolours[i].pcn; + if (i >= physical_colours) + { + nf_bug ("get_pcolour_pcn: i=%d\n", (int) i); + return ULONG_MAX; + } + return pcolours[i].pcn; } @@ -267,22 +266,36 @@ */ static void dump_pcolours () { -for (size_t i = 0; i < physical_colours; i++) - { + int items_on_current_line = 0; + + for (size_t i = 0; i < physical_colours; i++) + { #if 0 - printf ("%02lX %02X/%02X/%02X %d", - pcolours[i].pcn, - pcolours[i].rgb.r, - pcolours[i].rgb.g, - pcolours[i].rgb.b, - pcolours[i].usage_count); - fputs (i % 5 == 4 ? "\n" : " ", stdout); + printf ("%02lX %02X/%02X/%02X %d", + pcolours[i].pcn, + pcolours[i].rgb.r, + pcolours[i].rgb.g, + pcolours[i].rgb.b, + pcolours[i].usage_count); + fputs (i % 5 == 4 ? "\n" : " ", stdout); #endif - putchar (pcolours[i].usage_count == 1 ? '.' : '0' + pcolours[i].usage_count); - if (i % 79 == 78) - putchar ('\n'); - } -putchar ('\n'); + if (items_on_current_line == 0) + verbmsg ("colours: "); + verbmsg ("%c", + (pcolours[i].usage_count == 1) ? '.' : '0' + pcolours[i].usage_count); + if (++items_on_current_line % 10 == 0) + { + if (items_on_current_line == 50) + { + items_on_current_line = 0; + verbmsg ("\n"); + } + else + verbmsg (" "); + } + } + if (items_on_current_line != 0) + verbmsg ("\n"); } diff -uaNr yadex-1.5.2/src/credits.cc yadex-1.6.0/src/credits.cc --- yadex-1.5.2/src/credits.cc 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/src/credits.cc 2003-03-31 18:58:35.000000000 +0200 @@ -0,0 +1,12 @@ +// DO NOT EDIT -- generated from docsrc/copyright + +extern const char *const yadex_copyright[] = +{ + "Parts copyright Andrew Apted 2000-2001, GNU GPL v2", + "Parts copyright André Majorel 1997-2003, GNU GPL v2", + "Parts copyright Matthew W. Miller 2000, GNU GPL v2", + "Parts written by Raphaël Quinet, public domain", + "Parts written by Brendon Wyber, public domain", + 0 +}; + diff -uaNr yadex-1.5.2/src/credits.h yadex-1.6.0/src/credits.h --- yadex-1.5.2/src/credits.h 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/src/credits.h 2002-09-16 13:29:24.000000000 +0200 @@ -0,0 +1 @@ +extern const char *const yadex_copyright[]; diff -uaNr yadex-1.5.2/src/dependcy.cc yadex-1.6.0/src/dependcy.cc --- yadex-1.5.2/src/dependcy.cc 2000-04-12 03:38:15.000000000 +0200 +++ yadex-1.6.0/src/dependcy.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -52,3 +52,4 @@ serial_num->update (token); token_valid = true; } + diff -uaNr yadex-1.5.2/src/dialog.cc yadex-1.6.0/src/dialog.cc --- yadex-1.5.2/src/dialog.cc 2000-05-07 14:26:30.000000000 +0200 +++ yadex-1.6.0/src/dialog.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -35,139 +35,145 @@ /* - ask for confirmation (prompt2 may be NULL) - Returns zero for "no", non-zero for "yes". -*/ + * Confirm - ask for confirmation + * + * Ask for confirmation (prompt2 may be NULL). + * + * Return zero for "no", non-zero for "yes". + */ bool Confirm (int x0, int y0, const char *prompt1, const char *prompt2) { -const char *const prompt3 = "Press [Y] to confirm, [N] to cancel..."; -size_t maxlen; -double n_lines_of_text; -int width; -int height; -int text_x0; -int text_x1; -int x1; -int text_y0; -int text_y1; -int y1; -bool rc; - -maxlen = strlen (prompt3); -if (strlen (prompt1) > maxlen) - maxlen = strlen (prompt1); -if (prompt2 != NULL && strlen (prompt2) > maxlen) - maxlen = strlen (prompt2); -n_lines_of_text = (prompt2 == NULL ? 2.5 : 3.5); -width = 2 * BOX_BORDER + 2 * WIDE_HSPACING + maxlen * FONTW; -height = 2 * BOX_BORDER + 2 * WIDE_VSPACING + (int) (n_lines_of_text * FONTH); -if (x0 < 0) - x0 = (ScrMaxX - width) / 2; -if (y0 < 0) - y0 = (ScrMaxY - height) / 2; -text_x0 = x0 + BOX_BORDER + WIDE_HSPACING; -text_x1 = text_x0 + maxlen * FONTW - 1; -x1 = text_x1 + WIDE_HSPACING + BOX_BORDER; -text_y0 = y0 + BOX_BORDER + WIDE_VSPACING; -text_y1 = text_y0 + (int) (n_lines_of_text * FONTH) - 1; -y1 = text_y1 + WIDE_HSPACING + BOX_BORDER; -HideMousePointer (); -for (bool first_time = true; ; first_time = false) - { - if (first_time || is.key == YE_EXPOSE) - { + const char *const prompt3 = "Press [Y] to confirm, [N] to cancel..."; + size_t maxlen; + double n_lines_of_text; + int width; + int height; + int text_x0; + int text_x1; + int x1; + int text_y0; + int text_y1; + int y1; + bool rc; + + maxlen = strlen (prompt3); + if (strlen (prompt1) > maxlen) + maxlen = strlen (prompt1); + if (prompt2 != NULL && strlen (prompt2) > maxlen) + maxlen = strlen (prompt2); + n_lines_of_text = (prompt2 == NULL ? 2.5 : 3.5); + width = 2 * BOX_BORDER + 2 * WIDE_HSPACING + maxlen * FONTW; + height = 2 * BOX_BORDER + 2 * WIDE_VSPACING + (int) (n_lines_of_text * FONTH); + if (x0 < 0) + x0 = (ScrMaxX - width) / 2; + if (y0 < 0) + y0 = (ScrMaxY - height) / 2; + text_x0 = x0 + BOX_BORDER + WIDE_HSPACING; + text_x1 = text_x0 + maxlen * FONTW - 1; + x1 = text_x1 + WIDE_HSPACING + BOX_BORDER; + text_y0 = y0 + BOX_BORDER + WIDE_VSPACING; + text_y1 = text_y0 + (int) (n_lines_of_text * FONTH) - 1; + y1 = text_y1 + WIDE_HSPACING + BOX_BORDER; + HideMousePointer (); + for (bool first_time = true; ; first_time = false) + { + if (first_time || is.key == YE_EXPOSE) + { DrawScreenBox3D (x0, y0, x1, y1); set_colour (WHITE); DrawScreenText (text_x0, text_y0, prompt1); if (prompt2 != NULL) - DrawScreenText (text_x0, text_y0 + FONTH, prompt2); + DrawScreenText (text_x0, text_y0 + FONTH, prompt2); set_colour (YELLOW); DrawScreenText (text_x0, text_y1 - FONTH - 1, prompt3); - } - get_input_status (); - if (is.key == 'y' || is.key == 'Y' || is.key == YK_RETURN) - { + } + get_input_status (); + if (is.key == 'y' || is.key == 'Y' || is.key == YK_RETURN) + { rc = true; break; - } - if (is.key == 'n' || is.key == 'N' || is.key == YK_ESC) - { + } + if (is.key == 'n' || is.key == 'N' || is.key == YK_ESC) + { rc = false; break; - } - } -is.key = 0; // Shouldn't have to do that but EditorLoop() is broken -ShowMousePointer (); -return rc; + } + } + is.key = 0; // Shouldn't have to do that but EditorLoop() is broken + ShowMousePointer (); + return rc; } /* - * Confirm2 - * Ask for confirmation, in a smarter fashion - * Returns zero for "no", non-zero for "yes". + * Confirm2 - ask for confirmation, in a smarter fashion + * + * Return zero for "no", non-zero for "yes". */ int Confirm2 (int x0, int y0, confirm_t *confirm_flag, const char *prompt1, const char *prompt2) { -int r; + int r; -if (*confirm_flag == YC_YES) - return 1; -if (*confirm_flag == YC_NO) - return 0; -r = Confirm (x0, y0, prompt1, prompt2); -if (*confirm_flag == YC_ASK_ONCE) - *confirm_flag = r ? YC_YES : YC_NO; // We won't ask again -return r; + if (*confirm_flag == YC_YES) + return 1; + if (*confirm_flag == YC_NO) + return 0; + r = Confirm (x0, y0, prompt1, prompt2); + if (*confirm_flag == YC_ASK_ONCE) + *confirm_flag = r ? YC_YES : YC_NO; // We won't ask again + return r; } /* - display a notification and wait for a key (prompt2 may be NULL) -*/ + * Notify - notification dialog box + * + * Display a notification and wait for a key (prompt2 may + * be NULL) + */ void Notify (int x0, int y0, const char *prompt1, const char *prompt2) { -const char *const prompt3 = "Press any key to continue..."; -size_t maxlen; -double n_lines_of_text; -int width; -int height; -int text_x0; -int text_x1; -int x1; -int text_y0; -int text_y1; -int y1; - -HideMousePointer (); -maxlen = strlen (prompt3); -if (strlen (prompt1) > maxlen) - maxlen = strlen (prompt1); -if (prompt2 != NULL && strlen (prompt2) > maxlen) - maxlen = strlen (prompt2); -n_lines_of_text = (prompt2 == NULL ? 2.5 : 3.5); -width = 2 * BOX_BORDER + 2 * WIDE_HSPACING + maxlen * FONTW; -height = 2 * BOX_BORDER + 2 * WIDE_VSPACING + (int) (n_lines_of_text * FONTH); -if (x0 < 0) - x0 = (ScrMaxX - width) / 2; -if (y0 < 0) - y0 = (ScrMaxY - height) / 2; -text_x0 = x0 + BOX_BORDER + WIDE_HSPACING; -text_x1 = text_x0 + maxlen * FONTW - 1; -x1 = text_x1 + WIDE_HSPACING + BOX_BORDER; -text_y0 = y0 + BOX_BORDER + WIDE_VSPACING; -text_y1 = text_y0 + (int) (n_lines_of_text * FONTH) - 1; -y1 = text_y1 + WIDE_HSPACING + BOX_BORDER; -DrawScreenBox3D (x0, y0, x1, y1); -set_colour (WHITE); -DrawScreenText (text_x0, text_y0, prompt1); -if (prompt2 != NULL) - DrawScreenText (text_x0, text_y0 + FONTH, prompt2); -set_colour (YELLOW); -DrawScreenText (text_x0, text_y1 - FONTH - 1, prompt3); -get_key_or_click (); -ShowMousePointer (); + const char *const prompt3 = "Press any key to continue..."; + size_t maxlen; + double n_lines_of_text; + int width; + int height; + int text_x0; + int text_x1; + int x1; + int text_y0; + int text_y1; + int y1; + + HideMousePointer (); + maxlen = strlen (prompt3); + if (strlen (prompt1) > maxlen) + maxlen = strlen (prompt1); + if (prompt2 != NULL && strlen (prompt2) > maxlen) + maxlen = strlen (prompt2); + n_lines_of_text = (prompt2 == NULL ? 2.5 : 3.5); + width = 2 * BOX_BORDER + 2 * WIDE_HSPACING + maxlen * FONTW; + height = 2 * BOX_BORDER + 2 * WIDE_VSPACING + (int) (n_lines_of_text * FONTH); + if (x0 < 0) + x0 = (ScrMaxX - width) / 2; + if (y0 < 0) + y0 = (ScrMaxY - height) / 2; + text_x0 = x0 + BOX_BORDER + WIDE_HSPACING; + text_x1 = text_x0 + maxlen * FONTW - 1; + x1 = text_x1 + WIDE_HSPACING + BOX_BORDER; + text_y0 = y0 + BOX_BORDER + WIDE_VSPACING; + text_y1 = text_y0 + (int) (n_lines_of_text * FONTH) - 1; + y1 = text_y1 + WIDE_HSPACING + BOX_BORDER; + DrawScreenBox3D (x0, y0, x1, y1); + set_colour (WHITE); + DrawScreenText (text_x0, text_y0, prompt1); + if (prompt2 != NULL) + DrawScreenText (text_x0, text_y0 + FONTH, prompt2); + set_colour (YELLOW); + DrawScreenText (text_x0, text_y1 - FONTH - 1, prompt3); + get_key_or_click (); + ShowMousePointer (); } @@ -181,53 +187,53 @@ */ void debmes (const char *fmt, ...) { -char buf[200]; -va_list arglist; + char buf[200]; + va_list arglist; -if (Debug != 1) - return; -va_start (arglist, fmt); -y_vsnprintf (buf, sizeof buf, fmt, arglist); + if (Debug != 1) + return; + va_start (arglist, fmt); + y_vsnprintf (buf, sizeof buf, fmt, arglist); #ifdef Y_BGI -setviewport (0, 0, ScrMaxX, ScrMaxY, 1); -#endif /* FIXME! */ -Notify (-1, -1, buf, NULL); + setviewport (0, 0, ScrMaxX, ScrMaxY, 1); +#endif /* FIXME! */ + Notify (-1, -1, buf, NULL); } /* - clear the screen and display a message -*/ + * DisplayMessage - clear the screen and display a message + */ void DisplayMessage (int x0, int y0, const char *msg, ...) { -char prompt[120]; -va_list args; + char prompt[120]; + va_list args; -va_start (args, msg); -y_vsnprintf (prompt, sizeof prompt, msg, args); -int width = 2 * BOX_BORDER + 2 * WIDE_HSPACING + FONTW * strlen (prompt); -int height = 2 * BOX_BORDER + 2 * WIDE_VSPACING + FONTH; -if (x0 < 0) - x0 = (ScrMaxX - width) / 2; -if (y0 < 0) - y0 = (ScrMaxY - height) / 2; -HideMousePointer (); -DrawScreenBox3D (x0, y0, x0 + width - 1, y0 + height - 1); -push_colour (WINFG); -DrawScreenText (x0 + BOX_BORDER + WIDE_HSPACING, - y0 + BOX_BORDER + WIDE_VSPACING, prompt); -pop_colour (); -ShowMousePointer (); -XFlush (dpy); + va_start (args, msg); + y_vsnprintf (prompt, sizeof prompt, msg, args); + int width = 2 * BOX_BORDER + 2 * WIDE_HSPACING + FONTW * strlen (prompt); + int height = 2 * BOX_BORDER + 2 * WIDE_VSPACING + FONTH; + if (x0 < 0) + x0 = (ScrMaxX - width) / 2; + if (y0 < 0) + y0 = (ScrMaxY - height) / 2; + HideMousePointer (); + DrawScreenBox3D (x0, y0, x0 + width - 1, y0 + height - 1); + push_colour (WINFG); + DrawScreenText (x0 + BOX_BORDER + WIDE_HSPACING, + y0 + BOX_BORDER + WIDE_VSPACING, prompt); + pop_colour (); + ShowMousePointer (); + XFlush (dpy); } /* - let's make the user angry... -*/ + * NotImplemented - make the user angry... + */ void NotImplemented (void) { -Notify (-1, -1, "This function is not implemented... Yet!", NULL); + Notify (-1, -1, "This function is not implemented... Yet!", NULL); } diff -uaNr yadex-1.5.2/src/disppic.cc yadex-1.6.0/src/disppic.cc --- yadex-1.5.2/src/disppic.cc 2000-08-13 18:03:55.000000000 +0200 +++ yadex-1.6.0/src/disppic.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -41,9 +41,9 @@ /* - * display_pic() - * Load a picture and display it. - * A wrapper for LoadPicture() and Sprite.load()/draw(). + * display_pic() - load a picture and display it + * + * A wrapper for LoadPicture() and Sticker.load()/draw(). */ void display_pic (hookfunc_comm_t *c) { @@ -51,44 +51,34 @@ int height = c->y1 - c->y0 + 1; Lump_loc loc; - Img img (width, height); + c->img.clear (); + c->img.set_opaque (false); if (c->flags & HOOK_PATCH) patch_dir.loc_by_name (c->name, loc); else if ((c->flags & HOOK_SPRITE) && (c->flags & HOOK_ROOT)) wad_res.sprites.loc_by_root (c->name, loc); else if ((c->flags & HOOK_SPRITE) && ! (c->flags & HOOK_ROOT)) wad_res.sprites.loc_by_name (c->name, loc); - if (! LoadPicture (img, + if (! LoadPicture (c->img, c->name, loc, - INT_MIN, // Not very clean, should use c->xofs but *WithFunc doesn't set it - INT_MIN, // Not very clean, should use c->yofs but *WithFunc doesn't set it + 0, // Not very clean, should use c->xofs but *WithFunc doesn't set it + 0, // Not very clean, should use c->yofs but *WithFunc doesn't set it &c->width, &c->height)) { + c->disp_x0 = c->x0 + (width - c->width) / 2; + c->disp_y0 = c->y0 + (height - c->height) / 2; + c->disp_x1 = c->disp_x0 + c->width - 1; + c->disp_y1 = c->disp_y0 + c->height - 1; c->flags |= HOOK_SIZE_VALID; c->lump_loc = loc; c->flags |= HOOK_LOC_VALID; if (c->flags & HOOK_SPECTRAL) - spectrify_img (img); - Sticker sticker (img, true); // Use opaque because it's faster - sticker.draw (drw, 't', c->x0, c->y0); + spectrify_img (c->img); + Sticker sticker (c->img, true); // Use opaque because it's faster + sticker.draw (drw, 't', c->disp_x0, c->disp_y0); c->flags |= HOOK_DRAWN; - - /* Alas, drawing the smallest possible rectangle is not implemented - yet because the allocation of the game image happens before the - size of the picture is known. -- AYM 2000-03-29 */ -#if 0 - c->disp_x0 = c->x0 + (width - c->width) / 2; - c->disp_y0 = c->y0 + (height - c->height) / 2; - c->disp_x1 = c->disp_x0 + c->width - 1; - c->disp_y1 = c->disp_y0 + c->height - 1; -#else - c->disp_x0 = c->x0; - c->disp_y0 = c->y0; - c->disp_x1 = c->x1; - c->disp_y1 = c->y1; -#endif } else { diff -uaNr yadex-1.5.2/src/drawmap.cc yadex-1.6.0/src/drawmap.cc --- yadex-1.5.2/src/drawmap.cc 2001-06-21 15:55:40.000000000 +0200 +++ yadex-1.6.0/src/drawmap.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -52,13 +52,59 @@ #include "wadres.h" -void draw_grid (edit_t *e); +static void draw_grid (edit_t *e); +static void draw_vertices (edit_t *e); +static void draw_linedefs (edit_t *e); static void draw_things_squares (edit_t *e); static void draw_things_sprites (edit_t *e); static void draw_obj_no (int x, int y, int obj_no, acolour_t c); /* + * vertex_radius - apparent radius of a vertex, in pixels + * + * Try this in Gnuplot : + * + * plot [0:10] x + * replot log(x+1.46)/log(1.5)-log(2.46)/log(1.5)+1 + */ +int vertex_radius (double scale) +{ +#if 0 + static double last_scale = 0; + static int last_result = 0; + + if (scale == last_scale) + return last_result; + + const int VERTEX_PIXELS = 5; + + // The scale past which we switch from linear to logarithmic. + const double crossover = 0.1; + + // The base of the log. The higher, the stronger the effect. + const double base = 1.4; + + /* The point at which the derivative of log{base}(x) is 1. + This is where we want the crossover to occur. */ + const double knee_x = 1 / log (base); + const double knee_y = log (knee_x) / log (base); + + double factor; + if (scale <= crossover) + factor = scale; + else + factor = crossover + log (scale -crossover + knee_x) / log (base) - knee_y; + last_result = (int) (VERTEX_PIXELS * factor + 0.5); + return last_result; +#else + const int VERTEX_PIXELS = 6; + return (int) (VERTEX_PIXELS * (0.2 + scale / 2)); +#endif +} + + +/* draw the actual game map */ @@ -74,206 +120,32 @@ // Draw the grid first since it's in the background draw_grid (e); - // Then the things "reminders" - if (e->obj_type != OBJ_THINGS) - draw_things_squares (e); - - /* Draw the linedefs to form the map. - Optimization: off-screen lines are not drawn - and set_colour is not called unnecessarily. */ - switch (e->obj_type) - { - case OBJ_THINGS: - { - int current_colour = INT_MIN; /* Some impossible colour no. */ - int new_colour; - - ObjectsNeeded (OBJ_LINEDEFS, OBJ_VERTICES, 0); - for (n = 0; n < NumLineDefs; n++) - { - register int x1 = Vertices[LineDefs[n].start].x; - register int x2 = Vertices[LineDefs[n].end ].x; - register int y1 = Vertices[LineDefs[n].start].y; - register int y2 = Vertices[LineDefs[n].end ].y; - if (x1 < mapx0 && x2 < mapx0 - || x1 > mapx9 && x2 > mapx9 - || y1 < mapy0 && y2 < mapy0 - || y1 > mapy9 && y2 > mapy9) - continue; - if (LineDefs[n].flags & 1) - new_colour = WHITE; - else - new_colour = LIGHTGRAY; - if (new_colour != current_colour) - set_colour (current_colour = new_colour); - DrawMapLine (x1, y1, x2, y2); - } - break; - } - - case OBJ_VERTICES: - ObjectsNeeded (OBJ_LINEDEFS, OBJ_VERTICES, 0); - set_colour (LIGHTGRAY); - for (n = 0; n < NumLineDefs; n++) - { - register int x1 = Vertices[LineDefs[n].start].x; - register int x2 = Vertices[LineDefs[n].end ].x; - register int y1 = Vertices[LineDefs[n].start].y; - register int y2 = Vertices[LineDefs[n].end ].y; - if (x1 < mapx0 && x2 < mapx0 - || x1 > mapx9 && x2 > mapx9 - || y1 < mapy0 && y2 < mapy0 - || y1 > mapy9 && y2 > mapy9) - continue; - DrawMapVector (x1, y1, x2, y2); - } - break; - - case OBJ_LINEDEFS: - { - int current_colour = INT_MIN; /* Some impossible colour no. */ - int new_colour; - - ObjectsNeeded (OBJ_LINEDEFS, OBJ_VERTICES, 0); - for (n = 0; n < NumLineDefs; n++) - { - register int x1 = Vertices[LineDefs[n].start].x; - register int x2 = Vertices[LineDefs[n].end ].x; - register int y1 = Vertices[LineDefs[n].start].y; - register int y2 = Vertices[LineDefs[n].end ].y; - if (x1 < mapx0 && x2 < mapx0 - || x1 > mapx9 && x2 > mapx9 - || y1 < mapy0 && y2 < mapy0 - || y1 > mapy9 && y2 > mapy9) - continue; - if (LineDefs[n].type != 0) /* AYM 19980207: was "> 0" */ - { - if (LineDefs[n].tag != 0) /* AYM 19980207: was "> 0" */ - new_colour = LIGHTMAGENTA; - else - new_colour = LIGHTGREEN; - } - else if (LineDefs[n].tag != 0) /* AYM 19980207: was "> 0" */ - new_colour = LIGHTRED; - else if (LineDefs[n].flags & 1) - new_colour = WHITE; - else - new_colour = LIGHTGRAY; - if (new_colour != current_colour) - set_colour (current_colour = new_colour); - DrawMapLine (x1, y1, x2, y2); - - if (e->show_object_numbers) - { - int scnx0 = SCREENX (x1); - int scnx1 = SCREENX (x2); - int scny0 = SCREENY (y1); - int scny1 = SCREENY (y2); - int label_width = ((int) log10 (n) + 1) * FONTW; - if (abs (scnx1 - scnx0) > label_width + 4 - || abs (scny1 - scny0) > label_width + 4) - { - int scnx = (scnx0 + scnx1) / 2 - label_width / 2; - int scny = (scny0 + scny1) / 2 - FONTH / 2; - draw_obj_no (scnx, scny, n, LINEDEF_NO); - } - } - } - break; - } - - case OBJ_SECTORS: - { - int current_colour = INT_MIN; /* Some impossible colour no. */ - int new_colour; - - ObjectsNeeded (OBJ_LINEDEFS, OBJ_SIDEDEFS, 0); - for (n = 0; n < NumLineDefs; n++) - { - register int x1 = Vertices[LineDefs[n].start].x; - register int x2 = Vertices[LineDefs[n].end ].x; - register int y1 = Vertices[LineDefs[n].start].y; - register int y2 = Vertices[LineDefs[n].end ].y; - if (x1 < mapx0 && x2 < mapx0 - || x1 > mapx9 && x2 > mapx9 - || y1 < mapy0 && y2 < mapy0 - || y1 > mapy9 && y2 > mapy9) - continue; - int m; - if ((m = LineDefs[n].sidedef1) < 0 || (m = SideDefs[m].sector) < 0) - new_colour = LIGHTRED; - else - { - if (Sectors[m].tag != 0) /* AYM 19980207: was "> 0" */ - new_colour = LIGHTGREEN; - else if (Sectors[m].special > 0) - new_colour = LIGHTCYAN; - else if (LineDefs[n].flags & 1) - new_colour = WHITE; - else - new_colour = LIGHTGRAY; - if ((m = LineDefs[n].sidedef2) >= 0) - { - if ((m = SideDefs[m].sector) < 0) - new_colour = LIGHTRED; - else if (Sectors[m].tag != 0) /* AYM 19980207: was "> 0" */ - new_colour = LIGHTGREEN; - else if (Sectors[m].special > 0) - new_colour = LIGHTCYAN; - } - } - ObjectsNeeded (OBJ_LINEDEFS, OBJ_VERTICES, 0); - if (new_colour != current_colour) - set_colour (current_colour = new_colour); - DrawMapLine (x1, y1, x2, y2); - } - break; - } - } - - /* Draw in the vertices. - Optimization: off-screen vertices are not drawn. */ - if (e->obj_type == OBJ_VERTICES) - { - int r = (int) (OBJSIZE * y_min (Scale, 1)); - set_colour (LIGHTGREEN); - for (n = 0; n < NumVertices; n++) - { - int mapx = Vertices[n].x; - int mapy = Vertices[n].y; - if (mapx >= mapx0 && mapx <= mapx9 && mapy >= mapy0 && mapy <= mapy9) - { - register int scrx = SCREENX (mapx); - register int scry = SCREENY (mapy); - DrawScreenLine (scrx - r, scry - r, scrx + r, scry + r); - DrawScreenLine (scrx + r, scry - r, scrx - r, scry + r); - } - } - if (e->show_object_numbers && e->obj_type == OBJ_VERTICES) - { - for (n = 0; n < NumVertices; n++) - { - int mapx = Vertices[n].x; - int mapy = Vertices[n].y; - if (mapx >= mapx0 && mapx <= mapx9 && mapy >= mapy0 && mapy <= mapy9) - { - int x = (int) (SCREENX (mapx) + 2 * VERTEXSIZE); - int y = SCREENY (mapy) + 2; - draw_obj_no (x, y, n, VERTEX_NO); - } - } - } - } - - // Draw the things in things mode - if (e->obj_type == OBJ_THINGS) + if (e->global) { + draw_linedefs (e); if (e->show_things_sprites) draw_things_sprites (e); else draw_things_squares (e); + draw_vertices (e); + } + else + { + if (e->obj_type != OBJ_THINGS) + draw_things_squares (e); + draw_linedefs (e); + if (e->obj_type == OBJ_VERTICES) + draw_vertices (e); + if (e->obj_type == OBJ_THINGS) + { + if (e->show_things_sprites) + draw_things_sprites (e); + else + draw_things_squares (e); + } } + // Draw the things numbers if (e->obj_type == OBJ_THINGS && e->show_object_numbers) { @@ -290,15 +162,18 @@ // Draw the sector numbers if (e->obj_type == OBJ_SECTORS && e->show_object_numbers) { + int xoffset = - FONTW / 2; + for (n = 0; n < NumSectors; n++) { int mapx; int mapy; centre_of_sector (n, &mapx, &mapy); - if (mapx < mapx0 || mapx > mapx9 || mapy < mapy0 || mapy > mapy9) - continue; - draw_obj_no (SCREENX (mapx) - FONTW, SCREENY (mapy) - FONTH / 2, n, - SECTOR_NO); + if (mapx >= mapx0 && mapx <= mapx9 && mapy >= mapy0 && mapy <= mapy9) + draw_obj_no (SCREENX (mapx) + xoffset, SCREENY (mapy) - FONTH / 2, n, + SECTOR_NO); + if (n == 10 || n == 100 || n == 1000 || n == 10000) + xoffset -= FONTW / 2; } } } @@ -307,11 +182,11 @@ /* * draw_grid - draw the grid in the background of the edit window */ -void draw_grid (edit_t *e) +static void draw_grid (edit_t *e) { if (! e->grid_shown) return; - + int mapx0 = MAPX (0); int mapx1 = MAPX (ScrMaxX); int mapy0 = MAPY (ScrMaxY); @@ -433,6 +308,235 @@ /* + * draw_vertices - draw the vertices, and possibly their numbers + */ +static void draw_vertices (edit_t *e) +{ + int mapx0 = MAPX (0); + int mapx9 = MAPX (ScrMaxX); + int mapy0 = MAPY (ScrMaxY); + int mapy9 = MAPY (0); + const int r = vertex_radius (Scale); + + push_colour (LIGHTGREEN); + for (int n = 0; n < NumVertices; n++) + { + int mapx = Vertices[n].x; + int mapy = Vertices[n].y; + if (mapx >= mapx0 && mapx <= mapx9 && mapy >= mapy0 && mapy <= mapy9) + { + register int scrx = SCREENX (mapx); + register int scry = SCREENY (mapy); + DrawScreenLine (scrx - r, scry - r, scrx + r, scry + r); + DrawScreenLine (scrx + r, scry - r, scrx - r, scry + r); + } + } + if (e->show_object_numbers) + { + for (int n = 0; n < NumVertices; n++) + { + int mapx = Vertices[n].x; + int mapy = Vertices[n].y; + if (mapx >= mapx0 && mapx <= mapx9 && mapy >= mapy0 && mapy <= mapy9) + { + int x = (int) (SCREENX (mapx) + 2 * r); + int y = SCREENY (mapy) + 2; + draw_obj_no (x, y, n, VERTEX_NO); + } + } + } + pop_colour (); +} + + +/* + * draw_linedefs - draw the linedefs + */ +static void draw_linedefs (edit_t *e) +{ + int mapx0 = MAPX (0); + int mapx9 = MAPX (ScrMaxX); + int mapy0 = MAPY (ScrMaxY); + int mapy9 = MAPY (0); + + switch (e->obj_type) + { + case OBJ_THINGS: + { + int current_colour = INT_MIN; /* Some impossible colour no. */ + int new_colour; + + ObjectsNeeded (OBJ_LINEDEFS, OBJ_VERTICES, 0); + for (int n = 0; n < NumLineDefs; n++) + { + register int x1 = Vertices[LineDefs[n].start].x; + register int x2 = Vertices[LineDefs[n].end ].x; + register int y1 = Vertices[LineDefs[n].start].y; + register int y2 = Vertices[LineDefs[n].end ].y; + if (x1 < mapx0 && x2 < mapx0 + || x1 > mapx9 && x2 > mapx9 + || y1 < mapy0 && y2 < mapy0 + || y1 > mapy9 && y2 > mapy9) + continue; + if (LineDefs[n].flags & 1) + new_colour = WHITE; + else + new_colour = LIGHTGREY; + if (new_colour != current_colour) + set_colour (current_colour = new_colour); + DrawMapLine (x1, y1, x2, y2); + } + break; + } + + case OBJ_VERTICES: + ObjectsNeeded (OBJ_LINEDEFS, OBJ_VERTICES, 0); + set_colour (LIGHTGREY); + for (int n = 0; n < NumLineDefs; n++) + { + register int x1 = Vertices[LineDefs[n].start].x; + register int x2 = Vertices[LineDefs[n].end ].x; + register int y1 = Vertices[LineDefs[n].start].y; + register int y2 = Vertices[LineDefs[n].end ].y; + if (x1 < mapx0 && x2 < mapx0 + || x1 > mapx9 && x2 > mapx9 + || y1 < mapy0 && y2 < mapy0 + || y1 > mapy9 && y2 > mapy9) + continue; + DrawMapVector (x1, y1, x2, y2); + } + break; + + case OBJ_LINEDEFS: + { + int current_colour = INT_MIN; /* Some impossible colour no. */ + int new_colour; + + ObjectsNeeded (OBJ_LINEDEFS, OBJ_VERTICES, 0); + for (int n = 0; n < NumLineDefs; n++) + { + register int x1 = Vertices[LineDefs[n].start].x; + register int x2 = Vertices[LineDefs[n].end ].x; + register int y1 = Vertices[LineDefs[n].start].y; + register int y2 = Vertices[LineDefs[n].end ].y; + if (x1 < mapx0 && x2 < mapx0 + || x1 > mapx9 && x2 > mapx9 + || y1 < mapy0 && y2 < mapy0 + || y1 > mapy9 && y2 > mapy9) + continue; + if (LineDefs[n].type != 0) /* AYM 19980207: was "> 0" */ + { + if (LineDefs[n].tag != 0) /* AYM 19980207: was "> 0" */ + new_colour = LIGHTMAGENTA; + else + new_colour = LIGHTGREEN; + } + else if (LineDefs[n].flags & 1) + new_colour = WHITE; + else + new_colour = LIGHTGREY; + + // Signal errors by drawing the linedef in red. Needs work. + // Tag on a typeless linedef + if (LineDefs[n].type == 0 && LineDefs[n].tag != 0) + new_colour = LIGHTRED; + // No first sidedef + if (! is_sidedef (LineDefs[n].sidedef1)) + new_colour = LIGHTRED; + // Bad second sidedef + if (! is_sidedef (LineDefs[n].sidedef2) && LineDefs[n].sidedef2 != -1) + new_colour = LIGHTRED; + + if (new_colour != current_colour) + set_colour (current_colour = new_colour); + DrawMapLine (x1, y1, x2, y2); + + if (e->show_object_numbers) + { + int scnx0 = SCREENX (x1); + int scnx1 = SCREENX (x2); + int scny0 = SCREENY (y1); + int scny1 = SCREENY (y2); + int label_width = ((int) log10 (n) + 1) * FONTW; + if (abs (scnx1 - scnx0) > label_width + 4 + || abs (scny1 - scny0) > label_width + 4) + { + int scnx = (scnx0 + scnx1) / 2 - label_width / 2; + int scny = (scny0 + scny1) / 2 - FONTH / 2; + draw_obj_no (scnx, scny, n, LINEDEF_NO); + } + } + } + break; + } + + case OBJ_SECTORS: + { + int current_colour = INT_MIN; /* Some impossible colour no. */ + int new_colour; + + for (int n = 0; n < NumLineDefs; n++) + { + register int x1 = Vertices[LineDefs[n].start].x; + register int x2 = Vertices[LineDefs[n].end ].x; + register int y1 = Vertices[LineDefs[n].start].y; + register int y2 = Vertices[LineDefs[n].end ].y; + if (x1 < mapx0 && x2 < mapx0 + || x1 > mapx9 && x2 > mapx9 + || y1 < mapy0 && y2 < mapy0 + || y1 > mapy9 && y2 > mapy9) + continue; + int sd1 = OBJ_NO_NONE; + int sd2 = OBJ_NO_NONE; + int s1 = OBJ_NO_NONE; + int s2 = OBJ_NO_NONE; + // FIXME should flag negative sidedef numbers as errors + // FIXME should flag unused tag as errors + if ((sd1 = LineDefs[n].sidedef1) < 0 || sd1 >= NumSideDefs + || (s1 = SideDefs[sd1].sector) < 0 || s1 >= NumSectors + || (sd2 = LineDefs[n].sidedef2) >= NumSideDefs + || sd2 >= 0 && ((s2 = SideDefs[sd2].sector) < 0 + || s2 >= NumSectors)) + { + new_colour = LIGHTRED; + } + else + { + bool have_tag = false; + bool have_type = false; + if (Sectors[s1].tag != 0) + have_tag = true; + if (Sectors[s1].special != 0) + have_type = true; + if (sd2 >= 0) + { + if (Sectors[s2].tag != 0) + have_tag = true; + if (Sectors[s2].special != 0) + have_type = true; + } + if (have_tag && have_type) + new_colour = SECTOR_TAGTYPE; + else if (have_tag) + new_colour = SECTOR_TAG; + else if (have_type) + new_colour = SECTOR_TYPE; + else if (LineDefs[n].flags & 1) + new_colour = WHITE; + else + new_colour = LIGHTGREY; + } + if (new_colour != current_colour) + set_colour (current_colour = new_colour); + DrawMapLine (x1, y1, x2, y2); + } + break; + } + } +} + + +/* * draw_things_squares - the obvious */ static void draw_things_squares (edit_t *e) @@ -440,9 +544,9 @@ // The radius of the largest thing. int max_radius = get_max_thing_radius (); - // A thing is guaranteed to be totally off-screen - // if its centre is more than units - // beyond the edge of the screen. + /* A thing is guaranteed to be totally off-screen + if its centre is more than units + beyond the edge of the screen. */ int mapx0 = MAPX (0) - max_radius; int mapx9 = MAPX (ScrMaxX) + max_radius; int mapy0 = MAPY (ScrMaxY) - max_radius; @@ -694,27 +798,28 @@ /* - * draw_obj_no - * Draw a number at screen coordinates (x, y) + * draw_obj_no - draw a number at screen coordinates (x, y) + * + * FIXME too slow. */ static void draw_obj_no (int x, int y, int obj_no, acolour_t c) { -push_colour (BLACK); + push_colour (BLACK); #if 1 -DrawScreenText (x - 2, y, "%d", obj_no); -DrawScreenText (x - 1, y, "%d", obj_no); -DrawScreenText (x + 1, y, "%d", obj_no); -DrawScreenText (x + 2, y, "%d", obj_no); -DrawScreenText (x, y + 1, "%d", obj_no); -DrawScreenText (x, y - 1, "%d", obj_no); + DrawScreenText (x - 2, y, "%d", obj_no); + DrawScreenText (x - 1, y, "%d", obj_no); + DrawScreenText (x + 1, y, "%d", obj_no); + DrawScreenText (x + 2, y, "%d", obj_no); + DrawScreenText (x, y + 1, "%d", obj_no); + DrawScreenText (x, y - 1, "%d", obj_no); #else -DrawScreenText (x + 1, y + 1, "%d", obj_no); -DrawScreenText (x + 1, y - 1, "%d", obj_no); -DrawScreenText (x - 1, y + 1, "%d", obj_no); -DrawScreenText (x - 1, y - 1, "%d", obj_no); + DrawScreenText (x + 1, y + 1, "%d", obj_no); + DrawScreenText (x + 1, y - 1, "%d", obj_no); + DrawScreenText (x - 1, y + 1, "%d", obj_no); + DrawScreenText (x - 1, y - 1, "%d", obj_no); #endif -set_colour (c); -DrawScreenText (x, y, "%d", obj_no); -pop_colour (); + set_colour (c); + DrawScreenText (x, y, "%d", obj_no); + pop_colour (); } diff -uaNr yadex-1.5.2/src/drawmap.h yadex-1.6.0/src/drawmap.h --- yadex-1.5.2/src/drawmap.h 2000-01-10 14:40:12.000000000 +0100 +++ yadex-1.6.0/src/drawmap.h 2003-02-12 17:17:03.000000000 +0100 @@ -4,8 +4,16 @@ */ +#ifndef YH_DRAWMAP +#define YH_DRAWMAP + #include "_edit.h" -void draw_map (edit_t *e); /* SWAP! */ + +int vertex_radius (double scale); + +void draw_map (edit_t *e); void draw_infobar (const edit_t *e); + +#endif diff -uaNr yadex-1.5.2/src/edisplay.cc yadex-1.6.0/src/edisplay.cc --- yadex-1.5.2/src/edisplay.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/edisplay.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -64,150 +64,154 @@ #include "menu.h" #include "menubar.h" #include "modpopup.h" +#include "objects.h" #include "objinfo.h" #include "selbox.h" #include "spot.h" +#include "wadfile.h" edisplay_c::edisplay_c (edit_t *e) { -this->e = e; -pointer_scnx = 0; -pointer_scny = 0; -refresh_needed = 1; -highlight = new highlight_c; -objinfo = new objinfo_c; -infobar = new infobar_c; + this->e = e; + pointer_scnx = 0; + pointer_scny = 0; + refresh_needed = 1; + highlight = new highlight_c; + objinfo = new objinfo_c; + infobar = new infobar_c; } edisplay_c::~edisplay_c () { -delete highlight; -delete objinfo; + delete highlight; + delete objinfo; } // FIXME this should not be a separate method -void edisplay_c::highlight_object (int obj_no) +void edisplay_c::highlight_object (Objid& obj) { -highlight->set (e->obj_type, obj_no); -objinfo->set (e->obj_type, obj_no); + highlight->set (obj); + objinfo->set (obj.type, obj.num); } // FIXME this should not be a separate method void edisplay_c::forget_highlight () { -highlight->unset (); -/* I don't unset objinfo because, as it can't undraw - itself, it would lead to redrawing everything from - scratch everytime an object passes out of focus. */ -//objinfo->unset (); + highlight->unset (); + /* I don't unset objinfo because, as it can't undraw + itself, it would lead to redrawing everything from + scratch everytime an object passes out of focus. */ + //objinfo->unset (); } void edisplay_c::need_refresh () { -refresh_needed = 1; + refresh_needed = 1; } void edisplay_c::refresh () { -int redraw_from_scratch; + int redraw_from_scratch; -// The poor hacker's geometry manager (FIXME: this needs work!) -infobar->set_x1 (ScrMaxX); -infobar->set_y1 (ScrMaxY); -infobar->set_x0 (0); -infobar->set_y0 (ScrMaxY - (infobar->req_height () - 1)); -objinfo->set_y1 (e->infobar_shown ? infobar->get_y0 () - 1 : ScrMaxY); - -/* Extract the interesting data from the edit_c object - and feed it to the widgets. */ -infobar->set_visible (e->infobar_shown); -infobar->set_file_name (Level - ? (const char *) Level->wadfile->filename - : 0); -infobar->set_level_name (Level - ? (const char *) Level->dir.name - : 0); -infobar->set_obj_type (e->obj_type); -infobar->set_changes (MadeMapChanges ? 2 : (MadeChanges ? 1 : 0)); -infobar->set_grid_snap (e->grid_snap); -infobar->set_grid_step_locked (e->grid_step_locked); -infobar->set_scale (Scale); -infobar->set_grid_step (e->grid_step); -if (e->pointer_in_window) - infobar->set_pointer (e->pointer_x, e->pointer_y); -else - infobar->unset_pointer (); - -redraw_from_scratch = - refresh_needed - || e->selbox->need_to_clear () - || e->spot->need_to_clear () - || highlight->need_to_clear () - || objinfo->need_to_clear () - || infobar->need_to_clear () - || e->menubar->need_to_clear () - || e->modpopup->need_to_clear (); - -/* If we can update the display in an incremental fashion - (not from scratch), do it by telling all widgets, from - the top to the bottom, to undraw themselves if necessary. */ -if (! redraw_from_scratch) - { - e->modpopup->undraw (); - e->menubar->undraw (); - infobar->undraw (); - objinfo->undraw (); - highlight->undraw (); - e->spot->undraw (); - e->selbox->undraw (); - } - -/* If a complete refresh is required, call the clear() - method for all widgets to make them aware that they're - not visible anymore. */ -else - { - e->selbox->clear (); - e->spot->clear (); - highlight->clear (); - objinfo->clear (); - infobar->clear (); - e->menubar->clear (); - e->modpopup->clear (); - - // A piece of ad-hockery - objinfo->unset (); - - // As we said, "from scratch". - ClearScreen (); - draw_map (e); // FIXME should be widgetized - // draw_menubar (); // FIXME should be widgetized - HighlightSelection (e->obj_type, e->Selected); // FIXME should be widgetized - refresh_needed = 0; - } - -/* Tell all widgets from to bottom to the top - to draw themselves if necessary. */ -e->selbox->draw (); -e->spot->draw (); -highlight->draw (); -objinfo->draw (); -infobar->draw (); -e->menubar->draw (); -e->modpopup->draw (); - -// Redraw the pointer if necessary. -if (refresh_needed && (FakeCursor || e->rulers_shown)) - DrawPointer (e->rulers_shown); // FIXME should be widgetized + // The poor hacker's geometry manager (FIXME: this needs work!) + infobar->set_x1 (ScrMaxX); + infobar->set_y1 (ScrMaxY); + infobar->set_x0 (0); + infobar->set_y0 (ScrMaxY - (infobar->req_height () - 1)); + objinfo->set_y1 (e->infobar_shown ? infobar->get_y0 () - 1 : ScrMaxY); + + /* Extract the interesting data from the edit_c object + and feed it to the widgets. */ + infobar->set_visible (e->infobar_shown); + infobar->set_file_name (Level + ? Level->wadfile->pathname () + : 0); + infobar->set_level_name (Level + ? (const char *) Level->dir.name + : 0); + infobar->set_obj_type (e->obj_type); + infobar->set_changes (MadeMapChanges ? 2 : (MadeChanges ? 1 : 0)); + infobar->set_grid_snap (e->grid_snap); + infobar->set_grid_step_locked (e->grid_step_locked); + infobar->set_scale (Scale); + infobar->set_grid_step (e->grid_step); + if (e->pointer_in_window) + infobar->set_pointer (e->pointer_x, e->pointer_y); + else + infobar->unset_pointer (); + + + redraw_from_scratch = + refresh_needed + || e->selbox->need_to_clear () + || e->spot->need_to_clear () + || highlight->need_to_clear () + || objinfo->need_to_clear () + || infobar->need_to_clear () + || e->menubar->need_to_clear () + || e->modpopup->need_to_clear (); + + /* If we can update the display in an incremental fashion + (not from scratch), do it by telling all widgets, from + the top to the bottom, to undraw themselves if necessary. */ + if (! redraw_from_scratch) + { + e->modpopup->undraw (); + e->menubar->undraw (); + infobar->undraw (); + objinfo->undraw (); + highlight->undraw (); + e->spot->undraw (); + e->selbox->undraw (); + } + + /* If a complete refresh is required, call the clear() + method for all widgets to make them aware that they're + not visible anymore. */ + else + { + e->selbox->clear (); + e->spot->clear (); + highlight->clear (); + objinfo->clear (); + infobar->clear (); + e->menubar->clear (); + e->modpopup->clear (); + + // A piece of ad-hockery + objinfo->unset (); + + // As we said, "from scratch". + ClearScreen (); + draw_map (e); // FIXME should be widgetized + // draw_menubar (); // FIXME should be widgetized + HighlightSelection (e->obj_type, e->Selected); // FIXME should be widgetized + refresh_needed = 0; + } + + /* Tell all widgets from to bottom to the top + to draw themselves if necessary. */ + e->selbox->draw (); + e->spot->draw (); + highlight->draw (); + if (e->objinfo_shown) + objinfo->draw (); + infobar->draw (); + e->menubar->draw (); + e->modpopup->draw (); + + // Redraw the pointer if necessary. + if (refresh_needed && (FakeCursor || e->rulers_shown)) + DrawPointer (e->rulers_shown); // FIXME should be widgetized -// Refresh the physical display -update_display (); + // Refresh the physical display + update_display (); } diff -uaNr yadex-1.5.2/src/edisplay.h yadex-1.6.0/src/edisplay.h --- yadex-1.5.2/src/edisplay.h 2000-01-10 14:40:12.000000000 +0100 +++ yadex-1.6.0/src/edisplay.h 2003-02-12 17:16:08.000000000 +0100 @@ -16,7 +16,7 @@ ~edisplay_c (); void refresh (); void need_refresh (); - void highlight_object (int obj_no); + void highlight_object (Objid& obj); void forget_highlight (); private : diff -uaNr yadex-1.5.2/src/editgrid.cc yadex-1.6.0/src/editgrid.cc --- yadex-1.5.2/src/editgrid.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/editgrid.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -34,10 +34,10 @@ void edit_grid_adapt (edit_t *e) { -if (! e->grid_step_locked) - for (e->grid_step = e->grid_step_max; - e->grid_step * Scale / 2 >= grid_pixels_min; - e->grid_step /= 2) + if (! e->grid_step_locked) + for (e->grid_step = e->grid_step_max; + e->grid_step * Scale / 2 >= grid_pixels_min; + e->grid_step /= 2) ; } diff -uaNr yadex-1.5.2/src/editgrid.h yadex-1.6.0/src/editgrid.h --- yadex-1.5.2/src/editgrid.h 2000-01-10 14:40:12.000000000 +0100 +++ yadex-1.6.0/src/editgrid.h 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/editlev.cc yadex-1.6.0/src/editlev.cc --- yadex-1.5.2/src/editlev.cc 2000-05-27 14:26:04.000000000 +0200 +++ yadex-1.6.0/src/editlev.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -39,6 +39,7 @@ #include "gfx.h" #include "levels.h" #include "patchdir.h" +#include "wadfile.h" static void WriteYadexLog (const char *file, const char *level, @@ -233,7 +234,7 @@ if (Level && Level->wadfile) { const char *const file_name = - Level->wadfile ? Level->wadfile->filename : "(New level)"; + Level->wadfile ? Level->wadfile->pathname () : "(New level)"; WriteYadexLog (file_name, levelname, &t0, &t1); } } diff -uaNr yadex-1.5.2/src/editloop.cc yadex-1.6.0/src/editloop.cc --- yadex-1.5.2/src/editloop.cc 2000-08-15 03:14:25.000000000 +0200 +++ yadex-1.6.0/src/editloop.cc 2003-03-28 13:37:32.000000000 +0100 @@ -1,5 +1,4 @@ /* - * editloop.cc * The main loop of the editor. * BW & RQ sometime in 1993 or 1994. @@ -12,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -55,9 +54,12 @@ #include "menubar.h" #include "menu.h" #include "modpopup.h" +#include "objects.h" +#include "objid.h" #include "palview.h" #include "prefer.h" #include "rgbbmp.h" +#include "s_slice.h" #include "selbox.h" #include "selectn.h" #include "selpath.h" @@ -66,6 +68,7 @@ #include "t_spin.h" #include "x_centre.h" #include "x_exchng.h" +#include "x_hover.h" #include "xref.h" #ifdef Y_X11 @@ -192,6 +195,13 @@ } +// Used by the View menu +bool mode_th (micbarg_t p) { return ((edit_t *) p)->obj_type == OBJ_THINGS; } +bool mode_l (micbarg_t p) { return ((edit_t *) p)->obj_type == OBJ_LINEDEFS; } +bool mode_v (micbarg_t p) { return ((edit_t *) p)->obj_type == OBJ_VERTICES; } +bool mode_s (micbarg_t p) { return ((edit_t *) p)->obj_type == OBJ_SECTORS; } + + /* the editor main loop */ @@ -206,7 +216,8 @@ bool StretchSelBox = false; // FIXME apparently not used anymore... -int object = OBJ_NO_NONE; /* The object under the pointer */ +Objid object; // The object under the pointer +const Objid CANVAS (OBJ_NONE, OBJ_NO_CANVAS); memset (&e, 0, sizeof e); /* Catch-all */ e.move_speed = 20; @@ -214,6 +225,7 @@ // If you change this, don't forget to change // the initialisation of the menu bar below. e.obj_type = OBJ_THINGS; +e.global = false; e.tool = TOOL_NORMAL; e.grid_step = 128; e.grid_step_min = GridMin; @@ -221,16 +233,19 @@ e.grid_step_locked = 0; e.grid_shown = 1; e.grid_snap = 1; -e.infobar_shown = InfoShown; +e.infobar_shown = (bool) InfoShown; +e.objinfo_shown = true; e.show_object_numbers = false; e.show_things_squares = false; e.show_things_sprites = true; e.rulers_shown = 0; -e.click_obj_no = OBJ_NO_NONE; -e.click_obj_type = -1; +e.clicked.nil (); +//e.click_obj_no = OBJ_NO_NONE; +//e.click_obj_type = -1; e.click_ctrl = 0; -e.highlight_obj_no = OBJ_NO_NONE; -e.highlight_obj_type = -1; +e.highlighted.nil (); +//e.highlight_obj_no = OBJ_NO_NONE; +//e.highlight_obj_type = -1; e.Selected = 0; e.selbox = new selbox_c; e.edisplay = new edisplay_c (&e); @@ -247,6 +262,8 @@ OrigX = 0; OrigY = 0; +edit_zoom_init (); + if (zoom_default == 0) { zoom_fit (e); @@ -278,122 +295,127 @@ { e.menubar->compute_menubar_coords (0, 0, ScrMaxX, ScrMaxY); -e.mb_menu[MBM_FILE] = new menu_c (NULL, - "Save", 0, YK_F2, 0, - "Save as...", 5, YK_F3, 0, -// "Print", 0, -1, MEN_GRAY, - "Quit", 0, 'q', 0, +e.mb_menu[MBM_FILE] = new Menu (NULL, + "~Save", YK_F2, 0, + "Save ~as...", YK_F3, 0, +// "~Print", YK_, MIF_SACTIVE, false, 0, + "~Quit", 'q', 0, NULL); -e.mb_menu[MBM_EDIT] = new menu_c (NULL, - "Copy object(s)", 0, 'o', 0, - "Add object", 0, YK_INS, 0, - "Delete object(s)", 0, YK_DEL, 0, - "Exchange object numbers", 0, 24, 0, - "Preferences", 0, YK_F5, 0, - "Snap to grid", 0, 'y', MEN_TICK, !! e.grid_snap, - "Lock grid step", 0, 'z', MEN_TICK, !! e.grid_step_locked, +e.mb_menu[MBM_EDIT] = new Menu (NULL, + "~Copy object(s)", 'o', 0, + "~Add object", YK_INS, 0, + "~Delete object(s)", YK_DEL, 0, + "~Exchange object numbers", 24, 0, + "~Preferences...", YK_F5, 0, + "~Snap to grid", 'y', MIF_VTICK, &e.grid_snap, 0, + "~Lock grid step", 'z', MIF_VTICK, &e.grid_step_locked, 0, NULL); // If you change the order of modes here, don't forget // to modify the array. -e.mb_menu[MBM_VIEW] = new menu_c (NULL, - "Things", 0, 't', MEN_TICK, e.obj_type==OBJ_THINGS, - "Linedefs & sidedefs", 0, 'l', MEN_TICK, e.obj_type==OBJ_LINEDEFS, - "Vertices", 0, 'v', MEN_TICK, e.obj_type==OBJ_VERTICES, - "Sectors", 0, 's', MEN_TICK, e.obj_type==OBJ_SECTORS, - "Next mode", 0, YK_TAB, 0, - "Prev mode", 0, YK_BACKTAB, 0, - "Zoom in", 5, '+', 0, - "Zoom out", 5, '-', 0, - "Extra zoom", 6, ' ', MEN_TICK, !! e.extra_zoom, - "Whole level", 0, '`', 0, - "Show object numbers", -1, '&', MEN_TICK, !! e.show_object_numbers, - "Show sprites", -1, '%', MEN_TICK, !! e.show_things_sprites, - "Show grid", 5, 'h', MEN_TICK, !! e.grid_shown, -// "3D preview", 0, '3', MEN_GRAY, +e.mb_menu[MBM_VIEW] = new Menu (NULL, + "~Things", 't', MIF_FTICK, mode_th, (micbarg_t) &e, 0, + "~Linedefs & sidedefs", 'l', MIF_FTICK, mode_l, (micbarg_t) &e, 0, + "~Vertices", 'v', MIF_FTICK, mode_v, (micbarg_t) &e, 0, + "~Sectors", 's', MIF_FTICK, mode_s, (micbarg_t) &e, 0, + "Global", '\7', MIF_VTICK, &e.global, 0, + "~Next mode", YK_TAB, 0, + "~Prev mode", YK_BACKTAB, 0, + MI_SEPARATION, + "Zoom ~in", '+', 0, + "Zoom ~out", '-', 0, + "Extra ~zoom", ' ', MIF_VTICK, &e.extra_zoom, 0, + "~Whole level", '`', 0, + MI_SEPARATION, + "Show object numbers", '&', MIF_VTICK, &e.show_object_numbers, 0, + "Show sprites", '%', MIF_VTICK, &e.show_things_sprites, 0, + "Show ~grid", 'h', MIF_VTICK, &e.grid_shown, 0, + "Info bar", YK_ALT+'i', MIF_VTICK, &e.infobar_shown, 0, + "Object info boxes", 'i', MIF_VTICK, &e.objinfo_shown, 0, +// "3D preview", '3', MIF_SACTIVE, false, 0, NULL); -e.mb_menu[MBM_SEARCH] = new menu_c (NULL, -// "Find/change", 0, YK_F4, MEN_GRAY, -// "Repeat last find", 0, -1, MEN_GRAY, - "Next object", 0, 'n', 0, - "Prev object", 0, 'p', 0, - "Jump to object...", 0, 'j', 0, +e.mb_menu[MBM_SEARCH] = new Menu (NULL, +// "~Find/change", YK_F4, MIF_SACTIVE, false, 0, +// "~Repeat last find", -1, MIF_SACTIVE, false, 0, + "~Next object", 'n', 0, + "~Prev object", 'p', 0, + "~Jump to object...", 'j', 0, NULL); -e.mb_menu[MBM_MISC_L] = new menu_c ("Misc. operations", - "Find first free tag number", 16, -1, 0, - "Rotate and scale linedefs", 0, -1, 0, - "Split linedefs (add new vertex)", 23, -1, 0, - "Split linedefs and sector", 0, -1, 0, - "Delete linedefs and join sectors", 0, -1, 0, - "Flip linedefs", 0, -1, 0, - "Swap sidedefs", 1, -1, 0, - "Align textures (Y offset)", 16, -1, 0, - "Align textures (X offset)", 16, -1, 0, - "Remove 2nd sidedef (make single-sided)", 7, -1, 0, - "Make rectangular nook (32x16)", 17, -1, 0, - "Make rectangular boss (32x16)", 17, -1, 0, - "Set length (move 1st vertex)...", 4, -1, 0, - "Set length (move 2nd vertex)...", -1, -1, 0, - "Unlink 1st sidedef", 0, -1, 0, - "Unlink 2nd sidedef", -1, -1, 0, - "Mirror horizontally", 0, -1, 0, - "Mirror vertically", 0, -1, 0, +e.mb_menu[MBM_MISC_L] = new Menu ("Misc. operations", + "Find first free ~tag number", YK_, 0, + "~Rotate and scale linedefs...", YK_, 0, + "Split linedefs (add new ~vertex)", YK_, 0, + "~Split linedefs and sector", YK_, 0, + "~Delete linedefs and join sectors", YK_, 0, + "~Flip linedefs", YK_, 0, + "S~wap sidedefs", YK_, 0, + "Align textures (~Y offset)", YK_, 0, + "Align textures (~X offset)...", YK_, 0, + "Remove ~2nd sidedef (make single-sided)", YK_, 0, + "Make rectangular ~nook (32x16)", YK_, 0, + "Make rectangular ~boss (32x16)", YK_, 0, + "Set ~length (move 1st vertex)...", YK_, 0, + "Set length (move 2nd vertex)...", YK_, 0, + "~Unlink 1st sidedef", YK_, 0, + "Unlink 2nd sidedef", YK_, 0, + "~Mirror horizontally", YK_, 0, + "Mirror v~ertically", YK_, 0, + "~Cut a slice out of a sector", YK_, 0, NULL); -e.mb_menu[MBM_MISC_S] = new menu_c ("Misc. operations", - "Find first free tag number", 16, -1, 0, - "Rotate and scale sectors", 0, -1, 0, - "Make door from sector", 5, -1, 0, - "Make lift from sector", 5, -1, 0, - "Distribute sector floor heights", 18, -1, 0, - "Distribute sector ceiling heights", 18, -1, 0, - "Raise or lower sectors...", 9, -1, 0, - "Brighten or darken sectors...", 0, -1, 0, - "Unlink room", 0, -1, 0, - "Mirror horizontally", 0, -1, 0, - "Mirror vertically", 0, -1, 0, - "Swap flats", 0, -1, 0, +e.mb_menu[MBM_MISC_S] = new Menu ("Misc. operations", + "Find first free ~tag number", YK_, 0, + "~Rotate and scale sectors...", YK_, 0, + "Make ~door from sector", YK_, 0, + "Make ~lift from sector", YK_, 0, + "Distribute sector ~floor heights", YK_, 0, + "Distribute sector ~ceiling heights",YK_, 0, + "R~aise or lower sectors...", YK_, 0, + "~Brighten or darken sectors...", YK_, 0, + "~Unlink room", YK_, 0, + "~Mirror horizontally", YK_, 0, + "Mirror ~vertically", YK_, 0, + "~Swap flats", YK_, 0, NULL); -e.mb_menu[MBM_MISC_T] = new menu_c ("Misc. operations", - "Find first free tag number", 16, -1, 0, - "Rotate and scale things", 0, -1, 0, - "Spin things 45° clockwise", 0, 'x', 0, - "Spin things 45° counter-clockwise", 16, 'w', 0, - "Mirror horizontally", 0, -1, 0, - "Mirror vertically", 0, -1, 0, +e.mb_menu[MBM_MISC_T] = new Menu ("Misc. operations", + "Find first free ~tag number", YK_, 0, + "~Rotate and scale things...", YK_, 0, + "~Spin things 45° clockwise", 'x', 0, + "Spin things 45° ~counter-clockwise", 'w', 0, + "~Mirror horizontally", YK_, 0, + "Mirror ~vertically", YK_, 0, NULL); -e.mb_menu[MBM_MISC_V] = new menu_c ("Misc. operations", - "Find first free tag number", 16, -1, 0, - "Rotate and scale vertices", 0, -1, 0, - "Delete vertex and join linedefs", 0, -1, 0, - "Merge several vertices into one", 0, -1, 0, - "Add a linedef and split sector", 18, -1, 0, - "Mirror horizontally", 0, -1, 0, - "Mirror vertically", 0, -1, 0, +e.mb_menu[MBM_MISC_V] = new Menu ("Misc. operations", + "Find first free ~tag number", YK_, 0, + "~Rotate and scale vertices...", YK_, 0, + "~Delete vertex and join linedefs", YK_, 0, + "~Merge several vertices into one", YK_, 0, + "Add a linedef and ~split sector", YK_, 0, + "Mirror ~horizontally", YK_, 0, + "Mirror ~vertically", YK_, 0, NULL); -e.mb_menu[MBM_OBJECTS] = new menu_c ("Insert a pre-defined object", - "Rectangle", 0, -1, 0, - "Polygon (N sides)", 0, -1, 0, +e.mb_menu[MBM_OBJECTS] = new Menu ("Insert a pre-defined object", + "~Rectangle...", YK_, 0, + "~Polygon (N sides)...", YK_, 0, NULL); -e.mb_menu[MBM_CHECK] = new menu_c ("Check level consistency", - "Number of objects", 0, -1, 0, - "Check if all sectors are closed", 13, -1, 0, - "Check all cross-references", 10, -1, 0, - "Check for missing textures", 10, -1, 0, - "Check texture names", 6, -1, 0, +e.mb_menu[MBM_CHECK] = new Menu ("Check level consistency", + "~Number of objects", YK_, 0, + "Check if all ~sectors are closed", YK_, 0, + "Check all ~cross-references", YK_, 0, + "Check for ~missing textures", YK_, 0, + "Check ~texture names", YK_, 0, NULL); -e.mb_menu[MBM_HELP] = new menu_c (NULL, - "Keyboard & mouse...", 0, YK_F1, 0, - "Info bar", 0, 'i', MEN_TICK, e.infobar_shown, - "About Yadex...", 0, YK_ALT + 'a', 0, +e.mb_menu[MBM_HELP] = new Menu (NULL, + "~Keyboard & mouse...", YK_F1, 0, + "~About Yadex...", YK_ALT + 'a', 0, NULL); e.mb_ino[MBI_FILE] = @@ -418,42 +440,42 @@ // FIXME this should come from the .ygd // instead of being hard-coded. -menu_c *menu_linedef_flags = new menu_c (NULL, - "Impassable", 0, -1, 0, - "Monsters cannot cross", 0, -1, 0, - "Double-sided", 0, -1, 0, - "Upper texture unpegged", 0, -1, 0, - "Lower texture unpegged", 0, -1, 0, - "Secret (shown as normal)", 0, -1, 0, - "Blocks sound", 0, -1, 0, - "Never shown on the map", 0, -1, 0, - "Always shown on the map", 0, -1, 0, - "Pass through [Boom]", 0, -1, 0, // Boom extension - "b10 0400h", 2, -1, 0, // Undefined - "b11 0800h", 2, -1, 0, // Undefined - "Translucent [Strife]", 0, -1, 0, // Strife - "b13 2000h", 2, -1, 0, // Undefined - "b14 4000h", 2, -1, 0, // Undefined - "b15 8000h", 2, -1, 0, // Undefined +Menu *menu_linedef_flags = new Menu (NULL, + "~Impassable", YK_, 0, + "~Monsters cannot cross", YK_, 0, + "~Double-sided", YK_, 0, + "~Upper texture unpegged", YK_, 0, + "~Lower texture unpegged", YK_, 0, + "~Secret (shown as normal)", YK_, 0, + "~Blocks sound", YK_, 0, + "~Never shown on the map", YK_, 0, + "~Always shown on the map", YK_, 0, + "~Pass through [Boom]", YK_, 0, // Boom extension + "b1~0 0400h", YK_, 0, // Undefined + "b1~1 0800h", YK_, 0, // Undefined + "~Translucent [Strife]", YK_, 0, // Strife + "b1~3 2000h", YK_, 0, // Undefined + "b1~4 4000h", YK_, 0, // Undefined + "b1~5 8000h", YK_, 0, // Undefined NULL); -menu_c *menu_thing_flags = new menu_c (NULL, - "Easy", 0, -1, 0, - "Medium", 4, -1, 0, - "Hard", 0, -1, 0, - "Deaf", 0, -1, 0, - "Multiplayer", 0, -1, 0, - "Not in DM [Boom]", 0, -1, 0, // Boom extension - "Not in coop [Boom]", 7, -1, 0, // Boom extension - "Friendly [MBF]", 1, -1, 0, // MBF extension - "b8 0100h", 1, -1, 0, // Undefined - "b9 0200h", 1, -1, 0, // Undefined - "b10 0400h", 2, -1, 0, // Undefined - "b11 0800h", 2, -1, 0, // Undefined - "b12 1000h", 2, -1, 0, // Undefined - "b13 2000h", 2, -1, 0, // Undefined - "b14 4000h", 2, -1, 0, // Undefined - "b15 8000h", 2, -1, 0, // Undefined +Menu *menu_thing_flags = new Menu (NULL, + "~Easy", YK_, 0, + "Medi~um", YK_, 0, + "~Hard", YK_, 0, + "~Deaf", YK_, 0, + "~Multiplayer", YK_, 0, + "~Not in DM [Boom]", YK_, 0, // Boom extension + "Not in ~coop [Boom]", YK_, 0, // Boom extension + "F~riendly [MBF]", YK_, 0, // MBF extension + "b~8 0100h", YK_, 0, // Undefined + "b~9 0200h", YK_, 0, // Undefined + "b1~0 0400h", YK_, 0, // Undefined + "b1~1 0800h", YK_, 0, // Undefined + "b1~2 1000h", YK_, 0, // Undefined + "b1~3 2000h", YK_, 0, // Undefined + "b1~4 4000h", YK_, 0, // Undefined + "b1~5 8000h", YK_, 0, // Undefined NULL); /* AYM 1998-06-22 @@ -481,10 +503,10 @@ if (! has_event () && ! has_input_event ()) { #endif - if (is_obj (e.highlight_obj_no)) // FIXME - e.edisplay->highlight_object (e.highlight_obj_no); // Should - else // be in - e.edisplay->forget_highlight (); // edisplay_c ! + if (e.highlighted ()) // FIXME + e.edisplay->highlight_object (e.highlighted); // Should + else // be in + e.edisplay->forget_highlight (); // edisplay_c ! if (is.in_window) e.spot->set (edit_mapx_snapped (&e, e.pointer_x), @@ -521,7 +543,8 @@ e.pointer_x = MAPX (is.x); e.pointer_y = MAPY (is.y); - object = GetCurObject (e.obj_type, e.pointer_x, e.pointer_y, 20); + obj_type_t t = e.global ? OBJ_ANY : e.obj_type; + GetCurObject (object, t, e.pointer_x, e.pointer_y); } /* @@ -537,7 +560,7 @@ if (e.menubar->pulled_down () >= 0) { int menu_no = e.menubar->pulled_down (); - menu_c *menu = e.menubar->get_menu (menu_no); + Menu *menu = e.menubar->get_menu (menu_no); int r = menu->process_event (&is); if (r == MEN_CANCEL) @@ -568,13 +591,13 @@ MiscOperations (e.obj_type, &e.Selected, r + 1); else { - if (is_obj (e.highlight_obj_no)) - SelectObject (&e.Selected, e.highlight_obj_no); + if (e.highlighted ()) + SelectObject (&e.Selected, e.highlighted.num); MiscOperations (e.obj_type, &e.Selected, r + 1); - if (is_obj (e.highlight_obj_no)) - UnSelectObject (&e.Selected, e.highlight_obj_no); + if (e.highlighted ()) + UnSelectObject (&e.Selected, e.highlighted.num); } - e.highlight_obj_no = OBJ_NO_NONE; + e.highlighted.nil (); DragObject = false; StretchSelBox = false; RedrawMap = 1; @@ -590,7 +613,7 @@ e.obj_type = OBJ_LINEDEFS; for (int i = savednum; i < NumLineDefs; i++) SelectObject (&e.Selected, i); - e.highlight_obj_no = OBJ_NO_NONE; + e.highlighted.nil (); DragObject = false; StretchSelBox = false; } @@ -653,13 +676,13 @@ MiscOperations (e.obj_type, &e.Selected, r + 1); else { - if (is_obj (e.highlight_obj_no)) - SelectObject (&e.Selected, e.highlight_obj_no); + if (e.highlighted ()) + SelectObject (&e.Selected, e.highlighted.num); MiscOperations (e.obj_type, &e.Selected, r + 1); - if (is_obj (e.highlight_obj_no)) - UnSelectObject (&e.Selected, e.highlight_obj_no); + if (e.highlighted ()) + UnSelectObject (&e.Selected, e.highlighted.num); } - e.highlight_obj_no = OBJ_NO_NONE; + e.highlighted.nil (); DragObject = false; StretchSelBox = false; goto done2; @@ -705,7 +728,7 @@ e.obj_type = OBJ_LINEDEFS; for (int i = savednum; i < NumLineDefs; i++) SelectObject (&e.Selected, i); - e.highlight_obj_no = OBJ_NO_NONE; + e.highlighted.nil (); DragObject = false; StretchSelBox = false; } @@ -754,9 +777,9 @@ fatal_error ("modal=%02X", e.modal); if (! e.Selected) { - SelectObject (&e.Selected, e.highlight_obj_no); + SelectObject (&e.Selected, e.highlighted.num); frob_linedefs_flags (e.Selected, op, r); - UnSelectObject (&e.Selected, e.highlight_obj_no); + UnSelectObject (&e.Selected, e.highlighted.num); } else { @@ -807,9 +830,9 @@ fatal_error ("modal=%02X", e.modal); if (! e.Selected) { - SelectObject (&e.Selected, e.highlight_obj_no); + SelectObject (&e.Selected, e.highlighted.num); frob_things_flags (e.Selected, op, r); - UnSelectObject (&e.Selected, e.highlight_obj_no); + UnSelectObject (&e.Selected, e.highlighted.num); } else { @@ -859,7 +882,7 @@ { int itemno; - e.click_obj_no = OBJ_NO_NONE; + e.clicked.nil (); itemno = e.menubar->is_on_menubar_item (is.x, is.y); if (itemno >= 0) e.menubar->pull_down (itemno); @@ -872,11 +895,11 @@ Unless [Ctrl] is pressed, it also clears the current selection. */ else if (is.key == YE_BUTL_PRESS && e.tool == TOOL_NORMAL - && ! is_obj (object)) + && object.is_nil ()) { e.menubar->highlight (-1); // Close any open menu - e.click_obj_no = OBJ_NO_CANVAS; - e.click_ctrl = is.ctrl; + e.clicked = CANVAS; + e.click_ctrl = is.ctrl; if (! is.ctrl) { ForgetSelection (&e.Selected); @@ -892,24 +915,23 @@ the user is about to drag it. */ else if (is.key == YE_BUTL_PRESS && ! is.ctrl && e.tool == TOOL_NORMAL - && ! IsSelected (e.Selected, object)) + && ! IsSelected (e.Selected, object.num)) { e.menubar->highlight (-1); // Close any open menu - e.click_obj_no = object; - e.click_obj_type = e.obj_type; + e.clicked = object; e.click_ctrl = 0; e.click_time = is.time; ForgetSelection (&e.Selected); - SelectObject (&e.Selected, object); + SelectObject (&e.Selected, object.num); /* I don't like having to do that */ - if (e.obj_type == OBJ_THINGS && is_obj (object)) - MoveObjectsToCoords (e.obj_type, 0, - Things[object].xpos, Things[object].ypos, 0); - else if (e.obj_type == OBJ_VERTICES && is_obj (object)) - MoveObjectsToCoords (e.obj_type, 0, - Vertices[object].x, Vertices[object].y, 0); + if (object.type == OBJ_THINGS && object ()) + MoveObjectsToCoords (object.type, 0, + Things[object.num].xpos, Things[object.num].ypos, 0); + else if (object.type == OBJ_VERTICES && object ()) + MoveObjectsToCoords (object.type, 0, + Vertices[object.num].x, Vertices[object.num].y, 0); else - MoveObjectsToCoords (e.obj_type, 0, + MoveObjectsToCoords (object.type, 0, e.pointer_x, e.pointer_y, e.grid_snap ? e.grid_step : 0); RedrawMap = 1; } @@ -917,14 +939,13 @@ /* Second click of a double click on an object */ else if (is.key == YE_BUTL_PRESS && ! is.ctrl && e.tool == TOOL_NORMAL - && IsSelected (e.Selected, object) - && object == e.click_obj_no - && e.obj_type == e.click_obj_type + && IsSelected (e.Selected, object.num) + && object == e.clicked && is.time - e.click_time <= (unsigned long) double_click_timeout) { // Very important! If you don't do that, the release of the // click that closed the properties menu will drag the object. - e.click_obj_no = OBJ_NO_NONE; + e.clicked.nil (); send_event (YK_RETURN); goto done; } @@ -933,22 +954,21 @@ the user might want to drag the selection. */ else if (is.key == YE_BUTL_PRESS && ! is.ctrl && e.tool == TOOL_NORMAL - && IsSelected (e.Selected, object)) + && IsSelected (e.Selected, object.num)) { e.menubar->highlight (-1); // Close any open menu - e.click_obj_no = object; - e.click_obj_type = e.obj_type; + e.clicked = object; e.click_ctrl = 0; e.click_time = is.time; /* I don't like having to do that */ - if (e.obj_type == OBJ_THINGS && is_obj (object)) - MoveObjectsToCoords (e.obj_type, 0, - Things[object].xpos, Things[object].ypos, 0); - else if (e.obj_type == OBJ_VERTICES && is_obj (object)) - MoveObjectsToCoords (e.obj_type, 0, - Vertices[object].x, Vertices[object].y, 0); + if (object.type == OBJ_THINGS && object ()) + MoveObjectsToCoords (object.type, 0, + Things[object.num].xpos, Things[object.num].ypos, 0); + else if (object.type == OBJ_VERTICES && object ()) + MoveObjectsToCoords (object.type, 0, + Vertices[object.num].x, Vertices[object.num].y, 0); else - MoveObjectsToCoords (e.obj_type, 0, + MoveObjectsToCoords (object.type, 0, e.pointer_x, e.pointer_y, e.grid_snap ? e.grid_step : 0); } @@ -956,16 +976,15 @@ Clicking on unselected object with [Ctrl] pressed selects it. */ else if (is.key == YE_BUTL_PRESS && is.ctrl && e.tool == TOOL_NORMAL - && is_obj (object)) + && object ()) { e.menubar->highlight (-1); // Close any open menu - e.click_obj_no = object; - e.click_obj_type = e.obj_type; + e.clicked = object; e.click_ctrl = 1; - if (IsSelected (e.Selected, object)) - UnSelectObject (&e.Selected, object); + if (IsSelected (e.Selected, object.num)) + UnSelectObject (&e.Selected, object.num); else - SelectObject (&e.Selected, object); + SelectObject (&e.Selected, object.num); RedrawMap = 1; } @@ -973,13 +992,13 @@ else if (is.key == YE_BUTL_PRESS && e.tool == TOOL_SNAP_VERTEX && e.obj_type == OBJ_VERTICES - && is_obj (object) + && object () // Can't delete vertex that is referenced by the selection - && ! IsSelected (e.Selected, object)) + && ! IsSelected (e.Selected, object.num)) { - printf ("SNAP %d\n", (int) object); + printf ("SNAP %d\n", (int) object.num); SelPtr list = 0; - SelectObject (&list, object); + SelectObject (&list, object.num); DeleteVerticesJoinLineDefs (list); ForgetSelection (&list); RedrawMap = 1; @@ -994,7 +1013,7 @@ // FIXME : should call this automatically when switching tool else if (is.key == YE_BUTL_RELEASE && e.tool == TOOL_NORMAL - && e.click_obj_no == OBJ_NO_CANVAS) + && e.clicked == CANVAS) { int x1, y1, x2, y2; e.selbox->get_corners (&x1, &y1, &x2, &y2); @@ -1007,7 +1026,7 @@ // FIXME : should call this automatically when switching tool else if (is.key == YE_BUTL_RELEASE && e.tool == TOOL_NORMAL - && is_obj (e.click_obj_no)) + && e.clicked ()) { if (AutoMergeVertices (&e.Selected, e.obj_type, 'm')) RedrawMap = 1; @@ -1019,7 +1038,7 @@ else if (is.key == YE_MOTION && e.tool == TOOL_NORMAL && is.butl - && e.click_obj_no == OBJ_NO_NONE) + && ! e.clicked () && ! (e.clicked == CANVAS)) { int itemno = e.menubar->is_on_menubar_item (is.x, is.y); if (itemno >= 0) @@ -1032,7 +1051,7 @@ corner of the selection box. */ else if ((is.key == YE_MOTION || motion) && e.tool == TOOL_NORMAL - && is.butl && e.click_obj_no == OBJ_NO_CANVAS) + && is.butl && e.clicked == CANVAS) { e.selbox->set_2nd_corner (e.pointer_x, e.pointer_y); } @@ -1044,19 +1063,19 @@ else if ((is.key == YE_MOTION || motion) && e.tool == TOOL_NORMAL && is.butl - && is_obj (e.click_obj_no) + && e.clicked () && ! e.click_ctrl) { if (! e.Selected) { - SelectObject (&e.Selected, e.click_obj_no); - if (MoveObjectsToCoords (e.obj_type, e.Selected, + SelectObject (&e.Selected, e.clicked.num); + if (MoveObjectsToCoords (e.clicked.type, e.Selected, e.pointer_x, e.pointer_y, e.grid_snap ? e.grid_step : 0)) RedrawMap = 1; ForgetSelection (&e.Selected); } else - if (MoveObjectsToCoords (e.obj_type, e.Selected, + if (MoveObjectsToCoords (e.clicked.type, e.Selected, e.pointer_x, e.pointer_y, e.grid_snap ? e.grid_step : 0)) RedrawMap = 1; } @@ -1065,8 +1084,7 @@ if (is.in_window && ! is.butl && ! is.shift) { /* Check if there is something near the pointer */ - e.highlight_obj_no = object; - e.highlight_obj_type = e.obj_type; + e.highlighted = object; } /* @@ -1206,6 +1224,9 @@ if (! outfile) goto cancel_save; SaveLevelData (outfile, newlevelname); + levelname = newlevelname; + // Sigh. Shouldn't have to do that. Level must die ! + Level = FindMasterDir (MasterDir, levelname); cancel_save: RedrawMap = 1; } @@ -1229,23 +1250,26 @@ // Horrible indeed -- AYM 1999-07-30 newLevel = FindMasterDir (MasterDir, newlevelname); if (! newLevel) - nf_bug ("newLevel is NULL"); - oldl = Level; - newl = newLevel; - for (int m = 0; m < 11; m++) + nf_bug ("newLevel is NULL"); // Debatable ! -- AYM 2001-05-29 + if (Level) // If new level ("create" command), Level is NULL { - newl->wadfile = oldl->wadfile; - if (m > 0) - newl->dir = oldl->dir; - /* - if (!fncmp (outfile, oldl->wadfile->filename)) + oldl = Level; + newl = newLevel; + for (int m = 0; m < 11; m++) { - oldl->wadfile = WadFileList; - oldl->dir = lost... + newl->wadfile = oldl->wadfile; + if (m > 0) + newl->dir = oldl->dir; + /* + if (!fncmp (outfile, oldl->wadfile->filename)) + { + oldl->wadfile = WadFileList; + oldl->dir = lost... + } + */ + oldl = oldl->next; + newl = newl->next; } - */ - oldl = oldl->next; - newl = newl->next; } Level = newLevel; } @@ -1269,7 +1293,7 @@ // [a]: pop up the "Set flag" menu else if (is.key == 'a' && e.menubar->highlighted () < 0 - && (e.Selected || is_obj (e.highlight_obj_no))) + && (e.Selected || e.highlighted ())) { e.modal = 's'; // Set if (e.obj_type == OBJ_LINEDEFS) @@ -1287,7 +1311,7 @@ // [b]: pop up the "Toggle flag" menu else if (is.key == 'b' && e.menubar->highlighted () < 0 - && (e.Selected || is_obj (e.highlight_obj_no))) + && (e.Selected || e.highlighted ())) { e.modal = 't'; // Toggle if (e.obj_type == OBJ_LINEDEFS) @@ -1305,7 +1329,7 @@ // [c]: pop up the "Clear flag" menu else if (is.key == 'c' && e.menubar->highlighted () < 0 - && (e.Selected || is_obj (e.highlight_obj_no))) + && (e.Selected || e.highlighted ())) { e.modal = 'c'; // Clear; if (e.obj_type == OBJ_LINEDEFS) @@ -1342,15 +1366,20 @@ RedrawMap = 1; } - // [i]: show/hide the info bar - else if (is.key == 'i') + // [Alt][i]: show/hide the info bar + else if (is.key == YK_ALT + 'i') { e.infobar_shown = !e.infobar_shown; - // In the "Help" menu tick/untick the "Info bar" item. - e.mb_menu[MBM_HELP]->set_ticked (1, e.infobar_shown); RedrawMap = 1; } + // [i]: show/hide the object info boxes + else if (is.key == 'i') + { + e.objinfo_shown = !e.objinfo_shown; + RedrawMap = 1; + } + // [+], [=], wheel: zooming in else if (is.key == '+' || is.key == '=' || is.key == YE_WHEEL_UP) { @@ -1367,10 +1396,10 @@ RedrawMap = 1; } - // [0], [1], ... [9]: set the zoom factor + // [1] - [9], [0]: set the zoom factor else if (is.key >= '0' && is.key <= '9') { - int r = edit_set_zoom (&e, is.key == '0' ? 0.1 : 1.0 / dectoi(is.key)); + int r = edit_set_zoom (&e, digit_zoom_factors[dectoi(is.key)]); if (r == 0) RedrawMap = 1; } @@ -1494,8 +1523,6 @@ { e.extra_zoom = ! e.extra_zoom; edit_set_zoom (&e, Scale * (e.extra_zoom ? 4 : 0.25)); - // In the "View" menu, tick/untick the "Extra zoom" item - e.mb_menu[MBM_VIEW]->set_ticked (8, e.extra_zoom); RedrawMap = 1; } @@ -1535,11 +1562,6 @@ // Set the object type according to the new mode. e.obj_type = modes[new_mode].obj_type; - // In the "View" menu, untick the old mode - // and tick the new mode. - e.mb_menu[MBM_VIEW]->set_ticked (modes[old_mode].item_no, 0); - e.mb_menu[MBM_VIEW]->set_ticked (modes[new_mode].item_no, 1); - // Change the flavour of the "Misc" menu. e.menubar->set_menu (e.mb_ino[MBI_MISC], e.mb_menu[modes[new_mode].menu_no]); @@ -1626,52 +1648,77 @@ else ForgetSelection (&e.Selected); } - if (GetMaxObjectNum (e.obj_type) >= 0 && Select0) - e.highlight_obj_no = 0; + if (GetMaxObjectNum (e.obj_type) >= 0 && Select0 && ! e.global) + { + e.highlighted.type = e.obj_type; + e.highlighted.num = 0; + } else - e.highlight_obj_no = OBJ_NO_NONE; - e.highlight_obj_type = e.obj_type; + e.highlighted.nil (); DragObject = false; StretchSelBox = false; RedrawMap = 1; } + // [Ctrl][g]: toggle global mode + else if (is.key == '\7') + { + static bool dont_warn = false; + bool ok = false; + if (e.global) + ok = true; // No confirmation needed to switch off + else if (dont_warn) + ok = true; + else + { + ok = Confirm (-1, -1, + "Global mode is experimental and probably highly", + "unstable. This means crashes. Are you sure ?"); + RedrawMap = 1; + if (ok) + { + dont_warn = true; // User is sure. Won't ask again + Notify (-1, -1, + "Selection does not work in global mode. Don't", + "bother reporting it, I'm aware of it already."); + } + } + if (ok) + { + ForgetSelection (&e.Selected); + e.global = ! e.global; + RedrawMap = 1; + } + } + // [e]: Select/unselect all linedefs in non-forked path - else if (is.key == 'e' - && e.highlight_obj_type == OBJ_LINEDEFS - && e.highlight_obj_no != OBJ_NO_NONE) + else if (is.key == 'e' && e.highlighted._is_linedef ()) { ForgetSelection (&e.Selected); - select_linedefs_path (&e.Selected, e.highlight_obj_no, YS_ADD); + select_linedefs_path (&e.Selected, e.highlighted.num, YS_ADD); RedrawMap = 1; } // [Ctrl][e] Select/unselect all linedefs in path - else if (is.key == '\5' && ! is.shift - && e.highlight_obj_type == OBJ_LINEDEFS - && e.highlight_obj_no != OBJ_NO_NONE) + else if (is.key == '\5' && ! is.shift && e.highlighted._is_linedef ()) { - select_linedefs_path (&e.Selected, e.highlight_obj_no, YS_TOGGLE); + select_linedefs_path (&e.Selected, e.highlighted.num, YS_TOGGLE); RedrawMap = 1; } // [E]: Select/unselect all 1s linedefs in path - else if (is.key == 'E' - && e.highlight_obj_type == OBJ_LINEDEFS - && e.highlight_obj_no != OBJ_NO_NONE) + else if (is.key == 'E' && e.highlighted._is_linedef ()) { ForgetSelection (&e.Selected); - select_1s_linedefs_path (&e.Selected, e.highlight_obj_no, YS_ADD); + select_1s_linedefs_path (&e.Selected, e.highlighted.num, YS_ADD); RedrawMap = 1; } // [Ctrl][Shift][e]: Select/unselect all 1s linedefs in path - else if (is.key == '\5' && is.shift - && e.highlight_obj_type == OBJ_LINEDEFS - && e.highlight_obj_no != OBJ_NO_NONE) + else if (is.key == '\5' && is.shift && e.highlighted._is_linedef ()) { - select_1s_linedefs_path (&e.Selected, e.highlight_obj_no, YS_TOGGLE); + select_1s_linedefs_path (&e.Selected, e.highlighted.num, YS_TOGGLE); RedrawMap = 1; } @@ -1699,7 +1746,6 @@ else if (is.key == 'h') { e.grid_shown = ! e.grid_shown; - e.mb_menu[MBM_VIEW]->set_ticked (11, e.grid_shown); RedrawMap = 1; } @@ -1714,14 +1760,12 @@ else if (is.key == 'y') { e.grid_snap = ! e.grid_snap; - e.mb_menu[MBM_EDIT]->set_ticked (5, e.grid_snap); } // [z]: toggle the lock_grip_step flag else if (is.key == 'z') { e.grid_step_locked = ! e.grid_step_locked; - e.mb_menu[MBM_EDIT]->set_ticked (6, e.grid_step_locked); } // [r]: toggle the rulers @@ -1729,40 +1773,64 @@ e.rulers_shown = !e.rulers_shown; // [n], [>]: highlight the next object - else if (is.key == 'n' || is.key == '>') + else if ((is.key == 'n' || is.key == '>') + && (! e.global || e.highlighted ())) { - obj_no_t nmax = GetMaxObjectNum (e.obj_type); + obj_type_t t = e.highlighted () ? e.highlighted.type : e.obj_type; + obj_no_t nmax = GetMaxObjectNum (t); if (is_obj (nmax)) { - e.highlight_obj_no++; - if (e.highlight_obj_no > nmax) - e.highlight_obj_no = 0; - GoToObject (e.obj_type, e.highlight_obj_no); + if (e.highlighted.is_nil ()) + { + e.highlighted.type = t; + e.highlighted.num = 0; + } + else + { + e.highlighted.num++; + if (e.highlighted.num > nmax) + e.highlighted.num = 0; + } + GoToObject (e.highlighted); RedrawMap = 1; } } // [p], [<]: highlight the previous object - else if (is.key == 'p' || is.key == '<') + else if ((is.key == 'p' || is.key == '<') + && (! e.global || e.highlighted ())) { - obj_no_t nmax = GetMaxObjectNum (e.obj_type); + obj_type_t t = e.highlighted () ? e.highlighted.type : e.obj_type; + obj_no_t nmax = GetMaxObjectNum (t); if (is_obj (nmax)) { - e.highlight_obj_no--; - if (e.highlight_obj_no < 0) - e.highlight_obj_no = nmax; - GoToObject (e.obj_type, e.highlight_obj_no); + if (e.highlighted.is_nil ()) + { + e.highlighted.type = t; + e.highlighted.num = nmax; + } + else + { + e.highlighted.num--; + if (e.highlighted.num < 0) + e.highlighted.num = nmax; + } + GoToObject (e.highlighted); RedrawMap = 1; } } // [j], [#]: jump to object by number - else if (is.key == 'j' || is.key == '#') + else if ((is.key == 'j' || is.key == '#') + && (! e.global || e.highlighted ())) { - e.highlight_obj_no = InputObjectNumber (-1, -1, e.obj_type, - e.highlight_obj_no); - if (is_obj (e.highlight_obj_no)) - GoToObject (e.obj_type, e.highlight_obj_no); + Objid default_obj; + default_obj.type = e.highlighted () ? e.highlighted.type : e.obj_type; + default_obj.num = e.highlighted () ? e.highlighted.num : 0; + Objid target_obj; + input_objid (target_obj, default_obj, -1, -1); + if (target_obj ()) + GoToObject (target_obj); RedrawMap = 1; } @@ -1779,13 +1847,13 @@ // [o]: copy a group of objects else if (is.key == 'o' - && (e.Selected || is_obj (e.highlight_obj_no))) + && (e.Selected || e.highlighted ())) { int x, y; /* copy the object(s) */ if (! e.Selected) - SelectObject (&e.Selected, e.highlight_obj_no); + SelectObject (&e.Selected, e.highlighted.num); CopyObjects (e.obj_type, e.Selected); /* enter drag mode */ //DragObject = true; @@ -1793,8 +1861,8 @@ //e.highlight_obj_no = e.Selected->objnum; // Find the "hotspot" in the object(s) - if (is_obj (e.highlight_obj_no) && ! e.Selected) - GetObjectCoords (e.highlight_obj_type, e.highlight_obj_no, &x, &y); + if (e.highlighted () && ! e.Selected) + GetObjectCoords (e.highlighted.type, e.highlighted.num, &x, &y); else centre_of_objects (e.obj_type, e.Selected, &x, &y); @@ -1808,15 +1876,15 @@ // [Return]: edit the properties of the current object. else if (is.key == YK_RETURN - && (e.Selected || is_obj (e.highlight_obj_no))) + && (e.Selected || e.highlighted ())) { if (e.Selected) EditObjectsInfo (0, menubar_out_y1 + 1, e.obj_type, e.Selected); else { - SelectObject (&e.Selected, e.highlight_obj_no); - EditObjectsInfo (0, menubar_out_y1 + 1, e.obj_type, e.Selected); - UnSelectObject (&e.Selected, e.highlight_obj_no); + SelectObject (&e.Selected, e.highlighted.num); + EditObjectsInfo (0, menubar_out_y1 + 1, e.highlighted.type, e.Selected); + UnSelectObject (&e.Selected, e.highlighted.num); } RedrawMap = 1; DragObject = false; @@ -1825,13 +1893,13 @@ // [w]: spin things 1/8 turn counter-clockwise else if (is.key == 'w' && e.obj_type == OBJ_THINGS - && (e.Selected || is_obj (e.highlight_obj_no))) + && (e.Selected || e.highlighted ())) { if (! e.Selected) { - SelectObject (&e.Selected, e.highlight_obj_no); + SelectObject (&e.Selected, e.highlighted.num); spin_things (e.Selected, 45); - UnSelectObject (&e.Selected, e.highlight_obj_no); + UnSelectObject (&e.Selected, e.highlighted.num); } else { @@ -1855,13 +1923,13 @@ // [x]: spin things 1/8 turn clockwise else if (is.key == 'x' && e.obj_type == OBJ_THINGS - && (e.Selected || is_obj (e.highlight_obj_no))) + && (e.Selected || e.highlighted ())) { if (! e.Selected) { - SelectObject (&e.Selected, e.highlight_obj_no); + SelectObject (&e.Selected, e.highlighted.num); spin_things (e.Selected, -45); - UnSelectObject (&e.Selected, e.highlight_obj_no); + UnSelectObject (&e.Selected, e.highlighted.num); } else { @@ -1874,13 +1942,13 @@ // [x]: split linedefs else if (is.key == 'x' && e.obj_type == OBJ_LINEDEFS - && (e.Selected || is_obj (e.highlight_obj_no))) + && (e.Selected || e.highlighted ())) { if (! e.Selected) { - SelectObject (&e.Selected, e.highlight_obj_no); + SelectObject (&e.Selected, e.highlighted.num); SplitLineDefs (e.Selected); - UnSelectObject (&e.Selected, e.highlight_obj_no); + UnSelectObject (&e.Selected, e.highlighted.num); } else SplitLineDefs (e.Selected); @@ -1907,9 +1975,20 @@ } } + // [Ctrl][k]: cut a slice out of a sector + else if (is.key == 11 && e.obj_type == OBJ_LINEDEFS + && e.Selected && e.Selected->next && ! e.Selected->next->next) + { + sector_slice (e.Selected->next->objnum, e.Selected->objnum); + ForgetSelection (&e.Selected); + RedrawMap = 1; + DragObject = false; + StretchSelBox = false; + } + // [Del]: delete the current object else if (is.key == YK_DEL - && (e.Selected || e.highlight_obj_no >= 0)) /* 'Del' */ + && (e.Selected || e.highlighted ())) /* 'Del' */ { if (e.obj_type == OBJ_THINGS || Expert @@ -1924,19 +2003,19 @@ if (e.Selected) DeleteObjects (e.obj_type, &e.Selected); else - DeleteObject (e.obj_type, e.highlight_obj_no); + DeleteObject (e.highlighted); } // AYM 1998-09-20 I thought I'd add this // (though it doesn't fix the problem : if the object has been // deleted, HighlightObject is still called with a bad object#). - e.highlight_obj_no = OBJ_NO_NONE; + e.highlighted.nil (); DragObject = false; StretchSelBox = false; RedrawMap = 1; } // [Ins]: insert a new object - else if (is.key == YK_INS) /* 'Ins' */ + else if (is.key == YK_INS || is.key == YK_INS + YK_SHIFT) /* 'Ins' */ { SelPtr cur; int prev_obj_type = e.obj_type; @@ -1970,32 +2049,35 @@ else { InsertObject (OBJ_LINEDEFS, -1, 0, 0); - e.highlight_obj_no = NumLineDefs - 1; - LineDefs[e.highlight_obj_no].start = cur->next->objnum; - LineDefs[e.highlight_obj_no].end = cur->objnum; - cur->objnum = e.highlight_obj_no; + e.highlighted.type = OBJ_LINEDEFS; + e.highlighted.num = NumLineDefs - 1; + LineDefs[e.highlighted.num].start = cur->next->objnum; + LineDefs[e.highlighted.num].end = cur->objnum; + cur->objnum = e.highlighted.num; // FIXME cur = e.highlighted } } /* close the polygon if there are more than 2 vertices */ if (firstv >= 0 && is.shift) { - for (e.highlight_obj_no = 0; - e.highlight_obj_no < NumLineDefs; - e.highlight_obj_no++) - if ((LineDefs[e.highlight_obj_no].start == firstv - && LineDefs[e.highlight_obj_no].end == cur->objnum) - || (LineDefs[e.highlight_obj_no].end == firstv - && LineDefs[e.highlight_obj_no].start == cur->objnum)) + e.highlighted.type = OBJ_LINEDEFS; + for (e.highlighted.num = 0; + e.highlighted.num < NumLineDefs; + e.highlighted.num++) + if ((LineDefs[e.highlighted.num].start == firstv + && LineDefs[e.highlighted.num].end == cur->objnum) + || (LineDefs[e.highlighted.num].end == firstv + && LineDefs[e.highlighted.num].start == cur->objnum)) break; - if (e.highlight_obj_no < NumLineDefs) + if (e.highlighted.num < NumLineDefs) cur->objnum = obj_no; else { InsertObject (OBJ_LINEDEFS, -1, 0, 0); - e.highlight_obj_no = NumLineDefs - 1; - LineDefs[e.highlight_obj_no].start = firstv; - LineDefs[e.highlight_obj_no].end = cur->objnum; - cur->objnum = e.highlight_obj_no; + e.highlighted.type = OBJ_LINEDEFS; + e.highlighted.num = NumLineDefs - 1; + LineDefs[e.highlighted.num].start = firstv; + LineDefs[e.highlighted.num].end = cur->objnum; + cur->objnum = e.highlighted.num; // FIXME cur = e.highlighted } } else @@ -2021,11 +2103,12 @@ { e.obj_type = OBJ_SECTORS; InsertObject (OBJ_SECTORS, -1, 0, 0); - e.highlight_obj_no = NumSectors - 1; + e.highlighted.type = OBJ_SECTORS; + e.highlighted.num = NumSectors - 1; for (cur = e.Selected; cur; cur = cur->next) { InsertObject (OBJ_SIDEDEFS, -1, 0, 0); - SideDefs[NumSideDefs - 1].sector = e.highlight_obj_no; + SideDefs[NumSideDefs - 1].sector = e.highlighted.num; ObjectsNeeded (OBJ_LINEDEFS, OBJ_SIDEDEFS, 0); if (LineDefs[cur->objnum].sidedef1 >= 0) { @@ -2034,13 +2117,13 @@ s = SideDefs[LineDefs[cur->objnum].sidedef1].sector; if (s >= 0) { - Sectors[e.highlight_obj_no].floorh = Sectors[s].floorh; - Sectors[e.highlight_obj_no].ceilh = Sectors[s].ceilh; - strncpy (Sectors[e.highlight_obj_no].floort, + Sectors[e.highlighted.num].floorh = Sectors[s].floorh; + Sectors[e.highlighted.num].ceilh = Sectors[s].ceilh; + strncpy (Sectors[e.highlighted.num].floort, Sectors[s].floort, WAD_FLAT_NAME); - strncpy (Sectors[e.highlight_obj_no].ceilt, + strncpy (Sectors[e.highlighted.num].ceilt, Sectors[s].ceilt, WAD_FLAT_NAME); - Sectors[e.highlight_obj_no].light = Sectors[s].light; + Sectors[e.highlighted.num].light = Sectors[s].light; } LineDefs[cur->objnum].sidedef2 = NumSideDefs - 1; LineDefs[cur->objnum].flags = 4; @@ -2053,36 +2136,40 @@ LineDefs[cur->objnum].sidedef1 = NumSideDefs - 1; } ForgetSelection (&e.Selected); - SelectObject (&e.Selected, e.highlight_obj_no); + SelectObject (&e.Selected, e.highlighted.num); } } /* normal case: add a new object of the current type */ else { ForgetSelection (&e.Selected); - InsertObject (e.obj_type, e.highlight_obj_no, + /* FIXME how do you insert a new object of type T if + no object of that type already exists ? */ + obj_type_t t = e.highlighted () ? e.highlighted.type : e.obj_type; + InsertObject (t, e.highlighted.num, edit_mapx_snapped (&e, e.pointer_x), edit_mapy_snapped (&e, e.pointer_y)); - e.highlight_obj_no = GetMaxObjectNum (e.obj_type); + e.highlighted.type = t; + e.highlighted.num = GetMaxObjectNum (e.obj_type); if (e.obj_type == OBJ_LINEDEFS) { - int v1 = LineDefs[e.highlight_obj_no].start; - int v2 = LineDefs[e.highlight_obj_no].end; + int v1 = LineDefs[e.highlighted.num].start; + int v2 = LineDefs[e.highlighted.num].end; if (! Input2VertexNumbers (-1, -1, "Choose the two vertices for the new linedef", &v1, &v2)) { - DeleteObject (e.obj_type, e.highlight_obj_no); - e.highlight_obj_no = OBJ_NO_NONE; + DeleteObject (e.highlighted); + e.highlighted.nil (); } else { - LineDefs[e.highlight_obj_no].start = v1; - LineDefs[e.highlight_obj_no].end = v2; + LineDefs[e.highlighted.num].start = v1; + LineDefs[e.highlighted.num].end = v2; } } else if (e.obj_type == OBJ_VERTICES) { - SelectObject (&e.Selected, e.highlight_obj_no); + SelectObject (&e.Selected, e.highlighted.num); if (AutoMergeVertices (&e.Selected, e.obj_type, 'i')) RedrawMap = 1; ForgetSelection (&e.Selected); @@ -2099,20 +2186,11 @@ // have the time (as of 1998-12-14) to do it now. if (e.obj_type != prev_obj_type) { - int old_mode; int new_mode; - // What's the number of the current mode ? - old_mode = obj_type_to_mode_no (prev_obj_type); - // What's the number of the new mode ? new_mode = obj_type_to_mode_no (e.obj_type); - // In the "View" menu, untick the old mode - // and tick the new mode. - e.mb_menu[MBM_VIEW]->set_ticked (modes[old_mode].item_no, 0); - e.mb_menu[MBM_VIEW]->set_ticked (modes[new_mode].item_no, 1); - // Change the flavour of the "Misc" menu. e.menubar->set_menu (e.mb_ino[MBI_MISC], e.mb_menu[modes[new_mode].menu_no]); @@ -2170,6 +2248,17 @@ secret_sectors (); } + // [Ctrl][t] List tagged linedefs or sectors + else if (is.key == 20) + { + if (e.highlighted._is_sector ()) + list_tagged_linedefs (Sectors[e.highlighted.num].tag); + else if (e.highlighted._is_linedef ()) + list_tagged_sectors (LineDefs[e.highlighted.num].tag); + else + Beep (); + } + // [Ctrl][u] Select linedefs with unknown type (not documented) else if (is.key == 21) { @@ -2198,7 +2287,6 @@ else if (is.key == '&') { e.show_object_numbers = ! e.show_object_numbers; - e.mb_menu[MBM_VIEW]->set_ticked (9, e.show_object_numbers); RedrawMap = 1; } @@ -2207,7 +2295,6 @@ { e.show_things_sprites = ! e.show_things_sprites; e.show_things_squares = ! e.show_things_sprites; // Not a typo ! - e.mb_menu[MBM_VIEW]->set_ticked (10, e.show_things_sprites); RedrawMap = 1; } @@ -2237,7 +2324,7 @@ && ! is.scroll_lock && e.menubar->pulled_down () < 0) { - int distance; // In pixels + unsigned distance; // In pixels #define actual_move(total,dist) \ ((int) (((total * autoscroll_amp / 100)\ @@ -2290,7 +2377,7 @@ // Note: the ordinate "3 * FONTH" is of course not // critical. It's just a rough approximation. distance = ScrMaxX - is.x; - if (distance <= autoscroll_edge && is.y >= 3 * FONTH) + if (distance <= autoscroll_edge && (unsigned) is.y >= 3 * FONTH) { if (! UseMouse) is.x -= e.move_speed; diff -uaNr yadex-1.5.2/src/editobj.cc yadex-1.6.0/src/editobj.cc --- yadex-1.5.2/src/editobj.cc 2000-08-12 16:28:23.000000000 +0200 +++ yadex-1.6.0/src/editobj.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -37,7 +37,10 @@ #include "game.h" #include "gfx.h" #include "levels.h" +#include "objects.h" +#include "objid.h" #include "oldmenus.h" +#include "s_slice.h" #include "s_swapf.h" #include "selectn.h" #include "t_spin.h" @@ -56,7 +59,8 @@ char prompt[80]; HideMousePointer (); -sprintf (prompt, "Enter a %s number between 0 and %d:", GetObjectTypeName (objtype), GetMaxObjectNum (objtype)); +sprintf (prompt, "Enter a %s number between 0 and %d:", + GetObjectTypeName (objtype), GetMaxObjectNum (objtype)); if (x0 < 0) x0 = (ScrMaxX - 25 - 8 * strlen (prompt)) / 2; if (y0 < 0) @@ -74,6 +78,48 @@ } +/* + * input_objid - ask for an object number of the specified type + * + * If the user hit [Return], set objid.type to init.type + * and objid.num to whatever number the user entered. If + * the user hit [Esc], call nil() on objid. + */ +void input_objid (Objid& objid, const Objid& init, int x0, int y0) +{ +char prompt[80]; + +HideMousePointer (); +sprintf (prompt, "Enter a %s number between 0 and %d:", + GetObjectTypeName (init.type), GetMaxObjectNum (init.type)); +if (x0 < 0) + x0 = (ScrMaxX - 25 - 8 * strlen (prompt)) / 2; +if (y0 < 0) + y0 = (ScrMaxY - 55) / 2; +DrawScreenBox3D (x0, y0, x0 + 25 + 8 * strlen (prompt), y0 + 55); +set_colour (WHITE); +DrawScreenText (x0 + 10, y0 + 8, prompt); +int num = init.num; +int key; +while ((key + = InputInteger (x0 + 10, y0 + 28, &num, 0, GetMaxObjectNum (init.type))) + != YK_RETURN && key != YK_ESC) + Beep (); +if (key == YK_ESC) + objid.nil (); +else if (key == YK_RETURN) + { + objid.type = init.type; + objid.num = num; + } +else + { + nf_bug ("input_objid: bad key %d", (int) key); // Can't happen + objid.nil (); + } +ShowMousePointer (); +} + /* ask for an object number and display a warning message @@ -81,33 +127,60 @@ int InputObjectXRef (int x0, int y0, int objtype, bool allownone, int curobj) { -int val, key; +const char *const msg1 = "Warning: modifying the cross-references"; +const char *const msg2 = "between some objects may crash the game."; char prompt[80]; +size_t maxlen = 0; +size_t nlines = 0; +int width; +int height; -HideMousePointer (); +// Dimensions sprintf (prompt, "Enter a %s number between 0 and %d%c", - GetObjectTypeName (objtype), - GetMaxObjectNum (objtype), allownone ? ',' : ':'); -val = strlen (prompt); -if (val < 40) - val = 40; + GetObjectTypeName (objtype), + GetMaxObjectNum (objtype), allownone ? ',' : ':'); +maxlen = 40; // Why 40 ? -- AYM 2002-04-17 +if (strlen (prompt) > maxlen); + maxlen = strlen (prompt); +if (strlen (msg1) > maxlen) + maxlen = strlen (msg1); +if (strlen (msg2) > maxlen) + maxlen = strlen (msg2); +int ya = 0 + BOX_BORDER + WIDE_VSPACING; +int yb = ya; +if (allownone) + yb += FONTH; +int yc = yb + FONTH + WIDE_VSPACING; +// FIXME should query InputInteger() instead +int yd = yc + 2 * HOLLOW_BORDER + 2 * NARROW_VSPACING + FONTH + WIDE_VSPACING; +int ye = yd + FONTH; +int yf = ye + FONTH + WIDE_VSPACING + BOX_BORDER; +width = 2 * BOX_BORDER + 2 * WIDE_HSPACING + maxlen * FONTW; +height = yf - 0; + +// Position if (x0 < 0) - x0 = (ScrMaxX - 25 - 8 * val) / 2; + x0 = (ScrMaxX - width) / 2; if (y0 < 0) - y0 = (ScrMaxY - (allownone ? 85 : 75)) / 2; -DrawScreenBox3D (x0, y0, x0 + 25 + 8 * val, y0 + (allownone ? 85 : 75)); + y0 = (ScrMaxY - height) / 2; + +HideMousePointer (); +DrawScreenBox3D (x0, y0, x0 + width, y0 + height); set_colour (WHITE); -DrawScreenText (x0 + 10, y0 + 8, prompt); +int x = x0 + BOX_BORDER + WIDE_HSPACING; +DrawScreenText (x, y0 + ya, prompt); if (allownone) - DrawScreenText (x0 + 10, y0 + 18, "or -1 for none:"); + DrawScreenText (x, y0 + yb, "or -1 for none:"); set_colour (LIGHTRED); -DrawScreenText (x0 + 10, y0 + (allownone ? 60 : 50), - "Warning: modifying the cross-references"); -DrawScreenText (x0 + 10, y0 + (allownone ? 70 : 60), - "between some objects may crash the game."); -val = curobj; -while ((key = InputInteger (x0 + 10, y0 + (allownone ? 38 : 28), &val, - allownone ? -1 : 0, GetMaxObjectNum (objtype))) != YK_RETURN && key != YK_ESC) +DrawScreenText (x, y0 + yd, msg1); +DrawScreenText (x, y0 + ye, msg2); + +int val = curobj; +int key; +int min = allownone ? -1 : 0; +int max = GetMaxObjectNum (objtype); +while (key = InputInteger (x, y0 + yc, &val, min, max), + key != YK_RETURN && key != YK_ESC) Beep (); ShowMousePointer (); return val; @@ -169,13 +242,13 @@ { DrawScreenBoxHollow (entry1_x0, entry1_y0, entry1_x0 + entry_width - 1, entry1_y0 + entry_height - 1, BLACK); - set_colour (first ? WHITE : DARKGRAY); + set_colour (first ? WHITE : DARKGREY); DrawScreenText (entry1_x0 + HOLLOW_BORDER + NARROW_HSPACING, entry1_y0 + HOLLOW_BORDER + NARROW_VSPACING, "%d", *v1); DrawScreenBoxHollow (entry2_x0, entry2_y0, entry2_x0 + entry_width - 1, entry2_y0 + entry_height - 1, BLACK); - set_colour (! first ? WHITE : DARKGRAY); + set_colour (! first ? WHITE : DARKGREY); DrawScreenText (entry2_x0 + HOLLOW_BORDER + NARROW_HSPACING, entry2_y0 + HOLLOW_BORDER + NARROW_VSPACING, "%d", *v2); @@ -234,8 +307,15 @@ Vertices[obj->objnum].x); sprintf (menustr[1], "Change Y position (Current: %d)", Vertices[obj->objnum].y); +#ifdef OLDMEN val = DisplayMenuArray (0, y0, menustr[2], 2, NULL, menustr, NULL, NULL, NULL); +#else + val = vDisplayMenu (0, y0, menustr[2], + menustr[0], YK_, 0, + menustr[1], YK_, 0, + NULL); +#endif for (n = 0; n < 3; n++) FreeMemory (menustr[n]); subwin_y0 = y0 + BOX_BORDER + (2 + val) * FONTH; @@ -351,21 +431,21 @@ entry1_out_x1, entry1_out_y1, BLACK); if (*v1 < 0 || *v1 > v1max) { - set_colour (DARKGRAY); + set_colour (DARKGREY); ok = false; } else - set_colour (LIGHTGRAY); + set_colour (LIGHTGREY); DrawScreenText (entry1_text_x0, entry1_text_y0, "%d", *v1); DrawScreenBoxHollow (entry2_out_x0, entry2_out_y0, entry2_out_x1, entry2_out_y1, BLACK); if (*v2 < 0 || *v2 > v2max) { - set_colour (DARKGRAY); + set_colour (DARKGREY); ok = false; } else - set_colour (LIGHTGRAY); + set_colour (LIGHTGREY); DrawScreenText (entry2_text_x0, entry2_text_y0, "%d", *v2); if (first) key = InputInteger (entry1_out_x0, entry1_out_y0, v1, 0, v1max); @@ -408,7 +488,9 @@ DrawPointer (1); ShowMousePointer (); /* are we inside a Sector? */ -sector = GetCurObject (OBJ_SECTORS, xpos, ypos, 1); +Objid o; +GetCurObject (o, OBJ_SECTORS, xpos, ypos); +sector = o.num; /* !!!! Should also check for overlapping objects (sectors) !!!! */ switch (choice) @@ -580,6 +662,9 @@ Notify (-1, -1, msg, 0); return; } + +/* I think this switch statement deserves a prize for "worst + gratuitous obfuscation" or something. -- AYM 2000-11-07 */ switch (val) { case 1: @@ -587,6 +672,7 @@ sprintf (msg, "First free tag number: %d", FindFreeTag ()); Notify (-1, -1, msg, 0); break; + case 2: // * -> Rotate and scale if ((objtype == OBJ_THINGS @@ -605,6 +691,7 @@ RotateAndScaleObjects (objtype, *list, (double) angle * 0.0174533, (double) scale * 0.01); break; + case 3: // Linedef -> Split if (objtype == OBJ_LINEDEFS) @@ -636,6 +723,7 @@ ForgetSelection (list); } break; + case 4: // Linedef -> Split linedefs and sector if (objtype == OBJ_LINEDEFS) @@ -673,6 +761,7 @@ MergeVertices (list); } break; + case 5: // Linedef -> Delete linedefs and join sectors if (objtype == OBJ_LINEDEFS) @@ -712,6 +801,7 @@ } } break; + case 6: // Linedef -> Flip if (objtype == OBJ_LINEDEFS) @@ -742,11 +832,13 @@ flip_mirror (*list, OBJ_VERTICES, 'm'); } break; + case 7: // Linedefs -> Swap sidedefs if (objtype == OBJ_LINEDEFS) { if (Expert + || blindly_swap_sidedefs || Confirm (-1, -1, "Warning: the sector references are also swapped", "You may get strange results if you don't know what you are doing...")) @@ -763,6 +855,7 @@ flip_mirror (*list, OBJ_VERTICES, 'f'); } break; + case 8: // Linedef -> Align textures vertically if (objtype == OBJ_LINEDEFS) @@ -788,6 +881,7 @@ BrightenOrDarkenSectors (*list); } break; + case 9: // Linedef -> Align texture horizontally if (objtype == OBJ_LINEDEFS) @@ -823,9 +917,18 @@ ObjectsNeeded (OBJ_LINEDEFS, 0); for (cur = *list; cur; cur = cur->next) { - LineDefs[cur->objnum].sidedef2 = -1; /* remove ref. to 2nd SD */ - LineDefs[cur->objnum].flags &= ~0x04; /* clear "2S" bit */ - LineDefs[cur->objnum].flags |= 0x01; /* set "Im" bit */ + struct LineDef *l = LineDefs + cur->objnum; + l->sidedef2 = -1; /* remove ref. to 2nd SD */ + l->flags &= ~0x04; /* clear "2S" bit */ + l->flags |= 0x01; /* set "Im" bit */ + + if (is_sidedef (l->sidedef1)) + { + struct SideDef *s = SideDefs + l->sidedef1; + strcpy (s->tex1, "-"); + strcpy (s->tex2, "-"); + strcpy (s->tex3, default_middle_texture); + } /* Don't delete the 2nd sidedef, it could be used by another linedef. And if it isn't, the next cross-references check will delete it anyway. */ @@ -902,6 +1005,22 @@ flip_mirror (*list, OBJ_LINEDEFS, 'f'); break; + case 19 : + // Linedef -> Cut a slice out of a sector + if (objtype == OBJ_LINEDEFS) + { + if (! (*list)->next || (*list)->next->next) + { + Beep (); + Notify (-1, -1, "You must select exactly two linedefs", 0); + } + else + { + sector_slice ((*list)->next->objnum, (*list)->objnum); + ForgetSelection (list); + } + } + break; } } diff -uaNr yadex-1.5.2/src/editobj.h yadex-1.6.0/src/editobj.h --- yadex-1.5.2/src/editobj.h 2000-01-10 14:40:12.000000000 +0100 +++ yadex-1.6.0/src/editobj.h 2003-02-12 17:16:22.000000000 +0100 @@ -5,4 +5,5 @@ void DisplayObjectInfo (const edit_t *e, int); /* SWAP! */ +void input_objid (Objid& objid, const Objid& init, int x0, int y0); diff -uaNr yadex-1.5.2/src/editsave.cc yadex-1.6.0/src/editsave.cc --- yadex-1.5.2/src/editsave.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/editsave.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -29,10 +29,13 @@ #include "yadex.h" +#include "dialog.h" #include "editsave.h" #include "entry.h" #include "game.h" #include "levels.h" +#include "wadfile.h" +#include "wadlist.h" #ifndef NEW_SAVE_METHOD @@ -167,66 +170,104 @@ char *GetWadFileName (const char *levelname) { #define BUFSZ 79 -char *outfile = (char *) GetMemory (BUFSZ + 1); -WadPtr wad; + char *outfile = (char *) GetMemory (BUFSZ + 1); -/* get the file name */ -// If no name, find a default one -if (! levelname) - { - if (yg_level_name == YGLN_E1M1 || yg_level_name == YGLN_E1M10) + /* get the file name */ + // If no name, find a default one + if (! levelname) + { + if (yg_level_name == YGLN_E1M1 || yg_level_name == YGLN_E1M10) levelname = "E1M1"; - else if (yg_level_name == YGLN_MAP01) + else if (yg_level_name == YGLN_MAP01) levelname = "MAP01"; - else - { + else + { nf_bug ("Bad ygd_level_name %d, using E1M1.", (int) yg_level_name); levelname = "E1M1"; - } - } + } + } -if (! Level || ! Level->wadfile || ! fncmp (Level->wadfile->filename, MainWad)) - { - al_scpslower (outfile, levelname, BUFSZ); - al_saps (outfile, ".wad", BUFSZ); - } -else - strcpy (outfile, Level->wadfile->filename); -do - InputFileName (-1, -1, "Name of the new wad file:", BUFSZ, outfile); -while (! fncmp (outfile, MainWad)); -/* escape */ -if (outfile[0] == '\0') - { - FreeMemory (outfile); - return 0; - } -/* if the wad file already exists, rename it to "*.bak" */ -for (wad = WadFileList; wad; wad = wad->next) - if (! fncmp (outfile, wad->filename)) - { - al_fdrv_t drv; - al_fpath_t path; - al_fbase_t base; - - al_fana (wad->filename, drv, path, base, 0); - sprintf (wad->filename, "%s%s%s.bak", drv, path, base); - /* Need to close, then reopen: problems with SHARE.EXE */ - fclose (wad->fd); - if (rename (outfile, wad->filename) < 0) + if (! Level + || ! Level->wadfile + || ! fncmp (Level->wadfile->filename, MainWad)) + { + al_scpslower (outfile, levelname, BUFSZ); + al_saps (outfile, ".wad", BUFSZ); + } + else + strcpy (outfile, Level->wadfile->filename); + do + InputFileName (-1, -1, "Name of the new wad file:", BUFSZ, outfile); + while (! fncmp (outfile, MainWad)); + /* escape */ + if (outfile[0] == '\0') + { + FreeMemory (outfile); + return 0; + } + /* if the wad file already exists, rename it to "*.bak" */ + Wad_file *wf; + for (wad_list.rewind (); wad_list.get (wf);) + if (fncmp (outfile, wf->filename) == 0) + { + verbmsg ("wf->filename: %s\n", wf->filename); // DEBUG + verbmsg ("wf->fp %p\n", wf->fp); // DEBUG + verbmsg ("outfile %s\n", outfile); // DEBUG + al_fdrv_t drv; + al_fpath_t path; + al_fbase_t base; + + al_fana (wf->filename, drv, path, base, 0); + sprintf (wf->filename, "%s%s%s.bak", drv, path, base); + verbmsg ("setting wf->filename to %s\n", wf->filename); // DEBUG + /* Need to close, then reopen: problems with SHARE.EXE */ + verbmsg ("closing %p\n", wf->fp); // DEBUG + fclose (wf->fp); + verbmsg ("renaming %s -> %s\n", outfile, wf->filename); // DEBUG + if (rename (outfile, wf->filename) != 0) + { + verbmsg ("removing %s\n", wf->filename); // DEBUG + if (remove (wf->filename) != 0 && errno != ENOENT) + { + char buf1[81]; + char buf2[81]; + y_snprintf (buf1, sizeof buf1, "Could not delete \"%.64s\"", + wf->filename); + y_snprintf (buf2, sizeof buf2, "(%.64s)", strerror (errno)); + Notify (-1, -1, buf1, buf2); + return 0; + } + verbmsg ("renaming %s -> %s\n", outfile, wf->filename); // DEBUG + if (rename (outfile, wf->filename)) + { + char buf1[81]; + char buf2[81]; + y_snprintf (buf1, sizeof buf1, "Could not rename \"%.64s\"", + outfile); + y_snprintf (buf2, sizeof buf2, "as \"%.64s\" (%.64s)", + wf->filename, strerror (errno)); + Notify (-1, -1, buf1, buf2); + return 0; + } + } + verbmsg ("opening %s\n", wf->filename); // DEBUG + wf->fp = fopen (wf->filename, "rb"); + if (wf->fp == 0) { - if (remove (wad->filename)) - fatal_error ("could not delete file \"%s\"", wad->filename); - if (rename (outfile, wad->filename)) - fatal_error ("could not rename \"%s\" to \"%s\"", outfile, - wad->filename); + char buf1[81]; + char buf2[81]; + y_snprintf (buf1, sizeof buf1, "Could not reopen \"%.64s\"", + wf->filename); + y_snprintf (buf2, sizeof buf2, "(%.64s)", strerror (errno)); + Notify (-1, -1, buf1, buf2); + return 0; } - wad->fd = fopen (wad->filename, "rb"); - if (! wad->fd) - fatal_error ("could not reopen file \"%s\"", wad->filename); - break; - } -return outfile; + verbmsg ("wf->filename: %s\n", wf->filename); // DEBUG + verbmsg ("wf->fp %p\n", wf->fp); // DEBUG + verbmsg ("outfile %s\n", outfile); // DEBUG + break; + } + return outfile; } #endif diff -uaNr yadex-1.5.2/src/editzoom.cc yadex-1.6.0/src/editzoom.cc --- yadex-1.5.2/src/editzoom.cc 2000-08-13 19:33:00.000000000 +0200 +++ yadex-1.6.0/src/editzoom.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -36,6 +36,19 @@ #include "gfx.h" +double digit_zoom_factors[10]; + + +void edit_zoom_init () +{ + double factor = digit_zoom_base / 100.0; + double step = digit_zoom_step != 0 ? (digit_zoom_step + 100.0) / 100 + : pow (2, -.5); + for (int i = 1; i <= 10; i++, factor *= step) + digit_zoom_factors[i % 10] = factor; +} + + int edit_zoom_in (edit_t *e) { if (! e) return 1; // Prevent compiler warning about unused .p. diff -uaNr yadex-1.5.2/src/editzoom.h yadex-1.6.0/src/editzoom.h --- yadex-1.5.2/src/editzoom.h 2000-07-09 18:44:42.000000000 +0200 +++ yadex-1.6.0/src/editzoom.h 2003-02-12 17:16:31.000000000 +0100 @@ -4,6 +4,17 @@ */ +/* zoom factors for the digit keys + */ +extern double digit_zoom_factors[10]; + + +/* + * edit_zoom_init - initialise + */ +void edit_zoom_init (void); + + /* * edit_zoom_in - zoom_in * diff -uaNr yadex-1.5.2/src/endian.cc yadex-1.6.0/src/endian.cc --- yadex-1.5.2/src/endian.cc 2000-06-06 00:38:11.000000000 +0200 +++ yadex-1.6.0/src/endian.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/entry.cc yadex-1.6.0/src/entry.cc --- yadex-1.5.2/src/entry.cc 2000-05-07 14:34:47.000000000 +0200 +++ yadex-1.6.0/src/entry.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -33,83 +33,104 @@ #include "gfx.h" +const char *strgetl (const char *& str, long& value); + + /* - display the integer input box -*/ + * InputInteger - display the integer input box + * + * FIXME *valp, minv and maxv should be changed to long. + */ int InputInteger (int x0, int y0, int *valp, int minv, int maxv) { -int key, val; -bool neg, ok, firstkey; -int entry_out_x0; -int entry_out_y0; -int entry_out_x1; -int entry_out_y1; -int entry_text_x0; -int entry_text_y0; -int entry_text_x1; -int entry_text_y1; - -entry_out_x0 = x0; -entry_text_x0 = entry_out_x0 + HOLLOW_BORDER + NARROW_HSPACING; -entry_text_x1 = entry_text_x0 + 7 * FONTW - 1; -entry_out_x1 = entry_text_x1 + HOLLOW_BORDER + NARROW_HSPACING; -entry_out_y0 = y0; -entry_text_y0 = entry_out_y0 + HOLLOW_BORDER + NARROW_VSPACING; -entry_text_y1 = entry_text_y0 + FONTH - 1; -entry_out_y1 = entry_text_y1 + HOLLOW_BORDER + NARROW_VSPACING; -DrawScreenBoxHollow (entry_out_x0, entry_out_y0, entry_out_x1, entry_out_y1, BLACK); -neg = (*valp < 0); -val = neg ? -(*valp) : *valp; -firstkey = true; -for (;;) - { - ok = (neg ? -val : val) >= minv && (neg ? -val : val) <= maxv; - set_colour (BLACK); - DrawScreenBox (entry_text_x0, entry_text_y0, entry_text_x1, entry_text_y1); - if (ok) + int key; + int entry_out_x0; + int entry_out_y0; + int entry_out_x1; + int entry_out_y1; + int entry_text_x0; + int entry_text_y0; + int entry_text_x1; + int entry_text_y1; + const size_t boxlen = 7; // Visible width of entry box + const size_t bufmaxlen = 50; // Slack enough + char *buf = new char[bufmaxlen + 1]; + + entry_out_x0 = x0; + entry_text_x0 = entry_out_x0 + HOLLOW_BORDER + NARROW_HSPACING; + entry_text_x1 = entry_text_x0 + boxlen * FONTW - 1; + entry_out_x1 = entry_text_x1 + HOLLOW_BORDER + NARROW_HSPACING; + entry_out_y0 = y0; + entry_text_y0 = entry_out_y0 + HOLLOW_BORDER + NARROW_VSPACING; + entry_text_y1 = entry_text_y0 + FONTH - 1; + entry_out_y1 = entry_text_y1 + HOLLOW_BORDER + NARROW_VSPACING; + DrawScreenBoxHollow (entry_out_x0, entry_out_y0, entry_out_x1, entry_out_y1, + BLACK); + long val = *valp; + sprintf (buf, "%d", *valp); // FIXME what if we were in hex ? + for (bool firstkey = true; ; firstkey = false) + { + bool ok; + { + const char *checkp = buf; + ok = strgetl (checkp, val) == 0 + && checkp == buf + strlen (buf) + && val >= minv && val <= maxv; + } + set_colour (BLACK); + DrawScreenBox (entry_text_x0, entry_text_y0, entry_text_x1, entry_text_y1); + if (ok) set_colour (WHITE); - else - set_colour (LIGHTGRAY); - if (neg) - DrawScreenText (entry_text_x0, entry_text_y0, "-%d", val); - else - DrawScreenText (entry_text_x0, entry_text_y0, "%d", val); - key = get_key (); - if (firstkey && is_ordinary (key) && key != ' ') - { - val = 0; - neg = false; - } - firstkey = false; - if (val < 3275 && key >= '0' && key <= '9') - val = val * 10 + dectoi (key); - else if (val > 0 && key == YK_BACKSPACE) - val = val / 10; - else if (neg && key == YK_BACKSPACE) - neg = false; - else if (key == '-') - neg = !neg; - else if (ok && key == YK_RETURN) - break; /* return "val" */ - else if (key == YK_LEFT || key == YK_RIGHT - || key == YK_UP || key == YK_DOWN - || key == YK_TAB || key == YK_BACKTAB) - break; /* return "val", even if not valid */ - else if (key == YK_ESC) - { - neg = false; - val = IIV_CANCEL; /* return a value out of range */ + else + set_colour (LIGHTRED); + if (strlen (buf) > boxlen) + { + DrawScreenText (entry_text_x0, entry_text_y0, "<%s", + buf + (strlen (buf) - boxlen + 1)); + } + else + DrawScreenString (entry_text_x0, entry_text_y0, buf); + + key = get_key (); + if (key == YK_BACKSPACE && strlen (buf) > 0) + { + buf[strlen (buf) - 1] = '\0'; + } + else if (key == YK_RETURN && ok) + { + *valp = (int) val; + break; // Return current value + } + else if (key == YK_LEFT || key == YK_RIGHT + || key == YK_UP || key == YK_DOWN + || key == YK_TAB || key == YK_BACKTAB) + { + *valp = (int) val; + break; // Return current value, even if not valid + } + else if (key == YK_ESC) + { + *valp = IIV_CANCEL; // Return an out of range value break; - } - else + } + else if (is_ordinary (key) && strlen (buf) < bufmaxlen) + { + if (firstkey) + if (key == ' ') // Kludge : hit space to append to initial value + continue; + else + *buf = '\0'; + al_sapc (buf, key, bufmaxlen); + } + else + { Beep (); - } -if (neg) - *valp = -val; -else - *valp = val; -is.key = 0; // Shouldn't have to do that but EditorLoop() is broken -return key; + } + } + + is.key = 0; // Shouldn't have to do that but EditorLoop() is broken + delete[] buf; + return key; } @@ -118,25 +139,26 @@ */ int InputIntegerValue (int x0, int y0, int minv, int maxv, int defv) { -int val, key; -char prompt[80]; + int val, key; + char prompt[80]; -HideMousePointer (); -y_snprintf (prompt, sizeof prompt, "Enter a decimal number between %d and %d:", - minv, maxv); -if (x0 < 0) - x0 = (ScrMaxX - 25 - FONTW * strlen (prompt)) / 2; -if (y0 < 0) - y0 = (ScrMaxY - 55) / 2; -DrawScreenBox3D (x0, y0, x0 + 25 + FONTW * strlen (prompt), y0 + 55); -set_colour (WHITE); -DrawScreenText (x0 + 10, y0 + 8, prompt); -val = defv; -while ((key = InputInteger (x0 + 10, y0 + 28, &val, minv, maxv)) != YK_RETURN - && key != YK_ESC) - Beep (); -ShowMousePointer (); -return val; + HideMousePointer (); + y_snprintf (prompt, sizeof prompt, + "Enter a number between %d and %d:", + minv, maxv); + if (x0 < 0) + x0 = (ScrMaxX - 25 - FONTW * strlen (prompt)) / 2; + if (y0 < 0) + y0 = (ScrMaxY - 55) / 2; + DrawScreenBox3D (x0, y0, x0 + 25 + FONTW * strlen (prompt), y0 + 55); + set_colour (WHITE); + DrawScreenText (x0 + 10, y0 + 8, prompt); + val = defv; + while ((key = InputInteger (x0 + 10, y0 + 28, &val, minv, maxv)) != YK_RETURN + && key != YK_ESC) + Beep (); + ShowMousePointer (); + return val; } @@ -146,104 +168,161 @@ void InputFileName (int x0, int y0, const char *prompt, size_t maxlen, char *filename) { -int key; -size_t l; -size_t boxlen; -bool firstkey; -int width; -int title_y0; -int entry_out_x0; -int entry_out_y0; -int entry_out_x1; -int entry_out_y1; -int entry_text_x0; -int entry_text_y0; -int entry_text_x1; -int entry_text_y1; - -HideMousePointer (); -for (l = strlen (filename) + 1; l <= maxlen; l++) - filename [l] = '\0'; -/* compute the width of the input box */ -if (maxlen > 20) - boxlen = 20; -else - boxlen = maxlen; -/* compute the width of the dialog box */ -if (strlen (prompt) > boxlen) - l = strlen (prompt); -else - l = boxlen; - -width = 2 * HOLLOW_BORDER + 2 * NARROW_HSPACING + boxlen * FONTW; -if ((int) (strlen (prompt) * FONTW) > width) - width = strlen (prompt) * FONTW; -width += 2 * BOX_BORDER + 2 * WIDE_HSPACING; - -if (x0 < 0) - x0 = (ScrMaxX - width) / 2; -if (y0 < 0) - y0 = (ScrMaxY - 2 * BOX_BORDER - - 2 * WIDE_VSPACING - - (int) (2.5 * FONTH) - - 2 * HOLLOW_BORDER - - 2 * NARROW_VSPACING) / 2; -/* draw the dialog box */ -entry_out_x0 = x0 + BOX_BORDER + WIDE_HSPACING; -entry_text_x0 = entry_out_x0 + HOLLOW_BORDER + NARROW_HSPACING; -entry_text_x1 = entry_text_x0 + boxlen * FONTW - 1; -entry_out_x1 = entry_text_x1 + NARROW_HSPACING + HOLLOW_BORDER; -title_y0 = y0 + BOX_BORDER + WIDE_VSPACING; -entry_out_y0 = title_y0 + (int) (1.5 * FONTH); -entry_text_y0 = entry_out_y0 + HOLLOW_BORDER + NARROW_VSPACING; -entry_text_y1 = entry_text_y0 + FONTH - 1; -entry_out_y1 = entry_text_y1 + NARROW_VSPACING + HOLLOW_BORDER; - -DrawScreenBox3D (x0, y0, x0 + width - 1, entry_out_y1 + WIDE_VSPACING); -DrawScreenBoxHollow (entry_out_x0, entry_out_y0, entry_out_x1, entry_out_y1, BLACK); -set_colour (YELLOW); -DrawScreenText (entry_out_x0, title_y0, prompt); -firstkey = true; -for (;;) - { - l = strlen (filename); - set_colour (BLACK); - DrawScreenBox (entry_text_x0, entry_text_y0, entry_text_x1, entry_text_y1); - set_colour (WHITE); - if (l > boxlen) - { + int key; + size_t l; + size_t boxlen; + bool firstkey; + int width; + int title_y0; + int entry_out_x0; + int entry_out_y0; + int entry_out_x1; + int entry_out_y1; + int entry_text_x0; + int entry_text_y0; + int entry_text_x1; + int entry_text_y1; + + HideMousePointer (); + for (l = strlen (filename) + 1; l <= maxlen; l++) + filename [l] = '\0'; + /* compute the width of the input box */ + if (maxlen > 20) + boxlen = 20; + else + boxlen = maxlen; + /* compute the width of the dialog box */ + if (strlen (prompt) > boxlen) + l = strlen (prompt); + else + l = boxlen; + + width = 2 * HOLLOW_BORDER + 2 * NARROW_HSPACING + boxlen * FONTW; + if ((int) (strlen (prompt) * FONTW) > width) + width = strlen (prompt) * FONTW; + width += 2 * BOX_BORDER + 2 * WIDE_HSPACING; + + if (x0 < 0) + x0 = (ScrMaxX - width) / 2; + if (y0 < 0) + y0 = (ScrMaxY - 2 * BOX_BORDER + - 2 * WIDE_VSPACING + - (int) (2.5 * FONTH) + - 2 * HOLLOW_BORDER + - 2 * NARROW_VSPACING) / 2; + /* draw the dialog box */ + entry_out_x0 = x0 + BOX_BORDER + WIDE_HSPACING; + entry_text_x0 = entry_out_x0 + HOLLOW_BORDER + NARROW_HSPACING; + entry_text_x1 = entry_text_x0 + boxlen * FONTW - 1; + entry_out_x1 = entry_text_x1 + NARROW_HSPACING + HOLLOW_BORDER; + title_y0 = y0 + BOX_BORDER + WIDE_VSPACING; + entry_out_y0 = title_y0 + (int) (1.5 * FONTH); + entry_text_y0 = entry_out_y0 + HOLLOW_BORDER + NARROW_VSPACING; + entry_text_y1 = entry_text_y0 + FONTH - 1; + entry_out_y1 = entry_text_y1 + NARROW_VSPACING + HOLLOW_BORDER; + + DrawScreenBox3D (x0, y0, x0 + width - 1, entry_out_y1 + WIDE_VSPACING); + DrawScreenBoxHollow (entry_out_x0, entry_out_y0, entry_out_x1, entry_out_y1, BLACK); + set_colour (YELLOW); + DrawScreenString (entry_out_x0, title_y0, prompt); + firstkey = true; + for (;;) + { + l = strlen (filename); + set_colour (BLACK); + DrawScreenBox (entry_text_x0, entry_text_y0, entry_text_x1, entry_text_y1); + set_colour (WHITE); + if (l > boxlen) + { DrawScreenText (entry_text_x0, entry_text_y0, "<%s", - filename + (l - boxlen + 1)); - } - else - DrawScreenText (entry_text_x0, entry_text_y0, filename); - key = get_key (); - if (firstkey && is_ordinary (key)) - { + filename + (l - boxlen + 1)); + } + else + DrawScreenString (entry_text_x0, entry_text_y0, filename); + key = get_key (); + if (firstkey && is_ordinary (key)) + { for (l = 0; l <= maxlen; l++) - filename[l] = '\0'; + filename[l] = '\0'; l = 0; - } - firstkey = false; - if (l < maxlen && is_ordinary (key)) - { + } + firstkey = false; + if (l < maxlen && is_ordinary (key)) + { filename[l] = key; filename[l + 1] = '\0'; - } - else if (l > 0 && key == YK_BACKSPACE) + } + else if (l > 0 && key == YK_BACKSPACE) filename[l-1] = '\0'; - else if (key == YK_RETURN) + else if (key == YK_RETURN) break; /* return "filename" */ - else if (key == YK_ESC) - { + else if (key == YK_ESC) + { filename[0] = '\0'; /* return an empty string */ break; - } - else + } + else Beep (); - } -ShowMousePointer (); -is.key = 0; // Shouldn't have to do that but EditorLoop() is broken + } + ShowMousePointer (); + is.key = 0; // Shouldn't have to do that but EditorLoop() is broken } +/* + * strgetl - parse a C-style signed long integer + * + * Parse anything that would be a legal C signed long + * integer literal (L and U suffixes are not allowed). + * After the function returns, points on the first + * character that could not be parsed. If what was parsed + * constitutes a valid integer, contains its value + * and the return value is a null pointer. Otherwise, + * is undefined and the return value is a static + * string describing the error. + */ +const char *strgetl (const char *& str, long& value) +{ + int base = 10; + int sign = 1; + + // Leading + or - + if (*str == '-') + { + sign = -1; + str++; + } + else if (*str == '+') + str++; + + // 0- or 0x- prefix + if (*str == '0' && (str[1] == 'x' || str[1] == 'X')) + { + base = 16; + str += 2; + } + else if (*str == '0') + base = 8; // Don't advance str, so that "0" passes the next test + + // Check that there is at least one digit + if (hextoi (*str) < 0 || hextoi (*str) >= base) + { + if (base == 8) + return "expected an octal digit"; + else if (base == 10) + return "expected a decimal digit"; + else + return "expected a hex digit"; + } + + // Swallow all non-prefix digits + for (value = 0; *str != '\0'; str++) + { + int digitval = hextoi (*str); + if (digitval < 0 || digitval >= base) + return 0; + value = base * value + sign * digitval; + } + return 0; +} + diff -uaNr yadex-1.5.2/src/entry2.cc yadex-1.6.0/src/entry2.cc --- yadex-1.5.2/src/entry2.cc 2000-05-12 23:34:46.000000000 +0200 +++ yadex-1.6.0/src/entry2.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/events.cc yadex-1.6.0/src/events.cc --- yadex-1.5.2/src/events.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/events.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -63,8 +63,8 @@ */ void init_event () { -head = 0; -events_in_queue = 0; + head = 0; + events_in_queue = 0; } @@ -73,10 +73,10 @@ */ void send_event (int event) { -if (events_in_queue == Y_EVENT_QUEUE) - fatal_error ("Event buffer full"); -event_queue[(head + events_in_queue) % Y_EVENT_QUEUE] = event; -events_in_queue++; + if (events_in_queue == Y_EVENT_QUEUE) + fatal_error ("Event buffer full"); + event_queue[(head + events_in_queue) % Y_EVENT_QUEUE] = event; + events_in_queue++; } @@ -86,7 +86,7 @@ */ int has_event () { -return events_in_queue != 0; + return events_in_queue != 0; } @@ -96,8 +96,8 @@ */ int has_event (int event) { -return events_in_queue != 0 - && event_queue[head] == event; + return events_in_queue != 0 + && event_queue[head] == event; } @@ -108,9 +108,9 @@ */ int has_key_press_event () { -return events_in_queue != 0 - && event_queue[head] - && (event_queue[head] & ~ (YK_ALT | YK_CTRL | YK_SHIFT)) < YK__LAST; + return events_in_queue != 0 + && event_queue[head] + && (event_queue[head] & ~ (YK_ALT | YK_CTRL | YK_SHIFT)) < YK__LAST; } @@ -120,15 +120,15 @@ */ int get_event () { -if (events_in_queue == 0) // The buffer is empty - return 0; + if (events_in_queue == 0) // The buffer is empty + return 0; -int e = event_queue[head]; -events_in_queue--; -head++; -if (head == Y_EVENT_QUEUE) - head = 0; -return e; + int e = event_queue[head]; + events_in_queue--; + head++; + if (head == Y_EVENT_QUEUE) + head = 0; + return e; } diff -uaNr yadex-1.5.2/src/flats.cc yadex-1.6.0/src/flats.cc --- yadex-1.5.2/src/flats.cc 2000-08-13 18:38:27.000000000 +0200 +++ yadex-1.6.0/src/flats.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -37,6 +37,7 @@ #include "levels.h" #include "lists.h" #include "sticker.h" +#include "wadfile.h" #include "wads.h" @@ -47,29 +48,30 @@ void ChooseFloorTexture (int x0, int y0, const char *prompt, int listsize, char **list, char *name) { -(void) list; -(void) listsize; -// Build a list of char *, for InputNameFromListWithFunc()'s sake -char **flat_names = (char **) GetMemory (NumFTexture * sizeof *flat_names); -for (size_t n = 0; n < NumFTexture; n++) - flat_names[n] = flat_list[n].name; - -HideMousePointer (); - -SwitchToVGA256 (); -/* If we only have a 320x200x256 VGA driver, we must change x0 and y0. - Yuck! */ -if (GfxMode > -2) - { - x0 = -1; - y0 = -1; - } -InputNameFromListWithFunc (x0, y0, prompt, (size_t) NumFTexture, flat_names, 5, - name, 64, 64, DisplayFloorTexture); -SwitchToVGA16 (); + (void) list; + (void) listsize; + // Build a list of char *, for InputNameFromListWithFunc()'s sake + char **flat_names = (char **) GetMemory (NumFTexture * sizeof *flat_names); + for (size_t n = 0; n < NumFTexture; n++) + flat_names[n] = flat_list[n].name; + + HideMousePointer (); + + SwitchToVGA256 (); + /* If we only have a 320x200x256 VGA driver, we must change x0 and y0. + Yuck! */ + if (GfxMode > -2) + { + x0 = -1; + y0 = -1; + } + InputNameFromListWithFunc (x0, y0, prompt, (size_t) NumFTexture, flat_names, + 5, name, 64, 64, DisplayFloorTexture); -ShowMousePointer (); -FreeMemory (flat_names); + SwitchToVGA16 (); + + ShowMousePointer (); + FreeMemory (flat_names); } @@ -80,7 +82,7 @@ */ static int flat_list_entry_match (const void *key, const void *flat_list_entry) { -return y_strnicmp ((const char *) key, + return y_strnicmp ((const char *) key, ((const flat_list_entry_t *) flat_list_entry)->name, WAD_FLAT_NAME); } @@ -93,62 +95,54 @@ void DisplayFloorTexture (hookfunc_comm_t *c) { -c->width = DOOM_FLAT_WIDTH; // Big deal ! -c->height = DOOM_FLAT_HEIGHT; -c->flags = HOOK_SIZE_VALID; - -flat_list_entry_t *flat = (flat_list_entry_t *) - bsearch (c->name, flat_list, NumFTexture, sizeof *flat_list, - flat_list_entry_match); -if (! flat) // Not found in list - { - push_colour (WINBG); - DrawScreenBox (c->x0, c->y0, c->x1, c->y1); - set_colour (WINFG_DIM); - DrawScreenLine (c->x0, c->y0, c->x1, c->y1); - DrawScreenLine (c->x0, c->y1, c->x1, c->y0); - pop_colour (); - return; - } -c->lump_loc.wad = flat->wadfile; -c->lump_loc.ofs = flat->offset; -c->lump_loc.len = DOOM_FLAT_WIDTH * DOOM_FLAT_HEIGHT; // Sorry. -c->flags |= HOOK_LOC_VALID; -WadPtr wadfile = flat->wadfile; -wad_seek (wadfile, flat->offset); - -// Optimization for BGI -#if defined Y_BGI -unsigned char *pixels; /* array of pixels that hold the image */ - -pixels = GetFarMemory (c->width * c->height + 4); -wad_read_bytes (wadfile, pixels + 4, (long) c->width * c->height); -if (GfxMode < -1) - { - /* Probably a bug in the VESA driver... */ - /* It requires "size-1" instead of "size"! */ - ((unsigned short huge *)pixels)[0] = c->width - 1; - ((unsigned short huge *)pixels)[1] = c->height - 1; - } -else - { - ((unsigned short huge *)pixels)[0] = c->width; - ((unsigned short huge *)pixels)[1] = c->height; - } -putimage (c->x0, c->y0, pixels, COPY_PUT); -FreeFarMemory (pixels); -#else -Img img (c->width, c->height); -wad_read_bytes (wadfile, img.wbuf (), (long) c->width * c->height); -Sticker sticker (img, true); // Use opaque because it's faster -sticker.draw (drw, 't', c->x0, c->y0); -#endif -c->disp_x0 = c->x0; -c->disp_y0 = c->y0; -c->disp_x1 = c->x1; -c->disp_y1 = c->y1; + c->width = DOOM_FLAT_WIDTH; // Big deal ! + c->height = DOOM_FLAT_HEIGHT; + c->flags = HOOK_SIZE_VALID; + + flat_list_entry_t *flat = (flat_list_entry_t *) + bsearch (c->name, flat_list, NumFTexture, sizeof *flat_list, + flat_list_entry_match); + if (flat == 0) // Not found in list + { + push_colour (WINBG); + DrawScreenBox (c->x0, c->y0, c->x1, c->y1); + set_colour (WINFG_DIM); + DrawScreenLine (c->x0, c->y0, c->x1, c->y1); + DrawScreenLine (c->x0, c->y1, c->x1, c->y0); + pop_colour (); + return; + } + c->lump_loc.wad = flat->wadfile; + c->lump_loc.ofs = flat->offset; + c->lump_loc.len = DOOM_FLAT_WIDTH * DOOM_FLAT_HEIGHT; // Sorry. + c->flags |= HOOK_LOC_VALID; + const Wad_file *wadfile = flat->wadfile; + wadfile->seek (flat->offset); + if (wadfile->error ()) + { + warn ("%s: can't seek to %lXh\n", + wadfile->pathname (), (unsigned long) flat->offset); + warn ("%.8s: seek error\n", c->name); + } + + c->img.resize (c->width, c->height); + c->img.set_opaque (true); + long nbytes = (long) c->width * c->height; + wadfile->read_bytes (c->img.wbuf (), nbytes); + if (wadfile->error ()) + { + warn ("%s: read error\n", wadfile->where ()); + warn ("%.8s: short read\n", c->name); + } + Sticker sticker (c->img, true); // Use opaque because it's faster + sticker.draw (drw, 't', c->x0, c->y0); + + c->disp_x0 = c->x0; + c->disp_y0 = c->y0; + c->disp_x1 = c->x1; + c->disp_y1 = c->y1; -c->flags |= HOOK_DRAWN; + c->flags |= HOOK_DRAWN; } @@ -158,17 +152,17 @@ */ void display_flat_depressed (hookfunc_comm_t *c) { -draw_box_border (c->x0, c->y0, c->x1 - c->x0 + 1, c->y1 - c->y0 + 1, - HOLLOW_BORDER, 0); -c->x0 += HOLLOW_BORDER; -c->y0 += HOLLOW_BORDER; -c->x1 -= HOLLOW_BORDER; -c->y1 -= HOLLOW_BORDER; -DisplayFloorTexture (c); -c->x0 -= HOLLOW_BORDER; -c->y0 -= HOLLOW_BORDER; -c->x1 += HOLLOW_BORDER; -c->y1 += HOLLOW_BORDER; + draw_box_border (c->x0, c->y0, c->x1 - c->x0 + 1, c->y1 - c->y0 + 1, + HOLLOW_BORDER, 0); + c->x0 += HOLLOW_BORDER; + c->y0 += HOLLOW_BORDER; + c->x1 -= HOLLOW_BORDER; + c->y1 -= HOLLOW_BORDER; + DisplayFloorTexture (c); + c->x0 -= HOLLOW_BORDER; + c->y0 -= HOLLOW_BORDER; + c->x1 += HOLLOW_BORDER; + c->y1 += HOLLOW_BORDER; } diff -uaNr yadex-1.5.2/src/game.cc yadex-1.6.0/src/game.cc --- yadex-1.5.2/src/game.cc 2000-05-11 00:01:58.000000000 +0200 +++ yadex-1.6.0/src/game.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -32,24 +32,11 @@ #include "acolours.h" #include "game.h" #include "gamesky.h" -#include "macro.h" +#include "locate.h" #include "things.h" #include "trace.h" -static const char *standard_directories[] = - { - "./%b", - "~/.yadex/%v/%b", - "%i/%b", - "/usr/local/share/games/yadex/%v/%b", - "/usr/share/games/yadex/%v/%b", - "/usr/local/share/games/yadex/%b", - "/usr/share/games/yadex/%b", - 0 - }; - - const char ygd_file_magic[] = "# Yadex game definition file version 4"; @@ -80,47 +67,28 @@ char readbuf[YGD_BUF]; /* buffer the line is read into */ #define MAX_TOKENS 10 /* tokens per line */ int lineno; /* current line of file */ -const char **dirname; -char filename[257]; -char basename[13]; +char filename[1025]; +char basename[256]; al_scps (basename, game, sizeof basename - 1); al_saps (basename, ".ygd", sizeof basename - 1); /* Locate the game definition file. */ { - const char *home = getenv ("HOME"); - - for (dirname = standard_directories; *dirname; dirname++) - { - int r = macro_expand (filename, sizeof filename - 1, *dirname, - "%b", basename, - "%g", game, - "%i", install_dir, - "%v", yadex_version, - "~", home, - (const char *) 0); - if (r) - { - trace ("ygdloc", "%s: Could not expand macro #%d", *dirname, r); - continue; - } - ygdfile = fopen (filename, "r"); - if (ygdfile) - { - trace ("ygdloc", "%s: hit", filename); - break; - } - trace ("ygcloc", "%s: miss (%s)", filename, strerror (errno)); - } - - if (! ygdfile) - fatal_error ("Game definition file \"%s\" not found (%s)", - basename, strerror (errno)); - else - printf ("Using game definition file \"%s\".\n", filename); + Locate locate (yadex_share_path, basename, false); + const char *pathname = locate.get_next (); + if (pathname == NULL) + fatal_error ("Game definition file \"%s\" not found", basename); + if (strlen (pathname) > sizeof filename - 1) + fatal_error ("%s: file name too long"); + strcpy (filename, pathname); + printf ("Reading game definition file \"%s\".\n", filename); } +ygdfile = fopen (filename, "r"); +if (ygdfile == NULL) + fatal_error ("%s: %s", filename, strerror (errno)); + /* The first line of the ygd file must contain exactly ygd_file_magic. */ if (fgets (readbuf, sizeof readbuf, ygdfile) == NULL @@ -128,7 +96,7 @@ || readbuf[sizeof ygd_file_magic - 1] != '\n' || readbuf[sizeof ygd_file_magic] != '\0') { - report_error ("%s is not a valid Yadex game definition file", filename); + err ("%s is not a valid Yadex game definition file", filename); fatal_error ("Perhaps a leftover from a previous version of Yadex ?"); } @@ -368,12 +336,12 @@ bool abort = false; if (yg_level_format == YGLF__) { - report_error ("%s: Missing \"level_format\" directive.", filename); + err ("%s: Missing \"level_format\" directive.", filename); abort = true; } if (yg_level_name == YGLN__) { - report_error ("%s: Missing \"level_name\" directive.", filename); + err ("%s: Missing \"level_name\" directive.", filename); abort = true; } // FIXME perhaps print a warning message if picture_format @@ -383,6 +351,10 @@ exit (2); } +#if 0 + +#endif + /* * Second pass */ diff -uaNr yadex-1.5.2/src/game.h yadex-1.6.0/src/game.h --- yadex-1.5.2/src/game.h 2000-04-24 02:17:20.000000000 +0200 +++ yadex-1.6.0/src/game.h 2002-05-09 10:36:19.000000000 +0200 @@ -15,7 +15,7 @@ * Data structures for game definition data */ -/* ldt */ +// ldt typedef struct { int number; @@ -24,14 +24,14 @@ const char *longdesc; } ldtdef_t; -/* ldtgroup */ +// ldtgroup typedef struct { char ldtgroup; const char *desc; } ldtgroup_t; -/* st */ +// st typedef struct { int number; @@ -39,7 +39,7 @@ const char *longdesc; } stdef_t; -/* thing []*/ +// thing [] typedef struct { int number; // Thing number @@ -53,7 +53,7 @@ thinggroup for each thing when drawing things */ const char THINGDEF_SPECTRAL = 0x01; -/* thinggroup */ +// thinggroup typedef struct { char thinggroup; // Thing group @@ -83,7 +83,7 @@ extern al_llist_t *thinggroup; -/* shorthands to make program more readable */ +// Shorthands to make the code more readable #define CUR_LDTDEF ((ldtdef_t *)al_lptr (ldtdef )) #define CUR_LDTGROUP ((ldtgroup_t *)al_lptr (ldtgroup )) #define CUR_STDEF ((stdef_t *)al_lptr (stdef )) diff -uaNr yadex-1.5.2/src/gamedef.h yadex-1.6.0/src/gamedef.h --- yadex-1.5.2/src/gamedef.h 1970-01-01 01:00:00.000000000 +0100 +++ yadex-1.6.0/src/gamedef.h 2001-10-11 11:08:22.000000000 +0200 @@ -0,0 +1,111 @@ +/* + * gamedef.h - Game_def class + * AYM 2000-08-30 + */ + + +#ifndef YH_GAMEDEF /* DO NOT INSERT ANYTHING BEFORE THIS LINE */ +#define YH_GAMEDEF + + +class Game_def_priv; + + +typedef struct +{ + char ldtgroup; + const char *shortdesc; + const char *longdesc; +} linedef_type_t; + + +typedef char linedef_type_group_id_t; + + +typedef struct +{ + const char *desc; +} linedef_type_group_t; + + +typedef struct +{ + const char *shortdesc; + const char *longdesc; +} sector_type_t; + + +typedef char thing_type_group_id_t; + + +typedef struct +{ + char flags; // Flags + int radius; // Radius of thing + const char *desc; // Short description of thing + const char *sprite; // Root of name of sprite for thing +} thing_type_t; + + +const char THINGDEF_SPECTRAL = 0x01; + + +typedef struct +{ + char thinggroup; // Thing group + rgb_c rgb; // RGB colour + acolour_t acn; // Application colour# + const char *desc; // Description of thing group +} thing_type_group_t; + + +typedef enum { YGLF__, YGLF_ALPHA, YGLF_DOOM, YGLF_HEXEN } yglf_t; +typedef enum { YGLN__, YGLN_E1M10, YGLN_E1M1, YGLN_MAP01 } ygln_t; +typedef enum { YGPF_NORMAL, YGPF_ALPHA, YGPF_PR } ygpf_t; +typedef enum { YGTF_NORMAL, YGTF_NAMELESS, YGTF_STRIFE11 } ygtf_t; +typedef enum { YGTL_NORMAL, YGTL_TEXTURES, YGTL_NONE } ygtl_t; + + +/* shorthands to make program more readable */ + +#define LDT_FREE '\0' /* KLUDGE: bogus ldt group (see game.c) */ +#define ST_FREE '\0' /* KLUDGE: bogus sector type (see game.c) */ +#define THING_FREE '\0' /* KLUDGE: bogus thing group (see game.c) */ + + +/* + * Game_def - contain all the definitions relative to a game + */ +class Game_def +{ + public : + Game_def (); + ~Game_def (); + const linedef_type_t& linedef_type (wad_ldtype_t type) const; + const sector_type_t& sector_type (wad_stype_t type) const; + const thing_type_t& thing_type (wad_ttype_t type) const; + void linedef_type (wad_ldtype_t type, linedef_type_t& data); + void sector_type (wad_stype_t type, sector_type_t& data); + void thing_type (wad_ttype_t type, thing_type_t& data); + void del_linedef_type (wad_ldtype_t type); + void del_sector_type (wad_stype_t type); + void del_thing_type (wad_ttype_t type); + int level_format (yglf_t level_format); + int level_name (yglf_t level_name); + int picture_format (ygpf_t picture_format); + int texture_format (ygtf_t texture_format); + int texture_lumps (ygtl_t texture_lumps); + yglf_t level_format () const; + ygln_t level_name () const; + ygpf_t picture_format () const; + ygtf_t texture_format () const; + ygtl_t texture_lumps () const; + + private : + Game_def (const Game_def&); // Too lazy to implement it + Game_def& operator= (const Game_def&); // Too lazy to implement it + Game_def_priv *priv; +}; + + +#endif /* DO NOT ADD ANYTHING AFTER THIS LINE */ diff -uaNr yadex-1.5.2/src/gcolour1.cc yadex-1.6.0/src/gcolour1.cc --- yadex-1.5.2/src/gcolour1.cc 2000-08-10 23:57:40.000000000 +0200 +++ yadex-1.6.0/src/gcolour1.cc 2003-03-28 13:37:32.000000000 +0100 @@ -20,7 +20,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -41,7 +41,9 @@ #include "gcolour1.h" #include "gcolour2.h" #include "gfx.h" +#include "img.h" /* IMG_TRANSP */ #include "rgb.h" +#include "wadfile.h" #include "wads.h" @@ -73,9 +75,22 @@ } dpal = (u8 *) GetFarMemory (3 * DOOM_COLOURS); -wad_seek (dir->wadfile, dir->dir.start); +dir->wadfile->seek (dir->dir.start); +if (dir->wadfile->error ()) + { + warn ("%s: can't seek to %lXh\n", + dir->wadfile->pathname (), (unsigned long) dir->dir.start); + warn ("PLAYPAL: seek error\n"); + } for (int n = 0; n <= playpalnum; n++) - wad_read_bytes (dir->wadfile, dpal, 3 * DOOM_COLOURS); + { + dir->wadfile->read_bytes (dpal, 3 * DOOM_COLOURS); + if (dir->wadfile->error ()) + { + warn ("%s: read error\n", dir->wadfile->where ()); + warn ("PLAYPAL: error reading entry #%d\n", n); + } + } #if defined Y_BGI for (int n = 0; n < 3 * DOOM_COLOURS; n++) dpal[n] /= 4; @@ -96,21 +111,22 @@ } game_colours = alloc_colours (rgb_values, DOOM_COLOURS); -// Find the colour closest to colour 0 +// Find the colour closest to IMG_TRANSP { - colour0 = 0; + colour0 = IMG_TRANSP; int smallest_delta = INT_MAX; for (size_t n = 1; n < DOOM_COLOURS; n++) { - int delta = rgb_values[0] - rgb_values[n]; + int delta = rgb_values[IMG_TRANSP] - rgb_values[n]; if (delta < smallest_delta) { colour0 = n; smallest_delta = delta; } } - verbmsg ("Colour 0 remapped to %d (delta %d)\n", colour0, smallest_delta); + verbmsg ("colours: colour %d remapped to %d (delta %d)\n", + IMG_TRANSP, colour0, smallest_delta); } #endif diff -uaNr yadex-1.5.2/src/gcolour2.cc yadex-1.6.0/src/gcolour2.cc --- yadex-1.5.2/src/gcolour2.cc 2000-08-10 23:04:26.000000000 +0200 +++ yadex-1.6.0/src/gcolour2.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/gcolour3.cc yadex-1.6.0/src/gcolour3.cc --- yadex-1.5.2/src/gcolour3.cc 2000-04-20 23:52:42.000000000 +0200 +++ yadex-1.6.0/src/gcolour3.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/gcolour3.h yadex-1.6.0/src/gcolour3.h --- yadex-1.5.2/src/gcolour3.h 2000-06-21 00:53:57.000000000 +0200 +++ yadex-1.6.0/src/gcolour3.h 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/geom.cc yadex-1.6.0/src/geom.cc --- yadex-1.5.2/src/geom.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/geom.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/gfx.cc yadex-1.6.0/src/gfx.cc --- yadex-1.5.2/src/gfx.cc 2000-08-16 00:08:41.000000000 +0200 +++ yadex-1.6.0/src/gfx.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -39,7 +39,7 @@ #include "gcolour2.h" #include "gcolour3.h" #include "gfx.h" -#include "levels.h" // Level +#include "levels.h" /* Level */ #include "x11.h" #ifdef Y_DOS @@ -48,13 +48,13 @@ -/* if your graphics driver doesn't like circles, draw squares instead */ +// If your graphics driver doesn't like circles, draw squares instead #if defined NO_CIRCLES && defined Y_BGI #define circle (x, y, r) line (x - r, y - r, x - r, y + r); \ line (x - r, y + r, x + r, y + r); \ line (x + r, y + r, x + r, y - r); \ line (x + r, y - r, x - r, y - r) -#endif /* NO_CIRCLES */ +#endif /* NO_CIRCLES */ /* Parameters set by the command line args and config file */ const char *BGIDriver = "VESA"; // BGI: default extended BGI driver @@ -77,8 +77,8 @@ int ScrMaxY; // Maximum display Y-coord of screen/window int ScrCenterX; // Display X-coord of centre of screen/window int ScrCenterY; // Display Y-coord of centre of screen/window -int FONTH; -int FONTW; +unsigned FONTH; +unsigned FONTW; int font_xofs; int font_yofs; @@ -112,7 +112,6 @@ int win_vis_class; // The class of win's visual VisualID win_vis_id; // The ID of win's visual int win_depth; // The depth of win in bits -int win_bpp; // The depth of win in bytes int x_server_big_endian = 0; // Is the X server big endian ? int ximage_bpp; // Number of bytes per pixels in XImages int ximage_quantum;// Pad XImages lines to a multiple of that many bytes @@ -129,41 +128,41 @@ #if defined Y_BGI && defined CIRRUS_PATCH char mp[256]; char HWCursor[] = - { - 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, - 0x30, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, - 0x1F, 0x00, 0x00, 0x00, 0x1F, 0xC0, 0x00, 0x00, - 0x0F, 0xF0, 0x00, 0x00, 0x0F, 0xE0, 0x00, 0x00, - 0x07, 0xC0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, - 0x03, 0x70, 0x00, 0x00, 0x02, 0x38, 0x00, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3F, 0xFF, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0xFF, - 0x83, 0xFF, 0xFF, 0xFF, 0x80, 0xFF, 0xFF, 0xFF, - 0xC0, 0x3F, 0xFF, 0xFF, 0xC0, 0x0F, 0xFF, 0xFF, - 0xE0, 0x07, 0xFF, 0xFF, 0xE0, 0x0F, 0xFF, 0xFF, - 0xF0, 0x1F, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xFF, - 0xF8, 0x07, 0xFF, 0xFF, 0xF8, 0x83, 0xFF, 0xFF, - 0xFD, 0xC7, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - }; -#endif /* Y_BGI && CIRRUS_PATCH */ +{ + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, + 0x1F, 0x00, 0x00, 0x00, 0x1F, 0xC0, 0x00, 0x00, + 0x0F, 0xF0, 0x00, 0x00, 0x0F, 0xE0, 0x00, 0x00, + 0x07, 0xC0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, + 0x03, 0x70, 0x00, 0x00, 0x02, 0x38, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3F, 0xFF, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0xFF, + 0x83, 0xFF, 0xFF, 0xFF, 0x80, 0xFF, 0xFF, 0xFF, + 0xC0, 0x3F, 0xFF, 0xFF, 0xC0, 0x0F, 0xFF, 0xFF, + 0xE0, 0x07, 0xFF, 0xFF, 0xE0, 0x0F, 0xFF, 0xFF, + 0xF0, 0x1F, 0xFF, 0xFF, 0xF0, 0x0F, 0xFF, 0xFF, + 0xF8, 0x07, 0xFF, 0xFF, 0xF8, 0x83, 0xFF, 0xFF, + 0xFD, 0xC7, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +}; +#endif /* Y_BGI && CIRRUS_PATCH */ /* @@ -181,584 +180,589 @@ */ int InitGfx (void) { -// Initialization is in fact not necessary -int width; -int height; + // Initialization is in fact not necessary + int width; + int height; #if defined Y_BGI -static bool firsttime = true; -static int gdriver; -static int gmode; -int errorcode = grNoInitGraph; + static bool firsttime = true; + static int gdriver; + static int gmode; + int errorcode = grNoInitGraph; -verbmsg ("Switching to graphics mode...\n"); + verbmsg ("Switching to graphics mode...\n"); #if defined Y_BGI && defined CIRRUS_PATCH -if (CirrusCursor) - SetHWCursorMap (HWCursor); -#endif /* Y_BGI && CIRRUS_PATCH */ -if (firsttime) - { - if (VideoMode > 0) - { + if (CirrusCursor) + SetHWCursorMap (HWCursor); +#endif /* Y_BGI && CIRRUS_PATCH */ + if (firsttime) + { + if (VideoMode > 0) + { gdriver = cooked_installuserdriver (BGIDriver, NULL); gmode = VideoMode; initgraph (&gdriver, &gmode, install_dir); errorcode = graphresult (); - } - if (errorcode != grOk) - { + } + if (errorcode != grOk) + { gdriver = VGA; gmode = VGAHI; - } - } -if (gdriver == VGA || !firsttime) - { - initgraph (&gdriver, &gmode, install_dir); - errorcode = graphresult (); - if (errorcode != grOk) + } + } + if (gdriver == VGA || !firsttime) + { + initgraph (&gdriver, &gmode, install_dir); + errorcode = graphresult (); + if (errorcode != grOk) fatal_error ("graphics error: %s", grapherrormsg (errorcode)); - } -if (gdriver == VGA) - GfxMode = 2; /* 640x480x16 */ -else - { - GfxMode = -gmode; /* 640x480x256, 800x600x256, or 1024x768x256 */ - SetDoomPalette (0); - } -verbmsg ("GfxMode=%d\n", GfxMode); -setlinestyle (0, 0, 1); -setbkcolor (TranslateToDoomColor (BLACK)); -settextstyle (0, 0, 1); -firsttime = false; -width = getmaxx () + 1; -height = getmaxy () + 1; - -#elif defined Y_X11 - -/* - * Open display and get screen number - */ -dpy = XOpenDisplay (0); -if (! dpy) - { - report_error ("Can't open display"); - return 1; - } -scn = DefaultScreen (dpy); -{ -verbmsg ("X server endianness: "); -int r = ImageByteOrder (dpy); -if (r == LSBFirst) - { - verbmsg ("little-endian\n"); - x_server_big_endian = 0; - } -else if (r == MSBFirst) - { - verbmsg ("big-endian\n"); - x_server_big_endian = 1; - } -else - { - verbmsg ("unknown\n"); - warn ("don't understand X server's endianness code %d\n", r); - warn ("assuming same endianness as CPU.\n"); - x_server_big_endian = cpu_big_endian; - } -} -int screen_width = DisplayWidth (dpy, scn); -int screen_height = DisplayHeight (dpy, scn); - - -/* - * Create the window - */ -width = initial_window_width.pixels (screen_width); -height = initial_window_height.pixels (screen_height); -win = XCreateSimpleWindow (dpy, DefaultRootWindow (dpy), - 10, 10, width, height, 0, 0, 0); -//win = DefaultRootWindow (dpy); -{ -XWindowAttributes wa; -XVisualInfo model; -XVisualInfo *vis_info; -int nvisuals; - -XGetWindowAttributes (dpy, win, &wa); -win_vis = wa.visual; -win_depth = wa.depth; -if (win_depth == 8) - win_bpp = 1; -else if (win_depth == 16) - win_bpp = 2; -else if (win_depth == 24) - win_bpp = 3; -else if (win_depth == 32) - win_bpp = 4; -else - fatal_error ("win_depth = %d", win_depth); -verbmsg ("depth %d (%d B)\n", win_depth, win_bpp); - -/* - * Retrieve info regarding win's visual - */ -model.visualid = XVisualIDFromVisual (win_vis); -vis_info = XGetVisualInfo (dpy, VisualIDMask, &model, &nvisuals); -if (! vis_info) - fatal_error ("XGetVisualInfo returned NULL for ID %d", model.visualid); -if (nvisuals != 1) - fatal_error ("XGetVisualInfo returned %d visuals", nvisuals); -if (vis_info->depth != win_depth) - fatal_error ("Visual depth %d <> win depth %d", vis_info->depth, win_depth); -win_vis_id = vis_info->visualid; + } + if (gdriver == VGA) + GfxMode = 2; // 640x480x16 + else + { + GfxMode = -gmode; // 640x480x256, 800x600x256, or 1024x768x256 + SetDoomPalette (0); + } + verbmsg ("GfxMode=%d\n", GfxMode); + setlinestyle (0, 0, 1); + setbkcolor (TranslateToDoomColor (BLACK)); + settextstyle (0, 0, 1); + firsttime = false; + width = getmaxx () + 1; + height = getmaxy () + 1; + +#elif defined Y_X11 + + /* + * Open display and get screen number + */ + dpy = XOpenDisplay (0); + if (! dpy) + { + err ("Can't open display"); + return 1; + } + scn = DefaultScreen (dpy); + { + verbmsg ("X: server endianness: "); + int r = ImageByteOrder (dpy); + if (r == LSBFirst) + { + verbmsg ("little-endian\n"); + x_server_big_endian = 0; + } + else if (r == MSBFirst) + { + verbmsg ("big-endian\n"); + x_server_big_endian = 1; + } + else // Can't happen + { + verbmsg ("unknown\n"); + warn ("don't understand X server's endianness code %d\n", r); + warn ("assuming same endianness as CPU.\n"); + x_server_big_endian = cpu_big_endian; + } + } + int screen_width = DisplayWidth (dpy, scn); + int screen_height = DisplayHeight (dpy, scn); + // On QNX 6, XFree returns silly values. Use a plausible default instead. + if (screen_width == 16383 && screen_height == 16383) + { + warn ("QNX XFree bug detected (width %d, height %d)\n", + screen_width, screen_height); + screen_width = 1024; + screen_height = 768; + } + + + /* + * Create the window + */ + width = initial_window_width.pixels (screen_width); + height = initial_window_height.pixels (screen_height); + win = XCreateSimpleWindow (dpy, DefaultRootWindow (dpy), + 10, 10, width, height, 0, 0, 0); + //win = DefaultRootWindow (dpy); + { + XWindowAttributes wa; + XVisualInfo model; + XVisualInfo *vis_info; + int nvisuals; + + XGetWindowAttributes (dpy, win, &wa); + win_vis = wa.visual; + win_depth = wa.depth; + verbmsg ("X: window depth: %d b\n", win_depth); + + /* + * Retrieve info regarding win's visual + */ + model.visualid = XVisualIDFromVisual (win_vis); + vis_info = XGetVisualInfo (dpy, VisualIDMask, &model, &nvisuals); + if (! vis_info) + fatal_error ("XGetVisualInfo returned NULL for ID %d", model.visualid); + if (nvisuals != 1) + fatal_error ("XGetVisualInfo returned %d visuals", nvisuals); + if (vis_info->depth != win_depth) + fatal_error ("Visual depth %d <> win depth %d", vis_info->depth, win_depth); + win_vis_id = vis_info->visualid; #if defined _cplusplus || defined __cplusplus -win_vis_class = vis_info->c_class; + win_vis_class = vis_info->c_class; #elif -win_vis_class = vis_info->class; + win_vis_class = vis_info->class; #endif -win_ncolours = vis_info->colormap_size; -win_r_mask = vis_info->red_mask; -win_g_mask = vis_info->green_mask; -win_b_mask = vis_info->blue_mask; -XFree (vis_info); -verbmsg ("id %d class ", (int) win_vis_id); -if (win_vis_class == PseudoColor) - verbmsg ("PseudoColor"); -else if (win_vis_class == TrueColor) - verbmsg ("TrueColor"); -else if (win_vis_class == DirectColor) - verbmsg ("DirectColor"); -else if (win_vis_class == StaticColor) - verbmsg ("StaticColor"); -else if (win_vis_class == GrayScale) - verbmsg ("GrayScale"); -else if (win_vis_class == StaticGray) - verbmsg ("StaticGray"); -else - verbmsg ("unknown (%d)", win_vis_class); -verbmsg (" colours %d masks %08lX %08lX %08lX\n", - win_ncolours, win_r_mask, win_g_mask, win_b_mask); - -/* Compute win_[rgb]_bits and win_[rgb]_ofs */ -/* FIXME can enter infinite loop if MSb of either mask is set - and >> sign extends. */ -if (win_r_mask) - { - xpv_t mask; - for (mask = win_r_mask, win_r_ofs = 0; ! (mask & 1); mask >>= 1) - win_r_ofs++; - for (win_r_bits = 0; mask & 1; mask >>= 1) - win_r_bits++; - } -if (win_g_mask) - { - xpv_t mask; - for (mask = win_g_mask, win_g_ofs = 0; ! (mask & 1); mask >>= 1) - win_g_ofs++; - for (win_g_bits = 0; mask & 1; mask >>= 1) - win_g_bits++; - } -if (win_b_mask) - { - xpv_t mask; - for (mask = win_b_mask, win_b_ofs = 0; ! (mask & 1); mask >>= 1) - win_b_ofs++; - for (win_b_bits = 0; mask & 1; mask >>= 1) - win_b_bits++; - } -verbmsg ("r_ofs %d r_bits %d ", win_r_ofs, win_r_bits); -verbmsg ("g_ofs %d g_bits %d ", win_g_ofs, win_g_bits); -verbmsg ("b_ofs %d b_bits %d\n", win_b_ofs, win_b_bits); -} - -/* - * Get info relevant to XImages - */ -ximage_bpp = 0; -ximage_quantum = 0; -{ -int nformats = 0; -XPixmapFormatValues *format = XListPixmapFormats (dpy, &nformats); -if (format == 0 || nformats < 1) - { - warn ("XListPixmapFormats() trouble (ret=%p, n=%d).\n", format, nformats); - goto ximage_done; - } -/* Pick the best possible pixmap format. It must have the same - depth as the drawable. Should there be several formats that - satisfy that requirement (I don't think that ever happens), - prefer the one where the line quantum is equal to the number - of bits per pixel, as that is easier to work with. */ -{ -const XPixmapFormatValues *best = 0; -for (int n = 0; n < nformats; n++) - { - if (format[n].depth != win_depth) - continue; - best = format + n; - if (format[n].scanline_pad == format[n].bits_per_pixel) - break; - } -if (best != 0) - { - int bits_per_pixel = best->bits_per_pixel; - if (bits_per_pixel % 8) // Paranoia + win_ncolours = vis_info->colormap_size; + win_r_mask = vis_info->red_mask; + win_g_mask = vis_info->green_mask; + win_b_mask = vis_info->blue_mask; + XFree (vis_info); + verbmsg ("X: visual: id %xh, class ", (unsigned) win_vis_id); + if (win_vis_class == PseudoColor) + verbmsg ("PseudoColor"); + else if (win_vis_class == TrueColor) + verbmsg ("TrueColor"); + else if (win_vis_class == DirectColor) + verbmsg ("DirectColor"); + else if (win_vis_class == StaticColor) + verbmsg ("StaticColor"); + else if (win_vis_class == GrayScale) + verbmsg ("GrayScale"); + else if (win_vis_class == StaticGray) + verbmsg ("StaticGray"); + else + verbmsg ("unknown (%d)", win_vis_class); + verbmsg (", colours %d, masks %08lX %08lX %08lX\n", + win_ncolours, win_r_mask, win_g_mask, win_b_mask); + + // Compute win_[rgb]_bits and win_[rgb]_ofs + /* FIXME can enter infinite loop if MSb of either mask is set + and >> sign extends. */ + if (win_r_mask) + { + xpv_t mask; + for (mask = win_r_mask, win_r_ofs = 0; ! (mask & 1); mask >>= 1) + win_r_ofs++; + for (win_r_bits = 0; mask & 1; mask >>= 1) + win_r_bits++; + } + if (win_g_mask) + { + xpv_t mask; + for (mask = win_g_mask, win_g_ofs = 0; ! (mask & 1); mask >>= 1) + win_g_ofs++; + for (win_g_bits = 0; mask & 1; mask >>= 1) + win_g_bits++; + } + if (win_b_mask) + { + xpv_t mask; + for (mask = win_b_mask, win_b_ofs = 0; ! (mask & 1); mask >>= 1) + win_b_ofs++; + for (win_b_bits = 0; mask & 1; mask >>= 1) + win_b_bits++; + } + verbmsg ("X: visual: " + "r_ofs %d, r_bits %d, ", win_r_ofs, win_r_bits); + verbmsg ("g_ofs %d, g_bits %d, ", win_g_ofs, win_g_bits); + verbmsg ("b_ofs %d, b_bits %d\n", win_b_ofs, win_b_bits); + } + + /* + * Get info relevant to XImages + */ + ximage_bpp = 0; + ximage_quantum = 0; + { + int nformats = 0; + XPixmapFormatValues *format = XListPixmapFormats (dpy, &nformats); + if (format == 0 || nformats < 1) + { + warn ("XListPixmapFormats() trouble (ret=%p, n=%d).\n", format, nformats); + goto ximage_done; + } + /* Pick the best possible pixmap format. Prefer one that has the + same depth as the drawable, as it is likely to be the fastest + one. Should there be several formats that satisfy that + requirement (I don't think that ever happens), prefer the one + where the line quantum is equal to the number of bits per + pixel, as that is easier to work with. */ + { + const XPixmapFormatValues *best = 0; + for (int n = 0; n < nformats; n++) { - round_up (bits_per_pixel, 8); - warn ("XImage format has bad bits_per_pixel %d. Rounding up to %d.\n", - best->bits_per_pixel, bits_per_pixel); + const XPixmapFormatValues *current = format + n; + verbmsg ("X: pixmap format:" + " #%d, depth %2d, bits_per_pixel %2d, scanline_pad %2d\n", + n, current->depth, current->bits_per_pixel, current->scanline_pad); + if (best == 0) + { + best = current; + continue; + } + int cgoodness = 2 * (current->depth == win_depth) + + 1 * (current->scanline_pad == current->bits_per_pixel); + int bgoodness = 2 * (best->depth == win_depth) + + 1 * (best->scanline_pad == best->bits_per_pixel); + if (cgoodness > bgoodness) + best = current; } - int scanline_pad = best->scanline_pad; - if (best->scanline_pad % 8) // Paranoia + verbmsg ("X: pixmap format: best is #%d\n", int (best - format)); + if (best != 0) { - round_up (scanline_pad, 8); - warn ("XImage format has bad scanline_pad %d. Rounding up to %d.\n", - best->scanline_pad, scanline_pad); + int bits_per_pixel = best->bits_per_pixel; + if (bits_per_pixel % 8) // Paranoia + { + round_up (bits_per_pixel, 8); + warn ("XImage format has bad bits_per_pixel %d. Rounding up to %d.\n", + best->bits_per_pixel, bits_per_pixel); + } + int scanline_pad = best->scanline_pad; + if (best->scanline_pad % 8) // Paranoia + { + round_up (scanline_pad, 8); + warn ("XImage format has bad scanline_pad %d. Rounding up to %d.\n", + best->scanline_pad, scanline_pad); + } + ximage_bpp = bits_per_pixel / 8; + ximage_quantum = scanline_pad / 8; } - ximage_bpp = bits_per_pixel / 8; - ximage_quantum = scanline_pad / 8; - } -} -if (ximage_bpp == 0 || ximage_quantum == 0) - { - warn ("XListPixmapFormats() returned not suitable formats.\n"); - goto ximage_done; - } -ximage_done: -if (format != 0) - XFree (format); -} -/* Could not obtain authoritative/good values. Warn and guess - plausible values. */ -if (ximage_bpp == 0 || ximage_quantum == 0) - { - if (ximage_bpp == 0) - ximage_bpp = win_bpp; - if (ximage_quantum == 0) + } + if (ximage_bpp == 0 || ximage_quantum == 0) + { + warn ("XListPixmapFormats() returned no suitable formats.\n"); + goto ximage_done; + } + ximage_done: + if (format != 0) + XFree (format); + } + /* Could not obtain authoritative/good values. Warn and guess + plausible values. */ + if (ximage_bpp == 0 || ximage_quantum == 0) + { + if (ximage_bpp == 0) + ximage_bpp = (win_depth + 7) / 8; + if (ximage_quantum == 0) ximage_quantum = 4; - warn ("guessing format. Images will probably not be displayed correctly\n"); - } -verbmsg ("XImage format: %d B per pixel, %d B quantum.\n", - ximage_bpp, ximage_quantum); - -/* - * Further configure the window - */ + warn ("guessing format. Images will probably not be displayed correctly\n"); + } + verbmsg ("X: pixmap format: %d B per pixel, %d B quantum.\n", + ximage_bpp, ximage_quantum); + + /* + * Further configure the window + */ #if 0 -{ -XSetWindowAttributes wa; -wa.win_gravity = CenterGravity; -XChangeWindowAttributes (dpy, win, CWWinGravity, &wa); -} -#endif - -XStoreName (dpy, win, "Yadex"); // Temporary name -- will be overwritten -XSelectInput (dpy, win, - KeyPressMask | KeyReleaseMask - | ButtonPressMask | ButtonReleaseMask - | PointerMotionMask - | EnterWindowMask | LeaveWindowMask - | ExposureMask - | StructureNotifyMask); - -/* - * Possibly load and query the font - */ -{ -XFontStruct *xqf; - -// Load the font or use the default font. -default_font = true; -if (font_name != NULL) - { - x_catch_on (); // Catch errors in XLoadFont() - font_xfont = XLoadFont (dpy, font_name); - if (const char *err_msg = x_error ()) + { + XSetWindowAttributes wa; + wa.win_gravity = CenterGravity; + XChangeWindowAttributes (dpy, win, CWWinGravity, &wa); + } +#endif + + XStoreName (dpy, win, "Yadex"); // Temporary name -- will be overwritten + XSelectInput (dpy, win, + KeyPressMask | KeyReleaseMask + | ButtonPressMask | ButtonReleaseMask + | PointerMotionMask + | EnterWindowMask | LeaveWindowMask + | ExposureMask + | StructureNotifyMask); + + /* + * Possibly load and query the font + */ + { + XFontStruct *xqf; + + // Load the font or use the default font. + default_font = true; + if (font_name != NULL) + { + x_catch_on (); // Catch errors in XLoadFont() + font_xfont = XLoadFont (dpy, font_name); + if (const char *err_msg = x_error ()) { - warn ("can't load font \"%s\" (%s).\n", font_name, err_msg); - warn ("using default font instead.\n"); + warn ("can't load font \"%s\" (%s).\n", font_name, err_msg); + warn ("using default font instead.\n"); } - else - default_font = false; - x_catch_off (); - } - -// Query the font we'll use for FONTW, FONTH and FONTYOFS. -xqf = XQueryFont (dpy, - default_font ? XGContextFromGC (DefaultGC (dpy, scn)) : font_xfont); -if (xqf->direction != FontLeftToRight) - warn ("this font is not left-to-right !\n"); -if (xqf->min_byte1 != 0 || xqf->max_byte1 != 0) - warn ("this is not a single-byte font !\n"); -if (xqf->min_char_or_byte2 > 32 || xqf->max_char_or_byte2 < 126) - warn ("this font does not support the ASCII character set !\n"); -if (xqf->min_bounds.width != xqf->max_bounds.width) - warn ("this is not a fixed-width font !\n"); -FONTW = xqf->max_bounds.width; -FONTH = xqf->ascent + xqf->descent; -font_xofs = xqf->min_bounds.lbearing; -font_yofs = xqf->max_bounds.ascent; -XFreeFontInfo (NULL, xqf, 1); -verbmsg (" Font metrics: %dx%d, xofs=%d yofs=%d\n", - FONTW, FONTH, font_xofs, font_yofs); -} - -/* - * Get/create the colormap - * and allocate the colours. - */ -if (win_vis_class == PseudoColor) - { - verbmsg (" Running on PseudoColor visual, using private Colormap\n"); - cmap = XCreateColormap (dpy, win, win_vis, AllocNone); - } -else - cmap = DefaultColormap (dpy, scn); - -XSetWindowColormap (dpy, win, cmap); -game_colour = alloc_game_colours (0); -app_colour = commit_app_colours (); -if (win_depth == 24) - game_colour_24.refresh (game_colour, x_server_big_endian); - -/* - * Create the GC - */ -{ -XGCValues gcv; -unsigned long mask; - -mask = GCForeground | GCFunction | GCLineWidth; -if (! default_font) - { - mask |= GCFont; - gcv.font = font_xfont; - } -gcv.foreground = app_colour[0]; // Default colour -gcv.line_width = 0; -gcv.function = GXcopy; -gc = XCreateGC (dpy, win, mask, &gcv); -if (gc == 0) - fatal_error ("XCreateGC() returned NULL"); -} - - -/* - * More stuff - */ - -XMapWindow (dpy, win); - -// Unless no_pixmap is set, create the pixmap -// and its own pet GC. -if (no_pixmap) - drw = win; -else - { - XGCValues gcv; - - pixmap = XCreatePixmap (dpy, win, width, height, win_depth); - gcv.foreground = BlackPixel (dpy, scn); - gcv.graphics_exposures = False; // We don't want NoExpose events - pixmap_gc = XCreateGC (dpy, pixmap, GCForeground | GCGraphicsExposures, &gcv); - drw = win; - drw_mods = 0; // Force display the first time - } -XSync (dpy, False); -GfxMode = - VideoMode; + else + default_font = false; + x_catch_off (); + } + + // Query the font we'll use for FONTW, FONTH and FONTYOFS. + xqf = XQueryFont (dpy, + default_font ? XGContextFromGC (DefaultGC (dpy, scn)) : font_xfont); + if (xqf->direction != FontLeftToRight) + warn ("this font is not left-to-right !\n"); + if (xqf->min_byte1 != 0 || xqf->max_byte1 != 0) + warn ("this is not a single-byte font !\n"); + if (xqf->min_char_or_byte2 > 32 || xqf->max_char_or_byte2 < 126) + warn ("this font does not support the ASCII character set !\n"); + if (xqf->min_bounds.width != xqf->max_bounds.width) + warn ("this is not a fixed-width font !\n"); + FONTW = xqf->max_bounds.width; + FONTH = xqf->ascent + xqf->descent; + font_xofs = xqf->min_bounds.lbearing; + font_yofs = xqf->max_bounds.ascent; + XFreeFontInfo (NULL, xqf, 1); + verbmsg ("X: font: metrics: %dx%d, xofs %d, yofs %d\n", + FONTW, FONTH, font_xofs, font_yofs); + } + + /* + * Get/create the colormap + * and allocate the colours. + */ + if (win_vis_class == PseudoColor) + { + verbmsg ("X: running on PseudoColor visual, using private Colormap\n"); + cmap = XCreateColormap (dpy, win, win_vis, AllocNone); + } + else + cmap = DefaultColormap (dpy, scn); + + XSetWindowColormap (dpy, win, cmap); + game_colour = alloc_game_colours (0); + app_colour = commit_app_colours (); + if (win_depth == 24) + game_colour_24.refresh (game_colour, x_server_big_endian); + + /* + * Create the GC + */ + { + XGCValues gcv; + unsigned long mask; + + mask = GCForeground | GCFunction | GCLineWidth; + if (! default_font) + { + mask |= GCFont; + gcv.font = font_xfont; + } + gcv.foreground = app_colour[0]; // Default colour + gcv.line_width = 0; + gcv.function = GXcopy; + gc = XCreateGC (dpy, win, mask, &gcv); + if (gc == 0) + fatal_error ("XCreateGC() returned NULL"); + } + + + /* + * More stuff + */ + XSetWindowBackground (dpy, win, app_colour[0]); + XMapWindow (dpy, win); + + // Unless no_pixmap is set, create the pixmap and its own pet GC. + if (no_pixmap) + drw = win; + else + { + XGCValues gcv; + + pixmap = XCreatePixmap (dpy, win, width, height, win_depth); + gcv.foreground = app_colour[0]; + gcv.graphics_exposures = False; // We don't want NoExpose events + pixmap_gc = XCreateGC (dpy, pixmap, GCForeground | GCGraphicsExposures, + &gcv); + drw = win; + drw_mods = 0; // Force display the first time + } + XSync (dpy, False); + GfxMode = - VideoMode; #endif -SetWindowSize (width, height); -return 0; + SetWindowSize (width, height); + return 0; } - /* - terminate the graphics display -*/ - + * TermGfx - terminate the graphics display + */ void TermGfx () { -verbmsg ("TermGfx: GfxMode=%d\n", GfxMode); -if (GfxMode) - { + verbmsg ("TermGfx: GfxMode=%d\n", GfxMode); + if (GfxMode) + { #if defined Y_BGI - closegraph (); + closegraph (); #elif defined Y_X11 - int r; + int r; - if (! no_pixmap) - { + if (! no_pixmap) + { XFreePixmap (dpy, pixmap); XFreeGC (dpy, pixmap_gc); - } - r = XDestroyWindow (dpy, win); - verbmsg (" XDestroyWindow returned %d\n", r); - free_game_colours (game_colour); - game_colour = 0; - uncommit_app_colours (app_colour); - app_colour = 0; - if (cmap != DefaultColormap (dpy, scn)) - { - verbmsg (" Freeing Colormap\n"); + } + r = XDestroyWindow (dpy, win); + verbmsg ("X: XDestroyWindow returned %d\n", r); + free_game_colours (game_colour); + game_colour = 0; + uncommit_app_colours (app_colour); + app_colour = 0; + if (cmap != DefaultColormap (dpy, scn)) + { + verbmsg ("X: freeing Colormap\n"); XFreeColormap (dpy, cmap); - } - if (! default_font) - { - verbmsg (" Unloading font\n"); + } + if (! default_font) + { + verbmsg ("X: unloading font\n"); XUnloadFont (dpy, font_xfont); - } - XFreeGC (dpy, gc); - gc = 0; - /* FIXME there is surely more to do ... */ - XCloseDisplay (dpy); + } + XFreeGC (dpy, gc); + gc = 0; + // FIXME there is surely more to do... + XCloseDisplay (dpy); #endif - GfxMode = 0; - } + GfxMode = 0; + } } - /* - * SetWindowSize - * Set the size of the edit window + * SetWindowSize - set the size of the edit window */ void SetWindowSize (int width, int height) { -// Am I called uselessly ? -if (width == ScrMaxX + 1 && height == ScrMaxY + 1) - return; - -ScrMaxX = width - 1; -ScrMaxY = height - 1; -ScrCenterX = ScrMaxX / 2; -ScrCenterY = ScrMaxY / 2; + // Am I called uselessly ? + if (width == ScrMaxX + 1 && height == ScrMaxY + 1) + return; + + ScrMaxX = width - 1; + ScrMaxY = height - 1; + ScrCenterX = ScrMaxX / 2; + ScrCenterY = ScrMaxY / 2; #ifdef Y_X11 -// Replace the old pixmap by another of the new size -if (! no_pixmap) - { - XFreePixmap (dpy, pixmap); - pixmap = XCreatePixmap (dpy, win, width, height, win_depth); - drw = pixmap; - } + // Replace the old pixmap by another of the new size + if (! no_pixmap) + { + XFreePixmap (dpy, pixmap); + pixmap = XCreatePixmap (dpy, win, width, height, win_depth); + drw = pixmap; + } #endif } /* - switch from VGA 16 colours to VGA 256 colours - - This function does something only in the BGI version and if - the current mode is 16 colours (typically because the video - card is a plain VGA one (as opposed to an SVGA one) so the - only 256-colour mode is 320x200). - - If compiled with Y_X11, this function is a no-op. -*/ - + * SwitchToVGA256 - switch from VGA 16 colours to VGA 256 colours + * + * This function does something only in the BGI version and + * if the current mode is 16 colours (typically because the + * video card is a plain VGA one (as opposed to an SVGA + * one) so the only 256-colour mode is 320x200). + * + * If compiled with Y_X11, this function is a no-op. + */ void SwitchToVGA256 (void) { #if defined Y_X11 -return; + return; #elif defined Y_BGI -static int gdriver = -1; -int gmode, errorcode; + static int gdriver = -1; + int gmode, errorcode; -if (GfxMode > 0 && gdriver != VGA) /* if 16 colors and not failed before */ - { - if (gdriver == -1) - { - gdriver = cooked_installuserdriver ("VGA256", NULL); - errorcode = graphresult (); - } - HideMousePointer (); - closegraph (); - gmode = 0; - initgraph (&gdriver, &gmode, install_dir); - errorcode = graphresult (); - if (errorcode != grOk) - { - /* failed for 256 colors - back to 16 colors */ - gdriver = VGA; - gmode = VGAHI; - initgraph (&gdriver, &gmode, install_dir); - errorcode = graphresult (); - } - if (errorcode != grOk) /* shouldn't happen */ - fatal_error ("graphics error: %s", grapherrormsg (errorcode)); - ShowMousePointer (); - GfxMode = -1 /* 320x200x256 */; - SetDoomPalette (0); - ScrMaxX = getmaxx (); - ScrMaxY = getmaxy (); - ScrCenterX = ScrMaxX / 2; - ScrCenterY = ScrMaxY / 2; - } + if (GfxMode > 0 && gdriver != VGA) /* if 16 colors and not failed before */ + { + if (gdriver == -1) + { + gdriver = cooked_installuserdriver ("VGA256", NULL); + errorcode = graphresult (); + } + HideMousePointer (); + closegraph (); + gmode = 0; + initgraph (&gdriver, &gmode, install_dir); + errorcode = graphresult (); + if (errorcode != grOk) + { + // Failed for 256 colors - back to 16 colors + gdriver = VGA; + gmode = VGAHI; + initgraph (&gdriver, &gmode, install_dir); + errorcode = graphresult (); + } + if (errorcode != grOk) // Shouldn't happen + fatal_error ("graphics error: %s", grapherrormsg (errorcode)); + ShowMousePointer (); + GfxMode = -1; // 320x200x256 + SetDoomPalette (0); + ScrMaxX = getmaxx (); + ScrMaxY = getmaxy (); + ScrCenterX = ScrMaxX / 2; + ScrCenterY = ScrMaxY / 2; + } #endif } - /* - switch from VGA 256 colours to VGA 16 colours - See comments for SwitchToVGA256(). -*/ - + * SwitchToVGA16 - switch from VGA 256 colours to VGA 16 colours + * + * See comments for SwitchToVGA256(). + */ void SwitchToVGA16 (void) { #if defined Y_X11 -return; + return; #elif defined Y_BGI -int gdriver, gmode, errorcode; + int gdriver, gmode, errorcode; -if (GfxMode == -1) /* switch only if we are in 320x200x256 colors */ - { - HideMousePointer (); - closegraph (); - gdriver = VGA; - gmode = VGAHI; - initgraph (&gdriver, &gmode, install_dir); - errorcode = graphresult (); - if (errorcode != grOk) /* shouldn't happen */ + if (GfxMode == -1) // Switch only if we are in 320x200x256 colors + { + HideMousePointer (); + closegraph (); + gdriver = VGA; + gmode = VGAHI; + initgraph (&gdriver, &gmode, install_dir); + errorcode = graphresult (); + if (errorcode != grOk) // Shouldn't happen fatal_error ("graphics error: %s", grapherrormsg (errorcode)); - ShowMousePointer (); - GfxMode = 2; /* 640x480x16 */ - ScrMaxX = getmaxx (); - ScrMaxY = getmaxy (); - ScrCenterX = ScrMaxX / 2; - ScrCenterY = ScrMaxY / 2; - } + ShowMousePointer (); + GfxMode = 2; // 640x480x16 + ScrMaxX = getmaxx (); + ScrMaxY = getmaxy (); + ScrCenterX = ScrMaxX / 2; + ScrCenterY = ScrMaxY / 2; + } #else -; + ; #endif } /* - clear the screen -*/ - + * ClearScreen - clear the screen + */ void ClearScreen () { #if defined Y_BGI -cleardevice (); + cleardevice (); #elif defined Y_X11 -if (no_pixmap) - XClearWindow (dpy, win); -else - { - XFillRectangle (dpy, pixmap, pixmap_gc, 0, 0, ScrMaxX + 1, ScrMaxY + 1); - drw = pixmap; // Redisplaying from scratch so let's use the pixmap - } + if (no_pixmap) + XClearWindow (dpy, win); + else + { + XFillRectangle (dpy, pixmap, pixmap_gc, 0, 0, ScrMaxX + 1, ScrMaxY + 1); + drw = pixmap; // Redisplaying from scratch so let's use the pixmap + } #else -; + ; #endif } /* - * update_display + * update_display - update the physical display + * * Make sure the physical bitmap display (the X window) * is up to date WRT the logical bitmap display (the X * pixmap). @@ -771,48 +775,50 @@ void update_display () { #if defined Y_BGI -; // Nothing ; with BGI, screen output is synchronous + ; // Nothing ; with BGI, screen output is synchronous #elif defined Y_X11 -//if (drw_mods == 0) // Nothing to do, display is already up to date -// return; -//printf (" ["); -//fflush (stdout); -if (! no_pixmap && drw == pixmap) - { - //putchar ('*'); - XCopyArea (dpy, pixmap, win, pixmap_gc, 0, 0, ScrMaxX+1, ScrMaxY+1, 0, 0); - } -XFlush (dpy); -//printf ("] "); -//fflush (stdout); -drw_mods = 0; -drw = win; // If they don't like it, they can call ClearScreen() [HHOS] + //if (drw_mods == 0) // Nothing to do, display is already up to date + // return; + //printf (" ["); + //fflush (stdout); + if (! no_pixmap && drw == pixmap) + { + //putchar ('*'); + XCopyArea (dpy, pixmap, win, pixmap_gc, 0, 0, ScrMaxX+1, ScrMaxY+1, 0, 0); + } + XFlush (dpy); + //printf ("] "); + //fflush (stdout); + drw_mods = 0; + drw = win; // If they don't like it, they can call ClearScreen() [HHOS] #else -; + ; #endif } /* - * force_window_not_pixmap - * Redirect graphic output to window, not pixmap. - * Used only in yadex.cc, before calling the sprite viewer. + * force_window_not_pixmap - force graphic ops to use window + * + * Redirect graphic output to window, not pixmap. Used only + * in yadex.cc, before calling the sprite viewer. + * * FIXME this is not a clean way to do things. */ void force_window_not_pixmap () { -drw = win; + drw = win; } /* - * set_pcolour - * Set the current drawing colour + * set_pcolour - set the current drawing colour + * * must be an physical colour number (a.k.a. pixel value). */ void set_pcolour (pcolour_t colour) { -XSetForeground (dpy, gc, (xpv_t) colour); + XSetForeground (dpy, gc, (xpv_t) colour); } @@ -824,511 +830,528 @@ /* - * set_colour - * Set the current drawing color + * get_colour - get the current drawing colour + */ +acolour_t get_colour () +{ + return current_acolour; +} + + +/* + * set_colour - set the current drawing colour + * * must be an application colour number. */ void set_colour (acolour_t colour) { #if defined Y_BGI -if (colour != current_acolour) - { - current_acolour = colour; - current_bgicolour = (GfxMode < 0) ? TranslateToDoomColor (colour) : colour; - setcolor (current_bgicolour); - } + if (colour != current_acolour) + { + current_acolour = colour; + current_bgicolour = (GfxMode < 0) ? TranslateToDoomColor (colour) : colour; + setcolor (current_bgicolour); + } #elif defined Y_X11 -if (colour != current_acolour) - { - current_acolour = colour; - XSetForeground (dpy, gc, app_colour[colour]); - } + if (colour != current_acolour) + { + current_acolour = colour; + XSetForeground (dpy, gc, app_colour[colour]); + } #endif } /* - * push_colour + * push_colour - push a colour into the colour stack + * * Like set_colour() except that it will only last until * the next call to pop_colour(). */ void push_colour (acolour_t colour) { -if (colour_stack_pointer >= (int) (sizeof colour_stack / sizeof *colour_stack)) - { - nf_bug ("Colour stack overflow"); - return; - } -colour_stack[colour_stack_pointer] = current_acolour; -colour_stack_pointer++; -set_colour (colour); + if (colour_stack_pointer >= (int) (sizeof colour_stack / sizeof *colour_stack)) + { + nf_bug ("Colour stack overflow"); + return; + } + colour_stack[colour_stack_pointer] = current_acolour; + colour_stack_pointer++; + set_colour (colour); } /* - * pop_colour + * pop_colour - pop the colour stack + * * Cancel the effect of the last call to push_colour(). */ void pop_colour (void) { -if (colour_stack_pointer < 1) - { - nf_bug ("Colour stack underflow"); - return; - } -colour_stack_pointer--; -set_colour (colour_stack[colour_stack_pointer]); + if (colour_stack_pointer < 1) + { + nf_bug ("Colour stack underflow"); + return; + } + colour_stack_pointer--; + set_colour (colour_stack[colour_stack_pointer]); } /* - set the line style (thin or thick) -*/ - + * SetLineThickness - set the line style (thin or thick) + */ void SetLineThickness (int thick) { #if defined Y_BGI -setlinestyle (SOLID_LINE, 0, thick ? THICK_WIDTH : NORM_WIDTH); + setlinestyle (SOLID_LINE, 0, thick ? THICK_WIDTH : NORM_WIDTH); #elif defined Y_X11 -if (!! thick != LineThickness) - { - LineThickness = !! thick; - XGCValues gcv; - gcv.line_width = LineThickness ? 3 : (DrawingMode ? 1 : 0); - // ^ It's important to use a line_width of 1 when in xor mode. - // See note (1) in the hacker's guide. - XChangeGC (dpy, gc, GCLineWidth, &gcv); - } + if (!! thick != LineThickness) + { + LineThickness = !! thick; + XGCValues gcv; + gcv.line_width = LineThickness ? 3 : (DrawingMode ? 1 : 0); + // ^ It's important to use a line_width of 1 when in xor mode. + // See note (1) in the hacker's guide. + XChangeGC (dpy, gc, GCLineWidth, &gcv); + } #endif } /* - set the drawing mode (copy or xor) -*/ - + * SetDrawingMode - set the drawing mode (copy or xor) + */ void SetDrawingMode (int _xor) { #if defined Y_BGI -setwritemode (_xor ? XOR_PUT : COPY_PUT); + setwritemode (_xor ? XOR_PUT : COPY_PUT); #elif defined Y_X11 -if (!! _xor != DrawingMode) - { - DrawingMode = !! _xor; - XGCValues gcv; - gcv.function = DrawingMode ? GXxor : GXcopy; - gcv.line_width = LineThickness ? 3 : (DrawingMode ? 1 : 0); - // ^ It's important to use a line_width of 1 when in xor mode. - // See note (1) in the hacker's guide. - XChangeGC (dpy, gc, GCFunction | GCLineWidth, &gcv); - } + if (!! _xor != DrawingMode) + { + DrawingMode = !! _xor; + XGCValues gcv; + gcv.function = DrawingMode ? GXxor : GXcopy; + gcv.line_width = LineThickness ? 3 : (DrawingMode ? 1 : 0); + // ^ It's important to use a line_width of 1 when in xor mode. + // See note (1) in the hacker's guide. + XChangeGC (dpy, gc, GCFunction | GCLineWidth, &gcv); + } #endif } /* - * draw_point - draw a point at display coordinates (, ) + * draw_point - draw a point at display coordinates + * + * The point is drawn at display coordinates (, ). */ void draw_point (int x, int y) { #if defined Y_BGI -putpixel (x, y, current_bgicolour); + putpixel (x, y, current_bgicolour); #elif defined Y_X11 -XDrawPoint (dpy, drw, gc, x, y); + XDrawPoint (dpy, drw, gc, x, y); #endif } /* - - * draw_map_point - * Draw a point at map coordinates , + * draw_map_point - draw a point at map coordinates + * + * The point is drawn at map coordinates (, ) */ void draw_map_point (int mapx, int mapy) { #if defined Y_BGI -putpixel (SCREENX (mapx), SCREENY (mapy), current_bgicolour); + putpixel (SCREENX (mapx), SCREENY (mapy), current_bgicolour); #elif defined Y_X11 -XDrawPoint (dpy, drw, gc, SCREENX (mapx), SCREENY (mapy)); -drw_mods++; + XDrawPoint (dpy, drw, gc, SCREENX (mapx), SCREENY (mapy)); + drw_mods++; #endif } /* - draw a line on the screen from map coords -*/ - + * DrawMapLine - draw a line on the screen from map coords + */ void DrawMapLine (int mapx1, int mapy1, int mapx2, int mapy2) { #if defined Y_BGI -line (SCREENX (mapx1), SCREENY (mapy1), SCREENX (mapx2), SCREENY (mapy2)); + line (SCREENX (mapx1), SCREENY (mapy1), SCREENX (mapx2), SCREENY (mapy2)); #elif defined Y_X11 -XDrawLine (dpy, drw, gc, SCREENX (mapx1), SCREENY (mapy1), - SCREENX (mapx2), SCREENY (mapy2)); -drw_mods++; + XDrawLine (dpy, drw, gc, SCREENX (mapx1), SCREENY (mapy1), + SCREENX (mapx2), SCREENY (mapy2)); + drw_mods++; #endif } - /* - draw a circle on the screen from map coords -*/ - + * DrawMapCircle - draw a circle on the screen from map coords + */ void DrawMapCircle (int mapx, int mapy, int mapradius) { #if defined Y_BGI -circle (SCREENX (mapx), SCREENY (mapy), (int) (mapradius * Scale)); + circle (SCREENX (mapx), SCREENY (mapy), (int) (mapradius * Scale)); #elif defined Y_X11 -XDrawArc (dpy, drw, gc, SCREENX (mapx - mapradius), SCREENY (mapy + mapradius), - (unsigned int) (2 * mapradius * Scale), - (unsigned int) (2 * mapradius * Scale), 0, 360*64); -drw_mods++; + XDrawArc (dpy, drw, gc, SCREENX (mapx - mapradius), SCREENY (mapy + mapradius), + (unsigned int) (2 * mapradius * Scale), + (unsigned int) (2 * mapradius * Scale), 0, 360*64); + drw_mods++; #endif } /* - draw an arrow on the screen from map coords -*/ - + * DrawMapVector - draw an arrow on the screen from map coords + */ void DrawMapVector (int mapx1, int mapy1, int mapx2, int mapy2) { -int scrx1 = SCREENX (mapx1); -int scry1 = SCREENY (mapy1); -int scrx2 = SCREENX (mapx2); -int scry2 = SCREENY (mapy2); -double r = hypot ((double) (scrx1 - scrx2), (double) (scry1 - scry2)); -/* AYM 19980216 to avoid getting huge arrowheads when zooming in */ -int scrXoff = (r >= 1.0) ? (int) ((scrx1 - scrx2) * 8.0 / r * (Scale < 1 ? Scale : 1)) : 0; -int scrYoff = (r >= 1.0) ? (int) ((scry1 - scry2) * 8.0 / r * (Scale < 1 ? Scale : 1)) : 0; + int scrx1 = SCREENX (mapx1); + int scry1 = SCREENY (mapy1); + int scrx2 = SCREENX (mapx2); + int scry2 = SCREENY (mapy2); + double r = hypot ((double) (scrx1 - scrx2), (double) (scry1 - scry2)); +#if 0 + /* AYM 19980216 to avoid getting huge arrowheads when zooming in */ + int scrXoff = (r >= 1.0) ? (int) ((scrx1 - scrx2) * 8.0 / r * (Scale < 1 ? Scale : 1)) : 0; + int scrYoff = (r >= 1.0) ? (int) ((scry1 - scry2) * 8.0 / r * (Scale < 1 ? Scale : 1)) : 0; +#else + int scrXoff = (r >= 1.0) ? (int) ((scrx1 - scrx2) * 8.0 / r * (Scale / 2)) : 0; + int scrYoff = (r >= 1.0) ? (int) ((scry1 - scry2) * 8.0 / r * (Scale / 2)) : 0; +#endif #if defined Y_BGI -line (scrx1, scry1, scrx2, scry2); -scrx1 = scrx2 + 2 * scrXoff; -scry1 = scry2 + 2 * scrYoff; -line (scrx1 - scrYoff, scry1 + scrXoff, scrx2, scry2); -line (scrx1 + scrYoff, scry1 - scrXoff, scrx2, scry2); + line (scrx1, scry1, scrx2, scry2); + scrx1 = scrx2 + 2 * scrXoff; + scry1 = scry2 + 2 * scrYoff; + line (scrx1 - scrYoff, scry1 + scrXoff, scrx2, scry2); + line (scrx1 + scrYoff, scry1 - scrXoff, scrx2, scry2); #elif defined Y_X11 -XDrawLine (dpy, drw, gc, scrx1, scry1, scrx2, scry2); -scrx1 = scrx2 + 2 * scrXoff; -scry1 = scry2 + 2 * scrYoff; -XDrawLine (dpy, drw, gc, scrx1 - scrYoff, scry1 + scrXoff, scrx2, scry2); -XDrawLine (dpy, drw, gc, scrx1 + scrYoff, scry1 - scrXoff, scrx2, scry2); -drw_mods++; + XDrawLine (dpy, drw, gc, scrx1, scry1, scrx2, scry2); + scrx1 = scrx2 + 2 * scrXoff; + scry1 = scry2 + 2 * scrYoff; + XDrawLine (dpy, drw, gc, scrx1 - scrYoff, scry1 + scrXoff, scrx2, scry2); + XDrawLine (dpy, drw, gc, scrx1 + scrYoff, scry1 - scrXoff, scrx2, scry2); + drw_mods++; #endif } - /* - draw an arrow on the screen from map coords and angle (0 - 65535) -*/ - + * DrawMapArrow - draw an arrow on the screen from map coords and angle (0 - 65535) + */ void DrawMapArrow (int mapx1, int mapy1, unsigned angle) { -int mapx2 = mapx1 + (int) (50 * cos (angle / 10430.37835)); -int mapy2 = mapy1 + (int) (50 * sin (angle / 10430.37835)); -int scrx1 = SCREENX (mapx1); -int scry1 = SCREENY (mapy1); -int scrx2 = SCREENX (mapx2); -int scry2 = SCREENY (mapy2); -double r = hypot (scrx1 - scrx2, scry1 - scry2); -int scrXoff = (r >= 1.0) ? (int) ((scrx1 - scrx2) * 8.0 / r * (Scale < 1 ? Scale : 1)) : 0; -int scrYoff = (r >= 1.0) ? (int) ((scry1 - scry2) * 8.0 / r * (Scale < 1 ? Scale : 1)) : 0; + int mapx2 = mapx1 + (int) (50 * cos (angle / 10430.37835)); + int mapy2 = mapy1 + (int) (50 * sin (angle / 10430.37835)); + int scrx1 = SCREENX (mapx1); + int scry1 = SCREENY (mapy1); + int scrx2 = SCREENX (mapx2); + int scry2 = SCREENY (mapy2); + double r = hypot (scrx1 - scrx2, scry1 - scry2); +#if 0 + int scrXoff = (r >= 1.0) ? (int) ((scrx1 - scrx2) * 8.0 / r * (Scale < 1 ? Scale : 1)) : 0; + int scrYoff = (r >= 1.0) ? (int) ((scry1 - scry2) * 8.0 / r * (Scale < 1 ? Scale : 1)) : 0; +#else + int scrXoff = (r >= 1.0) ? (int) ((scrx1 - scrx2) * 8.0 / r * (Scale / 2)) : 0; + int scrYoff = (r >= 1.0) ? (int) ((scry1 - scry2) * 8.0 / r * (Scale / 2)) : 0; +#endif #if defined Y_BGI -line (scrx1, scry1, scrx2, scry2); -scrx1 = scrx2 + 2 * scrXoff; -scry1 = scry2 + 2 * scrYoff; -line (scrx1 - scrYoff, scry1 + scrXoff, scrx2, scry2); -line (scrx1 + scrYoff, scry1 - scrXoff, scrx2, scry2); + line (scrx1, scry1, scrx2, scry2); + scrx1 = scrx2 + 2 * scrXoff; + scry1 = scry2 + 2 * scrYoff; + line (scrx1 - scrYoff, scry1 + scrXoff, scrx2, scry2); + line (scrx1 + scrYoff, scry1 - scrXoff, scrx2, scry2); #elif defined Y_X11 -XDrawLine (dpy, drw, gc, scrx1, scry1, scrx2, scry2); -scrx1 = scrx2 + 2 * scrXoff; -scry1 = scry2 + 2 * scrYoff; -XDrawLine (dpy, drw, gc, scrx1 - scrYoff, scry1 + scrXoff, scrx2, scry2); -XDrawLine (dpy, drw, gc, scrx1 + scrYoff, scry1 - scrXoff, scrx2, scry2); -drw_mods++; + XDrawLine (dpy, drw, gc, scrx1, scry1, scrx2, scry2); + scrx1 = scrx2 + 2 * scrXoff; + scry1 = scry2 + 2 * scrYoff; + XDrawLine (dpy, drw, gc, scrx1 - scrYoff, scry1 + scrXoff, scrx2, scry2); + XDrawLine (dpy, drw, gc, scrx1 + scrYoff, scry1 - scrXoff, scrx2, scry2); + drw_mods++; #endif } - /* - draw a line on the screen from screen coords -*/ - + * DrawScreenLine - draw a line on the screen from screen coords + */ void DrawScreenLine (int Xstart, int Ystart, int Xend, int Yend) { #if defined Y_BGI -line (Xstart, Ystart, Xend, Yend); + line (Xstart, Ystart, Xend, Yend); #elif defined Y_X11 -XDrawLine (dpy, drw, gc, Xstart, Ystart, Xend, Yend); -drw_mods++; + XDrawLine (dpy, drw, gc, Xstart, Ystart, Xend, Yend); + drw_mods++; #endif } +/* + * DrawScreenLineLen - draw a line on the screen + */ void DrawScreenLineLen (int x, int y, int width, int height) { #if defined Y_BGI -line (x, y, x + width - 1, y + height - 1); + line (x, y, x + width - 1, y + height - 1); #elif defined Y_X11 -if (width > 0) - width--; -else if (width < 0) - width++; -if (height > 0) - height--; -else if (height < 0) - height++; -XDrawLine (dpy, drw, gc, x, y, x + width, y + height); -drw_mods++; + if (width > 0) + width--; + else if (width < 0) + width++; + if (height > 0) + height--; + else if (height < 0) + height++; + XDrawLine (dpy, drw, gc, x, y, x + width, y + height); + drw_mods++; #endif } /* - * DrawScreenRect - * Draw a rectangle + * DrawScreenRect - draw a rectangle + * * Unlike most functions here, the 3rd and 4th parameters * specify lengths, not coordinates. */ void DrawScreenRect (int x, int y, int width, int height) { #if defined Y_BGI -rectangle (x, y, x + width - 1, y + height - 1); + rectangle (x, y, x + width - 1, y + height - 1); #elif defined Y_X11 -XDrawRectangle (dpy, drw, gc, x, y, width - 1, height - 1); -drw_mods++; + XDrawRectangle (dpy, drw, gc, x, y, width - 1, height - 1); + drw_mods++; #endif } /* - draw a filled in box on the screen from screen coords - (scrx1, scry1) is the top left corner - (scrx2, scry2) is the bottom right corner - If scrx2 < scrx1 or scry2 < scry1, the function does nothing. -*/ - + * DrawScreenBox - draw a filled in box on the screen from screen coords + * + * (scrx1, scry1) is the top left corner + * (scrx2, scry2) is the bottom right corner + * If scrx2 < scrx1 or scry2 < scry1, the function does nothing. + */ void DrawScreenBox (int scrx1, int scry1, int scrx2, int scry2) { -if (scrx2 < scrx1 || scry2 < scry1) - return; + if (scrx2 < scrx1 || scry2 < scry1) + return; #if defined Y_BGI -setfillstyle (1, getcolor ()); -bar (scrx1, scry1, scrx2, scry2); + setfillstyle (1, getcolor ()); + bar (scrx1, scry1, scrx2, scry2); #elif defined Y_X11 -// FIXME missing gc fill_style -XFillRectangle (dpy, drw, gc, scrx1, scry1, - scrx2 - scrx1 + 1, scry2 - scry1 + 1); -drw_mods++; + // FIXME missing gc fill_style + XFillRectangle (dpy, drw, gc, scrx1, scry1, + scrx2 - scrx1 + 1, scry2 - scry1 + 1); + drw_mods++; #endif } /* - * DrawScreenBoxwh - * Draw a filled rectangle of width x height pixels + * DrawScreenBoxwh - draw a filled rectangle of width x height pixels + * * (scrx0, scry0) is the top left corner * (width, height) is the obvious * If width < 1 or height < 1, does nothing. */ void DrawScreenBoxwh (int scrx0, int scry0, int width, int height) { -if (width < 1 || height < 1) - return; + if (width < 1 || height < 1) + return; #if defined Y_BGI -setfillstyle (1, getcolor ()); -bar (scrx0, scry0, scrx0 + width - 1, scry0 + height - 1); + setfillstyle (1, getcolor ()); + bar (scrx0, scry0, scrx0 + width - 1, scry0 + height - 1); #elif defined Y_X11 -// FIXME missing gc fill_style -XFillRectangle (dpy, drw, gc, scrx0, scry0, width, height); -drw_mods++; + // FIXME missing gc fill_style + XFillRectangle (dpy, drw, gc, scrx0, scry0, width, height); + drw_mods++; #endif } /* - draw a filled-in 3D-box on the screen from screen coords - The 3D border is rather wide (BOX_BORDER pixels wide). -*/ - + * DrawScreenBox3D - draw a filled-in 3D box on the screen + * + * The 3D border is rather wide (BOX_BORDER pixels wide). + */ void DrawScreenBox3D (int scrx1, int scry1, int scrx2, int scry2) { -DrawScreenBox3DShallow (scrx1, scry1, scrx2, scry2); -push_colour (WINBG_DARK); + DrawScreenBox3DShallow (scrx1, scry1, scrx2, scry2); + push_colour (WINBG_DARK); #if defined Y_BGI -line (scrx1 + 1, scry2 - 1, scrx2 - 1, scry2 - 1); -line (scrx2 - 1, scry1 + 1, scrx2 - 1, scry2 - 1); + line (scrx1 + 1, scry2 - 1, scrx2 - 1, scry2 - 1); + line (scrx2 - 1, scry1 + 1, scrx2 - 1, scry2 - 1); #elif defined Y_X11 -XDrawLine (dpy, drw, gc, scrx1 + 1, scry2 - 1, scrx2 - 1, scry2 - 1); -XDrawLine (dpy, drw, gc, scrx2 - 1, scry1 + 1, scrx2 - 1, scry2 - 1); + XDrawLine (dpy, drw, gc, scrx1 + 1, scry2 - 1, scrx2 - 1, scry2 - 1); + XDrawLine (dpy, drw, gc, scrx2 - 1, scry1 + 1, scrx2 - 1, scry2 - 1); #endif -set_colour (WINBG_LIGHT); + set_colour (WINBG_LIGHT); #if defined Y_BGI -line (scrx1 + 1, scry1 + 1, scrx1 + 1, scry2 - 1); -line (scrx1 + 1, scry1 + 1, scrx2 - 1, scry1 + 1); + line (scrx1 + 1, scry1 + 1, scrx1 + 1, scry2 - 1); + line (scrx1 + 1, scry1 + 1, scrx2 - 1, scry1 + 1); #elif defined Y_X11 -XDrawLine (dpy, drw, gc, scrx1 + 1, scry1 + 1, scrx1 + 1, scry2 - 1); -XDrawLine (dpy, drw, gc, scrx1 + 1, scry1 + 1, scrx2 - 1, scry1 + 1); -drw_mods++; + XDrawLine (dpy, drw, gc, scrx1 + 1, scry1 + 1, scrx1 + 1, scry2 - 1); + XDrawLine (dpy, drw, gc, scrx1 + 1, scry1 + 1, scrx2 - 1, scry1 + 1); + drw_mods++; #endif -pop_colour (); + pop_colour (); } /* - * DrawScreenBox3DShallow + * DrawScreenBox3DShallow - draw a filled-in 3D box on the screen + * * Same thing as DrawScreenBox3D but shallow (the 3D border * is NARROW_BORDER pixels wide). */ void DrawScreenBox3DShallow (int scrx1, int scry1, int scrx2, int scry2) { #if defined Y_BGI -setfillstyle (1, TranslateToDoomColor (LIGHTGRAY)); -bar (scrx1 + 1, scry1 + 1, scrx2 - 1, scry2 - 1); -push_colour (WINBG_DARK); -line (scrx1, scry2, scrx2, scry2); -line (scrx2, scry1, scrx2, scry2); -set_colour (WINBG_LIGHT); -line (scrx1, scry1, scrx2, scry1); -line (scrx1, scry1, scrx1, scry2); -pop_colour (); - -#elif defined Y_X11 -push_colour (WINBG); -XFillRectangle (dpy, drw, gc, scrx1+1, scry1+1, scrx2-scrx1, scry2-scry1); -set_colour (WINBG_DARK); -XDrawLine (dpy, drw, gc, scrx1, scry2, scrx2, scry2); -XDrawLine (dpy, drw, gc, scrx2, scry1, scrx2, scry2); -set_colour (WINBG_LIGHT); -XDrawLine (dpy, drw, gc, scrx1, scry1, scrx2, scry1); -XDrawLine (dpy, drw, gc, scrx1, scry1, scrx1, scry2); -drw_mods++; -pop_colour (); + setfillstyle (1, TranslateToDoomColor (LIGHTGREY)); + bar (scrx1 + 1, scry1 + 1, scrx2 - 1, scry2 - 1); + push_colour (WINBG_DARK); + line (scrx1, scry2, scrx2, scry2); + line (scrx2, scry1, scrx2, scry2); + set_colour (WINBG_LIGHT); + line (scrx1, scry1, scrx2, scry1); + line (scrx1, scry1, scrx1, scry2); + pop_colour (); + +#elif defined Y_X11 + push_colour (WINBG); + XFillRectangle (dpy, drw, gc, scrx1+1, scry1+1, scrx2-scrx1, scry2-scry1); + set_colour (WINBG_DARK); + XDrawLine (dpy, drw, gc, scrx1, scry2, scrx2, scry2); + XDrawLine (dpy, drw, gc, scrx2, scry1, scrx2, scry2); + set_colour (WINBG_LIGHT); + XDrawLine (dpy, drw, gc, scrx1, scry1, scrx2, scry1); + XDrawLine (dpy, drw, gc, scrx1, scry1, scrx1, scry2); + drw_mods++; + pop_colour (); #endif } /* - * draw_box_border - * Draw the 3D border of a box. + * draw_box_border - draw the 3D border of a box. + * * (x, y) is the outer top left corner. * (width, height) are the outer dimensions. * (thickness) is the thickness of the border in pixels. * (raised) is zero for depressed, non-zero for raised. */ void draw_box_border (int x, int y, int width, int height, - int thickness, int raised) + int thickness, int raised) { #if defined Y_BGI #error "You need to write the BGI version of draw_box_border()" #elif defined Y_X11 -int n; -XPoint points[3]; + int n; + XPoint points[3]; -// We want offsets, not distances -width--; -height--; - -// Draw the right and bottom edges -push_colour (raised ? WINBG_DARK : WINBG_LIGHT); -points[0].x = x + width; -points[0].y = y; -points[1].x = 0; -points[1].y = height; -points[2].x = -width; -points[2].y = 0; -for (n = 0; n < thickness; n++) - { - XDrawLines (dpy, drw, gc, points, 3, CoordModePrevious); - points[0].x--; - points[0].y++; - points[1].y--; - points[2].x++; - } - -// Draw the left and top edges -set_colour (raised ? WINBG_LIGHT : WINBG_DARK); -points[0].x = x; -points[0].y = y + height; -points[1].x = 0; -points[1].y = -height; -points[2].x = width; -points[2].y = 0; -for (n = 0; n < thickness; n++) - { - XDrawLines (dpy, drw, gc, points, 3, CoordModePrevious); - points[0].x++; - points[0].y--; - points[1].y++; - points[2].x--; - } + // We want offsets, not distances + width--; + height--; + + // Draw the right and bottom edges + push_colour (raised ? WINBG_DARK : WINBG_LIGHT); + points[0].x = x + width; + points[0].y = y; + points[1].x = 0; + points[1].y = height; + points[2].x = -width; + points[2].y = 0; + for (n = 0; n < thickness; n++) + { + XDrawLines (dpy, drw, gc, points, 3, CoordModePrevious); + points[0].x--; + points[0].y++; + points[1].y--; + points[2].x++; + } + + // Draw the left and top edges + set_colour (raised ? WINBG_LIGHT : WINBG_DARK); + points[0].x = x; + points[0].y = y + height; + points[1].x = 0; + points[1].y = -height; + points[2].x = width; + points[2].y = 0; + for (n = 0; n < thickness; n++) + { + XDrawLines (dpy, drw, gc, points, 3, CoordModePrevious); + points[0].x++; + points[0].y--; + points[1].y++; + points[2].x--; + } -pop_colour (); + pop_colour (); #endif } /* - draw a hollow 3D-box on the screen from screen coords - The 3D border is HOLLOW_BORDER pixels wide. -*/ - + * DrawScreenBoxHollow - draw a hollow 3D box on the screen + * + * The 3D border is HOLLOW_BORDER pixels wide. + */ void DrawScreenBoxHollow (int scrx1, int scry1, int scrx2, int scry2, acolour_t colour) { #if defined Y_BGI -setfillstyle (1, TranslateToDoomColor (colour)); -bar (scrx1 + HOLLOW_BORDER, scry1 + HOLLOW_BORDER, - scrx2 - HOLLOW_BORDER, scry2 - HOLLOW_BORDER); -push_colour (WINBG_LIGHT); -line (scrx1, scry2, scrx2, scry2); -line (scrx2, scry1, scrx2, scry2); -set_colour (WINBG_DARK); -line (scrx1, scry1, scrx2, scry1); -line (scrx1, scry1, scrx1, scry2); -pop_colour (); - -#elif defined Y_X11 -push_colour (colour); -XFillRectangle (dpy, drw, gc, - scrx1 + HOLLOW_BORDER, scry1 + HOLLOW_BORDER, - scrx2 + 1 - scrx1 - 2 * HOLLOW_BORDER, scry2 + 1 - scry1 - 2 * HOLLOW_BORDER); -set_colour (WINBG_LIGHT); -XDrawLine (dpy, drw, gc, scrx1, scry2, scrx2, scry2); -XDrawLine (dpy, drw, gc, scrx2, scry1, scrx2, scry2); -set_colour (WINBG_DARK); -XDrawLine (dpy, drw, gc, scrx1, scry1, scrx2, scry1); -XDrawLine (dpy, drw, gc, scrx1, scry1, scrx1, scry2); -drw_mods++; -pop_colour (); + setfillstyle (1, TranslateToDoomColor (colour)); + bar (scrx1 + HOLLOW_BORDER, scry1 + HOLLOW_BORDER, + scrx2 - HOLLOW_BORDER, scry2 - HOLLOW_BORDER); + push_colour (WINBG_LIGHT); + line (scrx1, scry2, scrx2, scry2); + line (scrx2, scry1, scrx2, scry2); + set_colour (WINBG_DARK); + line (scrx1, scry1, scrx2, scry1); + line (scrx1, scry1, scrx1, scry2); + pop_colour (); + +#elif defined Y_X11 + push_colour (colour); + XFillRectangle (dpy, drw, gc, + scrx1 + HOLLOW_BORDER, scry1 + HOLLOW_BORDER, + scrx2 + 1 - scrx1 - 2 * HOLLOW_BORDER, scry2 + 1 - scry1 - 2 * HOLLOW_BORDER); + set_colour (WINBG_LIGHT); + XDrawLine (dpy, drw, gc, scrx1, scry2, scrx2, scry2); + XDrawLine (dpy, drw, gc, scrx2, scry1, scrx2, scry2); + set_colour (WINBG_DARK); + XDrawLine (dpy, drw, gc, scrx1, scry1, scrx2, scry1); + XDrawLine (dpy, drw, gc, scrx1, scry1, scrx1, scry2); + drw_mods++; + pop_colour (); #endif } - /* - draw a meter bar on the screen from screen coords (in a hollow box); max. value = 1.0 -*/ - + * DrawScreenMeter - draw a meter bar on the screen + * + * In a hollow box; max. value = 1.0 + */ void DrawScreenMeter (int scrx1, int scry1, int scrx2, int scry2, float value) { #if defined Y_BGI -if (value < 0.0) - value = 0.0; -if (value > 1.0) - value = 1.0; -setfillstyle (1, TranslateToDoomColor (BLACK)); -bar (scrx1 + 1 + (int) ((scrx2 - scrx1 - 2) * value), scry1 + 1, scrx2 - 1, scry2 - 1); -setfillstyle (1, TranslateToDoomColor (LIGHTGREEN)); -bar (scrx1 + 1, scry1 + 1, scrx1 + 1 + (int) ((scrx2 - scrx1 - 2) * value), scry2 - 1); + if (value < 0.0) + value = 0.0; + if (value > 1.0) + value = 1.0; + setfillstyle (1, TranslateToDoomColor (BLACK)); + bar (scrx1 + 1 + (int) ((scrx2 - scrx1 - 2) * value), scry1 + 1, scrx2 - 1, scry2 - 1); + setfillstyle (1, TranslateToDoomColor (LIGHTGREEN)); + bar (scrx1 + 1, scry1 + 1, scrx1 + 1 + (int) ((scrx2 - scrx1 - 2) * value), scry2 - 1); #elif defined Y_X11 -printf ("DrawScreenMeter()\n"); /* FIXME ! */ + printf ("DrawScreenMeter()\n"); // FIXME #endif } @@ -1340,13 +1363,14 @@ static int lastx0; static int lasty0; -/* Where the last DrawScreen{Text,String}() left the "cursor". */ +// Where the last DrawScreen{Text,String}() left the "cursor". static int lastxcur; static int lastycur; /* - * DrawScreenText + * DrawScreenText - format and display a string + * * Write text to the screen in printf() fashion. * The top left corner of the first character is at (, ) * If == -1, the text is printed at the same abscissa @@ -1358,168 +1382,236 @@ */ void DrawScreenText (int scrx, int scry, const char *msg, ...) { -char temp[120]; -va_list args; + char temp[120]; + va_list args; -// == NULL: print nothing, just set the coordinates. -if (msg == NULL) - { - if (scrx != -1 && scrx != -2) - { + // == NULL: print nothing, just set the coordinates. + if (msg == NULL) + { + if (scrx != -1 && scrx != -2) + { lastx0 = scrx; - lastxcur = scry; - } - if (scry != -1 && scry != -2) - { + lastxcur = scrx; + } + if (scry != -1 && scry != -2) + { lasty0 = scry; // Note: no "+ FONTH" lastycur = scry; - } - return; - } + } + return; + } -va_start (args, msg); -y_vsnprintf (temp, sizeof temp, msg, args); -DrawScreenString (scrx, scry, temp); + va_start (args, msg); + y_vsnprintf (temp, sizeof temp, msg, args); + DrawScreenString (scrx, scry, temp); } /* - * DrawScreenString + * DrawScreenString - display a string + * * Same thing as DrawScreenText() except that the string is * printed verbatim (no formatting or conversion). + * + * A "\1" in the string is not displayed but causes + * subsequent characters to be displayed in WINLABEL (or + * WINLABEL_DIM if the current colour before the function + * was called was WINFG_DIM). + * + * A "\2" in the string is not displayed but causes + * subsequent characters to be displayed in the same colour + * that was active before the function was called. + * + * The string can contain any number of "\1" and "\2". + * Regardless, upon return from the function, the current + * colour is restored to what it was before the function + * was called. + * + * This colour switching business was hacked in a hurry. + * Feel free to improve it. */ void DrawScreenString (int scrx, int scry, const char *str) { -int x; -int y; + int x; int y; -/* FIXME originally, the test was "< 0". Because it broke - when the screen was too small, I changed it to a more - specific "== -1". A quick and very dirty hack ! */ -if (scrx == -1) - x = lastx0; -else if (scrx == -2) - x = lastxcur; -else - x = scrx; -if (scry == -1) - y = lasty0; -else if (scry == -2) - y = lastycur; -else - y = scry; -const size_t len = strlen (str); -#if defined Y_BGI -outtextxy (x, y, str); -#elif defined Y_X11 -XDrawString (dpy, drw, gc, x - font_xofs, y + font_yofs, str, len); -if (text_dot) - XDrawPoint (dpy, drw, gc, x, y); -drw_mods++; -#endif - -lastxcur = x + FONTW * len; -lastycur = y; -if (scrx != -2) - lastx0 = x; -if (scry != -2) - lasty0 = y + FONTH; + /* FIXME originally, the test was "< 0". Because it broke + when the screen was too small, I changed it to a more + specific "== -1". A quick and very dirty hack ! */ + if (scrx == -1) + x = lastx0; + else if (scrx == -2) + x = lastxcur; + else + x = scrx; + if (scry == -1) + y = lasty0; + else if (scry == -2) + y = lastycur; + else + y = scry; + size_t len = strlen (str); +#if defined Y_BGI + outtextxy (x, y, str); + // FIXME implement colour changes (\1, \2) +#elif defined Y_X11 + if (strchr (str, '\1') == 0) + { + XDrawString (dpy, drw, gc, x - font_xofs, y + font_yofs, str, len); + } + else + { + acolour_t save = get_colour (); + int xx = x; + len = 0; + for (const char *p = str; *p != '\0';) + { + int i; + for (i = 0; p[i] != '\0' && p[i] != '\1' && p[i] != '\2'; i++) + ; + len += i; + if (i > 0) + { + XDrawString (dpy, drw, gc, xx - font_xofs, y + font_yofs, p, i); + xx += i * FONTW; + } + if (p[i] == '\0') + break; + if (p[i] == '\1') + set_colour (save == WINFG_DIM ? WINLABEL_DIM : WINLABEL); + else if (p[i] == '\2') + set_colour (save); + i++; + p += i; + } + set_colour (save); + } + if (text_dot) + XDrawPoint (dpy, drw, gc, x, y); + drw_mods++; +#endif + + lastxcur = x + FONTW * len; + lastycur = y; + if (scrx != -2) + lastx0 = x; + if (scry != -2) + lasty0 = y + FONTH; } /* - draw (or erase) the pointer if we aren't using the mouse -*/ + * DrawScreenChar - display a character + * + * Same thing as DrawScreenText() except that the string is + * printed verbatim (no formatting or conversion). + */ +void DrawScreenChar (int x, int y, char c) +{ +#if defined Y_BGI + char buf[2]; + buf[0] = c; + buf[1] = '\0'; + outtextxy (x, y, buf); +#elif defined Y_X11 + XDrawString (dpy, drw, gc, x - font_xofs, y + font_yofs, &c, 1); + if (text_dot) + XDrawPoint (dpy, drw, gc, x, y); + drw_mods++; +#endif +} + +/* + * DrawPointer - draw (or erase) the pointer if we aren't using the mouse + */ void DrawPointer (bool rulers) { #ifdef Y_BGI -int r; + int r; -/* use XOR mode : drawing the pointer twice erases it */ -SetDrawingMode (1); -/* draw the pointer */ -if (rulers) - { - set_colour (MAGENTA); - r = (int) (512 * Scale); - circle (is.x, is.y, r); - r >>= 1; - circle (is.x, is.y, r); - r >>= 1; - circle (is.x, is.y, r); - r >>= 1; - circle (is.x, is.y, r); - r = (int) (1024 * Scale); - line (is.x - r, is.y, is.x + r, is.y); - line (is.x, is.y - r, is.x, is.y + r); - } -else - { - set_colour (YELLOW); - line (is.x - 15, is.y - 13, is.x + 15, is.y + 13); - line (is.x - 15, is.y + 13, is.x + 15, is.y - 13); - } -/* restore normal write mode */ -SetDrawingMode (0); + // Use XOR mode : drawing the pointer twice erases it + SetDrawingMode (1); + // Draw the pointer + if (rulers) + { + set_colour (MAGENTA); + r = (int) (512 * Scale); + circle (is.x, is.y, r); + r >>= 1; + circle (is.x, is.y, r); + r >>= 1; + circle (is.x, is.y, r); + r >>= 1; + circle (is.x, is.y, r); + r = (int) (1024 * Scale); + line (is.x - r, is.y, is.x + r, is.y); + line (is.x, is.y - r, is.x, is.y + r); + } + else + { + set_colour (YELLOW); + line (is.x - 15, is.y - 13, is.x + 15, is.y + 13); + line (is.x - 15, is.y + 13, is.x + 15, is.y - 13); + } + // Restore normal write mode + SetDrawingMode (0); #else -; + ; #endif } #ifdef Y_BGI /* - translate a standard color to Doom palette 0 (approx.) -*/ - -int TranslateToDoomColor (int color) + * TranslateToDoomColor - translate a standard color to Doom palette 0 (approx.) + */ +int TranslateToDoomColor (int colour) { -if (GfxMode < 0) - switch (color) - { + if (GfxMode < 0) + switch (colour) + { case BLACK: - return 0; + return 0; case BLUE: - return 202; + return 202; case GREEN: - return 118; + return 118; case CYAN: - return 194; + return 194; case RED: - return 183; + return 183; case MAGENTA: - return 253; + return 253; case BROWN: - return 144; - case LIGHTGRAY: - return 88; - case DARKGRAY: - return 96; + return 144; + case LIGHTGREY: + return 88; + case DARKGREY: + return 96; case LIGHTBLUE: - return 197; + return 197; case LIGHTGREEN: - return 112; + return 112; case LIGHTCYAN: - return 193; + return 193; case LIGHTRED: - return 176; + return 176; case LIGHTMAGENTA: - return 250; + return 250; case YELLOW: - return 231; + return 231; case WHITE: - return 4; - } -return color; + return 4; + } + return colour; } #endif #if defined Y_BGI && defined CIRRUS_PATCH /* - Cirrus Logic Hardware Mouse Cursor Stuff -*/ + * Cirrus Logic Hardware Mouse Cursor Stuff + */ #define CRTC 0x3D4 #define ATTR 0x3C0 @@ -1531,108 +1623,106 @@ unsigned rdinx (unsigned pt, unsigned inx) { -if (pt == ATTR) - inportb (CRTC + 6); -outportb (pt, inx); -return inportb (pt + 1); + if (pt == ATTR) + inportb (CRTC + 6); + outportb (pt, inx); + return inportb (pt + 1); } void wrinx (int pt, unsigned inx, unsigned val) { -if (pt == ATTR) - { - inportb (CRTC + 6); - outportb (pt, inx); - outportb (pt, val); - } -else - { - outportb (pt, inx); - outportb (pt + 1, val); - } + if (pt == ATTR) + { + inportb (CRTC + 6); + outportb (pt, inx); + outportb (pt, val); + } + else + { + outportb (pt, inx); + outportb (pt + 1, val); + } } void modinx (unsigned pt, unsigned inx, unsigned mask, unsigned nwv) { -unsigned temp; + unsigned temp; -temp = (rdinx (pt, inx) & ~mask) + (nwv & mask); -wrinx (pt, inx, temp); + temp = (rdinx (pt, inx) & ~mask) + (nwv & mask); + wrinx (pt, inx, temp); } void clrinx (unsigned pt, unsigned inx, unsigned val) { -unsigned x; + unsigned x; -x = rdinx (pt, inx); -wrinx (pt, inx, x & ~val); + x = rdinx (pt, inx); + wrinx (pt, inx, x & ~val); } void SetHWCursorPos (unsigned x, unsigned y) { -outport (SEQ, (x << 5) | 0x10); -outport (SEQ, (y << 5) | 0x11); + outport (SEQ, (x << 5) | 0x10); + outport (SEQ, (y << 5) | 0x11); } void SetHWCursorCol (long fgcol, long bgcol) { -modinx (SEQ, 0x12, 3, 2); -outportb (0x3C8, 0xFF); -outportb (0x3C9, LOBYTE (fgcol) >> 2); -outportb (0x3C9, HIBYTE (bgcol) >> 2); -outportb (0x3C8, 0); -outportb (0x3C9, LOBYTE (bgcol) >> 2); -outportb (0x3C9, HIBYTE (bgcol) >> 2); -outportb (0x3C9, bgcol >> 18); -modinx (SEQ, 0x12, 3, 1); + modinx (SEQ, 0x12, 3, 2); + outportb (0x3C8, 0xFF); + outportb (0x3C9, LOBYTE (fgcol) >> 2); + outportb (0x3C9, HIBYTE (bgcol) >> 2); + outportb (0x3C8, 0); + outportb (0x3C9, LOBYTE (bgcol) >> 2); + outportb (0x3C9, HIBYTE (bgcol) >> 2); + outportb (0x3C9, bgcol >> 18); + modinx (SEQ, 0x12, 3, 1); } void CopyHWCursorMap (unsigned bytes) { -char *curmapptr = 0xA000FF00L; -unsigned lbank = (1024 / 64) - 1; + char *curmapptr = 0xA000FF00L; + unsigned lbank = (1024 / 64) - 1; -if ((rdinx (GRC, 0x0B) & 32)==0) - lbank = lbank << 2; -wrinx (GRC, 9, lbank << 2); -memmove (curmapptr, &mp, bytes); + if ((rdinx (GRC, 0x0B) & 32)==0) + lbank = lbank << 2; + wrinx (GRC, 9, lbank << 2); + memmove (curmapptr, &mp, bytes); } void SetHWCursorMap (char *map) { -memmove (&mp, map, 128); -memmove (&mp + 128, &mp, 128); -CopyHWCursorMap (256); -SetHWCursorCol (0xFF00000L, 0xFF); -wrinx (SEQ, 0x13, 0x3F); + memmove (&mp, map, 128); + memmove (&mp + 128, &mp, 128); + CopyHWCursorMap (256); + SetHWCursorCol (0xFF00000L, 0xFF); + wrinx (SEQ, 0x13, 0x3F); } -#endif /* Y_BGI && CIRRUS_PATCH */ +#endif /* Y_BGI && CIRRUS_PATCH */ #ifdef Y_DOS static int cooked_installuserdriver (const char far *__name, int huge (*detect)(void)) { -char savecwd[PATH_MAX+1]; -int gdriver; + char savecwd[PATH_MAX+1]; + int gdriver; -getcwd (savecwd, PATH_MAX); -if (al_fchdir (install_dir)) - fatal_error ("installuserdriver: chdir1 error (%s)", strerror (errno)); -gdriver = installuserdriver (__name, detect); -if (al_fchdir (savecwd)) - fatal_error ("installuserdriver: chdir2 error (%s)", strerror (errno)); -return gdriver; + getcwd (savecwd, PATH_MAX); + if (al_fchdir (install_dir)) + fatal_error ("installuserdriver: chdir1 error (%s)", strerror (errno)); + gdriver = installuserdriver (__name, detect); + if (al_fchdir (savecwd)) + fatal_error ("installuserdriver: chdir2 error (%s)", strerror (errno)); + return gdriver; } #endif -/* end of file */ - diff -uaNr yadex-1.5.2/src/gfx.h yadex-1.6.0/src/gfx.h --- yadex-1.5.2/src/gfx.h 2000-08-16 00:28:20.000000000 +0200 +++ yadex-1.6.0/src/gfx.h 2000-11-07 13:15:14.000000000 +0100 @@ -14,8 +14,8 @@ font, FONTW was 8 and FONTH was 10. DrawScreenText() is supposed to draw characters properly _centered_ within that space, taking into account the optional underscoring. */ -extern int FONTW; -extern int FONTH; +extern unsigned FONTW; +extern unsigned FONTH; extern int font_xofs; extern int font_yofs; @@ -88,7 +88,6 @@ void ClearScreen (void); void update_display (); void force_window_not_pixmap (); -void set_colour (acolour_t); void SetLineThickness (int thick); void SetDrawingMode (int _xor); void DrawMapCircle (int, int, int); @@ -106,6 +105,7 @@ int thickness, int raised); void DrawScreenText (int, int, const char *, ...); void DrawScreenString (int, int, const char *); +void DrawScreenChar (int x, int y, char c); void DrawPointer (bool); void DrawScreenMeter (int, int, int, int, float); void DrawScreenLineLen (int x, int y, int width, int height); @@ -118,6 +118,8 @@ #ifdef PCOLOUR_NONE void set_pcolour (pcolour_t colour); #endif +acolour_t get_colour (); +void set_colour (acolour_t); void push_colour (acolour_t colour); void pop_colour (void); void draw_point (int x, int y); diff -uaNr yadex-1.5.2/src/gfx2.cc yadex-1.6.0/src/gfx2.cc --- yadex-1.5.2/src/gfx2.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/gfx2.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/gfx3.cc yadex-1.6.0/src/gfx3.cc --- yadex-1.5.2/src/gfx3.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/gfx3.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/gotoobj.cc yadex-1.6.0/src/gotoobj.cc --- yadex-1.5.2/src/gotoobj.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/gotoobj.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -31,6 +31,9 @@ #include "gfx.h" #include "gotoobj.h" #include "levels.h" +#include "objects.h" +#include "objid.h" +#include "x_hover.h" /* @@ -70,7 +73,9 @@ */ inline int sector_under_pointer () { - return GetCurObject (OBJ_SECTORS, MAPX (is.x), MAPY (is.y), 1); +Objid o; +GetCurObject (o, OBJ_SECTORS, MAPX (is.x), MAPY (is.y)); +return o.num; } @@ -78,14 +83,14 @@ centre the map around the object and zoom in if necessary */ -void GoToObject (int objtype, int objnum) /* SWAP! */ +void GoToObject (const Objid& objid) /* SWAP! */ { int xpos, ypos; int xpos2, ypos2; int sd1, sd2; float oldscale; -GetObjectCoords (objtype, objnum, &xpos, &ypos); +GetObjectCoords (objid.type, objid.num, &xpos, &ypos); focus_on_map_coords (xpos, ypos); oldscale = Scale; @@ -96,7 +101,7 @@ #if 0 /* zoom in until the object can be selected */ while (Scale < 8.0 - && GetCurObject (objtype, MAPX (is.x), MAPY (is.y), 4) != objnum) + && GetCurObject (objid.type, MAPX (is.x), MAPY (is.y)) != objid.num) { if (Scale < 1.0) Scale = 1.0 / ((1.0 / Scale) - 1.0); @@ -116,7 +121,7 @@ most well-constituted sectors. It does not work so well for unclosed sectors, though (but it's partly GetCurObject()'s fault). */ -if (objtype == OBJ_SECTORS && sector_under_pointer () != objnum) +if (objid.type == OBJ_SECTORS && sector_under_pointer () != objid.num) { /* restore the Scale */ Scale = oldscale; @@ -126,8 +131,8 @@ sd1 = LineDefs[n].sidedef1; sd2 = LineDefs[n].sidedef2; ObjectsNeeded (OBJ_SIDEDEFS, 0); - if (sd1 >= 0 && SideDefs[sd1].sector == objnum - || sd2 >= 0 && SideDefs[sd2].sector == objnum) + if (sd1 >= 0 && SideDefs[sd1].sector == objid.num + || sd2 >= 0 && SideDefs[sd2].sector == objid.num) { GetObjectCoords (OBJ_LINEDEFS, n, &xpos2, &ypos2); int d = ComputeDist (abs (xpos - xpos2), abs (ypos - ypos2)) / 7; @@ -136,7 +141,7 @@ xpos = xpos2 + (xpos - xpos2) / d; ypos = ypos2 + (ypos - ypos2) / d; focus_on_map_coords (xpos, ypos); - if (sector_under_pointer () == objnum) + if (sector_under_pointer () == objid.num) break; } } diff -uaNr yadex-1.5.2/src/gotoobj.h yadex-1.6.0/src/gotoobj.h --- yadex-1.5.2/src/gotoobj.h 2000-01-10 14:40:12.000000000 +0100 +++ yadex-1.6.0/src/gotoobj.h 2000-11-07 00:47:39.000000000 +0100 @@ -4,6 +4,9 @@ */ +class Objid; + + void CenterMapAroundCoords (int, int); -void GoToObject (int objtype, int objnum); /* SWAP! */ +void GoToObject (const Objid& objid); /* SWAP! */ diff -uaNr yadex-1.5.2/src/help1.cc yadex-1.6.0/src/help1.cc --- yadex-1.5.2/src/help1.cc 2000-04-15 17:41:47.000000000 +0200 +++ yadex-1.6.0/src/help1.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -107,7 +107,7 @@ fprintf (fd, "** Yadex is work in progress. Subscribe to yadex-announce\n"); fprintf (fd, "** or keep an eye on the web page.\n"); fprintf (fd, "** To edit an existing level, type \"e \".\n"); -fprintf (fd, "** To create a new level, type \"c \".\n" +fprintf (fd, "** To create a new level, type \"c\".\n" "\n"); #endif } diff -uaNr yadex-1.5.2/src/help2.cc yadex-1.6.0/src/help2.cc --- yadex-1.5.2/src/help2.cc 2000-04-23 15:02:02.000000000 +0200 +++ yadex-1.6.0/src/help2.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -28,6 +28,7 @@ #include "yadex.h" +#include "credits.h" #include "gfx.h" #include "help1.h" // what() #include "help2.h" @@ -38,7 +39,7 @@ */ static const char *help_text[] = - { +{ " Keyboard :", "Esc/q Quit Pgup Scroll up", " Pgdn Scroll down", @@ -76,42 +77,42 @@ " [Ctrl] is pressed).", "- Wheel or buttons 4 and 5: zoom in and out", NULL - }; +}; void DisplayHelp () /* SWAP! */ { -int x0; -int y0; -int width; -int height; -size_t maxlen = 0; -int lines = 4; - -for (const char **str = help_text; *str; str++) - { - size_t len = strlen (*str); - maxlen = y_max (maxlen, len); - lines++; - } -width = (maxlen + 4) * FONTW + 2 * BOX_BORDER; -height = lines * FONTH + 2 * BOX_BORDER; -x0 = (ScrMaxX + 1 - width) / 2; -y0 = (ScrMaxY + 1 - height) / 2; -HideMousePointer (); -/* put in the instructions */ -DrawScreenBox3D (x0, y0, x0 + width - 1, y0 + height - 1); -set_colour (LIGHTCYAN); -DrawScreenText (x0 + BOX_BORDER + (width - 5 * FONTW) / 2, - y0 + BOX_BORDER + FONTH / 2, - "Yadex"); -set_colour (WINFG); -DrawScreenText (x0 + BOX_BORDER + 2 * FONTW, y0 + BOX_BORDER + FONTH, ""); -for (const char **str = help_text; *str; str++) - DrawScreenText (-1, -1, *str); -set_colour (YELLOW); -DrawScreenText (-1, -1, "Press any key to return to the editor..."); -get_key_or_click (); -ShowMousePointer (); + int x0; + int y0; + int width; + int height; + size_t maxlen = 0; + int lines = 4; + + for (const char **str = help_text; *str; str++) + { + size_t len = strlen (*str); + maxlen = y_max (maxlen, len); + lines++; + } + width = (maxlen + 4) * FONTW + 2 * BOX_BORDER; + height = lines * FONTH + 2 * BOX_BORDER; + x0 = (ScrMaxX + 1 - width) / 2; + y0 = (ScrMaxY + 1 - height) / 2; + HideMousePointer (); + /* put in the instructions */ + DrawScreenBox3D (x0, y0, x0 + width - 1, y0 + height - 1); + set_colour (LIGHTCYAN); + DrawScreenText (x0 + BOX_BORDER + (width - 5 * FONTW) / 2, + y0 + BOX_BORDER + FONTH / 2, + "Yadex"); + set_colour (WINFG); + DrawScreenText (x0 + BOX_BORDER + 2 * FONTW, y0 + BOX_BORDER + FONTH, ""); + for (const char **str = help_text; *str; str++) + DrawScreenText (-1, -1, *str); + set_colour (YELLOW); + DrawScreenText (-1, -1, "Press any key to return to the editor..."); + get_key_or_click (); + ShowMousePointer (); } @@ -121,49 +122,57 @@ */ void about_yadex () { -int width = 2 * BOX_BORDER + 2 * WIDE_HSPACING + 42 * FONTW; -int height = 2 * BOX_BORDER + 2 * WIDE_VSPACING + 22 * FONTH; -int x0 = (ScrMaxX + 1 - width) / 2; -int y0 = (ScrMaxY + 1 - height) / 2; - -HideMousePointer (); -DrawScreenBox3D (x0, y0, x0 + width - 1, y0 + height - 1); -push_colour (WINFG); -push_colour (WINFG_HL); -DrawScreenText (x0 + BOX_BORDER + WIDE_HSPACING, - y0 + BOX_BORDER + WIDE_VSPACING, what ()); -pop_colour (); -DrawScreenText (-1, -1, ""); -DrawScreenText (-1, -1, "Copyright © 1997-2000 André Majorel"); -DrawScreenText (-1, -1, "Yadex is derived from DEU 5.21 by"); -DrawScreenText (-1, -1, "Raphaël Quinet and Brendon Wyber."); -DrawScreenText (-1, -1, ""); -push_colour (WINFG_HL); -DrawScreenText (-1, -1, "Home page :"); -pop_colour (); -DrawScreenText (-1, -1, "http://www.teaser.fr/~amajorel/yadex/"); -DrawScreenText (-1, -1, "http://www.linuxgames.com/yadex/"); -DrawScreenText (-1, -1, ""); -push_colour (WINFG_HL); -DrawScreenText (-1, -1, "Mailing lists :"); -pop_colour (); -DrawScreenText (-1, -1, "yadex@middleearth.telefragged.com"); -DrawScreenText (-1, -1, "yadex-announce@middleearth.telefragged.com"); -DrawScreenText (-1, -1, "To subscribe, send mail with the"); -DrawScreenText (-1, -1, "subject \"subscribe \""); -DrawScreenText (-1, -1, "to listar@middleearth.telefragged.com"); -DrawScreenText (-1, -1, ""); -push_colour (WINFG_HL); -DrawScreenText (-1, -1, "Maintainer :"); -pop_colour (); -DrawScreenText (-1, -1, "André Majorel "); -DrawScreenText (-1, -1, ""); -DrawScreenText (-1, -1, ""); -set_colour (YELLOW); -DrawScreenText (-1, -1, "Press any key to return to the editor..."); -pop_colour (); -get_key_or_click (); -ShowMousePointer (); + int widthc = 57; + int heightc = 19; + + for (const char *const *s = yadex_copyright; *s != 0; s++) + { + if (strlen (*s) > size_t (widthc)) + widthc = strlen (*s); + heightc++; + } + int width = 2 * BOX_BORDER + 2 * WIDE_HSPACING + widthc * FONTW; + int height = 2 * BOX_BORDER + 2 * WIDE_VSPACING + heightc * FONTH; + int x0 = (ScrMaxX + 1 - width) / 2; + int y0 = (ScrMaxY + 1 - height) / 2; + + HideMousePointer (); + DrawScreenBox3D (x0, y0, x0 + width - 1, y0 + height - 1); + push_colour (WINFG); + push_colour (WINFG_HL); + DrawScreenText (x0 + BOX_BORDER + WIDE_HSPACING, + y0 + BOX_BORDER + WIDE_VSPACING, what ()); + pop_colour (); + DrawScreenText (-1, -1, ""); + for (const char *const *s = yadex_copyright; *s != 0; s++) + DrawScreenText (-1, -1, *s); + DrawScreenText (-1, -1, ""); + push_colour (WINFG_HL); + DrawScreenText (-1, -1, "Home page :"); + pop_colour (); + DrawScreenText (-1, -1, "http://www.teaser.fr/~amajorel/yadex/"); + DrawScreenText (-1, -1, "http://www.linuxgames.com/yadex/"); + DrawScreenText (-1, -1, ""); + push_colour (WINFG_HL); + DrawScreenText (-1, -1, "Mailing lists :"); + pop_colour (); + DrawScreenText (-1, -1, "you-know-what@freelists.org"); + DrawScreenText (-1, -1, "you-know-what-announce@freelists.org"); + DrawScreenText (-1, -1, "To subscribe, send mail with the subject"); + DrawScreenText (-1, -1, "\"subscribe \" to ecartis@freelists.org."); + DrawScreenText (-1, -1, ""); + push_colour (WINFG_HL); + DrawScreenText (-1, -1, "Maintainer :"); + pop_colour (); + DrawScreenText (-1, -1, "André Majorel (http://www.teaser.fr/~amajorel/)"); + DrawScreenText (-1, -1, "Send all email to you-know-what@freelists.org, NOT to me."); + DrawScreenText (-1, -1, ""); + DrawScreenText (-1, -1, ""); + set_colour (YELLOW); + DrawScreenText (-1, -1, "Press any key to return to the editor..."); + pop_colour (); + get_key_or_click (); + ShowMousePointer (); } diff -uaNr yadex-1.5.2/src/highlt.cc yadex-1.6.0/src/highlt.cc --- yadex-1.5.2/src/highlt.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/highlt.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -29,33 +29,33 @@ #include "yadex.h" #include "highlt.h" +#include "objects.h" +#include "objid.h" highlight_c::highlight_c (void) { -obj_no = OBJ_NO_NONE; -obj_no_disp = OBJ_NO_NONE; +obj.nil (); +obj_disp.nil (); } void highlight_c::draw (void) { -if (! is_obj (obj_no_disp) && is_obj (obj_no)) +if (! obj_disp () && obj ()) { - HighlightObject (obj_type, obj_no, YELLOW); - obj_no_disp = obj_no; - obj_type_disp = obj_type; + HighlightObject (obj.type, obj.num, YELLOW); + obj_disp = obj; } } void highlight_c::undraw (void) { -if (is_obj (obj_no_disp) - && (obj_no_disp != obj_no || obj_type_disp != obj_type)) +if (obj_disp () && ! (obj_disp == obj)) { - HighlightObject (obj_type_disp, obj_no_disp, YELLOW); - obj_no_disp = OBJ_NO_NONE; + HighlightObject (obj_disp.type, obj_disp.num, YELLOW); + obj_disp.nil (); } } diff -uaNr yadex-1.5.2/src/highlt.h yadex-1.6.0/src/highlt.h --- yadex-1.5.2/src/highlt.h 2000-01-10 14:40:12.000000000 +0100 +++ yadex-1.6.0/src/highlt.h 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -28,38 +28,25 @@ #include "edwidget.h" +#include "objid.h" class highlight_c : public edwidget_c { public : highlight_c (void); - void set (int obj_type, int obj_no) - { - this->obj_type = obj_type; - this->obj_no = obj_no; - } + void set (Objid& obj) { this->obj = obj; } /* Methods declared in edwidget */ - void unset () - { obj_no = OBJ_NO_NONE; } - + void unset () { obj.nil (); } void draw (); void undraw (); - - int can_undraw () - { return 1; } // I have the ability to undraw myself. - - int need_to_clear () - { return 0; } // I know how to undraw myself. - - void clear () - { obj_no_disp = OBJ_NO_NONE; } + int can_undraw () { return 1; } // I have the ability to undraw myself. + int need_to_clear () { return 0; } // I know how to undraw myself. + void clear () { obj_disp.nil (); } private : - int obj_no; /* The no. of the object we should highlight */ - int obj_type; /* The type of the object we should highlight */ - int obj_no_disp; /* The no. of the object that is really highlighted */ - int obj_type_disp; /* The type of the object that is really highlighted */ + Objid obj; // The object we should highlight + Objid obj_disp; // The object that is really highlighted }; diff -uaNr yadex-1.5.2/src/img.cc yadex-1.6.0/src/img.cc --- yadex-1.5.2/src/img.cc 2000-08-11 00:35:47.000000000 +0200 +++ yadex-1.6.0/src/img.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -28,19 +28,22 @@ #include "yadex.h" -#include "gcolour2.h" /* colour0 */ +#include "help1.h" #include "img.h" +#include "wadfile.h" +#include "wads.h" // Holds the private data members class Img_priv { public: - Img_priv () { buf = 0; width = 0; height = 0; } + Img_priv () { buf = 0; width = 0; height = 0; opaque = false; } ~Img_priv () { if (buf != 0) delete[] buf; } img_pixel_t *buf; img_dim_t width; img_dim_t height; + bool opaque; }; @@ -60,10 +63,11 @@ * * The new image is set to the specified dimensions. */ -Img::Img (img_dim_t width, img_dim_t height) +Img::Img (img_dim_t width, img_dim_t height, bool opaque) { p = new Img_priv; resize (width, height); + set_opaque (opaque); } @@ -140,6 +144,15 @@ /* + * Img::set_opaque - set or clear the opaque flag + */ +void Img::set_opaque (bool opaque) +{ + p->opaque = opaque; +} + + +/* * Img::resize - resize the image * * If either dimension is zero, the image becomes a null @@ -147,9 +160,7 @@ */ void Img::resize (img_dim_t width, img_dim_t height) { - // FIXME should check that the width and height are valid. - if (width == p->width && height == p->height - || width * height == p->width * p->height) + if (width == p->width && height == p->height) return; // Unallocate old buffer @@ -175,3 +186,86 @@ } +/* + * Img::save - save an image to file in packed PPM format + * + * Return 0 on success, non-zero on failure + * + * If an error occurs, errno is set to: + * - ECHILD if PLAYPAL could not be loaded + * - whatever fopen() or fclose() set it to + */ +int Img::save (const char *filename) const +{ + int rc = 0; + FILE *fp = 0; + + // Load palette 0 from PLAYPAL + MDirPtr dir = FindMasterDir (MasterDir, "PLAYPAL"); + if (dir == 0) + { + errno = ECHILD; + return 1; + } + unsigned char *pal = new unsigned char[768]; + dir->wadfile->seek (dir->dir.start); + if (dir->wadfile->error ()) + { + /*warn ("%s: can't seek to %lXh\n", + dir->wadfile->filename, (unsigned long) ftell (dir->wadfile->fp)); + warn ("PLAYPAL: seek error\n");*/ + rc = 1; + errno = ECHILD; + goto byebye; + } + dir->wadfile->read_bytes (pal, 768); + if (dir->wadfile->error ()) + { + /*warn ("%s: read error", dir->wadfile->where ()); + warn ("PLAYPAL: read error\n");*/ + rc = 1; + errno = ECHILD; + goto byebye; + } + + // Create PPM file + fp = fopen (filename, "wb"); + if (fp == NULL) + { + rc = 1; + goto byebye; + } + fputs ("P6\n", fp); + fprintf (fp, "# %s\n", what ()); + fprintf (fp, "%d %d 255\n", p->width, p->height); + { + const img_pixel_t *pix = p->buf; + const img_pixel_t *pixmax = pix + (unsigned long) p->width * p->height; + for (; pix < pixmax; pix++) + { + if (*pix == IMG_TRANSP && ! p->opaque) + { + putc ( 0, fp); // DeuTex convention, rgb:0/2f/2f + putc (47, fp); + putc (47, fp); + } + else + { + putc (pal[3 * *pix ], fp); + putc (pal[3 * *pix + 1], fp); + putc (pal[3 * *pix + 2], fp); + } + } + } + if (ferror (fp)) + rc = 1; + +byebye: + if (fp != 0) + if (fclose (fp)) + rc = 1; + delete[] pal; + return rc; +} + + diff -uaNr yadex-1.5.2/src/img.h yadex-1.6.0/src/img.h --- yadex-1.5.2/src/img.h 2000-08-11 00:46:48.000000000 +0200 +++ yadex-1.6.0/src/img.h 2001-10-11 11:05:45.000000000 +0200 @@ -23,18 +23,21 @@ { public : Img (); - Img (img_dim_t width, img_dim_t height); + Img (img_dim_t width, img_dim_t height, bool opaque); ~Img (); - bool is_null () const; // Is it a null image ? - img_dim_t width () const; // Return the width - img_dim_t height () const; // Return the height - const img_pixel_t *buf () const; // Return pointer on buffer - img_pixel_t *wbuf (); // Return pointer on buffer - // Set the width and height - void clear (); - void resize (img_dim_t width, img_dim_t height); + bool is_null () const; // Is it a null image ? + img_dim_t width () const; // Return the width + img_dim_t height () const; // Return the height + const img_pixel_t *buf () const; // Return pointer on buffer + img_pixel_t *wbuf (); // Return pointer on buffer + void clear (); + void set_opaque (bool opaque); + void resize (img_dim_t width, img_dim_t height); + int save (const char *filename) const; private : + Img (const Img&); // Too lazy to implement it + Img& operator= (const Img&); // Too lazy to implement it Img_priv *p; }; diff -uaNr yadex-1.5.2/src/imgscale.cc yadex-1.6.0/src/imgscale.cc --- yadex-1.5.2/src/imgscale.cc 2000-07-09 14:56:47.000000000 +0200 +++ yadex-1.6.0/src/imgscale.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/imgspect.cc yadex-1.6.0/src/imgspect.cc --- yadex-1.5.2/src/imgspect.cc 2000-08-10 23:34:49.000000000 +0200 +++ yadex-1.6.0/src/imgspect.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/infobar.cc yadex-1.6.0/src/infobar.cc --- yadex-1.5.2/src/infobar.cc 2000-07-09 15:46:57.000000000 +0200 +++ yadex-1.6.0/src/infobar.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -41,6 +41,7 @@ #include "yadex.h" #include "gfx.h" #include "infobar.h" +#include "objid.h" const char infobar_c::FILE_NAME_UNSET[1] = { ' ' }; // A special pointer value diff -uaNr yadex-1.5.2/src/infobar.h yadex-1.6.0/src/infobar.h --- yadex-1.5.2/src/infobar.h 2000-01-10 14:40:12.000000000 +0100 +++ yadex-1.6.0/src/infobar.h 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/input.cc yadex-1.6.0/src/input.cc --- yadex-1.5.2/src/input.cc 2000-05-17 00:12:21.000000000 +0200 +++ yadex-1.6.0/src/input.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -28,8 +28,8 @@ */ -#ifdef Y_X11 #include "yadex.h" +#ifdef Y_X11 #include // nanosleep () #include #include // XLookupString @@ -84,15 +84,15 @@ */ void init_input_status () { -is.in_window = 0; -is.width = -1; -is.height = 0; -is.butl = 0; -is.butm = 0; -is.butr = 0; -is.shift = 0; -is.ctrl = 0; -is.alt = 0; +is.in_window = 0; +is.width = -1; +is.height = 0; +is.butl = 0; +is.butm = 0; +is.butr = 0; +is.shift = 0; +is.ctrl = 0; +is.alt = 0; is.scroll_lock = 0; } @@ -104,7 +104,7 @@ typedef struct { KeySym ks; - int key; + inpev_t key; } key_info_t; static const key_info_t key_info[] = { @@ -130,8 +130,12 @@ { XK_Insert, YK_INS, }, { XK_Left, YK_LEFT, }, { XK_Linefeed, YK_RETURN, }, +#ifdef XK_Page_Down /* HP-UX 10 doesn't have XK_Page_Down */ { XK_Page_Down, YK_PD, }, +#endif +#ifdef XK_Page_Up /* HP-UX 10 doesn't have XK_Page_Up */ { XK_Page_Up, YK_PU, }, +#endif { XK_Return, YK_RETURN, }, { XK_Right, YK_RIGHT, }, { XK_Tab, YK_TAB, }, @@ -213,8 +217,11 @@ is.key = YE_ENTER; is.time = ev.xcrossing.time; is.in_window = 1; - is.x = ev.xcrossing.x; - is.y = ev.xcrossing.y; + // Sanity + if (ev.xcrossing.x < 0) nf_bug ("xcrossing.x < 0"); // Paranoia + if (ev.xcrossing.y < 0) nf_bug ("xcrossing.y < 0"); // Paranoia + is.x = ev.xcrossing.x; + is.y = ev.xcrossing.y; break; case LeaveNotify : is.key = YE_LEAVE; @@ -225,8 +232,10 @@ case MotionNotify : is.key = YE_MOTION; is.time = ev.xmotion.time; - is.x = ev.xmotion.x; - is.y = ev.xmotion.y; + if (ev.xmotion.x < 0) nf_bug ("xmotion.x < 0"); // Paranoia + if (ev.xmotion.y < 0) nf_bug ("xmotion.y < 0"); // Paranoia + is.x = ev.xmotion.x; + is.y = ev.xmotion.y; #ifdef DEBUG { static bool first_time = true; @@ -378,7 +387,7 @@ #if 0 if (ev.type == KeyPress) { - printf ("key=%04Xh", is.key); + printf ("key=%04hXh", is.key); if (is.key >= 0 && is.key <= UCHAR_MAX && isprint (is.key)) printf (" (%c)", (char) is.key); putchar ('\n'); @@ -458,7 +467,7 @@ */ typedef struct { - int key; + inpev_t key; const char *string; } key_string_t; static const key_string_t key_string[] = @@ -491,7 +500,7 @@ { YK_UP, "Up" }, }; -const char *key_to_string (int k) +const char *key_to_string (inpev_t k) { static char buf[51]; @@ -503,12 +512,12 @@ break; *buf = '\0'; -if (k & YK_CTRL || (n == nmax && k >= 0 && k <= 31)) +if (k & YK_CTRL || (n == nmax && k <= 31)) { al_saps (buf, "Ctrl-", sizeof buf - 1); if (k & YK_CTRL) k ^= YK_CTRL; - if (k >= 0 && k <= 31) + if (k <= 31) k += 96; // Heavy ASCII-ism : 01h (^A) -> 61h ("a") } if (k & YK_ALT) @@ -523,7 +532,7 @@ } if (n == nmax) - if (k >= 0 && k <= UCHAR_MAX && isprint (k)) + if (k <= UCHAR_MAX && isprint (k)) al_sapc (buf, k, sizeof buf - 1); else { diff -uaNr yadex-1.5.2/src/input.h yadex-1.6.0/src/input.h --- yadex-1.5.2/src/input.h 2000-01-10 14:40:12.000000000 +0100 +++ yadex-1.6.0/src/input.h 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -28,26 +28,27 @@ */ +typedef unsigned short inpev_t; typedef struct { - /* Window events */ - int width; /* New window width */ - int height; /* New window height */ - /* Mouse events */ - char in_window; /* <>0 iff mouse pointer is in window */ - char butl; /* <>0 iff left mouse button is depressed */ - char butm; /* <>0 iff middle mouse button is depressed */ - char butr; /* <>0 iff right mouse button is depressed */ - int x; /* Mouse pointer position */ - int y; - /* Keyboard */ - char shift; /* <>0 iff either [Shift] is pressed */ - char ctrl; /* <>0 iff either [Ctrl] is pressed */ - char alt; /* <>0 iff either [Alt]/[Meta] is pressed */ - char scroll_lock; /* Always 0 for the moment */ - /* General */ - int key; /* Code of key just pressed (ASCII + YK_*) */ - unsigned long time; /* Date of event in ms (1) */ + // Window events + int width; // New window width + int height; // New window height + // Mouse events + char in_window; // <>0 iff mouse pointer is in window + char butl; // <>0 iff left mouse button is depressed + char butm; // <>0 iff middle mouse button is depressed + char butr; // <>0 iff right mouse button is depressed + int x; // Mouse pointer position + int y; + // Keyboard + char shift; // <>0 iff either [Shift] is pressed + char ctrl; // <>0 iff either [Ctrl] is pressed + char alt; // <>0 iff either [Alt]/[Meta] is pressed + char scroll_lock; // Always 0 for the moment + // General + inpev_t key; // Code of last event (key, mouse, resize, expose...) + unsigned long time; // Date of event in ms (1) } input_status_t; /* Notes: @@ -55,59 +56,60 @@ enter and leave. */ -/* Event and key codes */ -enum - { - YK_BACKSPACE = '\b', - YK_TAB = '\t', - YK_RETURN = '\r', - YK_ESC = 0x1b, - YK_DEL = 0x7f, - YK_ = 256, - YK_BACKTAB, - YK_DOWN, - YK_END, - YK_F1, - YK_F2, - YK_F3, - YK_F4, - YK_F5, - YK_F6, - YK_F7, - YK_F8, - YK_F9, - YK_F10, - YK_HOME, - YK_INS, - YK_LEFT, - YK_PU, - YK_PD, - YK_RIGHT, - YK_UP, - YK__LAST, // Marks the end of key events - // Those are not key numbers but window events - YE_RESIZE, - YE_EXPOSE, - // Those are not key numbers but mouse events - YE_BUTL_PRESS, - YE_BUTL_RELEASE, - YE_BUTM_PRESS, - YE_BUTM_RELEASE, - YE_BUTR_PRESS, - YE_BUTR_RELEASE, - YE_WHEEL_UP, // Negative movement, normally bound to button 4 - YE_WHEEL_DOWN, // Positive movement, normally bound to button 5 - YE_ENTER, - YE_LEAVE, - YE_MOTION, - // Those are not key numbers but application - // events (i.e. generated internally) - YE_ZOOM_CHANGED, - // Those are ORed with the other key numbers : - YK_SHIFT = 0x2000, - YK_CTRL = 0X4000, - YK_ALT = 0x8000 - }; +/* Events and key codes */ +const inpev_t YK_BACKSPACE = '\b'; +const inpev_t YK_TAB = '\t'; +const inpev_t YK_RETURN = '\r'; +const inpev_t YK_ESC = 0x1b; +const inpev_t YK_DEL = 0x7f; +const inpev_t YK_ = 256; +const inpev_t YK_BACKTAB = 257; +const inpev_t YK_DOWN = 258; +const inpev_t YK_END = 259; +const inpev_t YK_F1 = 260; +const inpev_t YK_F2 = 261; +const inpev_t YK_F3 = 262; +const inpev_t YK_F4 = 263; +const inpev_t YK_F5 = 264; +const inpev_t YK_F6 = 265; +const inpev_t YK_F7 = 266; +const inpev_t YK_F8 = 267; +const inpev_t YK_F9 = 268; +const inpev_t YK_F10 = 269; +const inpev_t YK_HOME = 270; +const inpev_t YK_INS = 271; +const inpev_t YK_LEFT = 272; +const inpev_t YK_PU = 273; +const inpev_t YK_PD = 274; +const inpev_t YK_RIGHT = 275; +const inpev_t YK_UP = 276; +const inpev_t YK__LAST = 277; // Marks the end of key events + +// Those are not key numbers but window events +const inpev_t YE_RESIZE = 278; +const inpev_t YE_EXPOSE = 279; + +// Those are not key numbers but mouse events +const inpev_t YE_BUTL_PRESS = 280; +const inpev_t YE_BUTL_RELEASE = 281; +const inpev_t YE_BUTM_PRESS = 282; +const inpev_t YE_BUTM_RELEASE = 283; +const inpev_t YE_BUTR_PRESS = 284; +const inpev_t YE_BUTR_RELEASE = 285; +const inpev_t YE_WHEEL_UP = 286; // Negative, normally bound to button 4 +const inpev_t YE_WHEEL_DOWN = 287; // Positive, normally bound to button 5 +const inpev_t YE_ENTER = 288; +const inpev_t YE_LEAVE = 289; +const inpev_t YE_MOTION = 290; + +// Those are not key numbers but application events +// (i.e. generated internally) +const inpev_t YE_ZOOM_CHANGED = 291; + +// Those are ORed with the other key numbers : +const inpev_t YK_SHIFT = 0x2000; +const inpev_t YK_CTRL = 0X4000; +const inpev_t YK_ALT = 0x8000; /* Defined in input.c -- see the comment there */ extern input_status_t is; @@ -126,6 +128,6 @@ int have_key (); int get_key (); void get_key_or_click (); -const char *key_to_string (int k); +const char *key_to_string (inpev_t k); diff -uaNr yadex-1.5.2/src/l_align.cc yadex-1.6.0/src/l_align.cc --- yadex-1.5.2/src/l_align.cc 2000-05-13 00:09:18.000000000 +0200 +++ yadex-1.6.0/src/l_align.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -33,6 +33,7 @@ #include "entry.h" #include "gfx.h" #include "levels.h" +#include "objid.h" #include "oldmenus.h" #include "selectn.h" #include "textures.h" @@ -172,17 +173,17 @@ xoffset = 0; useroffset = 0; -switch (DisplayMenu (250, 110, "Aligning textures 'X' menu:", +switch (vDisplayMenu (250, 110, "Aligning textures (X offset) :", - " Sidedef 1, Check for identical textures. ", - " Sidedef 1, As above, but with inital offset. ", - " Sidedef 1, No texture checking. ", - " Sidedef 1, As above, but with inital offset. ", - - " Sidedef 2, Check for identical textures. ", - " Sidedef 2, As above, but with inital offset. ", - " Sidedef 2, No texture checking. ", - " Sidedef 2, As above, but with inital offset. ", + " Sidedef 1, Check for identical textures. ", YK_, 0, + " Sidedef 1, As above, but with inital offset. ", YK_, 0, + " Sidedef 1, No texture checking. ", YK_, 0, + " Sidedef 1, As above, but with inital offset. ", YK_, 0, + + " Sidedef 2, Check for identical textures. ", YK_, 0, + " Sidedef 2, As above, but with inital offset. ", YK_, 0, + " Sidedef 2, No texture checking. ", YK_, 0, + " Sidedef 2, As above, but with inital offset. ", YK_, 0, NULL)) { case 1: /* Sidedef 1 with checking for same textures */ diff -uaNr yadex-1.5.2/src/l_centre.cc yadex-1.6.0/src/l_centre.cc --- yadex-1.5.2/src/l_centre.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/l_centre.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/l_flags.cc yadex-1.6.0/src/l_flags.cc --- yadex-1.5.2/src/l_flags.cc 2000-04-27 23:01:05.000000000 +0200 +++ yadex-1.6.0/src/l_flags.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -40,29 +40,29 @@ */ void frob_linedefs_flags (SelPtr list, int op, int operand) { -SelPtr cur; -i16 mask; + SelPtr cur; + i16 mask; -if (op == YO_CLEAR || op == YO_SET || op == YO_TOGGLE) - mask = 1 << operand; -else - mask = operand; - -for (cur = list; cur; cur = cur->next) - { - if (op == YO_CLEAR) + if (op == YO_CLEAR || op == YO_SET || op == YO_TOGGLE) + mask = 1 << operand; + else + mask = operand; + + for (cur = list; cur; cur = cur->next) + { + if (op == YO_CLEAR) LineDefs[cur->objnum].flags &= ~mask; - else if (op == YO_SET) + else if (op == YO_SET) LineDefs[cur->objnum].flags |= mask; - else if (op == YO_TOGGLE) + else if (op == YO_TOGGLE) LineDefs[cur->objnum].flags ^= mask; - else - { + else + { nf_bug ("frob_linedef_flags: op=%02X", op); return; - } - } -MadeChanges = 1; + } + } + MadeChanges = 1; } diff -uaNr yadex-1.5.2/src/l_misc.cc yadex-1.6.0/src/l_misc.cc --- yadex-1.5.2/src/l_misc.cc 2000-05-07 14:36:39.000000000 +0200 +++ yadex-1.6.0/src/l_misc.cc 2003-03-28 13:37:32.000000000 +0100 @@ -11,7 +11,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -30,6 +30,8 @@ #include "yadex.h" #include "levels.h" +#include "objects.h" +#include "objid.h" #include "selectn.h" #include diff -uaNr yadex-1.5.2/src/l_prop.cc yadex-1.6.0/src/l_prop.cc --- yadex-1.5.2/src/l_prop.cc 2000-04-29 22:37:12.000000000 +0200 +++ yadex-1.6.0/src/l_prop.cc 2003-03-28 13:37:32.000000000 +0100 @@ -13,7 +13,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -34,6 +34,9 @@ #include "entry.h" #include "gfx.h" #include "levels.h" +#include "menudata.h" +#include "objects.h" +#include "objid.h" #include "oldmenus.h" #include "game.h" #include "selectn.h" @@ -41,224 +44,301 @@ /* + * Menu_data_ldt - Menu_data class for the linedef type + */ +class Menu_data_ldt : public Menu_data +{ + public : + Menu_data_ldt (al_llist_t *list); + virtual size_t nitems () const; + virtual const char *operator[] (size_t n) const; + + private : + mutable char buf[100]; + al_llist_t *list; +}; + + +/* + * Menu_data_ldt::Menu_data_ldt - ctor + */ +Menu_data_ldt::Menu_data_ldt (al_llist_t *list) : list (list) +{ + al_lrewind (this->list); +} + + +/* + * Menu_data_ldt::nitems - return the number of items + */ +size_t Menu_data_ldt::nitems () const +{ + return al_lcount (list); +} + + +/* + * Menu_data_ldt::operator[] - return the nth item + */ +const char *Menu_data_ldt::operator[] (size_t n) const +{ + if (al_lseek (list, n, SEEK_SET) != 0) + { + sprintf (buf, "BUG: al_lseek(%p, %lu): %s", + (void *) list, + (unsigned long) n, + al_astrerror (al_aerrno)); + return buf; + } + const ldtdef_t **pptr = (const ldtdef_t **) al_lptr (list); + if (pptr == NULL) + sprintf (buf, "BUG: al_lptr(%p): %s", + (void *) list, + al_astrerror (al_aerrno)); + else + sprintf (buf, "%3d - %.70s", (*pptr)->number, (*pptr)->longdesc); + return buf; +} + + +/* * Prototypes of private functions */ static char *GetTaggedLineDefFlag (int linedefnum, int flagndx); static int InputLinedefType (int x0, int y0, int *number); static const char *PrintLdtgroup (void *ptr); -static const char *PrintLdtdef (void *ptr); void LinedefProperties (int x0, int y0, SelPtr obj) { -char *menustr[8]; -char texname[WAD_TEX_NAME + 1]; -int n, val; -SelPtr cur, sdlist; -int objtype = OBJ_LINEDEFS; -int subwin_y0; -int subsubwin_y0; - -val = DisplayMenu (x0, y0, "Choose the object to edit:", - "Edit the linedef", - (LineDefs[obj->objnum].sidedef1 >= 0) ? "Edit the 1st sidedef" - : "Add a 1st sidedef", - (LineDefs[obj->objnum].sidedef2 >= 0) ? "Edit the 2nd sidedef" - : "Add a 2nd sidedef", - NULL); -subwin_y0 = y0 + BOX_BORDER + (2 + val) * FONTH; -switch (val) - { - case 1: + char *menustr[8]; + char texname[WAD_TEX_NAME + 1]; + int n, val; + SelPtr cur, sdlist; + int objtype = OBJ_LINEDEFS; + int subwin_y0; + int subsubwin_y0; + + { + bool sd1 = LineDefs[obj->objnum].sidedef1 >= 0; + bool sd2 = LineDefs[obj->objnum].sidedef2 >= 0; + val = vDisplayMenu (x0, y0, "Choose the object to edit:", + "Edit the linedef", YK_, 0, + sd1 ? "Edit the 1st sidedef" : "Add a 1st sidedef", YK_, 0, + sd2 ? "Edit the 2nd sidedef" : "Add a 2nd sidedef", YK_, 0, + NULL); + } + subwin_y0 = y0 + BOX_BORDER + (2 + val) * FONTH; + switch (val) + { + case 1: for (n = 0; n < 8; n++) - menustr[n] = (char *) GetMemory (60); + menustr[n] = (char *) GetMemory (60); sprintf (menustr[7], "Edit linedef #%d", obj->objnum); sprintf (menustr[0], "Change flags (Current: %d)", - LineDefs[obj->objnum].flags); + LineDefs[obj->objnum].flags); sprintf (menustr[1], "Change type (Current: %d)", - LineDefs[obj->objnum].type); + LineDefs[obj->objnum].type); sprintf (menustr[2], "Change sector tag (Current: %d)", - LineDefs[obj->objnum].tag); + LineDefs[obj->objnum].tag); sprintf (menustr[3], "Change starting vertex (Current: #%d)", - LineDefs[obj->objnum].start); + LineDefs[obj->objnum].start); sprintf (menustr[4], "Change ending vertex (Current: #%d)", - LineDefs[obj->objnum].end); + LineDefs[obj->objnum].end); sprintf (menustr[5], "Change 1st sidedef ref. (Current: #%d)", - LineDefs[obj->objnum].sidedef1); + LineDefs[obj->objnum].sidedef1); sprintf (menustr[6], "Change 2nd sidedef ref. (Current: #%d)", - LineDefs[obj->objnum].sidedef2); - val = DisplayMenuArray (x0 + 42, subwin_y0, menustr[7], 7, NULL, menustr, - NULL, NULL, NULL); + LineDefs[obj->objnum].sidedef2); + val = vDisplayMenu (x0 + 42, subwin_y0, menustr[7], + menustr[0], YK_, 0, + menustr[1], YK_, 0, + menustr[2], YK_, 0, + menustr[3], YK_, 0, + menustr[4], YK_, 0, + menustr[5], YK_, 0, + menustr[6], YK_, 0, + NULL); for (n = 0; n < 8; n++) - FreeMemory (menustr[n]); + FreeMemory (menustr[n]); subsubwin_y0 = subwin_y0 + BOX_BORDER + (2 + val) * FONTH; switch (val) - { - case 1: - val = DisplayMenu (x0 + 84, subsubwin_y0, "Toggle the flags:", - GetTaggedLineDefFlag (obj->objnum, 1), - GetTaggedLineDefFlag (obj->objnum, 2), - GetTaggedLineDefFlag (obj->objnum, 3), - GetTaggedLineDefFlag (obj->objnum, 4), - GetTaggedLineDefFlag (obj->objnum, 5), - GetTaggedLineDefFlag (obj->objnum, 6), - GetTaggedLineDefFlag (obj->objnum, 7), - GetTaggedLineDefFlag (obj->objnum, 8), - GetTaggedLineDefFlag (obj->objnum, 9), - GetTaggedLineDefFlag (obj->objnum, 10), - GetTaggedLineDefFlag (obj->objnum, 11), - GetTaggedLineDefFlag (obj->objnum, 12), - GetTaggedLineDefFlag (obj->objnum, 13), - GetTaggedLineDefFlag (obj->objnum, 14), - GetTaggedLineDefFlag (obj->objnum, 15), - GetTaggedLineDefFlag (obj->objnum, 16), - "(Enter a decimal value)", - NULL); - if (val >= 1 && val <= 16) - { - for (cur = obj; cur; cur = cur->next) - LineDefs[cur->objnum].flags ^= 0x01 << (val - 1); - MadeChanges = 1; - } - else if (val == 17) - { - val = InputIntegerValue (x0 + 126, subsubwin_y0 + 12 * FONTH, - 0, 65535, LineDefs[obj->objnum].flags); - if (val != IIV_CANCEL) - { - for (cur = obj; cur; cur = cur->next) - LineDefs[cur->objnum].flags = val; - MadeChanges = 1; - } - } - break; - case 2: - if (! InputLinedefType (x0, subsubwin_y0, &val)) - { - for (cur = obj; cur; cur = cur->next) - LineDefs[cur->objnum].type = val; - MadeChanges = 1; - } - break; - case 3: - val = InputIntegerValue (x0 + 84, subsubwin_y0, -32768, 32767, LineDefs[obj->objnum].tag); - if (val != IIV_CANCEL) /* not Esc */ - { - for (cur = obj; cur; cur = cur->next) - LineDefs[cur->objnum].tag = val; - MadeChanges = 1; - } - break; - case 4: - val = InputObjectXRef (x0 + 84, subsubwin_y0, OBJ_VERTICES, 0, LineDefs[obj->objnum].start); - if (val >= 0) - { - for (cur = obj; cur; cur = cur->next) - LineDefs[cur->objnum].start = val; - MadeChanges = 1; - MadeMapChanges = 1; - } - break; - case 5: - val = InputObjectXRef (x0 + 84, subsubwin_y0, OBJ_VERTICES, 0, LineDefs[obj->objnum].end); - if (val >= 0) - { - for (cur = obj; cur; cur = cur->next) - LineDefs[cur->objnum].end = val; - MadeChanges = 1; - MadeMapChanges = 1; - } - break; - case 6: - val = InputObjectXRef (x0 + 84, subsubwin_y0, OBJ_SIDEDEFS, 1, LineDefs[obj->objnum].sidedef1); - if (val >= -1) - { - for (cur = obj; cur; cur = cur->next) - LineDefs[cur->objnum].sidedef1 = val; - MadeChanges = 1; - MadeMapChanges = 1; - } - break; - case 7: - val = InputObjectXRef (x0 + 84, subsubwin_y0, OBJ_SIDEDEFS, 1, LineDefs[obj->objnum].sidedef2); - if (val >= -1) - { - for (cur = obj; cur; cur = cur->next) - LineDefs[cur->objnum].sidedef2 = val; - MadeChanges = 1; - MadeMapChanges = 1; - } - break; - } - break; + { + case 1: + val = vDisplayMenu (x0 + 84, subsubwin_y0, "Toggle the flags:", + GetTaggedLineDefFlag (obj->objnum, 1), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 2), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 3), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 4), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 5), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 6), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 7), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 8), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 9), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 10), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 11), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 12), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 13), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 14), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 15), YK_, 0, + GetTaggedLineDefFlag (obj->objnum, 16), YK_, 0, + "(Enter a decimal value)", YK_, 0, + NULL); + if (val >= 1 && val <= 16) + { + for (cur = obj; cur; cur = cur->next) + LineDefs[cur->objnum].flags ^= 0x01 << (val - 1); + MadeChanges = 1; + } + else if (val == 17) + { + val = InputIntegerValue (x0 + 126, subsubwin_y0 + 12 * FONTH, + 0, 65535, LineDefs[obj->objnum].flags); + if (val != IIV_CANCEL) + { + for (cur = obj; cur; cur = cur->next) + LineDefs[cur->objnum].flags = val; + MadeChanges = 1; + } + } + break; + + case 2: + if (! InputLinedefType (x0, subsubwin_y0, &val)) + { + for (cur = obj; cur; cur = cur->next) + LineDefs[cur->objnum].type = val; + MadeChanges = 1; + } + break; + + case 3: + val = InputIntegerValue (x0 + 84, subsubwin_y0, + -32768, 32767, LineDefs[obj->objnum].tag); + if (val != IIV_CANCEL) // Not [esc] + { + for (cur = obj; cur; cur = cur->next) + LineDefs[cur->objnum].tag = val; + MadeChanges = 1; + } + break; + + case 4: + val = InputObjectXRef (x0 + 84, subsubwin_y0, + OBJ_VERTICES, 0, LineDefs[obj->objnum].start); + if (val >= 0) + { + for (cur = obj; cur; cur = cur->next) + LineDefs[cur->objnum].start = val; + MadeChanges = 1; + MadeMapChanges = 1; + } + break; + + case 5: + val = InputObjectXRef (x0 + 84, subsubwin_y0, + OBJ_VERTICES, 0, LineDefs[obj->objnum].end); + if (val >= 0) + { + for (cur = obj; cur; cur = cur->next) + LineDefs[cur->objnum].end = val; + MadeChanges = 1; + MadeMapChanges = 1; + } + break; + + case 6: + val = InputObjectXRef (x0 + 84, subsubwin_y0, + OBJ_SIDEDEFS, 1, LineDefs[obj->objnum].sidedef1); + if (val >= -1) + { + for (cur = obj; cur; cur = cur->next) + LineDefs[cur->objnum].sidedef1 = val; + MadeChanges = 1; + MadeMapChanges = 1; + } + break; + + case 7: + val = InputObjectXRef (x0 + 84, subsubwin_y0, + OBJ_SIDEDEFS, 1, LineDefs[obj->objnum].sidedef2); + if (val >= -1) + { + for (cur = obj; cur; cur = cur->next) + LineDefs[cur->objnum].sidedef2 = val; + MadeChanges = 1; + MadeMapChanges = 1; + } + break; + } + break; - /* edit or add the first sidedef */ - case 2: + // Edit or add the first sidedef + case 2: ObjectsNeeded (OBJ_LINEDEFS, OBJ_SIDEDEFS, 0); if (LineDefs[obj->objnum].sidedef1 >= 0) - { - /* build a new selection list with the first SideDefs */ - objtype = OBJ_SIDEDEFS; - sdlist = 0; - for (cur = obj; cur; cur = cur->next) - if (LineDefs[cur->objnum].sidedef1 >= 0) - SelectObject (&sdlist, LineDefs[cur->objnum].sidedef1); - } + { + // Build a new selection list with the first sidedefs + objtype = OBJ_SIDEDEFS; + sdlist = 0; + for (cur = obj; cur; cur = cur->next) + if (LineDefs[cur->objnum].sidedef1 >= 0) + SelectObject (&sdlist, LineDefs[cur->objnum].sidedef1); + } else - { - /* add a new first sidedef */ - for (cur = obj; cur; cur = cur->next) - if (LineDefs[cur->objnum].sidedef1 == -1) - { - InsertObject (OBJ_SIDEDEFS, -1, 0, 0); - LineDefs[cur->objnum].sidedef1 = NumSideDefs - 1; - } - break; - } - /* FALL THROUGH */ + { + // Add a new first sidedef + for (cur = obj; cur; cur = cur->next) + if (LineDefs[cur->objnum].sidedef1 == -1) + { + InsertObject (OBJ_SIDEDEFS, -1, 0, 0); + LineDefs[cur->objnum].sidedef1 = NumSideDefs - 1; + } + break; + } + // FALL THROUGH - /* edit or add the second sidedef */ - case 3: + // Edit or add the second sidedef + case 3: if (objtype != OBJ_SIDEDEFS) - { - if (LineDefs[obj->objnum].sidedef2 >= 0) + { + if (LineDefs[obj->objnum].sidedef2 >= 0) + { + // Build a new selection list with the second (or first) SideDefs + objtype = OBJ_SIDEDEFS; + sdlist = 0; + for (cur = obj; cur; cur = cur->next) + if (LineDefs[cur->objnum].sidedef2 >= 0) + SelectObject (&sdlist, LineDefs[cur->objnum].sidedef2); + else if (LineDefs[cur->objnum].sidedef1 >= 0) + SelectObject (&sdlist, LineDefs[cur->objnum].sidedef1); + } + else + { + // Add a new second (or first) sidedef + for (cur = obj; cur; cur = cur->next) + if (LineDefs[cur->objnum].sidedef1 == -1) { - /* build a new selection list with the second (or first) SideDefs */ - objtype = OBJ_SIDEDEFS; - sdlist = 0; - for (cur = obj; cur; cur = cur->next) - if (LineDefs[cur->objnum].sidedef2 >= 0) - SelectObject (&sdlist, LineDefs[cur->objnum].sidedef2); - else if (LineDefs[cur->objnum].sidedef1 >= 0) - SelectObject (&sdlist, LineDefs[cur->objnum].sidedef1); + InsertObject (OBJ_SIDEDEFS, -1, 0, 0); + ObjectsNeeded (OBJ_LINEDEFS, 0); + LineDefs[cur->objnum].sidedef1 = NumSideDefs - 1; } - else + else if (LineDefs[cur->objnum].sidedef2 == -1) { - /* add a new second (or first) sidedef */ - for (cur = obj; cur; cur = cur->next) - if (LineDefs[cur->objnum].sidedef1 == -1) - { - InsertObject (OBJ_SIDEDEFS, -1, 0, 0); - ObjectsNeeded (OBJ_LINEDEFS, 0); - LineDefs[cur->objnum].sidedef1 = NumSideDefs - 1; - } - else if (LineDefs[cur->objnum].sidedef2 == -1) - { - n = LineDefs[cur->objnum].sidedef1; - InsertObject (OBJ_SIDEDEFS, -1, 0, 0); - strncpy (SideDefs[NumSideDefs - 1].tex3, "-", WAD_TEX_NAME); - strncpy (SideDefs[n].tex3, "-", WAD_TEX_NAME); - ObjectsNeeded (OBJ_LINEDEFS, 0); - LineDefs[cur->objnum].sidedef2 = NumSideDefs - 1; - LineDefs[cur->objnum].flags ^= 4; // Set the 2S bit - LineDefs[cur->objnum].flags &= ~1; // Clear the Im bit - } - break; + n = LineDefs[cur->objnum].sidedef1; + InsertObject (OBJ_SIDEDEFS, -1, 0, 0); + strncpy (SideDefs[NumSideDefs - 1].tex3, "-", WAD_TEX_NAME); + strncpy (SideDefs[n].tex3, "-", WAD_TEX_NAME); + ObjectsNeeded (OBJ_LINEDEFS, 0); + LineDefs[cur->objnum].sidedef2 = NumSideDefs - 1; + LineDefs[cur->objnum].flags ^= 4; // Set the 2S bit + LineDefs[cur->objnum].flags &= ~1; // Clear the Im bit } - } + break; + } + } ObjectsNeeded (OBJ_SIDEDEFS, 0); for (n = 0; n < 7; n++) - menustr[n] = (char *) GetMemory (60); + menustr[n] = (char *) GetMemory (60); sprintf (menustr[6], "Edit sidedef #%d", sdlist->objnum); texname[WAD_TEX_NAME] = '\0'; strncpy (texname, SideDefs[sdlist->objnum].tex3, WAD_TEX_NAME); @@ -268,95 +348,108 @@ strncpy (texname, SideDefs[sdlist->objnum].tex2, WAD_TEX_NAME); sprintf (menustr[2], "Change lower texture (Current: %s)", texname); sprintf (menustr[3], "Change texture X offset (Current: %d)", - SideDefs[sdlist->objnum].xoff); + SideDefs[sdlist->objnum].xoff); sprintf (menustr[4], "Change texture Y offset (Current: %d)", - SideDefs[sdlist->objnum].yoff); + SideDefs[sdlist->objnum].yoff); sprintf (menustr[5], "Change sector ref. (Current: #%d)", - SideDefs[sdlist->objnum].sector); - val = DisplayMenuArray (x0 + 42, subwin_y0, - menustr[6], 6, NULL, menustr, NULL, NULL, NULL); + SideDefs[sdlist->objnum].sector); + val = vDisplayMenu (x0 + 42, subwin_y0, menustr[6], + menustr[0], YK_, 0, + menustr[1], YK_, 0, + menustr[2], YK_, 0, + menustr[3], YK_, 0, + menustr[4], YK_, 0, + menustr[5], YK_, 0, + NULL); for (n = 0; n < 7; n++) - FreeMemory (menustr[n]); + FreeMemory (menustr[n]); subsubwin_y0 = subwin_y0 + BOX_BORDER + (2 + val) * FONTH; switch (val) - { - case 1: - strncpy (texname, SideDefs[sdlist->objnum].tex3, WAD_TEX_NAME); - ObjectsNeeded (0); - ChooseWallTexture (x0 + 84, subsubwin_y0 , - "Choose a wall texture", NumWTexture, WTexture, texname); - ObjectsNeeded (OBJ_SIDEDEFS, 0); - if (strlen (texname) > 0) - { - for (cur = sdlist; cur; cur = cur->next) - if (cur->objnum >= 0) - strncpy (SideDefs[cur->objnum].tex3, texname, WAD_TEX_NAME); - MadeChanges = 1; - } - break; - case 2: - strncpy (texname, SideDefs[sdlist->objnum].tex1, WAD_TEX_NAME); - ObjectsNeeded (0); - ChooseWallTexture (x0 + 84, subsubwin_y0, - "Choose a wall texture", NumWTexture, WTexture, texname); - ObjectsNeeded (OBJ_SIDEDEFS, 0); - if (strlen (texname) > 0) - { - for (cur = sdlist; cur; cur = cur->next) - if (cur->objnum >= 0) - strncpy (SideDefs[cur->objnum].tex1, texname, WAD_TEX_NAME); - MadeChanges = 1; - } - break; - case 3: - strncpy (texname, SideDefs[sdlist->objnum].tex2, WAD_TEX_NAME); - ObjectsNeeded (0); - ChooseWallTexture (x0 + 84, subsubwin_y0, - "Choose a wall texture", NumWTexture, WTexture, texname); - ObjectsNeeded (OBJ_SIDEDEFS, 0); - if (strlen (texname) > 0) - { - for (cur = sdlist; cur; cur = cur->next) - if (cur->objnum >= 0) - strncpy (SideDefs[cur->objnum].tex2, texname, WAD_TEX_NAME); - MadeChanges = 1; - } - break; - case 4: - val = InputIntegerValue (x0 + 84, subsubwin_y0, -32768, 32767, SideDefs[sdlist->objnum].xoff); - if (val != IIV_CANCEL) - { - for (cur = sdlist; cur; cur = cur->next) - if (cur->objnum >= 0) - SideDefs[cur->objnum].xoff = val; - MadeChanges = 1; - } - break; - case 5: - val = InputIntegerValue (x0 + 84, subsubwin_y0, -32768, 32767, SideDefs[sdlist->objnum].yoff); - if (val != IIV_CANCEL) - { - for (cur = sdlist; cur; cur = cur->next) - if (cur->objnum >= 0) - SideDefs[cur->objnum].yoff = val; - MadeChanges = 1; - } - break; - case 6: - val = InputObjectXRef (x0 + 84, subsubwin_y0, OBJ_SECTORS, 0, SideDefs[sdlist->objnum].sector); - if (val >= 0) - { - for (cur = sdlist; cur; cur = cur->next) - if (cur->objnum >= 0) - SideDefs[cur->objnum].sector = val; - MadeChanges = 1; - } - break; - } + { + case 1: + strncpy (texname, SideDefs[sdlist->objnum].tex3, WAD_TEX_NAME); + ObjectsNeeded (0); + ChooseWallTexture (x0 + 84, subsubwin_y0 , + "Choose a wall texture", NumWTexture, WTexture, texname); + ObjectsNeeded (OBJ_SIDEDEFS, 0); + if (strlen (texname) > 0) + { + for (cur = sdlist; cur; cur = cur->next) + if (cur->objnum >= 0) + strncpy (SideDefs[cur->objnum].tex3, texname, WAD_TEX_NAME); + MadeChanges = 1; + } + break; + + case 2: + strncpy (texname, SideDefs[sdlist->objnum].tex1, WAD_TEX_NAME); + ObjectsNeeded (0); + ChooseWallTexture (x0 + 84, subsubwin_y0, + "Choose a wall texture", NumWTexture, WTexture, texname); + ObjectsNeeded (OBJ_SIDEDEFS, 0); + if (strlen (texname) > 0) + { + for (cur = sdlist; cur; cur = cur->next) + if (cur->objnum >= 0) + strncpy (SideDefs[cur->objnum].tex1, texname, WAD_TEX_NAME); + MadeChanges = 1; + } + break; + + case 3: + strncpy (texname, SideDefs[sdlist->objnum].tex2, WAD_TEX_NAME); + ObjectsNeeded (0); + ChooseWallTexture (x0 + 84, subsubwin_y0, + "Choose a wall texture", NumWTexture, WTexture, texname); + ObjectsNeeded (OBJ_SIDEDEFS, 0); + if (strlen (texname) > 0) + { + for (cur = sdlist; cur; cur = cur->next) + if (cur->objnum >= 0) + strncpy (SideDefs[cur->objnum].tex2, texname, WAD_TEX_NAME); + MadeChanges = 1; + } + break; + + case 4: + val = InputIntegerValue (x0 + 84, subsubwin_y0, + -32768, 32767, SideDefs[sdlist->objnum].xoff); + if (val != IIV_CANCEL) + { + for (cur = sdlist; cur; cur = cur->next) + if (cur->objnum >= 0) + SideDefs[cur->objnum].xoff = val; + MadeChanges = 1; + } + break; + + case 5: + val = InputIntegerValue (x0 + 84, subsubwin_y0, + -32768, 32767, SideDefs[sdlist->objnum].yoff); + if (val != IIV_CANCEL) + { + for (cur = sdlist; cur; cur = cur->next) + if (cur->objnum >= 0) + SideDefs[cur->objnum].yoff = val; + MadeChanges = 1; + } + break; + + case 6: + val = InputObjectXRef (x0 + 84, subsubwin_y0, + OBJ_SECTORS, 0, SideDefs[sdlist->objnum].sector); + if (val >= 0) + { + for (cur = sdlist; cur; cur = cur->next) + if (cur->objnum >= 0) + SideDefs[cur->objnum].sector = val; + MadeChanges = 1; + } + break; + } ForgetSelection (&sdlist); break; - - } + } } @@ -365,14 +458,14 @@ static char *GetTaggedLineDefFlag (int linedefnum, int flagndx) { - static char ldstr[16][50]; + static char ldstr[16][50]; - if ((LineDefs[linedefnum].flags & (0x01 << (flagndx - 1))) != 0) - strcpy (ldstr[flagndx - 1], "* "); - else - strcpy (ldstr[flagndx - 1], " "); - strcat (ldstr[flagndx - 1], GetLineDefFlagsLongName (0x01 << (flagndx - 1))); - return ldstr[flagndx - 1]; + if ((LineDefs[linedefnum].flags & (0x01 << (flagndx - 1))) != 0) + strcpy (ldstr[flagndx - 1], "* "); + else + strcpy (ldstr[flagndx - 1], " "); + strcat (ldstr[flagndx - 1], GetLineDefFlagsLongName (0x01 << (flagndx - 1))); + return ldstr[flagndx - 1]; } @@ -384,96 +477,73 @@ */ static int InputLinedefType (int x0, int y0, int *number) { -int r; -int ldtgno = 0; -char ldtg; -al_llist_t *list = 0; + int r; + int ldtgno = 0; + char ldtg; + al_llist_t *list = 0; -for (;;) + for (;;) { - /* - * First let user select a ldtgroup - */ - if (DisplayMenuList (x0+84, y0, "Select group", ldtgroup, - PrintLdtgroup, &ldtgno) < 0) - return 1; - if (al_lseek (ldtgroup, ldtgno, SEEK_SET)) - fatal_error ("%s ILT1 (%s)", msg_unexpected, al_astrerror (al_aerrno)); - ldtg = CUR_LDTGROUP->ldtgroup; - - /* - * KLUDGE: Special ldtgroup LDT_FREE means "enter number" - * Don't look for this ldtgroup in the .ygd file : LoadGameDefs() - * creates it manually. - */ - if (ldtg == LDT_FREE) + /* First let user select a ldtgroup */ + if (DisplayMenuList (x0+84, y0, "Select group", ldtgroup, + PrintLdtgroup, &ldtgno) < 0) + return 1; + if (al_lseek (ldtgroup, ldtgno, SEEK_SET)) + fatal_error ("%s ILT1 (%s)", msg_unexpected, al_astrerror (al_aerrno)); + ldtg = CUR_LDTGROUP->ldtgroup; + + /* KLUDGE: Special ldtgroup LDT_FREE means "enter number" + Don't look for this ldtgroup in the .ygd file : + LoadGameDefs() creates it manually. */ + if (ldtg == LDT_FREE) { - /* FIXME should be unsigned ! should accept hex. */ - *number = InputIntegerValue (x0+126, y0 + (3 + ldtgno) * FONTH, - -32768, 32767, 0); - if (*number != IIV_CANCEL) - break; - goto again; + // FIXME should be unsigned + *number = InputIntegerValue (x0+126, y0 + (3 + ldtgno) * FONTH, + -32768, 32767, 0); + if (*number != IIV_CANCEL) + break; + goto again; } - - /* - * Then build a list of pointers on all ldt that have this - * ldtgroup and let user select one - */ - list = al_lcreate (sizeof (void *)); - for (al_lrewind (ldtdef); ! al_leol (ldtdef); al_lstep (ldtdef)) - if (CUR_LDTDEF->ldtgroup == ldtg) + + /* Then build a list of pointers on all ldt that have this + ldtgroup and let user select one */ + list = al_lcreate (sizeof (void *)); + for (al_lrewind (ldtdef); ! al_leol (ldtdef); al_lstep (ldtdef)) + if (CUR_LDTDEF->ldtgroup == ldtg) { - void *ptr = CUR_LDTDEF; - al_lwrite (list, &ptr); + void *ptr = CUR_LDTDEF; + al_lwrite (list, &ptr); } - r = DisplayMenuList - (x0+126, y0 + 2 * FONTH, "Select type", list, PrintLdtdef, NULL); - if (r < 0) - goto again; - if (al_lseek (list, r, SEEK_SET)) - fatal_error ("%s ILT2 (%s)", msg_unexpected, al_astrerror (al_aerrno)); - *number = (*((ldtdef_t **) al_lptr (list)))->number; - al_ldiscard (list); - break; - - again : - ; - /* draw_map (OBJ_THINGS, 0, 0); FIXME! */ + { + Menu_data_ldt menudata (list); + r = DisplayMenuList + (x0+126, y0 + 2 * FONTH, "Select type", menudata, NULL); + } + if (r < 0) + goto again; + if (al_lseek (list, r, SEEK_SET)) + fatal_error ("%s ILT2 (%s)", msg_unexpected, al_astrerror (al_aerrno)); + *number = (*((ldtdef_t **) al_lptr (list)))->number; + al_ldiscard (list); + break; + + again : + ; + /* draw_map (OBJ_THINGS, 0, 0); FIXME! */ } -return 0; + return 0; } - - /* * PrintLdtgroup * Used by DisplayMenuList when called by InputLinedefType */ static const char *PrintLdtgroup (void *ptr) { -if (! ptr) - return "PrintLdtgroup: (null)"; -return ((ldtgroup_t *)ptr)->desc; + if (! ptr) + return "PrintLdtgroup: (null)"; + return ((ldtgroup_t *)ptr)->desc; } - -/* - * PrintLdtdef - * Used by DisplayMenuList when called by InputLinedefType - */ -static const char *PrintLdtdef (void *ptr) -{ -static char buf[100]; - -if (! ptr) - return "PrintLdtdef: (null)"; -sprintf (buf, "[%3d] %.70s", - (*((ldtdef_t **)ptr))->number, - (*((ldtdef_t **)ptr))->longdesc); -return buf; -} - - diff -uaNr yadex-1.5.2/src/l_unlink.cc yadex-1.6.0/src/l_unlink.cc --- yadex-1.5.2/src/l_unlink.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/l_unlink.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -30,6 +30,8 @@ #include "yadex.h" #include "bitvec.h" #include "levels.h" +#include "objects.h" +#include "objid.h" #include "selectn.h" diff -uaNr yadex-1.5.2/src/l_vertices.cc yadex-1.6.0/src/l_vertices.cc --- yadex-1.5.2/src/l_vertices.cc 2000-01-10 14:40:11.000000000 +0100 +++ yadex-1.6.0/src/l_vertices.cc 2003-03-28 13:37:32.000000000 +0100 @@ -10,7 +10,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 diff -uaNr yadex-1.5.2/src/levels.cc yadex-1.6.0/src/levels.cc --- yadex-1.5.2/src/levels.cc 2000-07-26 00:24:44.000000000 +0200 +++ yadex-1.6.0/src/levels.cc 2003-03-28 13:37:32.000000000 +0100 @@ -12,7 +12,7 @@ Yadex incorporates code from DEU 5.21 that was put in the public domain in 1994 by Raphaël Quinet and Brendon Wyber. -The rest of Yadex is Copyright © 1997-2000 André Majorel. +The rest of Yadex is Copyright © 1997-2003 André Majorel and others. 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 @@ -34,8 +34,10 @@ #include "dialog.h" #include "game.h" #include "levels.h" +#include "objid.h" #include "wstructs.h" #include "things.h" +#include "wadfile.h" #include "wads.h" #include "wads2.h" @@ -146,7 +148,6 @@ int rc = 0; MDirPtr dir; int OldNumVertices; -int n; /* No objects are needed: they may be swapped after they have been read */ ObjectsNeeded (0); @@ -160,11 +161,16 @@ /* Get the number of vertices */ i32 v_offset = 42; i32 v_length = 42; +{ +const char *lump_name = "BUG"; if (yg_level_format == YGLF_ALPHA) // Doom alpha - dir = FindMasterDir (Level, "POINTS"); + lump_name = "POINTS"; +else + lump_name = "VERTEXES"; +dir = FindMasterDir (Level, lump_name); +if (dir == 0) + OldNumVertices = 0; else - dir = FindMasterDir (Level, "VERTEXES"); -if (dir) { v_offset = dir->dir.start; v_length = dir->dir.size; @@ -176,18 +182,20 @@ OldNumVertices = (int) (v_length / WAD_VERTEX_BYTES); if ((i32) (OldNumVertices * WAD_VERTEX_BYTES) != v_length) warn ("the %s lump has a weird size." - " The wad might be corrupt.\n", - yg_level_format == YGLF_ALPHA ? "POINTS" : "VERTEXES"); + " The wad might be corrupt.\n", lump_name); } -else - OldNumVertices = 0; +} // Read THINGS +{ +const char *lump_name = "THINGS"; verbmsg ("Reading %s things", levelname); i32 offset = 42; i32 length; -dir = FindMasterDir (Level, "THINGS"); -if (dir) +dir = FindMasterDir (Level, lump_name); +if (dir == 0) + NumThings = 0; +else { offset = dir->dir.start; length = dir->dir.size; @@ -195,8 +203,8 @@ { NumThings = (int) (length / WAD_HEXEN_THING_BYTES); if ((i32) (NumThings * WAD_HEXEN_THING_BYTES) != length) - warn ("the THINGS lump has a weird size." - " The wad might be corrupt.\n"); + warn ("the %s lump has a weird size." + " The wad might be corrupt.\n", lump_name); } else // Doom/Heretic/Strife mode { @@ -208,101 +216,144 @@ size_t thing_size = yg_level_format == YGLF_ALPHA ? 12 : WAD_THING_BYTES; NumThings = (int) (length / thing_size); if ((i32) (NumThings * thing_size) != length) - warn ("the THINGS lump has a weird size." - " The wad might be corrupt.\n"); + warn ("the %s lump has a weird size." + " The wad might be corrupt.\n", lump_name); } } -else - NumThings = 0; things_angles++; things_types++; if (NumThings > 0) { Things = (TPtr) GetFarMemory ((unsigned long) NumThings * sizeof (struct Thing)); - wad_seek (dir->wadfile, offset); - if (MainWad == Iwad4) // Hexen mode - for (n = 0; n < NumThings; n++) + const Wad_file *wf = dir->wadfile; + wf->seek (offset); + if (wf->error ()) + { + err ("%s: seek error", lump_name); + rc = 1; + goto byebye; + } + if (MainWad == Iwad4) // Hexen mode + for (long n = 0; n < NumThings; n++) { u8 dummy2[6]; - wad_read_i16 (dir->wadfile); // Tid - wad_read_i16 (dir->wadfile, &(Things[n].xpos )); - wad_read_i16 (dir->wadfile, &(Things[n].ypos )); - wad_read_i16 (dir->wadfile); // Height - wad_read_i16 (dir->wadfile, &(Things[n].angle)); - wad_read_i16 (dir->wadfile, &(Things[n].type )); - wad_read_i16 (dir->wadfile, &(Things[n].when )); - wad_read_bytes (dir->wadfile, dummy2, sizeof dummy2); - } - else // Doom/Heretic/Strife mode - for (n = 0; n < NumThings; n++) - { - wad_read_i16 (dir->wadfile, &(Things[n].xpos )); - wad_read_i16 (dir->wadfile, &(Things[n].ypos )); - wad_read_i16 (dir->wadfile, &(Things[n].angle)); - wad_read_i16 (dir->wadfile, &(Things[n].type )); + wf->read_i16 (); // Tid + wf->read_i16 (&Things[n].xpos ); + wf->read_i16 (&Things[n].ypos ); + wf->read_i16 (); // Height + wf->read_i16 (&Things[n].angle); + wf->read_i16 (&Things[n].type ); + wf->read_i16 (&Things[n].when ); + wf->read_bytes (dummy2, sizeof dummy2); + if (wf->error ()) + { + err ("%s: error reading thing #%ld", lump_name, n); + rc = 1; + goto byebye; + } + } + else // Doom/Heretic/Strife mode + for (long n = 0; n < NumThings; n++) + { + wf->read_i16 (&Things[n].xpos ); + wf->read_i16 (&Things[n].ypos ); + wf->read_i16 (&Things[n].angle); + wf->read_i16 (&Things[n].type ); if (yg_level_format == YGLF_ALPHA) - wad_read_i16 (dir->wadfile); // Alpha. Don't know what its for. - wad_read_i16 (dir->wadfile, &(Things[n].when )); + wf->read_i16 (); // Alpha. Don't know what it's for. + wf->read_i16 (&Things[n].when ); + if (wf->error ()) + { + err ("%s: error reading thing #%ld", lump_name, n); + rc = 1; + goto byebye; + } } } +} // Read LINEDEFS if (yg_level_format != YGLF_ALPHA) { + const char *lump_name = "LINEDEFS"; verbmsg (" linedefs"); - dir = FindMasterDir (Level, "LINEDEFS"); - if (dir) + dir = FindMasterDir (Level, lump_name); + if (dir == 0) + NumLineDefs = 0; + else + { if (MainWad == Iwad4) // Hexen mode { NumLineDefs = (int) (dir->dir.size / WAD_HEXEN_LINEDEF_BYTES); if ((i32) (NumLineDefs * WAD_HEXEN_LINEDEF_BYTES) != dir->dir.size) - warn ("the LINEDEFS lump has a weird size." - " The wad might be corrupt.\n"); + warn ("the %s lump has a weird size." + " The wad might be corrupt.\n", lump_name); } else // Doom/Heretic/Strife mode { NumLineDefs = (int) (dir->dir.size / WAD_LINEDEF_BYTES); if ((i32) (NumLineDefs * WAD_LINEDEF_BYTES) != dir->dir.size) - warn ("the LINEDEFS lump has a weird size." - " The wad might be corrupt.\n"); + warn ("the %s lump has a weird size." + " The wad might be corrupt.\n", lump_name); } - else - NumLineDefs = 0; + } if (NumLineDefs > 0) { LineDefs = (LDPtr) GetFarMemory ((unsigned long) NumLineDefs * sizeof (struct LineDef)); - wad_seek (dir->wadfile, dir->dir.start); + const Wad_file *wf = dir->wadfile; + wf->seek (dir->dir.start); + if (wf->error ()) + { + err ("%s: seek error", lump_name); + rc = 1; + goto byebye; + } if (MainWad == Iwad4) // Hexen mode - for (n = 0; n < NumLineDefs; n++) + for (long n = 0; n < NumLineDefs; n++) { u8 dummy[6]; - wad_read_i16 (dir->wadfile, &(LineDefs[n].start )); - wad_read_i16 (dir->wadfile, &(LineDefs[n].end )); - wad_read_i16 (dir->wadfile, &(LineDefs[n].flags )); - wad_read_bytes (dir->wadfile, dummy, sizeof dummy); - wad_read_i16 (dir->wadfile, &(LineDefs[n].sidedef1)); - wad_read_i16 (dir->wadfile, &(LineDefs[n].sidedef2)); + wf->read_i16 (&LineDefs[n].start); + wf->read_i16 (&LineDefs[n].end); + wf->read_i16 (&LineDefs[n].flags); + wf->read_bytes (dummy, sizeof dummy); + wf->read_i16 (&LineDefs[n].sidedef1); + wf->read_i16 (&LineDefs[n].sidedef2); LineDefs[n].type = dummy[0]; + LineDefs[n].tag = dummy[1]; // arg1 often contains a tag + if (wf->error ()) + { + err ("%s: error reading linedef #%ld", lump_name, n); + rc = 1; + goto byebye; + } } else // Doom/Heretic/Strife mode - for (n = 0; n < NumLineDefs; n++) + for (long n = 0; n < NumLineDefs; n++) { - wad_read_i16 (dir->wadfile, &(LineDefs[n].start )); - wad_read_i16 (dir->wadfile, &(LineDefs[n].end )); - wad_read_i16 (dir->wadfile, &(LineDefs[n].flags )); - wad_read_i16 (dir->wadfile, &(LineDefs[n].type )); - wad_read_i16 (dir->wadfile, &(LineDefs[n].tag )); - wad_read_i16 (dir->wadfile, &(LineDefs[n].sidedef1)); - wad_read_i16 (dir->wadfile, &(LineDefs[n].sidedef2)); + wf->read_i16 (&LineDefs[n].start); + wf->read_i16 (&LineDefs[n].end); + wf->read_i16 (&LineDefs[n].flags); + wf->read_i16 (&LineDefs[n].type); + wf->read_i16 (&LineDefs[n].tag); + wf->read_i16 (&LineDefs[n].sidedef1); + wf->read_i16 (&LineDefs[n].sidedef2); + if (wf->error ()) + { + err ("%s: error reading linedef #%ld", lump_name, n); + rc = 1; + goto byebye; + } } } } // Read SIDEDEFS +{ +const char *lump_name = "SIDEDEFS"; verbmsg (" sidedefs"); -dir = FindMasterDir (Level, "SIDEDEFS"); +dir = FindMasterDir (Level, lump_name); if (dir) { NumSideDefs = (int) (dir->dir.size / WAD_SIDEDEF_BYTES); @@ -316,27 +367,41 @@ { SideDefs = (SDPtr) GetFarMemory ((unsigned long) NumSideDefs * sizeof (struct SideDef)); - wad_seek (dir->wadfile, dir->dir.start); - for (n = 0; n < NumSideDefs; n++) + const Wad_file *wf = dir->wadfile; + wf->seek (dir->dir.start); + if (wf->error ()) + { + err ("%s: seek error", lump_name); + rc = 1; + goto byebye; + } + for (long n = 0; n < NumSideDefs; n++) { - wad_read_i16 (dir->wadfile, &(SideDefs[n].xoff)); - wad_read_i16 (dir->wadfile, &(SideDefs[n].yoff)); - wad_read_bytes (dir->wadfile, &(SideDefs[n].tex1), WAD_TEX_NAME); - wad_read_bytes (dir->wadfile, &(SideDefs[n].tex2), WAD_TEX_NAME); - wad_read_bytes (dir->wadfile, &(SideDefs[n].tex3), WAD_TEX_NAME); - wad_read_i16 (dir->wadfile, &(SideDefs[n].sector)); + wf->read_i16 (&SideDefs[n].xoff); + wf->read_i16 (&SideDefs[n].yoff); + wf->read_bytes (&SideDefs[n].tex1, WAD_TEX_NAME); + wf->read_bytes (&SideDefs[n].tex2, WAD_TEX_NAME); + wf->read_bytes (&SideDefs[n].tex3, WAD_TEX_NAME); + wf->read_i16 (&SideDefs[n].sector); + if (wf->error ()) + { + err ("%s: error reading sidedef #%ld", lump_name, n); + rc = 1; + goto byebye; + } } } +} /* Sanity checkings on linedefs: the 1st and 2nd vertices must exist. The 1st and 2nd sidedefs must exist or be set to -1. */ -for (n = 0; n < NumLineDefs; n++) +for (long n = 0; n < NumLineDefs; n++) { if (LineDefs[n].sidedef1 != -1 && outside (LineDefs[n].sidedef1, 0, NumSideDefs - 1)) { - warn ("linedef %d has bad 1st sidedef number %d\n", + err ("linedef %ld has bad 1st sidedef number %d, giving up", n, LineDefs[n].sidedef1); rc = 1; goto byebye; @@ -344,22 +409,22 @@ if (LineDefs[n].sidedef2 != -1 && outside (LineDefs[n].sidedef2, 0, NumSideDefs - 1)) { - warn ("linedef %d has bad 2nd sidedef number %d\n", + err ("linedef %ld has bad 2nd sidedef number %d, giving up", n, LineDefs[n].sidedef2); rc = 1; goto byebye; } if (outside (LineDefs[n].start, 0, OldNumVertices -1)) { - warn ("linedef %d has bad 1st vertex number %d\n", - n, LineDefs[n].start); + err ("linedef %ld has bad 1st vertex number %d, giving up", + n, LineDefs[n].start); rc = 1; goto byebye; } if (outside (LineDefs[n].end, 0, OldNumVertices - 1)) { - warn ("linedef %d has bad 2nd vertex number %d\n", - n, LineDefs[n].end); + err ("linedef %ld has bad 2nd vertex number %d, giving up", + n, LineDefs[n].end); rc = 1; goto byebye; } @@ -368,12 +433,14 @@ // Read LINES (Doom alpha only) if (yg_level_format == YGLF_ALPHA) { + const char *lump_name = "LINES"; verbmsg (" lines"); - dir = FindMasterDir (Level, "LINES"); + dir = FindMasterDir (Level, lump_name); if (dir) { if ((dir->dir.size - 4) % 36) - warn ("the LINES lump has a weird size. The wad might be corrupt.\n"); + warn ("the %s lump has a weird size. The wad might be corrupt.\n", + lump_name); const size_t nlines = dir->dir.size / 36; NumLineDefs = nlines; NumSideDefs = 2 * nlines; // Worst case. We'll adjust later. @@ -383,61 +450,105 @@ * sizeof (struct SideDef)); // Read TEXTURES if (yg_texture_format != YGTF_NAMELESS) - { + { + const char *lump_name = "TEXTURES"; + bool success = false; ntex = 0; - MDirPtr d = FindMasterDir (MasterDir, "TEXTURES"); + i32 *offset_table = 0; + MDirPtr d = FindMasterDir (MasterDir, lump_name); if (! d) - warn ("TEXTURES lump not found. Will not be able to" - " import texture names.\n"); - else { - wad_seek (d->wadfile, d->dir.start); - i32 num; - wad_read_i32 (d->wadfile, &num); - if (num < 0 || num > 32767) - warn ("TEXTURES has bad name count. Ignoring TEXTURES.\n"); - else + warn ("%s: lump not found in directory\n", lump_name); + goto textures_done; + } + { + const Wad_file *wf = d->wadfile; + wf->seek (d->dir.start); + if (wf->error ()) + { + warn ("%s: seek error\n", lump_name); + goto textures_done; + } + i32 num; + wf->read_i32 (&num); + if (wf->error ()) + { + warn ("%s: error reading texture count\n", lump_name); + } + if (num < 0 || num > 32767) + { + warn ("%s: bad texture count, giving up\n", lump_name); + goto textures_done; + } + ntex = num; + offset_table = new i32[ntex]; + for (size_t n = 0; n < ntex; n++) + { + wf->read_i32 (offset_table + n); + if (wf->error ()) { - ntex = num; - i32 *offset_table = new i32[ntex]; - for (size_t n = 0; n < ntex; n++) - wad_read_i32 (d->wadfile, offset_table + n); - tex_list = (char *) GetMemory (ntex * WAD_TEX_NAME); - for (size_t n = 0; n < ntex; n++) - { - wad_seek (d->wadfile, d->dir.start + offset_table[n]); - wad_read_bytes (d->wadfile, tex_list + WAD_TEX_NAME * n, - WAD_TEX_NAME); - } - delete[] offset_table; + warn ("%s: error reading offsets table\n"); + goto textures_done; } } + tex_list = (char *) GetMemory (ntex * WAD_TEX_NAME); + for (size_t n = 0; n < ntex; n++) + { + const long offset = d->dir.start + offset_table[n]; + wf->seek (offset); + if (wf->error ()) + { + warn ("%s: seek error\n", lump_name); + goto textures_done; + } + wf->read_bytes (tex_list + WAD_TEX_NAME * n, WAD_TEX_NAME); + if (wf->error ()) + { + warn ("%s: error reading texture names\n", lump_name); + goto textures_done; + } + } + success = true; + } - } + textures_done: + if (offset_table != 0) + delete[] offset_table; + if (! success) + warn ("%s: errors found, won't be able to import texture names\n", + lump_name); + } - wad_seek (dir->wadfile, dir->dir.start + 4); + const Wad_file *wf = dir->wadfile; + wf->seek (dir->dir.start + 4); + if (wf->error ()) + { + err ("%s: seek error", lump_name); + rc = 1; + goto byebye; + } size_t s = 0; for (size_t n = 0; n < nlines; n++) { LDPtr ld = LineDefs + n; - ld->start = wad_read_i16 (dir->wadfile); - ld->end = wad_read_i16 (dir->wadfile); - ld->flags = wad_read_i16 (dir->wadfile); - wad_read_i16 (dir->wadfile); // Unused ? - ld->type = wad_read_i16 (dir->wadfile); - ld->tag = wad_read_i16 (dir->wadfile); - wad_read_i16 (dir->wadfile); // Unused ? - i16 sector1 = wad_read_i16 (dir->wadfile); - i16 xofs1 = wad_read_i16 (dir->wadfile); - i16 tex1m = wad_read_i16 (dir->wadfile); - i16 tex1u = wad_read_i16 (dir->wadfile); - i16 tex1l = wad_read_i16 (dir->wadfile); - wad_read_i16 (dir->wadfile); // Unused ? - i16 sector2 = wad_read_i16 (dir->wadfile); - i16 xofs2 = wad_read_i16 (dir->wadfile); - i16 tex2m = wad_read_i16 (dir->wadfile); - i16 tex2u = wad_read_i16 (dir->wadfile); - i16 tex2l = wad_read_i16 (dir->wadfile); + ld->start = wf->read_i16 (); + ld->end = wf->read_i16 (); + ld->flags = wf->read_i16 (); + wf->read_i16 (); // Unused ? + ld->type = wf->read_i16 (); + ld->tag = wf->read_i16 (); + wf->read_i16 (); // Unused ? + i16 sector1 = wf->read_i16 (); + i16 xofs1 = wf->read_i16 (); + i16 tex1m = wf->read_i16 (); + i16 tex1u = wf->read_i16 (); + i16 tex1l = wf->read_i16 (); + wf->read_i16 (); // Unused ? + i16 sector2 = wf->read_i16 (); + i16 xofs2 = wf->read_i16 (); + i16 tex2m = wf->read_i16 (); + i16 tex2u = wf->read_i16 (); + i16 tex2l = wf->read_i16 (); if (sector1 >= 0) // Create first sidedef { ld->sidedef1 = s; @@ -466,13 +577,15 @@ } else ld->sidedef2 = -1; - if (dir->wadfile->error) + if (wf->error ()) { - warn ("read error in %s\n", dir->wadfile->filename); - break; + err ("%s: error reading line #%d", lump_name, int (n)); + rc = 1; + goto byebye; } } - if (NumSideDefs > s) // Almost always true. + // (size_t) to silence GCC warning + if ((size_t) NumSideDefs > s) // Almost always true. { NumSideDefs = s; SideDefs = (SDPtr) ResizeFarMemory (SideDefs, @@ -502,7 +615,7 @@ { verbmsg (" vertices"); int last_used_vertex = -1; -for (n = 0; n < NumLineDefs; n++) +for (long n = 0; n < NumLineDefs; n++) { last_used_vertex = y_max (last_used_vertex, LineDefs[n].start); last_used_vertex = y_max (last_used_vertex, LineDefs[n].end); @@ -511,13 +624,13 @@ // This block is only here to warn me if (1) is false. { bitvec_c vertex_used (OldNumVertices); - for (int n = 0; n < NumLineDefs; n++) + for (long n = 0; n < NumLineDefs; n++) { vertex_used.set (LineDefs[n].start); vertex_used.set (LineDefs[n].end); } int unused = 0; - for (int n = 0; n <= last_used_vertex; n++) + for (long n = 0; n <= last_used_vertex; n++) { if (! vertex_used.get (n)) unused++; @@ -555,52 +668,72 @@ // Now load all the vertices except the unused ones at the end. if (NumVertices > 0) { + const char *lump_name = "BUG"; Vertices = (VPtr) GetFarMemory ((unsigned long) NumVertices * sizeof (struct Vertex)); if (yg_level_format == YGLF_ALPHA) // Doom alpha - dir = FindMasterDir (Level, "POINTS"); + lump_name = "POINTS"; else - dir = FindMasterDir (Level, "VERTEXES"); - if (dir) + lump_name = "VERTEXES"; + dir = FindMasterDir (Level, lump_name); + if (dir == 0) + goto vertexes_done; // FIXME isn't that fatal ? + { + const Wad_file *wf = dir->wadfile; + wf->seek (v_offset); + if (wf->error ()) { - wad_seek (dir->wadfile, v_offset); - MapMaxX = -32767; - MapMaxY = -32767; - MapMinX = 32767; - MapMinY = 32767; - for (n = 0; n < NumVertices; n++) - { - i16 val; - wad_read_i16 (dir->wadfile, &val); - if (val < MapMinX) - MapMinX = val; - if (val > MapMaxX) - MapMaxX = val; - Vertices[n].x = val; - wad_read_i16 (dir->wadfile, &val); - if (val < MapMinY) - MapMinY = val; - if (val > MapMaxY) - MapMaxY = val; - Vertices[n].y = val; + err ("%s: seek error", lump_name); + rc = 1; + goto byebye; + } + MapMaxX = -32767; + MapMaxY = -32767; + MapMinX = 32767; + MapMinY = 32767; + for (long n = 0; n < NumVertices; n++) + { + i16 val; + wf->read_i16 (&val); + if (val < MapMinX) + MapMinX = val; + if (val > MapMaxX) + MapMaxX = val; + Vertices[n].x = val; + wf->read_i16 (&val); + if (val < MapMinY) + MapMinY = val; + if (val > MapMaxY) + MapMaxY = val; + Vertices[n].y = val; + if (wf->error ()) + { + err ("%s: error reading vertex #%ld", lump_name, n); + rc = 1; + goto byebye; } } } + vertexes_done: + ; + } } // Ignore SEGS, SSECTORS and NODES // Read SECTORS +{ +const char *lump_name = "SECTORS"; verbmsg (" sectors\n"); -dir = FindMasterDir (Level, "SECTORS"); +dir = FindMasterDir (Level, lump_name); if (yg_level_format != YGLF_ALPHA) { if (dir) { NumSectors = (int) (dir->dir.size / WAD_SECTOR_BYTES); if ((i32) (NumSectors * WAD_SECTOR_BYTES) != dir->dir.size) - warn ("the SECTORS lump has a weird size." - " The wad might be corrupt.\n"); + warn ("the %s lump has a weird size." + " The wad might be corrupt.\n", lump_name); } else NumSectors = 0; @@ -608,92 +741,181 @@ { Sectors = (SPtr) GetFarMemory ((unsigned long) NumSectors * sizeof (struct Sector)); - wad_seek (dir->wadfile, dir->dir.start); - for (n = 0; n < NumSectors; n++) + const Wad_file *wf =