This repository was archived by the owner on Jan 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathg_mappack.c
714 lines (632 loc) · 20.5 KB
/
g_mappack.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
#include "g_local.h"
/*
=============================
Q1 Torch
=============================
*/
/*QUAKED light_torch (0 1 0) (-8 -8 -8) (8 8 8)
The torches from Quake 1 (no model yet)
"light" = The amount of light emitted from the torch
"style" = The style of the light : default 0
*/
void torch_think (edict_t *self)
{
self->s.frame++;
if (self->s.frame == 5)
self->s.frame = 0;
self->nextthink = level.time + FRAMETIME;
}
void SP_light_torch (edict_t *self) //New function by Beel.
{
self->movetype = MOVETYPE_NONE;
self->solid = SOLID_NOT;
self->s.modelindex = gi.modelindex ("models/torch/tris.md2");
self->s.frame = 0;
self->think = torch_think;
self->nextthink = level.time + FRAMETIME;
gi.linkentity (self);
}
/*
=============================
Small flame
=============================
*/
/*QUAKED light_flame (0 1 0) (-8 -8 0) (8 8 16) START_OFF
Small flame from Q1
Default light value is 300.
Default style is 0.
model=models/objects/fire/"
*/
void smallflame_think (edict_t *self)
{
if(self->s.frame >= 10) //was 5
self->s.frame = 0;
else
self->s.frame++;
self->nextthink = level.time + FRAMETIME;
}
void bigflame_think (edict_t *self)
{
self->s.frame++;
if (self->s.frame == 16)
self->s.frame = 6;
self->nextthink = level.time + FRAMETIME;
}
void SP_light_flame (edict_t *self) //New function by Beel. (small flame)
{
self->movetype = MOVETYPE_NONE;
self->solid = SOLID_NOT;
VectorSet (self->mins, -8, -8, 0);
VectorSet (self->maxs, 8, 8, 16);
self->s.modelindex = gi.modelindex ("models/objects/fire/tris.md2"); //was models/flame/tris.md2
self->s.frame = 0;
self->s.renderfx |= RF_IR_VISIBLE | RF_FULLBRIGHT; // PGM
self->s.effects |= EF_PLASMA;
//Knightmare- only one size for this model
//ed - spawnflag of 2 gives a big flame
// if (self->spawnflags & 2)
// self->think = bigflame_think;
// else
self->nextthink = level.time + FRAMETIME;
self->think = smallflame_think;
gi.linkentity (self);
}
/*
==========================
Trigger entities with key presses
==========================
*/
//#define START_OFF 1
extern void Think_Delay (edict_t *ent);
extern void target_laser_on (edict_t *self);
extern void target_laser_off (edict_t *self);
void Cmd_Trigger_f (edict_t *ent)
{
char *targetname;
edict_t *t;
int arg2;
arg2 = atoi (gi.argv(2));
targetname = gi.argv(1);
t = G_Find (NULL, FOFS(targetname), targetname);
switch (arg2)
{
/*
=============
Turn target off
=============
*/
case 1:
if (!t)
return;
if (!strncmp(t->classname,"target_mappack_laser",sizeof("target_mappack_laser")))
{
if (t->spawnflags & 1)
target_laser_off (t);
}
if (!strncmp(t->classname,"mappack_light",sizeof("mappack_light")))
{
if (!t->spawnflags & 1)
{
gi.configstring (CS_LIGHTS+t->style, "a");
t->spawnflags |= 1;
}
}
break;
/*
=============
Turn target on
=============
*/
case 2:
if (!t)
return;
if (!strncmp(t->classname,"target_satan_laser",sizeof("target_satan_laser")))
{
if (t->spawnflags & 1)
{
}
else
target_laser_on (t);
}
if (!strncmp(t->classname,"satan_light", sizeof("satan_light")))
{
if (t->spawnflags & 1)
{
gi.configstring (CS_LIGHTS+t->style, "m");
t->spawnflags &= ~1;
}
}
break;
/*
=============
Just swap em around, or trigger em if not toggleable
=============
*/
default:
if (!t)
return;
t = G_Spawn();
t->classname = "DelayedUse";
t->nextthink = level.time + 0.01;
t->think = Think_Delay;
t->activator = ent;
t->target = gi.argv(1);
break;
}
}
/*
=============================
Spawning a user defined model
=============================
*/
//ed - added all these spawnflags and stuff
/*QUAKED model_spawn (1 0 0) (-8 -8 -8) (8 8 8) x TOGGLE NOT_IR PLAYER NO_MODEL ANIM_ONCE
Spawns a user defined model, you can specify whether its solid, if so how big the box is, and apply nearly
any effect to the entity.
Spawnflags:
TOGGLE Start active, when triggered become inactive
NOT_IR The model won't be tinted red when the player has IR goggles on
PLAYER Set this if you want to use a player model
NO_MODEL Don't use a model. Usefull for placing particle effects and dynamic lights on their own
ANIM__ONCE Only play the animation once
-----------------------
Key/Value pairs:
"style" Specifies the animation type to use.
0: None (unless startframe and framenumbers are used)
1: ANIM01 - cycle between frames 0 and 1 at 2 hz
2: ANIM23 - cycle between frames 2 and 3 at 2 hz
3: ANIM_ALL - cycle through all frames at 2 hz
4: ANIM_ALLFAST - cycle through all frames at 10 hz
Note: The animation flags override startframe and framenumbers settings you may have enterered. ANIM_ALL and ANIM_ALLFAST don't do what you might think - rather than setting a framerate, these apparently cause the model to cycle through its ENTIRE sequence of animations in 0.5 or 0.1 seconds... which for monster and player models is of course not possible. Looks exceptionally goofy.
"usermodel" The model to load (models/ is already coded)
"startframe" The starting frame : default 0
"framenumbers" The number of frames you want to display after startframe
"skinnum" The skin number to use, default 0
"health" If non-zero and solidstate is 3 or 4 (solid), the entity will be shootable. When destroyed, it blows up with a no-damage explosion.
"solidstate"
1 - not solid at all. These models do not obey any sort of physics. If you place them up in the air or embedded in a wall they will stay there and be perfectly happy about it.
2 - solid. These models will "droptofloor" when spawned. If the health value is set they may be damaged.
3 - solid. Same as above but not affected by gravity. Model will remain in the same location.
4 - not solid but affected by gravity. Model will "droptofloor" when spawned.
NOTE : if you want the model to be solid then you must enter vector values into the following fields :
"bleft" = the point that is at the bottom left of the models bounding box in a model editor
"tright" = the point that is at the top left of the models bounding box in a model editor
"effects"
1: ROTATE Rotate like a weapon
2: GIB
8: BLASTER Yellowish orange glow plus particles
16: ROCKET Rocket trail
32: GRENADE Grenade trail
64: HYPERBLASTER BLASTER w/o the particles
128: BFG Big green ball
256: COLOR_SHELL
512: POWERSCREEN Green power shield
16384: FLIES Ewwww
32768: QUAD Blue shell
65536: PENT Red shell
131072: TELEPORTER Teleporter particles
262144: FLAG1 Red glow
524288: FLAG2 Blue glow
1048576: IONRIPPER
2097152: GREENGIB
4194304: BLUE_HB Blue hyperblaster glow
8388608: SPINNING_LIGHTS Red spinning lights
16777216: PLASMA
33554432: TRAP
67108864: TRACKER
134217728: DOUBLE Yellow shell
268435456: SPHERETRANS Transparent
536870912: TAGTRAIL
1073741824: HALF_DAMAGE
2147483648: TRACKER_TRAIL
"renderfx"
1: MINLIGHT Never completely dark
2: VIEWERMODEL
4: WEAPONMODEL
8: FULLBRIGHT
16: DEPTHHACK
32: TRANSLUCENT Transparent
64: FRAMELERP
128: BEAM
512: GLOW Pulsating glow of normal Q2 pickup items
1024: SHELL_RED
2048: SHELL_GREEN
4096: SHELL_BLUE
32768: IR_VISIBLE
65536: SHELL_DOUBLE
131072: SHELL_HALF_DAMAGE White shell
262144: USE_DISGUISE
"movewith" Targetname of the entity to move with
*/
#define TOGGLE 2
#define NOT_IR 4
#define PLAYER_MODEL 8
#define NO_MODEL 16
#define ANIM_ONCE 32
void model_spawn_use (edict_t *self, edict_t *other, edict_t *activator);
void modelspawn_think (edict_t *self)
{
self->s.frame++;
if (self->s.frame >= self->framenumbers)
{
self->s.frame = self->startframe;
if(self->spawnflags & ANIM_ONCE)
{
model_spawn_use(self,world,world);
return;
}
}
self->nextthink = level.time + FRAMETIME;
gi.linkentity(self);
if (!strcmp(self->classname, "model_train"))
train_move_children (self);
}
void model_spawn_use (edict_t *self, edict_t *other, edict_t *activator)
{
if (self->delay) //we started off
{
self->svflags &= ~SVF_NOCLIENT;
self->delay = 0;
if(self->framenumbers > 1)
{
self->think = modelspawn_think;
self->nextthink = level.time + FRAMETIME;
}
self->s.sound = self->noise_index;
#ifdef LOOP_SOUND_ATTENUATION
self->s.attenuation = self->attenuation;
#endif
}
else //we started active
{
self->svflags |= SVF_NOCLIENT;
self->delay = 1;
self->use = model_spawn_use;
self->think = NULL;
self->nextthink = 0;
self->s.sound = 0;
}
}
void model_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
if(self->deathtarget)
{
self->target = self->deathtarget;
G_UseTargets (self, attacker);
}
train_kill_children(self);
BecomeExplosion1(self);
}
#define ANIM_MASK (EF_ANIM01|EF_ANIM23|EF_ANIM_ALL|EF_ANIM_ALLFAST)
void SP_model_spawn (edict_t *ent)
{
char modelname[256];
//paranoia check
if ((!ent->usermodel) && (!ent->spawnflags & NO_MODEL) && !(ent->spawnflags & PLAYER_MODEL))
{
gi.dprintf("%s without a model and without NO_MODEL spawnflag at %s\n", ent->classname, vtos(ent->s.origin));
G_FreeEdict(ent);
return;
}
switch (ent->solidstate)
{
case 1 : ent->solid = SOLID_NOT; ent->movetype = MOVETYPE_NONE; break;
case 2 : ent->solid = SOLID_BBOX; ent->movetype = MOVETYPE_TOSS; break;
case 3 : ent->solid = SOLID_BBOX; ent->movetype = MOVETYPE_NONE; break;
case 4 : ent->solid = SOLID_NOT; ent->movetype = MOVETYPE_TOSS; break;
default: ent->solid = SOLID_NOT; ent->movetype = MOVETYPE_NONE; break;
}
if (ent->solid != SOLID_NOT )
{
if (ent->health > 0)
{
ent->die = model_die;
ent->takedamage = DAMAGE_YES;
}
}
switch (ent->style)
{
case 1 : ent->s.effects |= EF_ANIM01; break;
case 2 : ent->s.effects |= EF_ANIM23; break;
case 3 : ent->s.effects |= EF_ANIM_ALL; break;
case 4 : ent->s.effects |= EF_ANIM_ALLFAST; break;
}
// DWH: Rather than use one value (renderfx) we use the
// actual values for effects and renderfx. All may
// be combined.
ent->s.effects |= ent->effects;
ent->s.renderfx |= ent->renderfx;
if (ent->startframe < 0)
ent->startframe = 0;
if (!ent->framenumbers)
ent->framenumbers = 1;
// Change framenumbers to last frame to play
ent->framenumbers += ent->startframe;
if (!VectorLength(ent->bleft) && ent->solid == SOLID_BBOX)
{
gi.dprintf("%s solid with no bleft vector at %s, using default (-16,-16,-16)\n", ent->classname, vtos(ent->s.origin));
VectorSet(ent->bleft, -16, -16, -16);
}
VectorCopy (ent->bleft, ent->mins);
if (!VectorLength(ent->tright) && ent->solid == SOLID_BBOX)
{
gi.dprintf("%s solid with no tright vector at %, using default (16,16,16)\n", ent->classname, vtos(ent->s.origin));
VectorSet(ent->tright, 16, 16, 16);
}
VectorCopy (ent->tright, ent->maxs);
if (ent->solid != SOLID_NOT)
ent->clipmask = CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER;
if (ent->spawnflags & NO_MODEL)
{ // For rendering effects to work, we MUST use a model
ent->s.modelindex = gi.modelindex ("sprites/point.sp2");
ent->movetype = MOVETYPE_NOCLIP;
}
else
{
if (ent->spawnflags & PLAYER_MODEL)
{
if(!ent->usermodel || !strlen(ent->usermodel))
ent->s.modelindex = MAX_MODELS-1; //was 255
else
{
if(strstr(ent->usermodel,"tris.md2"))
sprintf(modelname,"players/%s", ent->usermodel);
else
sprintf(modelname,"players/%s/tris.md2", ent->usermodel);
ent->s.modelindex = gi.modelindex(modelname);
}
}
else
{
if(strstr(ent->usermodel,".sp2"))
sprintf(modelname, "sprites/%s", ent->usermodel);
else
sprintf(modelname, "models/%s", ent->usermodel);
ent->s.modelindex = gi.modelindex (modelname);
}
if (ent->startframe < 0)
{
gi.dprintf("model_spawn with startframe less than 0 at %s\n", vtos(ent->s.origin));
ent->startframe = 0;
}
ent->s.frame = ent->startframe;
}
if (st.noise)
ent->noise_index = gi.soundindex (st.noise);
//ent->s.sound = ent->noise_index;
#ifdef LOOP_SOUND_ATTENUATION
ent->s.attenuation = ent->attenuation;
#endif
if (ent->skinnum) // Knightmare- selectable skin
ent->s.skinnum = ent->skinnum;
if (ent->spawnflags & ANIM_ONCE)
ent->spawnflags |= TOGGLE;
if (ent->spawnflags & TOGGLE)
{
ent->delay = 0;
ent->use = model_spawn_use;
}
if(!(ent->s.effects & ANIM_MASK) && (ent->framenumbers > 1))
{
ent->think = modelspawn_think;
ent->nextthink = level.time + 2*FRAMETIME;
}
if (ent->spawnflags & NOT_IR)
ent->s.renderfx &= ~RF_IR_VISIBLE;
else
ent->s.renderfx |= RF_IR_VISIBLE;
gi.linkentity (ent);
}
/*QUAKED model_train (1 0 0) (-8 -8 -8) (8 8 8) START_ON TOGGLE BLOCK_STOPS PLAYER NO_MODEL ROTATE ROT_CONST SMOOTH
A moving model. The "team" key allows you to team train entities together.
Spawnflags:
PLAYER Set this if you want to use a player model
NO_MODEL Don't use a model. Usefull for placing particle effects and dynamic lights on their own
SPLINE: If set, the func_train will follow a spline curve between path_corners. What this means is you can create near perfectly smooth curvilinear paths with a handful of path_corners. The train will constantly turn to face the direction it is moving (unless yaw_speed and pitch_speed are negative values). For a couple of examples, see the rottrain and lcraft example maps (available on the downloads page.) The shape of the spline curve is controlled by the location and pitch and yaw angles of the train's path_corners. Train roll angle will vary linearly between path_corner roll angle values (the third component of the angles vector).
-----------------------
Key/Value pairs:
"style" Specifies the animation type to use.
0: None (unless startframe and framenumbers are used)
1: ANIM01 - cycle between frames 0 and 1 at 2 hz
2: ANIM23 - cycle between frames 2 and 3 at 2 hz
3: ANIM_ALL - cycle through all frames at 2 hz
4: ANIM_ALLFAST - cycle through all frames at 10 hz
Note: The animation flags override startframe and framenumbers settings you may have enterered. ANIM_ALL and ANIM_ALLFAST don't do what you might think - rather than setting a framerate, these apparently cause the model to cycle through its ENTIRE sequence of animations in 0.5 or 0.1 seconds... which for monster and player models is of course not possible. Looks exceptionally goofy.
"usermodel" The model to load (models/ is already coded)
"startframe" The starting frame : default 0
"framenumbers" The number of frames you want to display after startframe
"skinnum" The skin number to use, default 0
"health" If non-zero and solidstate is 3 or 4 (solid), the entity will be shootable. When destroyed, it blows up with a no-damage explosion.
"target" first path_corner"
"team" func_train or func_rotating
"solidstate"
1 = Not solid (default)
2 = Bounding box
NOTE : if you want the model to be solid then you must enter vector values into the following fields :
"bleft" = the point that is at the bottom left of the models bounding box in a model editor
"tright" = the point that is at the top left of the models bounding box in a model editor
"speed" How fast the model should move
"accel" Acceleration
"decel" Deceleration
"pitch_speed" (Nose up & Down) in degrees per second (defualt 20)
"yaw_speed" (Side-to-side "wiggle") in degrees per second (default 20)
"roll_speed" (Banking) in degrees per second toward the next path corner's set roll
"dmg" default 2, damage to inflict when blocked
"noise" Sound model makes while moving(path/file.wav)
"effects"
1: ROTATE Rotate like a weapon
2: GIB
8: BLASTER Yellowish orange glow plus particles
16: ROCKET Rocket trail
32: GRENADE Grenade trail
64: HYPERBLASTER BLASTER w/o the particles
128: BFG Big green ball
256: COLOR_SHELL
512: POWERSCREEN Green power shield
16384: FLIES Ewwww
32768: QUAD Blue shell
65536: PENT Red shell
131072: TELEPORTER Teleporter particles
262144: FLAG1 Red glow
524288: FLAG2 Blue glow
1048576: IONRIPPER
2097152: GREENGIB
4194304: BLUE_HB Blue hyperblaster glow
8388608: SPINNING_LIGHTS Red spinning lights
16777216: PLASMA
33554432: TRAP
67108864: TRACKER
134217728: DOUBLE Yellow shell
268435456: SPHERETRANS Transparent
536870912: TAGTRAIL
1073741824: HALF_DAMAGE
2147483648: TRACKER_TRAIL
"renderfx"
1: MINLIGHT Never completely dark
2: VIEWERMODEL
4: WEAPONMODEL
8: FULLBRIGHT
16: DEPTHHACK
32: TRANSLUCENT Transparent
64: FRAMELERP
128: BEAM
512: GLOW Pulsating glow of normal Q2 pickup items
1024: SHELL_RED
2048: SHELL_GREEN
4096: SHELL_BLUE
32768: IR_VISIBLE
65536: SHELL_DOUBLE
131072: SHELL_HALF_DAMAGE White shell
262144: USE_DISGUISE
To have other entities move with the model train, set the door pieces' movewith values to the same as the train's targetname and they will move in
unison, and also still be able to move relative to the train themselves, and can be attached and detached using target_movewith.
NOTE: All the pieces must be created after the model train entity, otherwise they will move ahead of it.
*/
#define MODEL_TRAIN_START_ON 1
#define MODEL_TRAIN_TOGGLE 2
#define MODEL_TRAIN_BLOCK_STOPS 4
#define MODEL_TRAIN_ROTATE 32
#define MODEL_TRAIN_ROT_CONST 64
#define TRAIN_ANIM 32
#define TRAIN_ANIM_FAST 64
#define MODEL_TRAIN_SMOOTH 128
#define TRAIN_ROTATE 8
#define TRAIN_ROT_CONST 16
#define TRAIN_SPLINE 4096
extern void train_use (edict_t *self, edict_t *other, edict_t *activator);
extern void func_train_find (edict_t *self);
void train_blocked (edict_t *self, edict_t *other);
void model_train_animator(edict_t *animator)
{
edict_t *train;
train = animator->owner;
if(!train || !train->inuse)
{
G_FreeEdict(animator);
return;
}
if(Q_strcasecmp(train->classname,"model_train"))
{
G_FreeEdict(animator);
return;
}
animator->nextthink = level.time + FRAMETIME;
if(VectorLength(train->velocity) == 0)
return;
train->s.frame++;
if (train->s.frame >= train->framenumbers)
train->s.frame = train->startframe;
gi.linkentity(train);
}
void SP_model_train (edict_t *self)
{
SP_model_spawn (self);
self->class_id = ENTITY_MODEL_TRAIN;
// Reset s.sound, which SP_model_spawn may have turned on
self->moveinfo.sound_middle = self->s.sound;
self->s.sound = 0;
if(!self->inuse) return;
// Reset some things from SP_model_spawn
self->delay = 0;
self->think = NULL;
self->nextthink = 0;
self->s.sound = self->noise_index;
if (self->health)
{
self->die = model_die;
self->takedamage = DAMAGE_YES;
}
if(self->framenumbers > self->startframe+1)
{
edict_t *animator;
animator = G_Spawn();
animator->owner = self;
animator->think = model_train_animator;
animator->nextthink = level.time + FRAMETIME;
}
self->s.frame = self->startframe;
self->movetype = MOVETYPE_PUSH;
// Really gross stuff here... translate model_spawn spawnflags
// to func_train spawnflags. PLAYER_MODEL and NO_MODEL have
// already been checked in SP_model_spawn and are never re-used,
// so it's OK to overwrite those.
if (self->spawnflags & MODEL_TRAIN_ROTATE)
{
self->spawnflags &= ~MODEL_TRAIN_ROTATE;
self->spawnflags |= TRAIN_ROTATE;
}
if (self->spawnflags & MODEL_TRAIN_ROT_CONST)
{
self->spawnflags &= ~MODEL_TRAIN_ROT_CONST;
self->spawnflags |= TRAIN_ROT_CONST;
}
//Knightmare- change both rotate flags to spline flag
if ((self->spawnflags & TRAIN_ROTATE) && (self->spawnflags &TRAIN_ROT_CONST))
{
self->spawnflags &= ~TRAIN_ROTATE;
self->spawnflags &= ~TRAIN_ROT_CONST;
self->spawnflags |= TRAIN_SPLINE;
}
if(self->style == 3)
self->spawnflags |= TRAIN_ANIM; // 32
if(self->style == 4)
self->spawnflags |= TRAIN_ANIM_FAST; // 64
// TRAIN_SMOOTH forces trains to go directly to Move_Done from
// Move_Final rather than slowing down (if necessary) for one
// frame.
if (self->spawnflags & MODEL_TRAIN_SMOOTH)
self->smooth_movement = 1;
else
self->smooth_movement = 0;
self->blocked = train_blocked;
if (self->spawnflags & MODEL_TRAIN_BLOCK_STOPS)
self->dmg = 0;
else
{
if (!self->dmg)
self->dmg = 100;
}
if (!self->speed)
self->speed = 100;
//Mappack
if(!self->accel)
self->moveinfo.accel = self->speed;
else
self->moveinfo.accel = self->accel;
if(!self->decel)
self->moveinfo.decel = self->speed;
else
self->moveinfo.decel = self->decel;
self->moveinfo.speed = self->speed;
self->use = train_use;
gi.linkentity (self);
if (self->target)
{
// start trains on the second frame, to make sure their targets have had
// a chance to spawn
self->nextthink = level.time + FRAMETIME;
self->think = func_train_find;
}
else
gi.dprintf ("model_train without a target at %s\n", vtos(self->s.origin));
}