FS2_Open
Open source remastering of the Freespace 2 engine
playercontrol.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 #include "autopilot/autopilot.h"
12 #include "camera/camera.h"
13 #include "debugconsole/console.h"
15 #include "freespace2/freespace.h"
17 #include "gamesnd/gamesnd.h"
18 #include "globalincs/linklist.h"
19 #include "hud/hud.h"
20 #include "hud/hudmessage.h"
21 #include "hud/hudsquadmsg.h"
22 #include "hud/hudtargetbox.h"
23 #include "io/joy.h"
24 #include "io/joy_ff.h"
25 #include "io/mouse.h"
26 #include "io/timer.h"
27 #include "mission/missiongoals.h"
28 #include "mission/missionmessage.h"
29 #include "network/multi_obj.h"
30 #include "network/multiutil.h"
31 #include "object/object.h"
32 #include "object/objectdock.h"
33 #include "observer/observer.h"
34 #include "parse/parselo.h"
35 #include "playerman/player.h"
36 #include "ship/ship.h"
37 #include "ship/shipfx.h"
38 #include "weapon/weapon.h"
39 
40 #ifndef NDEBUG
41 #include "io/key.h"
42 #endif
43 
44 
46 // Global object and other interesting player type things
49 
51 player *Player = NULL;
52 
53 // Goober5000
54 int Player_use_ai = 0;
55 
57 
58 physics_info Descent_physics; // used when we want to control the player like the descent ship
59 
62 
63 int toggle_glide = 0;
64 int press_glide = 0;
65 
67 // Module data
69 static int Player_all_alone_msg_inited=0; // flag used for initializing a player-specific voice msg
70 
71 #ifndef NDEBUG
73  DCF_BOOL( show_killer_weapon, Show_killer_weapon )
74 #endif
75 
81 void playercontrol_read_stick(int *axis, float frame_time);
83 
89 {
90  float sk;
91  angles delta;
92 
93  // Make sure we actually need to do all this math.
94  if ((ap->p == bp->p) && (ap->h == bp->h))
95  return;
96 
97  sk = 1.0f - scale*flRealframetime;
98 
99  CLAMP(sk, 0.0f, 1.0f);
100 
101  delta.p = ap->p - bp->p;
102  delta.h = ap->h - bp->h;
103 
104  ap->p = ap->p - delta.p * (1.0f - sk);
105  ap->h = ap->h - delta.h * (1.0f - sk);
106 
107  // If we're very close, put ourselves at goal.
108  if ((fl_abs(delta.p) < 0.005f) && (fl_abs(delta.h) < 0.005f)) {
109  ap->p = bp->p;
110  ap->h = bp->h;
111  }
112 }
113 
116 
117 void view_modify(angles *ma, angles *da, float max_p, float max_h, float frame_time)
118 {
119  int axis[NUM_JOY_AXIS_ACTIONS];
120  float t = 0;
121  float u = 0;
122  vec3d trans = ZERO_VECTOR;
123 
124  if ( Viewer_mode & VM_EXTERNAL) {
128  } else {
129  return;
130  }
131  } else if ( gTirDll_TrackIR.Enabled( ) ) {
133  ma->h = -PI2*(gTirDll_TrackIR.GetYaw());
134  ma->p = PI2*(gTirDll_TrackIR.GetPitch());
135 
136  trans.xyz.x = -0.4f*gTirDll_TrackIR.GetX();
137  trans.xyz.y = 0.4f*gTirDll_TrackIR.GetY();
138  trans.xyz.z = -gTirDll_TrackIR.GetZ();
139 
140  if(trans.xyz.z < 0)
141  trans.xyz.z = 0.0f;
142 
144  } else {
145  // View slewing commands commented out until we can safely add more commands in the pilot code.
146  }
147 
148  if (t != 0.0f)
149  da->h += t;
150  else
151  da->h = 0.0f;
152 
153  if (u != 0.0f)
154  da->p += u;
155  else
156  da->p = 0.0f;
157 
158  da->b = 0.0f;
159 
160  playercontrol_read_stick(axis, frame_time);
161 
162  if (( Viewer_mode & VM_EXTERNAL ) && !(Viewer_mode & VM_EXTERNAL_CAMERA_LOCKED)) {
163  // check the heading on the x and y axes
164  da->h -= f2fl( axis[0] );
165  da->p -= f2fl( axis[1] );
166  }
167 
168  if (da->h > 1.0f)
169  da->h = 1.0f;
170  else if (da->h < -1.0f)
171  da->h = -1.0f;
172 
173  if (da->p > 1.0f)
174  da->p = 1.0f;
175  else if (da->p < -1.0f)
176  da->p = -1.0f;
177 
178  if ( (Game_time_compression >= F1_0) && !(Viewer_mode & VM_EXTERNAL) )
179  {
180  ma->p += 2*da->p * flFrametime;
181  ma->b += 2*da->b * flFrametime;
182  ma->h += 2*da->h * flFrametime;
183  }
184  else
185  {
186  //If time compression is less than normal, still move camera at same speed
187  //This gives a cool matrix effect
188  ma->p += da->p * flRealframetime;
189  ma->b += da->b * flRealframetime;
190  ma->h += da->h * flRealframetime;
191  }
192 
193  if (ma->p > max_p)
194  ma->p = max_p;
195  else if (ma->p < -max_p)
196  ma->p = -max_p;
197 
198  if (ma->h > max_h)
199  ma->h = max_h;
200  else if (ma->h < -max_h)
201  ma->h = -max_h;
202 }
203 
205 {
206  vec3d view_vector;
207  vec3d targetpos_rotated;
208  vec3d playerpos_rotated;
209  vec3d forwardvec_rotated;
210  vec3d target_pos;
211  angles view_angles;
212  angles forward_angles;
213 
214  if ((Player_ai->target_objnum == -1) || (Viewer_mode & VM_OTHER_SHIP)) {
215  // If the object isn't targeted or we're viewing from the target's perspective, center the view and turn off target padlock
216  // because the target won't be at the angle we've calculated from the player's perspective.
218  chase_slew_angles.p = 0.0f;
219  chase_slew_angles.h = 0.0f;
220  return;
221  }
222 
223  object * targetp = &Objects[Player_ai->target_objnum];
224 
225  // check to see if there is even a current target. if not, switch off the
226  // target padlock tracking flag, make the camera slew to the center,
227  // and exit the procedure
228  if ( targetp == &obj_used_list ) {
230  chase_slew_angles.p = 0.0f;
231  chase_slew_angles.h = 0.0f;
232  return;
233  }
234 
235  // look at a subsystem if there is one.
236  if ( Player_ai->targeted_subsys != NULL ) {
237  get_subsystem_world_pos(targetp, Player_ai->targeted_subsys, &target_pos);
238 
239  } else {
240  target_pos = targetp->pos;
241  }
242 
243  vm_vec_rotate(&targetpos_rotated, &target_pos, &Player_obj->orient);
244  vm_vec_rotate(&playerpos_rotated, &Player_obj->pos, &Player_obj->orient);
245  vm_vec_rotate(&forwardvec_rotated, &Player_obj->orient.vec.fvec, &Player_obj->orient);
246 
247  vm_vec_normalized_dir(&view_vector,&targetpos_rotated,&playerpos_rotated);
248  vm_extract_angles_vector(&view_angles,&view_vector);
249  vm_extract_angles_vector(&forward_angles,&forwardvec_rotated);
250  chase_slew_angles.h = forward_angles.h - view_angles.h;
251  chase_slew_angles.p = -(forward_angles.p - view_angles.p);
252 
253  // the gimbal limits of the player's virtual neck.
254  // These nested ifs prevent the player from looking up and
255  // down beyond 90 degree angles.
256  if (chase_slew_angles.p > PI_2)
257  chase_slew_angles.p = PI_2;
258  else if (chase_slew_angles.p < -PI_2)
259  chase_slew_angles.p = -PI_2;
260 
261  // prevents the player from looking completely behind himself; just over his shoulder
262  if (chase_slew_angles.h > PI2/3)
263  chase_slew_angles.h = PI2/3;
264  else if (chase_slew_angles.h < -PI2/3)
265  chase_slew_angles.h = -PI2/3;
266 }
267 
268 
273 {
274  view_modify(&chase_slew_angles, &Viewer_slew_angles_delta, PI_2, PI2/3, frame_time);
275 }
276 
278 {
279  float t;
280 
281  // Process centering key.
284  }
285 
288  if (Viewer_chase_info.distance < 0.0f)
290 }
291 
292 float camera_zoom_scale = 1.0f;
293 
294 DCF(camera_speed, "Sets the camera zoom scale")
295 {
296  if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
297  dc_printf("Camera zoom scale is %f\n", camera_zoom_scale);
298  return;
299  }
300 
301  dc_stuff_float(&camera_zoom_scale);
302 
303  dc_printf("Camera zoom scale set to %f\n", camera_zoom_scale);
304 }
305 
307 {
308  float t;
309 
310  view_modify(&Viewer_external_info.angles, &Viewer_external_angles_delta, PI2, PI2, frame_time);
311 
312  // Process centering key.
317  }
318 
321  if (Viewer_external_info.distance < 0.0f){
323  }
324 
325  // Do over-the-top correction.
326 
329  else if (Viewer_external_info.angles.p < -PI)
331 
334  else if (Viewer_external_info.angles.h < -PI)
336 }
337 
342 {
346 }
347 
352 {
353  float t1, t2, oldspeed;
354 
355  t1 = ci->heading;
356  t2 = ci->pitch;
357  oldspeed = ci->forward_cruise_percent;
358  memset( ci, 0, sizeof(control_info) );
359  ci->heading = t1;
360  ci->pitch = t2;
361  ci->forward_cruise_percent = oldspeed;
362 }
363 
364 void playercontrol_read_stick(int *axis, float frame_time)
365 {
366  int i;
367 
368  // Read the stick
369  control_get_axes_readings(&axis[0], &axis[1], &axis[2], &axis[3], &axis[4]);
370 
371  if (Use_mouse_to_fly) {
372  int dx, dy, dz;
373  float factor;
374 
375  factor = (float) Mouse_sensitivity + 1.77f;
376  factor = factor * factor / frame_time / 0.6f;
377 
378  mouse_get_delta(&dx, &dy, &dz);
379  int x_axis, y_axis, z_axis;
380  x_axis = y_axis = z_axis = -1;
381 
382  for (i = 0; i < NUM_JOY_AXIS_ACTIONS; i++) {
383  switch(Axis_map_to[i])
384  {
385  case JOY_X_AXIS:
386  x_axis = i;
387  break;
388  case JOY_Y_AXIS:
389  y_axis = i;
390  break;
391  case JOY_Z_AXIS:
392  z_axis = i;
393  break;
394  }
395  }
396 
397  if (x_axis >= 0) {
398  if (Invert_axis[x_axis]) {
399  dx = -dx;
400  }
401  axis[x_axis] += (int) ((float) dx * factor);
402  }
403 
404  if (y_axis >= 0) {
405  if (Invert_axis[y_axis]) {
406  dy = -dy;
407  }
408  axis[y_axis] += (int) ((float) dy * factor);
409  }
410 
411  if (z_axis >= 0) {
412  if (Invert_axis[z_axis]) {
413  dz = -dz;
414  }
415  axis[z_axis] += (int) ((float) dz * factor);
416  }
417  }
418 }
419 
421 {
422  float kh=0.0f, scaled, newspeed, delta, oldspeed;
423  int axis[NUM_JOY_AXIS_ACTIONS], slew_active=1;
424  static int afterburner_last = 0;
425  static float analog_throttle_last = 9e9f;
426  static int override_analog_throttle = 0;
427  static float savedspeed = ci->forward_cruise_percent; //Backslash
428  int ok_to_read_ci_pitch_yaw=1;
429  int centering_speed = 7; // the scale speed in which the camera will smoothly center when the player presses Center View
430 
431  oldspeed = ci->forward_cruise_percent;
433 
434  if ( Viewer_mode & VM_EXTERNAL ) {
437  ok_to_read_ci_pitch_yaw=0;
438  }
439 
440  do_view_external(frame_time);
441  do_thrust_keys(ci);
442  slew_active=0;
443  } else if ( Viewer_mode & VM_CHASE ) {
444  do_view_chase(frame_time);
445  slew_active=0;
446  } else { // We're in the cockpit.
447  if (view_centering) {
448  // If we're centering the view, check to see if we're actually centered and bypass any view modifications
449  // until the view has finally been centered.
450  if ((Viewer_slew_angles.h == 0.0f) && (Viewer_slew_angles.p == 0.0f)) {
451  view_centering = 0; // if the view has been centered, allow the player to freelook again.
452  }
453  slew_active = 0;
454  } else if ( Viewer_mode & VM_TRACK ) { // Player's vision will track current target.
455  do_view_track_target(frame_time);
456  } else {
457  // The Center View command check is here because
458  // we don't want the player centering the view in target padlock mode
460  view_centering = 1;
461  slew_active = 0;
462  }
463  do_view_slew(frame_time);
464 
465  // Orthogonal padlock views moved here in order to get the springy chase effect when transitioning.
467 
468  }
469  }
470 
471  if ( ok_to_read_ci_pitch_yaw ) {
472  // From keyboard...
473  do_thrust_keys(ci);
476  ci->heading = 0.0f;
477  } else {
479  if (kh == 0.0f) {
480  ci->heading = 0.0f;
481 
482  } else if (kh > 0.0f) {
483  if (ci->heading < 0.0f)
484  ci->heading = 0.0f;
485 
486  } else { // kh < 0
487  if (ci->heading > 0.0f)
488  ci->heading = 0.0f;
489  }
490 
492  }
493 
494  ci->heading += kh;
495 
497  if (kh == 0.0f) {
498  ci->pitch = 0.0f;
499  } else if (kh > 0.0f) {
500  if (ci->pitch < 0.0f)
501  ci->pitch = 0.0f;
502 
503  } else { // kh < 0
504  if (ci->pitch > 0.0f)
505  ci->pitch = 0.0f;
506  }
507 
508  ci->pitch += kh;
509  }
510 
511  if ( !slew_active ) {
512  // If we're not in a view that slews (ie, not a cockpit view), make the viewer slew angles spring to the center.
513  chase_slew_angles.h = 0.0f;
514  chase_slew_angles.p = 0.0f;
515  }
516 
517  chase_angles_to_value(&Viewer_slew_angles, &chase_slew_angles, centering_speed);
518 
519  if (!(Game_mode & GM_DEAD)) {
520  if ( button_info_query(&Player->bi, ONE_THIRD_THROTTLE) ) {
523  if ( Player->ci.forward_cruise_percent < 33.3f ) {
525 
526  } else if ( Player->ci.forward_cruise_percent > 33.3f ) {
528  }
529 
530  Player->ci.forward_cruise_percent = 33.3f;
531  override_analog_throttle = 1;
532  }
533 
534  if ( button_info_query(&Player->bi, TWO_THIRDS_THROTTLE) ) {
537  if ( Player->ci.forward_cruise_percent < 66.6f ) {
539 
540  } else if (Player->ci.forward_cruise_percent > 66.6f) {
542  }
543 
544  Player->ci.forward_cruise_percent = 66.6f;
545  override_analog_throttle = 1;
546  }
547 
548  if ( button_info_query(&Player->bi, PLUS_5_PERCENT_THROTTLE) ) {
550  Player->ci.forward_cruise_percent += 5.0f;
551  if (Player->ci.forward_cruise_percent > 100.0f)
552  Player->ci.forward_cruise_percent = 100.0f;
553  }
554 
555  if ( button_info_query(&Player->bi, MINUS_5_PERCENT_THROTTLE) ) {
557  Player->ci.forward_cruise_percent -= 5.0f;
558  if (Player->ci.forward_cruise_percent < 0.0f)
559  Player->ci.forward_cruise_percent = 0.0f;
560  }
561 
562  if ( button_info_query(&Player->bi, ZERO_THROTTLE) ) {
565  if ( ci->forward_cruise_percent > 0.0f && Player_obj->phys_info.fspeed > 0.5) {
567  }
568 
569  ci->forward_cruise_percent = 0.0f;
570  override_analog_throttle = 1;
571  }
572 
573  if ( button_info_query(&Player->bi, MAX_THROTTLE) ) {
576  if ( ci->forward_cruise_percent < 100.0f ) {
578  }
579 
580  ci->forward_cruise_percent = 100.0f;
581  override_analog_throttle = 1;
582  }
583 
584  // AL 12-29-97: If afterburner key is down, player should have full forward thrust (even if afterburners run out)
585  if ( check_control(AFTERBURNER) ) {
586  ci->forward = 1.0f;
587  }
588 
590  ci->forward = -pi->max_rear_vel * 1.0f;
591  }
592 
593  if ( Player->flags & PLAYER_FLAGS_MATCH_TARGET ) {
594  if ( (Player_ai->last_target == Player_ai->target_objnum) && (Player_ai->target_objnum != -1) && ( ci->forward_cruise_percent == oldspeed) ) {
595  float tspeed, pmax_speed;
596  object *targeted_objp = &Objects[Player_ai->target_objnum];
597 
598  tspeed = targeted_objp->phys_info.speed; //changed from fspeed. If target is reversing, sliding, or gliding we still want to keep up. -- Backslash
599 
600  // maybe need to get speed from docked partner
601  if ( tspeed < MATCH_SPEED_THRESHOLD ) {
602  Assert(targeted_objp->type == OBJ_SHIP);
603 
604  // Goober5000
605  if (object_is_docked(targeted_objp))
606  {
607  tspeed = dock_calc_docked_speed(targeted_objp); //changed from fspeed
608  }
609  }
610 
611  // Note, if closer than 100 units, scale down speed a bit. Prevents repeated collisions. -- MK, 12/17/97
612  float dist = vm_vec_dist(&Player_obj->pos, &targeted_objp->pos);
613 
614  if (dist < 100.0f) {
615  tspeed = tspeed * (0.5f + dist/200.0f);
616  }
617 
618  //SUSHI: If gliding, don't do anything for speed matching
619  if (!( (Objects[Player->objnum].phys_info.flags & PF_GLIDING) || (Objects[Player->objnum].phys_info.flags & PF_FORCE_GLIDE) )) {
621  if (pmax_speed > 0.0f) {
622  ci->forward_cruise_percent = (tspeed / pmax_speed) * 100.0f;
623  } else {
624  ci->forward_cruise_percent = 0.0f;
625  }
626  override_analog_throttle = 1;
627  }
628 
629  } else
630  Player->flags &= ~PLAYER_FLAGS_MATCH_TARGET;
631  }
632 
633  // code to read joystick axis for pitch/heading. Code to read joystick buttons
634  // for bank.
635  if ( !(Game_mode & GM_DEAD) ) {
636  playercontrol_read_stick(axis, frame_time);
637  } else {
638  axis[0] = axis[1] = axis[2] = axis[3] = axis[4] = 0;
639  }
640 
641  if (Axis_map_to[JOY_HEADING_AXIS] >= 0) {
642  // check the heading on the x axis
644  delta = f2fl( axis[JOY_HEADING_AXIS] );
645  if ( (delta > 0.05f) || (delta < -0.05f) ) {
646  ci->bank -= delta;
647  }
648  } else {
649  ci->heading += f2fl( axis[JOY_HEADING_AXIS] );
650  }
651  }
652 
653  // check the pitch on the y axis
654  if (Axis_map_to[JOY_PITCH_AXIS] >= 0) {
655  ci->pitch -= f2fl( axis[JOY_PITCH_AXIS] );
656  }
657 
658  if (Axis_map_to[JOY_BANK_AXIS] >= 0) {
659  ci->bank -= f2fl( axis[JOY_BANK_AXIS] ) * 1.5f;
660  }
661 
662  // axis 2 is for throttle
664  scaled = (float) axis[JOY_ABS_THROTTLE_AXIS] * 1.2f / (float) F1_0 - 0.1f; // convert to -0.1 - 1.1 range
665  oldspeed = ci->forward_cruise_percent;
666 
667  newspeed = (1.0f - scaled) * 100.0f;
668 
669  delta = analog_throttle_last - newspeed;
670  if (!override_analog_throttle || (delta < -1.5f) || (delta > 1.5f)) {
671  ci->forward_cruise_percent = newspeed;
672  analog_throttle_last = newspeed;
673  override_analog_throttle = 0;
674  }
675  }
676 
679 
680  if ( ci->forward_cruise_percent > 100.0f )
681  ci->forward_cruise_percent = 100.0f;
682  if ( ci->forward_cruise_percent < 0.0f )
683  ci->forward_cruise_percent = 0.0f;
684 
685  // set up the firing stuff. Read into control info ala Descent so that weapons will be
686  // created during the object simulation phase, and not immediately as was happening before.
687 
688  //keyboard: fire the current primary weapon
690  ci->fire_primary_count++;
691  }
692 
693  // for debugging, check to see if the debug key is down -- if so, make fire the debug laser instead
694 #ifndef NDEBUG
695  if ( keyd_pressed[KEY_DEBUG_KEY] ) {
697  ci->fire_primary_count = 0;
698  }
699 #endif
700 
701  // keyboard: fire the current secondary weapon
703  ci->fire_secondary_count++;
704 
705  // if we're a multiplayer client, set our accum bits now
706  if( MULTIPLAYER_CLIENT && (Net_player != NULL)){
708  }
709  }
710 
711  // keyboard: launch countermeasures, but not if AI controlling Player
716  }
717 
718  // see if the afterburner has been started (keyboard + joystick)
720  if (!afterburner_last) {
724  } else {
725  ci->afterburner_start = 1;
726  }
727  }
728 
729  afterburner_last = 1;
730 
731  } else {
732  if (afterburner_last)
733  ci->afterburner_stop = 1;
734 
735  afterburner_last = 0;
736  }
737 
738  // new gliding systems combining code by Backslash, Turey, Kazan, and WMCoolmon
739 
740  // Check for toggle button pressed.
741  if ( button_info_query(&Player->bi, TOGGLE_GLIDING) ) {
743  if ( Player_obj != NULL && Ship_info[Player_ship->ship_info_index].can_glide ) {
745  }
746  }
747  // This logic is a bit tricky. It checks to see if the glide_when_pressed button is in a different state
748  // than press_glide. Since it sets press_glide equal to glide_when_pressed inside of this if statement,
749  // this only evaluates to true when the state of the button is different than it was last time.
751  if ( Player_obj != NULL && Ship_info[Player_ship->ship_info_index].can_glide ) {
752  // This only works if check_control returns only 1 or 0. Shouldn't be a problem,
753  // but this comment's here just in case it is.
755  }
756  }
757 
758  // if the player is warping out, cancel gliding
760  toggle_glide = 0;
761  press_glide = 0;
762  }
763 
764  // Do we want to be gliding?
765  if ( toggle_glide || press_glide ) {
766  // Probably don't need to do this check, but just in case...
767  if ( Player_obj != NULL && Ship_info[Player_ship->ship_info_index].can_glide ) {
768  // Only bother doing this if we need to.
769  if ( toggle_glide && press_glide ) {
770  // Overkill -- if gliding is toggled on and glide_when_pressed is pressed, turn glide off
773  ci->forward_cruise_percent = savedspeed;
776  }
777  } else if ( !object_get_gliding(Player_obj) ) {
779  savedspeed = ci->forward_cruise_percent;
780  ci->forward_cruise_percent = 0.0f;
781  override_analog_throttle = 1;
782  if (Ship_info[Player_ship->ship_info_index].glide_start_snd > 0) {
783  //If a custom glide start sound was specified, play it
784  snd_play( &Snds[Ship_info[Player_ship->ship_info_index].glide_start_snd], 0.0f );
785  } else {
786  //If glide_start_snd wasn't set (probably == 0), use the default throttle down sound
788  }
789  }
790  }
791  } else {
792  // Probably don't need to do the second half of this check, but just in case...
793  if ( Player_obj != NULL && Ship_info[Player_ship->ship_info_index].can_glide ) {
794  // Only bother doing this if we need to.
797  ci->forward_cruise_percent = savedspeed;
798  if (Ship_info[Player_ship->ship_info_index].glide_end_snd > 0) {
799  //If a custom glide end sound was specified, play it
800  snd_play( &Snds[Ship_info[Player_ship->ship_info_index].glide_end_snd], 0.0f );
801  } else {
802  //If glide_end_snd wasn't set (probably == 0), use the default throttle up sound
804  }
805  }
806  }
807  }
808 
809  }
810 
811  if ( (Viewer_mode & VM_EXTERNAL) ) {
813  ci->heading=0.0f;
814  ci->pitch=0.0f;
815  ci->bank=0.0f;
816  }
817  }
818 }
819 
821 {
822  if (dest_ci == NULL)
823  return;
824 
825  if (src_ci == NULL) {
826  dest_ci->pitch = 0.0f;
827  dest_ci->vertical = 0.0f;
828  dest_ci->heading = 0.0f;
829  dest_ci->sideways = 0.0f;
830  dest_ci->bank = 0.0f;
831  dest_ci->forward = 0.0f;
832  dest_ci->forward_cruise_percent = 0.0f;
833  dest_ci->fire_countermeasure_count = 0;
834  dest_ci->fire_secondary_count = 0;
835  dest_ci->fire_primary_count = 0;
836  } else {
837  dest_ci->pitch = src_ci->pitch;
838  dest_ci->vertical = src_ci->vertical;
839  dest_ci->heading = src_ci->heading;
840  dest_ci->sideways = src_ci->sideways;
841  dest_ci->bank = src_ci->bank;
842  dest_ci->forward = src_ci->forward;
844  }
845 }
846 
847 void read_player_controls(object *objp, float frametime)
848 {
849  float diff;
850  int can_warp = 0, warp_failed = 0;
851  float target_warpout_speed;
852 
854 
855  switch( Player->control_mode )
856  {
857  case PCM_SUPERNOVA:
858  break;
859 
860  case PCM_NORMAL:
861  read_keyboard_controls(&(Player->ci), frametime, &objp->phys_info );
862 
863  if ( lua_game_control & LGC_STEERING ) {
864  // make sure to copy the control before reseting it
865  Player->lua_ci = Player->ci;
866  copy_control_info(&(Player->ci), NULL);
867  } else if ( lua_game_control & LGC_FULL ) {
869  // first copy over the new values, then reset
870  temp = Player->ci;
871  copy_control_info(&(Player->ci), &(Player->lua_ci));
872  Player->lua_ci = temp;
873  } else {
874  // just copy the ci should that be needed in scripting
875  Player->lua_ci = Player->ci;
876  }
877  break;
878 
879  case PCM_WARPOUT_STAGE1: // Accelerate to 40 km/s
880  case PCM_WARPOUT_STAGE2: // Go 40 km/s steady up to the effect
881  case PCM_WARPOUT_STAGE3: // Go 40 km/s steady through the effect
882  {
883  memset(&(Player->ci), 0, sizeof(control_info) ); // set the controls to 0
884 
885  if ( (objp->type == OBJ_SHIP) && (!(Game_mode & GM_DEAD)) )
886  {
888 
889  target_warpout_speed = ship_get_warpout_speed(objp);
890 
891  if ( Warpout_forced ) {
892  Ships[objp->instance].current_max_speed = target_warpout_speed * 2.0f;
893 
894  diff = target_warpout_speed-objp->phys_info.fspeed;
895 
896  if ( diff < 0.0f )
897  diff = 0.0f;
898 
899  Player->ci.forward = ((target_warpout_speed+diff) / Ships[objp->instance].current_max_speed);
900  } else {
901  // check if warp ability has been disabled
902  if ( Ships[objp->instance].flags & ( SF_WARP_BROKEN|SF_WARP_NEVER ) ) {
903  HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Cannot warp out at this time.", 81));
904  warp_failed = 1;
905  } else {
906  if ( (!warp_failed) && (Ships[objp->instance].current_max_speed >= target_warpout_speed) ) {
907  can_warp = 1;
908  } else {
909  Ships[objp->instance].current_max_speed = target_warpout_speed + 5.0f;
910  can_warp = 1;
911  }
912 
913  if (can_warp) {
914  diff = target_warpout_speed - objp->phys_info.fspeed;
915 
916  if ( diff < 0.0f )
917  diff = 0.0f;
918 
919  Player->ci.forward = ((target_warpout_speed + diff) / Ships[objp->instance].current_max_speed);
920  }
921  }
922 
923  if ( warp_failed ) {
926  }
927  }
928 
929  if ( Player->control_mode == PCM_WARPOUT_STAGE1 )
930  {
931  float warpout_delay;
933 
934  if (sip->warpout_engage_time >= 0)
935  warpout_delay = sip->warpout_engage_time / 1000.0f;
936  else
937  warpout_delay = MINIMUM_PLAYER_WARPOUT_TIME;
938 
939  // Wait at least 3 seconds before making sure warp speed is set.
940  if ( Warpout_time > warpout_delay) {
941  // If we are going around 5% of the target speed, progress to next stage
942  float diffSpeed = objp->phys_info.fspeed;
943  if(target_warpout_speed != 0.0f) {
944  diffSpeed = fl_abs(objp->phys_info.fspeed - target_warpout_speed )/target_warpout_speed;
945  }
946  if ( diffSpeed < TARGET_WARPOUT_MATCH_PERCENT ) {
948  }
949  }
950  }
951  }
952 
953  break;
954  }
955  }
956 
957  // the ships maximum velocity now depends on the energy flowing to engines
958  if(objp->type != OBJ_OBSERVER){
960  }
961  if(Player_obj->type == OBJ_SHIP && !Player_use_ai){
962  // only read player control info if player ship is not dead
963  // or if Player_use_ai is disabed
964  if ( !(Ships[Player_obj->instance].flags & SF_DYING) ) {
965  vec3d wash_rot;
966  if ((Ships[objp->instance].wash_intensity > 0) && !((Player->control_mode == PCM_WARPOUT_STAGE1) || (Player->control_mode == PCM_WARPOUT_STAGE2) || (Player->control_mode == PCM_WARPOUT_STAGE3)) ) {
967  float intensity = 0.3f * MIN(Ships[objp->instance].wash_intensity, 1.0f);
968  vm_vec_copy_scale(&wash_rot, &Ships[objp->instance].wash_rot_axis, intensity);
969  physics_read_flying_controls( &objp->orient, &objp->phys_info, &(Player->ci), flFrametime, &wash_rot);
970  } else {
971  physics_read_flying_controls( &objp->orient, &objp->phys_info, &(Player->ci), flFrametime);
972  }
973  }
974  } else if(Player_obj->type == OBJ_OBSERVER){
975  physics_read_flying_controls(&objp->orient,&objp->phys_info,&(Player->ci), flFrametime);
976  }
977 }
978 
980 {
981  static int initted = 0;
982 
983  if (initted)
984  return;
985 
986  initted = 1;
987  physics_init( &Descent_physics );
988  Descent_physics.flags |= PF_ACCELERATES | PF_SLIDE_ENABLED;
989 
990  Viewer_slew_angles_delta.p = 0.0f;
991  Viewer_slew_angles_delta.b = 0.0f;
992  Viewer_slew_angles_delta.h = 0.0f;
993 }
994 
999 {
1000  if ( !Player ) {
1001  Int3(); // why is Player NULL?
1002  return;
1003  }
1004 
1005  Player->flags &= ~PLAYER_FLAGS_MATCH_TARGET;
1007 }
1008 
1016 void player_match_target_speed(char *no_target_text, char *match_off_text, char *match_on_text)
1017 {
1018  // multiplayer observers can't match target speed
1020  return;
1021  }
1022 
1023  if ( Player_ai->target_objnum == -1) {
1024  if ( no_target_text ) {
1025  if ( no_target_text[0] ) {
1026  HUD_sourced_printf(HUD_SOURCE_HIDDEN, no_target_text );
1027  }
1028  } else {
1029 // HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR("No currently selected target.",-1) );
1030  }
1031  return;
1032  }
1033 
1034  object *targeted_objp = &Objects[Player_ai->target_objnum];
1035 
1036  if ( targeted_objp->type != OBJ_SHIP ) {
1037  return;
1038  }
1039 
1040  if ( Player->flags & PLAYER_FLAGS_MATCH_TARGET ) {
1041  Player->flags &= ~PLAYER_FLAGS_MATCH_TARGET;
1042  if ( match_off_text ) {
1043  if ( match_off_text[0] ) {
1044  HUD_sourced_printf(HUD_SOURCE_HIDDEN, match_off_text );
1045  }
1046  } else {
1047 // HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR("No longer matching speed with current target.",-1) );
1048  }
1049  } else {
1050  int can_match=0;
1051 
1052  if ( targeted_objp->phys_info.fspeed > MATCH_SPEED_THRESHOLD ) {
1053  can_match=1;
1054  } else {
1055  // account for case of matching speed with docked ship
1056  if (object_is_docked(targeted_objp))
1057  {
1058  if (dock_calc_docked_fspeed(targeted_objp) > MATCH_SPEED_THRESHOLD)
1059  {
1060  can_match=1;
1061  }
1062  }
1063  }
1064 
1065  if ( can_match ) {
1066  Player->flags |= PLAYER_FLAGS_MATCH_TARGET;
1067  if ( match_on_text ) {
1068  if ( match_on_text[0] ) {
1069  HUD_sourced_printf(HUD_SOURCE_HIDDEN, match_on_text );
1070  }
1071  } else {
1072 // HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR("Matching speed with current target.",-1) );
1073  }
1074  }
1075  }
1076 }
1077 
1078 // toggle_player_object toggles between the player objects (i.e. the ship they are currently flying)
1079 // and a descent style ship.
1080 
1081 int use_descent = 0;
1083 
1085 {
1086  if ( use_descent ) {
1087  memcpy( &Player_obj->phys_info, &phys_save, sizeof(physics_info) );
1088  } else {
1089  memcpy( &phys_save, &Player_obj->phys_info, sizeof(physics_info) );
1090  memcpy( &Player_obj->phys_info, &Descent_physics, sizeof(physics_info) );
1091  }
1092  use_descent = !use_descent;
1093 
1094  HUD_sourced_printf(HUD_SOURCE_HIDDEN, NOX("Using %s style physics for player ship."), use_descent ? NOX("DESCENT") : NOX("FreeSpace"));
1095 }
1096 
1101 {
1102  ship_obj *so;
1103  object *objp;
1104 
1106 
1107  // See if there are any friendly ships present, if so return without preventing msg
1108  for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
1109  objp = &Objects[so->objnum];
1110  if ( objp == Player_obj ) {
1111  continue;
1112  }
1113 
1114  if ( Ships[objp->instance].team == Player_ship->team ) {
1115  int ship_type = Ship_info[Ships[objp->instance].ship_info_index].class_type;
1116  if ( ship_type != -1 && (Ship_types[ship_type].message_bools & STI_MSG_COUNTS_FOR_ALONE) ) {
1117  return;
1118  }
1119  }
1120  }
1121 
1122  // There must be no friendly ships present, so prevent the 'all alone' message from ever playing
1124 }
1125 
1130 {
1131  // Enable auto-targeting by default for all new pilots
1134 
1135  p->auto_advance = 1;
1136 }
1137 
1142 {
1143  Player->save_flags = 0;
1144  if ( Player->flags & PLAYER_FLAGS_AUTO_TARGETING ) {
1146  }
1147 
1148 
1149  if ( Player->flags & PLAYER_FLAGS_AUTO_MATCH_SPEED ) {
1150  // multiplayer observers can't match target speed
1152  {
1154  }
1155  }
1156 
1157  // if we're in multiplayer mode don't do this because we will desync ourselves with the server
1158  if(!(Game_mode & GM_MULTIPLAYER)){
1159  if ( Player_ship->flags & SF_PRIMARY_LINKED ) {
1161  } else {
1162  Player->flags &= ~PLAYER_FLAGS_LINK_PRIMARY;
1163  }
1166  } else {
1167  Player->flags &= ~PLAYER_FLAGS_LINK_SECONDARY;
1168  }
1169  }
1170 }
1171 
1176 {
1177  ship_info *player_sip;
1178  player_sip = &Ship_info[Player_ship->ship_info_index];
1179  polymodel *pm = model_get(player_sip->model_num);
1180 
1181  // Don't restores the save flags in training, as we must ensure certain things are off, such as speed matching.
1183  Player->flags |= Player->save_flags;
1184  }
1185 
1186  if ( Player->flags & PLAYER_FLAGS_LINK_PRIMARY && !(player_sip->flags2 & SIF2_NO_PRIMARY_LINKING) ) {
1187  if ( Player_ship->weapons.num_primary_banks > 1 ) {
1189  }
1190  }
1191 
1192  if ( Player->flags & PLAYER_FLAGS_LINK_SECONDARY && (pm->n_missiles > 0 && pm->missile_banks[0].num_slots > 1) ) {
1194  }
1195 }
1196 
1202 {
1203  toggle_glide = 0;
1204  press_glide = 0;
1205  memset(&(Player->ci), 0, sizeof(control_info) ); // set the controls to 0
1206 
1208  Viewer_external_info.angles.p = 0.0f;
1209  Viewer_external_info.angles.b = 0.0f;
1210  Viewer_external_info.angles.h = 0.0f;
1212 
1213  Viewer_mode = 0;
1214 
1215  Player_obj = NULL;
1216  Player_ship = NULL;
1217  Player_ai = NULL;
1218 
1219  Player_use_ai = 0; // Goober5000
1220 
1221  if(Player == NULL)
1222  return;
1223 
1224  Player->flags = PLAYER_FLAGS_STRUCTURE_IN_USE; // reset the player flags
1225  Player->flags |= Player->save_flags;
1226 
1227  // Init variables for friendly fire monitoring.
1228  Player->friendly_last_hit_time = 0;
1229  Player->friendly_hits = 0;
1230  Player->friendly_damage = 0.0f;
1231  Player->last_warning_message_time = 0;
1232 
1233  Player->control_mode = PCM_NORMAL;
1234 
1235  Player->allow_warn_timestamp = 1; // init timestamp that is used for managing attack warnings sent to player
1236  Player->check_warn_timestamp = 1;
1237  Player->warn_count = 0; // number of attack warnings player has received this mission
1238 
1239  Player->distance_warning_count = 0; // Number of warning too far from origin
1240  Player->distance_warning_time = 0; // Time at which last warning was given
1241 
1242  Player->praise_count = 0; // number of praises player has received this mission
1243  Player->allow_praise_timestamp = 1; // timestamp until next praise is allowed
1244  Player->praise_delay_timestamp = 0; // timstamp used to delay praises given to the player
1245 
1246  Player->ask_help_count = 0; // number of times player has been asked for help by wingmen
1247  Player->allow_ask_help_timestamp = 1; // timestamp until next ask_help is allowed
1248 
1249  Player->scream_count = 0; // number of times player has heard wingman screams this mission
1250  Player->allow_scream_timestamp = 1; // timestamp until next wingman scream is allowed
1251 
1252  Player->low_ammo_complaint_count = 0; // number of complaints about low ammo received in this mission
1253  Player->allow_ammo_timestamp = 1; // timestamp until next 'Ammo low' message can be played
1254 
1255  Player->praise_self_count = 0; // number of boasts about kills received in this mission
1256  Player->praise_self_timestamp = 1; // timestamp marking time until next boast is allowed
1257 
1258  Player->request_repair_timestamp = 1; // timestamp until next 'requesting repair sir' message can be played
1259 
1260  Player->repair_sound_loop = -1;
1261  Player->cargo_scan_loop = -1;
1262  Player->cargo_inspect_time = 0; // time that current target's cargo has been inspected for
1263 
1264  Player->target_is_dying = -1; // The player target is dying, set to -1 if no target
1265  Player->current_target_sx = -1; // Screen x-pos of current target (or subsystem if applicable)
1266  Player->current_target_sy = -1; // Screen y-pos of current target (or subsystem if applicable)
1267  Player->target_in_lock_cone = -1; // Is the current target in secondary weapon lock cone?
1268  Player->locking_subsys=NULL; // Subsystem pointer that missile lock is trying to seek
1269  Player->locking_on_center=0; // boolean, whether missile lock is trying for center of ship or not
1270  Player->locking_subsys_parent=-1;
1271 
1272  Player->killer_objtype=-1; // type of object that killed player
1273  Player->killer_weapon_index = -1; // weapon used to kill player (if applicable)
1274  Player->killer_parent_name[0]=0; // name of parent object that killed the player
1275 
1276  Player_all_alone_msg_inited=0;
1278 
1279  Player->death_message = "";
1280 }
1281 
1287 {
1288  Player_num = 0;
1289  Player = &Players[Player_num];
1291  Player->failures_this_session = 0;
1292  Player->show_skip_popup = (ubyte) 1;
1293 }
1294 
1299 {
1300  Assert(Player);
1301  if ( Player->repair_sound_loop > -1 ) {
1302  snd_stop(Player->repair_sound_loop);
1303  Player->repair_sound_loop = -1;
1304  }
1305  if ( Player->cargo_scan_loop > -1 ) {
1306  snd_stop(Player->cargo_scan_loop);
1307  Player->cargo_scan_loop = -1;
1308  }
1309 }
1310 
1316 {
1317  Assert(Player);
1318  if ( Player->repair_sound_loop == -1 ) {
1320  }
1321 }
1322 
1327 {
1328  Assert(Player);
1329  if ( Player->repair_sound_loop != -1 ) {
1330  snd_stop(Player->repair_sound_loop);
1331  Player->repair_sound_loop = -1;
1332  }
1333 }
1334 
1339 {
1340  Assert(Player);
1341  if ( Player->cargo_scan_loop == -1 ) {
1343  }
1344 }
1345 
1350 {
1351  Assert(Player);
1352  if ( Player->cargo_scan_loop != -1 ) {
1353  snd_stop(Player->cargo_scan_loop);
1354  Player->cargo_scan_loop = -1;
1355  }
1356 }
1357 
1365 {
1366  // in multiplayer, never praise
1367  if(Game_mode & GM_MULTIPLAYER){
1368  return 0;
1369  }
1370 
1371  if ( timestamp_elapsed(Player->praise_delay_timestamp) ) {
1372  int ship_index;
1373 
1374  Player->praise_delay_timestamp = 0;
1376  if ( ship_index >= 0 ) {
1377  // Only praise if above 50% integrity
1378  if ( get_hull_pct(&Objects[Ships[ship_index].objnum]) > 0.5f ) {
1379  if (Player->stats.m_kill_count_ok > 10) { // this number should probably be in the AI profile or mission file rather than hardcoded
1381  }
1382  else {
1384  }
1386  Player->allow_scream_timestamp = timestamp(20000); // prevent death scream following praise
1387  Player->praise_count++;
1388  return 1;
1389  }
1390  }
1391  }
1392 
1393  if ( Player->praise_delay_timestamp == 0 ) {
1394  return 0;
1395  }
1396 
1397  return 1;
1398 }
1399 
1400 int player_inspect_cap_subsys_cargo(float frametime, char *outstr);
1401 
1410 int player_inspect_cargo(float frametime, char *outstr)
1411 {
1412  object *cargo_objp;
1413  ship *cargo_sp;
1414  ship_info *cargo_sip;
1415  vec3d vec_to_cargo;
1416  float dot;
1417  int scan_subsys;
1418 
1419  outstr[0] = 0;
1420 
1421  if ( Player_ai->target_objnum < 0 ) {
1422  return 0;
1423  }
1424 
1425  cargo_objp = &Objects[Player_ai->target_objnum];
1426  Assert(cargo_objp->type == OBJ_SHIP);
1427  cargo_sp = &Ships[cargo_objp->instance];
1428  cargo_sip = &Ship_info[cargo_sp->ship_info_index];
1429 
1430  // Goober5000 - possibly swap cargo scan behavior
1431  scan_subsys = (cargo_sip->flags & SIF_HUGE_SHIP);
1432  if (cargo_sp->flags2 & SF2_TOGGLE_SUBSYSTEM_SCANNING)
1433  scan_subsys = !scan_subsys;
1434  if (scan_subsys)
1435  return player_inspect_cap_subsys_cargo(frametime, outstr);
1436 
1437  // check if target is ship class that can be inspected
1438  // MWA -- 1/27/98 -- added fighters/bombers to this list. For multiplayer, we
1439  // want to show callsign of player
1440  // G5K -- 10/20/08 -- moved the callsign code into hud_stuff_ship_callsign, where
1441  // it makes more sense
1442 
1443  // scannable cargo behaves differently. Scannable cargo is either "scanned" or "not scanned". This flag
1444  // can be set on any ship. Any ship with this set won't have "normal" cargo behavior
1445  if ( !(cargo_sp->flags & SF_SCANNABLE) ) {
1446  if ( !(cargo_sip->flags & (SIF_CARGO|SIF_TRANSPORT)) ) {
1447  return 0;
1448  }
1449  }
1450 
1451  // if cargo is already revealed
1452  if ( cargo_sp->flags & SF_CARGO_REVEALED ) {
1453  if ( !(cargo_sp->flags & SF_SCANNABLE) ) {
1454  char *cargo_name = Cargo_names[cargo_sp->cargo1 & CARGO_INDEX_MASK];
1455  Assert( cargo_sip->flags & (SIF_CARGO|SIF_TRANSPORT) );
1456 
1457  if ( cargo_name[0] == '#' ) {
1458  sprintf(outstr, XSTR("passengers: %s", 83), cargo_name+1 );
1459  } else {
1460  sprintf(outstr,XSTR("cargo: %s", 84), cargo_name );
1461  }
1462  } else {
1463  strcpy(outstr, XSTR( "Scanned", 85) );
1464  }
1465 
1466  // always bash cargo_inspect_time to 0 since AI ships can reveal cargo that we
1467  // are in the process of scanning
1468  Player->cargo_inspect_time = 0;
1469 
1470  return 1;
1471  }
1472 
1473  // see if player is within inspection range
1475 
1476  // check if player is facing cargo, do not proceed with inspection if not
1477  vm_vec_normalized_dir(&vec_to_cargo, &cargo_objp->pos, &Player_obj->pos);
1478  dot = vm_vec_dot(&vec_to_cargo, &Player_obj->orient.vec.fvec);
1479  if ( dot < CARGO_MIN_DOT_TO_REVEAL ) {
1480  if ( !(cargo_sp->flags & SF_SCANNABLE) )
1481  strcpy(outstr,XSTR( "cargo: <unknown>", 86));
1482  else
1483  strcpy(outstr,XSTR( "not scanned", 87));
1485  Player->cargo_inspect_time = 0;
1486  return 1;
1487  }
1488 
1489  // player is facing the cargo, and withing range, so proceed with inspection
1490  if ( hud_sensors_ok(Player_ship, 0) ) {
1491  Player->cargo_inspect_time += fl2i(frametime*1000+0.5f);
1492  }
1493 
1494  if ( !(cargo_sp->flags & SF_SCANNABLE) )
1495  strcpy(outstr,XSTR( "cargo: inspecting", 88));
1496  else
1497  strcpy(outstr,XSTR( "scanning", 89));
1498 
1499  if ( Player->cargo_inspect_time > cargo_sip->scan_time ) {
1500  ship_do_cargo_revealed( cargo_sp );
1501  snd_play( &Snds[SND_CARGO_REVEAL], 0.0f );
1502  Player->cargo_inspect_time = 0;
1503  }
1504  } else {
1505  if ( !(cargo_sp->flags & SF_SCANNABLE) )
1506  strcpy(outstr,XSTR( "cargo: <unknown>", 86));
1507  else
1508  strcpy(outstr,XSTR( "not scanned", 87));
1509  }
1510 
1511  return 1;
1512 }
1513 
1517 int player_inspect_cap_subsys_cargo(float frametime, char *outstr)
1518 {
1519  object *cargo_objp;
1520  ship *cargo_sp;
1521  ship_info *cargo_sip;
1522  vec3d vec_to_cargo;
1523  float dot;
1524  ship_subsys *subsys;
1525 
1526  outstr[0] = 0;
1527  subsys = Player_ai->targeted_subsys;
1528 
1529  if ( subsys == NULL ) {
1530  return 0;
1531  }
1532 
1533  cargo_objp = &Objects[Player_ai->target_objnum];
1534  Assert(cargo_objp->type == OBJ_SHIP);
1535  cargo_sp = &Ships[cargo_objp->instance];
1536  cargo_sip = &Ship_info[cargo_sp->ship_info_index];
1537 
1538  // don't do any sort of scanning thing unless capship has a non-"nothing" cargo
1539  // this compensates for changing the "no display" index from -1 to 0
1540  if (subsys->subsys_cargo_name == 0) {
1541  return 0;
1542  }
1543 
1544  // don't scan cargo on turrets, radar, etc. only the majors: fighterbay, sensor, engines, weapons, nav, comm
1546  return 0;
1547  }
1548 
1549  // if cargo is already revealed
1550  if (subsys->flags & SSF_CARGO_REVEALED) {
1551  if ( !(cargo_sp->flags & SF_SCANNABLE) ) {
1552  char *cargo_name = Cargo_names[subsys->subsys_cargo_name & CARGO_INDEX_MASK];
1553 
1554  if ( cargo_name[0] == '#' ) {
1555  sprintf(outstr, XSTR("passengers: %s", 83), cargo_name+1 );
1556  } else {
1557  sprintf(outstr,XSTR("cargo: %s", 84), cargo_name );
1558  }
1559  } else {
1560  strcpy(outstr, XSTR( "Scanned", 85) );
1561  }
1562 
1563  // always bash cargo_inspect_time to 0 since AI ships can reveal cargo that we
1564  // are in the process of scanning
1565  Player->cargo_inspect_time = 0;
1566 
1567  return 1;
1568  }
1569 
1570  // see if player is within inspection range [ok for subsys]
1571  vec3d subsys_pos;
1572  float subsys_rad;
1573  int subsys_in_view, x, y;
1574  float scan_dist;
1575 
1576  get_subsystem_world_pos(cargo_objp, Player_ai->targeted_subsys, &subsys_pos);
1577  subsys_rad = subsys->system_info->radius;
1578 
1579  // Goober5000
1580  if (cargo_sip->flags & SIF_HUGE_SHIP) {
1581  scan_dist = MAX(CAP_CARGO_REVEAL_MIN_DIST, (subsys_rad + CAPITAL_CARGO_RADIUS_DELTA));
1582  } else {
1583  scan_dist = MAX(CARGO_REVEAL_MIN_DIST, (subsys_rad + CARGO_RADIUS_DELTA));
1584  }
1585 
1586  if ( Player_ai->current_target_distance < scan_dist ) {
1587 
1588  // check if player is facing cargo, do not proceed with inspection if not
1589  vm_vec_normalized_dir(&vec_to_cargo, &subsys_pos, &Player_obj->pos);
1590  dot = vm_vec_dot(&vec_to_cargo, &Player_obj->orient.vec.fvec);
1591  int hud_targetbox_subsystem_in_view(object *target_objp, int *sx, int *sy);
1592  subsys_in_view = hud_targetbox_subsystem_in_view(cargo_objp, &x, &y);
1593 
1594  if ( (dot < CARGO_MIN_DOT_TO_REVEAL) || (!subsys_in_view) ) {
1595  if ( !(cargo_sp->flags & SF_SCANNABLE) )
1596  strcpy(outstr,XSTR( "cargo: <unknown>", 86));
1597  else
1598  strcpy(outstr,XSTR( "not scanned", 87));
1600  Player->cargo_inspect_time = 0;
1601  return 1;
1602  }
1603 
1604  // player is facing the cargo, and within range, so proceed with inspection
1605  if ( hud_sensors_ok(Player_ship, 0) ) {
1606  Player->cargo_inspect_time += fl2i(frametime*1000+0.5f);
1607  }
1608 
1609  if ( !(cargo_sp->flags & SF_SCANNABLE) )
1610  strcpy(outstr,XSTR( "cargo: inspecting", 88));
1611  else
1612  strcpy(outstr,XSTR( "scanning", 89));
1613 
1614  if ( Player->cargo_inspect_time > cargo_sip->scan_time ) {
1615  ship_do_cap_subsys_cargo_revealed( cargo_sp, subsys, 0);
1616  snd_play( &Snds[SND_CARGO_REVEAL], 0.0f );
1617  Player->cargo_inspect_time = 0;
1618  }
1619  } else {
1620  if ( !(cargo_sp->flags & SF_SCANNABLE) )
1621  strcpy(outstr,XSTR( "cargo: <unknown>", 86));
1622  else
1623  strcpy(outstr,XSTR( "not scanned", 87));
1624  }
1625 
1626  return 1;
1627 }
1628 
1629 
1635 {
1636  float prange,srange;
1637 
1638  hud_get_best_primary_bank(&prange);
1640 
1641  return MAX(prange,srange);
1642 }
1643 
1651 void player_generate_killer_weapon_name(int weapon_info_index, int killer_species, char *weapon_name)
1652 {
1653  if ( weapon_info_index < 0 ) {
1654  return;
1655  }
1656 
1657 #ifndef NDEBUG
1658  if ( Show_killer_weapon || (killer_species == Ship_info[Player_ship->ship_info_index].species) ) {
1659 #else
1660  if (killer_species == Ship_info[Player_ship->ship_info_index].species) {
1661 #endif
1662  strcpy(weapon_name, Weapon_info[weapon_info_index].name);
1663  } else {
1664  if ( Weapon_info[weapon_info_index].subtype == WP_MISSILE ) {
1665  strcpy(weapon_name, XSTR( "missile", 90));
1666  } else {
1667  strcpy(weapon_name, XSTR( "laser fire", 91));
1668  }
1669  }
1670 }
1671 
1676 {
1677  char weapon_name[NAME_LENGTH];
1678  weapon_name[0] = 0;
1679  SCP_string &msg = player_p->death_message;
1680  int ship_index;
1681 
1682  player_generate_killer_weapon_name(player_p->killer_weapon_index, player_p->killer_species, weapon_name);
1683 
1684  switch (player_p->killer_objtype)
1685  {
1686  case OBJ_SHOCKWAVE:
1687  if (weapon_name[0])
1688  {
1689  sprintf(msg, XSTR( "%s was killed by a missile shockwave", 92), player_p->callsign);
1690  }
1691  else
1692  {
1693  sprintf(msg, XSTR( "%s was killed by a shockwave from %s exploding", 93), player_p->callsign, player_p->killer_parent_name);
1694  }
1695  break;
1696 
1697  case OBJ_WEAPON:
1698  Assert(weapon_name[0]);
1699 
1700  // is this from a friendly ship?
1701  ship_index = ship_name_lookup(player_p->killer_parent_name, 1);
1702  if ((ship_index >= 0) && (Player_ship != NULL) && (Player_ship->team == Ships[ship_index].team))
1703  {
1704  sprintf(msg, XSTR( "%s was killed by friendly fire from %s", 1338), player_p->callsign, player_p->killer_parent_name);
1705  }
1706  else
1707  {
1708  sprintf(msg, XSTR( "%s was killed by %s", 94), player_p->callsign, player_p->killer_parent_name);
1709  }
1710  break;
1711 
1712  case OBJ_SHIP:
1713  if (player_p->flags & PLAYER_FLAGS_KILLED_BY_EXPLOSION)
1714  {
1715  sprintf(msg, XSTR( "%s was killed by a blast from %s exploding", 95), player_p->callsign, player_p->killer_parent_name);
1716  }
1717  else if (player_p->flags & PLAYER_FLAGS_KILLED_BY_ENGINE_WASH)
1718  {
1719  sprintf(msg, XSTR( "%s was killed by engine wash from %s", 1494), player_p->callsign, player_p->killer_parent_name);
1720  }
1721  else
1722  {
1723  sprintf(msg, XSTR( "%s was killed by a collision with %s", 96), player_p->callsign, player_p->killer_parent_name);
1724  }
1725  break;
1726 
1727  case OBJ_DEBRIS:
1728  sprintf(msg, XSTR( "%s was killed by a collision with debris", 97), player_p->callsign);
1729  break;
1730 
1731  case OBJ_ASTEROID:
1732  sprintf(msg, XSTR( "%s was killed by a collision with an asteroid", 98), player_p->callsign);
1733  break;
1734 
1735  case OBJ_BEAM:
1736  if (strlen(player_p->killer_parent_name) <= 0)
1737  {
1738  Warning(LOCATION, "Killer_parent_name not specified for beam!");
1739  sprintf(msg, XSTR( "%s was killed by a beam from an unknown source", 1081), player_p->callsign);
1740  }
1741  else
1742  {
1743  // is this from a friendly ship?
1744  ship_index = ship_name_lookup(player_p->killer_parent_name, 1);
1745  if ((ship_index >= 0) && (Player_ship != NULL) && (Player_ship->team == Ships[ship_index].team))
1746  {
1747  sprintf(msg, XSTR( "%s was destroyed by friendly beam fire from %s", 1339), player_p->callsign, player_p->killer_parent_name);
1748  }
1749  else
1750  {
1751  sprintf(msg, XSTR( "%s was destroyed by a beam from %s", 1082), player_p->callsign, player_p->killer_parent_name);
1752  }
1753  }
1754  break;
1755 
1756  default:
1757  sprintf(msg, XSTR( "%s was killed by unknown causes", 99), player_p->callsign);
1758  break;
1759  }
1760 }
1761 
1766 {
1767  SCP_string &msg = Player->death_message;
1768 
1769  // make sure we don't already have a death message
1770  if (msg.empty())
1771  {
1772  // check if player killed self
1773  if (Player->flags & PLAYER_KILLED_SELF)
1774  {
1775  // reasons he killed himself
1777  {
1778  msg = XSTR("You have killed yourself with a shockwave from your own weapon", 1421);
1779  }
1780  else if (Player->flags & PLAYER_FLAGS_KILLED_SELF_MISSILES)
1781  {
1782  msg = XSTR("You have killed yourself with your own missiles", 1422);
1783  }
1784  else
1785  {
1786  msg = XSTR("You have killed yourself", 100);
1787  }
1788 
1789  Player->flags &= ~PLAYER_KILLED_SELF;
1790  }
1791  else
1792  {
1794  }
1795  }
1796  color col;
1797  gr_init_color(&col, 255, 0, 0);
1798  // display the message
1799  HUD_fixed_printf(30.0f, col, msg.c_str());
1800 }
1801 
1803 {
1804  Player->check_for_all_alone_msg=timestamp(30000);
1805 }
1806 
1811 {
1812  if ( Game_mode & GM_MULTIPLAYER ){
1813  return;
1814  }
1815 
1816  if ( !Player_all_alone_msg_inited ) {
1818  Player_all_alone_msg_inited=1;
1819  return;
1820  }
1821 
1822  if ( Player->flags & PLAYER_FLAGS_NO_CHECK_ALL_ALONE_MSG ) {
1823  return;
1824  }
1825 
1826  // only check every N seconds
1827  if ( !timestamp_elapsed(Player->check_for_all_alone_msg) ) {
1828  return;
1829  }
1830 
1832 
1833  // at least one primary objective must be not complete (but not failed)
1836  return;
1837  }
1838 
1839  // there must be no reinforcements available, hold off on message
1841  return;
1842  }
1843 
1844  // there must be no ships present that are on the same team as the player
1845  ship_obj *so;
1846  object *objp;
1847 
1848  for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
1849  objp = &Objects[so->objnum];
1850 
1851  if ( objp == Player_obj ) {
1852  continue;
1853  }
1854 
1855  if ( Ships[objp->instance].team == Player_ship->team ) {
1856  int ship_type = Ship_info[Ships[objp->instance].ship_info_index].class_type;
1857  if ( ship_type != -1 && (Ship_types[ship_type].message_bools & STI_MSG_COUNTS_FOR_ALONE) ) {
1858  return;
1859  }
1860  }
1861  }
1862 
1863  // met all the requirements, now only play 50% of the time :)
1864  if ( rand()&1 ) {
1866  }
1868 }
1869 
1870 
1872 {
1873  if ( check_control(PADLOCK_UP) ) {
1874  chase_slew_angles.h = 0.0f;
1875  chase_slew_angles.p = -PI_2;
1877  return;
1878  }
1879  if ( check_control(PADLOCK_DOWN) ) {
1880  chase_slew_angles.h = -PI;
1881  chase_slew_angles.p = 0.0f;
1883  return;
1884  }
1885 
1886  if ( check_control(PADLOCK_RIGHT) ) {
1887  chase_slew_angles.h = PI_2;
1888  chase_slew_angles.p = 0.0f;
1890  return;
1891  }
1892 
1893  if ( check_control(PADLOCK_LEFT) ) {
1894  chase_slew_angles.h = -PI_2;
1895  chase_slew_angles.p = 0.0f;
1897  return;
1898  }
1899 
1900  if ( Viewer_mode & VM_PADLOCK_ANY ) {
1901  // clear padlock views and center the view once
1902  // the player lets go of an orthogonal padlock command
1904  chase_slew_angles.h = 0.0f;
1905  chase_slew_angles.p = 0.0f;
1906  }
1907 }
1908 
1910 {
1912 
1913  matrix old_eye_orient;
1914  old_eye_orient = *eye_orient;
1915 
1916  if ( Viewer_mode & VM_PADLOCK_UP ) {
1917  eye_orient->vec.fvec = old_eye_orient.vec.uvec;
1918  vm_vec_copy_scale( &eye_orient->vec.uvec, &old_eye_orient.vec.fvec, -1.0f );
1919  } else if ( Viewer_mode & VM_PADLOCK_REAR ) {
1920  vm_vec_negate(&eye_orient->vec.fvec);
1921  vm_vec_negate(&eye_orient->vec.rvec);
1922  } else if ( Viewer_mode & VM_PADLOCK_LEFT ) {
1923  vm_vec_copy_scale( &eye_orient->vec.fvec, &old_eye_orient.vec.rvec, -1.0f );
1924  eye_orient->vec.rvec = old_eye_orient.vec.fvec;
1925  } else if ( Viewer_mode & VM_PADLOCK_RIGHT ) {
1926  eye_orient->vec.fvec = old_eye_orient.vec.rvec;
1927  vm_vec_copy_scale( &eye_orient->vec.rvec, &old_eye_orient.vec.fvec, -1.0f );
1928  } else {
1929  Int3();
1930  }
1931 }
1932 
1934 {
1935  int padlock_view_index=0;
1936 
1937  if ( Viewer_mode & VM_PADLOCK_UP ) {
1938  padlock_view_index = 0;
1939  } else if ( Viewer_mode & VM_PADLOCK_REAR ) {
1940  padlock_view_index = 1;
1941  } else if ( Viewer_mode & VM_PADLOCK_LEFT ) {
1942  padlock_view_index = 2;
1943  } else if ( Viewer_mode & VM_PADLOCK_RIGHT ) {
1944  padlock_view_index = 3;
1945  } else {
1946  Int3();
1947  return;
1948  }
1949 
1950  char str[128];
1951 
1952  if ( !(Viewer_mode & (VM_CHASE|VM_EXTERNAL)) ) {
1953  switch (padlock_view_index) {
1954  case 0:
1955  strcpy_s(str, XSTR( "top view", 101)); break;
1956  case 1:
1957  strcpy_s(str, XSTR( "rear view", 102)); break;
1958  case 2:
1959  strcpy_s(str, XSTR( "left view", 103)); break;
1960  case 3:
1961  strcpy_s(str, XSTR( "right view", 104)); break;
1962  }
1963  color col;
1964  gr_init_color(&col, 0, 255, 0);
1965  HUD_fixed_printf(0.01f, col, str);
1966  }
1967 }
1968 
1969 extern vec3d Dead_camera_pos;
1971 
1972 #define MIN_DIST_TO_DEAD_CAMERA 50.0f
1973 
1977 {
1978  static camid player_camera;
1979  if(!player_camera.isValid())
1980  {
1981  player_camera = cam_create("Player camera");
1982  }
1983 
1984  object *viewer_obj = NULL;
1987  vec3d tmp_dir;
1988 
1989  // if the player object is NULL, return
1990  if(Player_obj == NULL){
1991  return camid();
1992  }
1993 
1994  // standalone servers can bail here
1996  return camid();
1997  }
1998 
1999  // if we're not in-mission, don't do this
2000  if(!(Game_mode & GM_IN_MISSION)){
2001  return camid();
2002  }
2003 
2004  if (Game_mode & GM_DEAD) {
2005  vec3d vec_to_deader, view_pos;
2006  float dist;
2007  if (Player_ai->target_objnum != -1) {
2008  int view_from_player = 1;
2009 
2010  if (Viewer_mode & VM_OTHER_SHIP) {
2011  // View from target.
2012  viewer_obj = &Objects[Player_ai->target_objnum];
2013  if ( viewer_obj->type == OBJ_SHIP ) {
2014  ship_get_eye( &eye_pos, &eye_orient, viewer_obj );
2015  view_from_player = 0;
2016  }
2017  }
2018 
2019  if ( view_from_player ) {
2020  // View target from player ship.
2021  viewer_obj = NULL;
2022  eye_pos = Player_obj->pos;
2023 
2024  vm_vec_normalized_dir(&tmp_dir, &Objects[Player_ai->target_objnum].pos, &eye_pos);
2025  vm_vector_2_matrix(&eye_orient, &tmp_dir, NULL, NULL);
2026  }
2027  } else {
2028  dist = vm_vec_normalized_dir(&vec_to_deader, &Player_obj->pos, &Dead_camera_pos);
2029 
2030  if (dist < MIN_DIST_TO_DEAD_CAMERA){
2031  dist += flFrametime * 16.0f;
2032  }
2033 
2034  vm_vec_scale(&vec_to_deader, -dist);
2035  vm_vec_add(&Dead_camera_pos, &Player_obj->pos, &vec_to_deader);
2036 
2037  view_pos = Player_obj->pos;
2038 
2039  if (!(Game_mode & GM_DEAD_BLEW_UP)) {
2040  } else if (Player_ai->target_objnum != -1) {
2041  view_pos = Objects[Player_ai->target_objnum].pos;
2042  } else {
2043  // Make camera follow explosion, but gradually slow down.
2044  vm_vec_scale_add2(&Player_obj->pos, &Dead_player_last_vel, flFrametime);
2045  view_pos = Player_obj->pos;
2046  }
2047 
2048  eye_pos = Dead_camera_pos;
2049 
2050  vm_vec_normalized_dir(&tmp_dir, &Player_obj->pos, &eye_pos);
2051 
2052  vm_vector_2_matrix(&eye_orient, &tmp_dir, NULL, NULL);
2053  viewer_obj = NULL;
2054  }
2055  }
2056 
2057  // If already blown up, these other modes can override.
2058  if (!(Game_mode & (GM_DEAD | GM_DEAD_BLEW_UP))) {
2059  if(!(Viewer_mode & VM_FREECAMERA))
2060  viewer_obj = Player_obj;
2061 
2062  if (Viewer_mode & VM_OTHER_SHIP) {
2063  if (Player_ai->target_objnum != -1){
2064  viewer_obj = &Objects[Player_ai->target_objnum];
2065  }
2066  }
2067  if(Viewer_mode & VM_FREECAMERA) {
2068  Viewer_obj = NULL;
2069  return cam_get_current();
2070  } else if (Viewer_mode & VM_EXTERNAL) {
2071  Assert(viewer_obj != NULL);
2072  matrix tm, tm2;
2073 
2075  vm_matrix_x_matrix(&tm, &viewer_obj->orient, &tm2);
2076 
2077  vm_vec_scale_add(&eye_pos, &viewer_obj->pos, &tm.vec.fvec, 2.0f * viewer_obj->radius + Viewer_external_info.distance);
2078 
2079  vm_vec_sub(&tmp_dir, &viewer_obj->pos, &eye_pos);
2080  vm_vec_normalize(&tmp_dir);
2081  vm_vector_2_matrix(&eye_orient, &tmp_dir, &viewer_obj->orient.vec.uvec, NULL);
2082  viewer_obj = NULL;
2083 
2084  // Modify the orientation based on head orientation.
2085  compute_slew_matrix(&eye_orient, &Viewer_slew_angles);
2086  } else if ( Viewer_mode & VM_CHASE ) {
2087  vec3d move_dir;
2088 
2089  if ( viewer_obj->phys_info.speed < 0.1 ){
2090  move_dir = viewer_obj->orient.vec.fvec;
2091  } else {
2092  move_dir = viewer_obj->phys_info.vel;
2093  vm_vec_normalize_safe(&move_dir);
2094  }
2095 
2096  vm_vec_scale_add(&eye_pos, &viewer_obj->pos, &move_dir, -3.0f * viewer_obj->radius - Viewer_chase_info.distance);
2097  vm_vec_scale_add2(&eye_pos, &viewer_obj->orient.vec.uvec, 0.75f * viewer_obj->radius);
2098  vm_vec_sub(&tmp_dir, &viewer_obj->pos, &eye_pos);
2099  vm_vec_normalize(&tmp_dir);
2100 
2101  // JAS: I added the following code because if you slew up using
2102  // Descent-style physics, eye_dir and Viewer_obj->orient.vec.uvec are
2103  // equal, which causes a zero-length vector in the vm_vector_2_matrix
2104  // call because the up and the forward vector are the same. I fixed
2105  // it by adding in a fraction of the right vector all the time to the
2106  // up vector.
2107  vec3d tmp_up = viewer_obj->orient.vec.uvec;
2108  vm_vec_scale_add2( &tmp_up, &viewer_obj->orient.vec.rvec, 0.00001f );
2109 
2110  vm_vector_2_matrix(&eye_orient, &tmp_dir, &tmp_up, NULL);
2111  viewer_obj = NULL;
2112 
2113  // Modify the orientation based on head orientation.
2114  compute_slew_matrix(&eye_orient, &Viewer_slew_angles);
2115  } else if ( Viewer_mode & VM_WARP_CHASE ) {
2116  Warp_camera.get_info(&eye_pos, NULL);
2117 
2119 
2120 
2121  vec3d warp_pos = Player_obj->pos;
2122  shipp->warpout_effect->getWarpPosition(&warp_pos);
2123  vm_vec_sub(&tmp_dir, &warp_pos, &eye_pos);
2124  vm_vec_normalize(&tmp_dir);
2125  vm_vector_2_matrix(&eye_orient, &tmp_dir, &Player_obj->orient.vec.uvec, NULL);
2126  viewer_obj = NULL;
2127  } else {
2128  // get an eye position based upon the correct type of object
2129  switch(viewer_obj->type)
2130  {
2131  case OBJ_SHIP:
2132  // make a call to get the eye point for the player object
2133  ship_get_eye( &eye_pos, &eye_orient, viewer_obj );
2134  break;
2135  case OBJ_OBSERVER:
2136  // make a call to get the eye point for the player object
2137  observer_get_eye( &eye_pos, &eye_orient, viewer_obj );
2138  break;
2139  default :
2140  Int3();
2141  }
2142  }
2143  }
2144 
2145  player_camera.getCamera()->set_position(&eye_pos);
2146  player_camera.getCamera()->set_rotation(&eye_orient);
2147 
2148  return player_camera;
2149 }
#define SF2_TOGGLE_SUBSYSTEM_SCANNING
Definition: ship.h:490
int fire_countermeasure_count
Definition: physics.h:112
int use_descent
int ask_help_count
Definition: player.h:156
float max_rear_vel
Definition: physics.h:53
PITCH_FORWARD.
void observer_get_eye(vec3d *eye_pos, matrix *eye_orient, object *obj)
Definition: observer.cpp:99
#define SHIP_GET_UNSILENCED
Definition: ship.h:1789
int timestamp(int delta_ms)
Definition: timer.cpp:226
#define PLAYER_FLAGS_MATCH_TARGET
Definition: player.h:36
#define MULTIPLAYER_CLIENT
Definition: multi.h:132
vci Viewer_chase_info
Definition: systemvars.cpp:56
int i
Definition: multi_pxo.cpp:466
int player_process_pending_praise()
See if there is a praise message to deliver to the player. We want to delay the praise messages a bit...
void do_view_chase(float frame_time)
camid cam_create(char *n_name, vec3d *n_pos, vec3d *n_norm, object *n_object, int n_object_host_submodel)
Definition: camera.cpp:888
float p
Definition: pstypes.h:111
TOGGLE_GLIDING.
model_subsystem * system_info
Definition: ship.h:314
void hud_gauge_popup_start(int gauge_index, int time)
Start a gauge to pop-up.
Definition: hud.cpp:3036
#define SF_DEPART_WARP
Definition: ship.h:449
#define MIN(a, b)
Definition: pstypes.h:296
int Player_num
void control_get_axes_readings(int *h, int *p, int *b, int *ta, int *tr)
ai_info * Player_ai
Definition: ai.cpp:24
int team
Definition: ship.h:606
void player_get_padlock_orient(matrix *eye_orient)
void player_restore_target_and_weapon_link_prefs()
int afterburner_start
Definition: physics.h:116
bool object_glide_forced(object *objp)
Definition: object.cpp:2066
control_info ci
Definition: player.h:126
#define TBOX_FLASH_CARGO
Definition: hudtargetbox.h:27
matrix * vm_matrix_x_matrix(matrix *dest, const matrix *src0, const matrix *src1)
Definition: vecmat.cpp:1006
int flags
Definition: player.h:104
#define PCM_WARPOUT_STAGE1
Definition: player.h:59
float player_farthest_weapon_range()
int num_primary_banks
Definition: ship.h:99
set zero throttle
Definition: gamesnd.h:82
float dock_calc_docked_fspeed(object *objp)
Definition: objectdock.cpp:261
int Game_mode
Definition: systemvars.cpp:24
#define F1_0
Definition: fix.h:15
void vm_vec_scale_add(vec3d *dest, const vec3d *src1, const vec3d *src2, float k)
Definition: vecmat.cpp:266
int game_type
Definition: missionparse.h:138
int Mouse_sensitivity
Definition: mouse.cpp:50
void view_modify(angles *ma, angles *da, float max_p, float max_h, float frame_time)
VIEW_CENTER.
int n_missiles
Definition: model.h:769
polymodel * model_get(int model_num)
Definition: modelread.cpp:3134
camid player_get_cam()
#define PLAYER_FLAGS_KILLED_SELF_MISSILES
Definition: player.h:53
weapon_info Weapon_info[MAX_WEAPON_TYPES]
Definition: weapons.cpp:79
int toggle_glide
ship_weapon weapons
Definition: ship.h:658
int killer_species
Definition: player.h:181
net_player * Net_player
Definition: multi.cpp:94
SCP_vector< game_snd > Snds
Definition: gamesnd.cpp:19
int scream_count
Definition: player.h:159
#define CARGO_INDEX_MASK
Definition: missionparse.h:220
ZERO_THROTTLE.
float GetZ()
float flFrametime
Definition: fredstubs.cpp:22
#define MIN_DIST_TO_DEAD_CAMERA
#define MESSAGE_ALL_ALONE
void player_display_padlock_view()
int Warpout_forced
Definition: fredstubs.cpp:176
VIEW_DIST_DECREASE.
int hud_get_best_primary_bank(float *range)
Definition: hudtarget.cpp:3719
float ship_get_warpout_speed(object *objp)
Definition: ship.cpp:17306
void read_player_controls(object *objp, float frametime)
#define VM_WARP_CHASE
Definition: systemvars.h:37
physics_info phys_info
Definition: object.h:157
matrix * vm_angles_2_matrix(matrix *m, const angles *a)
Definition: vecmat.cpp:752
vec3d Dead_player_last_vel
Definition: fredstubs.cpp:178
#define CAPITAL_CARGO_RADIUS_DELTA
Definition: hudtarget.h:28
int check_for_all_alone_msg
Definition: player.h:185
#define STI_MSG_COUNTS_FOR_ALONE
Definition: ship.h:988
int allow_warn_timestamp
Definition: player.h:143
int fire_secondary_count
Definition: physics.h:111
void object_set_gliding(object *objp, bool enable, bool force)
Definition: object.cpp:2036
int model_num
Definition: ship.h:1189
int cargo_inspect_time
Definition: player.h:171
RIGHT_SLIDE_THRUST.
#define PCM_NORMAL
Definition: player.h:58
#define MINIMUM_PLAYER_WARPOUT_TIME
Definition: player.h:281
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
#define PF_GLIDING
Definition: physics.h:32
Assert(pm!=NULL)
int target_objnum
Definition: ai.h:339
int fire_primary_count
Definition: physics.h:110
Definition: pstypes.h:88
#define NETINFO_FLAG_OBSERVER
Definition: multi.h:605
void set_position(vec3d *in_position=NULL, float in_translation_time=0.0f, float in_translation_acceleration_time=0.0f, float in_translation_deceleration_time=0.0f, float in_end_velocity=0.0f)
Definition: camera.cpp:162
#define PLAYER_FLAGS_LINK_PRIMARY
Definition: player.h:45
#define OBJ_ASTEROID
Definition: object.h:44
YAW_RIGHT.
#define VM_EXTERNAL
Definition: systemvars.h:31
Definition: 2d.h:95
vec3d leaning_position
Definition: systemvars.cpp:57
matrix Eye_matrix
Definition: 3dsetup.cpp:26
#define PLAYER_FLAGS_KILLED_BY_ENGINE_WASH
Definition: player.h:51
#define SIF_CARGO
Definition: ship.h:884
#define VM_TRACK
Definition: systemvars.h:32
struct vec3d::@225::@227 xyz
void hud_targetbox_end_flash(int index)
YAW_LEFT.
int distance_warning_count
Definition: player.h:140
vec3d max_vel
Definition: physics.h:49
GLclampf f
Definition: Glext.h:7097
BANK_RIGHT.
int button_info_query(button_info *bi, int n)
void ship_do_cargo_revealed(ship *shipp, int from_network)
Definition: ship.cpp:16138
#define PRIMARY_GOAL
Definition: missiongoals.h:28
void player_match_target_speed(char *no_target_text, char *match_off_text, char *match_on_text)
vec3d * vm_vec_rotate(vec3d *dest, const vec3d *src, const matrix *m)
Definition: vecmat.cpp:933
float factor
Definition: lua.cpp:440
object obj_used_list
Definition: object.cpp:53
#define f2fl(fx)
Definition: floating.h:37
void player_stop_repair_sound()
#define MESSAGE_HIGH_PRAISE
enum_h * u
Definition: lua.cpp:12649
PADLOCK_UP.
fix t2
Definition: animplay.cpp:37
DCF(camera_speed,"Sets the camera zoom scale")
ship_subsys * targeted_subsys
Definition: ai.h:472
float ship_get_secondary_weapon_range(ship *shipp)
Definition: ship.cpp:16238
int hud_sensors_ok(ship *sp, int show_msg)
Check if targeting is possible based on sensors strength.
Definition: hudtarget.cpp:4578
angles Viewer_slew_angles
Definition: systemvars.cpp:54
void vm_vec_scale_add2(vec3d *dest, const vec3d *src, float k)
Definition: vecmat.cpp:284
int lua_game_control
#define PLAYER_FLAGS_AUTO_TARGETING
Definition: player.h:38
void player_show_death_message()
void ship_do_cap_subsys_cargo_revealed(ship *shipp, ship_subsys *subsys, int from_network)
Definition: ship.cpp:16161
float dock_calc_docked_speed(object *objp)
Definition: objectdock.cpp:269
int cargo_scan_loop
Definition: player.h:150
uint flags
Definition: ship.h:644
void do_view_external(float frame_time)
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
int flags
Definition: multi.h:463
#define VM_EXTERNAL_CAMERA_LOCKED
Definition: systemvars.h:36
#define LGC_STEERING
Definition: player.h:66
object * objp
Definition: lua.cpp:3105
GLenum GLenum GLenum GLenum GLenum scale
Definition: Glext.h:8503
#define OBJ_OBSERVER
Definition: object.h:43
#define Int3()
Definition: pstypes.h:292
float GetX()
int Player_use_ai
void HUD_sourced_printf(int source, const char *format,...)
Definition: hudmessage.cpp:571
#define CARGO_MIN_DOT_TO_REVEAL
Definition: hudtarget.h:31
void playercontrol_read_stick(int *axis, float frame_time)
Reads and combines the axes from the player's joystick and mouse.
float current_target_distance
Definition: ai.h:489
ship * shipp
Definition: lua.cpp:9162
void player_maybe_start_repair_sound()
int mission_goals_incomplete(int desired_type, int team)
vec3d pos
Definition: object.h:152
void get_info(vec3d *position, matrix *orientation)
Definition: camera.cpp:531
vec3d view_pos
Definition: fredrender.cpp:103
#define SIF_AFTERBURNER
Definition: ship.h:879
char callsign[CALLSIGN_LEN+1]
Definition: player.h:91
#define CARGO_REVEAL_MIN_DIST
Definition: hudtarget.h:29
void ship_get_eye(vec3d *eye_pos, matrix *eye_orient, object *obj, bool do_slew, bool from_origin)
Definition: ship.cpp:13227
int repair_sound_loop
Definition: player.h:148
VIEW_EXTERNAL.
#define PLAYER_FLAGS_AUTO_MATCH_SPEED
Definition: player.h:39
SCP_string death_message
Definition: player.h:208
cargo scanning (looped)
Definition: gamesnd.h:134
#define CLAMP(x, min, max)
Definition: pstypes.h:488
bool isValid()
Definition: camera.cpp:851
DOWN_SLIDE_THRUST.
int objnum
Definition: ship.h:1483
int valid_cap_subsys_cargo_list(char *subsys)
Definition: ship.cpp:16984
#define LGC_FULL
Definition: player.h:67
#define VM_PADLOCK_REAR
Definition: systemvars.h:39
int object_is_docked(object *objp)
Definition: object.cpp:2019
int low_ammo_complaint_count
Definition: player.h:162
int m_kill_count_ok
Definition: scoring.h:115
#define VM_FREECAMERA
Definition: systemvars.h:44
int friendly_hits
Definition: player.h:129
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
int instance
Definition: object.h:150
fix friendly_last_hit_time
Definition: player.h:131
matrix * vm_vector_2_matrix(matrix *m, const vec3d *fvec, const vec3d *uvec, const vec3d *rvec)
Definition: vecmat.cpp:850
Definition: player.h:85
#define VM_PADLOCK_RIGHT
Definition: systemvars.h:41
const float PI2
Definition: pstypes.h:305
int auto_advance
Definition: player.h:190
WarpEffect * warpout_effect
Definition: ship.h:576
int target_is_dying
Definition: player.h:172
void player_maybe_start_cargo_scan_sound()
float pitch
Definition: physics.h:100
int flags
Definition: ship.h:322
angles chase_slew_angles
REVERSE_THRUST.
struct matrix::@228::@230 vec
int target_in_lock_cone
Definition: player.h:175
virtual int getWarpPosition(vec3d *output)
Definition: shipfx.cpp:3525
int subtype
Definition: lua.cpp:9763
void player_stop_cargo_scan_sound()
void vm_vec_scale(vec3d *dest, float s)
Definition: vecmat.cpp:248
#define GM_MULTIPLAYER
Definition: systemvars.h:18
#define PLAYER_FLAGS_KILLED_BY_EXPLOSION
Definition: player.h:48
int fire_debug_count
Definition: physics.h:113
int allow_ammo_timestamp
Definition: player.h:163
#define TARGET_WARPOUT_MATCH_PERCENT
Definition: player.h:280
int flags
Definition: ship.h:1227
control_info lua_ci
Definition: player.h:210
float get_hull_pct(object *objp)
Definition: object.cpp:271
bool object_get_gliding(object *objp)
Definition: object.cpp:2059
int ship_get_sound(object *objp, GameSoundsIndex id)
Returns a ship-specific sound index.
Definition: ship.cpp:18614
float speed
Definition: physics.h:79
void player_generate_death_message(player *player_p)
int warn_count
Definition: player.h:145
#define OBJ_WEAPON
Definition: object.h:33
int allow_praise_timestamp
Definition: player.h:153
angles_t angles
Definition: systemvars.h:73
float check_control_timef(int id)
#define PF_ACCELERATES
Definition: physics.h:18
#define MESSAGE_PRAISE
void player_controls_init()
int praise_delay_timestamp
Definition: player.h:154
int ship_get_random_player_wing_ship(int flags, float max_dist, int persona_index, int get_first, int multi_team)
Definition: ship.cpp:14508
#define OBJ_DEBRIS
Definition: object.h:37
int last_target
Definition: ai.h:497
int current_target_sy
Definition: player.h:174
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
#define PLAYER_KILLED_SELF
Definition: player.h:56
float forward
Definition: physics.h:105
VIEW_DIST_INCREASE.
warp_camera Warp_camera
Definition: camera.cpp:17
int player_inspect_cap_subsys_cargo(float frametime, char *outstr)
#define vm_vec_negate(v)
Definition: vecmat.h:70
void do_thrust_keys(control_info *ci)
object * Viewer_obj
Definition: object.cpp:57
#define SSF_CARGO_REVEALED
Definition: ship.h:279
float current_max_speed
Definition: ship.h:641
void physics_init(physics_info *pi)
Definition: physics.cpp:49
#define HUD_SOURCE_HIDDEN
Definition: hudmessage.h:23
char cargo1
Definition: ship.h:549
float distance
Definition: systemvars.h:74
int snd_play(game_snd *gs, float pan, float vol_scale, int priority, bool is_voice_msg)
Definition: sound.cpp:517
#define SF_PRIMARY_LINKED
Definition: ship.h:458
#define fl_abs(fl)
Definition: floating.h:31
AFTERBURNER.
#define PF_FORCE_GLIDE
Definition: physics.h:33
int Use_mouse_to_fly
Definition: mouse.cpp:51
net_player_server_info s_info
Definition: multi.h:472
float vm_vec_normalized_dir(vec3d *dest, const vec3d *end, const vec3d *start)
Definition: vecmat.cpp:591
float vm_vec_dist(const vec3d *v0, const vec3d *v1)
Definition: vecmat.cpp:355
#define MAX_PLAYERS
Definition: pstypes.h:32
int failures_this_session
Definition: player.h:202
matrix eye_orient
Definition: fredrender.cpp:112
#define PCM_WARPOUT_STAGE2
Definition: player.h:60
float friendly_damage
Definition: player.h:130
int subsys_cargo_name
Definition: ship.h:373
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias.
int flags2
Definition: ship.h:1228
ubyte show_skip_popup
Definition: player.h:203
set 1/3 or 2/3 throttle (up)
Definition: gamesnd.h:83
Definition: ship.h:534
#define KEY_DEBUG_KEY
Definition: key.h:69
PADLOCK_RIGHT.
vec3d eye_pos
Definition: fredrender.cpp:103
int current_target_sx
Definition: player.h:173
void control_used(int id)
ONE_THIRD_THROTTLE.
int num_slots
Definition: model.h:433
float wash_intensity
Definition: ship.h:664
void player_set_padlock_state()
int save_flags
Definition: player.h:105
int press_glide
int killer_objtype
Definition: player.h:180
#define delta
Definition: fvi.cpp:418
float vm_vec_normalize_safe(vec3d *v)
Definition: vecmat.cpp:471
GLdouble GLdouble t
Definition: Glext.h:5329
#define CAP_CARGO_REVEAL_MIN_DIST
Definition: hudtarget.h:30
builtin_message Builtin_messages[]
vec3d * vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m)
Definition: vecmat.cpp:959
void mouse_get_delta(int *dx, int *dy, int *dz)
Definition: mouse.cpp:358
camid cam_get_current()
Definition: camera.cpp:952
LOCAL physics_info phys_save
set 1/3 or 2/3 throttle (down)
Definition: gamesnd.h:84
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
object Objects[MAX_OBJECTS]
Definition: object.cpp:62
PITCH_BACK.
float camera_zoom_scale
vei Viewer_external_info
Definition: systemvars.cpp:55
unsigned char ubyte
Definition: pstypes.h:62
int Show_killer_weapon
float Warpout_time
Definition: fredstubs.cpp:177
uint flags
Definition: physics.h:37
char killer_parent_name[NAME_LENGTH]
Definition: player.h:183
const char * XSTR(const char *str, int index)
Definition: localize.cpp:851
#define ZERO_VECTOR
Definition: vecmat.h:60
void player_set_next_all_alone_msg_timestamp()
#define GM_DEAD
Definition: systemvars.h:25
int objnum
Definition: player.h:124
float GetYaw()
PADLOCK_LEFT.
ship * Player_ship
Definition: ship.cpp:124
#define GM_IN_MISSION
Definition: systemvars.h:23
matrix orient
Definition: object.h:153
#define SIF2_NO_PRIMARY_LINKING
Definition: ship.h:928
#define NOX(s)
Definition: pstypes.h:473
void vm_vec_copy_scale(vec3d *dest, const vec3d *src, float s)
Definition: vecmat.cpp:257
physics_info Descent_physics
#define OBJ_SHIP
Definition: object.h:32
#define GM_STANDALONE_SERVER
Definition: systemvars.h:27
float bank
Definition: physics.h:104
void player_save_target_and_weapon_link_prefs()
#define PLAYER_FLAGS_NO_CHECK_ALL_ALONE_MSG
Definition: player.h:47
void dc_stuff_float(float *f)
Stuffs a float to the given variable.
float forward_cruise_percent
Definition: physics.h:106
int afterburner_stop
Definition: physics.h:117
#define OOC_FIRE_SECONDARY
Definition: multi_obj.h:27
void set_rotation(matrix *in_orientation=NULL, float in_rotation_time=0.0f, float in_rotation_acceleration_time=0.0f, float in_rotation_deceleration_time=0.0f)
Definition: camera.cpp:195
#define SIF_HUGE_SHIP
Definition: ship.h:945
int control_mode
Definition: player.h:134
GLuint const GLchar * name
Definition: Glext.h:5608
FIRE_SECONDARY.
FORWARD_THRUST.
void vm_vec_sub(vec3d *dest, const vec3d *src0, const vec3d *src1)
Definition: vecmat.cpp:168
void physics_read_flying_controls(matrix *orient, physics_info *pi, control_info *ci, float sim_time, vec3d *wash_rot)
Definition: physics.cpp:449
vec3d vel
Definition: physics.h:77
float radius
Definition: model.h:179
float fspeed
Definition: physics.h:80
fix t1
Definition: animplay.cpp:37
#define MISSION_TYPE_TRAINING
Definition: missionparse.h:63
angles * vm_extract_angles_vector(angles *a, const vec3d *v)
Definition: vecmat.cpp:1114
#define VM_PADLOCK_UP
Definition: systemvars.h:38
#define SF_SCANNABLE
Definition: ship.h:465
LEFT_SLIDE_THRUST.
float GetY()
int Invert_axis[]
TrackIRDLL gTirDll_TrackIR
UP_SLIDE_THRUST.
set full throttle
Definition: gamesnd.h:81
ship Ships[MAX_SHIPS]
Definition: ship.cpp:122
int allow_scream_timestamp
Definition: player.h:160
player warp has failed
Definition: gamesnd.h:115
#define MESSAGE_PRIORITY_HIGH
player * Player
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
int allow_ask_help_timestamp
Definition: player.h:157
#define DCF_BOOL(function_name, bool_variable)
Definition: console.h:71
#define CARGO_RADIUS_DELTA
Definition: hudtarget.h:27
float frame_time
Definition: multi.cpp:1426
Definition: pstypes.h:606
#define SF_WARP_BROKEN
Definition: ship.h:460
#define NAME_LENGTH
Definition: globals.h:15
#define SF_SECONDARY_DUAL_FIRE
Definition: ship.h:459
#define WP_MISSILE
Definition: weapon.h:28
int request_repair_timestamp
Definition: player.h:169
#define VM_PADLOCK_LEFT
Definition: systemvars.h:40
#define fl2i(fl)
Definition: floating.h:33
void chase_angles_to_value(angles *ap, angles *bp, int scale)
Slew angles chase towards a value like they're on a spring.
int distance_warning_time
Definition: player.h:141
#define MESSAGE_TIME_ANYTIME
void message_send_builtin_to_player(int type, ship *shipp, int priority, int timing, int group, int delay, int multi_target, int multi_team_filter)
PADLOCK_DOWN.
vec3d wash_rot_axis
Definition: ship.h:665
cargo revealed
Definition: gamesnd.h:73
TWO_THIRDS_THROTTLE.
#define OBJ_SHOCKWAVE
Definition: object.h:41
class camera * getCamera()
Definition: camera.cpp:833
float heading
Definition: physics.h:102
void player_level_init()
FIRE_PRIMARY.
int snd_play_looping(game_snd *gs, float pan, int start_loop, int stop_loop, float vol_scale, int scriptingUpdateVolume)
Definition: sound.cpp:822
ship is being repaired (during rearm/repair)
Definition: gamesnd.h:103
int warpout_engage_time
Definition: ship.h:1219
char subobj_name[MAX_NAME_LEN]
Definition: model.h:172
ship_subsys * locking_subsys
Definition: player.h:176
#define GM_DEAD_BLEW_UP
Definition: systemvars.h:21
#define PLAYER_FLAGS_KILLED_SELF_SHOCKWAVE
Definition: player.h:54
ship_obj Ship_obj_list
Definition: ship.cpp:162
long Game_time_compression
Definition: fredstubs.cpp:202
int ship_info_index
Definition: ship.h:539
#define PLAYER_FLAGS_STRUCTURE_IN_USE
Definition: player.h:40
GLfloat GLfloat p
Definition: Glext.h:8373
float vertical
Definition: physics.h:101
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
ubyte keyd_pressed[NUM_KEYS]
Definition: key.cpp:42
SCP_vector< ship_info > Ship_info
Definition: ship.cpp:164
#define LOCATION
Definition: pstypes.h:245
#define SIF_TRANSPORT
Definition: ship.h:890
#define VM_PADLOCK_ANY
Definition: systemvars.h:46
int Viewer_mode
Definition: systemvars.cpp:28
void gamesnd_play_error_beep()
Definition: gamesnd.cpp:1159
fix last_warning_message_time
Definition: player.h:132
void player_set_pilot_defaults(player *p)
int player_inspect_cargo(float frametime, char *outstr)
#define timestamp_elapsed(stamp)
Definition: timer.h:102
void player_maybe_play_all_alone_msg()
void player_init()
MINUS_5_PERCENT_THROTTLE.
#define PF_SLIDE_ENABLED
Definition: physics.h:21
vec3d * get_subsystem_world_pos(object *parent_obj, ship_subsys *subsys, vec3d *world_pos)
Definition: hudtarget.cpp:4395
#define MATCH_SPEED_THRESHOLD
Definition: hudtarget.h:26
void do_view_track_target(float frame_time)
#define PI
Definition: pstypes.h:303
int Game_skill_level
Definition: fredstubs.cpp:170
int check_control(int id, int key)
angles Viewer_slew_angles_delta
#define PCM_SUPERNOVA
Definition: player.h:62
float vm_vec_dot(const vec3d *v0, const vec3d *v1)
Definition: vecmat.cpp:312
LAUNCH_COUNTERMEASURE.
float sideways
Definition: physics.h:103
void player_control_reset_ci(control_info *ci)
void player_init_all_alone_msg()
BANK_LEFT.
const float PI_2
Definition: pstypes.h:307
void HUD_fixed_printf(float duration, color col, const char *format,...)
Definition: hudmessage.cpp:470
BANK_WHEN_PRESSED.
object * Player_obj
Definition: object.cpp:56
int killer_weapon_index
Definition: player.h:182
#define SF_CARGO_REVEALED
Definition: ship.h:456
uint flags2
Definition: ship.h:645
int locking_on_center
Definition: player.h:178
float flRealframetime
Definition: fredstubs.cpp:226
#define SF_DYING
Definition: ship.h:447
int praise_self_count
Definition: player.h:165
int temp
Definition: lua.cpp:4996
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
Definition: console.cpp:358
polymodel * pm
Definition: lua.cpp:1598
angles Viewer_external_angles_delta
#define PCM_WARPOUT_STAGE3
Definition: player.h:61
w_bank * missile_banks
Definition: model.h:773
void copy_control_info(control_info *dest_ci, control_info *src_ci)
#define MAX(a, b)
Definition: pstypes.h:299
#define VM_OTHER_SHIP
Definition: systemvars.h:35
player Players[MAX_PLAYERS]
int scan_time
Definition: ship.h:1351
#define OBJ_BEAM
Definition: object.h:46
void toggle_player_object()
int ship_name_lookup(const char *name, int inc_players)
Definition: ship.cpp:12900
void joy_ff_adjust_handling(int speed)
Definition: joy-unix.cpp:575
float radius
Definition: object.h:154
MAX_THROTTLE.
void player_stop_looped_sounds()
void snd_stop(int sig)
Definition: sound.cpp:875
mission The_mission
int check_warn_timestamp
Definition: player.h:137
#define VM_CHASE
Definition: systemvars.h:34
float GetPitch()
float h
Definition: pstypes.h:111
void do_view_slew(float frame_time)
#define HUD_CMEASURE_GAUGE
Definition: hudgauges.h:47
char type
Definition: object.h:146
void compute_slew_matrix(matrix *orient, angles *a)
Definition: ship.cpp:6546
vec3d vmd_zero_vector
Definition: vecmat.cpp:24
#define LOCAL
Definition: pstypes.h:37
char * Cargo_names[]
int praise_count
Definition: player.h:152
void gameseq_post_event(int event)
The total number of actions an axis may map to.
float distance
Definition: systemvars.h:79
void vm_vec_add(vec3d *dest, const vec3d *src0, const vec3d *src1)
Definition: vecmat.cpp:159
int hud_targetbox_subsystem_in_view(object *target_objp, int *sx, int *sy)
void gr_init_color(color *c, int r, int g, int b)
Definition: 2d.cpp:1155
button_info bi
Definition: player.h:125
matrix vmd_identity_matrix
Definition: vecmat.cpp:28
int locking_subsys_parent
Definition: player.h:177
void player_clear_speed_matching()
bool Enabled()
Definition: trackirpublic.h:60
int praise_self_timestamp
Definition: player.h:166
#define SF_WARP_NEVER
Definition: ship.h:461
SCP_vector< ship_type_info > Ship_types
Definition: ship.cpp:168
int hud_squadmsg_reinforcements_available(int team)
#define PLAYER_FLAGS_LINK_SECONDARY
Definition: player.h:46
float b
Definition: pstypes.h:111
GLint y
Definition: Gl.h:1505
void player_generate_killer_weapon_name(int weapon_info_index, int killer_species, char *weapon_name)
PLUS_5_PERCENT_THROTTLE.
#define MESSAGE_TIME_SOON
scoring_struct stats
Definition: player.h:127
float vm_vec_normalize(vec3d *v)
Definition: vecmat.cpp:460
void read_keyboard_controls(control_info *ci, float frame_time, physics_info *pi)
#define strcpy_s(...)
Definition: safe_strings.h:67
int view_centering
int Axis_map_to[]
vec3d Dead_camera_pos
Definition: shiphit.cpp:67