mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- processed all remaining local input CCMDs and removed some bits only needed for multiplayer.
These MP bits should be reimplemented as network commands later, they only take up valuable space in the bit field.
This commit is contained in:
parent
ee7d558282
commit
d62d2eaec7
26 changed files with 123 additions and 225 deletions
|
@ -74,6 +74,7 @@ char gUserMapFilename[BMAX_PATH];
|
|||
short BloodVersion = 0x115;
|
||||
|
||||
int gNetPlayers;
|
||||
int gQuitRequest;
|
||||
|
||||
int gChokeCounter = 0;
|
||||
|
||||
|
@ -81,7 +82,6 @@ double g_gameUpdateTime, g_gameUpdateAndDrawTime;
|
|||
double g_gameUpdateAvgTime = 0.001;
|
||||
|
||||
bool gQuitGame;
|
||||
int gQuitRequest;
|
||||
|
||||
enum gametokens
|
||||
{
|
||||
|
@ -522,7 +522,6 @@ bool gRestartGame = false;
|
|||
|
||||
void ProcessFrame(void)
|
||||
{
|
||||
char buffer[128];
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
auto& inp = gPlayer[i].input;
|
||||
|
@ -538,6 +537,7 @@ void ProcessFrame(void)
|
|||
}
|
||||
gNetFifoTail++;
|
||||
|
||||
#if 0
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
if (gPlayer[i].input.syncFlags.quit)
|
||||
|
@ -561,6 +561,7 @@ void ProcessFrame(void)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
viewClearInterpolations();
|
||||
{
|
||||
if (paused || gEndGameMgr.at0 || (gGameOptions.nGameType == 0 && M_Active()))
|
||||
|
@ -703,7 +704,6 @@ void GameInterface::app_init()
|
|||
Printf(PRINT_NONOTIFY, "Initializing sound system\n");
|
||||
sndInit();
|
||||
registerosdcommands();
|
||||
registerinputcommands();
|
||||
|
||||
gChoke.sub_83ff0(518, sub_84230);
|
||||
UpdateDacs(0, true);
|
||||
|
@ -792,8 +792,10 @@ static void drawBackground()
|
|||
{
|
||||
twod->ClearScreen();
|
||||
DrawTexture(twod, tileGetTexture(2518, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
|
||||
#if 0
|
||||
if (gQuitRequest && !gQuitGame)
|
||||
netBroadcastMyLogoff(gQuitRequest == 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void commonTicker()
|
||||
|
|
|
@ -87,7 +87,6 @@ struct GameInterface : ::GameInterface
|
|||
void DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg) override;
|
||||
void QuitToTitle() override;
|
||||
FString GetCoordString() override;
|
||||
void clearlocalinputstate() override;
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize) override;
|
||||
|
||||
GameStats getStats() override;
|
||||
|
|
|
@ -44,8 +44,6 @@ InputPacket gInput, gNetInput;
|
|||
bool bSilentAim = false;
|
||||
|
||||
int iTurnCount = 0;
|
||||
static int WeaponToSend;
|
||||
static SYNCFLAGS BitsToSend;
|
||||
|
||||
void ctrlInit(void)
|
||||
{
|
||||
|
@ -131,7 +129,7 @@ void ctrlGetInput(void)
|
|||
InputPacket input = {};
|
||||
|
||||
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
|
||||
if (!mouseaim) gInput.syncFlags.lookCenter = 1;
|
||||
if (!mouseaim) gInput.actions |= SB_CENTERVIEW;
|
||||
|
||||
if (numplayers == 1)
|
||||
{
|
||||
|
@ -141,15 +139,8 @@ void ctrlGetInput(void)
|
|||
|
||||
CONTROL_GetInput(&info);
|
||||
|
||||
if (gQuitRequest)
|
||||
gInput.syncFlags.quit = 1;
|
||||
|
||||
gInput.syncFlags.value |= BitsToSend.value;
|
||||
ApplyGlobalInput(gInput, &info);
|
||||
|
||||
BitsToSend.value = 0;
|
||||
WeaponToSend = 0;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
{
|
||||
if (automapMode != am_off)
|
||||
|
@ -200,7 +191,7 @@ void ctrlGetInput(void)
|
|||
gInput.syncFlags.lookDown |= buttonMap.ButtonDown(gamefunc_Look_Down);
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Look_Up) || buttonMap.ButtonDown(gamefunc_Look_Down))
|
||||
gInput.syncFlags.lookCenter = 1;
|
||||
gInput.actions |= SB_CENTERVIEW;
|
||||
else
|
||||
{
|
||||
gInput.syncFlags.lookUp |= buttonMap.ButtonDown(gamefunc_Aim_Up);
|
||||
|
@ -332,26 +323,4 @@ void ctrlGetInput(void)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// CCMD based input. The basics are from Randi's ZDuke but this uses dynamic
|
||||
// registration to only have the commands active when this game module runs.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void registerinputcommands()
|
||||
{
|
||||
C_RegisterFunction("centerview", nullptr, [](CCmdFuncPtr)->int { BitsToSend.lookCenter = 1; return CCMD_OK; });
|
||||
C_RegisterFunction("holsterweapon", nullptr, [](CCmdFuncPtr)->int { BitsToSend.holsterWeapon = 1; return CCMD_OK; });
|
||||
C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { BitsToSend.spin180 = 1; return CCMD_OK; });
|
||||
}
|
||||
|
||||
// This is called from ImputState::ClearAllInput and resets all static state being used here.
|
||||
void GameInterface::clearlocalinputstate()
|
||||
{
|
||||
WeaponToSend = 0;
|
||||
BitsToSend.value = 0;
|
||||
}
|
||||
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -295,8 +295,7 @@ void GameInterface::QuitToTitle()
|
|||
gQuitGame = true;
|
||||
gRestartGame = true;
|
||||
}
|
||||
else
|
||||
gQuitRequest = 2;
|
||||
//else gQuitRequest = 2;
|
||||
}
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -42,7 +42,6 @@ void sub_5571C(char mode);
|
|||
void sub_557C4(int x, int y, int interpolation);
|
||||
void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz, int smooth, int viewPlayer);
|
||||
int32_t registerosdcommands(void);
|
||||
void registerinputcommands(void);
|
||||
int qanimateoffs(int a1, int a2);
|
||||
int32_t qgetpalookup(int32_t a1, int32_t a2);
|
||||
void HookReplaceFunctions();
|
||||
|
|
|
@ -295,6 +295,21 @@ CCMD(invuse)
|
|||
ActionsToSend |= SB_INVUSE;
|
||||
}
|
||||
|
||||
CCMD(centerview)
|
||||
{
|
||||
ActionsToSend |= SB_CENTERVIEW;
|
||||
}
|
||||
|
||||
CCMD(turnaround)
|
||||
{
|
||||
ActionsToSend |= SB_TURNAROUND;
|
||||
}
|
||||
|
||||
CCMD(holsterweapon)
|
||||
{
|
||||
ActionsToSend |= SB_HOLSTER;
|
||||
}
|
||||
|
||||
CCMD(pause)
|
||||
{
|
||||
sendPause = true;
|
||||
|
@ -329,3 +344,24 @@ void ApplyGlobalInput(InputPacket& input, ControlInfo *info)
|
|||
ActionsToSend = 0;
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
void registerinputcommands()
|
||||
{
|
||||
C_RegisterFunction("centerview", nullptr, [](CCmdFuncPtr)->int { BitsToSend.lookCenter = 1; return CCMD_OK; });
|
||||
C_RegisterFunction("holsterweapon", nullptr, [](CCmdFuncPtr)->int { BitsToSend.holsterWeapon = 1; return CCMD_OK; });
|
||||
C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { BitsToSend.spin180 = 1; return CCMD_OK; });
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// CCMD based input. The basics are from Randi's ZDuke but this uses dynamic
|
||||
// registration to only have the commands active when this game module runs.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
C_RegisterFunction("backoff", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_ESCAPE; return CCMD_OK; });
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -66,11 +66,11 @@ int32_t handleevents(void);
|
|||
|
||||
enum GameFunction_t
|
||||
{
|
||||
gamefunc_Move_Forward,
|
||||
gamefunc_Move_Backward,
|
||||
gamefunc_Turn_Left,
|
||||
gamefunc_Turn_Right,
|
||||
gamefunc_Strafe,
|
||||
gamefunc_Move_Forward, //
|
||||
gamefunc_Move_Backward, //
|
||||
gamefunc_Turn_Left, //
|
||||
gamefunc_Turn_Right, //
|
||||
gamefunc_Strafe, //
|
||||
gamefunc_Fire,
|
||||
gamefunc_Open,
|
||||
gamefunc_Run,
|
||||
|
@ -81,8 +81,8 @@ enum GameFunction_t
|
|||
gamefunc_Look_Down,
|
||||
gamefunc_Look_Left,
|
||||
gamefunc_Look_Right,
|
||||
gamefunc_Strafe_Left,
|
||||
gamefunc_Strafe_Right,
|
||||
gamefunc_Strafe_Left, //
|
||||
gamefunc_Strafe_Right, //
|
||||
gamefunc_Aim_Up,
|
||||
gamefunc_Aim_Down,
|
||||
gamefunc_Shrink_Screen, // Automap only
|
||||
|
|
|
@ -18,14 +18,17 @@ enum ESyncBits_ : uint32_t
|
|||
SB_INVPREV = 1 << 11,
|
||||
SB_INVNEXT = 1 << 12,
|
||||
SB_INVUSE = 1 << 13,
|
||||
|
||||
SB_CENTERVIEW = 1 << 14,
|
||||
SB_TURNAROUND = 1 << 15,
|
||||
SB_HOLSTER = 1 << 16,
|
||||
|
||||
SB_WEAPONMASK_BITS = (15u * SB_FIRST_WEAPON_BIT), // Weapons take up 4 bits
|
||||
SB_ITEMUSE_BITS = (127u * SB_ITEM_BIT_1),
|
||||
|
||||
SB_BUTTON_MASK = 0, // all input from buttons (i.e. active while held)
|
||||
SB_INTERFACE_MASK = (SB_INVPREV|SB_INVNEXT|SB_INVUSE), // all input from CCMDs
|
||||
SB_INTERFACE_BITS = (SB_WEAPONMASK_BITS | SB_ITEMUSE_BITS | SB_INTERFACE_MASK)
|
||||
SB_INTERFACE_MASK = (SB_INVPREV|SB_INVNEXT|SB_INVUSE|SB_CENTERVIEW|SB_TURNAROUND|SB_HOLSTER), // all input from CCMDs
|
||||
SB_INTERFACE_BITS = (SB_WEAPONMASK_BITS | SB_ITEMUSE_BITS | SB_INTERFACE_MASK),
|
||||
SB_ALL = ~0u
|
||||
};
|
||||
|
||||
// enforce type safe operations on the input bits.
|
||||
|
@ -67,19 +70,13 @@ enum EDukeSyncBits_ : uint32_t
|
|||
SKB_LOOK_RIGHT = 1 << 7,
|
||||
SKB_LOOK_UP = 1 << 13,
|
||||
SKB_LOOK_DOWN = 1 << 14,
|
||||
SKB_MULTIFLAG = 1 << 17,
|
||||
SKB_CENTER_VIEW = 1 << 18,
|
||||
SKB_HOLSTER = 1 << 19,
|
||||
SKB_QUICK_KICK = 1 << 22,
|
||||
SKB_AIMMODE = 1 << 23,
|
||||
SKB_GAMEQUIT = 1 << 26,
|
||||
SKB_TURNAROUND = 1 << 28,
|
||||
SKB_OPEN = 1 << 29,
|
||||
SKB_ESCAPE = 1u << 31,
|
||||
|
||||
SKB_INTERFACE_BITS = (SKB_QUICK_KICK | \
|
||||
SKB_HOLSTER | \
|
||||
SKB_TURNAROUND | SKB_OPEN | SKB_ESCAPE),
|
||||
SKB_OPEN | SKB_ESCAPE),
|
||||
|
||||
SKB_NONE = 0,
|
||||
SKB_ALL = ~0u
|
||||
|
@ -102,15 +99,12 @@ union SYNCFLAGS
|
|||
unsigned int shoot2 : 1;
|
||||
unsigned int lookUp : 1;
|
||||
unsigned int lookDown : 1;
|
||||
|
||||
|
||||
unsigned int action : 1;
|
||||
unsigned int jab : 1;
|
||||
unsigned int holsterWeapon : 1;
|
||||
unsigned int lookCenter : 1;
|
||||
unsigned int lookLeft : 1;
|
||||
unsigned int lookRight : 1;
|
||||
unsigned int spin180 : 1;
|
||||
unsigned int quit : 1;
|
||||
unsigned int restart : 1;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -122,9 +116,7 @@ union SYNCFLAGS
|
|||
|
||||
|
||||
#define SK_AUTO_AIM 7
|
||||
#define SK_CENTER_VIEW 8
|
||||
|
||||
#define SK_MESSAGE 11
|
||||
#define SK_LOOK_UP 12
|
||||
#define SK_LOOK_DOWN 13
|
||||
#define SK_CRAWL_LOCK 14
|
||||
|
@ -137,11 +129,7 @@ union SYNCFLAGS
|
|||
#define SK_CRAWL 20
|
||||
#define SK_SNAP_UP 21
|
||||
#define SK_SNAP_DOWN 22
|
||||
#define SK_QUIT_GAME 23
|
||||
|
||||
#define SK_TURN_180 25
|
||||
|
||||
#define SK_HIDE_WEAPON 30
|
||||
#define SK_SPACE_BAR 31
|
||||
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_PS_NS
|
||||
|
||||
extern short bPlayerPan;
|
||||
extern short bLockPan;
|
||||
|
||||
extern const char* s_buildRev;
|
||||
extern const char* s_buildTimestamp;
|
||||
|
@ -58,7 +60,6 @@ BEGIN_PS_NS
|
|||
|
||||
void uploadCinemaPalettes();
|
||||
int32_t registerosdcommands(void);
|
||||
void registerinputcommands();
|
||||
void InitFonts();
|
||||
|
||||
int htimer = 0;
|
||||
|
@ -584,7 +585,17 @@ void GameTicker()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (localInput.actions & SB_CENTERVIEW)
|
||||
{
|
||||
bLockPan = false;
|
||||
bPlayerPan = false;
|
||||
PlayerList[nLocalPlayer].q16horiz = fix16_from_int(92);
|
||||
nDestVertPan[nLocalPlayer] = fix16_from_int(92);
|
||||
}
|
||||
if (localInput.actions & SB_TURNAROUND)
|
||||
{
|
||||
// todo
|
||||
}
|
||||
|
||||
|
||||
sPlayerInput[nLocalPlayer].xVel = lPlayerXVel;
|
||||
|
@ -687,7 +698,6 @@ void GameInterface::app_init()
|
|||
|
||||
SetCheats(excheats, countof(excheats));
|
||||
registerosdcommands();
|
||||
registerinputcommands();
|
||||
if (nNetPlayerCount == -1)
|
||||
{
|
||||
nNetPlayerCount = nCfgNetPlayers - 1;
|
||||
|
|
|
@ -252,7 +252,6 @@ struct GameInterface : ::GameInterface
|
|||
bool SaveGame(FSaveGameNode* sv) override;
|
||||
bool CanSave() override;
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize) override { return { 0, 24 }; }
|
||||
void clearlocalinputstate() override;
|
||||
void QuitToTitle();
|
||||
|
||||
FString statFPS() override;
|
||||
|
|
|
@ -31,7 +31,6 @@ BEGIN_PS_NS
|
|||
extern short bPlayerPan;
|
||||
extern short bLockPan;
|
||||
|
||||
int BitsToSend;
|
||||
bool g_MyAimMode;
|
||||
|
||||
short nInputStack = 0;
|
||||
|
@ -371,32 +370,4 @@ void PlayerInterruptKeys(bool after)
|
|||
}
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// CCMD based input. The basics are from Randi's ZDuke but this uses dynamic
|
||||
// registration to only have the commands active when this game module runs.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int ccmd_centerview(CCmdFuncPtr parm);
|
||||
|
||||
|
||||
void registerinputcommands()
|
||||
{
|
||||
C_RegisterFunction("centerview", nullptr, ccmd_centerview);
|
||||
|
||||
// These are only here to silence the engine when the keys bound to them are pressed. The functions do not exist.
|
||||
C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { return CCMD_OK; });
|
||||
C_RegisterFunction("holsterweapon", nullptr, [](CCmdFuncPtr)->int { return CCMD_OK; });
|
||||
|
||||
}
|
||||
|
||||
// This is called from ImputState::ClearAllInput and resets all static state being used here.
|
||||
void GameInterface::clearlocalinputstate()
|
||||
{
|
||||
BitsToSend = 0;
|
||||
|
||||
}
|
||||
|
||||
END_PS_NS
|
||||
END_PS_NS
|
||||
|
|
|
@ -2870,17 +2870,6 @@ loc_1BD2E:
|
|||
}
|
||||
}
|
||||
|
||||
int ccmd_centerview(CCmdFuncPtr parm)
|
||||
{
|
||||
return CCMD_OK;
|
||||
bLockPan = false;
|
||||
bPlayerPan = false;
|
||||
PlayerList[nLocalPlayer].q16horiz = fix16_from_int(92);
|
||||
nDestVertPan[nLocalPlayer] = fix16_from_int(92);
|
||||
return CCMD_OK;
|
||||
}
|
||||
|
||||
|
||||
static SavegameHelper sgh("player",
|
||||
SV(lPlayerXVel),
|
||||
SV(lPlayerYVel),
|
||||
|
|
|
@ -47,7 +47,6 @@ BEGIN_DUKE_NS
|
|||
void SetDispatcher();
|
||||
void InitCheats();
|
||||
int registerosdcommands(void);
|
||||
void registerinputcommands(void);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -331,7 +330,6 @@ static void Startup(void)
|
|||
InitCheats();
|
||||
checkcommandline();
|
||||
registerosdcommands();
|
||||
registerinputcommands();
|
||||
|
||||
screenpeek = myconnectindex;
|
||||
ps[myconnectindex].palette = BASEPAL;
|
||||
|
|
|
@ -197,6 +197,7 @@ int domovethings()
|
|||
GetNextInput();
|
||||
updateinterpolations();
|
||||
|
||||
#if 0
|
||||
j = -1;
|
||||
for (i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
|
@ -227,6 +228,7 @@ int domovethings()
|
|||
}
|
||||
else j = i;
|
||||
}
|
||||
#endif
|
||||
|
||||
//if(ud.recstat == 1) record();
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ int PHEIGHT = PHEIGHT_DUKE;
|
|||
int duke3d_globalflags;
|
||||
InputPacket loc;
|
||||
uint8_t ready2send;
|
||||
int gamequit;
|
||||
int playerswhenstarted;
|
||||
int show_shareware;
|
||||
int screenpeek;
|
||||
|
|
|
@ -52,7 +52,6 @@ extern int32_t PHEIGHT;
|
|||
extern int duke3d_globalflags;
|
||||
extern uint8_t ready2send;
|
||||
extern InputPacket loc;
|
||||
extern int gamequit;
|
||||
extern int playerswhenstarted;
|
||||
extern int show_shareware;
|
||||
extern int screenpeek;
|
||||
|
|
|
@ -146,6 +146,12 @@ inline ESyncBits PlayerInputBits(int pl, ESyncBits bits)
|
|||
return (sync[pl].actions & bits);
|
||||
}
|
||||
|
||||
inline void PlayerSetInput(int pl, ESyncBits bit)
|
||||
{
|
||||
sync[pl].actions |= bit;
|
||||
}
|
||||
|
||||
|
||||
inline int PlayerNewWeapon(int pl)
|
||||
{
|
||||
return sync[pl].getNewWeapon();
|
||||
|
|
|
@ -39,8 +39,6 @@ source as it is released.
|
|||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
static EDukeSyncBits BitsToSend;
|
||||
|
||||
// State timer counters.
|
||||
static int nonsharedtimer;
|
||||
static int turnheldtime;
|
||||
|
@ -336,7 +334,7 @@ void hud_input(int snum)
|
|||
// Here we have to be extra careful that the weapons do not get mixed up, so let's keep the code for Duke and RR completely separate.
|
||||
fi.selectweapon(snum, weap);
|
||||
|
||||
if (PlayerInput(snum, SKB_HOLSTER))
|
||||
if (PlayerInput(snum, SB_HOLSTER))
|
||||
{
|
||||
if (p->curr_weapon > KNEE_WEAPON)
|
||||
{
|
||||
|
@ -564,7 +562,7 @@ void hud_input(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
if (PlayerInput(snum, SKB_TURNAROUND) && p->one_eighty_count == 0)
|
||||
if (PlayerInput(snum, SB_TURNAROUND) && p->one_eighty_count == 0)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_TURNAROUND, -1, snum, -1);
|
||||
|
@ -612,13 +610,6 @@ static void processInputBits(player_struct *p, ControlInfo &info)
|
|||
if (buttonMap.ButtonDown(gamefunc_Fire)) loc.sbits |= SKB_FIRE;
|
||||
if (buttonMap.ButtonDown(gamefunc_Open)) loc.sbits |= SKB_OPEN;
|
||||
|
||||
// These 3 bits are only available when not riding a bike or boat.
|
||||
if (onVehicle) BitsToSend &= ~(SKB_HOLSTER|SKB_TURNAROUND|SKB_CENTER_VIEW);
|
||||
loc.sbits |= BitsToSend;
|
||||
BitsToSend = 0;
|
||||
|
||||
if (gamequit) loc.sbits |= SKB_GAMEQUIT;
|
||||
|
||||
if (!onVehicle)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Jump)) loc.sbits |= SKB_JUMP;
|
||||
|
@ -637,7 +628,12 @@ static void processInputBits(player_struct *p, ControlInfo &info)
|
|||
if (buttonMap.ButtonDown(gamefunc_Quick_Kick)) loc.sbits |= SKB_QUICK_KICK;
|
||||
if (in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming)) loc.sbits |= SKB_AIMMODE;
|
||||
|
||||
ApplyGlobalInput(loc, &info);
|
||||
}
|
||||
ApplyGlobalInput(loc, &info);
|
||||
if (onVehicle)
|
||||
{
|
||||
// mask out all actions not compatible with vehicles.
|
||||
loc.actions &= ~(SB_WEAPONMASK_BITS | SB_TURNAROUND | SB_CENTERVIEW | SB_HOLSTER);
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Dpad_Aiming))
|
||||
|
@ -1102,7 +1098,6 @@ void GetInput()
|
|||
if (paused)
|
||||
{
|
||||
loc = {};
|
||||
if (gamequit) loc.sbits |= SKB_GAMEQUIT;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1145,26 +1140,9 @@ void GetInput()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// CCMD based input. The basics are from Randi's ZDuke but this uses dynamic
|
||||
// registration to only have the commands active when this game module runs.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void registerinputcommands()
|
||||
{
|
||||
C_RegisterFunction("centerview", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_CENTER_VIEW; return CCMD_OK; });
|
||||
C_RegisterFunction("holsterweapon", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_HOLSTER; return CCMD_OK; });
|
||||
|
||||
C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_TURNAROUND; return CCMD_OK; });
|
||||
C_RegisterFunction("backoff", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_ESCAPE; return CCMD_OK; });
|
||||
}
|
||||
|
||||
// This is called from ImputState::ClearAllInput and resets all static state being used here.
|
||||
void GameInterface::clearlocalinputstate()
|
||||
{
|
||||
BitsToSend = 0;
|
||||
nonsharedtimer = 0;
|
||||
turnheldtime = 0;
|
||||
lastcontroltime = 0;
|
||||
|
|
|
@ -1264,7 +1264,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum
|
|||
|
||||
if (p->holster_weapon)
|
||||
{
|
||||
PlayerSetInput(snum, SKB_HOLSTER);
|
||||
PlayerSetInput(snum, SB_HOLSTER);
|
||||
p->weapon_pos = -9;
|
||||
}
|
||||
else if (j >= MIN_WEAPON && p->gotweapon[j] && (unsigned int)p->curr_weapon != j) switch (j)
|
||||
|
@ -2518,14 +2518,14 @@ static void operateweapon(int snum, EDukeSyncBits sb_snum, int psect)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void processweapon(int snum, EDukeSyncBits sb_snum, int psect)
|
||||
static void processweapon(int snum, ESyncBits actions, EDukeSyncBits sb_snum, int psect)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
int pi = p->i;
|
||||
auto s = &sprite[pi];
|
||||
int shrunk = (s->yrepeat < 32);
|
||||
|
||||
if (isNamWW2GI() && (sb_snum & SKB_HOLSTER)) // 'Holster Weapon
|
||||
if (isNamWW2GI() && (actions & SB_HOLSTER)) // 'Holster Weapon
|
||||
{
|
||||
if (isWW2GI())
|
||||
{
|
||||
|
@ -2604,6 +2604,7 @@ void processinput_d(int snum)
|
|||
int j, i, k, doubvel, fz, cz, hz, lz, truefdist;
|
||||
char shrunk;
|
||||
EDukeSyncBits sb_snum;
|
||||
ESyncBits actions;
|
||||
short psect, psectlotag, pi;
|
||||
struct player_struct* p;
|
||||
spritetype* s;
|
||||
|
@ -2615,6 +2616,7 @@ void processinput_d(int snum)
|
|||
resetinputhelpers(p);
|
||||
|
||||
sb_snum = PlayerInputBits(snum, SKB_ALL);
|
||||
actions = PlayerInputBits(snum, SB_ALL);
|
||||
|
||||
auto sb_fvel = PlayerInputForwardVel(snum);
|
||||
auto sb_svel = PlayerInputSideVel(snum);
|
||||
|
@ -2737,8 +2739,8 @@ void processinput_d(int snum)
|
|||
|
||||
fi.doincrements(p);
|
||||
|
||||
if (isWW2GI() && aplWeaponWorksLike[p->curr_weapon][snum] == HANDREMOTE_WEAPON) processweapon(snum, sb_snum, psect);
|
||||
if (!isWW2GI() && p->curr_weapon == HANDREMOTE_WEAPON) processweapon(snum, sb_snum, psect);
|
||||
if (isWW2GI() && aplWeaponWorksLike[p->curr_weapon][snum] == HANDREMOTE_WEAPON) processweapon(snum, actions, sb_snum, psect);
|
||||
if (!isWW2GI() && p->curr_weapon == HANDREMOTE_WEAPON) processweapon(snum, actions, sb_snum, psect);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3001,7 +3003,7 @@ HORIZONLY:
|
|||
}
|
||||
|
||||
// center_view
|
||||
if (sb_snum & SKB_CENTER_VIEW || p->hard_landing)
|
||||
if (actions & SB_CENTERVIEW || p->hard_landing)
|
||||
{
|
||||
playerCenterView(snum);
|
||||
}
|
||||
|
@ -3066,12 +3068,7 @@ HORIZONLY:
|
|||
}
|
||||
|
||||
// HACKS
|
||||
processweapon(snum, sb_snum, psect);
|
||||
}
|
||||
|
||||
void processweapon_d(int s, EDukeSyncBits ss, int p)
|
||||
{
|
||||
processweapon(s, ss, p);
|
||||
processweapon(snum, actions, sb_snum, psect);
|
||||
}
|
||||
|
||||
void processmove_d(int snum, EDukeSyncBits sb_snum, int psect, int fz, int cz, int shrunk, int truefdist)
|
||||
|
|
|
@ -1067,7 +1067,7 @@ void selectweapon_r(int snum, int weap)
|
|||
|
||||
if (p->holster_weapon)
|
||||
{
|
||||
PlayerSetInput(snum, SKB_HOLSTER);
|
||||
PlayerSetInput(snum, SB_HOLSTER);
|
||||
p->weapon_pos = -9;
|
||||
}
|
||||
else if (j >= MIN_WEAPON && p->gotweapon[j] && p->curr_weapon != j) switch (j)
|
||||
|
@ -3402,6 +3402,7 @@ void processinput_r(int snum)
|
|||
int j, i, k, doubvel, fz, cz, hz, lz, truefdist, var60;
|
||||
char shrunk;
|
||||
EDukeSyncBits sb_snum;
|
||||
ESyncBits actions;
|
||||
short psect, psectlotag, pi;
|
||||
struct player_struct* p;
|
||||
spritetype* s;
|
||||
|
@ -3413,6 +3414,7 @@ void processinput_r(int snum)
|
|||
resetinputhelpers(p);
|
||||
|
||||
sb_snum = PlayerInputBits(snum, SKB_ALL);
|
||||
actions = PlayerInputBits(snum, SB_ALL);
|
||||
|
||||
auto sb_fvel = PlayerInputForwardVel(snum);
|
||||
auto sb_svel = PlayerInputSideVel(snum);
|
||||
|
@ -4027,7 +4029,7 @@ HORIZONLY:
|
|||
return;
|
||||
}
|
||||
|
||||
if (sb_snum & SKB_CENTER_VIEW || p->hard_landing)
|
||||
if (actions & SB_CENTERVIEW || p->hard_landing)
|
||||
{
|
||||
playerCenterView(snum);
|
||||
}
|
||||
|
@ -4103,11 +4105,6 @@ HORIZONLY:
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void processweapon_r(int s, EDukeSyncBits ss, int p)
|
||||
{
|
||||
processweapon(s, ss, p);
|
||||
}
|
||||
|
||||
void processmove_r(int snum, EDukeSyncBits sb_snum, int psect, int fz, int cz, int shrunk, int truefdist)
|
||||
{
|
||||
int psectlotag = sector[psect].lotag;
|
||||
|
|
|
@ -198,7 +198,6 @@ void GameInterface::app_init()
|
|||
Printf("Copyright (c) 1997 3D Realms Entertainment\n");
|
||||
|
||||
registerosdcommands();
|
||||
registerinputcommands();
|
||||
|
||||
engineInit();
|
||||
auto pal = fileSystem.LoadFile("3drealms.pal", 0);
|
||||
|
|
|
@ -2223,7 +2223,6 @@ void LoadSaveMsg(const char *msg);
|
|||
void UpdateStatusBar(int arg);
|
||||
void InitFonts();
|
||||
int32_t registerosdcommands(void);
|
||||
void registerinputcommands();
|
||||
void SW_InitMultiPsky(void);
|
||||
|
||||
extern int PlayClock;
|
||||
|
@ -2269,7 +2268,6 @@ struct GameInterface : ::GameInterface
|
|||
void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); }
|
||||
FString GetCoordString() override;
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize) override;
|
||||
void clearlocalinputstate() override;
|
||||
void QuitToTitle() override;
|
||||
void ResetFollowPos(bool message) override;
|
||||
|
||||
|
|
|
@ -34,11 +34,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
BEGIN_SW_NS
|
||||
|
||||
SWBOOL MultiPlayQuitFlag = FALSE;
|
||||
|
||||
int BitsToSend = 0;
|
||||
|
||||
|
||||
void
|
||||
FunctionKeys(PLAYERp pp)
|
||||
{
|
||||
|
@ -118,9 +113,6 @@ getinput(InputPacket *loc, SWBOOL tied)
|
|||
|
||||
lastInputTicks = currentHiTicks;
|
||||
|
||||
// MAKE SURE THIS WILL GET SET
|
||||
SET_LOC_KEY(loc->bits, SK_QUIT_GAME, MultiPlayQuitFlag);
|
||||
|
||||
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
|
||||
|
||||
if (!CommEnabled)
|
||||
|
@ -419,9 +411,6 @@ getinput(InputPacket *loc, SWBOOL tied)
|
|||
}
|
||||
|
||||
|
||||
loc->bits |= BitsToSend;
|
||||
BitsToSend = 0;
|
||||
|
||||
SET_LOC_KEY(loc->bits, SK_OPERATE, buttonMap.ButtonDown(gamefunc_Open));
|
||||
SET_LOC_KEY(loc->bits, SK_JUMP, buttonMap.ButtonDown(gamefunc_Jump));
|
||||
SET_LOC_KEY(loc->bits, SK_CRAWL, buttonMap.ButtonDown(gamefunc_Crouch));
|
||||
|
@ -459,27 +448,4 @@ getinput(InputPacket *loc, SWBOOL tied)
|
|||
FunctionKeys(pp);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// CCMD based input. The basics are from Randi's ZDuke but this uses dynamic
|
||||
// registration to only have the commands active when this game module runs.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void registerinputcommands()
|
||||
{
|
||||
C_RegisterFunction("centerview", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= BIT(SK_CENTER_VIEW); return CCMD_OK; });
|
||||
C_RegisterFunction("holsterweapon", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= BIT(SK_HIDE_WEAPON); return CCMD_OK; });
|
||||
|
||||
C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= BIT(SK_TURN_180); return CCMD_OK; });
|
||||
}
|
||||
|
||||
// This is called from ImputState::ClearAllInput and resets all static state being used here.
|
||||
void GameInterface::clearlocalinputstate()
|
||||
{
|
||||
BitsToSend = 0;
|
||||
|
||||
}
|
||||
|
||||
END_SW_NS
|
||||
|
|
|
@ -6627,18 +6627,18 @@ pWeaponUnHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (TEST_SYNC_KEY(psp->PlayerP, SK_HIDE_WEAPON))
|
||||
if (psp->PlayerP->input.actions & SB_HOLSTER)
|
||||
{
|
||||
if (FLAG_KEY_PRESSED(psp->PlayerP, SK_HIDE_WEAPON))
|
||||
if (psp->PlayerP->KeyPressBits & SB_HOLSTER)
|
||||
{
|
||||
FLAG_KEY_RELEASE(psp->PlayerP, SK_HIDE_WEAPON);
|
||||
psp->PlayerP->KeyPressBits &= ~SB_HOLSTER;
|
||||
pSetState(psp, state);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FLAG_KEY_RESET(psp->PlayerP, SK_HIDE_WEAPON);
|
||||
psp->PlayerP->KeyPressBits |= SB_HOLSTER;
|
||||
}
|
||||
|
||||
if (TEST_SYNC_KEY(psp->PlayerP, SK_SHOOT))
|
||||
|
@ -6671,19 +6671,19 @@ pWeaponHideKeys(PANEL_SPRITEp psp, PANEL_STATEp state)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (TEST_SYNC_KEY(psp->PlayerP, SK_HIDE_WEAPON))
|
||||
if (psp->PlayerP->input.actions & SB_HOLSTER)
|
||||
{
|
||||
if (FLAG_KEY_PRESSED(psp->PlayerP, SK_HIDE_WEAPON))
|
||||
if (psp->PlayerP->KeyPressBits & SB_HOLSTER)
|
||||
{
|
||||
psp->PlayerP->KeyPressBits &= ~SB_HOLSTER;
|
||||
PutStringInfo(psp->PlayerP,"Weapon Holstered");
|
||||
FLAG_KEY_RELEASE(psp->PlayerP, SK_HIDE_WEAPON);
|
||||
pSetState(psp, state);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FLAG_KEY_RESET(psp->PlayerP, SK_HIDE_WEAPON);
|
||||
psp->PlayerP->KeyPressBits |= SB_HOLSTER;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -1566,13 +1566,13 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel)
|
|||
|
||||
if (!TEST(pp->Flags, PF_TURN_180))
|
||||
{
|
||||
if (TEST_SYNC_KEY(pp, SK_TURN_180))
|
||||
if (pp->input.actions & SB_TURNAROUND)
|
||||
{
|
||||
if (FLAG_KEY_PRESSED(pp, SK_TURN_180))
|
||||
if (pp->KeyPressBits & SB_TURNAROUND)
|
||||
{
|
||||
short delta_ang;
|
||||
|
||||
FLAG_KEY_RELEASE(pp, SK_TURN_180);
|
||||
pp->KeyPressBits &= ~SB_TURNAROUND;
|
||||
|
||||
pp->turn180_target = NORM_ANGLE(fix16_to_int(*pq16ang) + 1024);
|
||||
|
||||
|
@ -1591,7 +1591,7 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel)
|
|||
}
|
||||
else
|
||||
{
|
||||
FLAG_KEY_RESET(pp, SK_TURN_180);
|
||||
pp->KeyPressBits |= SB_TURNAROUND;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1938,7 +1938,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
|
|||
SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING);
|
||||
}
|
||||
|
||||
if (TEST_SYNC_KEY(pp, SK_CENTER_VIEW))
|
||||
if (pp->input.actions & SB_CENTERVIEW)
|
||||
{
|
||||
if (PedanticMode)
|
||||
pp->q16horizbase = fix16_from_int(100);
|
||||
|
|
|
@ -83,18 +83,16 @@ DoPrediction(PLAYERp ppp)
|
|||
|
||||
// get rid of input bits so it doesn't go into other code branches that would
|
||||
// get it out of sync
|
||||
ppp->input.actions &= ~(SB_WEAPONMASK_BITS|SB_ITEMUSE_BITS);
|
||||
ppp->KeyPressBits |= (SB_WEAPONMASK_BITS|SB_ITEMUSE_BITS|SB_INVNEXT|SB_INVPREV|SB_INVUSE);
|
||||
ppp->input.actions &= ~(SB_WEAPONMASK_BITS|SB_ITEMUSE_BITS|SB_HOLSTER|SB_CENTERVIEW);
|
||||
ppp->KeyPressBits |= (SB_WEAPONMASK_BITS|SB_ITEMUSE_BITS|SB_INVNEXT|SB_INVPREV|SB_INVUSE|SB_HOLSTER|SB_CENTERVIEW);
|
||||
RESET(ppp->input.bits,
|
||||
BIT(SK_SHOOT)|BIT(SK_OPERATE)|BIT(SK_HIDE_WEAPON)|
|
||||
BIT(SK_AUTO_AIM)|
|
||||
BIT(SK_CENTER_VIEW)
|
||||
BIT(SK_SHOOT)|BIT(SK_OPERATE)|
|
||||
BIT(SK_AUTO_AIM)
|
||||
);
|
||||
|
||||
SET(ppp->KeyPressFlags,
|
||||
BIT(SK_SHOOT)|BIT(SK_OPERATE)|BIT(SK_HIDE_WEAPON)|
|
||||
BIT(SK_AUTO_AIM)|
|
||||
BIT(SK_CENTER_VIEW)
|
||||
BIT(SK_SHOOT)|BIT(SK_OPERATE)|
|
||||
BIT(SK_AUTO_AIM)
|
||||
);
|
||||
|
||||
// back up things so they won't get stepped on
|
||||
|
|
Loading…
Reference in a new issue