Tutorial level

Add a tutorial level to teach commands to new players.
Very much a WIP.

Breaks save and bones compat.
This commit is contained in:
Pasi Kallinen
2023-02-25 20:37:01 +02:00
parent 7aead98a49
commit fc7a32b86e
38 changed files with 646 additions and 27 deletions

View File

@@ -245,6 +245,10 @@ extern const struct class_sym def_monsyms[MAXMCLASSES];
/* current mon class symbols */
extern uchar monsyms[MAXMCLASSES];
/* lua callback queue names */
extern const char * const nhcb_name[];
extern int nhcb_counts[];
#include "obj.h"
extern NEARDATA struct obj *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf,
*uarmu, /* under-wear, so to speak */

View File

@@ -53,10 +53,11 @@ struct tmpbranch {
/*
* Flags that map into the dungeon flags bitfields.
*/
#define TOWN 1 /* levels only */
#define HELLISH 2
#define MAZELIKE 4
#define ROGUELIKE 8
#define TOWN 0x01 /* levels only */
#define HELLISH 0x02
#define MAZELIKE 0x04
#define ROGUELIKE 0x08
#define UNCONNECTED 0x10
#define D_ALIGN_NONE 0
#define D_ALIGN_CHAOTIC (AM_CHAOTIC << 4)

View File

@@ -19,7 +19,7 @@ typedef struct d_flags { /* dungeon/level type flags */
Bitfield(maze_like, 1); /* is this a maze? */
Bitfield(rogue_like, 1); /* is this an old-fashioned presentation? */
Bitfield(align, 3); /* dungeon alignment. */
Bitfield(unused, 1); /* etc... */
Bitfield(unconnected, 1); /* dungeon not connected to any branch */
} d_flags;
typedef struct s_level { /* special dungeon level element */

View File

@@ -24,7 +24,8 @@ struct engr {
* against monsters when an object is present
* even when hero isn't (so behaves similarly
* to how Elbereth did in 3.4.3) */
/* 7 free bits */
Bitfield(nowipeout, 1); /* this engraving will not degrade */
/* 6 free bits */
};
#define newengr(lth) \

View File

@@ -245,6 +245,7 @@ extern int domonability(void);
extern const struct ext_func_tab *ext_func_tab_from_func(int(*)(void));
extern char cmd_from_func(int(*)(void));
extern char cmd_from_dir(int, int);
extern char *cmd_from_ecname(const char *);
extern const char *cmdname_from_func(int(*)(void), char *, boolean);
extern boolean redraw_cmd(char);
extern const char *levltyp_to_name(int);
@@ -2008,6 +2009,7 @@ extern int shiny_obj(char);
/* ### options.c ### */
extern boolean ask_do_tutorial(void);
extern boolean match_optname(const char *, const char *, int, boolean);
extern uchar txt2key(char *);
extern void initoptions(void);

View File

@@ -35,6 +35,7 @@ struct flag {
boolean goldX; /* for BUCX filtering, whether gold is X or U */
boolean help; /* look in data file for info about stuff */
boolean tips; /* show helpful hints? */
boolean tutorial; /* ask if player wants tutorial level? */
boolean ignintr; /* ignore interrupts */
boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */
boolean ins_chkpt; /* checkpoint as appropriate; INSURANCE */

View File

@@ -524,6 +524,16 @@ enum nhcore_calls {
NUM_NHCORE_CALLS
};
/* Lua callbacks. TODO: Merge with NHCORE */
enum nhcb_calls {
NHCB_CMD_BEFORE = 0,
NHCB_LVL_ENTER,
NHCB_LVL_LEAVE,
NHCB_END_TURN,
NUM_NHCB
};
/* Macros for messages referring to hands, eyes, feet, etc... */
enum bodypart_types {
ARM = 0,

View File

@@ -628,6 +628,8 @@ static int optfn_##a(int, int, boolean, char *, char *);
NHOPTB(travel_debug, Advanced, 0, opt_out, set_wizonly,
Off, No, No, No, NoAlias, (boolean *) 0, Term_False)
#endif
NHOPTB(tutorial, Advanced, 0, opt_out, set_in_config,
On, Yes, No, No, NoAlias, &flags.tutorial, Term_False)
NHOPTB(use_darkgray, Advanced, 0, opt_out, set_in_config,
On, Yes, No, No, NoAlias, &iflags.wc2_darkgray, Term_False)
NHOPTB(use_inverse, Advanced, 0, opt_out, set_in_game,

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 74
#define EDITLEVEL 75
/*
* Development status possibilities.

View File

@@ -389,6 +389,10 @@ struct levelflags {
normal mode descendant of such) */
Bitfield(corrmaze, 1); /* Whether corridors are used for the maze
rather than ROOM */
Bitfield(rndmongen, 1); /* random monster generation allowed? */
Bitfield(deathdrops, 1); /* monsters may drop corpses/death drops */
Bitfield(noautosearch, 1); /* automatic searching disabled */
schar temperature; /* +1 == hot, -1 == cold */
};

View File

@@ -355,6 +355,8 @@ struct you {
d_level uz, uz0; /* your level on this and the previous turn */
d_level utolev; /* level monster teleported you to, or uz */
uchar utotype; /* bitmask of goto_level() flags for utolev */
d_level ucamefrom; /* level where you came from; used for tutorial */
boolean nofollowers; /* level change ignores monster followers/pets */
boolean umoved; /* changed map location (post-move) */
int last_str_turn; /* 0: none, 1: half turn, 2: full turn
* +: turn right, -: turn left */