aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--saga/actor.cpp2
-rw-r--r--saga/gfx.cpp81
-rw-r--r--saga/gfx.h13
-rw-r--r--saga/interface.h1
-rw-r--r--saga/objectmap.cpp3
-rw-r--r--saga/render.cpp10
-rw-r--r--saga/sfuncs.cpp4
-rw-r--r--saga/xref.txt1
8 files changed, 15 insertions, 100 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index b70218da51..f7bbc8c494 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -1518,7 +1518,7 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount,
_activeSpeech.speechCoords[0] = actor->screenPosition;
_activeSpeech.speechCoords[0].y -= ACTOR_DIALOGUE_HEIGHT;
_activeSpeech.speechColor[0] = actor->speechColor;
- _activeSpeech.outlineColor[0] = _vm->_gfx->getBlack();
+ _activeSpeech.outlineColor[0] = kITEColorBlack;
_activeSpeech.sampleResourceId = sampleResourceId;
_activeSpeech.playing = false;
_activeSpeech.slowModeCharIndex = 0;
diff --git a/saga/gfx.cpp b/saga/gfx.cpp
index 1af8dff24a..450284b89d 100644
--- a/saga/gfx.cpp
+++ b/saga/gfx.cpp
@@ -60,8 +60,6 @@ Gfx::Gfx(OSystem *system, int width, int height, GameDetector &detector) : _syst
// Set module data
_back_buf = back_buf;
_init = 1;
- _white_index = -1;
- _black_index = -1;
// For now, always show the mouse cursor.
setCursor();
@@ -749,90 +747,17 @@ SURFACE *Gfx::getBackBuffer() {
return &_back_buf;
}
-int Gfx::getWhite(void) {
- return _white_index;
-}
-
-int Gfx::getBlack(void) {
- return _black_index;
-}
-
-int Gfx::matchColor(unsigned long colormask) {
- int i;
- int red = (colormask & 0x0FF0000UL) >> 16;
- int green = (colormask & 0x000FF00UL) >> 8;
- int blue = colormask & 0x00000FFUL;
- int dr;
- int dg;
- int db;
- long color_delta;
- long best_delta = LONG_MAX;
- int best_index = 0;
- byte *ppal;
-
- for (i = 0, ppal = _cur_pal; i < PAL_ENTRIES; i++, ppal += 4) {
- dr = ppal[0] - red;
- dr = ABS(dr);
- dg = ppal[1] - green;
- dg = ABS(dg);
- db = ppal[2] - blue;
- db = ABS(db);
- ppal[3] = 0;
-
- color_delta = (long)(dr * RED_WEIGHT + dg * GREEN_WEIGHT + db * BLUE_WEIGHT);
-
- if (color_delta == 0) {
- return i;
- }
-
- if (color_delta < best_delta) {
- best_delta = color_delta;
- best_index = i;
- }
- }
-
- return best_index;
-}
-
int Gfx::setPalette(SURFACE *surface, PALENTRY *pal) {
- byte red;
- byte green;
- byte blue;
- int color_delta;
- int best_wdelta = 0;
- int best_windex = 0;
- int best_bindex = 0;
- int best_bdelta = 1000;
int i;
byte *ppal;
for (i = 0, ppal = _cur_pal; i < PAL_ENTRIES; i++, ppal += 4) {
- red = pal[i].red;
- ppal[0] = red;
- color_delta = red;
- green = pal[i].green;
- ppal[1] = green;
- color_delta += green;
- blue = pal[i].blue;
- ppal[2] = blue;
- color_delta += blue;
+ ppal[0] = pal[i].red;
+ ppal[1] = pal[i].green;
+ ppal[2] = pal[i].blue;
ppal[3] = 0;
-
- if (color_delta < best_bdelta) {
- best_bindex = i;
- best_bdelta = color_delta;
- }
-
- if (color_delta > best_wdelta) {
- best_windex = i;
- best_wdelta = color_delta;
- }
}
- // Set whitest and blackest color indices
- _white_index = best_windex;
- _black_index = best_bindex;
-
_system->setPalette(_cur_pal, 0, PAL_ENTRIES);
return SUCCESS;
diff --git a/saga/gfx.h b/saga/gfx.h
index c7ff643dd4..e65d91f4be 100644
--- a/saga/gfx.h
+++ b/saga/gfx.h
@@ -68,20 +68,12 @@ struct SURFACE : Graphics::Surface {
#define PAL_ENTRIES 256
-#define RGB_RED 0x00FF0000UL
-#define RGB_GREEN 0x0000FF00UL
-#define RGB_BLUE 0x000000FFUL
-
#define CURSOR_W 7
#define CURSOR_H 7
#define CURSOR_ORIGIN_X 4
#define CURSOR_ORIGIN_Y 4
-#define RED_WEIGHT 0.299
-#define GREEN_WEIGHT 0.587
-#define BLUE_WEIGHT 0.114
-
int drawPalette(SURFACE *dst_s);
int bufToSurface(SURFACE *ds, const byte *src, int src_w, int src_h, Rect *src_rect, Point *dst_pt);
int bufToBuffer(byte * dst_buf, int dst_w, int dst_h, const byte *src,
@@ -100,9 +92,6 @@ public:
Gfx(OSystem *system, int width, int height, GameDetector &detector);
SURFACE *getBackBuffer();
- int getWhite();
- int getBlack();
- int matchColor(unsigned long colormask);
int setPalette(SURFACE *surface, PALENTRY *pal);
int getCurrentPal(PALENTRY *src_pal);
int palToBlack(SURFACE *surface, PALENTRY *src_pal, double percent);
@@ -114,8 +103,6 @@ private:
void setCursor();
int _init;
SURFACE _back_buf;
- int _white_index;
- int _black_index;
byte _cur_pal[PAL_ENTRIES * 4];
OSystem *_system;
};
diff --git a/saga/interface.h b/saga/interface.h
index 51eee1e6c7..d213284312 100644
--- a/saga/interface.h
+++ b/saga/interface.h
@@ -99,6 +99,7 @@ enum ITEColors {
kITEColorDarkGrey = 0x0b,
kITEColorGreen = 0xba,
kITEColorBlack = 0x0f,
+ kITEColorRed = 0x65,
kITEColorBlue = 0x93
};
diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp
index fe4a7a7e49..6b592fff67 100644
--- a/saga/objectmap.cpp
+++ b/saga/objectmap.cpp
@@ -31,6 +31,7 @@
#include "saga/gfx.h"
#include "saga/console.h"
#include "saga/font.h"
+#include "saga/interface.h"
#include "saga/objectmap.h"
#include "saga/stream.h"
@@ -206,7 +207,7 @@ void ObjectMap::draw(SURFACE *ds, const Point& testPoint, int color, int color2)
if (hitZoneIndex != -1) {
snprintf(txtBuf, sizeof(txtBuf), "hitZone %d", hitZoneIndex);
_vm->_font->draw(SMALL_FONT_ID, ds, txtBuf, 0, 2, 2,
- _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
+ kITEColorBrightWhite, kITEColorBlack, FONT_OUTLINE);
}
}
diff --git a/saga/render.cpp b/saga/render.cpp
index d384ef548f..457168ca28 100644
--- a/saga/render.cpp
+++ b/saga/render.cpp
@@ -126,9 +126,9 @@ int Render::drawScene() {
// Display scene maps, if applicable
if (getFlags() & RF_OBJECTMAP_TEST) {
if (_vm->_scene->_objectMap)
- _vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack());
+ _vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, kITEColorBrightWhite, kITEColorBlack);
if (_vm->_scene->_actionMap)
- _vm->_scene->_actionMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->matchColor(RGB_RED), _vm->_gfx->getBlack());
+ _vm->_scene->_actionMap->draw(backbuf_surface, mouse_pt, kITEColorRed, kITEColorBlack);
}
// Draw queued actors
@@ -152,7 +152,7 @@ int Render::drawScene() {
sprintf(txt_buf, "%d", _fps);
fps_width = _vm->_font->getStringWidth(SMALL_FONT_ID, txt_buf, 0, FONT_NORMAL);
_vm->_font->draw(SMALL_FONT_ID, backbuf_surface, txt_buf, 0, backbuf_surface->w - fps_width, 2,
- _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
+ kITEColorBrightWhite, kITEColorBlack, FONT_OUTLINE);
}
// Display "paused game" message, if applicable
@@ -160,7 +160,7 @@ int Render::drawScene() {
int msg_len = strlen(PAUSEGAME_MSG);
int msg_w = _vm->_font->getStringWidth(BIG_FONT_ID, PAUSEGAME_MSG, msg_len, FONT_OUTLINE);
_vm->_font->draw(BIG_FONT_ID, backbuf_surface, PAUSEGAME_MSG, msg_len,
- (backbuf_surface->w - msg_w) / 2, 90, _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
+ (backbuf_surface->w - msg_w) / 2, 90, kITEColorBrightWhite, kITEColorBlack, FONT_OUTLINE);
}
// Update user interface
@@ -170,7 +170,7 @@ int Render::drawScene() {
// Display text formatting test, if applicable
if (_flags & RF_TEXT_TEST) {
_vm->textDraw(MEDIUM_FONT_ID, backbuf_surface, test_txt, mouse_pt.x, mouse_pt.y,
- _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE | FONT_CENTERED);
+ kITEColorBrightWhite, kITEColorBlack, FONT_OUTLINE | FONT_CENTERED);
}
// Display palette test, if applicable
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index 2f3447694f..9c8808d49c 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -1110,8 +1110,8 @@ void Script::sfPlacard(SCRIPTFUNC_PARAMS) {
_vm->_scene->getInfo(&scene_info);
- text_entry.color = _vm->_gfx->getWhite();
- text_entry.effect_color = _vm->_gfx->getBlack();
+ text_entry.color = kITEColorBrightWhite;
+ text_entry.effect_color = kITEColorBlack;
text_entry.text_x = _vm->getDisplayWidth() / 2;
text_entry.text_y = (_vm->getSceneHeight() - _vm->_font->getHeight(MEDIUM_FONT_ID)) / 2;
text_entry.font_id = MEDIUM_FONT_ID;
diff --git a/saga/xref.txt b/saga/xref.txt
index 3a7ffd8dd5..622bed7122 100644
--- a/saga/xref.txt
+++ b/saga/xref.txt
@@ -103,6 +103,7 @@ WHITE_02 kITEColorWhite
GREY_0A kITEColorGrey
DK_GREY_0B kITEColorDarkGrey
PITCH_BLACK kITEColorBlack
+RED_65 kITEColorRed
BLUE_93 kITEColorBlue
GREEB_BA kITEColorGreen