Removed a lot of redundant jlDrawPresent() calls.
This commit is contained in:
parent
2ecdd25824
commit
4f08699513
2 changed files with 52 additions and 34 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
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=()
|
||||
|
||||
|
|
|
@ -43,6 +43,12 @@ segment "warehouse";
|
|||
#define MAX_WIDTH 20
|
||||
#define MAX_HEIGHT 12
|
||||
|
||||
#ifdef JOEY_IIGS
|
||||
#define ANIMATION_DELAY
|
||||
#else
|
||||
#define ANIMATION_DELAY jlUtilSleep(2);
|
||||
#endif
|
||||
|
||||
#define TILE_NOTHING 0
|
||||
#define TILE_WALL 1
|
||||
#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) {
|
||||
jint16 i = 0;
|
||||
jint16 x = AVATAR_X_ON_SCREEN;
|
||||
|
@ -289,15 +319,15 @@ void avatarWalkDown(bool pushing) {
|
|||
|
||||
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);
|
||||
if (pushing) {
|
||||
tileDraw(TILE_CRATE, tx, i + 24);
|
||||
}
|
||||
jlDisplayPresent();
|
||||
jlUtilSleep(1);
|
||||
tickerUpdate();
|
||||
ANIMATION_DELAY
|
||||
avatarErase(x, i);
|
||||
|
||||
frame++;
|
||||
if (frame >= AVATAR_MAX_FRAMES) {
|
||||
|
@ -309,8 +339,6 @@ void avatarWalkDown(bool pushing) {
|
|||
seq = seq2;
|
||||
}
|
||||
}
|
||||
|
||||
tickerUpdate();
|
||||
}
|
||||
|
||||
avatarY++;
|
||||
|
@ -336,15 +364,15 @@ void avatarWalkLeft(bool pushing) {
|
|||
|
||||
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);
|
||||
if (pushing) {
|
||||
tileDraw(TILE_CRATE, i - 8, ty);
|
||||
}
|
||||
jlDisplayPresent();
|
||||
jlUtilSleep(1);
|
||||
tickerUpdate();
|
||||
ANIMATION_DELAY
|
||||
avatarErase(i, y);
|
||||
|
||||
frame++;
|
||||
if (frame >= AVATAR_MAX_FRAMES) {
|
||||
|
@ -356,8 +384,6 @@ void avatarWalkLeft(bool pushing) {
|
|||
seq = seq2;
|
||||
}
|
||||
}
|
||||
|
||||
tickerUpdate();
|
||||
}
|
||||
|
||||
avatarX--;
|
||||
|
@ -383,15 +409,15 @@ void avatarWalkRight(bool pushing) {
|
|||
|
||||
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);
|
||||
if (pushing) {
|
||||
tileDraw(TILE_CRATE, i + 24, ty);
|
||||
}
|
||||
jlDisplayPresent();
|
||||
jlUtilSleep(1);
|
||||
tickerUpdate();
|
||||
ANIMATION_DELAY
|
||||
avatarErase(i, y);
|
||||
|
||||
frame++;
|
||||
if (frame >= AVATAR_MAX_FRAMES) {
|
||||
|
@ -403,8 +429,6 @@ void avatarWalkRight(bool pushing) {
|
|||
seq = seq2;
|
||||
}
|
||||
}
|
||||
|
||||
tickerUpdate();
|
||||
}
|
||||
|
||||
avatarX++;
|
||||
|
@ -430,15 +454,15 @@ void avatarWalkUp(bool pushing) {
|
|||
|
||||
avatarFacing = AVATAR_UP;
|
||||
|
||||
for (i=y; i>y-16; i--) {
|
||||
for (i=y; i>y-16; i-=2) {
|
||||
|
||||
jlImgDisplay(savedScreen1);
|
||||
if (pushing) {
|
||||
tileDraw(TILE_CRATE, tx, i - 8);
|
||||
}
|
||||
avatarDraw(x, i, seq, frame);
|
||||
jlDisplayPresent();
|
||||
jlUtilSleep(1);
|
||||
tickerUpdate();
|
||||
ANIMATION_DELAY
|
||||
avatarErase(x, i);
|
||||
|
||||
frame++;
|
||||
if (frame >= AVATAR_MAX_FRAMES) {
|
||||
|
@ -450,8 +474,6 @@ void avatarWalkUp(bool pushing) {
|
|||
seq = seq2;
|
||||
}
|
||||
}
|
||||
|
||||
tickerUpdate();
|
||||
}
|
||||
|
||||
avatarY--;
|
||||
|
@ -526,9 +548,6 @@ void gamePlay(void) {
|
|||
switch (key) {
|
||||
case 27:
|
||||
playing = menuMain();
|
||||
if (playing) {
|
||||
puzzleRedraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case 13:
|
||||
|
@ -820,7 +839,6 @@ jint16 menuHandle(const char *title, const char *menuItems[], jint16 selected) {
|
|||
if (selected != last) {
|
||||
jlDrawBlit8x8(jlImgSurfaceGet(fontI), spaceX, spaceY, xpos, lastY);
|
||||
jlDrawBlit8x8(jlImgSurfaceGet(fontI), rightArrowsX, rightArrowsY, xpos, ypos);
|
||||
jlDisplayPresent();
|
||||
lastY = ypos;
|
||||
last = selected;
|
||||
}
|
||||
|
@ -1033,7 +1051,6 @@ void puzzleLoad(void) {
|
|||
void puzzleRedraw(void) {
|
||||
puzzleDraw();
|
||||
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 ",
|
||||
puzzleCount, puzzleCurrent, cratesOnTarget, crateCount, spinner[count]);
|
||||
|
||||
jlDisplayPresent();
|
||||
|
||||
if (jlUtilTimeSpan(last, jlUtilTimer()) > 3) {
|
||||
|
@ -1279,11 +1297,11 @@ void titleShow(void) {
|
|||
jlImgDisplay(savedScreen1);
|
||||
//showPalette();
|
||||
jlDisplayPresent();
|
||||
jlUtilSleep(20);
|
||||
jlUtilSleep(120);
|
||||
if (images[count+1] != 0) {
|
||||
jlDrawClear();
|
||||
jlDisplayPresent();
|
||||
jlUtilSleep(3);
|
||||
jlUtilSleep(20);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
@ -1303,8 +1321,8 @@ int main(void) {
|
|||
titleShow();
|
||||
|
||||
// Load the rest of our data.
|
||||
if (!jlImgLoad(tilesI, "biff")) jlUtilDie("Unable to load tiles!");
|
||||
if (!jlStnLoad(tilesS, "biff")) jlUtilDie("Unable to load tiles stencil!");
|
||||
if (!jlImgLoad(tilesI, "biff")) jlUtilDie("Unable to load tiles!");
|
||||
if (!jlStnLoad(tilesS, "biff")) jlUtilDie("Unable to load tiles stencil!");
|
||||
if (!jlImgLoad(fontI, "font")) jlUtilDie("Unable to load font!");
|
||||
if (!jlImgLoad(aboutI, "about")) jlUtilDie("Unable to load about!");
|
||||
if (!jlImgLoad(helpI, "help")) jlUtilDie("Unable to load help!");
|
||||
|
|
Loading…
Add table
Reference in a new issue