From 2cb5267002375c1f0a8004e24d1780661891225c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 23 Feb 2022 02:43:29 +0200 Subject: [PATCH] CHEWY: Remove more unused functions --- engines/chewy/mcga.cpp | 4 -- engines/chewy/mcga.h | 1 - engines/chewy/mcga_graphics.cpp | 120 ++------------------------------ engines/chewy/mcga_graphics.h | 11 --- 4 files changed, 7 insertions(+), 129 deletions(-) diff --git a/engines/chewy/mcga.cpp b/engines/chewy/mcga.cpp index 7469003914e..accaf871d9c 100644 --- a/engines/chewy/mcga.cpp +++ b/engines/chewy/mcga.cpp @@ -89,10 +89,6 @@ void clear_mcga() { Common::fill(SCREEN, SCREEN + SCREEN_WIDTH * SCREEN_HEIGHT, 0); } -void setpixel_mcga(int16 x, int16 y, int16 farbe) { - line_mcga(x, y, x, y, farbe); -} - uint8 getpix(int16 x, int16 y) { return *(byte *)SCREEN_S.getBasePtr(x, y); } diff --git a/engines/chewy/mcga.h b/engines/chewy/mcga.h index c54f27b737d..248e691163e 100644 --- a/engines/chewy/mcga.h +++ b/engines/chewy/mcga.h @@ -39,7 +39,6 @@ void rastercol(int16 color, int16 r, int16 g, int16 b); void set_palpart(const byte *palette, int16 startcol, int16 anz); void clear_mcga(); -void setpixel_mcga(int16 x, int16 y, int16 farbe); uint8 getpix(int16 x, int16 y); void line_mcga(int16 x1, int16 y1, int16 x2, int16 y2, int16 farbe); diff --git a/engines/chewy/mcga_graphics.cpp b/engines/chewy/mcga_graphics.cpp index 5634e6bfc8c..5c24e2bd394 100644 --- a/engines/chewy/mcga_graphics.cpp +++ b/engines/chewy/mcga_graphics.cpp @@ -72,29 +72,9 @@ byte *McgaGraphics::get_zeiger() { return get_dispoff(); } -void McgaGraphics::set_mono() { - _mono = true; -} - -void McgaGraphics::calc_mono(byte *palette, int16 startcol, int16 anz) { - int16 k = startcol * 3; - for (int16 i = 0; i < anz; i++) { - uint8 r = palette[k]; - uint8 g = palette[k + 1]; - uint8 b = palette[k + 2]; - uint8 grau = (((float)r) * 0.30) + (((float)g) * 0.59) + (((float)b) * 0.11); - palette[k] = grau; - palette[k + 1] = grau; - palette[k + 2] = grau; - k += 3; - } -} - void McgaGraphics::set_palette(byte *palette) { for (int16 i = 0; i < 768; i++) _palTable[i] = palette[i]; - if (_mono) - calc_mono(palette, 0, 256); setpalette(palette); } @@ -111,14 +91,10 @@ void McgaGraphics::raster_col(int16 c, int16 r, int16 g, int16 b) { _palTable[index] = r; _palTable[index + 1] = g; _palTable[index + 2] = b; - if (_mono) - calc_mono(_palTable, c, 1); rastercol(c, r, g, b); } void McgaGraphics::einblenden(byte *palette, int16 frames) { - if (_mono) - calc_mono(palette, 0, 256); for (int16 j = 63; j >= 0; j--) { int16 k = 0; for (int16 i = 0; i < 256; i++) { @@ -140,28 +116,6 @@ void McgaGraphics::einblenden(byte *palette, int16 frames) { } } -void McgaGraphics::aufhellen(byte *palette, int16 startcol, int16 anz, int16 stufen, int16 frames) { - if (_mono) - calc_mono(palette, startcol, anz); - for (int16 j = stufen; j >= 0; j--) { - int16 endcol = startcol + anz; - int16 k = startcol * 3; - for (int16 i = startcol; i < endcol; i++) { - int16 r = _palTable[k]; - int16 g = _palTable[k + 1]; - int16 b = _palTable[k + 2]; - if ((r + 1) <= palette[k]) ++r; - if ((g + 1) <= palette[k + 1]) ++g; - if ((b + 1) <= palette[k + 2]) ++b; - _palTable[k] = r; - _palTable[k + 1] = g; - _palTable[k + 2] = b; - k += 3; - } - set_palpart(_palTable, startcol, anz); - } -} - void McgaGraphics::ausblenden(int16 frames) { for (int16 j = 0; j < 64; j++) { int16 k = 0; @@ -181,26 +135,6 @@ void McgaGraphics::ausblenden(int16 frames) { } } -void McgaGraphics::abblenden(int16 startcol, int16 anz, int16 stufen, int16 frames) { - int16 endcol = startcol + anz; - for (int16 j = 0; j < stufen; j++) { - int16 k = startcol * 3; - for (int16 i = startcol; i < endcol; i++) { - int16 r = _palTable[k]; - int16 g = _palTable[k + 1]; - int16 b = _palTable[k + 2]; - if (r > 0) --r; - if (g > 0) --g; - if (b > 0) --b; - _palTable[k] = r; - _palTable[k + 1] = g; - _palTable[k + 2] = b; - k += 3; - } - set_palpart(_palTable, startcol, anz); - } -} - void McgaGraphics::set_teilpalette(const byte *palette, int16 startcol, int16 anz) { int16 k = startcol * 3; int16 endcol = startcol + anz; @@ -210,8 +144,6 @@ void McgaGraphics::set_teilpalette(const byte *palette, int16 startcol, int16 an _palTable[k + 2] = palette[k + 2]; k += 3; } - if (_mono) - calc_mono(_palTable, startcol, anz); set_palpart(_palTable, startcol, anz); } @@ -219,10 +151,6 @@ void McgaGraphics::cls() { clear_mcga(); } -void McgaGraphics::punkt(int16 xpos, int16 ypos, int16 farbn) { - setpixel_mcga(xpos, ypos, farbn); -} - uint8 McgaGraphics::get_pixel(int16 xpos, int16 ypos) { uint8 pix = getpix(xpos, ypos); @@ -783,51 +711,22 @@ void McgaGraphics::move(int16 x, int16 y) { } void McgaGraphics::init_mausmode(MouseInfo *mInfo) { - _mausMode = true; _mInfo = mInfo; } -void McgaGraphics::exit_mausmode() { - _mausMode = false; - _mInfo = nullptr; -} - int16 McgaGraphics::devices() { int16 i = 0; - if (_mausMode != false) { - // TODO: This is wrong. 'i' should be initialized to "button status" (BX after a call to Int33h/03 - if (i > 1) { - i = 27; - } else if (i == 1) - i = 13; - else - i = 0; - } + // TODO: This is wrong. 'i' should be initialized to "button status" (BX after a call to Int33h/03 + if (i > 1) { + i = 27; + } else if (i == 1) + i = 13; + else + i = 0; return i; } -int16 McgaGraphics::check_stellen_anz(char *zstring, int16 *pos, int16 stellen) { - int16 diff; - int16 k = 0; - while (zstring[k] != 0) - ++k; - - if (k >= stellen) { - while ((k) && (stellen)) { - --k; - --stellen; - } - diff = 0; - } else { - diff = stellen - k; - k = 0; - } - *pos = k; - - return diff; -} - void McgaGraphics::scale_set(byte *sptr, int16 x, int16 y, int16 xdiff_, int16 ydiff_, int16 scrwidth) { if (xdiff_ || ydiff_) zoom_set(sptr, x, y, xdiff_, ydiff_, scrwidth); @@ -835,11 +734,6 @@ void McgaGraphics::scale_set(byte *sptr, int16 x, int16 y, int16 xdiff_, int16 y mspr_set_mcga(sptr, x, y, scrwidth); } -void McgaGraphics::update_screen() { - if (_svga == ON) - upd_scr(); -} - void McgaGraphics::ltoa(long N, char *str, int base) { sprintf(str, "%ld", N); } diff --git a/engines/chewy/mcga_graphics.h b/engines/chewy/mcga_graphics.h index b0209e0ca72..8133d7df27e 100644 --- a/engines/chewy/mcga_graphics.h +++ b/engines/chewy/mcga_graphics.h @@ -36,27 +36,20 @@ public: void init(); void set_writemode(char wm); void init_mausmode(MouseInfo *mInfo); - void exit_mausmode(); void set_clip(int16 x1, int16 y1, int16 x2, int16 y2); void set_pointer(byte *ptr); byte *get_zeiger(); - void set_mono(); - void calc_mono(byte *palette, int16 startcol, int16 anz); void set_palette(byte *palette); void palette_save(byte *palette = nullptr); void rest_palette(); void raster_col(int16 c, int16 r, int16 g, int16 b); void einblenden(byte *palette, int16 frames); - void aufhellen(byte *palette, int16 startcol, int16 anz, int16 stufen, - int16 frames); void ausblenden(int16 frames); - void abblenden(int16 startcol, int16 anz, int16 stufen, int16 frames); void set_teilpalette(const byte *palette, int16 startcol, int16 anz); void cls(); - void punkt(int16 xpos, int16 ypos, int16 farbn); uint8 get_pixel(int16 xpos, int16 ypos); void linie(int16 x1, int16 y1, int16 x2, int16 y2, int16 farbe); void box(int16 x1, int16 y1, int16 x2, int16 y2, int16 farbe); @@ -82,18 +75,14 @@ public: const char *format); void vorschub(); void move(int16 x, int16 y); - void update_screen(); private: - int16 check_stellen_anz(char *zstring, int16 *pos, int16 stellen); int16 devices(); float _sines[360]; float _cosines[360]; byte _palTable[PALETTE_SIZE]; uint8 _writeMode = 0; - bool _mono = false; - bool _mausMode = false; int16 _crlfx = 0, _crlfy = 0; int16 _fontBr = 0, _fontH = 0; uint8 _svga = 0;