Fix controls
This commit is contained in:
parent
2e39b5204b
commit
3287ff2a31
1 changed files with 31 additions and 11 deletions
42
demo3.cpp
42
demo3.cpp
|
@ -35,13 +35,14 @@ public:
|
|||
uint8_t mColor;
|
||||
};
|
||||
|
||||
#define MAX_CHANGES 32
|
||||
#define MAX_CHANGES 16
|
||||
|
||||
Change changes[MAX_CHANGES];
|
||||
|
||||
bool editReleased = false;
|
||||
bool editing = false;
|
||||
uint16_t changeIndex = 0;
|
||||
int16_t editCounter = 0;
|
||||
|
||||
#define HEIGHT_PROFILE_LENGTH 256
|
||||
const int8_t heightProfile[] = {
|
||||
|
@ -240,9 +241,9 @@ int main()
|
|||
|
||||
for (uint16_t i = 0; i < MAX_CHANGES; ++i)
|
||||
{
|
||||
changes[i].mCoords.x = 0;
|
||||
changes[i].mCoords.x = i;
|
||||
changes[i].mCoords.y = 0;
|
||||
changes[i].mHeight = floorHeightAt(0,0);
|
||||
changes[i].mHeight = floorHeightAt(i,0);
|
||||
}
|
||||
|
||||
uint32_t previousTime = 0;
|
||||
|
@ -322,6 +323,7 @@ int main()
|
|||
changes[changeIndex].mCoords.x = selectedSquare.x;
|
||||
changes[changeIndex].mCoords.y = selectedSquare.y;
|
||||
editReleased = false;
|
||||
editCounter = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -331,7 +333,13 @@ int main()
|
|||
{
|
||||
if (editing)
|
||||
{
|
||||
changes[changeIndex].mHeight += 100;
|
||||
if (editCounter == 0)
|
||||
{
|
||||
changes[changeIndex].mHeight += UNITS_PER_SQUARE / 4;
|
||||
editCounter = 4;
|
||||
}
|
||||
else
|
||||
editCounter--;
|
||||
}
|
||||
else if (aButton)
|
||||
player.mCamera.shear = min(player.mCamera.shear + 10,60);
|
||||
|
@ -342,7 +350,13 @@ int main()
|
|||
{
|
||||
if (editing)
|
||||
{
|
||||
changes[changeIndex].mHeight -= 100;
|
||||
if (editCounter == 0)
|
||||
{
|
||||
changes[changeIndex].mHeight -= UNITS_PER_SQUARE / 4;
|
||||
editCounter = 4;
|
||||
}
|
||||
else
|
||||
editCounter--;
|
||||
}
|
||||
else if (aButton)
|
||||
player.mCamera.shear = max(player.mCamera.shear - 10,-60);
|
||||
|
@ -353,17 +367,23 @@ int main()
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.mCamera.shear /= 2;
|
||||
editCounter = 0;
|
||||
}
|
||||
|
||||
if (!aButton)
|
||||
player.mCamera.shear /= 2;
|
||||
|
||||
int addition = 0;
|
||||
|
||||
if (pokitto.rightBtn())
|
||||
addition = 1;
|
||||
else if (pokitto.leftBtn())
|
||||
addition = -1;
|
||||
if (!editing)
|
||||
{
|
||||
if (pokitto.rightBtn())
|
||||
addition = 1;
|
||||
else if (pokitto.leftBtn())
|
||||
addition = -1;
|
||||
}
|
||||
|
||||
if (aButton)
|
||||
{
|
||||
|
@ -384,9 +404,9 @@ int main()
|
|||
Unit heightDiff = player.mCamera.height - prevHeight;
|
||||
|
||||
if (heightDiff == 0)
|
||||
player.mVericalSpeed = 0; // hit floor/ceiling
|
||||
player.mVericalSpeed = 0; // hit floor
|
||||
|
||||
if (player.mVericalSpeed == 0 && pokitto.bBtn())
|
||||
if (!editing && player.mVericalSpeed == 0 && pokitto.bBtn())
|
||||
{
|
||||
int16_t camX = divRoundDown(player.mCamera.position.x,UNITS_PER_SQUARE);
|
||||
int16_t camY = divRoundDown(player.mCamera.position.y,UNITS_PER_SQUARE);
|
||||
|
|
Loading…
Reference in a new issue