Skip to content

Commit a76e5ad

Browse files
authored
Merge pull request #88 from inguin/biometer
Fix biometer artifacts, enable biometer in setup screen
2 parents 6da3e08 + 738db0a commit a76e5ad

File tree

3 files changed

+16
-25
lines changed

3 files changed

+16
-25
lines changed

Diff for: src/GameSrc/mainloop.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ void mainloop(int argc, char *argv[]) {
147147

148148
MousePollProc(); // update the cursor, was 35 times/sec originally
149149

150-
if (_current_loop != SETUP_LOOP)
151-
status_bio_update();
150+
status_bio_update();
152151

153152
SDLDraw();
154153
}

Diff for: src/GameSrc/setup.c

+5
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,11 @@ errtype difficulty_draw(uchar full) {
339339
draw_raw_res_bm_extract(REF_IMG_bmDifficultyScreen, 0, 0);
340340
/*if (which_lang)
341341
draw_raw_res_bm_extract(MKREF(RES_bmIntroGraphics4,which_lang-1),50,11);*/
342+
343+
// This shouldn't be necessary since the difficulty screen already
344+
// contains the biometer background, but there seems to be a 1-pixel
345+
// offset in the left biometer region between the two resources.
346+
status_bio_draw();
342347
}
343348
setup_mode = SETUP_DIFFICULTY;
344349
for (i = 0; i < NUM_DIFF_CATEGORIES; i++) {

Diff for: src/GameSrc/status.c

+10-23
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ void ss_save_under_set_pixel(int color, short i, short j) {
256256
void bio_set_pixel(int color, short x, short y) {
257257
short x0, x1, y0, y1, i, j;
258258

259-
// KLC - don't need if ((curr_bio_mode == DIFF_BIO) && (under_bio(x)))
260-
// return;
259+
if ((curr_bio_mode == DIFF_BIO) && (under_bio(x)))
260+
return;
261261
if (convert_use_mode) {
262262
x0 = SCONV_X(x);
263263
y0 = SCONV_Y(y);
@@ -274,27 +274,14 @@ void bio_set_pixel(int color, short x, short y) {
274274
// Restore the pixels from the offscreen background bitmap.
275275
// ---------------------------------------------------------
276276
void bio_restore_pixel(grs_bitmap *bmp, short x, short y) {
277-
int x0, y0;
278-
int x1, y1;
279-
uchar *pp;
280-
int i, j;
281-
282-
// Determine where x and y really are on the Mac screen.
283-
x0 = SCONV_X(x);
284-
y0 = SCONV_Y(y);
285-
x1 = SCONV_X(x + 1);
286-
y1 = SCONV_Y(y + 1);
287-
288-
// OK, this sets a pointer to the background bitmap at the same location. I just happen
289-
// to know that the difference between the on-screen and offscreen bitmaps is (10,2).
290-
pp = bmp->bits + (bmp->row * (y0 - 2) + (x0 - 10));
291-
292-
// Restore the pixels directly from the offscreen background bitmap.
293-
for (j = y0; j < y1; j++) {
294-
for (i = x0; i < x1; i++)
295-
ss_save_under_set_pixel(*pp++, i, j);
296-
pp += bmp->row - 2;
297-
}
277+
if ((curr_bio_mode == DIFF_BIO) && (under_bio(x)))
278+
return;
279+
280+
short a, b, c, d;
281+
STORE_CLIP(a, b, c, d);
282+
ss_cset_cliprect(&bio_canvas, x, y, x + 1, y + 1);
283+
ss_bitmap(bmp, STATUS_BIO_X, STATUS_BIO_Y);
284+
RESTORE_CLIP(a, b, c, d);
298285
}
299286

300287
// ---------------------------------------------------------

0 commit comments

Comments
 (0)