Removed a lot of redundant jlDrawPresent() calls.

This commit is contained in:
Scott Duensing 2020-08-22 19:54:46 -05:00
parent 2ecdd25824
commit 4f08699513
2 changed files with 52 additions and 34 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash -e #!/bin/bash -e
PROJECT=Warehouse PROJECT=Warehouse
DATA=(font.img kanga.img tiles.img title.img about.img help.img ../puzzles.dat ../index.dat) DATA=(font.img kanga.img biff.img biff.stn title.img about.img help.img ../puzzles.dat ../index.dat)
#SOURCE=(*.c *.h) #SOURCE=(*.c *.h)
SOURCE=() SOURCE=()

View file

@ -43,6 +43,12 @@ segment "warehouse";
#define MAX_WIDTH 20 #define MAX_WIDTH 20
#define MAX_HEIGHT 12 #define MAX_HEIGHT 12
#ifdef JOEY_IIGS
#define ANIMATION_DELAY
#else
#define ANIMATION_DELAY jlUtilSleep(2);
#endif
#define TILE_NOTHING 0 #define TILE_NOTHING 0
#define TILE_WALL 1 #define TILE_WALL 1
#define TILE_FLOOR 2 #define TILE_FLOOR 2
@ -276,6 +282,30 @@ void avatarDraw(jint16 x1, jint16 y1, jint16 sequence, jint16 frame) {
} }
void avatarErase(jint16 x1, jint16 y1) {
jint16 x2 = x1 + 8;
jint16 x3 = x2 + 8;
jint16 x4 = x3 + 8;
jint16 y2 = y1 + 8;
jint16 y3 = y2 + 8;
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x1, y1, x1, y1);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x2, y1, x2, y1);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x3, y1, x3, y1);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x4, y1, x4, y1);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x1, y2, x1, y2);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x2, y2, x2, y2);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x3, y2, x3, y2);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x4, y2, x4, y2);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x1, y3, x1, y3);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x2, y3, x2, y3);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x3, y3, x3, y3);
jlDrawBlit8x8(jlImgSurfaceGet(savedScreen1), x4, y3, x4, y3);
}
void avatarWalkDown(bool pushing) { void avatarWalkDown(bool pushing) {
jint16 i = 0; jint16 i = 0;
jint16 x = AVATAR_X_ON_SCREEN; jint16 x = AVATAR_X_ON_SCREEN;
@ -289,15 +319,15 @@ void avatarWalkDown(bool pushing) {
avatarFacing = AVATAR_DOWN; avatarFacing = AVATAR_DOWN;
for (i=y; i<y+16; i++) { for (i=y; i<y+16; i+=2) {
jlImgDisplay(savedScreen1);
avatarDraw(x, i, seq, frame); avatarDraw(x, i, seq, frame);
if (pushing) { if (pushing) {
tileDraw(TILE_CRATE, tx, i + 24); tileDraw(TILE_CRATE, tx, i + 24);
} }
jlDisplayPresent(); tickerUpdate();
jlUtilSleep(1); ANIMATION_DELAY
avatarErase(x, i);
frame++; frame++;
if (frame >= AVATAR_MAX_FRAMES) { if (frame >= AVATAR_MAX_FRAMES) {
@ -309,8 +339,6 @@ void avatarWalkDown(bool pushing) {
seq = seq2; seq = seq2;
} }
} }
tickerUpdate();
} }
avatarY++; avatarY++;
@ -336,15 +364,15 @@ void avatarWalkLeft(bool pushing) {
avatarFacing = AVATAR_LEFT; avatarFacing = AVATAR_LEFT;
for (i=x; i>x-16; i--) { for (i=x; i>x-16; i-=2) {
jlImgDisplay(savedScreen1);
avatarDraw(i, y, seq, frame); avatarDraw(i, y, seq, frame);
if (pushing) { if (pushing) {
tileDraw(TILE_CRATE, i - 8, ty); tileDraw(TILE_CRATE, i - 8, ty);
} }
jlDisplayPresent(); tickerUpdate();
jlUtilSleep(1); ANIMATION_DELAY
avatarErase(i, y);
frame++; frame++;
if (frame >= AVATAR_MAX_FRAMES) { if (frame >= AVATAR_MAX_FRAMES) {
@ -356,8 +384,6 @@ void avatarWalkLeft(bool pushing) {
seq = seq2; seq = seq2;
} }
} }
tickerUpdate();
} }
avatarX--; avatarX--;
@ -383,15 +409,15 @@ void avatarWalkRight(bool pushing) {
avatarFacing = AVATAR_RIGHT; avatarFacing = AVATAR_RIGHT;
for (i=x; i<x+16; i++) { for (i=x; i<x+16; i+=2) {
jlImgDisplay(savedScreen1);
avatarDraw(i, y, seq, frame); avatarDraw(i, y, seq, frame);
if (pushing) { if (pushing) {
tileDraw(TILE_CRATE, i + 24, ty); tileDraw(TILE_CRATE, i + 24, ty);
} }
jlDisplayPresent(); tickerUpdate();
jlUtilSleep(1); ANIMATION_DELAY
avatarErase(i, y);
frame++; frame++;
if (frame >= AVATAR_MAX_FRAMES) { if (frame >= AVATAR_MAX_FRAMES) {
@ -403,8 +429,6 @@ void avatarWalkRight(bool pushing) {
seq = seq2; seq = seq2;
} }
} }
tickerUpdate();
} }
avatarX++; avatarX++;
@ -430,15 +454,15 @@ void avatarWalkUp(bool pushing) {
avatarFacing = AVATAR_UP; avatarFacing = AVATAR_UP;
for (i=y; i>y-16; i--) { for (i=y; i>y-16; i-=2) {
jlImgDisplay(savedScreen1);
if (pushing) { if (pushing) {
tileDraw(TILE_CRATE, tx, i - 8); tileDraw(TILE_CRATE, tx, i - 8);
} }
avatarDraw(x, i, seq, frame); avatarDraw(x, i, seq, frame);
jlDisplayPresent(); tickerUpdate();
jlUtilSleep(1); ANIMATION_DELAY
avatarErase(x, i);
frame++; frame++;
if (frame >= AVATAR_MAX_FRAMES) { if (frame >= AVATAR_MAX_FRAMES) {
@ -450,8 +474,6 @@ void avatarWalkUp(bool pushing) {
seq = seq2; seq = seq2;
} }
} }
tickerUpdate();
} }
avatarY--; avatarY--;
@ -526,9 +548,6 @@ void gamePlay(void) {
switch (key) { switch (key) {
case 27: case 27:
playing = menuMain(); playing = menuMain();
if (playing) {
puzzleRedraw();
}
break; break;
case 13: case 13:
@ -820,7 +839,6 @@ jint16 menuHandle(const char *title, const char *menuItems[], jint16 selected) {
if (selected != last) { if (selected != last) {
jlDrawBlit8x8(jlImgSurfaceGet(fontI), spaceX, spaceY, xpos, lastY); jlDrawBlit8x8(jlImgSurfaceGet(fontI), spaceX, spaceY, xpos, lastY);
jlDrawBlit8x8(jlImgSurfaceGet(fontI), rightArrowsX, rightArrowsY, xpos, ypos); jlDrawBlit8x8(jlImgSurfaceGet(fontI), rightArrowsX, rightArrowsY, xpos, ypos);
jlDisplayPresent();
lastY = ypos; lastY = ypos;
last = selected; last = selected;
} }
@ -1033,7 +1051,6 @@ void puzzleLoad(void) {
void puzzleRedraw(void) { void puzzleRedraw(void) {
puzzleDraw(); puzzleDraw();
avatarDraw(AVATAR_X_ON_SCREEN, AVATAR_Y_ON_SCREEN, avatarFacing, 0); avatarDraw(AVATAR_X_ON_SCREEN, AVATAR_Y_ON_SCREEN, avatarFacing, 0);
jlDisplayPresent();
} }
@ -1239,6 +1256,7 @@ void tickerUpdate(void) {
fontPrint(fontI, 0, 24, "%d puzzles. Showing #%d. %d/%d %c ", fontPrint(fontI, 0, 24, "%d puzzles. Showing #%d. %d/%d %c ",
puzzleCount, puzzleCurrent, cratesOnTarget, crateCount, spinner[count]); puzzleCount, puzzleCurrent, cratesOnTarget, crateCount, spinner[count]);
jlDisplayPresent(); jlDisplayPresent();
if (jlUtilTimeSpan(last, jlUtilTimer()) > 3) { if (jlUtilTimeSpan(last, jlUtilTimer()) > 3) {
@ -1279,11 +1297,11 @@ void titleShow(void) {
jlImgDisplay(savedScreen1); jlImgDisplay(savedScreen1);
//showPalette(); //showPalette();
jlDisplayPresent(); jlDisplayPresent();
jlUtilSleep(20); jlUtilSleep(120);
if (images[count+1] != 0) { if (images[count+1] != 0) {
jlDrawClear(); jlDrawClear();
jlDisplayPresent(); jlDisplayPresent();
jlUtilSleep(3); jlUtilSleep(20);
} }
count++; count++;
} }