]> granicus.if.org Git - nethack/commit
pmnames mons gender naming plus a window port interface change
authornhmall <nhmall@nethack.org>
Sat, 26 Dec 2020 16:23:23 +0000 (11:23 -0500)
committernhmall <nhmall@nethack.org>
Sat, 26 Dec 2020 16:23:23 +0000 (11:23 -0500)
commit0c3b9642e4207ed3c0b756585b83477f59116305
tree248f7f4b3343b60783a57c6546ff7c36e3d04107
parent62e6064a5421bbc779e961397ca5b283a4658dac
pmnames mons gender naming plus a window port interface change

add MALE, FEMALE, and gender-neutral names for individual monster species
to the mons array. The gender-neutral name (NEUTRAL) is mandatory, the
MALE and FEMALE versions are not.

replace code uses of the mname field of permonst with one of the three
potentially-available gender-specific names.

consolidate some separate mons entries that differed only by species into a
single mons entry (caveman, cavewoman and priest,priestess etc.)

consolidate several "* lord" and "* queen/* king" monst entries into
their single species, and allow both genders on some where it makes some
sense (there is probably more work and cleanup to come out of this at some
point, and the chosen gender-neutral name variations are not cast in stone
if someone has better suggestions).

related function or macro additions:
    pmname(pm, gender) to get the gender variation of the permonst name. It
    guards against monsters that haven't got anything except NEUTRAL naming
    and falls back to the NEUTRAL version if FEMALE and MALE versions are
    missing.

    Ugender to obtain the current hero gender.
    Mgender(mtmp) to obtain the gender of a monster

While the code can safely refer directly to pmnames[NEUTRAL] safely in the
code because it always exists, the other two (pmnames[MALE] and
pmnames[FEMALE] may not exist so use:
    pmname(ptr, gidx)
      where -ptr is a permonst *
            -gidx is an index into the pmnames array field of the
             permonst struct
pmname() checks for a valid index and checks for null-pointers for
pmnames[MALE] and pmnames[FEMALE], and will fall back to pmnames[NEUTRAL] if
the pointer requested if the requested variation is unavailable, or if the
gidx is out-of-range.

Allow code to specify makemon flags to request female or male (via MM_MALE
and MM_FEMALE flags respectively)to makedefs, since the species alone doesn't
distinguish male/female anymore. Specifying MM_MALE or MM_FEMALE won't
override the pm M2_MALE and M2_FEMALE flags on a mons[] entry.

male and female tiles have been added to win/share/monsters.txt.
The majority are duplicated placeholders except for those that were
separate mons entries before. Perhaps someone will contribute artwork in the
future to make the male and female variations visually distinguishable.

tilemapping via has the MALE tile indexes in the glyph2tile[]
array produced at build time. If a window port has information that the
FEMALE tile is required, it just has to increment the index returned
from the glyph2tile[] array by 1.

statues already preserved gender of the monster through STATUE_FEMALE
and STATUE_MALE, so ensure that pmnames takes that into consideration.

I expect some refinement will be required after broad play-testing puts it to
the test.

    consolidate caveman,cavewoman and priest,priestess monst.c entries etc

This commit will require a bump of editlevel in patchlevel.h because it alters
the index numbers of the monsters due to the consolidation of some. Those
index numbers are saved in some other structures, even though the mons[] array
itself is not part of the savefile.

Window Port Interface Change

Also add a parameter to print_glyph to convey additional information beyond
the glyph to the window ports. Every single window port was calling back to
mapglyph for the information anyway, so just included it in the interface and
produce the information right in the display core.

The mapglyph() function uses will be eliminated, although there are still some
in the code yet to be dealt with.

win32, tty, x11, Qt, msdos window ports have all had adjustments done to
utilize the new parameter instead of calling mapglyph, but some of those
window ports have not been thoroughly tested since the changes.

Interface change additional info:

    print_glyph(window, x, y, glyph, bkglyph, *glyphmod)
            -- Print the glyph at (x,y) on the given window.  Glyphs are
               integers at the interface, mapped to whatever the window-
               port wants (symbol, font, color, attributes, ...there's
               a 1-1 map between glyphs and distinct things on the map).
            -- bkglyph is a background glyph for potential use by some
               graphical or tiled environments to allow the depiction
               to fall against a background consistent with the grid
               around x,y. If bkglyph is NO_GLYPH, then the parameter
               should be ignored (do nothing with it).
                -- glyphmod provides extended information about the glyph
               that window ports can use to enhance the display in
               various ways.
                    unsigned int glyphmod[NUM_GLYPHMOD]
               where:
                    glyphmod[GM_TTYCHAR]  is the text characters associated
                                          with the original NetHack display.

                    glyphmod[GM_FLAGS]    are the special flags that denote
                                          additional information that window
                                          ports can use.

                    glyphmod[GM_COLOR] is the text character
                                       color associated with the original
                                       NetHack display.

Support for including the glyphmod info in the display glyph buffer
alongside the glyph itself was added and is the default operation.
That can be turned off by defining UNBUFFERED_GLYPHMOD at compile time.
With UNBUFFERED_GLYPHMOD operation, a call will be placed to map_glyphmod()
immediately prior to every print_glyph() call.
113 files changed:
doc/fixes37.0
doc/window.doc
include/artilist.h
include/decl.h
include/display.h
include/extern.h
include/hack.h
include/mextra.h
include/monflag.h
include/monst.h
include/patchlevel.h
include/permonst.h
include/winX.h
include/wincurs.h
include/wingem.h
include/winprocs.h
include/wintty.h
include/you.h
src/apply.c
src/attrib.c
src/bones.c
src/botl.c
src/cmd.c
src/detect.c
src/display.c
src/do_name.c
src/do_wear.c
src/dog.c
src/dogmove.c
src/dokick.c
src/dothrow.c
src/eat.c
src/end.c
src/exper.c
src/explode.c
src/files.c
src/hack.c
src/insight.c
src/invent.c
src/makemon.c
src/mapglyph.c
src/mhitu.c
src/minion.c
src/mkmaze.c
src/mkroom.c
src/mon.c
src/mondata.c
src/monst.c
src/mplayer.c
src/mthrowu.c
src/muse.c
src/music.c
src/nhlobj.c
src/objnam.c
src/options.c
src/pager.c
src/pickup.c
src/polyself.c
src/potion.c
src/pray.c
src/priest.c
src/questpgr.c
src/read.c
src/restore.c
src/role.c
src/save.c
src/shk.c
src/sounds.c
src/sp_lev.c
src/steal.c
src/steed.c
src/teleport.c
src/timeout.c
src/trap.c
src/u_init.c
src/uhitm.c
src/vault.c
src/weapon.c
src/were.c
src/windows.c
src/wizard.c
src/worn.c
src/zap.c
sys/msdos/vidvesa.c
sys/msdos/vidvga.c
util/makedefs.c
win/Qt/qt_bind.cpp
win/Qt/qt_bind.h
win/Qt/qt_glyph.cpp
win/Qt/qt_glyph.h
win/Qt/qt_map.cpp
win/Qt/qt_map.h
win/Qt/qt_plsel.cpp
win/Qt/qt_stat.cpp
win/Qt/qt_win.cpp
win/Qt/qt_win.h
win/X11/winmap.c
win/X11/winstat.c
win/chain/wc_chainin.c
win/chain/wc_chainout.c
win/chain/wc_trace.c
win/curses/cursmain.c
win/curses/cursstat.c
win/share/monsters.txt
win/share/safeproc.c
win/share/tilemap.c
win/share/tiletext.c
win/shim/winshim.c
win/tty/wintty.c
win/win32/mhmap.c
win/win32/mhmsg.h
win/win32/mswproc.c
win/win32/winMS.h