[Scummvm-cvs-logs] CVS: scummvm/saga gfx.cpp,1.11,1.12 gfx_mod.h,1.5,1.6 render.cpp,1.10,1.11 render.h,1.7,1.8
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Sun May 2 08:45:02 CEST 2004
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4160
Modified Files:
gfx.cpp gfx_mod.h render.cpp render.h
Log Message:
Got rid of r_softcursor by having the backend always draw the cursor
instead. This fixes graphics glitches in at least ITE.
Got rid of r_fullscreen, which wasn't even used anymore anyway.
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- gfx.cpp 2 May 2004 00:00:38 -0000 1.11
+++ gfx.cpp 2 May 2004 15:44:18 -0000 1.12
@@ -63,6 +63,11 @@
// Set module data
GfxModule.r_back_buf = r_back_buf;
GfxModule.init = 1;
+ GfxModule.white_index = -1;
+ GfxModule.black_index = -1;
+
+ // For now, always show the mouse cursor.
+ SYSINPUT_ShowMouse();
return R_SUCCESS;
}
@@ -376,73 +381,6 @@
return R_SUCCESS;
}
-int GFX_DrawCursor(R_SURFACE *ds, R_POINT *p1) {
- static byte cursor_img[R_CURSOR_W * R_CURSOR_H] = {
- 0, 0, 0, 255, 0, 0, 0,
- 0, 0, 0, 255, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 255, 255, 0, 0, 0, 255, 255,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 255, 0, 0, 0,
- 0, 0, 0, 255, 0, 0, 0
- };
-
- R_CLIPINFO ci;
-
- byte *src_p, *dst_p;
-
- int x, y;
- int src_skip, dst_skip;
-
- R_POINT cur_pt;
- R_RECT cur_rect;
-
- // Clamp point to surface
- cur_pt.x = MAX(p1->x, (int16)0);
- cur_pt.y = MAX(p1->y, (int16)0);
-
- cur_pt.x = MIN(p1->x, (int16)(ds->buf_w - 1));
- cur_pt.y = MIN(p1->y, (int16)(ds->buf_h - 1));
-
- cur_pt.x -= R_CURSOR_ORIGIN_X;
- cur_pt.y -= R_CURSOR_ORIGIN_Y;
-
- //Clip cursor to surface
- cur_rect.left = 0;
- cur_rect.top = 0;
- cur_rect.right = R_CURSOR_W - 1;
- cur_rect.bottom = R_CURSOR_H - 1;
-
- ci.dst_rect = &ds->clip_rect;
- ci.src_rect = &cur_rect;
- ci.dst_pt = &cur_pt;
-
- GFX_GetClipInfo(&ci);
-
- src_p = cursor_img + ci.src_draw_x + (ci.src_draw_y * R_CURSOR_W);
- dst_p = ds->buf + ci.dst_draw_x + (ci.dst_draw_y * ds->buf_pitch);
-
- src_skip = R_CURSOR_W - ci.draw_w;
- dst_skip = ds->buf_pitch - ci.draw_w;
-
- for (y = 0; y < ci.draw_h; y++) {
- for (x = 0; x < ci.draw_w; x++) {
- if (*src_p != 0) {
- *dst_p = *src_p;
- }
-
- dst_p++;
- src_p++;
- }
-
- src_p += src_skip;
- dst_p += dst_skip;
- }
-
- return R_SUCCESS;
-
-}
-
// Fills a rectangle in the surface ds from point 'p1' to point 'p2' using
// the specified color.
int GFX_DrawRect(R_SURFACE *ds, R_RECT *dst_rect, int color) {
@@ -963,6 +901,32 @@
}
}
+ // When the palette changes, make sure the cursor colours are still
+ // correct. We may have to reconsider this code later, but for now
+ // there is only one cursor image.
+
+ if (GfxModule.white_index != best_windex) {
+ // Set up the mouse cursor
+ static byte cursor_img[R_CURSOR_W * R_CURSOR_H] = {
+ 0, 0, 0, 255, 0, 0, 0,
+ 0, 0, 0, 255, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 255, 255, 0, 0, 0, 255, 255,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 255, 0, 0, 0,
+ 0, 0, 0, 255, 0, 0, 0
+ };
+
+ for (i = 0; i < R_CURSOR_W * R_CURSOR_H; i++) {
+ if (cursor_img[i] == 0)
+ cursor_img[i] = 255;
+ else if (cursor_img[i] == 255)
+ cursor_img[i] = best_windex;
+ }
+
+ _system->setMouseCursor(cursor_img, R_CURSOR_W, R_CURSOR_H, 4, 4);
+ }
+
// Set whitest and blackest color indices
GfxModule.white_index = best_windex;
GfxModule.black_index = best_bindex;
Index: gfx_mod.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx_mod.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gfx_mod.h 1 May 2004 09:40:47 -0000 1.5
+++ gfx_mod.h 2 May 2004 15:44:19 -0000 1.6
@@ -49,7 +49,6 @@
int GFX_BufToSurface(R_SURFACE *ds, const byte *src, int src_w, int src_h, R_RECT *src_rect, R_POINT *dst_pt);
int GFX_BufToBuffer(byte * dst_buf, int dst_w, int dst_h, const byte *src,
int src_w, int src_h, R_RECT *src_rect, R_POINT *dst_pt);
-int GFX_DrawCursor(R_SURFACE *ds, R_POINT *p1);
int GFX_DrawRect(R_SURFACE *ds, R_RECT *dst_rect, int color);
int GFX_DrawFrame(R_SURFACE *ds, R_POINT *p1, R_POINT *p2, int color);
int GFX_DrawPolyLine(R_SURFACE *ds, R_POINT *pts, int pt_ct, int draw_color);
Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- render.cpp 2 May 2004 02:11:55 -0000 1.10
+++ render.cpp 2 May 2004 15:44:19 -0000 1.11
@@ -53,14 +53,6 @@
const char *test_txt = "The quick brown fox jumped over the lazy dog. She sells sea shells down by the sea shore.";
int RENDER_Register() {
- // Register "r_softcursor" cfg cvar
- RenderModule.r_softcursor = R_SOFTCURSOR_DEFAULT;
-
- if (CVAR_Register_I(&RenderModule.r_softcursor,
- "r_softcursor", NULL, R_CVAR_CFG, 0, 1) != R_SUCCESS) {
- return R_FAILURE;
- }
-
return R_SUCCESS;
}
@@ -105,11 +97,6 @@
RenderModule.r_backbuf_surface = GFX_GetBackBuffer();
- // Initialize cursor state
- if (RenderModule.r_softcursor) {
- SYSINPUT_HideMouse();
- }
-
_system = system;
RenderModule.initialized = 1;
@@ -186,10 +173,6 @@
INTERFACE_Update(&mouse_pt, UPDATE_MOUSEMOVE);
- if (RenderModule.r_softcursor) {
- GFX_DrawCursor(backbuf_surface, &mouse_pt);
- }
-
// Display text formatting test, if applicable
if (RenderModule.r_flags & RF_TEXT_TEST) {
TEXT_Draw(MEDIUM_FONT_ID, backbuf_surface, test_txt, mouse_pt.x, mouse_pt.y,
Index: render.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- render.h 2 May 2004 02:11:55 -0000 1.7
+++ render.h 2 May 2004 15:44:19 -0000 1.8
@@ -32,17 +32,12 @@
#define R_FULLSCREEN_DEFAULT 0
#define R_DOUBLERES_DEFAULT 1
#define R_HICOLOR_DEFAULT 1
-#define R_SOFTCURSOR_DEFAULT 1
#define R_PAUSEGAME_MSG "PAWS GAME"
struct R_RENDER_MODULE {
int initialized;
- // Init cvars
- int r_fullscreen;
- int r_softcursor;
-
// Module data
R_SURFACE *r_backbuf_surface;
More information about the Scummvm-git-logs
mailing list