22#ifndef NUVIE_CORE_CONVERSE_INTERPRET_H
23#define NUVIE_CORE_CONVERSE_INTERPRET_H
25#include "ultima/nuvie/core/converse.h"
26#include "common/stack.h"
44#define U6OP_CANCARRY 0x9a
45#define U6OP_WEIGHT 0x9b
46#define U6OP_HORSED 0x9d
47#define U6OP_HASOBJ 0x9f
54#define U6OP_OBJCOUNT 0xbb
55#define U6OP_INPARTY 0xc6
56#define U6OP_OBJINPARTY 0xc7
58#define U6OP_LEAVE 0xcc
59#define U6OP_NPCNEARBY 0xd7
60#define U6OP_WOUNDED 0xda
61#define U6OP_POISONED 0xdc
69#define U6OP_HORSE 0x9c
70#define U6OP_SLEEP 0x9e
72#define U6OP_ENDIF 0xa2
75#define U6OP_CLEARF 0xa5
77#define U6OP_ASSIGN 0xa8
79#define U6OP_DPRINT 0xb5
81#define U6OP_INDEXOF 0xb7
83#define U6OP_DELETE 0xba
84#define U6OP_INVENTORY 0xbe
85#define U6OP_PORTRAIT 0xbf
86#define U6OP_ADDKARMA 0xc4
87#define U6OP_SUBKARMA 0xc5
90#define U6OP_WORKTYPE 0xcd
91#define U6OP_RESURRECT 0xd6
92#define U6OP_SETNAME 0xd8
95#define U6OP_ENDANSWER 0xee
96#define U6OP_KEYWORDS 0xef
97#define U6OP_SLOOK 0xf1
98#define U6OP_SCONVERSE 0xf2
99#define U6OP_SPREFIX 0xf3
100#define U6OP_ANSWER 0xf6
102#define U6OP_ASKC 0xf8
103#define U6OP_INPUTSTR 0xf9
104#define U6OP_INPUT 0xfb
105#define U6OP_INPUTNUM 0xfc
106#define U6OP_SIDENT 0xff
108#define U6OP_ENDDATA 0xb8
110#define MDOP_MISC_ACTION 0xd1
140 converse_value start_c;
142 converse_value break_c;
155 converse_value db_loc;
156 converse_value db_offset;
159 const char *get_rstr(uint32 sn)
const {
160 return ((sn < rstrings.
size()) ? rstrings[sn].c_str() :
"");
165 void set_ystr(
const char *s);
166 void set_rstr(uint32 sn,
const char *s);
167 converse_value add_rstr(
const char *s);
169 void let(uint8 v, uint8 t) {
174 decl_v = decl_t = 0x00;
177 void enter(converse_value c);
180 while (b_frame && !b_frame->empty()) leave();
182 struct convi_frame_s *top_frame()
const {
183 return ((b_frame && !b_frame->empty()) ? b_frame->top() :
nullptr);
185 void do_frame(converse_value c);
187 void set_break(converse_value c) {
188 if (top_frame()) top_frame()->break_c = c;
190 converse_value get_break()
const {
191 return (top_frame() ? top_frame()->break_c : 0x00);
196 void set_run(
bool r) {
197 if (top_frame()) top_frame()->run = r;
199 bool get_run()
const {
200 return (top_frame() ? top_frame()->run :
true);
204 ConverseInterpret(Converse *owner);
205 virtual ~ConverseInterpret();
207 bool waiting()
const {
228 virtual void collect_input();
229 virtual struct in_val_s read_value();
230 void eval(uint32 vi = 0);
232 void add_val(converse_value c, uint8 d = 0);
233 void add_text(
unsigned char c = 0);
236 uint32 val_count()
const {
239 converse_value get_val(uint32 vi);
240 uint8 get_val_size(uint32 vi);
241 converse_value pop_val();
242 uint8 pop_val_size();
267 virtual uint8 npc_num(uint32 n);
269 bool var_input()
const {
270 return decl_t != 0x00;
273 struct converse_db_s *get_db(uint32 loc, uint32 i);
274 converse_value get_db_integer(uint32 loc, uint32 i);
275 void set_db_integer(uint32 loc, uint32 i, converse_value val);
276 char *get_db_string(uint32 loc, uint32 i);
277 converse_value find_db_string(uint32 loc,
const char *dstring);
280 virtual bool is_print(converse_value check)
const {
281 return (((check == 0x0a) || (check >= 0x20 && check <= 0x7a) || (check == 0x7e) || (check == 0x7b)));
283 virtual bool is_ctrl(converse_value code)
const {
284 return (((code >= 0xa1 || code == 0x9c || code == 0x9e) && !is_valop(code) && !is_datasize(code)));
286 virtual bool is_datasize(converse_value check)
const {
287 return ((check == 0xd3 || check == 0xd2 || check == 0xd4));
289 virtual bool is_valop(converse_value check)
const {
290 return (((check == 0x81) || (check == 0x82) || (check == 0x83)
291 || (check == 0x84) || (check == 0x85) || (check == 0x86)
292 || (check == 0x90) || (check == 0x91) || (check == 0x92)
293 || (check == 0x93) || (check == 0x94) || (check == 0x95)
294 || (check == 0x9a) || (check == 0x9b) || (check == 0x9d)
295 || (check == 0x9f) || (check == 0xa0) || (check == 0xa7)
296 || (check == 0xab) || (check == 0xb2) || (check == 0xb3)
297 || (check == 0xb4) || (check == 0xb7) || (check == 0xbb) || (check == 0xc6)
298 || (check == 0xc7) || (check == 0xca) || (check == 0xcc)
299 || (check == 0xd7) || (check == 0xda) || (check == 0xdc)
300 || (check == 0xdd) || (check == 0xe0) || (check == 0xe1)
301 || (check == 0xe2) || (check == 0xe3) || (check == 0xe4)));
303 const char *evop_str(converse_value op);
304 const char *op_str(converse_value op);
size_type size() const
Definition: array.h:316
Definition: converse.h:78
Definition: converse_interpret.h:115
Definition: converse_interpret.h:328
Definition: converse_interpret.h:322
Definition: converse_interpret.h:308
Definition: converse_interpret.h:314
Definition: converse_interpret.h:132
Definition: converse_interpret.h:138
Definition: converse_interpret.h:127