… | |
… | |
88 | { |
88 | { |
89 | tag_t ACC (RW, count); /* Generation count for this object */ |
89 | tag_t ACC (RW, count); /* Generation count for this object */ |
90 | UUID uuid; // Unique Identifier, survives saves etc. |
90 | UUID uuid; // Unique Identifier, survives saves etc. |
91 | |
91 | |
92 | /* These variables are not changed by copy_object() */ |
92 | /* These variables are not changed by copy_object() */ |
93 | struct pl *ACC (RW, contr); /* Pointer to the player which control this object */ |
93 | player *ACC (RW, contr); /* Pointer to the player which control this object */ |
94 | struct object *ACC (RW, next); /* Pointer to the next object in the free/used list */ |
94 | object *ACC (RW, next); /* Pointer to the next object in the free/used list */ |
95 | struct object *ACC (RW, prev); /* Pointer to the previous object in the free/used list */ |
95 | object *ACC (RW, prev); /* Pointer to the previous object in the free/used list */ |
96 | struct object *ACC (RW, active_next); /* Next & previous object in the 'active' */ |
96 | object *ACC (RW, active_next); /* Next & previous object in the 'active' */ |
97 | struct object *ACC (RW, active_prev); /* List. This is used in process_events */ |
97 | object *ACC (RW, active_prev); /* List. This is used in process_events */ |
98 | /* so that the entire object list does not */ |
98 | /* so that the entire object list does not */ |
99 | /* need to be gone through. */ |
99 | /* need to be gone through. */ |
100 | struct object *ACC (RW, below); /* Pointer to the object stacked below this one */ |
100 | object *ACC (RW, below); /* Pointer to the object stacked below this one */ |
101 | struct object *ACC (RW, above); /* Pointer to the object stacked above this one */ |
101 | object *ACC (RW, above); /* Pointer to the object stacked above this one */ |
102 | /* Note: stacked in the *same* environment */ |
102 | /* Note: stacked in the *same* environment */ |
103 | struct object *inv; /* Pointer to the first object in the inventory */ |
103 | object *inv; /* Pointer to the first object in the inventory */ |
104 | struct object *ACC (RW, container); /* Current container being used. I think this |
104 | object *ACC (RW, container); /* Current container being used. I think this |
105 | * is only used by the player right now. |
105 | * is only used by the player right now. |
106 | */ |
106 | */ |
107 | struct object *ACC (RW, env); /* Pointer to the object which is the environment. |
107 | object *ACC (RW, env); /* Pointer to the object which is the environment. |
108 | * This is typically the container that the object is in. |
108 | * This is typically the container that the object is in. |
109 | */ |
109 | */ |
110 | struct object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ |
110 | object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ |
111 | struct object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
111 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
112 | struct mapstruct *ACC (RW, map); /* Pointer to the map in which this object is present */ |
112 | maptile *ACC (RW, map); /* Pointer to the map in which this object is present */ |
113 | }; |
113 | }; |
114 | |
114 | |
115 | // these are being copied |
115 | // these are being copied |
116 | struct object_copy : attachable<object> |
116 | struct object_copy : attachable<object> |
117 | { |
117 | { |
… | |
… | |
206 | sint8 ACC (RW, range); /* Range of the spell */ |
206 | sint8 ACC (RW, range); /* Range of the spell */ |
207 | uint8 ACC (RW, range_modifier); /* How going up in level effects range */ |
207 | uint8 ACC (RW, range_modifier); /* How going up in level effects range */ |
208 | char *ACC (RW, spellarg); |
208 | char *ACC (RW, spellarg); |
209 | |
209 | |
210 | /* Following are values used by any object */ |
210 | /* Following are values used by any object */ |
211 | struct treasureliststruct *ACC (RW, randomitems); /* Items to be generated */ |
211 | treasurelist *ACC (RW, randomitems); /* Items to be generated */ |
212 | struct archetype *ACC (RW, arch); /* Pointer to archetype */ |
212 | archetype *ACC (RW, arch); /* Pointer to archetype */ |
213 | struct archetype *ACC (RW, other_arch); /* Pointer used for various things - mostly used for what */ |
213 | archetype *ACC (RW, other_arch); /* Pointer used for various things - mostly used for what */ |
214 | key_value *key_values; /* Fields not explictly known by the loader. */ |
214 | key_value *key_values; /* Fields not explictly known by the loader. */ |
215 | /* this objects turns into or what this object creates */ |
215 | /* this objects turns into or what this object creates */ |
216 | uint32 flags[4]; /* various flags */ |
216 | uint32 flags[4]; /* various flags */ |
217 | uint16 ACC (RW, animation_id); /* An index into the animation array */ |
217 | uint16 ACC (RW, animation_id); /* An index into the animation array */ |
218 | uint8 ACC (RW, anim_speed); /* ticks between animation-frames */ |
218 | uint8 ACC (RW, anim_speed); /* ticks between animation-frames */ |
… | |
… | |
230 | float ACC (RW, move_slow_penalty); /* How much this slows down the object */ |
230 | float ACC (RW, move_slow_penalty); /* How much this slows down the object */ |
231 | }; |
231 | }; |
232 | |
232 | |
233 | struct object : zero_initialised, object_keep, object_copy, object_pod |
233 | struct object : zero_initialised, object_keep, object_copy, object_pod |
234 | { |
234 | { |
|
|
235 | typedef unordered_vector<object *> vector; |
|
|
236 | |
|
|
237 | static vector mortals; |
|
|
238 | static vector active; // active objects, not yet used |
|
|
239 | static vector objects; // not used yet, use first->next->... |
|
|
240 | static object *first; // will be replaced by "objects" |
|
|
241 | |
235 | static object *create (); |
242 | static object *create (); |
236 | void free (bool free_inventory = false); |
243 | void free (bool free_inventory = false); |
237 | |
244 | |
238 | static void free_mortals (); |
245 | static void free_mortals (); |
239 | static bool can_merge (object *op1, object *op2); |
246 | static bool can_merge (object *op1, object *op2); |
240 | |
247 | |
241 | void clear (); |
248 | void clear (); |
242 | void clone (object *destination); |
249 | void clone (object *destination); |
|
|
250 | |
|
|
251 | bool destroyed () { return QUERY_FLAG (this, FLAG_FREED); } |
243 | |
252 | |
244 | void instantiate () |
253 | void instantiate () |
245 | { |
254 | { |
246 | if (!uuid.seq) // HACK |
255 | if (!uuid.seq) // HACK |
247 | uuid = gen_uuid (); |
256 | uuid = gen_uuid (); |
… | |
… | |
343 | struct archetype : zero_initialised |
352 | struct archetype : zero_initialised |
344 | { |
353 | { |
345 | archetype (); |
354 | archetype (); |
346 | ~archetype (); |
355 | ~archetype (); |
347 | |
356 | |
|
|
357 | static archetype *find (const char *arch); |
|
|
358 | |
348 | shstr ACC (RW, name); /* More definite name, like "generate_kobold" */ |
359 | shstr ACC (RW, name); /* More definite name, like "generate_kobold" */ |
349 | struct archetype *ACC (RW, next); /* Next archetype in a linked list */ |
360 | struct archetype *ACC (RW, next); /* Next archetype in a linked list */ |
350 | struct archetype *ACC (RW, head); /* The main part of a linked object */ |
361 | struct archetype *ACC (RW, head); /* The main part of a linked object */ |
351 | struct archetype *ACC (RW, more); /* Next part of a linked object */ |
362 | struct archetype *ACC (RW, more); /* Next part of a linked object */ |
352 | object ACC (RO, clone); /* An object from which to do copy_object() */ |
363 | object ACC (RO, clone); /* An object from which to do copy_object() */ |
353 | uint32 ACC (RW, editable); /* editable flags (mainly for editor) */ |
364 | uint32 ACC (RW, editable); /* editable flags (mainly for editor) */ |
354 | sint8 ACC (RW, tail_x), ACC (RW, tail_y); /* Where the lower right most portion of the object is |
365 | sint8 ACC (RW, tail_x), ACC (RW, tail_y); /* Where the lower right most portion of the object is |
355 | * in comparison to the head. |
366 | * in comparison to the head. |
356 | */ |
367 | */ |
357 | }; |
368 | }; |
358 | |
369 | |
359 | extern object *objects; |
370 | extern object *objects; |
360 | extern object *active_objects; |
371 | extern object *active_objects; |
361 | |
372 | |