2020-08-16 14:00:40 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1997, 2005 - 3D Realms Entertainment
|
|
|
|
|
|
|
|
This file is part of Shadow Warrior version 1.2
|
|
|
|
|
|
|
|
Shadow Warrior is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
Original Source: 1997 - Frank Maddin and Jim Norwood
|
|
|
|
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "ns.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "network.h"
|
|
|
|
#include "gamecontrol.h"
|
|
|
|
#include "player.h"
|
2020-10-04 16:31:48 +00:00
|
|
|
#include "razemenu.h"
|
2020-08-16 14:00:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
BEGIN_SW_NS
|
|
|
|
|
2022-09-04 20:52:03 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-12-11 02:49:58 +00:00
|
|
|
void InitTimingVars(void)
|
2020-09-02 18:56:09 +00:00
|
|
|
{
|
|
|
|
PlayClock = 0;
|
|
|
|
randomseed = 17L;
|
|
|
|
MoveSkip8 = 2;
|
|
|
|
MoveSkip2 = 0;
|
|
|
|
MoveSkip4 = 1; // start slightly offset so these
|
|
|
|
}
|
|
|
|
|
2020-10-15 08:47:14 +00:00
|
|
|
#if 0
|
2020-09-06 11:03:27 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
TURBOTURNTIME = (120 / 8),
|
|
|
|
NORMALTURN = (12 + 6),
|
|
|
|
RUNTURN = (28),
|
|
|
|
PREAMBLETURN = 3,
|
|
|
|
NORMALKEYMOVE = 35,
|
2020-09-06 11:46:18 +00:00
|
|
|
MAXFVEL = ((NORMALKEYMOVE * 2) + 10),
|
2020-09-06 11:03:27 +00:00
|
|
|
MAXSVEL = ((NORMALKEYMOVE * 2) + 10),
|
|
|
|
MAXANGVEL = 100,
|
|
|
|
MAXHORIZVEL = 128
|
|
|
|
};
|
2020-10-15 08:47:14 +00:00
|
|
|
#endif
|
2020-09-06 11:03:27 +00:00
|
|
|
|
2020-09-06 10:49:05 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// handles movement
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2023-10-02 19:03:59 +00:00
|
|
|
void processWeapon(DSWPlayer* const pp)
|
2020-08-16 14:00:40 +00:00
|
|
|
{
|
2023-09-30 10:51:34 +00:00
|
|
|
DSWActor* plActor = pp->GetActor();
|
2021-12-25 20:21:42 +00:00
|
|
|
if (plActor == nullptr) return;
|
2020-08-16 14:00:40 +00:00
|
|
|
int i;
|
2020-09-06 10:49:05 +00:00
|
|
|
|
2023-10-02 05:00:10 +00:00
|
|
|
if (pp->cmd.ucmd.getNewWeapon() == WeaponSel_Next)
|
2020-09-06 10:49:05 +00:00
|
|
|
{
|
2021-12-25 20:21:42 +00:00
|
|
|
int next_weapon = plActor->user.WeaponNum + 1;
|
2021-11-21 20:47:37 +00:00
|
|
|
int start_weapon;
|
2020-09-06 10:49:05 +00:00
|
|
|
|
2021-12-25 20:21:42 +00:00
|
|
|
start_weapon = plActor->user.WeaponNum + 1;
|
2020-09-06 10:49:05 +00:00
|
|
|
|
2021-12-25 20:21:42 +00:00
|
|
|
if (plActor->user.WeaponNum == WPN_SWORD)
|
2020-09-06 10:49:05 +00:00
|
|
|
start_weapon = WPN_STAR;
|
|
|
|
|
2021-12-25 20:21:42 +00:00
|
|
|
if (plActor->user.WeaponNum == WPN_FIST)
|
2020-09-06 10:49:05 +00:00
|
|
|
{
|
|
|
|
next_weapon = 14;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
next_weapon = -1;
|
2020-09-09 17:52:52 +00:00
|
|
|
for (i = start_weapon; true; i++)
|
2020-09-06 10:49:05 +00:00
|
|
|
{
|
|
|
|
if (i >= MAX_WEAPONS_KEYS)
|
|
|
|
{
|
|
|
|
next_weapon = 13;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-12-27 18:34:06 +00:00
|
|
|
if (pp->WpnFlags & (BIT(i)) && pp->WpnAmmo[i])
|
2020-09-06 10:49:05 +00:00
|
|
|
{
|
|
|
|
next_weapon = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-02 05:00:10 +00:00
|
|
|
pp->cmd.ucmd.setNewWeapon(next_weapon + 1);
|
2020-09-06 10:49:05 +00:00
|
|
|
}
|
2023-10-02 05:00:10 +00:00
|
|
|
else if (pp->cmd.ucmd.getNewWeapon() == WeaponSel_Prev)
|
2020-09-06 10:49:05 +00:00
|
|
|
{
|
2021-12-25 20:21:42 +00:00
|
|
|
int prev_weapon = plActor->user.WeaponNum - 1;
|
2021-11-21 20:47:37 +00:00
|
|
|
int start_weapon;
|
2020-09-06 10:49:05 +00:00
|
|
|
|
2021-12-25 20:21:42 +00:00
|
|
|
start_weapon = plActor->user.WeaponNum - 1;
|
2020-09-06 10:49:05 +00:00
|
|
|
|
2021-12-25 20:21:42 +00:00
|
|
|
if (plActor->user.WeaponNum == WPN_SWORD)
|
2020-09-06 10:49:05 +00:00
|
|
|
{
|
|
|
|
prev_weapon = 13;
|
|
|
|
}
|
2021-12-25 20:21:42 +00:00
|
|
|
else if (plActor->user.WeaponNum == WPN_STAR)
|
2020-09-06 10:49:05 +00:00
|
|
|
{
|
|
|
|
prev_weapon = 14;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prev_weapon = -1;
|
2020-09-09 17:52:52 +00:00
|
|
|
for (i = start_weapon; true; i--)
|
2020-09-06 10:49:05 +00:00
|
|
|
{
|
|
|
|
if (i <= -1)
|
|
|
|
i = WPN_HEART;
|
|
|
|
|
2021-12-27 18:34:06 +00:00
|
|
|
if (pp->WpnFlags & (BIT(i)) && pp->WpnAmmo[i])
|
2020-09-06 10:49:05 +00:00
|
|
|
{
|
|
|
|
prev_weapon = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-02 05:00:10 +00:00
|
|
|
pp->cmd.ucmd.setNewWeapon(prev_weapon + 1);
|
2020-09-06 10:49:05 +00:00
|
|
|
}
|
2023-10-02 05:00:10 +00:00
|
|
|
else if (pp->cmd.ucmd.getNewWeapon() == WeaponSel_Alt)
|
2020-09-06 10:49:05 +00:00
|
|
|
{
|
2021-12-25 20:21:42 +00:00
|
|
|
int which_weapon = plActor->user.WeaponNum + 1;
|
2023-10-02 05:00:10 +00:00
|
|
|
pp->cmd.ucmd.setNewWeapon(which_weapon);
|
2020-09-06 10:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-16 14:00:40 +00:00
|
|
|
END_SW_NS
|