22 #ifndef NUVIE_USECODE_USECODE_H 23 #define NUVIE_USECODE_USECODE_H 25 #include "ultima/shared/std/string.h" 26 #include "ultima/nuvie/misc/call_back.h" 27 #include "ultima/nuvie/misc/map_entity.h" 28 #include "ultima/nuvie/core/obj_manager.h" 29 #include "ultima/nuvie/core/player.h" 36 #define USE_EVENT_USE 0x01 37 #define USE_EVENT_LOOK 0x02 38 #define USE_EVENT_PASS 0x04 39 #define USE_EVENT_MESSAGE 0x08 40 #define USE_EVENT_SEARCH 0x10 42 #define USE_EVENT_MOVE 0x40 43 #define USE_EVENT_LOAD 0x80 44 #define USE_EVENT_READY 0x0100 45 #define USE_EVENT_GET 0x0200 46 #define USE_EVENT_DROP 0x0400 47 #define USE_EVENT_INPUT_CANCEL 0x501 53 typedef uint16 UseCodeEvent;
137 const char *useCodeTypeToString(UseCodeType type);
171 Actor *actor_ref, *actor2_ref;
173 CallbackMessage *msg_ref;
187 bool use_obj(uint16 x, uint16 y, uint8 z,
Obj *src_obj =
nullptr);
188 bool use_obj(
Obj *obj,
Obj *src_obj =
nullptr) {
189 return (use_obj(obj, player->get_actor()));
192 virtual bool use_obj(
Obj *obj,
Actor *actor);
193 virtual bool look_obj(
Obj *obj,
Actor *actor) {
196 virtual bool pass_obj(
Obj *obj,
Actor *actor, uint16 x, uint16 y) {
199 virtual bool search_obj(
Obj *obj,
Actor *actor) {
202 virtual bool move_obj(
Obj *obj, sint16 rel_x, sint16 rel_y);
203 virtual bool load_obj(
Obj *obj) {
206 virtual bool message_obj(
Obj *obj, CallbackMessage msg,
void *msg_data) {
209 virtual bool ready_obj(
Obj *obj,
Actor *actor);
210 virtual bool get_obj(
Obj *obj,
Actor *actor) {
213 virtual bool drop_obj(
Obj *obj,
Actor *actor, uint16 x, uint16 y, uint16 qty = 0) {
217 virtual bool has_usecode(
Obj *obj, UseCodeEvent ev = USE_EVENT_USE);
218 virtual bool has_usecode(
Actor *actor, UseCodeEvent ev = USE_EVENT_USE) {
221 virtual bool has_lookcode(
Obj *obj) {
222 return has_usecode(obj, USE_EVENT_LOOK);
224 virtual bool has_passcode(
Obj *obj) {
225 return has_usecode(obj, USE_EVENT_PASS);
227 virtual bool has_movecode(
Obj *obj) {
228 return has_usecode(obj, USE_EVENT_MOVE);
230 virtual bool has_loadcode(
Obj *obj) {
231 return has_usecode(obj, USE_EVENT_LOAD);
233 virtual bool has_readycode(
Obj *obj) {
234 return has_usecode(obj, USE_EVENT_READY);
236 virtual bool cannot_unready(
const Obj *obj)
const {
239 virtual bool has_getcode(
Obj *obj) {
240 return has_usecode(obj, USE_EVENT_GET);
242 virtual bool has_dropcode(
Obj *obj) {
243 return has_usecode(obj, USE_EVENT_DROP);
246 bool is_door(
const Obj *obj)
const {
247 return (is_locked_door(obj) || is_unlocked_door(obj));
249 virtual bool is_locked_door(
const Obj *obj)
const {
252 virtual bool is_unlocked_door(
const Obj *obj)
const {
255 virtual bool is_closed_door(
const Obj *obj)
const {
258 virtual bool process_effects(
Obj *container_obj,
Actor *actor) {
261 virtual bool is_food(
const Obj *obj)
const {
264 virtual bool is_container(
const Obj *obj)
const;
265 virtual bool is_container(uint16 obj_n, uint8 frame_n)
const {
268 virtual bool is_readable(
const Obj *obj)
const {
271 virtual bool is_chest(
const Obj *obj)
const {
275 void set_itemref(sint32 *val) {
276 items.sint_ref = val;
278 void set_itemref(
Obj *val) {
281 void set_itemref(
Actor *val,
Actor *val2 =
nullptr) {
282 items.actor_ref = val;
283 items.actor2_ref = val2;
286 items.mapcoord_ref = val;
289 Obj *get_obj_from_container(
Obj *obj);
290 bool search_container(
Obj *obj,
bool show_string =
true);
291 Obj *destroy_obj(
Obj *obj, uint32 count = 0,
bool run_usecode =
true);
292 bool out_of_use_range(
Obj *obj,
bool check_enemies);
295 bool is_script_running();
299 void toggle_frame(
Obj *obj);
300 void dbg_print_event(UseCodeEvent event,
Obj *obj);
Definition: configuration.h:61
Definition: usecode.h:151
Definition: actor_manager.h:42
Definition: detection.h:27
Definition: map_entity.h:45
Definition: obj_manager.h:75