forked from grayj/Jedi-Academy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bg_saberLoad.c
1501 lines (1342 loc) · 34 KB
/
bg_saberLoad.c
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
//bg_saberLoad.c
#include "q_shared.h"
#include "bg_public.h"
#include "bg_local.h"
#include "w_saber.h"
// Borrow the one in UI:
#define MAX_SABER_DATA_SIZE 0x4000
extern char SaberParms[MAX_SABER_DATA_SIZE];
//Could use strap stuff but I don't particularly care at the moment anyway.
#include "../namespace_begin.h"
extern int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
extern void trap_FS_Read( void *buffer, int len, fileHandle_t f );
extern void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
extern void trap_FS_FCloseFile( fileHandle_t f );
extern int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
extern qhandle_t trap_R_RegisterSkin( const char *name );
#include "../namespace_end.h"
#ifdef QAGAME
extern int G_SoundIndex( const char *name );
#elif defined CGAME
#include "../namespace_begin.h"
sfxHandle_t trap_S_RegisterSound( const char *sample);
qhandle_t trap_R_RegisterShader( const char *name ); // returns all white if not found
int trap_FX_RegisterEffect(const char *file);
#include "../namespace_end.h"
#endif
#ifdef _XBOX
#include "../cgame/cg_local.h"
#include "../client/cl_data.h"
#endif
#include "../namespace_begin.h"
int BG_SoundIndex(char *sound)
{
#ifdef QAGAME
return G_SoundIndex(sound);
#elif defined CGAME
return trap_S_RegisterSound(sound);
#endif
}
extern stringID_table_t FPTable[];
//#define MAX_SABER_DATA_SIZE 0x10000
//static char SaberParms[MAX_SABER_DATA_SIZE];
stringID_table_t SaberTable[] =
{
ENUM2STRING(SABER_NONE),
ENUM2STRING(SABER_SINGLE),
ENUM2STRING(SABER_STAFF),
ENUM2STRING(SABER_BROAD),
ENUM2STRING(SABER_PRONG),
ENUM2STRING(SABER_DAGGER),
ENUM2STRING(SABER_ARC),
ENUM2STRING(SABER_SAI),
ENUM2STRING(SABER_CLAW),
ENUM2STRING(SABER_LANCE),
ENUM2STRING(SABER_STAR),
ENUM2STRING(SABER_TRIDENT),
"", -1
};
//Also used in npc code
qboolean BG_ParseLiteral( const char **data, const char *string )
{
const char *token;
token = COM_ParseExt( data, qtrue );
if ( token[0] == 0 )
{
Com_Printf( "unexpected EOF\n" );
return qtrue;
}
if ( Q_stricmp( token, string ) )
{
Com_Printf( "required string '%s' missing\n", string );
return qtrue;
}
return qfalse;
}
saber_colors_t TranslateSaberColor( const char *name )
{
if ( !Q_stricmp( name, "red" ) )
{
return SABER_RED;
}
if ( !Q_stricmp( name, "orange" ) )
{
return SABER_ORANGE;
}
if ( !Q_stricmp( name, "yellow" ) )
{
return SABER_YELLOW;
}
if ( !Q_stricmp( name, "green" ) )
{
return SABER_GREEN;
}
if ( !Q_stricmp( name, "blue" ) )
{
return SABER_BLUE;
}
if ( !Q_stricmp( name, "purple" ) )
{
return SABER_PURPLE;
}
if ( !Q_stricmp( name, "random" ) )
{
return ((saber_colors_t)(Q_irand( SABER_ORANGE, SABER_PURPLE )));
}
return SABER_BLUE;
}
saber_styles_t TranslateSaberStyle( const char *name )
{
if ( !Q_stricmp( name, "fast" ) )
{
return SS_FAST;
}
if ( !Q_stricmp( name, "medium" ) )
{
return SS_MEDIUM;
}
if ( !Q_stricmp( name, "strong" ) )
{
return SS_STRONG;
}
if ( !Q_stricmp( name, "desann" ) )
{
return SS_DESANN;
}
if ( !Q_stricmp( name, "tavion" ) )
{
return SS_TAVION;
}
if ( !Q_stricmp( name, "dual" ) )
{
return SS_DUAL;
}
if ( !Q_stricmp( name, "staff" ) )
{
return SS_STAFF;
}
return SS_NONE;
}
void WP_SaberSetDefaults( saberInfo_t *saber )
{
int i;
//Set defaults so that, if it fails, there's at least something there
for ( i = 0; i < MAX_BLADES; i++ )
{
saber->blade[i].color = SABER_RED;
saber->blade[i].radius = SABER_RADIUS_STANDARD;
saber->blade[i].lengthMax = 32;
}
strcpy(saber->name, "default");
strcpy(saber->fullName, "lightsaber");
strcpy(saber->model, "models/weapons2/saber_reborn/saber_w.glm");
saber->skin = 0;
saber->soundOn = BG_SoundIndex( "sound/weapons/saber/enemy_saber_on.wav" );
saber->soundLoop = BG_SoundIndex( "sound/weapons/saber/saberhum3.wav" );
saber->soundOff = BG_SoundIndex( "sound/weapons/saber/enemy_saber_off.wav" );
saber->numBlades = 1;
saber->type = SABER_SINGLE;
saber->style = SS_NONE;
saber->maxChain = 0;//0 = use default behavior
saber->lockable = qtrue;
saber->throwable = qtrue;
saber->disarmable = qtrue;
saber->activeBlocking = qtrue;
saber->twoHanded = qfalse;
saber->forceRestrictions = 0;
saber->lockBonus = 0;
saber->parryBonus = 0;
saber->breakParryBonus = 0;
saber->disarmBonus = 0;
saber->singleBladeStyle = SS_NONE;//makes it so that you use a different style if you only have the first blade active
saber->singleBladeThrowable = qfalse;//makes it so that you can throw this saber if only the first blade is on
// saber->brokenSaber1 = NULL;//if saber is actually hit by another saber, it can be cut in half/broken and will be replaced with this saber in your right hand
// saber->brokenSaber2 = NULL;//if saber is actually hit by another saber, it can be cut in half/broken and will be replaced with this saber in your left hand
saber->returnDamage = qfalse;//when returning from a saber throw, it keeps spinning and doing damage
//===NEW FOR MP ONLY========================================================================================
//done in cgame (client-side code)
saber->noWallMarks = qfalse; //0 - if 1, stops the saber from drawing marks on the world (good for real-sword type mods)
saber->noDlight = qfalse; //0 - if 1, stops the saber from drawing a dynamic light (good for real-sword type mods)
saber->noBlade = qfalse; //0 - if 1, stops the saber from drawing a blade (good for real-sword type mods)
saber->noClashFlare = qfalse; //0 - if non-zero, the saber will not do the big, white clash flare with other sabers
saber->trailStyle = 0; //0 - default (0) is normal, 1 is a motion blur and 2 is no trail at all (good for real-sword type mods)
saber->g2MarksShader = 0; //none - if set, the game will use this shader for marks on enemies instead of the default "gfx/damage/saberglowmark"
//saber->bladeShader = 0; //none - if set, overrides the shader used for the saber blade?
//saber->trailShader = 0; //none - if set, overrides the shader used for the saber trail?
saber->spinSound = 0; //none - if set, plays this sound as it spins when thrown
saber->swingSound[0] = 0; //none - if set, plays one of these 3 sounds when swung during an attack - NOTE: must provide all 3!!!
saber->swingSound[1] = 0; //none - if set, plays one of these 3 sounds when swung during an attack - NOTE: must provide all 3!!!
saber->swingSound[2] = 0; //none - if set, plays one of these 3 sounds when swung during an attack - NOTE: must provide all 3!!!
saber->hitSound[0] = 0; //none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
saber->hitSound[1] = 0; //none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
saber->hitSound[2] = 0; //none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!!
saber->blockSound[0] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
saber->blockSound[1] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
saber->blockSound[2] = 0; //none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!!
saber->blockEffect = 0; //none - if set, plays this effect when the saber/sword hits another saber/sword (instead of "saber/saber_block.efx")
saber->hitPersonEffect = 0; //none - if set, plays this effect when the saber/sword hits a person (instead of "saber/blood_sparks_mp.efx")
saber->hitOtherEffect = 0; //none - if set, plays this effect when the saber/sword hits something else damagable (instead of "saber/saber_cut.efx")
//done in game (server-side code)
saber->knockbackScale = 0; //0 - if non-zero, uses damage done to calculate an appropriate amount of knockback
saber->damageScale = 1.0f; //1 - scale up or down the damage done by the saber
saber->noDismemberment = qfalse; //0 - if non-zero, the saber never does dismemberment (good for pointed/blunt melee weapons)
saber->noIdleEffect = qfalse; //0 - if non-zero, the saber will not do damage or any effects when it is idle (not in an attack anim). (good for real-sword type mods)
//saber->bounceOnWalls = qfalse; //0 - if non-zero, the saber will bounce back when it hits solid architecture (good for real-sword type mods)
//saber->stickOnImpact = qfalse; //0 - if non-zero, the saber will stick in the wall when thrown and hits solid architecture (good for sabers that are meant to be thrown).
//saber->noAttack = qfalse; //0 - if non-zero, you cannot attack with the saber (for sabers/weapons that are meant to be thrown only, not used as melee weapons).
//=========================================================================================================================================
}
#define DEFAULT_SABER "Kyle"
qboolean WP_SaberParseParms( const char *SaberName, saberInfo_t *saber )
{
const char *token;
const char *value;
const char *p;
char useSaber[1024];
float f;
int n;
qboolean triedDefault = qfalse;
if ( !saber )
{
return qfalse;
}
//Set defaults so that, if it fails, there's at least something there
WP_SaberSetDefaults( saber );
if ( !SaberName || !SaberName[0] )
{
strcpy(useSaber, DEFAULT_SABER); //default
triedDefault = qtrue;
}
else
{
strcpy(useSaber, SaberName);
}
//try to parse it out
p = SaberParms;
COM_BeginParseSession("saberinfo");
// look for the right saber
while ( p )
{
token = COM_ParseExt( &p, qtrue );
if ( token[0] == 0 )
{
if (!triedDefault)
{ //fall back to default and restart, should always be there
p = SaberParms;
COM_BeginParseSession("saberinfo");
strcpy(useSaber, DEFAULT_SABER);
triedDefault = qtrue;
}
else
{
return qfalse;
}
}
if ( !Q_stricmp( token, useSaber ) )
{
break;
}
SkipBracedSection( &p );
}
if ( !p )
{ //even the default saber isn't found?
return qfalse;
}
//got the name we're using for sure
strcpy(saber->name, useSaber);
if ( BG_ParseLiteral( &p, "{" ) )
{
return qfalse;
}
// parse the saber info block
while ( 1 )
{
token = COM_ParseExt( &p, qtrue );
if ( !token[0] )
{
Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", useSaber );
return qfalse;
}
if ( !Q_stricmp( token, "}" ) )
{
break;
}
//saber fullName
if ( !Q_stricmp( token, "name" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
strcpy(saber->fullName, value);
continue;
}
//saber type
if ( !Q_stricmp( token, "saberType" ) )
{
int saberType;
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saberType = GetIDForString( SaberTable, value );
if ( saberType >= SABER_SINGLE && saberType <= NUM_SABERS )
{
saber->type = (saberType_t)saberType;
}
continue;
}
//saber hilt
if ( !Q_stricmp( token, "saberModel" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
strcpy(saber->model, value);
continue;
}
if ( !Q_stricmp( token, "customSkin" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->skin = trap_R_RegisterSkin(value);
continue;
}
//on sound
if ( !Q_stricmp( token, "soundOn" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->soundOn = BG_SoundIndex( (char *)value );
continue;
}
//loop sound
if ( !Q_stricmp( token, "soundLoop" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->soundLoop = BG_SoundIndex( (char *)value );
continue;
}
//off sound
if ( !Q_stricmp( token, "soundOff" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->soundOff = BG_SoundIndex( (char *)value );
continue;
}
if ( !Q_stricmp( token, "numBlades" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
if ( n < 1 || n >= MAX_BLADES )
{
Com_Error(ERR_DROP, "WP_SaberParseParms: saber %s has illegal number of blades (%d) max: %d", useSaber, n, MAX_BLADES );
continue;
}
saber->numBlades = n;
continue;
}
// saberColor
if ( !Q_stricmpn( token, "saberColor", 10 ) )
{
if (strlen(token)==10)
{
n = -1;
}
else if (strlen(token)==11)
{
n = atoi(&token[10])-1;
if (n > 7 || n < 1 )
{
#ifndef FINAL_BUILD
Com_Printf( S_COLOR_YELLOW"WARNING: bad saberColor '%s' in %s\n", token, useSaber );
#endif
continue;
}
}
else
{
#ifndef FINAL_BUILD
Com_Printf( S_COLOR_YELLOW"WARNING: bad saberColor '%s' in %s\n", token, useSaber );
#endif
continue;
}
if ( COM_ParseString( &p, &value ) ) //read the color
{
continue;
}
if (n==-1)
{//NOTE: this fills in the rest of the blades with the same color by default
saber_colors_t color = TranslateSaberColor( value );
for ( n = 0; n < MAX_BLADES; n++ )
{
saber->blade[n].color = color;
}
} else
{
saber->blade[n].color = TranslateSaberColor( value );
}
continue;
}
//saber length
if ( !Q_stricmpn( token, "saberLength", 11 ) )
{
if (strlen(token)==11)
{
n = -1;
}
else if (strlen(token)==12)
{
n = atoi(&token[11])-1;
if (n > 7 || n < 1 )
{
#ifndef FINAL_BUILD
Com_Printf( S_COLOR_YELLOW"WARNING: bad saberLength '%s' in %s\n", token, useSaber );
#endif
continue;
}
}
else
{
#ifndef FINAL_BUILD
Com_Printf( S_COLOR_YELLOW"WARNING: bad saberLength '%s' in %s\n", token, useSaber );
#endif
continue;
}
if ( COM_ParseFloat( &p, &f ) )
{
SkipRestOfLine( &p );
continue;
}
//cap
if ( f < 4.0f )
{
f = 4.0f;
}
if (n==-1)
{//NOTE: this fills in the rest of the blades with the same length by default
for ( n = 0; n < MAX_BLADES; n++ )
{
saber->blade[n].lengthMax = f;
}
}
else
{
saber->blade[n].lengthMax = f;
}
continue;
}
//blade radius
if ( !Q_stricmpn( token, "saberRadius", 11 ) )
{
if (strlen(token)==11)
{
n = -1;
}
else if (strlen(token)==12)
{
n = atoi(&token[11])-1;
if (n > 7 || n < 1 )
{
#ifndef FINAL_BUILD
Com_Printf( S_COLOR_YELLOW"WARNING: bad saberRadius '%s' in %s\n", token, useSaber );
#endif
continue;
}
}
else
{
#ifndef FINAL_BUILD
Com_Printf( S_COLOR_YELLOW"WARNING: bad saberRadius '%s' in %s\n", token, useSaber );
#endif
continue;
}
if ( COM_ParseFloat( &p, &f ) )
{
SkipRestOfLine( &p );
continue;
}
//cap
if ( f < 0.25f )
{
f = 0.25f;
}
if (n==-1)
{//NOTE: this fills in the rest of the blades with the same length by default
for ( n = 0; n < MAX_BLADES; n++ )
{
saber->blade[n].radius = f;
}
}
else
{
saber->blade[n].radius = f;
}
continue;
}
//locked saber style
if ( !Q_stricmp( token, "saberStyle" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->style = TranslateSaberStyle( value );
continue;
}
//maxChain
if ( !Q_stricmp( token, "maxChain" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->maxChain = n;
continue;
}
//lockable
if ( !Q_stricmp( token, "lockable" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->lockable = ((qboolean)(n!=0));
continue;
}
//throwable
if ( !Q_stricmp( token, "throwable" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->throwable = ((qboolean)(n!=0));
continue;
}
//disarmable
if ( !Q_stricmp( token, "disarmable" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->disarmable = ((qboolean)(n!=0));
continue;
}
//active blocking
if ( !Q_stricmp( token, "blocking" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->activeBlocking = ((qboolean)(n!=0));
continue;
}
//twoHanded
if ( !Q_stricmp( token, "twoHanded" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->twoHanded = ((qboolean)(n!=0));
continue;
}
//force power restrictions
if ( !Q_stricmp( token, "forceRestrict" ) )
{
int fp;
if ( COM_ParseString( &p, &value ) )
{
continue;
}
fp = GetIDForString( FPTable, value );
if ( fp >= FP_FIRST && fp < NUM_FORCE_POWERS )
{
saber->forceRestrictions |= (1<<fp);
}
continue;
}
//lockBonus
if ( !Q_stricmp( token, "lockBonus" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->lockBonus = n;
continue;
}
//parryBonus
if ( !Q_stricmp( token, "parryBonus" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->parryBonus = n;
continue;
}
//breakParryBonus
if ( !Q_stricmp( token, "breakParryBonus" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->breakParryBonus = n;
continue;
}
//disarmBonus
if ( !Q_stricmp( token, "disarmBonus" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->disarmBonus = n;
continue;
}
//single blade saber style
if ( !Q_stricmp( token, "singleBladeStyle" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->singleBladeStyle = TranslateSaberStyle( value );
continue;
}
//single blade throwable
if ( !Q_stricmp( token, "singleBladeThrowable" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->singleBladeThrowable = ((qboolean)(n!=0));
continue;
}
//broken replacement saber1 (right hand)
if ( !Q_stricmp( token, "brokenSaber1" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
//saber->brokenSaber1 = G_NewString( value );
continue;
}
//broken replacement saber2 (left hand)
if ( !Q_stricmp( token, "brokenSaber2" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
//saber->brokenSaber2 = G_NewString( value );
continue;
}
//spins and does damage on return from saberthrow
if ( !Q_stricmp( token, "returnDamage" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->returnDamage = ((qboolean)(n!=0));
continue;
}
//stops the saber from drawing marks on the world (good for real-sword type mods)
if ( !Q_stricmp( token, "noWallMarks" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->noWallMarks = ((qboolean)(n!=0));
continue;
}
//stops the saber from drawing a dynamic light (good for real-sword type mods)
if ( !Q_stricmp( token, "noDlight" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->noDlight = ((qboolean)(n!=0));
continue;
}
//stops the saber from drawing a blade (good for real-sword type mods)
if ( !Q_stricmp( token, "noBlade" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->noBlade = ((qboolean)(n!=0));
continue;
}
//default (0) is normal, 1 is a motion blur and 2 is no trail at all (good for real-sword type mods)
if ( !Q_stricmp( token, "trailStyle" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->trailStyle = n;
continue;
}
//if set, the game will use this shader for marks on enemies instead of the default "gfx/damage/saberglowmark"
if ( !Q_stricmp( token, "g2MarksShader" ) )
{
if ( COM_ParseString( &p, &value ) )
{
SkipRestOfLine( &p );
continue;
}
#ifdef QAGAME//cgame-only cares about this
#elif defined CGAME
saber->g2MarksShader = trap_R_RegisterShader( value );
#endif
continue;
}
//if non-zero, uses damage done to calculate an appropriate amount of knockback
if ( !Q_stricmp( token, "knockbackScale" ) )
{
if ( COM_ParseFloat( &p, &f ) )
{
SkipRestOfLine( &p );
continue;
}
saber->knockbackScale = f;
continue;
}
//scale up or down the damage done by the saber
if ( !Q_stricmp( token, "damageScale" ) )
{
if ( COM_ParseFloat( &p, &f ) )
{
SkipRestOfLine( &p );
continue;
}
saber->damageScale = f;
continue;
}
//if non-zero, the saber never does dismemberment (good for pointed/blunt melee weapons)
if ( !Q_stricmp( token, "noDismemberment" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->noDismemberment = ((qboolean)(n!=0));
continue;
}
//if non-zero, the saber will not do damage or any effects when it is idle (not in an attack anim). (good for real-sword type mods)
if ( !Q_stricmp( token, "noIdleEffect" ) )
{
if ( COM_ParseInt( &p, &n ) )
{
SkipRestOfLine( &p );
continue;
}
saber->noIdleEffect = ((qboolean)(n!=0));
continue;
}
//spin sound (when thrown)
if ( !Q_stricmp( token, "spinSound" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->spinSound = BG_SoundIndex( (char *)value );
continue;
}
//swing sound - NOTE: must provide all 3!!!
if ( !Q_stricmp( token, "swingSound1" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->swingSound[0] = BG_SoundIndex( (char *)value );
continue;
}
//swing sound - NOTE: must provide all 3!!!
if ( !Q_stricmp( token, "swingSound2" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->swingSound[1] = BG_SoundIndex( (char *)value );
continue;
}
//swing sound - NOTE: must provide all 3!!!
if ( !Q_stricmp( token, "swingSound3" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->swingSound[2] = BG_SoundIndex( (char *)value );
continue;
}
//hit sound - NOTE: must provide all 3!!!
if ( !Q_stricmp( token, "hitSound1" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->hitSound[0] = BG_SoundIndex( (char *)value );
continue;
}
//hit sound - NOTE: must provide all 3!!!
if ( !Q_stricmp( token, "hitSound2" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->hitSound[1] = BG_SoundIndex( (char *)value );
continue;
}
//hit sound - NOTE: must provide all 3!!!
if ( !Q_stricmp( token, "hitSound3" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->hitSound[2] = BG_SoundIndex( (char *)value );
continue;
}
//block sound - NOTE: must provide all 3!!!
if ( !Q_stricmp( token, "blockSound1" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->blockSound[0] = BG_SoundIndex( (char *)value );
continue;
}
//block sound - NOTE: must provide all 3!!!
if ( !Q_stricmp( token, "blockSound2" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->blockSound[1] = BG_SoundIndex( (char *)value );
continue;
}
//block sound - NOTE: must provide all 3!!!
if ( !Q_stricmp( token, "blockSound3" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
saber->blockSound[2] = BG_SoundIndex( (char *)value );
continue;
}
//block effect - when saber/sword hits another saber/sword
if ( !Q_stricmp( token, "blockEffect" ) )
{
if ( COM_ParseString( &p, &value ) )
{
continue;
}
#ifdef QAGAME//cgame-only cares about this
#elif defined CGAME
saber->blockEffect = trap_FX_RegisterEffect( (char *)value );
#endif
continue;
}