mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-26 05:51:52 +00:00
- got rid of ksgn.
Because every bit of Build code that can be removed is a good thing.
This was only used in two places, one of which could be done better, the other one in the voxel drawer setup now uses a local C-inline version.
(cherry picked from commit 5536184bee
)
This commit is contained in:
parent
b7d5110a49
commit
5d210c64e0
5 changed files with 7 additions and 35 deletions
|
@ -195,9 +195,3 @@ static __forceinline void clearbufshort (void *buff, unsigned int count, WORD cl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __forceinline SDWORD ksgn (SDWORD a)
|
|
||||||
{
|
|
||||||
if (a < 0) return -1;
|
|
||||||
else if (a > 0) return 1;
|
|
||||||
else return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -316,17 +316,3 @@ static inline void clearbufshort (void *buff, unsigned int count, WORD clear)
|
||||||
:"cc");
|
:"cc");
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline SDWORD ksgn (SDWORD a)
|
|
||||||
{
|
|
||||||
SDWORD result, dummy;
|
|
||||||
|
|
||||||
asm volatile
|
|
||||||
("add %0,%0\n\t"
|
|
||||||
"sbb %1,%1\n\t"
|
|
||||||
"cmp %0,%1\n\t"
|
|
||||||
"adc $0,%1"
|
|
||||||
:"=r" (dummy), "=r" (result)
|
|
||||||
:"0" (a)
|
|
||||||
:"cc");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
|
@ -339,13 +339,4 @@ __forceinline void clearbufshort (void *buff, unsigned int count, WORD clear)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline SDWORD ksgn (SDWORD a)
|
|
||||||
{
|
|
||||||
__asm mov edx,a
|
|
||||||
__asm add edx,edx
|
|
||||||
__asm sbb eax,eax
|
|
||||||
__asm cmp eax,edx
|
|
||||||
__asm adc eax,0
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning (default: 4035)
|
#pragma warning (default: 4035)
|
||||||
|
|
|
@ -2610,11 +2610,7 @@ void P_PlayerThink (player_t *player)
|
||||||
else if (cmd->ucmd.upmove != 0)
|
else if (cmd->ucmd.upmove != 0)
|
||||||
{
|
{
|
||||||
// Clamp the speed to some reasonable maximum.
|
// Clamp the speed to some reasonable maximum.
|
||||||
int magnitude = abs (cmd->ucmd.upmove);
|
cmd->ucmd.upmove = clamp<short>(cmd->ucmd.upmove, -0x300, 0x300);
|
||||||
if (magnitude > 0x300)
|
|
||||||
{
|
|
||||||
cmd->ucmd.upmove = ksgn (cmd->ucmd.upmove) * 0x300;
|
|
||||||
}
|
|
||||||
if (player->mo->waterlevel >= 2 || (player->mo->flags2 & MF2_FLY) || (player->cheats & CF_NOCLIP2))
|
if (player->mo->waterlevel >= 2 || (player->mo->flags2 & MF2_FLY) || (player->cheats & CF_NOCLIP2))
|
||||||
{
|
{
|
||||||
player->mo->Vel.Z = player->mo->Speed * cmd->ucmd.upmove / 128.;
|
player->mo->Vel.Z = player->mo->Speed * cmd->ucmd.upmove / 128.;
|
||||||
|
|
|
@ -2907,6 +2907,11 @@ void R_DrawParticle_rgba(vissprite_t *vis)
|
||||||
|
|
||||||
extern double BaseYaspectMul;;
|
extern double BaseYaspectMul;;
|
||||||
|
|
||||||
|
inline int sgn(int v)
|
||||||
|
{
|
||||||
|
return v < 0 ? -1 : v > 0 ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
||||||
const FVector3 &dasprpos, DAngle dasprang,
|
const FVector3 &dasprpos, DAngle dasprang,
|
||||||
fixed_t daxscale, fixed_t dayscale, FVoxel *voxobj,
|
fixed_t daxscale, fixed_t dayscale, FVoxel *voxobj,
|
||||||
|
@ -3048,7 +3053,7 @@ void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
||||||
xe += xi; ye += yi;
|
xe += xi; ye += yi;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = ksgn(ys-backy)+ksgn(xs-backx)*3+4;
|
i = sgn(ys - backy) + sgn(xs - backx) * 3 + 4;
|
||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case 6: case 7: x1 = 0; y1 = 0; break;
|
case 6: case 7: x1 = 0; y1 = 0; break;
|
||||||
|
|
Loading…
Reference in a new issue