Add shearing
This commit is contained in:
parent
cee662ed6b
commit
6307d48599
1 changed files with 12 additions and 2 deletions
12
game.cpp
12
game.cpp
|
@ -767,6 +767,8 @@ inline void pixelFunc(PixelInfo pixel)
|
|||
|
||||
unsigned short pal[256];
|
||||
|
||||
Unit shear = 0;
|
||||
|
||||
void draw()
|
||||
{
|
||||
RayConstraints c;
|
||||
|
@ -775,7 +777,7 @@ void draw()
|
|||
c.maxSteps = 10;
|
||||
c.computeTextureCoords = 1;
|
||||
|
||||
render(player.mCamera,floorHeightAt,ceilingHeightAt,textureAt,pixelFunc,c);
|
||||
render(player.mCamera,floorHeightAt,ceilingHeightAt,textureAt,pixelFunc,c,shear);
|
||||
|
||||
Unit previousDepth;
|
||||
|
||||
|
@ -868,11 +870,14 @@ int main()
|
|||
}
|
||||
|
||||
bool strafe = p.aBtn();
|
||||
bool lookUpDown = p.cBtn();
|
||||
|
||||
if (p.upBtn())
|
||||
{
|
||||
if (strafe)
|
||||
heightOffset = step;
|
||||
else if (lookUpDown)
|
||||
shear = min(shear + 100, 2 * UNITS_PER_SQUARE);
|
||||
else
|
||||
moveOffset = d;
|
||||
}
|
||||
|
@ -880,6 +885,8 @@ int main()
|
|||
{
|
||||
if (strafe)
|
||||
heightOffset = -step;
|
||||
else if (lookUpDown)
|
||||
shear = max(shear - 100, -2 * UNITS_PER_SQUARE);
|
||||
else
|
||||
{
|
||||
moveOffset.x = -1 * d.x;
|
||||
|
@ -887,6 +894,9 @@ int main()
|
|||
}
|
||||
}
|
||||
|
||||
if (!lookUpDown)
|
||||
shear = shear / 2;
|
||||
|
||||
int addition = 0;
|
||||
|
||||
if (p.rightBtn())
|
||||
|
|
Loading…
Reference in a new issue