blob: 81fdf40f859558047e1b3ea4d3775c147de2ef99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*
* PARSEC HEADER: obj_cust.h
*/
#ifndef _OBJ_CUST_H_
#define _OBJ_CUST_H_
// maximum number of custom (additional) types --------------------------------
//
#define MAX_NUM_CUSTOM_TYPES 64
// custom type flags ----------------------------------------------------------
//
#define CUSTOM_TYPE_DEFAULT 0x0000
#define CUSTOM_TYPE_SUMMONABLE 0x0001
#define CUSTOM_TYPE_NOT_PERSISTANT 0x0002
// custom object notify events ------------------------------------------------
//
enum {
CUSTOM_NOTIFY_GENOBJECT_DELETE = 0 // GenObject will be deleted
};
// structure for registration/maintenance of custom types ---------------------
//
struct custom_type_info_s {
const char* type_name;
dword type_id;
size_t type_size;
CustomObject* type_template;
int type_flags;
void (*callback_init)( CustomObject *base );
void (*callback_instant)( CustomObject *base );
void (*callback_destroy)( CustomObject *base );
int (*callback_animate)( CustomObject *base );
int (*callback_collide)( CustomObject *base );
void (*callback_notify)( CustomObject *base, GenObject *genobj, int event );
int (*callback_persist)( CustomObject* base, int ToStream, void* relist );
dword _mksiz64[ 4 ];
};
// external functions
dword OBJ_FetchCustomTypeId( const char *name );
const char* OBJ_FetchCustomTypeName( dword objtypeid );
size_t OBJ_FetchCustomTypeSize( dword objtypeid );
CustomObject* OBJ_FetchCustomTypeTemplate( dword objtypeid );
int OBJ_InitFromCustomTypeTemplate( CustomObject *obj, CustomObject *templ );
void OBJ_InitCustomType( GenObject *classpo );
dword OBJ_RegisterCustomType( custom_type_info_s *info );
int OBJ_GetCustomTypeFlags( dword objtypeid );
void OBJ_RegisterNotifyCustomObject( GenObject *genobj, CustomObject *customobj );
int OBJ_UnregisterNotifyCustomObject( GenObject *genobj, CustomObject *customobj );
void OBJ_NotifyCustomObjectsList( GenObject *genobj, int event );
// external variables
extern int num_custom_types;
extern custom_type_info_s custom_type_info[];
#endif // _OBJ_CUST_H_
|