22#ifndef NUVIE_CORE_MAGIC_H
23#define NUVIE_CORE_MAGIC_H
25#include "ultima/nuvie/core/events.h"
26#include "ultima/nuvie/misc/call_back.h"
31#define REAGENT_U6_MANDRAKE_ROOT 0x01
32#define REAGENT_U6_NIGHTSHADE 0x02
33#define REAGENT_U6_BLACK_PEARL 0x04
34#define REAGENT_U6_BLOOD_MOSS 0x08
35#define REAGENT_U6_SPIDER_SILK 0x10
36#define REAGENT_U6_GARLIC 0x20
37#define REAGENT_U6_GINSENG 0x40
38#define REAGENT_U6_SULFUROUS_ASH 0x80
40#define MAX_SCRIPT_LENGTH 65000
41#define MAX_TOKEN_LENGTH 255
42#define MAX_STACK_DEPTH 255
44#define MAGIC_STATE_READY 0x00
45#define MAGIC_STATE_SELECT_SPELL 0x01
46#define MAGIC_STATE_PROCESS_SCRIPT 0x02
47#define MAGIC_STATE_ACQUIRE_TARGET 0x03
48#define MAGIC_STATE_ACQUIRE_INPUT 0x04
49#define MAGIC_STATE_ACQUIRE_DIRECTION 0x05
50#define MAGIC_STATE_ACQUIRE_INV_OBJ 0x06
51#define MAGIC_STATE_TALK_TO_ACTOR 0x07
52#define MAGIC_STATE_ACQUIRE_SPELL 0x08
53#define MAGIC_STATE_ACQUIRE_OBJ 0x09
55#define MAGIC_ALL_SPELLS 255
67 Spell(uint8 new_num,
const char *new_name =
"undefined name",
const char *new_invocation =
"kawo", uint8 new_reagents = 255) {
69 name = scumm_strdup(new_name);
70 invocation = scumm_strdup(new_invocation);
71 reagents = new_reagents;
82 char cast_buffer_str[26];
83 uint8 cast_buffer_len;
97 bool read_spell_list();
98 void clear_cast_buffer() {
99 cast_buffer_str[0] =
'\0';
102 bool start_new_spell();
103 Obj *book_equipped();
105 void cast_spell_directly(uint8 spell_num);
107 uint16 callback(uint16 msg,
CallBack *caller,
void *data =
nullptr)
override;
108 bool process_script_return(uint8 ret);
109 bool resume(
const MapCoord &location);
110 bool resume(NuvieDir dir);
111 bool resume_with_spell_num(uint8 spell_num);
112 bool resume(
Obj *obj);
114 bool is_waiting_for_location()
const {
115 if (magic_script && state == MAGIC_STATE_ACQUIRE_TARGET)
return true;
118 bool is_waiting_for_direction()
const {
119 if (magic_script && state == MAGIC_STATE_ACQUIRE_DIRECTION)
return true;
122 bool is_waiting_for_inventory_obj()
const {
123 if (magic_script && state == MAGIC_STATE_ACQUIRE_INV_OBJ)
return true;
126 bool is_waiting_for_obj()
const {
127 if (magic_script && state == MAGIC_STATE_ACQUIRE_OBJ)
return true;
130 bool is_waiting_to_talk()
const {
131 if (state == MAGIC_STATE_TALK_TO_ACTOR)
return true;
134 bool is_waiting_for_spell()
const {
135 if (magic_script && state == MAGIC_STATE_ACQUIRE_SPELL)
return true;
138 bool is_selecting_spell()
const {
139 if (magic_script && state == MAGIC_STATE_SELECT_SPELL)
return true;
143 bool is_waiting_to_resume()
const {
144 if (magic_script)
return true;
148 Spell *get_spell(uint8 spell_num) {
149 return spell[spell_num];
151 Obj *get_spellbook_obj() {
152 return spellbook_obj;
155 Actor *get_actor_from_script();
156 void show_spell_description(uint8 index);
158 bool spellbook_has_spell(
Obj *book, uint8 spell_index);
159 void display_ingredients(uint8 index);
160 void display_spell_incantation(uint8 index);
Definition: call_back.h:50