mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-18 23:21:43 +00:00
Start rewriting input code
This commit is contained in:
parent
4dcde5dde7
commit
941e47cc61
9 changed files with 164 additions and 107 deletions
|
@ -397,6 +397,12 @@ void CONFIG_SetDefaults()
|
||||||
NumBits = 16;
|
NumBits = 16;
|
||||||
NumVoices = 32;
|
NumVoices = 32;
|
||||||
|
|
||||||
|
mouseaiming = 0;
|
||||||
|
aimmode = 1;
|
||||||
|
mouseflip = 0;
|
||||||
|
runkey_mode = 0;
|
||||||
|
auto_run = 1;
|
||||||
|
|
||||||
CONFIG_SetDefaultKeys(keydefaults);
|
CONFIG_SetDefaultKeys(keydefaults);
|
||||||
|
|
||||||
memset(MouseFunctions, -1, sizeof(MouseFunctions));
|
memset(MouseFunctions, -1, sizeof(MouseFunctions));
|
||||||
|
|
|
@ -634,6 +634,9 @@ char debugBuffer[256];
|
||||||
|
|
||||||
short wConsoleNode; // TODO - move me into network file
|
short wConsoleNode; // TODO - move me into network file
|
||||||
|
|
||||||
|
int mouseaiming, aimmode, mouseflip;
|
||||||
|
int runkey_mode, auto_run;
|
||||||
|
|
||||||
|
|
||||||
void DebugOut(const char *fmt, ...)
|
void DebugOut(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
@ -915,25 +918,25 @@ void CheckKeys()
|
||||||
CONTROL_ClearButton(gamefunc_Enlarge_Screen);
|
CONTROL_ClearButton(gamefunc_Enlarge_Screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BUTTON(gamefunc_Mouse_Sensitivity_Up))
|
// if (BUTTON(gamefunc_Mouse_Sensitivity_Up))
|
||||||
{
|
// {
|
||||||
if (lMouseSens < 64)
|
// if (lMouseSens < 64)
|
||||||
lMouseSens++;
|
// lMouseSens++;
|
||||||
|
//
|
||||||
CONTROL_ClearButton(gamefunc_Mouse_Sensitivity_Up);
|
// CONTROL_ClearButton(gamefunc_Mouse_Sensitivity_Up);
|
||||||
StatusMessage(500, "MOUSE SENSITIVITY SET TO %d", lMouseSens);
|
// StatusMessage(500, "MOUSE SENSITIVITY SET TO %d", lMouseSens);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
if (BUTTON(gamefunc_Mouse_Sensitivity_Down))
|
// if (BUTTON(gamefunc_Mouse_Sensitivity_Down))
|
||||||
{
|
// {
|
||||||
if (lMouseSens >= 1)
|
// if (lMouseSens >= 1)
|
||||||
lMouseSens -= 1;
|
// lMouseSens -= 1;
|
||||||
|
//
|
||||||
CONTROL_ClearButton(gamefunc_Mouse_Sensitivity_Down);
|
// CONTROL_ClearButton(gamefunc_Mouse_Sensitivity_Down);
|
||||||
StatusMessage(500, "MOUSE SENSITIVITY SET TO %d", lMouseSens);
|
// StatusMessage(500, "MOUSE SENSITIVITY SET TO %d", lMouseSens);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// F11?
|
// F11?
|
||||||
if (BUTTON(gamefunc_Gamma_Correction))
|
if (BUTTON(gamefunc_Gamma_Correction))
|
||||||
|
@ -2197,7 +2200,7 @@ LOOP3:
|
||||||
sPlayerInput[nLocalPlayer].xVel = lPlayerXVel;
|
sPlayerInput[nLocalPlayer].xVel = lPlayerXVel;
|
||||||
sPlayerInput[nLocalPlayer].yVel = lPlayerYVel;
|
sPlayerInput[nLocalPlayer].yVel = lPlayerYVel;
|
||||||
sPlayerInput[nLocalPlayer].buttons = lLocalButtons | lLocalCodes;
|
sPlayerInput[nLocalPlayer].buttons = lLocalButtons | lLocalCodes;
|
||||||
sPlayerInput[nLocalPlayer].nAngle = nPlayerDAng;
|
sPlayerInput[nLocalPlayer].nAngle = fix16_from_int(nPlayerDAng)<<2;
|
||||||
sPlayerInput[nLocalPlayer].nTarget = besttarget;
|
sPlayerInput[nLocalPlayer].nTarget = besttarget;
|
||||||
|
|
||||||
Ra[nLocalPlayer].nTarget = besttarget;
|
Ra[nLocalPlayer].nTarget = besttarget;
|
||||||
|
|
|
@ -186,6 +186,9 @@ extern short bNoSound;
|
||||||
|
|
||||||
extern int bVanilla;
|
extern int bVanilla;
|
||||||
|
|
||||||
|
extern int mouseaiming, aimmode, mouseflip;
|
||||||
|
extern int runkey_mode, auto_run;
|
||||||
|
|
||||||
extern char g_modDir[BMAX_PATH];
|
extern char g_modDir[BMAX_PATH];
|
||||||
enum {
|
enum {
|
||||||
kPalNormal = 0,
|
kPalNormal = 0,
|
||||||
|
|
|
@ -20,10 +20,12 @@ struct PlayerInput
|
||||||
{
|
{
|
||||||
int xVel;
|
int xVel;
|
||||||
int yVel;
|
int yVel;
|
||||||
short nAngle;
|
// short nAngle;
|
||||||
|
fix16_t nAngle;
|
||||||
uint16_t buttons;
|
uint16_t buttons;
|
||||||
short nTarget;
|
short nTarget;
|
||||||
uint8_t horizon;
|
// uint8_t horizon;
|
||||||
|
fix16_t horizon;
|
||||||
int8_t nItem;
|
int8_t nItem;
|
||||||
int h;
|
int h;
|
||||||
char i;
|
char i;
|
||||||
|
|
|
@ -525,7 +525,7 @@ int32_t registerosdcommands(void)
|
||||||
|
|
||||||
//{ "cl_autoaim", "enable/disable weapon autoaim", (void *)&ud.config.AutoAim, CVAR_INT|CVAR_MULTI, 0, 3 },
|
//{ "cl_autoaim", "enable/disable weapon autoaim", (void *)&ud.config.AutoAim, CVAR_INT|CVAR_MULTI, 0, 3 },
|
||||||
//{ "cl_automsg", "enable/disable automatically sending messages to all players", (void *)&ud.automsg, CVAR_BOOL, 0, 1 },
|
//{ "cl_automsg", "enable/disable automatically sending messages to all players", (void *)&ud.automsg, CVAR_BOOL, 0, 1 },
|
||||||
//{ "cl_autorun", "enable/disable autorun", (void *)&ud.auto_run, CVAR_BOOL, 0, 1 },
|
{ "cl_autorun", "enable/disable autorun", (void *)&auto_run, CVAR_BOOL, 0, 1 },
|
||||||
|
|
||||||
//{ "cl_autosave", "enable/disable autosaves", (void *) &ud.autosave, CVAR_BOOL, 0, 1 },
|
//{ "cl_autosave", "enable/disable autosaves", (void *) &ud.autosave, CVAR_BOOL, 0, 1 },
|
||||||
//{ "cl_autosavedeletion", "enable/disable automatic deletion of autosaves", (void *) &ud.autosavedeletion, CVAR_BOOL, 0, 1 },
|
//{ "cl_autosavedeletion", "enable/disable automatic deletion of autosaves", (void *) &ud.autosavedeletion, CVAR_BOOL, 0, 1 },
|
||||||
|
@ -540,7 +540,7 @@ int32_t registerosdcommands(void)
|
||||||
|
|
||||||
//{ "cl_idplayers", "enable/disable name display when aiming at opponents", (void *)&ud.idplayers, CVAR_BOOL, 0, 1 },
|
//{ "cl_idplayers", "enable/disable name display when aiming at opponents", (void *)&ud.idplayers, CVAR_BOOL, 0, 1 },
|
||||||
|
|
||||||
//{ "cl_runmode", "enable/disable modernized run key operation", (void *)&ud.runkey_mode, CVAR_BOOL, 0, 1 },
|
{ "cl_runmode", "enable/disable modernized run key operation", (void *)&runkey_mode, CVAR_BOOL, 0, 1 },
|
||||||
|
|
||||||
// { "cl_showcoords", "show your position in the game world", (void *)&ud.coords, CVAR_INT, 0,
|
// { "cl_showcoords", "show your position in the game world", (void *)&ud.coords, CVAR_INT, 0,
|
||||||
//#ifdef USE_OPENGL
|
//#ifdef USE_OPENGL
|
||||||
|
@ -597,14 +597,14 @@ int32_t registerosdcommands(void)
|
||||||
{ "in_joystick","enables input from the joystick if it is present",(void *)&gSetup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
{ "in_joystick","enables input from the joystick if it is present",(void *)&gSetup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
||||||
{ "in_mouse","enables input from the mouse if it is present",(void *)&gSetup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
{ "in_mouse","enables input from the mouse if it is present",(void *)&gSetup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
|
||||||
|
|
||||||
//{ "in_aimmode", "0:toggle, 1:hold to aim", (void *)&ud.mouseaiming, CVAR_BOOL, 0, 1 },
|
{ "in_aimmode", "0:toggle, 1:hold to aim", (void *)&mouseaiming, CVAR_BOOL, 0, 1 },
|
||||||
{
|
{
|
||||||
"in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time",
|
"in_mousebias", "emulates the original mouse code's weighting of input towards whichever axis is moving the most at any given time",
|
||||||
(void *)&MouseBias, CVAR_INT, 0, 32
|
(void *)&MouseBias, CVAR_INT, 0, 32
|
||||||
},
|
},
|
||||||
{ "in_mousedeadzone", "amount of mouse movement to filter out", (void *)&MouseDeadZone, CVAR_INT, 0, 512 },
|
{ "in_mousedeadzone", "amount of mouse movement to filter out", (void *)&MouseDeadZone, CVAR_INT, 0, 512 },
|
||||||
//{ "in_mouseflip", "invert vertical mouse movement", (void *)&ud.mouseflip, CVAR_BOOL, 0, 1 },
|
{ "in_mouseflip", "invert vertical mouse movement", (void *)&mouseflip, CVAR_BOOL, 0, 1 },
|
||||||
//{ "in_mousemode", "toggles vertical mouse view", (void *)&g_myAimMode, CVAR_BOOL, 0, 1 },
|
{ "in_mousemode", "toggles vertical mouse view", (void *)&aimmode, CVAR_BOOL, 0, 1 },
|
||||||
{ "in_mousesmoothing", "enable/disable mouse input smoothing", (void *)&SmoothInput, CVAR_BOOL, 0, 1 },
|
{ "in_mousesmoothing", "enable/disable mouse input smoothing", (void *)&SmoothInput, CVAR_BOOL, 0, 1 },
|
||||||
|
|
||||||
//{ "mus_enabled", "enables/disables music", (void *)&ud.config.MusicToggle, CVAR_BOOL, 0, 1 },
|
//{ "mus_enabled", "enables/disables music", (void *)&ud.config.MusicToggle, CVAR_BOOL, 0, 1 },
|
||||||
|
|
|
@ -144,6 +144,27 @@ void PlayerInterruptKeys()
|
||||||
memset(&info, 0, sizeof(ControlInfo)); // this is done within CONTROL_GetInput() anyway
|
memset(&info, 0, sizeof(ControlInfo)); // this is done within CONTROL_GetInput() anyway
|
||||||
CONTROL_GetInput(&info);
|
CONTROL_GetInput(&info);
|
||||||
|
|
||||||
|
if (MouseDeadZone)
|
||||||
|
{
|
||||||
|
if (info.mousey > 0)
|
||||||
|
info.mousey = max(info.mousey - MouseDeadZone, 0);
|
||||||
|
else if (info.mousey < 0)
|
||||||
|
info.mousey = min(info.mousey + MouseDeadZone, 0);
|
||||||
|
|
||||||
|
if (info.mousex > 0)
|
||||||
|
info.mousex = max(info.mousex - MouseDeadZone, 0);
|
||||||
|
else if (info.mousex < 0)
|
||||||
|
info.mousex = min(info.mousex + MouseDeadZone, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MouseBias)
|
||||||
|
{
|
||||||
|
if (klabs(info.mousex) > klabs(info.mousey))
|
||||||
|
info.mousey = tabledivide32_noinline(info.mousey, MouseBias);
|
||||||
|
else
|
||||||
|
info.mousex = tabledivide32_noinline(info.mousex, MouseBias);
|
||||||
|
}
|
||||||
|
|
||||||
if (PlayerList[nLocalPlayer].nHealth == 0)
|
if (PlayerList[nLocalPlayer].nHealth == 0)
|
||||||
{
|
{
|
||||||
lPlayerYVel = 0;
|
lPlayerYVel = 0;
|
||||||
|
@ -152,6 +173,13 @@ void PlayerInterruptKeys()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JBF: Run key behaviour is selectable
|
||||||
|
int const playerRunning = (runkey_mode) ? (BUTTON(gamefunc_Run) | auto_run) : (auto_run ^ BUTTON(gamefunc_Run));
|
||||||
|
int const turnAmount = playerRunning ? 12 : 8;
|
||||||
|
constexpr int const analogExtent = 32767; // KEEPINSYNC sdlayer.cpp
|
||||||
|
|
||||||
|
int fvel = 0;
|
||||||
|
|
||||||
info.dyaw *= (lMouseSens >> 1) + 1;
|
info.dyaw *= (lMouseSens >> 1) + 1;
|
||||||
|
|
||||||
int nXVel, nYVel;
|
int nXVel, nYVel;
|
||||||
|
@ -160,13 +188,13 @@ void PlayerInterruptKeys()
|
||||||
|
|
||||||
if (BUTTON(gamefunc_Run))
|
if (BUTTON(gamefunc_Run))
|
||||||
{
|
{
|
||||||
nXVel = Sin(inita + 512) * 12;
|
nXVel = Cos(inita) * 12;
|
||||||
nYVel = sintable[inita] * 12;
|
nYVel = Sin(inita) * 12;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nXVel = Sin(inita + 512) * 6;
|
nXVel = Cos(inita) * 6;
|
||||||
nYVel = sintable[inita] * 6;
|
nYVel = Sin(inita) * 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
// loc_18E60
|
// loc_18E60
|
||||||
|
@ -180,44 +208,52 @@ void PlayerInterruptKeys()
|
||||||
lPlayerXVel -= nXVel;
|
lPlayerXVel -= nXVel;
|
||||||
lPlayerYVel -= nYVel;
|
lPlayerYVel -= nYVel;
|
||||||
}
|
}
|
||||||
else if (info.dz)
|
if (info.mousey)
|
||||||
{
|
{
|
||||||
if (info.dz < -6400)
|
if (info.mousey < -6400)
|
||||||
{
|
{
|
||||||
info.dz = -6400;
|
info.mousey = -6400;
|
||||||
}
|
}
|
||||||
else if (info.dz > 6400)
|
else if (info.mousey > 6400)
|
||||||
{
|
{
|
||||||
info.dz = 6400;
|
info.mousey = 6400;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mouseaiming)
|
||||||
|
aimmode = BUTTON(gamefunc_Mouseview);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CONTROL_ClearButton(gamefunc_Mouseview);
|
||||||
|
aimmode = !aimmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// loc_18EE4
|
// loc_18EE4
|
||||||
if (BUTTON(gamefunc_Mouseview))
|
if (aimmode)
|
||||||
{
|
{
|
||||||
int nVPan = nVertPan[nLocalPlayer] - (info.dz >> 7);
|
fix16_t nVPan = nVertPan[nLocalPlayer] - fix16_from_int((info.mousey >> 7));
|
||||||
|
|
||||||
if (nVPan < 0)
|
if (nVPan < F16(0))
|
||||||
{
|
{
|
||||||
nVPan = 0;
|
nVPan = F16(0);
|
||||||
}
|
}
|
||||||
else if (nVPan > 184)
|
else if (nVPan > F16(184))
|
||||||
{
|
{
|
||||||
nVPan = 184;
|
nVPan = F16(184);
|
||||||
}
|
}
|
||||||
|
|
||||||
nVertPan[nLocalPlayer] = nVPan;
|
nVertPan[nLocalPlayer] = nVPan;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (BUTTON(gamefunc_Run))
|
if (BUTTON(gamefunc_Run))
|
||||||
{
|
{
|
||||||
lPlayerXVel += Sin(inita + 512) * ((-info.dz) >> 7);
|
lPlayerXVel += Cos(inita) * ((-info.mousey) >> 7);
|
||||||
lPlayerYVel += Sin(inita) * ((-info.dz) >> 7);
|
lPlayerYVel += Sin(inita) * ((-info.mousey) >> 7);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lPlayerXVel += Sin(inita + 512) * ((-info.dz) >> 8);
|
lPlayerXVel += Cos(inita) * ((-info.mousey) >> 8);
|
||||||
lPlayerYVel += Sin(inita) * ((-info.dz) >> 8);
|
lPlayerYVel += Sin(inita) * ((-info.mousey) >> 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -509,7 +545,8 @@ void RestartPlayer(short nPlayer)
|
||||||
sprite[nSprite].y = sprite[nNStartSprite].y;
|
sprite[nSprite].y = sprite[nNStartSprite].y;
|
||||||
sprite[nSprite].z = sprite[nNStartSprite].z;
|
sprite[nSprite].z = sprite[nNStartSprite].z;
|
||||||
mychangespritesect(nSprite, sprite[nNStartSprite].sectnum);
|
mychangespritesect(nSprite, sprite[nNStartSprite].sectnum);
|
||||||
sprite[nSprite].ang = sprite[nNStartSprite].ang;
|
PlayerList[nPlayer].q16angle = fix16_from_int(sprite[nNStartSprite].ang&kAngleMask);
|
||||||
|
sprite[nSprite].ang = fix16_to_int(PlayerList[nPlayer].q16angle);
|
||||||
|
|
||||||
floorspr = insertsprite(sprite[nSprite].sectnum, 0);
|
floorspr = insertsprite(sprite[nSprite].sectnum, 0);
|
||||||
assert(floorspr >= 0 && floorspr < kMaxSprites);
|
assert(floorspr >= 0 && floorspr < kMaxSprites);
|
||||||
|
@ -527,7 +564,8 @@ void RestartPlayer(short nPlayer)
|
||||||
sprite[nSprite].x = sPlayerSave[nPlayer].x;
|
sprite[nSprite].x = sPlayerSave[nPlayer].x;
|
||||||
sprite[nSprite].y = sPlayerSave[nPlayer].y;
|
sprite[nSprite].y = sPlayerSave[nPlayer].y;
|
||||||
sprite[nSprite].z = sector[sPlayerSave[nPlayer].nSector].floorz;
|
sprite[nSprite].z = sector[sPlayerSave[nPlayer].nSector].floorz;
|
||||||
sprite[nSprite].ang = sPlayerSave[nPlayer].nAngle;
|
PlayerList[nPlayer].q16angle = fix16_from_int(sPlayerSave[nPlayer].nAngle&kAngleMask);
|
||||||
|
sprite[nSprite].ang = fix16_to_int(PlayerList[nPlayer].q16angle);
|
||||||
|
|
||||||
floorspr = -1;
|
floorspr = -1;
|
||||||
}
|
}
|
||||||
|
@ -630,8 +668,8 @@ void RestartPlayer(short nPlayer)
|
||||||
nYDamage[nPlayer] = 0;
|
nYDamage[nPlayer] = 0;
|
||||||
nXDamage[nPlayer] = 0;
|
nXDamage[nPlayer] = 0;
|
||||||
|
|
||||||
nVertPan[nPlayer] = 92;
|
nVertPan[nPlayer] = F16(92);
|
||||||
nDestVertPan[nPlayer] = 92;
|
nDestVertPan[nPlayer] = F16(92);
|
||||||
nBreathTimer[nPlayer] = 90;
|
nBreathTimer[nPlayer] = 90;
|
||||||
|
|
||||||
nTauntTimer[nPlayer] = RandomSize(3) + 3;
|
nTauntTimer[nPlayer] = RandomSize(3) + 3;
|
||||||
|
@ -732,7 +770,7 @@ void StartDeathSeq(int nPlayer, int nVal)
|
||||||
|
|
||||||
StopFiringWeapon(nPlayer);
|
StopFiringWeapon(nPlayer);
|
||||||
|
|
||||||
nVertPan[nPlayer] = 92;
|
nVertPan[nPlayer] = F16(92);
|
||||||
eyelevel[nPlayer] = -14080;
|
eyelevel[nPlayer] = -14080;
|
||||||
nPlayerInvisible[nPlayer] = 0;
|
nPlayerInvisible[nPlayer] = 0;
|
||||||
dVertPan[nPlayer] = 15;
|
dVertPan[nPlayer] = 15;
|
||||||
|
@ -1109,7 +1147,8 @@ void FuncPlayer(int pA, int nDamage, int nRun)
|
||||||
}
|
}
|
||||||
|
|
||||||
// loc_1A494:
|
// loc_1A494:
|
||||||
sprite[nPlayerSprite].ang = ((sPlayerInput[nPlayer].nAngle << 2) + sprite[nPlayerSprite].ang) & kAngleMask;
|
PlayerList[nPlayer].q16angle = (PlayerList[nPlayer].q16angle + sPlayerInput[nPlayer].nAngle) & 0x7FFFFFF;
|
||||||
|
sprite[nPlayerSprite].ang = fix16_to_int(PlayerList[nPlayer].q16angle);
|
||||||
|
|
||||||
// sprite[nPlayerSprite].zvel is modified within Gravity()
|
// sprite[nPlayerSprite].zvel is modified within Gravity()
|
||||||
short zVel = sprite[nPlayerSprite].zvel;
|
short zVel = sprite[nPlayerSprite].zvel;
|
||||||
|
@ -1204,7 +1243,8 @@ void FuncPlayer(int pA, int nDamage, int nRun)
|
||||||
{
|
{
|
||||||
if (nTotalPlayers <= 1)
|
if (nTotalPlayers <= 1)
|
||||||
{
|
{
|
||||||
sprite[nPlayerSprite].ang = GetAngleToSprite(nPlayerSprite, nSpiritSprite);
|
PlayerList[nPlayer].q16angle = fix16_from_int(GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask);
|
||||||
|
sprite[nPlayerSprite].ang = fix16_to_int(PlayerList[nPlayer].q16angle);
|
||||||
|
|
||||||
lPlayerXVel = 0;
|
lPlayerXVel = 0;
|
||||||
lPlayerYVel = 0;
|
lPlayerYVel = 0;
|
||||||
|
@ -1222,15 +1262,15 @@ void FuncPlayer(int pA, int nDamage, int nRun)
|
||||||
StopLocalSound();
|
StopLocalSound();
|
||||||
InitSpiritHead();
|
InitSpiritHead();
|
||||||
|
|
||||||
nDestVertPan[nPlayer] = 92;
|
nDestVertPan[nPlayer] = F16(92);
|
||||||
|
|
||||||
if (levelnum == 11)
|
if (levelnum == 11)
|
||||||
{
|
{
|
||||||
nDestVertPan[nPlayer] += 46;
|
nDestVertPan[nPlayer] += F16(46);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nDestVertPan[nPlayer] += 11;
|
nDestVertPan[nPlayer] += F16(11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1258,8 +1298,8 @@ void FuncPlayer(int pA, int nDamage, int nRun)
|
||||||
zVelB = -zVelB;
|
zVelB = -zVelB;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zVelB > 512) {
|
if (zVelB > 512 && !bLockPan) {
|
||||||
nDestVertPan[nPlayer] = 92;
|
nDestVertPan[nPlayer] = F16(92);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1360,14 +1400,14 @@ void FuncPlayer(int pA, int nDamage, int nRun)
|
||||||
loc_1AB8E:
|
loc_1AB8E:
|
||||||
if (!bPlayerPan && !bLockPan)
|
if (!bPlayerPan && !bLockPan)
|
||||||
{
|
{
|
||||||
int nPanVal = ((spr_z - sprite[nPlayerSprite].z) / 32) + 92;
|
fix16_t nPanVal = fix16_from_int(spr_z - sprite[nPlayerSprite].z) / 32 + F16(92);
|
||||||
|
|
||||||
if (nPanVal < 0) {
|
if (nPanVal < F16(0)) {
|
||||||
nPanVal = 0;
|
nPanVal = F16(0);
|
||||||
}
|
}
|
||||||
else if (nPanVal > 183)
|
else if (nPanVal > F16(183))
|
||||||
{
|
{
|
||||||
nPanVal = 183;
|
nPanVal = F16(183);
|
||||||
}
|
}
|
||||||
|
|
||||||
nDestVertPan[nPlayer] = nPanVal;
|
nDestVertPan[nPlayer] = nPanVal;
|
||||||
|
@ -3006,8 +3046,8 @@ do_default_b:
|
||||||
if (BUTTON(gamefunc_Look_Up))
|
if (BUTTON(gamefunc_Look_Up))
|
||||||
{
|
{
|
||||||
bLockPan = kFalse;
|
bLockPan = kFalse;
|
||||||
if (nVertPan[nPlayer] < 180) {
|
if (nVertPan[nPlayer] < F16(180)) {
|
||||||
nVertPan[nPlayer] += 4;
|
nVertPan[nPlayer] += F16(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bPlayerPan = kTrue;
|
bPlayerPan = kTrue;
|
||||||
|
@ -3016,8 +3056,8 @@ do_default_b:
|
||||||
else if (BUTTON(gamefunc_Look_Down))
|
else if (BUTTON(gamefunc_Look_Down))
|
||||||
{
|
{
|
||||||
bLockPan = kFalse;
|
bLockPan = kFalse;
|
||||||
if (nVertPan[nPlayer] > 4) {
|
if (nVertPan[nPlayer] > F16(4)) {
|
||||||
nVertPan[nPlayer] -= 4;
|
nVertPan[nPlayer] -= F16(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bPlayerPan = kTrue;
|
bPlayerPan = kTrue;
|
||||||
|
@ -3027,14 +3067,14 @@ do_default_b:
|
||||||
{
|
{
|
||||||
bLockPan = kFalse;
|
bLockPan = kFalse;
|
||||||
bPlayerPan = kFalse;
|
bPlayerPan = kFalse;
|
||||||
nVertPan[nPlayer] = 92;
|
nVertPan[nPlayer] = F16(92);
|
||||||
nDestVertPan[nPlayer] = 92;
|
nDestVertPan[nPlayer] = F16(92);
|
||||||
}
|
}
|
||||||
else if (BUTTON(gamefunc_Aim_Up))
|
else if (BUTTON(gamefunc_Aim_Up))
|
||||||
{
|
{
|
||||||
bLockPan = kTrue;
|
bLockPan = kTrue;
|
||||||
if (nVertPan[nPlayer] < 180) {
|
if (nVertPan[nPlayer] < F16(180)) {
|
||||||
nVertPan[nPlayer] += 4;
|
nVertPan[nPlayer] += F16(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bPlayerPan = kTrue;
|
bPlayerPan = kTrue;
|
||||||
|
@ -3043,8 +3083,8 @@ do_default_b:
|
||||||
else if (BUTTON(gamefunc_Aim_Down))
|
else if (BUTTON(gamefunc_Aim_Down))
|
||||||
{
|
{
|
||||||
bLockPan = kTrue;
|
bLockPan = kTrue;
|
||||||
if (nVertPan[nPlayer] > 4) {
|
if (nVertPan[nPlayer] > F16(4)) {
|
||||||
nVertPan[nPlayer] -= 4;
|
nVertPan[nPlayer] -= F16(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bPlayerPan = kTrue;
|
bPlayerPan = kTrue;
|
||||||
|
@ -3056,19 +3096,20 @@ do_default_b:
|
||||||
bPlayerPan = kFalse;
|
bPlayerPan = kFalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aimmode)
|
||||||
|
bLockPan = kTrue;
|
||||||
|
|
||||||
// loc_1C05E
|
// loc_1C05E
|
||||||
short ecx = nDestVertPan[nPlayer] - nVertPan[nPlayer];
|
fix16_t ecx = nDestVertPan[nPlayer] - nVertPan[nPlayer];
|
||||||
|
|
||||||
if (BUTTON(gamefunc_Mouseview))
|
if (aimmode)
|
||||||
{
|
{
|
||||||
ecx = 0;
|
ecx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ecx)
|
if (ecx)
|
||||||
{
|
{
|
||||||
int eax = ecx / 4;
|
if (ecx / 4 == 0)
|
||||||
|
|
||||||
if (!eax)
|
|
||||||
{
|
{
|
||||||
if (ecx >= 0) {
|
if (ecx >= 0) {
|
||||||
ecx = 1;
|
ecx = 1;
|
||||||
|
@ -3080,16 +3121,15 @@ do_default_b:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ecx = ecx / 4;
|
ecx /= 4;
|
||||||
eax = ecx;
|
|
||||||
|
|
||||||
if (eax > 4)
|
if (ecx > F16(4))
|
||||||
{
|
{
|
||||||
ecx = 4;
|
ecx = F16(4);
|
||||||
}
|
}
|
||||||
else if (eax < -4)
|
else if (ecx < -F16(4))
|
||||||
{
|
{
|
||||||
ecx = -4;
|
ecx = -F16(4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3228,19 +3268,19 @@ do_default_b:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (nVertPan[nPlayer] < 92)
|
if (nVertPan[nPlayer] < F16(92))
|
||||||
{
|
{
|
||||||
nVertPan[nPlayer] = 91;
|
nVertPan[nPlayer] = F16(91);
|
||||||
eyelevel[nPlayer] -= (dVertPan[nPlayer] << 8);
|
eyelevel[nPlayer] -= (dVertPan[nPlayer] << 8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nVertPan[nPlayer] += dVertPan[nPlayer];
|
nVertPan[nPlayer] += fix16_from_int(dVertPan[nPlayer]);
|
||||||
if (nVertPan[nPlayer] >= 200)
|
if (nVertPan[nPlayer] >= F16(200))
|
||||||
{
|
{
|
||||||
nVertPan[nPlayer] = 199;
|
nVertPan[nPlayer] = F16(199);
|
||||||
}
|
}
|
||||||
else if (nVertPan[nPlayer] <= 92)
|
else if (nVertPan[nPlayer] <= F16(92))
|
||||||
{
|
{
|
||||||
if (!(SectFlag[sprite[nPlayerSprite].sectnum] & kSectUnderwater))
|
if (!(SectFlag[sprite[nPlayerSprite].sectnum] & kSectUnderwater))
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,8 @@ struct Player
|
||||||
short field_3A;
|
short field_3A;
|
||||||
short field_3C;
|
short field_3C;
|
||||||
short nRun;
|
short nRun;
|
||||||
|
|
||||||
|
fix16_t q16angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern short PlayerCount;
|
extern short PlayerCount;
|
||||||
|
|
|
@ -28,9 +28,9 @@ short bSubTitles = kTrue;
|
||||||
|
|
||||||
int zbob;
|
int zbob;
|
||||||
|
|
||||||
short nDestVertPan[kMaxPlayers] = { 0 };
|
fix16_t nDestVertPan[kMaxPlayers] = { 0 };
|
||||||
short dVertPan[kMaxPlayers];
|
short dVertPan[kMaxPlayers];
|
||||||
short nVertPan[kMaxPlayers];
|
fix16_t nVertPan[kMaxPlayers];
|
||||||
int nCamerax;
|
int nCamerax;
|
||||||
int nCameray;
|
int nCameray;
|
||||||
int nCameraz;
|
int nCameraz;
|
||||||
|
@ -41,8 +41,8 @@ short nQuake[kMaxPlayers] = { 0 };
|
||||||
|
|
||||||
short nChunkTotal = 0;
|
short nChunkTotal = 0;
|
||||||
|
|
||||||
short nCameraa;
|
fix16_t nCameraa;
|
||||||
short nCamerapan;
|
fix16_t nCamerapan;
|
||||||
short nViewTop;
|
short nViewTop;
|
||||||
short bClip = kFalse;
|
short bClip = kFalse;
|
||||||
short nViewBottom;
|
short nViewBottom;
|
||||||
|
@ -277,8 +277,8 @@ void DrawView()
|
||||||
int playerY;
|
int playerY;
|
||||||
int playerZ;
|
int playerZ;
|
||||||
short nSector;
|
short nSector;
|
||||||
int nAngle;
|
fix16_t nAngle;
|
||||||
short pan;
|
fix16_t pan;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (bgpages <= 0)
|
if (bgpages <= 0)
|
||||||
|
@ -315,7 +315,7 @@ void DrawView()
|
||||||
playerY = sprite[nSprite].y;
|
playerY = sprite[nSprite].y;
|
||||||
playerZ = sprite[nSprite].z;
|
playerZ = sprite[nSprite].z;
|
||||||
nSector = sprite[nSprite].sectnum;
|
nSector = sprite[nSprite].sectnum;
|
||||||
nAngle = sprite[nSprite].ang;
|
nAngle = fix16_from_int(sprite[nSprite].ang);
|
||||||
|
|
||||||
SetGreenPal();
|
SetGreenPal();
|
||||||
UnMaskStatus();
|
UnMaskStatus();
|
||||||
|
@ -338,7 +338,7 @@ void DrawView()
|
||||||
playerY = sprite[nPlayerSprite].y;
|
playerY = sprite[nPlayerSprite].y;
|
||||||
playerZ = sprite[nPlayerSprite].z + eyelevel[nLocalPlayer];
|
playerZ = sprite[nPlayerSprite].z + eyelevel[nLocalPlayer];
|
||||||
nSector = nPlayerViewSect[nLocalPlayer];
|
nSector = nPlayerViewSect[nLocalPlayer];
|
||||||
nAngle = sprite[nPlayerSprite].ang;
|
nAngle = PlayerList[nLocalPlayer].q16angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
nCameraa = nAngle;
|
nCameraa = nAngle;
|
||||||
|
@ -347,7 +347,7 @@ void DrawView()
|
||||||
{
|
{
|
||||||
if (nSnakeCam >= 0)
|
if (nSnakeCam >= 0)
|
||||||
{
|
{
|
||||||
pan = 92;
|
pan = F16(92);
|
||||||
viewz = playerZ;
|
viewz = playerZ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -360,7 +360,8 @@ void DrawView()
|
||||||
if (viewz > floorZ)
|
if (viewz > floorZ)
|
||||||
viewz = floorZ;
|
viewz = floorZ;
|
||||||
|
|
||||||
nCameraa += (nQuake[nLocalPlayer] >> 7) % 31;
|
nCameraa += fix16_from_int((nQuake[nLocalPlayer] >> 7) % 31);
|
||||||
|
nCameraa &= 0x7FFFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -370,7 +371,7 @@ void DrawView()
|
||||||
-2000 * Sin(inita),
|
-2000 * Sin(inita),
|
||||||
4, 0, 0, CLIPMASK1);
|
4, 0, 0, CLIPMASK1);
|
||||||
|
|
||||||
pan = 92;
|
pan = F16(92);
|
||||||
viewz = playerZ;
|
viewz = playerZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +429,7 @@ void DrawView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drawrooms(nCamerax, nCameray, viewz, nCameraa, nCamerapan, nSector);
|
renderDrawRoomsQ16(nCamerax, nCameray, viewz, nCameraa, nCamerapan, nSector);
|
||||||
analyzesprites();
|
analyzesprites();
|
||||||
renderDrawMasks();
|
renderDrawMasks();
|
||||||
|
|
||||||
|
@ -463,7 +464,7 @@ void DrawView()
|
||||||
|
|
||||||
sprite[nPlayerSprite].cstat |= 0x8000;
|
sprite[nPlayerSprite].cstat |= 0x8000;
|
||||||
|
|
||||||
int ang2 = nCameraa - sprite[nPlayerSprite].ang;
|
int ang2 = fix16_to_int(nCameraa) - sprite[nPlayerSprite].ang;
|
||||||
if (ang2 < 0)
|
if (ang2 < 0)
|
||||||
ang2 = -ang2;
|
ang2 = -ang2;
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,9 @@ void ResetView();
|
||||||
void NoClip();
|
void NoClip();
|
||||||
void Clip();
|
void Clip();
|
||||||
|
|
||||||
extern short nDestVertPan[];
|
extern fix16_t nDestVertPan[];
|
||||||
extern short dVertPan[];
|
extern short dVertPan[];
|
||||||
extern short nVertPan[];
|
extern fix16_t nVertPan[];
|
||||||
extern short nQuake[];
|
extern short nQuake[];
|
||||||
|
|
||||||
extern int nCamerax;
|
extern int nCamerax;
|
||||||
|
|
Loading…
Reference in a new issue