This repository has been archived by the owner on Sep 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
g_spawn.cpp
1796 lines (1496 loc) · 35.8 KB
/
g_spawn.cpp
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
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_spawn.cpp $
// $Revision:: 68 $
// $Author:: Jimdose $
// $Date:: 1/29/99 6:14p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// $Log:: /Quake 2 Engine/Sin/code/game/g_spawn.cpp $
//
// 68 1/29/99 6:14p Jimdose
// fixed savegame bug
//
// 67 1/22/99 8:01p Jimdose
// G_SoawnEntities no longer calls G_LevelStart when loading a savegame. This
// fixes the Darwin tubes bug in Area57.
//
// 66 11/07/98 10:01p Jimdose
// added G_GetClassFromArgs
//
// 65 11/05/98 8:29p Aldie
// Removed checksumming and fixed stuff for loading times
//
// 64 10/28/98 4:46p Jimdose
// G_ArchiveEdict was accessing edict->owner->entity, which may be cleared out
// when called.
//
// 63 10/27/98 9:46p Aldie
// Changed training cvar to level.training
//
// 62 10/26/98 4:20p Markd
// Added game.skill variable
//
// 61 10/25/98 11:57p Jimdose
// moved playerfrozen from game to level
//
// 60 10/24/98 11:47p Jimdose
// made RestoreEnt call G_InitSpawnArguments
//
// 59 10/23/98 3:43a Markd
// put in universal_script support
//
// 58 10/19/98 11:46p Aldie
// Clear spawn arguments out after spawning things
//
// 57 10/19/98 12:07a Jimdose
// made all code use fast checks for inheritance (no text lookups when
// possible)
// isSubclassOf no longer requires ::_classinfo()
//
// 56 10/18/98 8:43p Jimdose
// Started adding check for SOLID_BSP and no model in SpawnEntities
//
// 55 10/17/98 8:15p Jimdose
// Changed G_CallSpawn2 to G_CallSpawn
//
// 54 10/17/98 12:21a Jimdose
// Added G_ResetEdicts
//
// 53 10/16/98 1:50a Jimdose
// Removed G_SaveClientData from G_LevelShutdown
//
// 52 10/15/98 7:13p Jimdose
// Overrode = for SpawnArgGroup. Fixes crash on level change with multiplayer
//
// 51 10/14/98 10:56p Jimdose
// More work on persistant data
// added archive functions for spawnargs classes
//
// 50 10/14/98 1:18a Jimdose
// Got cross-level persistant info working
//
// 49 10/11/98 8:51p Jimdose
// Added LoadingServer variable
//
// 48 10/10/98 12:39p Markd
// Renamed team to moveteam
//
// 47 10/10/98 1:27a Jimdose
// added G_Precache
//
// 46 10/07/98 11:47p Jimdose
// Got savegames working
//
// 45 9/15/98 6:46p Aldie
// Clear out the event list after deleting all the edicts
//
// 44 9/02/98 3:47p Markd
// Put in precache ability for the main game script
//
// 43 8/29/98 9:42p Jimdose
// Made all function names consistantly begin with G_
// Added call info to G_Trace
//
// 42 8/29/98 2:53p Aldie
// Added status meter for loading levels.
//
// 41 8/27/98 4:18p Jimdose
// Only start script when the world is spawned so that demomap won't start
// scripts
//
// 40 8/24/98 1:33p Markd
// fixed null string problem with gamescript
//
// 39 8/24/98 11:32a Markd
// Added Start method to threads, repladed all ProcessEvent(
// EV_ScriptThread_execute) with thread->Start( -1 )
//
// 38 8/12/98 3:19p Aldie
// Created a G_CallSpawn2 that returns pointer to Entity that is created.
// Currently used with func_box.
//
// 37 8/04/98 6:05p Aldie
// Relocated DETAIL spawnflag
//
// 36 7/08/98 12:54p Jimdose
// Made developer c_var global
//
// 35 7/02/98 5:24p Markd
// Added detail spawning abilities
//
// 34 6/24/98 4:49p Aldie
// Made it so func_spawn will work.
//
// 33 6/23/98 9:54p Jimdose
// Fixed infinite loop bug in G_RunFrame
//
// 32 6/16/98 9:04p Markd
// made objects default to "Object" instead of "entity"
//
// 31 5/27/98 5:02a Aldie
// Added queue for bloodsplats
//
// 30 5/26/98 7:56p Jimdose
// added scripted cameras
//
// 29 5/25/98 6:52a Aldie
// Added ResetBulletHoles to SpawnEntity
//
// 28 5/24/98 8:46p Jimdose
// Made a lot of functions more str-friendly.
// Got rid of a lot of char * based strings
// Cleaned up get spawn arg functions and sound functions
// sound functions now use consistant syntax
//
// 27 5/24/98 4:48p Jimdose
// Made char *'s const
//
// 26 5/24/98 2:47p Markd
// Made char *'s into const char *'s
//
// 25 5/20/98 11:11a Markd
// removed char * dependency
//
// 24 5/18/98 8:13p Jimdose
// Renamed Navigator back to PathManager
//
// 23 5/12/98 7:07p Markd
// Put in Development spawnflag
//
// 22 5/09/98 8:02p Jimdose
// AI nodes are saved after map changes
//
// 21 4/30/98 5:28p Jimdose
// Removed check for null models in G_CallSpawn. If an entity deleted itself
// in its constructor, the check would access deallocated memory
//
// 20 4/29/98 5:04p Jimdose
// Fixed gi.error so that it doesn't crash when called from C++
//
// 19 4/28/98 8:13p Jimdose
// Added checks to ensure that SOLID_BSP objects have models
//
// 18 4/28/98 5:26p Jimdose
// Made spawnflags for !easy, !medium, !hard, !deathmatch and !coop work.
//
// 17 4/27/98 3:42p Jimdose
// Navigator is initialized in SpawnEntities
//
// 16 4/18/98 6:53p Markd
// Fixed spawning of new entity classes
//
// 15 4/16/98 2:04p Jimdose
// Removed pathmanager
//
// 14 4/07/98 9:18p Jimdose
// Think I found that bug where free_edicts gets put on the active_edicts list.
//
// 13 4/07/98 8:02p Markd
// Added tons 'o SINMDL prefixed commands
//
// 12 4/07/98 5:41p Jimdose
// Added assertions to G_Spawn and G_FreeEdict
//
// 11 4/05/98 1:56a Jimdose
// fixed bug where edicts were being freed, but not entities when the map
// changed
//
// 10 3/31/98 12:30a Markd
// Added models/ to spawning of model stuff
//
// 9 3/30/98 9:44p Markd
// Added in proper spawing for classname "model"
//
// 8 3/27/98 5:37p Jimdose
// SpawnEntities now frees up any entities for when levels change, but the game
// is the same.
//
// 7 3/26/98 8:19p Jimdose
// G_FreeEdict no longer clears the edicts client variable
//
// 6 3/13/98 7:24p Aldie
// Added get vector arg.
//
// 5 3/02/98 5:46p Jimdose
// pathManager frees all cached paths on starting a map.
//
// 4 2/19/98 5:03p Jimdose
// Moved G_Entity, G_Random, and G_CRandom to g_utils
//
// 3 2/16/98 2:18p Jimdose
// Made G_FindTeams work
// Added active_edicts and free_edicts for faster entity processing and for
// operations that depend on the order that physics is processed on entities
// (such as binding).
//
// 2 2/03/98 11:06a Jimdose
// Converted to work with Sin progs
//
// 1 1/21/98 2:56p Jimdose
//
// 3 12/30/97 6:04p Jimdose
// Added header text
//
// DESCRIPTION:
//
#include "g_local.h"
#include "class.h"
#include "Entity.h"
#include "g_spawn.h"
#include "navigate.h"
#include <setjmp.h>
#include "player.h"
#include "gravpath.h"
#include "surface.h"
#include "console.h"
#include "object.h"
void G_ExitWithError( void );
extern jmp_buf G_AbortGame;
SpawnArgsForEntity PersistantData;
typedef struct
{
char key[ 64 ];
char value[ 256 ];
} spawnargs_t;
#define NUM_SPAWN_ARGS 32
int numSpawnArgs = 0;
spawnargs_t spawnArgs[ NUM_SPAWN_ARGS ];
/****************************************************************************
SpawnArg Class Definition
****************************************************************************/
CLASS_DECLARATION( Class, SpawnArg, NULL );
ResponseDef SpawnArg::Responses[] =
{
{ NULL, NULL }
};
SpawnArg::SpawnArg()
{
memset( key, 0, sizeof( key ) );
memset( value, 0, sizeof( value ) );
}
SpawnArg::SpawnArg
(
SpawnArg &arg
)
{
strcpy( key, arg.key );
strcpy( value, arg.value );
}
void SpawnArg::Archive
(
Archiver &arc
)
{
Class::Archive( arc );
arc.WriteRaw( key, sizeof( key ) );
arc.WriteRaw( value, sizeof( value ) );
}
void SpawnArg::Unarchive
(
Archiver &arc
)
{
Class::Unarchive( arc );
arc.ReadRaw( key, sizeof( key ) );
arc.ReadRaw( value, sizeof( value ) );
}
/****************************************************************************
SpawnArgs Class Definition
****************************************************************************/
CLASS_DECLARATION( Class, SpawnArgs, NULL );
ResponseDef SpawnArgs::Responses[] =
{
{ NULL, NULL }
};
SpawnArgs::SpawnArgs()
{
}
SpawnArgs::SpawnArgs
(
SpawnArgs &otherlist
)
{
SpawnArg arg1;
SpawnArg *arg2;
int num;
int i;
num = otherlist.NumArgs();
for( i = 1; i <= num; i++ )
{
arg2 = otherlist.argList.AddressOfObjectAt( i );
strcpy( arg1.key, arg2->key );
strcpy( arg1.value, arg2->value );
argList.AddObject( arg1 );
}
argList.Resize( num );
}
void SpawnArgs::operator=
(
SpawnArgs &otherlist
)
{
SpawnArg arg1;
SpawnArg *arg2;
int num;
int i;
argList.ClearObjectList();
num = otherlist.NumArgs();
for( i = 1; i <= num; i++ )
{
arg2 = otherlist.argList.AddressOfObjectAt( i );
strcpy( arg1.key, arg2->key );
strcpy( arg1.value, arg2->value );
argList.AddObject( arg1 );
}
argList.Resize( num );
}
int SpawnArgs::NumArgs
(
void
)
{
return argList.NumObjects();
}
void SpawnArgs::SetArgs
(
void
)
{
SpawnArg arg;
int i;
for( i = 0; i < numSpawnArgs; i++ )
{
strcpy( arg.key, spawnArgs[ i ].key );
strcpy( arg.value, spawnArgs[ i ].value );
argList.AddObject( arg );
}
argList.Resize( numSpawnArgs );
}
void SpawnArgs::RestoreArgs
(
void
)
{
SpawnArg *arg;
int i;
numSpawnArgs = argList.NumObjects();
for( i = 0; i < numSpawnArgs; i++ )
{
arg = &argList.ObjectAt( i + 1 );
strcpy( spawnArgs[ i ].key, arg->key );
strcpy( spawnArgs[ i ].value, arg->value );
}
}
void SpawnArgs::Archive
(
Archiver &arc
)
{
int i;
int num;
Class::Archive( arc );
num = argList.NumObjects();
arc.WriteInteger( num );
for( i = 1; i <= num; i++ )
{
arc.WriteObject( argList.AddressOfObjectAt( i ) );
}
}
void SpawnArgs::Unarchive
(
Archiver &arc
)
{
int i;
int num;
Class::Unarchive( arc );
argList.FreeObjectList();
num = arc.ReadInteger();
argList.Resize( num );
for( i = 1; i <= num; i++ )
{
arc.ReadObject( argList.AddressOfObjectAt( i ) );
}
}
/****************************************************************************
SpawnArgGroup Class Definition
****************************************************************************/
CLASS_DECLARATION( Class, SpawnArgGroup, NULL );
ResponseDef SpawnArgGroup::Responses[] =
{
{ NULL, NULL }
};
SpawnArgGroup::SpawnArgGroup()
{
}
SpawnArgGroup::SpawnArgGroup
(
SpawnArgGroup &group
)
{
SpawnArgs *arg;
int num;
int i;
num = group.spawnArgList.NumObjects();
for( i = 1; i <= num; i++ )
{
arg = group.spawnArgList.AddressOfObjectAt( i );
spawnArgList.AddObject( *arg );
}
spawnArgList.Resize( num );
}
void SpawnArgGroup::operator=
(
SpawnArgGroup &group
)
{
SpawnArgs *arg;
int num;
int i;
num = group.spawnArgList.NumObjects();
for( i = 1; i <= num; i++ )
{
arg = group.spawnArgList.AddressOfObjectAt( i );
spawnArgList.AddObject( *arg );
}
spawnArgList.Resize( num );
}
int SpawnArgGroup::NumInGroup
(
void
)
{
return spawnArgList.NumObjects();
}
void SpawnArgGroup::AddArgs
(
void
)
{
SpawnArgs args;
args.SetArgs();
spawnArgList.AddObject( args );
spawnArgList.Resize( NumInGroup() );
}
void SpawnArgGroup::RestoreArgs
(
int i
)
{
assert( ( i > 0 ) && ( i <= NumInGroup() ) );
if ( ( i <= 0 ) || ( i > NumInGroup() ) )
{
G_InitSpawnArguments();
return;
}
spawnArgList.ObjectAt( i ).RestoreArgs();
}
void SpawnArgGroup::Archive
(
Archiver &arc
)
{
int i;
int num;
Class::Archive( arc );
num = spawnArgList.NumObjects();
arc.WriteInteger( num );
for( i = 1; i <= num; i++ )
{
arc.WriteObject( spawnArgList.AddressOfObjectAt( i ) );
}
}
void SpawnArgGroup::Unarchive
(
Archiver &arc
)
{
int i;
int num;
Class::Unarchive( arc );
spawnArgList.FreeObjectList();
num = arc.ReadInteger();
spawnArgList.Resize( num );
for( i = 1; i <= num; i++ )
{
arc.ReadObject( spawnArgList.AddressOfObjectAt( i ) );
}
}
/****************************************************************************
SpawnArgsForEntity Class Definition
****************************************************************************/
CLASS_DECLARATION( Class, SpawnArgsForEntity, NULL );
ResponseDef SpawnArgsForEntity::Responses[] =
{
{ NULL, NULL }
};
void SpawnArgsForEntity::Reset
(
void
)
{
groupList.FreeObjectList();
entnumList.FreeObjectList();
}
void SpawnArgsForEntity::AddEnt
(
Entity *ent
)
{
int num;
SpawnArgGroup group;
if ( ent && ent->isSubclassOf( Sentient ) )
{
G_InitSpawnArguments();
entnumList.AddObject( ent->entnum );
groupList.AddObject( group );
num = groupList.NumObjects();
groupList.Resize( num );
entnumList.Resize( num );
( ( Sentient * )ent )->WritePersistantData( groupList.ObjectAt( num ) );
}
}
qboolean SpawnArgsForEntity::RestoreEnt
(
Entity *ent
)
{
int num;
SpawnArgGroup *group;
num = entnumList.IndexOfObject( ent->entnum );
if ( num && ent->isSubclassOf( Sentient ) )
{
group = groupList.AddressOfObjectAt( num );
( ( Sentient * )ent )->RestorePersistantData( *group );
G_InitSpawnArguments();
return true;
}
return false;
}
void SpawnArgsForEntity::RestoreEnts
(
void
)
{
int num;
int i;
int entnum;
edict_t *ent;
SpawnArgGroup *group;
num = groupList.NumObjects();
for( i = 1; i <= num; i++ )
{
entnum = entnumList.ObjectAt( i );
ent = &g_edicts[ entnum ];
group = groupList.AddressOfObjectAt( i );
group->RestoreArgs( 1 );
game.force_entnum = true;
game.spawn_entnum = ent->s.number;
G_CallSpawn();
game.force_entnum = false;
if ( ent->entity && ent->entity->isSubclassOf( Sentient ) )
{
( ( Sentient * )ent->entity )->RestorePersistantData( *group );
}
}
Reset();
}
void SpawnArgsForEntity::Archive
(
Archiver &arc
)
{
int i;
int num;
Class::Archive( arc );
num = groupList.NumObjects();
arc.WriteInteger( num );
for( i = 1; i <= num; i++ )
{
arc.WriteInteger( entnumList.ObjectAt( i ) );
arc.WriteObject( groupList.AddressOfObjectAt( i ) );
}
}
void SpawnArgsForEntity::Unarchive
(
Archiver &arc
)
{
int i;
int num;
Reset();
Class::Unarchive( arc );
num = arc.ReadInteger();
entnumList.Resize( num );
groupList.Resize( num );
for( i = 1; i <= num; i++ )
{
arc.ReadInteger( entnumList.AddressOfObjectAt( i ) );
arc.ReadObject( groupList.AddressOfObjectAt( i ) );
}
}
/****************************************************************************
spawn arg management
****************************************************************************/
void G_SetFloatArg
(
const char *key,
double value
)
{
char text[ 20 ];
sprintf( text, "%f", value );
G_SetSpawnArg( key, text );
}
void G_SetIntArg
(
const char *key,
int value
)
{
char text[ 20 ];
sprintf( text, "%d", value );
G_SetSpawnArg( key, text );
}
void G_DefaultArg
(
const char *key,
const char *defaultvalue
)
{
if ( !G_GetSpawnArg( key ) )
{
G_SetSpawnArg( key, defaultvalue );
}
}
void G_DefaultFloatArg
(
const char *key,
double defaultvalue
)
{
if ( !G_GetSpawnArg( key ) )
{
G_SetFloatArg( key, defaultvalue );
}
}
void G_DefaultIntArg
(
const char *key,
int defaultvalue
)
{
if ( !G_GetSpawnArg( key ) )
{
G_SetIntArg( key, defaultvalue );
}
}
Vector G_GetVectorArg
(
const char *key,
Vector defaultvalue
)
{
const char *text;
text = G_GetSpawnArg( key );
if ( text )
{
return Vector(text);
}
return defaultvalue;
}
float G_GetFloatArg
(
const char *key,
double defaultvalue
)
{
const char *text;
text = G_GetSpawnArg( key );
if ( text )
{
return (float)atof( text );
}
return (float)defaultvalue;
}
int G_GetIntArg
(
const char *key,
int defaultvalue
)
{
const char *text;
text = G_GetSpawnArg( key );
if ( text )
{
return atoi( text );
}
return defaultvalue;
}
str G_GetStringArg
(
const char *key,
const char *defaultvalue
)
{
const char *text;
str ret;
text = G_GetSpawnArg( key );
if ( !text )
{
text = defaultvalue;
}
if ( text )
{
return text;
}
return "";
}
void G_InitSpawnArguments
(
void
)
{
int i;
numSpawnArgs = 0;
for( i = 0; i < NUM_SPAWN_ARGS; i++ )
{
memset( spawnArgs[ i ].key, 0, sizeof( spawnArgs[ i ].key ) );
memset( spawnArgs[ i ].value, 0, sizeof( spawnArgs[ i ].value ) );
}
}
qboolean G_SetSpawnArg
(
const char *keyname,
const char *value
)
{
int i;
for( i = 0; i < numSpawnArgs; i++ )
{
if ( !strcmp( keyname, spawnArgs[ i ].key ) )
{
break;
}
}
if ( i >= NUM_SPAWN_ARGS )
{
return false;
}
if ( i == numSpawnArgs )
{
strncpy( spawnArgs[ i ].key, keyname, sizeof( spawnArgs[ 0 ].key ) - 1 );
numSpawnArgs++;
}
strncpy( spawnArgs[ i ].value, value, sizeof( spawnArgs[ 0 ].value ) - 1 );
return true;
}
const char *G_GetSpawnArg
(
const char *key,
const char *defaultvalue
)
{
int i;
for( i = 0; i < numSpawnArgs; i++ )
{
if ( !strcmp( key, spawnArgs[ i ].key ) )
{
return spawnArgs[ i ].value;
}
}
return defaultvalue;
}
int G_GetNumSpawnArgs
(
void
)
{
return numSpawnArgs;
}
/*
===============
G_GetClassFromArgs
Finds the spawn function for the entity and returns ClassDef *
===============
*/
ClassDef *G_GetClassFromArgs
(
void
)
{
const char *classname;
ClassDef *cls = NULL;
classname = G_GetSpawnArg( "classname" );
//
// check normal spawn functions
// see if the class name is stored within the model