diff -ur --exclude=CVS ScummVM/saga/actor.cpp ScummVM+hack/saga/actor.cpp
old
|
new
|
|
1517 | 1517 | _activeSpeech.speechCoords[0] = actor->screenPosition; |
1518 | 1518 | _activeSpeech.speechCoords[0].y -= ACTOR_DIALOGUE_HEIGHT; |
1519 | 1519 | _activeSpeech.speechColor[0] = actor->speechColor; |
1520 | | _activeSpeech.outlineColor[0] = _vm->_gfx->getBlack(); |
| 1520 | _activeSpeech.outlineColor[0] = kITEColorBlack; |
1521 | 1521 | _activeSpeech.sampleResourceId = sampleResourceId; |
1522 | 1522 | _activeSpeech.playing = false; |
1523 | 1523 | _activeSpeech.slowModeCharIndex = 0; |
diff -ur --exclude=CVS ScummVM/saga/gfx.cpp ScummVM+hack/saga/gfx.cpp
old
|
new
|
|
60 | 60 | // Set module data |
61 | 61 | _back_buf = back_buf; |
62 | 62 | _init = 1; |
63 | | _white_index = -1; |
64 | | _black_index = -1; |
65 | 63 | |
66 | 64 | // For now, always show the mouse cursor. |
67 | 65 | setCursor(); |
… |
… |
|
749 | 747 | return &_back_buf; |
750 | 748 | } |
751 | 749 | |
752 | | int Gfx::getWhite(void) { |
753 | | return _white_index; |
754 | | } |
755 | | |
756 | | int Gfx::getBlack(void) { |
757 | | return _black_index; |
758 | | } |
759 | | |
760 | | int Gfx::matchColor(unsigned long colormask) { |
761 | | int i; |
762 | | int red = (colormask & 0x0FF0000UL) >> 16; |
763 | | int green = (colormask & 0x000FF00UL) >> 8; |
764 | | int blue = colormask & 0x00000FFUL; |
765 | | int dr; |
766 | | int dg; |
767 | | int db; |
768 | | long color_delta; |
769 | | long best_delta = LONG_MAX; |
770 | | int best_index = 0; |
771 | | byte *ppal; |
772 | | |
773 | | for (i = 0, ppal = _cur_pal; i < PAL_ENTRIES; i++, ppal += 4) { |
774 | | dr = ppal[0] - red; |
775 | | dr = ABS(dr); |
776 | | dg = ppal[1] - green; |
777 | | dg = ABS(dg); |
778 | | db = ppal[2] - blue; |
779 | | db = ABS(db); |
780 | | ppal[3] = 0; |
781 | | |
782 | | color_delta = (long)(dr * RED_WEIGHT + dg * GREEN_WEIGHT + db * BLUE_WEIGHT); |
783 | | |
784 | | if (color_delta == 0) { |
785 | | return i; |
786 | | } |
787 | | |
788 | | if (color_delta < best_delta) { |
789 | | best_delta = color_delta; |
790 | | best_index = i; |
791 | | } |
792 | | } |
793 | | |
794 | | return best_index; |
795 | | } |
796 | | |
797 | 750 | int Gfx::setPalette(SURFACE *surface, PALENTRY *pal) { |
798 | | byte red; |
799 | | byte green; |
800 | | byte blue; |
801 | | int color_delta; |
802 | | int best_wdelta = 0; |
803 | | int best_windex = 0; |
804 | | int best_bindex = 0; |
805 | | int best_bdelta = 1000; |
806 | 751 | int i; |
807 | 752 | byte *ppal; |
808 | 753 | |
809 | 754 | for (i = 0, ppal = _cur_pal; i < PAL_ENTRIES; i++, ppal += 4) { |
810 | | red = pal[i].red; |
811 | | ppal[0] = red; |
812 | | color_delta = red; |
813 | | green = pal[i].green; |
814 | | ppal[1] = green; |
815 | | color_delta += green; |
816 | | blue = pal[i].blue; |
817 | | ppal[2] = blue; |
818 | | color_delta += blue; |
| 755 | ppal[0] = pal[i].red; |
| 756 | ppal[1] = pal[i].green; |
| 757 | ppal[2] = pal[i].blue; |
819 | 758 | ppal[3] = 0; |
820 | | |
821 | | if (color_delta < best_bdelta) { |
822 | | best_bindex = i; |
823 | | best_bdelta = color_delta; |
824 | | } |
825 | | |
826 | | if (color_delta > best_wdelta) { |
827 | | best_windex = i; |
828 | | best_wdelta = color_delta; |
829 | | } |
830 | 759 | } |
831 | 760 | |
832 | | // Set whitest and blackest color indices |
833 | | _white_index = best_windex; |
834 | | _black_index = best_bindex; |
835 | | |
836 | 761 | _system->setPalette(_cur_pal, 0, PAL_ENTRIES); |
837 | 762 | |
838 | 763 | return SUCCESS; |
diff -ur --exclude=CVS ScummVM/saga/gfx.h ScummVM+hack/saga/gfx.h
old
|
new
|
|
68 | 68 | |
69 | 69 | #define PAL_ENTRIES 256 |
70 | 70 | |
71 | | #define RGB_RED 0x00FF0000UL |
72 | | #define RGB_GREEN 0x0000FF00UL |
73 | | #define RGB_BLUE 0x000000FFUL |
74 | | |
75 | 71 | #define CURSOR_W 7 |
76 | 72 | #define CURSOR_H 7 |
77 | 73 | |
78 | 74 | #define CURSOR_ORIGIN_X 4 |
79 | 75 | #define CURSOR_ORIGIN_Y 4 |
80 | 76 | |
81 | | #define RED_WEIGHT 0.299 |
82 | | #define GREEN_WEIGHT 0.587 |
83 | | #define BLUE_WEIGHT 0.114 |
84 | | |
85 | 77 | int drawPalette(SURFACE *dst_s); |
86 | 78 | int bufToSurface(SURFACE *ds, const byte *src, int src_w, int src_h, Rect *src_rect, Point *dst_pt); |
87 | 79 | int bufToBuffer(byte * dst_buf, int dst_w, int dst_h, const byte *src, |
… |
… |
|
100 | 92 | |
101 | 93 | Gfx(OSystem *system, int width, int height, GameDetector &detector); |
102 | 94 | SURFACE *getBackBuffer(); |
103 | | int getWhite(); |
104 | | int getBlack(); |
105 | | int matchColor(unsigned long colormask); |
106 | 95 | int setPalette(SURFACE *surface, PALENTRY *pal); |
107 | 96 | int getCurrentPal(PALENTRY *src_pal); |
108 | 97 | int palToBlack(SURFACE *surface, PALENTRY *src_pal, double percent); |
… |
… |
|
114 | 103 | void setCursor(); |
115 | 104 | int _init; |
116 | 105 | SURFACE _back_buf; |
117 | | int _white_index; |
118 | | int _black_index; |
119 | 106 | byte _cur_pal[PAL_ENTRIES * 4]; |
120 | 107 | OSystem *_system; |
121 | 108 | }; |
diff -ur --exclude=CVS ScummVM/saga/interface.h ScummVM+hack/saga/interface.h
old
|
new
|
|
99 | 99 | kITEColorDarkGrey = 0x0b, |
100 | 100 | kITEColorGreen = 0xba, |
101 | 101 | kITEColorBlack = 0x0f, |
| 102 | kITEColorRed = 0x65, |
102 | 103 | kITEColorBlue = 0x93 |
103 | 104 | }; |
104 | 105 | |
diff -ur --exclude=CVS ScummVM/saga/objectmap.cpp ScummVM+hack/saga/objectmap.cpp
old
|
new
|
|
31 | 31 | #include "saga/gfx.h" |
32 | 32 | #include "saga/console.h" |
33 | 33 | #include "saga/font.h" |
| 34 | #include "saga/interface.h" |
34 | 35 | #include "saga/objectmap.h" |
35 | 36 | #include "saga/stream.h" |
36 | 37 | |
… |
… |
|
206 | 207 | if (hitZoneIndex != -1) { |
207 | 208 | snprintf(txtBuf, sizeof(txtBuf), "hitZone %d", hitZoneIndex); |
208 | 209 | _vm->_font->draw(SMALL_FONT_ID, ds, txtBuf, 0, 2, 2, |
209 | | _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE); |
| 210 | kITEColorBrightWhite, kITEColorBlack, FONT_OUTLINE); |
210 | 211 | |
211 | 212 | } |
212 | 213 | } |
diff -ur --exclude=CVS ScummVM/saga/render.cpp ScummVM+hack/saga/render.cpp
old
|
new
|
|
126 | 126 | // Display scene maps, if applicable |
127 | 127 | if (getFlags() & RF_OBJECTMAP_TEST) { |
128 | 128 | if (_vm->_scene->_objectMap) |
129 | | _vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack()); |
| 129 | _vm->_scene->_objectMap->draw(backbuf_surface, mouse_pt, kITEColorBrightWhite, kITEColorBlack); |
130 | 130 | if (_vm->_scene->_actionMap) |
131 | | _vm->_scene->_actionMap->draw(backbuf_surface, mouse_pt, _vm->_gfx->matchColor(RGB_RED), _vm->_gfx->getBlack()); |
| 131 | _vm->_scene->_actionMap->draw(backbuf_surface, mouse_pt, kITEColorRed, kITEColorBlack); |
132 | 132 | } |
133 | 133 | |
134 | 134 | // Draw queued actors |
… |
… |
|
152 | 152 | sprintf(txt_buf, "%d", _fps); |
153 | 153 | fps_width = _vm->_font->getStringWidth(SMALL_FONT_ID, txt_buf, 0, FONT_NORMAL); |
154 | 154 | _vm->_font->draw(SMALL_FONT_ID, backbuf_surface, txt_buf, 0, backbuf_surface->w - fps_width, 2, |
155 | | _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE); |
| 155 | kITEColorBrightWhite, kITEColorBlack, FONT_OUTLINE); |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Display "paused game" message, if applicable |
… |
… |
|
160 | 160 | int msg_len = strlen(PAUSEGAME_MSG); |
161 | 161 | int msg_w = _vm->_font->getStringWidth(BIG_FONT_ID, PAUSEGAME_MSG, msg_len, FONT_OUTLINE); |
162 | 162 | _vm->_font->draw(BIG_FONT_ID, backbuf_surface, PAUSEGAME_MSG, msg_len, |
163 | | (backbuf_surface->w - msg_w) / 2, 90, _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE); |
| 163 | (backbuf_surface->w - msg_w) / 2, 90, kITEColorBrightWhite, kITEColorBlack, FONT_OUTLINE); |
164 | 164 | } |
165 | 165 | |
166 | 166 | // Update user interface |
… |
… |
|
170 | 170 | // Display text formatting test, if applicable |
171 | 171 | if (_flags & RF_TEXT_TEST) { |
172 | 172 | _vm->textDraw(MEDIUM_FONT_ID, backbuf_surface, test_txt, mouse_pt.x, mouse_pt.y, |
173 | | _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE | FONT_CENTERED); |
| 173 | kITEColorBrightWhite, kITEColorBlack, FONT_OUTLINE | FONT_CENTERED); |
174 | 174 | } |
175 | 175 | |
176 | 176 | // Display palette test, if applicable |
diff -ur --exclude=CVS ScummVM/saga/sfuncs.cpp ScummVM+hack/saga/sfuncs.cpp
old
|
new
|
|
1091 | 1091 | |
1092 | 1092 | _vm->_scene->getInfo(&scene_info); |
1093 | 1093 | |
1094 | | text_entry.color = _vm->_gfx->getWhite(); |
1095 | | text_entry.effect_color = _vm->_gfx->getBlack(); |
| 1094 | text_entry.color = kITEColorBrightWhite; |
| 1095 | text_entry.effect_color = kITEColorBlack; |
1096 | 1096 | text_entry.text_x = _vm->getDisplayWidth() / 2; |
1097 | 1097 | text_entry.text_y = (_vm->getSceneHeight() - _vm->_font->getHeight(MEDIUM_FONT_ID)) / 2; |
1098 | 1098 | text_entry.font_id = MEDIUM_FONT_ID; |
diff -ur --exclude=CVS ScummVM/saga/xref.txt ScummVM+hack/saga/xref.txt
old
|
new
|
|
103 | 103 | GREY_0A kITEColorGrey |
104 | 104 | DK_GREY_0B kITEColorDarkGrey |
105 | 105 | PITCH_BLACK kITEColorBlack |
| 106 | RED_65 kITEColorRed |
106 | 107 | BLUE_93 kITEColorBlue |
107 | 108 | GREEB_BA kITEColorGreen |
108 | 109 | |