mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- Blood: Adapt uplifted DoPlayerHorizon()
from SW to Blood.
* Horizon now standardised on 100 like the other games. * Need to determine where/why/how the player's horizon is starting out at 0 and get it to init at 100 like the other games.
This commit is contained in:
parent
f2b48fe79c
commit
d2501007f2
3 changed files with 66 additions and 57 deletions
|
@ -44,30 +44,13 @@ enum
|
|||
void applylook(PLAYER *pPlayer, fixed_t const q16avel, double const scaleAdjust);
|
||||
void sethorizon(PLAYER *pPlayer, fixed_t const q16horz, double const scaleAdjust);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// handles the input bits
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void processInputBits(ControlInfo* const hidInput, bool* mouseaim)
|
||||
{
|
||||
ApplyGlobalInput(gInput, hidInput);
|
||||
*mouseaim = !(gInput.actions & SB_AIMMODE);
|
||||
|
||||
if (!mouseaim || (gInput.actions & (SB_LOOK_UP|SB_LOOK_DOWN)))
|
||||
{
|
||||
gInput.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// handles movement
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void processMovement(ControlInfo* const hidInput, bool const mouseaim)
|
||||
static void processMovement(ControlInfo* const hidInput)
|
||||
{
|
||||
double const scaleAdjust = InputScale();
|
||||
int const run = !!(gInput.actions & SB_RUN);
|
||||
|
@ -83,7 +66,7 @@ static void processMovement(ControlInfo* const hidInput, bool const mouseaim)
|
|||
input.q16avel += FloatToFixed(hidInput->mousex + (scaleAdjust * hidInput->dyaw));
|
||||
}
|
||||
|
||||
if (mouseaim)
|
||||
if (!(gInput.actions & SB_AIMMODE))
|
||||
{
|
||||
input.q16horz += FloatToFixed(hidInput->mousey);
|
||||
}
|
||||
|
@ -209,10 +192,8 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
return;
|
||||
}
|
||||
|
||||
bool mouseaim;
|
||||
|
||||
processInputBits(hidInput, &mouseaim);
|
||||
processMovement(hidInput, mouseaim);
|
||||
ApplyGlobalInput(gInput, hidInput);
|
||||
processMovement(hidInput);
|
||||
|
||||
if (packet)
|
||||
{
|
||||
|
|
|
@ -721,9 +721,9 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
pPlayer->pXSprite->health = pDudeInfo->startHealth<<4;
|
||||
pPlayer->pSprite->cstat &= (unsigned short)~32768;
|
||||
pPlayer->bloodlust = 0;
|
||||
pPlayer->q16horiz = 0;
|
||||
pPlayer->q16horiz = 100;
|
||||
pPlayer->q16slopehoriz = 0;
|
||||
pPlayer->q16look = 0;
|
||||
pPlayer->q16look = 100;
|
||||
pPlayer->slope = 0;
|
||||
pPlayer->fraggerId = -1;
|
||||
pPlayer->underwaterTime = 1200;
|
||||
|
@ -1304,6 +1304,13 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3)
|
|||
return -1;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
HORIZ_SPEED = 14,
|
||||
PLAYER_HORIZ_MIN = -79,
|
||||
PLAYER_HORIZ_MAX = 219
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Player's angle function, called in processInput() or from gi->GetInput() as required.
|
||||
|
@ -1355,40 +1362,63 @@ void sethorizon(PLAYER *pPlayer, fixed_t const q16horz, double const scaleAdjust
|
|||
{
|
||||
InputPacket *pInput = &pPlayer->input;
|
||||
|
||||
if ((pInput->actions & SB_CENTERVIEW) && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)))
|
||||
// Calculate adjustment as true pitch (Fixed point math really sucks...)
|
||||
double horizAngle = clamp(atan2(pPlayer->q16look - IntToFixed(100), IntToFixed(128)) * (512. / pi::pi()), -180, 180);
|
||||
|
||||
if (q16horz)
|
||||
{
|
||||
if (pPlayer->q16look < 0)
|
||||
pPlayer->q16look = min(pPlayer->q16look + FloatToFixed(scaleAdjust * 4.), 0);
|
||||
|
||||
if (pPlayer->q16look > 0)
|
||||
pPlayer->q16look = max(pPlayer->q16look - FloatToFixed(scaleAdjust * 4.), 0);
|
||||
|
||||
if (!pPlayer->q16look)
|
||||
pInput->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pInput->actions & (SB_LOOK_UP|SB_AIM_UP))
|
||||
pPlayer->q16look = min(pPlayer->q16look + FloatToFixed(scaleAdjust * 4.), IntToFixed(60));
|
||||
|
||||
if (pInput->actions & (SB_LOOK_DOWN|SB_AIM_DOWN))
|
||||
pPlayer->q16look = max(pPlayer->q16look - FloatToFixed(scaleAdjust * 4.), IntToFixed(-60));
|
||||
pInput->actions &= ~SB_CENTERVIEW;
|
||||
horizAngle += FixedToFloat(q16horz);
|
||||
}
|
||||
|
||||
pPlayer->q16look = clamp(pPlayer->q16look + xs_CRoundToInt(q16horz / 3.25), IntToFixed(-60), IntToFixed(60));
|
||||
// this is the locked type
|
||||
if (pInput->actions & (SB_AIM_UP|SB_AIM_DOWN))
|
||||
{
|
||||
pInput->actions &= ~SB_CENTERVIEW;
|
||||
|
||||
if (pPlayer->q16look > 0)
|
||||
{
|
||||
pPlayer->q16horiz = FloatToFixed(fmulscale30(120., Sinf(FixedToFloat(pPlayer->q16look) * 8.)));
|
||||
// adjust q16horiz negative
|
||||
if (pInput->actions & SB_AIM_DOWN)
|
||||
horizAngle -= scaleAdjust * (HORIZ_SPEED >> 1);
|
||||
|
||||
// adjust q16horiz positive
|
||||
if (pInput->actions & SB_AIM_UP)
|
||||
horizAngle += scaleAdjust * (HORIZ_SPEED >> 1);
|
||||
}
|
||||
else if (pPlayer->q16look < 0)
|
||||
|
||||
// this is the unlocked type
|
||||
if (pInput->actions & (SB_LOOK_UP|SB_LOOK_DOWN))
|
||||
{
|
||||
pPlayer->q16horiz = FloatToFixed(fmulscale30(180., Sinf(FixedToFloat(pPlayer->q16look) * 8.)));
|
||||
pInput->actions |= SB_CENTERVIEW;
|
||||
|
||||
// adjust q16horiz negative
|
||||
if (pInput->actions & SB_LOOK_DOWN)
|
||||
horizAngle -= scaleAdjust * HORIZ_SPEED;
|
||||
|
||||
// adjust q16horiz positive
|
||||
if (pInput->actions & SB_LOOK_UP)
|
||||
horizAngle += scaleAdjust * HORIZ_SPEED;
|
||||
}
|
||||
else
|
||||
|
||||
if (pInput->actions & SB_CENTERVIEW)
|
||||
{
|
||||
pPlayer->q16horiz = 0;
|
||||
if (!(pInput->actions & (SB_LOOK_UP|SB_LOOK_DOWN)))
|
||||
{
|
||||
// not pressing the q16horiz keys
|
||||
if (horizAngle != 0)
|
||||
{
|
||||
// move q16horiz back to 100
|
||||
horizAngle += scaleAdjust * ((1. / 65536.) - (horizAngle * (10. / GameTicRate)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// not looking anymore because q16horiz is back at 100
|
||||
pInput->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Convert back to Build's horizon and clamp.
|
||||
pPlayer->q16horiz = pPlayer->q16look = clamp(IntToFixed(100) + xs_CRoundToInt(IntToFixed(128) * tan(horizAngle * (pi::pi() / 512.))), IntToFixed(PLAYER_HORIZ_MIN), IntToFixed(PLAYER_HORIZ_MAX));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -74,8 +74,6 @@ INTERPOLATE gInterpolation[kMaxInterpolations];
|
|||
|
||||
int gScreenTilt;
|
||||
|
||||
int const defaultHoriz = polymostcenterhoriz;
|
||||
|
||||
FFont *gFont[kFontNum];
|
||||
|
||||
void FontSet(int id, int tile, int space)
|
||||
|
@ -806,8 +804,8 @@ void viewDrawScreen(bool sceneonly)
|
|||
for (int i = 0; i < 16; i++)
|
||||
ror_status[i] = TestBitString(gotpic, 4080 + i);
|
||||
yax_preparedrawrooms();
|
||||
DrawMirrors(vd8, vd4, vd0, IntToFixed(v50), IntToFixed(v54 + defaultHoriz), gInterpolate, -1);
|
||||
drawrooms(vd8, vd4, vd0, v50, v54 + defaultHoriz, vcc);
|
||||
DrawMirrors(vd8, vd4, vd0, IntToFixed(v50), IntToFixed(v54), gInterpolate, -1);
|
||||
drawrooms(vd8, vd4, vd0, v50, v54, vcc);
|
||||
yax_drawrooms(viewProcessSprites, vcc, 0, gInterpolate);
|
||||
bool do_ror_hack = false;
|
||||
for (int i = 0; i < 16; i++)
|
||||
|
@ -881,7 +879,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
for (int i = 0; i < 16; i++)
|
||||
ror_status[i] = TestBitString(gotpic, 4080 + i);
|
||||
fixed_t deliriumPitchI = interpolate(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate);
|
||||
DrawMirrors(cX, cY, cZ, cA, q16horiz + IntToFixed(defaultHoriz) + deliriumPitchI, gInterpolate, gViewIndex);
|
||||
DrawMirrors(cX, cY, cZ, cA, q16horiz + deliriumPitchI, gInterpolate, gViewIndex);
|
||||
int bakCstat = gView->pSprite->cstat;
|
||||
if (gViewPos == 0)
|
||||
{
|
||||
|
@ -892,7 +890,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
gView->pSprite->cstat |= 514;
|
||||
}
|
||||
|
||||
renderDrawRoomsQ16(cX, cY, cZ, cA, q16horiz + IntToFixed(defaultHoriz) + deliriumPitchI, nSectnum);
|
||||
renderDrawRoomsQ16(cX, cY, cZ, cA, q16horiz + deliriumPitchI, nSectnum);
|
||||
viewProcessSprites(cX, cY, cZ, FixedToInt(cA), gInterpolate);
|
||||
bool do_ror_hack = false;
|
||||
for (int i = 0; i < 16; i++)
|
||||
|
@ -950,7 +948,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
int v8 = byte_1CE5C2 > 0 && (sector[tmpSect].ceilingstat & 1);
|
||||
if (gWeather.at12d8 > 0 || v8)
|
||||
{
|
||||
gWeather.Draw(cX, cY, cZ, cA, q16horiz + defaultHoriz + deliriumPitch, gWeather.at12d8);
|
||||
gWeather.Draw(cX, cY, cZ, cA, q16horiz + deliriumPitch, gWeather.at12d8);
|
||||
if (v8)
|
||||
{
|
||||
gWeather.at12d8 = ClipRange(delta * 8 + gWeather.at12d8, 0, 4095);
|
||||
|
|
Loading…
Reference in a new issue