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