Files
nethack/sys/msdos/pckeys.c
nhmall 6c0ae092c6 distinguish global variables that get written to savefile
The g? structs had a mix of variables that were written to
the savefile, and those that were not.

For better clarity and to distinguish those that end up in
the savefile, relocate some g? variables that get written
directly to the savefile into different structs.

This updates EDITLEVEL, although technically it probably
didn't need to, since savefile contents are not changing.

Details:

    gb.bases            -> svb.bases
    gb.bbubbles         -> svb.bbubbles
    gb.branches         -> svb.branches
    gc.context          -> svc.context
    gd.disco            -> svd.disco
    gd.dndest           -> svd.dndest
    gd.doors            -> svd.doors
    gd.doors_alloc      -> svd.doors_alloc
    gd.dungeon_topology -> svd.dungeon_topology
    gd.dungeons         -> svd.dungeons
    ge.exclusion_zones  -> sve.exclusion_zones
    gh.hackpid          -> svh.hackpid
    gi.inv_pos          -> svi.inv_pos
    gk.killer           -> svk.killer
    gl.lastseentyp      -> svl.lastseentyp
    gl.level            -> svl.level
    gl.level_info       -> svl.level_info
    gm.mapseenchn       -> svm.mapseenchn
    gm.moves            -> svm.moves
    gm.mvitals          -> svm.mvitals
    gn.n_dgns           -> svn.n_dgns
    gn.n_regions        -> svn.n_regions
    gn.nroom            -> svn.nroom
    go.oracle_cnt       -> svo.oracle_cnt
    gp.pl_character     -> svp.pl_character
    gp.pl_fruit         -> svp.pl_fruit
    gp.plname           -> svp.plname
    gp.program_state    -> svp.program_state
    gq.quest_status     -> svq.quest_status
    gr.rooms            -> svr.rooms
    gs.sp_levchn        -> svs.sp_levchn
    gs.spl_book         -> svs.spl_book
    gt.timer_id         -> svt.timer_id
    gt.tune             -> svt.tune
    gu.updest           -> svu.updest
    gx.xmax             -> svx.xmax
    gx.xmin             -> svx.xmin
    gy.ymax             -> svy.ymax
    gy.ymin             -> svy.ymin

Related note:
There are some pointer variables that are heads of chains that were not
moved from 'g?' to 'sv?', because they are not actually written to the
savefile directly, but the objects/monst/trap/lightsource/timer in the
chains they point to are. That can be changed, if desired.
Examples: gi.invent, gm.migrating_objs, gb.billobjs, gm.migrating_mons,
          gf.ftrap, gl.light_base, gt.timer_base
2024-07-13 14:57:50 -04:00

133 lines
3.0 KiB
C

/* NetHack 3.7 pckeys.c $NHDT-Date: 1596498270 2020/08/03 23:44:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.14 $ */
/* Copyright (c) NetHack PC Development Team 1996 */
/* NetHack may be freely redistributed. See license for details. */
/*
* MSDOS tile-specific key handling.
*/
#include "hack.h"
#ifdef MSDOS
#ifdef TILES_IN_GLYPHMAP
#include "wintty.h"
#include "pcvideo.h"
boolean pckeys(unsigned char, unsigned char);
static void userpan(boolean);
static void overview(boolean);
static void traditional(boolean);
static void refresh(void);
extern struct WinDesc *wins[MAXWIN]; /* from wintty.c */
extern boolean inmap; /* from video.c */
#define SHIFT (0x1 | 0x2)
#define CTRL 0x4
#define ALT 0x8
/*
* Check for special interface manipulation keys.
* Returns TRUE if the scan code triggered something.
*
*/
boolean
pckeys(unsigned char scancode, unsigned char shift)
{
boolean opening_dialog;
opening_dialog = svp.pl_character[0] ? FALSE : TRUE;
switch (scancode) {
#ifdef SIMULATE_CURSOR
case 0x3d: /* F3 = toggle cursor type */
HideCursor();
cursor_type += 1;
if (cursor_type >= NUM_CURSOR_TYPES)
cursor_type = 0;
DrawCursor();
break;
#endif
case 0x74: /* Control-right_arrow = scroll horizontal to right */
if ((shift & CTRL) && iflags.tile_view && !opening_dialog)
userpan(1);
break;
case 0x73: /* Control-left_arrow = scroll horizontal to left */
if ((shift & CTRL) && iflags.tile_view && !opening_dialog)
userpan(0);
break;
case 0x3E: /* F4 = toggle overview mode */
if (iflags.tile_view && !opening_dialog && !Is_rogue_level(&u.uz)) {
iflags.traditional_view = FALSE;
overview(iflags.over_view ? FALSE : TRUE);
refresh();
}
break;
case 0x3F: /* F5 = toggle traditional mode */
if (iflags.tile_view && !opening_dialog && !Is_rogue_level(&u.uz)) {
iflags.over_view = FALSE;
traditional(iflags.traditional_view ? FALSE : TRUE);
refresh();
}
break;
default:
return FALSE;
}
return TRUE;
}
static void
userpan(boolean on)
{
#ifdef SCREEN_VGA
if (iflags.usevga)
vga_userpan(on);
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa)
vesa_userpan(on);
#endif
}
static void
overview(boolean on)
{
#ifdef SCREEN_VGA
if (iflags.usevga)
vga_overview(on);
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa)
vesa_overview(on);
#endif
}
static void
traditional(boolean on)
{
#ifdef SCREEN_VGA
if (iflags.usevga)
vga_traditional(on);
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa)
vesa_traditional(on);
#endif
}
static void
refresh(void)
{
#ifdef SCREEN_VGA
if (iflags.usevga)
vga_refresh();
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa)
vesa_refresh();
#endif
}
#endif /* TILES_IN_GLYPHMAP */
#endif /* MSDOS */
/*pckeys.c*/