mirror of
https://github.com/jeremysrand/apple2048.git
synced 2024-09-27 13:54:30 +00:00
Clean up the animations
This commit is contained in:
parent
f2cfbc6a34
commit
3b271d3c97
81
apple2048.c
81
apple2048.c
@ -172,6 +172,7 @@ void performAnimationsLeft(void)
|
|||||||
tTileAnim *tileAnim;
|
tTileAnim *tileAnim;
|
||||||
tPos x;
|
tPos x;
|
||||||
tPos y;
|
tPos y;
|
||||||
|
bool firstFrame = true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
animInProgress = false;
|
animInProgress = false;
|
||||||
@ -183,14 +184,23 @@ void performAnimationsLeft(void)
|
|||||||
|
|
||||||
x = tileAnim->fromX;
|
x = tileAnim->fromX;
|
||||||
y = tileAnim->fromY;
|
y = tileAnim->fromY;
|
||||||
if ((x % TILE_WIDTH) != (TILE_WIDTH - 1)) {
|
|
||||||
x += TILE_WIDTH;
|
if (!firstFrame) {
|
||||||
if (x < 40) {
|
switch (x % TILE_WIDTH) {
|
||||||
cputcxy(x, y + 1, ' ');
|
case 0:
|
||||||
cputcxy(x, y + 2, ' ');
|
break;
|
||||||
cputcxy(x, y + 3, ' ');
|
case 1:
|
||||||
|
textframexy(((x / TILE_WIDTH) + 1) * TILE_WIDTH, y,
|
||||||
|
TILE_WIDTH, TILE_HEIGHT, TEXTFRAME_WIDE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
x += TILE_WIDTH - 1;
|
||||||
|
cputcxy(x, y + 1, ' ');
|
||||||
|
cputcxy(x, y + 2, ' ');
|
||||||
|
cputcxy(x, y + 3, ' ');
|
||||||
|
x -= TILE_WIDTH - 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
x -= TILE_WIDTH;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x--;
|
x--;
|
||||||
@ -207,6 +217,7 @@ void performAnimationsLeft(void)
|
|||||||
}
|
}
|
||||||
playSound(200, 2);
|
playSound(200, 2);
|
||||||
}
|
}
|
||||||
|
firstFrame = false;
|
||||||
} while (animInProgress);
|
} while (animInProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,6 +229,7 @@ void performAnimationsRight(void)
|
|||||||
tTileAnim *tileAnim;
|
tTileAnim *tileAnim;
|
||||||
tPos x;
|
tPos x;
|
||||||
tPos y;
|
tPos y;
|
||||||
|
bool firstFrame = true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
animInProgress = false;
|
animInProgress = false;
|
||||||
@ -229,10 +241,21 @@ void performAnimationsRight(void)
|
|||||||
|
|
||||||
x = tileAnim->fromX;
|
x = tileAnim->fromX;
|
||||||
y = tileAnim->fromY;
|
y = tileAnim->fromY;
|
||||||
if ((x % TILE_WIDTH) != 0) {
|
|
||||||
cputcxy(x, y + 1, ' ');
|
if (!firstFrame) {
|
||||||
cputcxy(x, y + 2, ' ');
|
switch (x % TILE_WIDTH) {
|
||||||
cputcxy(x, y + 3, ' ');
|
case 0:
|
||||||
|
break;
|
||||||
|
case (TILE_WIDTH - 1):
|
||||||
|
textframexy((x / TILE_WIDTH) * TILE_WIDTH, y,
|
||||||
|
TILE_WIDTH, TILE_HEIGHT, TEXTFRAME_WIDE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cputcxy(x, y + 1, ' ');
|
||||||
|
cputcxy(x, y + 2, ' ');
|
||||||
|
cputcxy(x, y + 3, ' ');
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x++;
|
x++;
|
||||||
@ -249,6 +272,7 @@ void performAnimationsRight(void)
|
|||||||
}
|
}
|
||||||
playSound(200, 2);
|
playSound(200, 2);
|
||||||
}
|
}
|
||||||
|
firstFrame = false;
|
||||||
} while (animInProgress);
|
} while (animInProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,6 +284,7 @@ void performAnimationsUp(void)
|
|||||||
tTileAnim *tileAnim;
|
tTileAnim *tileAnim;
|
||||||
tPos x;
|
tPos x;
|
||||||
tPos y;
|
tPos y;
|
||||||
|
bool firstFrame = true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
animInProgress = false;
|
animInProgress = false;
|
||||||
@ -272,14 +297,16 @@ void performAnimationsUp(void)
|
|||||||
x = tileAnim->fromX;
|
x = tileAnim->fromX;
|
||||||
y = tileAnim->fromY;
|
y = tileAnim->fromY;
|
||||||
|
|
||||||
switch ((y % TILE_HEIGHT)) {
|
if (!firstFrame) {
|
||||||
case 0:
|
switch ((y % TILE_HEIGHT)) {
|
||||||
default:
|
case 0:
|
||||||
cputsxy(x, y + TILE_HEIGHT, " ");
|
break;
|
||||||
if (y < TILE_Y_TO_SCREEN_Y(BOARD_SIZE))
|
default:
|
||||||
|
cputsxy(x + 1, y + TILE_HEIGHT - 1, " ");
|
||||||
textframexy(x, ((y / TILE_HEIGHT) + 1) * TILE_HEIGHT,
|
textframexy(x, ((y / TILE_HEIGHT) + 1) * TILE_HEIGHT,
|
||||||
TILE_WIDTH, TILE_HEIGHT, TEXTFRAME_WIDE);
|
TILE_WIDTH, TILE_HEIGHT, TEXTFRAME_WIDE);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
y--;
|
y--;
|
||||||
@ -296,6 +323,7 @@ void performAnimationsUp(void)
|
|||||||
}
|
}
|
||||||
playSound(200, 2);
|
playSound(200, 2);
|
||||||
}
|
}
|
||||||
|
firstFrame = false;
|
||||||
} while (animInProgress);
|
} while (animInProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,6 +335,7 @@ void performAnimationsDown(void)
|
|||||||
tTileAnim *tileAnim;
|
tTileAnim *tileAnim;
|
||||||
tPos x;
|
tPos x;
|
||||||
tPos y;
|
tPos y;
|
||||||
|
bool firstFrame = true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
animInProgress = false;
|
animInProgress = false;
|
||||||
@ -319,13 +348,16 @@ void performAnimationsDown(void)
|
|||||||
x = tileAnim->fromX;
|
x = tileAnim->fromX;
|
||||||
y = tileAnim->fromY;
|
y = tileAnim->fromY;
|
||||||
|
|
||||||
switch ((y % TILE_HEIGHT)) {
|
if (!firstFrame) {
|
||||||
case 0:
|
switch ((y % TILE_HEIGHT)) {
|
||||||
default:
|
case 0:
|
||||||
cputsxy(x, y, " ");
|
break;
|
||||||
textframexy(x, (y / TILE_HEIGHT) * TILE_HEIGHT,
|
default:
|
||||||
TILE_WIDTH, TILE_HEIGHT, TEXTFRAME_WIDE);
|
cputsxy(x + 1, y, " ");
|
||||||
break;
|
textframexy(x, (y / TILE_HEIGHT) * TILE_HEIGHT,
|
||||||
|
TILE_WIDTH, TILE_HEIGHT, TEXTFRAME_WIDE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
y++;
|
y++;
|
||||||
@ -342,6 +374,7 @@ void performAnimationsDown(void)
|
|||||||
}
|
}
|
||||||
playSound(200, 2);
|
playSound(200, 2);
|
||||||
}
|
}
|
||||||
|
firstFrame = false;
|
||||||
} while (animInProgress);
|
} while (animInProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user