/* copy the entire screen to the window at the scroll position
*
* perhaps use mit-shm to speed this up
*/
/* copy the entire screen to the window at the scroll position
*
* perhaps use mit-shm to speed this up
*/
+ if (em_game_status == EM_GAME_STATUS_MENU)
+ {
+ ClearRectangle(screenBitmap, 0, SCR_MENUY * TILEY,
+ SCR_FIELDX * TILEX, (17 - SCR_MENUY) * TILEY);
+ BlitBitmap(scoreBitmap, screenBitmap, 0, 0, SCR_MENUX * TILEX, SCOREY,
+ 0, SCR_MENUY * TILEY);
+ }
+
if (x < 2 * TILEX && y < 2 * TILEY)
{
BlitBitmap(screenBitmap, window, x, y,
if (x < 2 * TILEX && y < 2 * TILEY)
{
BlitBitmap(screenBitmap, window, x, y,
- 20 * TILEX, 12 * TILEY, SX, SY);
+ SCR_FIELDX * TILEX, SCR_FIELDY * TILEY, SX, SY);
}
else if (x < 2 * TILEX && y >= 2 * TILEY)
{
BlitBitmap(screenBitmap, window, x, y,
}
else if (x < 2 * TILEX && y >= 2 * TILEY)
{
BlitBitmap(screenBitmap, window, x, y,
BlitBitmap(screenBitmap, window, x, 0,
BlitBitmap(screenBitmap, window, x, 0,
- 20 * TILEX, y - 2 * TILEY, SX, SY + 14 * TILEY - y);
+ SCR_FIELDX * TILEX, y - 2 * TILEY,
+ SX, SY + MAX_BUF_YSIZE * TILEY - y);
}
else if (x >= 2 * TILEX && y < 2 * TILEY)
{
BlitBitmap(screenBitmap, window, x, y,
}
else if (x >= 2 * TILEX && y < 2 * TILEY)
{
BlitBitmap(screenBitmap, window, x, y,
BlitBitmap(screenBitmap, window, 0, y,
BlitBitmap(screenBitmap, window, 0, y,
- x - 2 * TILEX, 12 * TILEY, SX + 22 * TILEX - x, SY);
+ x - 2 * TILEX, SCR_FIELDY * TILEY,
+ SX + MAX_BUF_XSIZE * TILEX - x, SY);
}
else
{
BlitBitmap(screenBitmap, window, x, y,
}
else
{
BlitBitmap(screenBitmap, window, x, y,
BlitBitmap(screenBitmap, window, 0, y,
BlitBitmap(screenBitmap, window, 0, y,
- x - 2 * TILEX, 14 * TILEY - y, SX + 22 * TILEX - x, SY);
+ x - 2 * TILEX, MAX_BUF_YSIZE * TILEY - y,
+ SX + MAX_BUF_XSIZE * TILEX - x, SY);
BlitBitmap(screenBitmap, window, x, 0,
BlitBitmap(screenBitmap, window, x, 0,
- 22 * TILEX - x, y - 2 * TILEY, SX, SY + 14 * TILEY - y);
+ MAX_BUF_XSIZE * TILEX - x, y - 2 * TILEY,
+ SX, SY + MAX_BUF_YSIZE * TILEY - y);
BlitBitmap(screenBitmap, window, 0, 0,
x - 2 * TILEX, y - 2 * TILEY,
BlitBitmap(screenBitmap, window, 0, 0,
x - 2 * TILEX, y - 2 * TILEY,
- BlitBitmap(scoreBitmap, window, 0, 0,
- 20 * TILEX, SCOREY, SX, SY + 12 * TILEY);
+ /* draw either the main menu footer or the in-game time/gems/score values */
+
+ if (em_game_status == EM_GAME_STATUS_PLAY)
+ BlitBitmap(scoreBitmap, window, 0, 0, SCR_FIELDX * TILEX, SCOREY,
+ SX, SY + SCR_FIELDY * TILEY - SCOREY);
+
/* draw differences between game tiles and screen tiles
*
* implicitly handles scrolling and restoring background under the sprites
*
* perhaps use mit-shm to speed this up
*/
/* draw differences between game tiles and screen tiles
*
* implicitly handles scrolling and restoring background under the sprites
*
* perhaps use mit-shm to speed this up
*/
static void animscreen(void)
{
unsigned int x, y, dx, dy;
static void animscreen(void)
{
unsigned int x, y, dx, dy;
static void blitplayer(struct PLAYER *ply)
{
unsigned int x, y, dx, dy;
static void blitplayer(struct PLAYER *ply)
{
unsigned int x, y, dx, dy;
- if ((unsigned int)(dx - screen_x) < (21 * TILEX - 1) &&
- (unsigned int)(dy - screen_y) < (13 * TILEY - 1))
+ if ((unsigned int)(dx - screen_x) < ((MAX_BUF_XSIZE - 1) * TILEX - 1) &&
+ (unsigned int)(dy - screen_y) < ((MAX_BUF_YSIZE - 1) * TILEY - 1))
obj = screentiles[dy / TILEY][dx / TILEX];
XCopyArea(display, objmaskBitmap, spriteBitmap, spriteGC,
(obj / 512) * TILEX, (obj % 512) * TILEY / 16, TILEX, TILEY,
obj = screentiles[dy / TILEY][dx / TILEX];
XCopyArea(display, objmaskBitmap, spriteBitmap, spriteGC,
(obj / 512) * TILEX, (obj % 512) * TILEY / 16, TILEX, TILEY,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
x, y);
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
x, y);
- SetClipOrigin(sprBitmap, sprBitmap->stored_clip_gc, x - 22 * TILEX, y);
+ SetClipOrigin(sprBitmap, sprBitmap->stored_clip_gc,
+ x - MAX_BUF_XSIZE * TILEX, y);
BlitBitmapMasked(sprBitmap, screenBitmap,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
BlitBitmapMasked(sprBitmap, screenBitmap,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
- SetClipOrigin(sprBitmap, sprBitmap->stored_clip_gc, x, y - 14 * TILEY);
+ SetClipOrigin(sprBitmap, sprBitmap->stored_clip_gc,
+ x, y - MAX_BUF_YSIZE * TILEY);
BlitBitmapMasked(sprBitmap, screenBitmap,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
BlitBitmapMasked(sprBitmap, screenBitmap,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
x, y);
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
x, y);
- XSetClipOrigin(display, sprBitmap->stored_clip_gc, x - 22 * TILEX, y);
+ XSetClipOrigin(display, sprBitmap->stored_clip_gc,
+ x - MAX_BUF_XSIZE * TILEX, y);
XCopyArea(display, sprBitmap->drawable, screenBitmap->drawable,
sprBitmap->stored_clip_gc,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
XCopyArea(display, sprBitmap->drawable, screenBitmap->drawable,
sprBitmap->stored_clip_gc,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
- XSetClipOrigin(display, sprBitmap->stored_clip_gc, x, y - 14 * TILEY);
+ XSetClipOrigin(display, sprBitmap->stored_clip_gc,
+ x, y - MAX_BUF_YSIZE * TILEY);
XCopyArea(display, sprBitmap->drawable, screenBitmap->drawable,
sprBitmap->stored_clip_gc,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
XCopyArea(display, sprBitmap->drawable, screenBitmap->drawable,
sprBitmap->stored_clip_gc,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
XCopyArea(display, sprPixmap, screenPixmap, screenGC,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
x, y);
XCopyArea(display, sprPixmap, screenPixmap, screenGC,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
x, y);
- XSetClipOrigin(display, screenGC, x - 22 * TILEX, y);
+ XSetClipOrigin(display, screenGC, x - MAX_BUF_XSIZE * TILEX, y);
XCopyArea(display, sprPixmap, screenPixmap, screenGC,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
XCopyArea(display, sprPixmap, screenPixmap, screenGC,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
- x - 22 * TILEX, y);
- XSetClipOrigin(display, screenGC, x, y - 14 * TILEY);
+ x - MAX_BUF_XSIZE * TILEX, y);
+ XSetClipOrigin(display, screenGC, x, y - MAX_BUF_YSIZE * TILEY);
XCopyArea(display, sprPixmap, screenPixmap, screenGC,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
XCopyArea(display, sprPixmap, screenPixmap, screenGC,
(spr / 8) * TILEX, (spr % 8) * TILEY, TILEX, TILEY,
- ClearRectangle(scoreBitmap, 0, 0, 20 * TILEX, SCOREY);
+ ClearRectangle(scoreBitmap, 0, 0, SCR_FIELDX * TILEX, SCOREY);
BlitBitmap(botBitmap, scoreBitmap,
11 * SCOREX, colours[0] * SCOREY, 3 * SCOREX, SCOREY,
1 * SCOREX, 0); /* 0-63 time */
BlitBitmap(botBitmap, scoreBitmap,
18 * SCOREX, colours[0] * SCOREY, 6 * SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
11 * SCOREX, colours[0] * SCOREY, 3 * SCOREX, SCOREY,
1 * SCOREX, 0); /* 0-63 time */
BlitBitmap(botBitmap, scoreBitmap,
18 * SCOREX, colours[0] * SCOREY, 6 * SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
14 * SCOREX, colours[0] * SCOREY, 4 * SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
14 * SCOREX, colours[0] * SCOREY, 4 * SCOREX, SCOREY,
i = lev.score;
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
i = lev.score;
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
i = lev.required;
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
i = lev.required;
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
BlitBitmap(botBitmap, scoreBitmap,
(i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- screen_x = x - 19 * TILEX;
- screen_y = y - 11 * TILEY;
+ if (x < SCR_FIELDX * TILEX)
+ x = SCR_FIELDX * TILEY;
+ if (y < SCR_FIELDY * TILEY)
+ y = SCR_FIELDY * TILEY;
+
+ screen_x = x - (SCR_FIELDX - 1) * TILEX;
+ screen_y = y - (SCR_FIELDY - 1) * TILEY;
- BlitBitmap(ttlBitmap, screenBitmap,
- 0, 0, 20 * TILEX, 12 * TILEY, 0, 0);
+ /* draw title screen on menu background */
+
+ BlitBitmap(ttlBitmap, screenBitmap, ORIG_MENU_SX, ORIG_MENU_SY,
+ SCR_MENUX * TILEX, SCR_MENUY * TILEY, 0, 0);
+
+ /* draw copyright note at footer */
- BlitBitmap(botBitmap, scoreBitmap,
- 0, colours[1] * SCOREY, 20 * TILEX, SCOREY, 0, 0);
+ BlitBitmap(botBitmap, scoreBitmap, 0, colours[1] * SCOREY,
+ SCR_MENUX * TILEX, SCOREY, 0, 0);
SetClipOrigin(botBitmap, botBitmap->stored_clip_gc,
0, 0 - colours[0] * SCOREY);
}
SetClipOrigin(botBitmap, botBitmap->stored_clip_gc,
0, 0 - colours[0] * SCOREY);
}
- BlitBitmapMasked(botBitmap, scoreBitmap,
- 0, colours[0] * SCOREY, 20 * TILEX, SCOREY, 0, 0);
+ BlitBitmapMasked(botBitmap, scoreBitmap, 0, colours[0] * SCOREY,
+ SCR_MENUX * TILEX, SCOREY, 0, 0);
#else
XCopyArea(display, ttlPixmap, screenPixmap, screenGC,
#else
XCopyArea(display, ttlPixmap, screenPixmap, screenGC,
- 0, 0, 20 * TILEX, 12 * TILEY, 0, 0);
+ 0, 0, SCR_MENUX * TILEX, SCR_MENUY * TILEY, 0, 0);
if (botmaskBitmap)
{
XCopyArea(display, botPixmap, scorePixmap, scoreGC,
if (botmaskBitmap)
{
XCopyArea(display, botPixmap, scorePixmap, scoreGC,
- 0, colours[1] * SCOREY, 20 * TILEX, SCOREY, 0, 0);
+ 0, colours[1] * SCOREY, SCR_MENUX * TILEX, SCOREY, 0, 0);
XSetClipMask(display, scoreGC, botmaskBitmap);
XSetClipOrigin(display, scoreGC, 0, 0 - colours[0] * SCOREY);
}
XCopyArea(display, botPixmap, scorePixmap, scoreGC,
XSetClipMask(display, scoreGC, botmaskBitmap);
XSetClipOrigin(display, scoreGC, 0, 0 - colours[0] * SCOREY);
}
XCopyArea(display, botPixmap, scorePixmap, scoreGC,
- 0, colours[0] * SCOREY, 20 * TILEX, SCOREY, 0, 0);
+ 0, colours[0] * SCOREY, SCR_MENUX * TILEX, SCOREY, 0, 0);
XSetDashes(display, antsGC, colour_anim, ants_dashes, 2);
XDrawRectangle(display, screenPixmap, antsGC,
XSetDashes(display, antsGC, colour_anim, ants_dashes, 2);
XDrawRectangle(display, screenPixmap, antsGC,
- 0, y * TILEY, 20 * TILEX - 1, TILEY - 1);
+ 0, y * TILEY, SCR_MENUX * TILEX - 1, TILEY - 1);
- BlitBitmap(ttlBitmap, screenBitmap,
- left, y, right - left, MENUFONTY, left, y);
+ BlitBitmap(ttlBitmap, screenBitmap, ORIG_MENU_SX + left, ORIG_MENU_SY + y,
+ right - left, MENUFONTY, left, y);
- BlitBitmapMasked(ttlBitmap, screenBitmap,
- ch_x, ch_y, MENUFONTX, MENUFONTY, x, y);
+ BlitBitmapMasked(ttlBitmap, screenBitmap, ch_x, ch_y, MENUFONTX, MENUFONTY,
+ x - ORIG_MENU_SX, y - ORIG_MENU_SY);
#else
if (ttlmaskBitmap)
XSetClipOrigin(display, screenGC, x - ch_x, y - ch_y);
#else
if (ttlmaskBitmap)
XSetClipOrigin(display, screenGC, x - ch_x, y - ch_y);