forked from NVIDIA/Q2RTX
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcpp.hint
More file actions
581 lines (518 loc) · 24.5 KB
/
cpp.hint
File metadata and controls
581 lines (518 loc) · 24.5 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
// such as names of functions and macros.
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
/**
*
*
*
* Macros for properly declaring(and thus implementing) the static
* save descriptor field logics for any svg_base_edict_t derived classes.
*
*
*
**/
/**
* @brief Opens the save descriptor field definition for the specified classType.
**/
#define SAVE_DESCRIPTOR_FIELDS_BEGIN(classType) \
svg_save_descriptor_field_t classType::saveDescriptorFields[] = {\
/**
* @brief This macro actually declares the field descriptor. It is used as an internal macro for
* the other macros which are used to define the save field descriptors with.
**/
#define _SAVE_DESCRIPTOR_FIELD(classType, fieldName, fieldType, fieldSize, flags) \
{ \
fieldType, #fieldName, q_offsetof(classType, fieldName), fieldSize, flags \
}
/**
* @brief This macro is used to define a field descriptor for a field in the save descriptor.
**/
#define SAVE_DESCRIPTOR_DEFINE_FIELD(classType, fieldName, fieldType) _SAVE_DESCRIPTOR_FIELD(classType, fieldName, fieldType, 1, 0)
/**
* @brief This macro is used to define a field descriptor for a field in the save descriptor.
**/
#define SAVE_DESCRIPTOR_DEFINE_FUNCPTR(classType, fieldName, fieldType, funcPtrType) _SAVE_DESCRIPTOR_FIELD(classType, fieldName, fieldType, 1, funcPtrType )
/**
* @brief This macro is used to define a field descriptor for a field in the save descriptor.
* It is used for fields that are arrays of a specific size.
**/
#define SAVE_DESCRIPTOR_DEFINE_FIELD_SIZE(classType, fieldName, fieldType, fieldSize) _SAVE_DESCRIPTOR_FIELD(classType, fieldName, fieldType, fieldSize, 0)
/**
* @brief This macro is used to define a field descriptor for a field in the save descriptor.
* It is used for fields that are arrays of a specific size.
**/
#define SAVE_DESCRIPTOR_DEFINE_FIELD_ARRAY(classType, fieldName, fieldType, fieldSize) _SAVE_DESCRIPTOR_FIELD(classType, fieldName, fieldType, fieldSize, 0)
/**
* @brief Opens the save descriptor field definition for the specified classType.
**/
#define SAVE_DESCRIPTOR_FIELDS_END() \
} \
/**
*
* Macros for properly declaring and defining the static
* save descriptor field logics for any svg_base_edict_t
* derived classes.
*
**/
/**
* @brief Any derived class which needs support for saving implemented,
* it declare support routines using this macro.
**/
#define SVG_SAVE_DESCRIPTOR_FIELDS_DECLARE_IMPLEMENTATION() \
static svg_save_descriptor_field_t saveDescriptorFields[]; \
virtual svg_save_descriptor_field_t *GetSaveDescriptorFields() override; \
virtual int32_t GetSaveDescriptorFieldsCount() override; \
virtual svg_save_descriptor_field_t *GetSaveDescriptorField( const char *name ) override;
/**
* @brief This macro defines the necessary implementations for the save descriptor fields functions:
* GetSaveDescriptorFields(), GetSaveDescriptorFieldCount() and GetSaveDescriptorField().
**/
#define SVG_SAVE_DESCRIPTOR_FIELDS_DEFINE_IMPLEMENTATION( classType, parentClassType ) \
/* @return A pointer of type `svg_save_descriptor_field_t` representing the save descriptor fields. */ \
svg_save_descriptor_field_t *classType::GetSaveDescriptorFields() { \
return classType::saveDescriptorFields; \
} \
/* @return The number of save descriptor fields. */ \
int32_t classType::GetSaveDescriptorFieldsCount() { \
return sizeof( classType::saveDescriptorFields) / sizeof(svg_save_descriptor_field_t); \
} \
/* A pointer to the save descriptor field with the given name. */\
svg_save_descriptor_field_t *classType::GetSaveDescriptorField( const char *name ) { \
/* Check if the name is valid. */\
if ( !name ) { \
return nullptr; \
} \
/* Check if the name is empty. */ \
if ( *name == '\0' ) { \
return nullptr; \
} \
\
/* Check if parent type has a save descriptor field.*/ \
if ( parentClassType::GetSaveDescriptorField( name ) ) { \
return parentClassType::GetSaveDescriptorField( name ); \
} \
\
/* Get pointer to the type's save descriptor fields.*/ \
svg_save_descriptor_field_t *fields = classType::GetSaveDescriptorFields(); \
\
/* Iterate this edict (derived-) type's save descriptor fields and return a pointer to it if found. */ \
for ( int32_t i = 0; i < classType::GetSaveDescriptorFieldsCount(); i++ ) { \
if ( strcmp( name, fields[ i ].name ) == 0 ) { \
return &classType::saveDescriptorFields[ i ]; \
} \
} \
\
/* Unable to find. */\
return nullptr;\
}\
/**
* For use with "Non-Static-Member" function callbacks residing
* outside of an edict class.
**/
//
// Think:
//
//! Declares the global function in the notation style compatible for our use with
//! DEFINE_GLOBAL_CALLBACK_THINK
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_THINK(className, functionName) \
auto functionName( className *self ) -> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_THINK(functionName) \
auto functionName( svg_base_edict_t *self ) -> void \
//
// Spawn:
//
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_SPAWN(className, functionName) \
auto functionName( className *self ) -> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_SPAWN(functionName) \
auto functionName( svg_base_edict_t *self ) -> void \
//
// PostSpawn:
//
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_POSTSPAWN(className, functionName) \
auto functionName( className *self ) -> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_POSTSPAWN(functionName) \
auto functionName( svg_base_edict_t *self ) -> void \
//
// PreThink:
//
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_PRETHINK(className, functionName) \
auto functionName( className *self ) -> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_PRETHINK(functionName) \
auto functionName( svg_base_edict_t *self ) -> void \
//
// PostThink:
//
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_POSTTHINK(className, functionName) \
auto functionName( className *self ) -> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_POSTTHINK(functionName) \
auto functionName( svg_base_edict_t *self ) -> void \
//
// Blocked:
//
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_BLOCKED(className, functionName) \
auto functionName( className *self, svg_base_edict_t *other ) -> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_BLOCKED(functionName) \
auto functionName( svg_base_edict_t *self, svg_base_edict_t *other ) -> void \
//
// Touch:
//
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_TOUCH(className, functionName) \
auto functionName( className *self, svg_base_edict_t *other, const cm_plane_t *plane, cm_surface_t *surf )-> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_TOUCH(functionName) \
auto functionName( svg_base_edict_t *self, svg_base_edict_t *other, const cm_plane_t *plane, cm_surface_t *surf) -> void \
//
// Use:
//
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_USE(className, functionName) \
auto functionName( className *self, svg_base_edict_t *other, svg_base_edict_t *activator, const entity_usetarget_type_t useType, const int32_t useValue ) -> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_USE(functionName) \
auto functionName( svg_base_edict_t *self, svg_base_edict_t *other, svg_base_edict_t *activator, const entity_usetarget_type_t useType, const int32_t useValue ) -> void \
//
// OnSignalIn:
//
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_ON_SIGNALIN(className, functionName) \
auto functionName( className *self, svg_base_edict_t *other, svg_base_edict_t *activator, const char *signalName, const svg_signal_argument_array_t &signalArguments ) -> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_ON_SIGNALIN(functionName) \
auto functionName( svg_base_edict_t *self, svg_base_edict_t *other, svg_base_edict_t *activator, const char *signalName, const svg_signal_argument_array_t &signalArguments ) -> void \
//
// Pain:
//
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_PAIN(className, functionName) \
auto functionName( className *self, svg_base_edict_t *other, float kick, int damage ) -> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_PAIN(functionName) \
auto functionName( svg_base_edict_t *self, svg_base_edict_t *other, float kick, int damage ) -> void \
//
// Die.
//
#if 1
#define DECLARE_GLOBAL_CLASSNAME_CALLBACK_DIE(className, functionName) \
auto functionName( className *self, svg_base_edict_t *inflictor, svg_base_edict_t *attacker, int damage, vec_t *point ) -> void \
#endif
//!
#define DECLARE_GLOBAL_CALLBACK_DIE(functionName) \
auto functionName( svg_base_edict_t *self, svg_base_edict_t *inflictor, svg_base_edict_t *attacker, int damage, vec_t *point ) -> void \
//
// PushMoveInfo EndMove.
//
#define DECLARE_MEMBER_CALLBACK_PUSHMOVE_ENDMOVE(className, functionName) \
static auto functionName(className *self) -> void; \
//! Defines the start of the function definition, awaiting to be prepended by its user
//! with the actual arguments and -> returnType;
//!
//! aka
//!
//! DEFINE_GLOBAL_CALLBACK_THINK(SVG_FreeEdict)(svg_base_edict_t *self) -> void {
//! ...
//! }
#define DEFINE_GLOBAL_CALLBACK_THINK(functionName) \
static const svg_save_funcptr_instance_t save__global_ ##functionName(#functionName, FPTR_SAVE_TYPE_THINK, reinterpret_cast<void *>(##functionName) ); \
auto functionName \
//! For Spawn.
#define DEFINE_GLOBAL_CALLBACK_SPAWN(functionName) \
static const svg_save_funcptr_instance_t save__global__ ##functionName(#functionName, FPTR_SAVE_TYPE_SPAWN, reinterpret_cast<void *>(##functionName)); \
auto functionName \
//! For PostSpawn.
#define DEFINE_GLOBAL_CALLBACK_POSTSPAWN(functionName) \
static const svg_save_funcptr_instance_t save__global__ ##functionName(#functionName, FPTR_SAVE_TYPE_POSTSPAWN, reinterpret_cast<void *>(##functionName)); \
auto functionName \
//! For PreThink
#define DEFINE_GLOBAL_CALLBACK_PRETHINK(functionName) \
static const svg_save_funcptr_instance_t save__global__ ##functionName(#functionName, FPTR_SAVE_TYPE_PRETHINK, reinterpret_cast<void *>(##functionName)); \
auto functionName \
//! For PostThink.
#define DEFINE_GLOBAL_CALLBACK_POSTTHINK(functionName) \
static const svg_save_funcptr_instance_t save__global__ ##functionName(#functionName, FPTR_SAVE_TYPE_POSTSPAWN, reinterpret_cast<void *>(##functionName)); \
auto functionName \
//! For Blocked.
#define DEFINE_GLOBAL_CALLBACK_BLOCKED(functionName) \
static const svg_save_funcptr_instance_t save__global__ ##functionName(#functionName, FPTR_SAVE_TYPE_BLOCKED, reinterpret_cast<void *>(##functionName)); \
auto functionName \
//! For Touch.
#define DEFINE_GLOBAL_CALLBACK_TOUCH(functionName) \
static const svg_save_funcptr_instance_t save__global__ ##functionName(#functionName, FPTR_SAVE_TYPE_TOUCH, reinterpret_cast<void *>(##functionName)); \
auto functionName \
//! For Use.
#define DEFINE_GLOBAL_CALLBACK_USE(functionName) \
static const svg_save_funcptr_instance_t save__global__ ##functionName(#functionName, FPTR_SAVE_TYPE_USE, reinterpret_cast<void *>(##functionName)); \
auto functionName \
//! For OnSignalIn.
#define DEFINE_GLOBAL_CALLBACK_ONSIGNALIN(functionName) \
static const svg_save_funcptr_instance_t save__global__ ##functionName(#functionName, FPTR_SAVE_TYPE_ONSIGNALIN, reinterpret_cast<void *>(##functionName)); \
auto functionName \
//! For Pain.
#define DEFINE_GLOBAL_CALLBACK_PAIN(functionName) \
static const svg_save_funcptr_instance_t save__global__ ##functionName(#functionName, FPTR_SAVE_TYPE_PAIN, reinterpret_cast<void *>(##functionName)); \
auto functionName \
//! For Die.
#define DEFINE_GLOBAL_CALLBACK_DIE(functionName) \
static const svg_save_funcptr_instance_t save__global__ ##functionName(#functionName, FPTR_SAVE_TYPE_DIE, reinterpret_cast<void *>(##functionName)); \
auto functionName \
//! Defines the start of the function definition, awaiting to be prepended by its user
//! with the actual arguments and -> returnType;
//!
//! aka
//!
//! DEFINE_GLOBAL_CALLBACK_THINK(SVG_FreeEdict)(svg_base_edict_t *self) -> void {
//! ...
//! }
/**
* For use with "Static-Member" function callbacks, residing inside
* an svg_base_edict_t or derived class.
**/
//! Generates a string such as: "className::functionName".
#define _DEFINE_MEMBER_CALLBACK_FULLNAME(className, functionName) \
("" className "::" functionName "") \
//
// Think:
//
//! Declares the member function in the notation style compatible for our use with
//! DEFINE_MEMBER_CALLBACK_THINK
#define DECLARE_MEMBER_CALLBACK_THINK(className, functionName) \
static auto functionName(className *self) -> void; \
//
// Spawn:
//
#define DECLARE_MEMBER_CALLBACK_SPAWN(className, functionName) \
static auto functionName(className *self) -> void; \
//
// PostSpawn:
//
#define DECLARE_MEMBER_CALLBACK_POSTSPAWN(className, functionName) \
static auto functionName(className *self) -> void; \
//
// PreThink:
//
#define DECLARE_MEMBER_CALLBACK_PRETHINK(className, functionName) \
static auto functionName(className *self) -> void; \
//
// PostThink:
//
#define DECLARE_MEMBER_CALLBACK_POSTTHINK(className, functionName) \
static auto functionName(className *self) -> void; \
//
// Blocked:
//
#define DECLARE_MEMBER_CALLBACK_BLOCKED(className, functionName) \
static auto functionName(className *self, svg_base_edict_t *other ) -> void; \
//
// Touch:
//
#define DECLARE_MEMBER_CALLBACK_TOUCH(className, functionName) \
static auto functionName(className *self, svg_base_edict_t *other, const cm_plane_t *plane, cm_surface_t *surf )-> void; \
//
// Use:
//
#define DECLARE_MEMBER_CALLBACK_USE(className, functionName) \
static auto functionName(className *self, svg_base_edict_t *other, svg_base_edict_t *activator, const entity_usetarget_type_t useType, const int32_t useValue ) -> void; \
//
// OnSignalIn:
//
#define DECLARE_MEMBER_CALLBACK_ON_SIGNALIN(className, functionName) \
static auto functionName(className *self, svg_base_edict_t *other, svg_base_edict_t *activator, const char *signalName, const svg_signal_argument_array_t &signalArguments ) -> void; \
//
// Pain:
//
#define DECLARE_MEMBER_CALLBACK_PAIN(className, functionName) \
static auto functionName(className *self, svg_base_edict_t *other, float kick, int damage ) -> void; \
//
// Die.
//
#define DECLARE_MEMBER_CALLBACK_DIE(className, functionName) \
static auto functionName(className *self, svg_base_edict_t *inflictor, svg_base_edict_t *attacker, int damage, vec_t *point ) -> void; \
//! Defines the start of the static member function definition, awaiting to be prepended by its user
//! with the actual arguments and -> returnType;
//!
//! aka
//!
//! DEFINE_MEMBER_CALLBACK_THINK(svg_monster_testdummy_t, monster_testdummy_think)(svg_monster_testdummy_t *self) -> void {
//! ...
//! }
#define DEFINE_MEMBER_CALLBACK_THINK(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_THINK, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//! For Spawn.
#define DEFINE_MEMBER_CALLBACK_SPAWN(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_SPAWN, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//! For PostSpawn.
#define DEFINE_MEMBER_CALLBACK_POSTSPAWN(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_POSTSPAWN, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//! For PreThink
#define DEFINE_MEMBER_CALLBACK_PRETHINK(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_PRETHINK, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//! For PostThink.
#define DEFINE_MEMBER_CALLBACK_POSTTHINK(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_POSTSPAWN, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//! For Blocked.
#define DEFINE_MEMBER_CALLBACK_BLOCKED(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_BLOCKED, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//! For Touch.
#define DEFINE_MEMBER_CALLBACK_TOUCH(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_TOUCH, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//! For Use.
#define DEFINE_MEMBER_CALLBACK_USE(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_USE, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//! For OnSignalIn.
#define DEFINE_MEMBER_CALLBACK_ON_SIGNALIN(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_ONSIGNALIN, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//! For Pain.
#define DEFINE_MEMBER_CALLBACK_PAIN(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_PAIN, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//! For Die.
#define DEFINE_MEMBER_CALLBACK_DIE(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_DIE, reinterpret_cast<void *>(##className::##functionName)); \
auto className::##functionName \
//
// PushMoveInfo EndMove.
//
#define DEFINE_MEMBER_CALLBACK_PUSHMOVE_ENDMOVE(className, functionName) \
static const svg_save_funcptr_instance_t save__ ##className ##__ ##functionName(_DEFINE_MEMBER_CALLBACK_FULLNAME(#className, #functionName), FPTR_SAVE_TYPE_PUSHER_MOVEINFO_ENDMOVECALLBACK, reinterpret_cast<void *>(##className::##functionName)); \
[[nodiscard]] auto className::##functionName \
// Top abstract class, the start of the class tree
// Instances of this cannot be allocated, as it is abstract.
#define __DeclareTopRootTypeInfo( worldSpawnClassName, className, superClass, typeInfoFlags, allocatorFunction ) \
virtual inline EdictTypeInfo* GetTypeInfo() const { \
return &ClassInfo; \
} \
inline static EdictTypeInfo ClassInfo = EdictTypeInfo( (worldSpawnClassName), (#className), (#superClass), (typeInfoFlags), (allocatorFunction) );
// Top abstract class, the start of the class tree
#define DefineTopRootClass( worldSpawnClassName, className, superClass, typeInfoFlags ) \
using SelfType = className; \
using Super = superClass; \
static className* AllocateInstance( const cm_entity_t* cm_entity ) { \
className *baseEdict = new className( cm_entity ); \
baseEdict->classname = svg_level_qstring_t::from_char_str( worldSpawnClassName ); \
/*baseEdict->hashedClassname = baseEdict->GetTypeInfo()->hashedMapClass;*/ \
return baseEdict; \
} \
__DeclareTopRootTypeInfo( worldSpawnClassName, className, superClass, typeInfoFlags, &className::AllocateInstance );
//__DeclareTopRootTypeInfo( worldSpawnClassName, className, nullptr, EdictTypeInfo::TypeInfoFlag_WorldSpawn | typeInfoFlags, allocatorFunction );
/**
* @brief Declares the type information for a class, including its name, superclass, flags, and allocator function.
* @param worldSpawnClassName The name of the world spawn class associated with this type.
* @param classname The name of the class.
* @param superClass The name of the superclass for this type.
* @param typeFlags The flags associated with this type.
* @param allocatorFunction The function used to allocate instances of this type.
* @note This macro should be used in the class definition to declare the type information.
**/
#define __DeclareTypeInfo( worldSpawnClassName, className, superClass, typeInfoFlags, allocatorFunction ) \
virtual inline EdictTypeInfo* GetTypeInfo() const override { \
return &ClassInfo; \
} \
inline static EdictTypeInfo ClassInfo = EdictTypeInfo( (worldSpawnClassName), (#className), (#superClass), (typeInfoFlags), (allocatorFunction) );
// Abstract class that inherits from another
// Instances of this cannot be allocated
// NOTE: multiple inheritance not supported
#define DefineAbstractClass( className, superClass ) \
using SelfType = className; \
using Super = superClass; /* Allows us to refer to super class using Base */ \
__DeclareTypeInfo( #className, #className, #superClass, EdictTypeInfo::TypeInfoFlag_Abstract, nullptr );
// Declares and initialises the type information for this class, so it can be spawned in a map.
// NOTE: multiple inheritance not supported
// @param mapClassName (string) - the map classname of this entity, used during entity spawning
// @param classname (symbol) - the internal C++ class name
// @param superClass (symbol) - the class this entity class inherits from
#define DefineWorldSpawnClass( worldSpawnClassName, className, superClass, typeInfoFlags, spawnFunc ) \
using SelfType = className; \
using Super = superClass; \
static svg_base_edict_t* AllocateInstance( const cm_entity_t* cm_entity ) { \
className *baseEdict = new className( cm_entity ); \
baseEdict->classname = svg_level_qstring_t::from_char_str( worldSpawnClassName ); \
baseEdict->SetSpawnCallback( reinterpret_cast<svg_edict_callback_spawn_fptr>( spawnFunc ) ); \
return baseEdict; \
} \
__DeclareTypeInfo( worldSpawnClassName, className, superClass, typeInfoFlags, &className::AllocateInstance );
#if 0
// Declares and initialises the type information for this class, so it can be spawned during gameplay.
// NOTE: multiple inheritance not supported
// @param mapClassName (string) - the map classname of this entity, used during entity spawning
// @param classname (symbol) - the internal C++ class name
// @param superClass (symbol) - the class this entity class inherits from
#define DefineGameClass( classname, superClass ) \
using Super = superClass; \
static GameEntity* AllocateInstance( PODEntity* entity ) { \
classname *baseEntity = new classname( entity ); \
baseEntity->SetClassname(#classname); \
entity->hashedClassname = baseEntity->GetTypeInfo()->hashedMapClass; \
entity->isLocal = true; \
return baseEntity; \
} \
__DeclareTypeInfo( #classname, #classname, #superClass, TypeInfo::TypeFlag_GameSpawn, &classname::AllocateInstance );
#endif
#define Com_Printf(...) Com_LPrintf(PRINT_ALL, __VA_ARGS__)
#define Com_WPrintf(...) Com_LPrintf(PRINT_WARNING, __VA_ARGS__)
#define Com_EPrintf(...) Com_LPrintf(PRINT_ERROR, __VA_ARGS__)
//! WID: Assertions that always trigger.
#define Q_assert(expr) \
do { if (!(expr)) Com_Error(ERR_FATAL, "%s: assertion `%s' failed", __func__, #expr); } while (0)
//! WID: For when cvar developer >= 1
#define Q_DevAssert(expr) \
do { if ( !(expr)) Com_LPrintf( PRINT_DEVELOPER, "%s:%s:%d: DevAssert failed: `%s'\n", __FILE__, __func__, __LINE__, #expr); } while (0)
//! WID: For when cvar developer >= 1
#define Q_DevPrint(...) \
do { Com_LPrintf( PRINT_DEVELOPER, "%s:%s:%d: %s\n", __FILE__, __func__, __LINE__, __VA_ARGS__ ); } while (0)
#define q_noreturn __attribute__((noreturn))
#define q_noreturn
#define q_printf(f, a) __attribute__((format(gnu_printf, f, a)))
#define q_printf(f, a) __attribute__((format(printf, f, a)))
#define q_printf(f, a)
/****
*
*
*
* Neatly wraps up the enclosing and/or opening and closing of a block of
* code that demands us to require linking as extern "C".
*
*
*
****/
#define QEXTERN_C_ENCLOSE(ENCLOSED_CODE) \
extern "C" { \
ENCLOSED_CODE \
}; \
\
#define QEXTERN_C_OPEN \
extern "C" { \
\
#define QEXTERN_C_CLOSE \
}; \
\