mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-30 17:01:03 +00:00
SW: Make map follow mode work better.
- Input was too fast following input code changes. - Speed of input can now be changed with toggling the run key. - Remove function 'MoveScrollMode2D()' and incorporate into 'getinput()' to reduce code duplication. - Store map follow coordinates in PLAYERp struct and remove old globals.
This commit is contained in:
parent
4630c8a0b7
commit
8e94c48eff
5 changed files with 126 additions and 193 deletions
|
@ -81,7 +81,6 @@ void pWeaponForceRest(PLAYERp pp);
|
|||
#define SO_IDLE_SOUND 1
|
||||
|
||||
extern SWBOOL NoMeters;
|
||||
extern int Follow_posx,Follow_posy;
|
||||
|
||||
#define TEST_UNDERWATER(pp) (TEST(sector[(pp)->cursectnum].extra, SECTFX_UNDERWATER))
|
||||
extern unsigned char palette_data[256][3]; // Global palette array
|
||||
|
@ -2211,132 +2210,6 @@ void PlayerCheckValidMove(PLAYERp pp)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
MoveScrollMode2D(PLAYERp pp)
|
||||
{
|
||||
#define TURBOTURNTIME (120/8)
|
||||
#define NORMALTURN (12+6)
|
||||
#define RUNTURN (28)
|
||||
#define PREAMBLETURN 3
|
||||
#define NORMALKEYMOVE 35
|
||||
#define MAXVEL ((NORMALKEYMOVE*2)+10)
|
||||
#define MAXSVEL ((NORMALKEYMOVE*2)+10)
|
||||
#define MAXANGVEL 100
|
||||
|
||||
ControlInfo scrl_input;
|
||||
int32_t keymove;
|
||||
int32_t momx, momy;
|
||||
static int mfvel=0, mfsvel=0;
|
||||
extern SWBOOL HelpInputMode, ScrollMode2D;
|
||||
|
||||
|
||||
CONTROL_GetInput(&scrl_input);
|
||||
|
||||
mfsvel = mfvel = 0;
|
||||
|
||||
if (M_Active())
|
||||
return;
|
||||
|
||||
// Recenter view if told
|
||||
if (buttonMap.ButtonDown(gamefunc_Center_View))
|
||||
{
|
||||
Follow_posx = pp->posx;
|
||||
Follow_posy = pp->posy;
|
||||
}
|
||||
|
||||
// Toggle follow map mode on/off
|
||||
if (buttonMap.ButtonDown(gamefunc_Map_Follow_Mode))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
ScrollMode2D = !ScrollMode2D;
|
||||
// Reset coords
|
||||
Follow_posx = pp->posx;
|
||||
Follow_posy = pp->posy;
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
mfsvel -= scrl_input.dyaw>>2;
|
||||
mfsvel -= scrl_input.dx>>2;
|
||||
mfvel = -scrl_input.dz>>2;
|
||||
|
||||
#if 0
|
||||
int const running = !!BUTTON(gamefunc_Run) ^ !!TEST(pp->Flags, PF_LOCK_RUN);
|
||||
if (running)
|
||||
{
|
||||
keymove = NORMALKEYMOVE << 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
keymove = NORMALKEYMOVE;
|
||||
}
|
||||
|
||||
if (!HelpInputMode && !ConPanel)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
{
|
||||
mfsvel -= -keymove;
|
||||
}
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||
{
|
||||
mfsvel -= keymove;
|
||||
}
|
||||
}
|
||||
|
||||
if (!InputMode && !ConPanel)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe_Left))
|
||||
{
|
||||
mfsvel += keymove;
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe_Right))
|
||||
{
|
||||
mfsvel += -keymove;
|
||||
}
|
||||
}
|
||||
|
||||
if (!HelpInputMode && !ConPanel)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
|
||||
{
|
||||
mfvel += keymove;
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
|
||||
{
|
||||
mfvel += -keymove;
|
||||
}
|
||||
}
|
||||
|
||||
if (mfvel < -MAXVEL)
|
||||
mfvel = -MAXVEL;
|
||||
if (mfvel > MAXVEL)
|
||||
mfvel = MAXVEL;
|
||||
if (mfsvel < -MAXSVEL)
|
||||
mfsvel = -MAXSVEL;
|
||||
if (mfsvel > MAXSVEL)
|
||||
mfsvel = MAXSVEL;
|
||||
|
||||
momx = mulscale9(mfvel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang) + 512)]);
|
||||
momy = mulscale9(mfvel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang))]);
|
||||
|
||||
momx += mulscale9(mfsvel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang))]);
|
||||
momy += mulscale9(mfsvel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang) + 1536)]);
|
||||
|
||||
//mfvel = momx;
|
||||
//mfsvel = momy;
|
||||
|
||||
Follow_posx += momx;
|
||||
Follow_posy += momy;
|
||||
|
||||
Follow_posx = max(Follow_posx, x_min_bound);
|
||||
Follow_posy = max(Follow_posy, y_min_bound);
|
||||
Follow_posx = min(Follow_posx, x_max_bound);
|
||||
Follow_posy = min(Follow_posy, y_max_bound);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
DoPlayerMenuKeys(PLAYERp pp)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue