mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +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.
This commit is contained in:
parent
67b2e2f52e
commit
5536184bee
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");
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -2609,11 +2609,7 @@ void P_PlayerThink (player_t *player)
|
|||
else if (cmd->ucmd.upmove != 0)
|
||||
{
|
||||
// Clamp the speed to some reasonable maximum.
|
||||
int magnitude = abs (cmd->ucmd.upmove);
|
||||
if (magnitude > 0x300)
|
||||
{
|
||||
cmd->ucmd.upmove = ksgn (cmd->ucmd.upmove) * 0x300;
|
||||
}
|
||||
cmd->ucmd.upmove = clamp<short>(cmd->ucmd.upmove, -0x300, 0x300);
|
||||
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.;
|
||||
|
|
|
@ -2701,6 +2701,11 @@ void R_DrawParticle_C (vissprite_t *vis)
|
|||
|
||||
extern double BaseYaspectMul;;
|
||||
|
||||
inline int sgn(int v)
|
||||
{
|
||||
return v < 0 ? -1 : v > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
||||
const FVector3 &dasprpos, DAngle dasprang,
|
||||
fixed_t daxscale, fixed_t dayscale, FVoxel *voxobj,
|
||||
|
@ -2840,7 +2845,7 @@ void R_DrawVoxel(const FVector3 &globalpos, FAngle viewangle,
|
|||
xe += xi; ye += yi;
|
||||
}
|
||||
|
||||
i = ksgn(ys-backy)+ksgn(xs-backx)*3+4;
|
||||
i = sgn(ys - backy) + sgn(xs - backx) * 3 + 4;
|
||||
switch(i)
|
||||
{
|
||||
case 6: case 7: x1 = 0; y1 = 0; break;
|
||||
|
|
Loading…
Reference in a new issue