Move */main/controls.c -> similar/main/controls.c
This commit is contained in:
parent
86f373e4e0
commit
ff96f3239d
|
@ -379,6 +379,7 @@ class DXXProgram(DXXCommon):
|
|||
'arch/sdl/timer.c',
|
||||
'main/config.c',
|
||||
'main/console.c',
|
||||
'main/controls.c',
|
||||
'main/credits.c',
|
||||
'main/digiobj.c',
|
||||
'main/effects.c',
|
||||
|
@ -610,7 +611,6 @@ class D1XProgram(DXXProgram):
|
|||
'main/bmread.c',
|
||||
'main/cntrlcen.c',
|
||||
'main/collide.c',
|
||||
'main/controls.c',
|
||||
'main/custom.c',
|
||||
'main/dumpmine.c',
|
||||
'main/endlevel.c',
|
||||
|
@ -704,7 +704,6 @@ class D2XProgram(DXXProgram):
|
|||
'main/bm.c',
|
||||
'main/cntrlcen.c',
|
||||
'main/collide.c',
|
||||
'main/controls.c',
|
||||
'main/dumpmine.c',
|
||||
'main/endlevel.c',
|
||||
'main/escort.c',
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
||||
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
||||
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
||||
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
||||
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
||||
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
||||
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
||||
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* Code for controlling player movement
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "key.h"
|
||||
#include "joy.h"
|
||||
#include "timer.h"
|
||||
#include "dxxerror.h"
|
||||
#include "inferno.h"
|
||||
#include "game.h"
|
||||
#include "object.h"
|
||||
#include "player.h"
|
||||
#include "controls.h"
|
||||
#include "render.h"
|
||||
#include "args.h"
|
||||
#include "palette.h"
|
||||
#include "mouse.h"
|
||||
#include "kconfig.h"
|
||||
|
||||
//look at keyboard, mouse, joystick, CyberMan, whatever, and set
|
||||
//physics vars rotvel, velocity
|
||||
|
||||
void read_flying_controls( object * obj )
|
||||
{
|
||||
Assert(FrameTime > 0); //Get MATT if hit this!
|
||||
|
||||
// Couldn't the "50" in the next three lines be changed to "64" with no ill effect?
|
||||
obj->mtype.phys_info.rotthrust.x = Controls.pitch_time;
|
||||
obj->mtype.phys_info.rotthrust.y = Controls.heading_time;
|
||||
obj->mtype.phys_info.rotthrust.z = Controls.bank_time;
|
||||
|
||||
// Set object's thrust vector for forward/backward
|
||||
vm_vec_copy_scale(&obj->mtype.phys_info.thrust,&obj->orient.fvec, Controls.forward_thrust_time );
|
||||
|
||||
// slide left/right
|
||||
vm_vec_scale_add2(&obj->mtype.phys_info.thrust,&obj->orient.rvec, Controls.sideways_thrust_time );
|
||||
|
||||
// slide up/down
|
||||
vm_vec_scale_add2(&obj->mtype.phys_info.thrust,&obj->orient.uvec, Controls.vertical_thrust_time );
|
||||
|
||||
if (obj->mtype.phys_info.flags & PF_WIGGLE) {
|
||||
fix swiggle;
|
||||
fix_fastsincos(((fix)GameTime64), &swiggle, NULL);
|
||||
if (FrameTime < F1_0) // Only scale wiggle if getting at least 1 FPS, to avoid causing the opposite problem.
|
||||
swiggle = fixmul(swiggle*20, FrameTime); //make wiggle fps-independant (based on pre-scaled amount of wiggle at 20 FPS)
|
||||
vm_vec_scale_add2(&obj->mtype.phys_info.velocity,&obj->orient.uvec,fixmul(swiggle,Player_ship->wiggle));
|
||||
}
|
||||
|
||||
// As of now, obj->mtype.phys_info.thrust & obj->mtype.phys_info.rotthrust are
|
||||
// in units of time... In other words, if thrust==FrameTime, that
|
||||
// means that the user was holding down the Max_thrust key for the
|
||||
// whole frame. So we just scale them up by the max, and divide by
|
||||
// FrameTime to make them independant of framerate
|
||||
|
||||
// Prevent divide overflows on high frame rates.
|
||||
// In a signed divide, you get an overflow if num >= div<<15
|
||||
{
|
||||
fix ft = FrameTime;
|
||||
|
||||
// Note, you must check for ft < F1_0/2, else you can get an overflow on the << 15.
|
||||
if ((ft < F1_0/2) && (ft << 15 <= Player_ship->max_thrust)) {
|
||||
ft = (Player_ship->max_thrust >> 15) + 1;
|
||||
}
|
||||
|
||||
vm_vec_scale( &obj->mtype.phys_info.thrust, fixdiv(Player_ship->max_thrust,ft) );
|
||||
|
||||
if ((ft < F1_0/2) && (ft << 15 <= Player_ship->max_rotthrust)) {
|
||||
ft = (Player_ship->max_thrust >> 15) + 1;
|
||||
}
|
||||
|
||||
vm_vec_scale( &obj->mtype.phys_info.rotthrust, fixdiv(Player_ship->max_rotthrust,ft) );
|
||||
}
|
||||
|
||||
//moved here by WraithX
|
||||
if (Player_is_dead) {
|
||||
//vm_vec_zero(&obj->mtype.phys_info.rotthrust); //let dead players rotate, changed by WraithX
|
||||
vm_vec_zero(&obj->mtype.phys_info.thrust); //don't let dead players move, changed by WraithX
|
||||
return;
|
||||
}//end if
|
||||
|
||||
|
||||
}
|
|
@ -18,10 +18,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "pstypes.h"
|
||||
#include "key.h"
|
||||
#include "joy.h"
|
||||
#include "timer.h"
|
||||
|
@ -36,10 +33,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#include "palette.h"
|
||||
#include "mouse.h"
|
||||
#include "kconfig.h"
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
#include "laser.h"
|
||||
#ifdef NETWORK
|
||||
#include "multi.h"
|
||||
#endif
|
||||
#include "vclip.h"
|
||||
#include "fireball.h"
|
||||
|
||||
|
@ -54,6 +50,7 @@ fix Afterburner_charge=f1_0;
|
|||
extern int Drop_afterburner_blob_flag; //ugly hack
|
||||
|
||||
extern fix Seismic_tremor_magnitude;
|
||||
#endif
|
||||
|
||||
void read_flying_controls( object * obj )
|
||||
{
|
||||
|
@ -61,14 +58,7 @@ void read_flying_controls( object * obj )
|
|||
|
||||
Assert(FrameTime > 0); //Get MATT if hit this!
|
||||
|
||||
// this section commented and moved to the bottom by WraithX
|
||||
// if (Player_is_dead) {
|
||||
// vm_vec_zero(&obj->mtype.phys_info.rotthrust);
|
||||
// vm_vec_zero(&obj->mtype.phys_info.thrust);
|
||||
// return;
|
||||
// }
|
||||
// end of section to be moved.
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
if ((obj->type!=OBJ_PLAYER) || (obj->id!=Player_num)) return; //references to player_ship require that this obj be the player
|
||||
|
||||
if (Guided_missile[Player_num] && Guided_missile[Player_num]->signature==Guided_missile_sig[Player_num]) {
|
||||
|
@ -100,7 +90,9 @@ void read_flying_controls( object * obj )
|
|||
#endif
|
||||
|
||||
}
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
obj->mtype.phys_info.rotthrust.x = Controls.pitch_time;
|
||||
obj->mtype.phys_info.rotthrust.y = Controls.heading_time;
|
||||
obj->mtype.phys_info.rotthrust.z = Controls.bank_time;
|
||||
|
@ -108,10 +100,10 @@ void read_flying_controls( object * obj )
|
|||
|
||||
forward_thrust_time = Controls.forward_thrust_time;
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
if (Players[Player_num].flags & PLAYER_FLAGS_AFTERBURNER)
|
||||
{
|
||||
if (Controls.afterburner_state) { //player has key down
|
||||
//if (forward_thrust_time >= 0) { //..and isn't moving backward
|
||||
{
|
||||
fix afterburner_scale;
|
||||
int old_count,new_count;
|
||||
|
@ -150,6 +142,7 @@ void read_flying_controls( object * obj )
|
|||
Players[Player_num].energy -= charge_up * 100 / 10; //full charge uses 10% of energy
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set object's thrust vector for forward/backward
|
||||
vm_vec_copy_scale(&obj->mtype.phys_info.thrust,&obj->orient.fvec, forward_thrust_time );
|
Loading…
Reference in a new issue