22#ifndef NUVIE_CORE_OBJ_H
23#define NUVIE_CORE_OBJ_H
25#include "ultima/nuvie/core/nuvie_defs.h"
26#include "ultima/nuvie/misc/u6_llist.h"
33#define NO_OBJ_STATUS 0
36#define OBJ_STATUS_OK_TO_TAKE 0x1
38#define OBJ_STATUS_INVISIBLE 0x2
39#define OBJ_STATUS_CHARMED 0x4
44#define OBJ_STATUS_ON_MAP 0x0
45#define OBJ_STATUS_IN_CONTAINER 0x8
46#define OBJ_STATUS_IN_INVENTORY 0x10
47#define OBJ_STATUS_READIED 0x18
48#define OBJ_STATUS_MASK_GET 0x18
49#define OBJ_STATUS_MASK_SET 0xE7
51#define OBJ_STATUS_TEMPORARY 0x20
52#define OBJ_STATUS_EGG_ACTIVE 0x40
53#define OBJ_STATUS_BROKEN 0x40
54#define OBJ_STATUS_MUTANT 0x40
55#define OBJ_STATUS_CURSED 0x40
56#define OBJ_STATUS_LIT 0x80
66#define OBJ_LOC_READIED 3
69#define NUVIE_OBJ_STATUS_LOC_MASK_GET 0x7
70#define NUVIE_OBJ_STATUS_LOC_MASK_SET 0xf8
72#define NUVIE_OBJ_STATUS_SCRIPTING 0x8
73#define NUVIE_OBJ_STATUS_ACTOR_OBJ 0x10
75#define OBJ_MATCH_QUALITY true
76#define OBJ_NOMATCH_QUALITY false
78#define OBJ_MATCH_FRAME_N true
79#define OBJ_NOMATCH_FRAME_N false
82#define OBJ_DONT_CHECK_PARENT false
106 bool is_script_obj()
const {
107 return (nuvie_status & NUVIE_OBJ_STATUS_SCRIPTING);
109 bool is_actor_obj()
const {
110 return (nuvie_status & NUVIE_OBJ_STATUS_ACTOR_OBJ);
113 bool is_ok_to_take()
const;
114 bool is_invisible()
const {
115 return (status & OBJ_STATUS_INVISIBLE);
117 bool is_charmed()
const {
118 return (status & OBJ_STATUS_CHARMED);
120 bool is_temporary()
const {
121 return (status & OBJ_STATUS_TEMPORARY);
123 bool is_egg_active()
const {
124 return (status & OBJ_STATUS_EGG_ACTIVE);
126 bool is_broken()
const {
127 return (status & OBJ_STATUS_BROKEN);
129 bool is_mutant()
const {
130 return (status & OBJ_STATUS_MUTANT);
132 bool is_cursed()
const {
133 return (status & OBJ_STATUS_CURSED);
135 bool is_lit()
const {
136 return (status & OBJ_STATUS_LIT);
139 bool is_on_map()
const {
140 return ((nuvie_status & NUVIE_OBJ_STATUS_LOC_MASK_GET) == OBJ_LOC_MAP);
142 bool is_in_container()
const {
143 return ((nuvie_status & NUVIE_OBJ_STATUS_LOC_MASK_GET) == OBJ_LOC_CONT);
145 bool is_in_inventory(
bool check_parent =
true)
const;
147 bool is_readied()
const {
148 return ((nuvie_status & NUVIE_OBJ_STATUS_LOC_MASK_GET) == OBJ_LOC_READIED);
151 bool has_container()
const {
152 return (container !=
nullptr);
154 void make_container();
155 Obj *get_container_obj(
bool recursive =
false);
156 uint32 container_count_objects()
const;
158 uint8 get_engine_loc()
const;
159 Actor *get_actor_holding_obj();
161 void set_on_map(
U6LList *map_list);
162 void set_in_container(
Obj *container_obj);
163 void set_in_inventory();
165 void set_invisible(
bool flag);
167 void set_temporary(
bool flag =
true);
169 void set_ok_to_take(
bool flag,
bool recursive =
false);
173 void set_in_script(
bool flag);
174 void set_actor_obj(
bool flag);
176 void add(
Obj *obj,
bool stack =
false,
bool addAtTail =
false);
178 bool remove(
Obj *obj);
180 Obj *find_in_container(uint16 obj_n, uint8 quality,
bool match_quality = OBJ_MATCH_QUALITY, uint8 frame_n = 0,
bool match_frame_n = OBJ_NOMATCH_FRAME_N,
Obj **prev_obj =
nullptr)
const;
182 uint32 get_total_qty(uint16 match_obj_n);
186 void add_and_stack(
Obj *obj,
bool addAtTail =
false);
Definition: u6_llist.h:46