Add assistance to fire-command

Allows the fire-command to autowield a launcher; it will now
do either swapweapon or wield an appropriate launcher, if you
have ammo quivered.

This assistance can be turned off with the fireassist boolean option.

Adds a rudimentary command queue, which allows the code to add keys
or extended commands into the queue, and they're executed as if
the user did them.  Time passes normally when doing the queue,
and the queue will get cleared if hero is interrupted.
This commit is contained in:
Pasi Kallinen
2021-06-09 09:02:31 +03:00
parent f6e60c7516
commit 76f77ee0cc
15 changed files with 253 additions and 8 deletions

View File

@@ -644,6 +644,25 @@ struct _create_particular_data {
#define LUA_VER_BUFSIZ 20
#define LUA_COPYRIGHT_BUFSIZ 120
/*
* Rudimentary command queue.
* Allows the code to put keys and extended commands into the queue,
* and they're executed just as if the user did them. Time passes
* normally when doing queued actions. The queue will get cleared
* if hero is interrupted.
*/
enum cmdq_cmdtypes {
CMDQ_KEY = 0, /* a literal character, cmdq_add_key() */
CMDQ_EXTCMD, /* extended command, cmdq_add_ec() */
};
struct _cmd_queue {
int typ;
char key;
const struct ext_func_tab *ec_entry;
struct _cmd_queue *next;
};
/*
* 'g' -- instance_globals holds engine state that does not need to be
* persisted upon game exit. The initialization state is well defined
@@ -656,6 +675,8 @@ struct _create_particular_data {
*/
struct instance_globals {
struct _cmd_queue *command_queue;
/* apply.c */
int jumping_is_magic; /* current jump result of magic */
int polearm_range_min;