[Scummvm-cvs-logs] CVS: scummvm/saga actionmap.cpp,1.27,1.28 console.cpp,1.17,1.18 events.cpp,1.28,1.29 gfx.cpp,1.30,1.31 gfx.h,1.13,1.14 interface.cpp,1.32,1.33 isomap.cpp,1.19,1.20 objectmap.cpp,1.25,1.26 render.cpp,1.38,1.39 scene.cpp,1.50,1.51 sprite.cpp,1.23,1.24

Max Horn fingolfin at users.sourceforge.net
Sat Oct 30 15:35:12 CEST 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14800

Modified Files:
	actionmap.cpp console.cpp events.cpp gfx.cpp gfx.h 
	interface.cpp isomap.cpp objectmap.cpp render.cpp scene.cpp 
	sprite.cpp 
Log Message:
Turn some methods into functions (potentially gives better code, and we may want to move some of those into the graphics/ module one day)

Index: actionmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actionmap.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- actionmap.cpp	27 Oct 2004 21:32:27 -0000	1.27
+++ actionmap.cpp	30 Oct 2004 22:34:08 -0000	1.28
@@ -147,7 +147,7 @@
 				}
 			} else if (n_points > 2) {
 				// Hit-test a polygon
-				if (_vm->_gfx->hitTestPoly(points, n_points, imouse)) {
+				if (hitTestPoly(points, n_points, imouse)) {
 					return i;
 				}
 			}
@@ -170,10 +170,10 @@
 			clickarea = &exmap_entry->clickareas[k];
 			if (clickarea->n_points == 2) {
 				// 2 points represent a box
-				_vm->_gfx->drawFrame(ds, &clickarea->points[0], &clickarea->points[1], color);
+				drawFrame(ds, &clickarea->points[0], &clickarea->points[1], color);
 			} else if (clickarea->n_points > 2) {
 				// Otherwise draw a polyline
-				_vm->_gfx->drawPolyLine(ds, clickarea->points, clickarea->n_points, color);
+				drawPolyLine(ds, clickarea->points, clickarea->n_points, color);
 			}
 		}
 	}

Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/console.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- console.cpp	30 Oct 2004 22:13:48 -0000	1.17
+++ console.cpp	30 Oct 2004 22:34:08 -0000	1.18
@@ -208,7 +208,7 @@
 	fill_rect.bottom = _yPos + 1;
 	fill_rect.right = ds->w;
 
-	_vm->_gfx->drawRect(ds, &fill_rect, _vm->_gfx->matchColor(CONSOLE_BGCOLOR));
+	drawRect(ds, &fill_rect, _vm->_gfx->matchColor(CONSOLE_BGCOLOR));
 	txt_fgcolor = _vm->_gfx->matchColor(CONSOLE_TXTCOLOR);
 	txt_shcolor = _vm->_gfx->matchColor(CONSOLE_TXTSHADOW);
 

Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- events.cpp	27 Oct 2004 21:32:27 -0000	1.28
+++ events.cpp	30 Oct 2004 22:34:08 -0000	1.29
@@ -332,7 +332,7 @@
 				bg_pt.x = bginfo.bg_x;
 				bg_pt.y = bginfo.bg_y;
 
-				_vm->_gfx->bufToBuffer(rbuf_info.bg_buf, rbuf_info.bg_buf_w, rbuf_info.bg_buf_h,
+				bufToBuffer(rbuf_info.bg_buf, rbuf_info.bg_buf_w, rbuf_info.bg_buf_h,
 								bginfo.bg_buf, bginfo.bg_w, bginfo.bg_h, NULL, &bg_pt);
 				if (event->param == SET_PALETTE) {
 					PALENTRY *pal_p;

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- gfx.cpp	30 Oct 2004 22:13:48 -0000	1.30
+++ gfx.cpp	30 Oct 2004 22:34:08 -0000	1.31
@@ -70,7 +70,7 @@
 }
  */
 
-int Gfx::drawPalette(SURFACE *dst_s) {
+int drawPalette(SURFACE *dst_s) {
 	int x;
 	int y;
 	int color = 0;
@@ -93,31 +93,6 @@
 	return 0;
 }
 
-int Gfx::simpleBlit(SURFACE *dst_s, SURFACE *src_s) {
-	byte *src_p;
-	byte *dst_p;
-	int y, w, p;
-
-	assert((dst_s != NULL) && (src_s != NULL));
-	assert(dst_s->w == src_s->w);
-	assert(dst_s->h == src_s->h);
-
-	src_p = (byte *)src_s->pixels;
-	dst_p = (byte *)dst_s->pixels;
-
-	w = src_s->w;
-	p = src_s->pitch;
-
-	for (y = 0; y < src_s->h; y++) {
-		memcpy(dst_p, src_p, w);
-
-		dst_p += p;
-		src_p += p;
-	}
-
-	return SUCCESS;
-}
-
 // TODO: I've fixed at least one clipping bug here, but I have a feeling there
 //       are several more. 
 
@@ -130,7 +105,7 @@
 // - If src_rect is NULL, the entire buffer is copied./
 // - The surface must match the logical dimensions of the buffer exactly.
 // - Returns FAILURE on error
-int Gfx::bufToSurface(SURFACE *ds, const byte *src, int src_w, int src_h, 
+int bufToSurface(SURFACE *ds, const byte *src, int src_w, int src_h, 
 					 Rect *src_rect, Point *dst_pt) {
 	const byte *read_p;
 	byte *write_p;
@@ -256,7 +231,7 @@
 	return SUCCESS;
 }
 
-int Gfx::bufToBuffer(byte *dst_buf, int dst_w, int dst_h, const byte *src,
+int bufToBuffer(byte *dst_buf, int dst_w, int dst_h, const byte *src,
 					int src_w, int src_h, Rect *src_rect, Point *dst_pt) {
 	const byte *read_p;
 	byte *write_p;
@@ -378,7 +353,7 @@
 
 // Fills a rectangle in the surface ds from point 'p1' to point 'p2' using
 // the specified color.
-int Gfx::drawRect(SURFACE *ds, Rect *dst_rect, int color) {
+int drawRect(SURFACE *ds, Rect *dst_rect, int color) {
 	byte *write_p;
 
 	int w;
@@ -418,7 +393,7 @@
 	return SUCCESS;
 }
 
-int Gfx::drawFrame(SURFACE *ds, const Point *p1, const Point *p2, int color) {
+int drawFrame(SURFACE *ds, const Point *p1, const Point *p2, int color) {
 	int left, top, right, bottom;
 
 	int min_x;
@@ -460,7 +435,7 @@
 	return SUCCESS;
 }
 
-int Gfx::drawPolyLine(SURFACE *ds, const Point *pts, int pt_ct, int draw_color) {
+int drawPolyLine(SURFACE *ds, const Point *pts, int pt_ct, int draw_color) {
 	const Point *first_pt = pts;
 	int last_i = 1;
 	int i;
@@ -481,7 +456,7 @@
 	return SUCCESS;
 }
 
-int Gfx::getClipInfo(CLIPINFO *clipinfo) {
+int getClipInfo(CLIPINFO *clipinfo) {
 	Common::Rect s;
 	int d_x, d_y;
 
@@ -565,7 +540,7 @@
 	return SUCCESS;
 }
 
-int Gfx::clipLine(SURFACE *ds, const Point *src_p1, const Point *src_p2, 
+int clipLine(SURFACE *ds, const Point *src_p1, const Point *src_p2, 
 				 Point *dst_p1, Point *dst_p2) {
 	const Point *n_p1;
 	const Point *n_p2;
@@ -637,7 +612,7 @@
 // Coriolis Group Books, 1997
 //
 // Performs no clipping
-void Gfx::drawLine(SURFACE *ds, const Point *p1, const Point *p2, int color) {
+void drawLine(SURFACE *ds, const Point *p1, const Point *p2, int color) {
 	byte *write_p;
 	int clip_result;
 	int temp;
@@ -1079,7 +1054,7 @@
 	_system->setMouseCursor(cursor_img, CURSOR_W, CURSOR_H, 4, 4, keycolor);
 }
 
-bool Gfx::hitTestPoly(const Point *points, unsigned int npoints, const Point& test_point) {
+bool hitTestPoly(const Point *points, unsigned int npoints, const Point& test_point) {
 	int yflag0;
 	int yflag1;
 	bool inside_flag = false;

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- gfx.h	30 Oct 2004 22:13:48 -0000	1.13
+++ gfx.h	30 Oct 2004 22:34:08 -0000	1.14
@@ -82,19 +82,21 @@
 #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,
+	int src_w, int src_h, Rect *src_rect, Point *dst_pt);
+int getClipInfo(CLIPINFO *clipinfo);
+int drawRect(SURFACE *ds, Rect *dst_rect, int color);
+int drawFrame(SURFACE *ds, const Point *p1, const Point *p2, int color);
+int drawPolyLine(SURFACE *ds, const Point *pts, int pt_ct, int draw_color);
+int clipLine(SURFACE *ds, const Point *src_p1, const Point *src_p2, Point *dst_p1, Point *dst_p2);
+void drawLine(SURFACE * ds, const Point *p1, const Point *p2, int color);
+
+bool hitTestPoly(const Point *points, unsigned int npoints, const Point& test_point);
+
 class Gfx {
 public:
-	int simpleBlit(SURFACE *dst_s, SURFACE *src_s);
-	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,
-		int src_w, int src_h, Rect *src_rect, Point *dst_pt);
-	int drawRect(SURFACE *ds, Rect *dst_rect, int color);
-	int drawFrame(SURFACE *ds, const Point *p1, const Point *p2, int color);
-	int drawPolyLine(SURFACE *ds, const Point *pts, int pt_ct, int draw_color);
-	int getClipInfo(CLIPINFO *clipinfo);
-	int clipLine(SURFACE *ds, const Point *src_p1, const Point *src_p2, Point *dst_p1, Point *dst_p2);
-	void drawLine(SURFACE * ds, const Point *p1, const Point *p2, int color);
 
 	Gfx(OSystem *system, int width, int height);
 	SURFACE *getBackBuffer();
@@ -105,7 +107,6 @@
 	int getCurrentPal(PALENTRY *src_pal);
 	int palToBlack(SURFACE *surface, PALENTRY *src_pal, double percent);
 	int blackToPal(SURFACE *surface, PALENTRY *src_pal, double percent);
-	bool hitTestPoly(const Point *points, unsigned int npoints, const Point& test_point);
 
 private:
 	void setCursor(int best_white);

Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- interface.cpp	27 Oct 2004 21:32:27 -0000	1.32
+++ interface.cpp	30 Oct 2004 22:34:08 -0000	1.33
@@ -308,7 +308,7 @@
 	rect.right = g_di.logical_w;
 	rect.bottom = _iDesc.status_y + _iDesc.status_h;
 
-	_vm->_gfx->drawRect(back_buf, &rect, _iDesc.status_bgcol);
+	drawRect(back_buf, &rect, _iDesc.status_bgcol);
 
 	// Draw command panel background
 	if (_panelMode == kPanelCommand) {
@@ -318,7 +318,7 @@
 		origin.x = 0;
 		origin.y = g_di.logical_h - _cPanel.img_h;
 
-		_vm->_gfx->bufToSurface(back_buf, _cPanel.img, _cPanel.img_w,
+		bufToSurface(back_buf, _cPanel.img, _cPanel.img_w,
 						_cPanel.img_h, NULL, &origin);
 	} else {
 		xbase = _dPanel.x;
@@ -327,7 +327,7 @@
 		origin.x = 0;
 		origin.y = g_di.logical_h - _cPanel.img_h;
 
-		_vm->_gfx->bufToSurface(back_buf, _dPanel.img, _dPanel.img_w,
+		bufToSurface(back_buf, _dPanel.img, _dPanel.img_w,
 						_dPanel.img_h, NULL, &origin);
 	}
 
@@ -405,7 +405,7 @@
 	rect.right = g_di.logical_w;
 	rect.bottom = _iDesc.status_y + _iDesc.status_h;
 
-	_vm->_gfx->drawRect(ds, &rect, _iDesc.status_bgcol);
+	drawRect(ds, &rect, _iDesc.status_bgcol);
 
 	string_w = _vm->_font->getStringWidth(SMALL_FONT_ID, _statusText, 0, 0);
 

Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- isomap.cpp	30 Oct 2004 22:13:48 -0000	1.19
+++ isomap.cpp	30 Oct 2004 22:34:08 -0000	1.20
@@ -135,7 +135,7 @@
 	GAME_DISPLAYINFO disp_info;
 	GAME_GetDisplayInfo(&disp_info);
 	Rect iso_rect(disp_info.logical_w, disp_info.scene_h);
-	_gfx->drawRect(dst_s, &iso_rect, 0);
+	drawRect(dst_s, &iso_rect, 0);
 	drawMetamap(dst_s, -1000, -500);
 
 	return SUCCESS;

Index: objectmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- objectmap.cpp	27 Oct 2004 21:32:27 -0000	1.25
+++ objectmap.cpp	30 Oct 2004 22:34:08 -0000	1.26
@@ -285,10 +285,10 @@
 			clickarea = &object_map->clickareas[k];
 			if (clickarea->n_points == 2) {
 				// 2 points represent a box
-				_vm->_gfx->drawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
+				drawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
 			} else if (clickarea->n_points > 2) {
 				// Otherwise draw a polyline
-				_vm->_gfx->drawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
+				drawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
 			}
 		}
 	}
@@ -332,7 +332,7 @@
 				}
 			} else if (n_points > 2) {
 				// Hit-test a polygon
-				if (_vm->_gfx->hitTestPoly(points, n_points, imouse)) {
+				if (hitTestPoly(points, n_points, imouse)) {
 					return object_map->objectNum;
 				}
 			}

Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- render.cpp	30 Oct 2004 22:13:48 -0000	1.38
+++ render.cpp	30 Oct 2004 22:34:08 -0000	1.39
@@ -179,7 +179,7 @@
 
 	// Display palette test, if applicable
 	if (_flags & RF_PALETTE_TEST) {
-		_vm->_gfx->drawPalette(backbuf_surface);
+		drawPalette(backbuf_surface);
 	}
 
 	// Draw console

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- scene.cpp	28 Oct 2004 01:56:25 -0000	1.50
+++ scene.cpp	30 Oct 2004 22:34:08 -0000	1.51
@@ -822,7 +822,7 @@
 	switch (_sceneMode) {
 
 	case SCENE_MODE_NORMAL:
-		_vm->_gfx->bufToSurface(dst_s, buf_info.bg_buf, disp_info.logical_w,
+		bufToSurface(dst_s, buf_info.bg_buf, disp_info.logical_w,
 						MAX(disp_info.scene_h, _bg.h), NULL, &bg_pt);
 		break;
 	case SCENE_MODE_ISO:

Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sprite.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- sprite.cpp	30 Oct 2004 22:13:48 -0000	1.23
+++ sprite.cpp	30 Oct 2004 22:34:08 -0000	1.24
@@ -349,7 +349,7 @@
 	ci.src_rect = &spr_src_rect;
 	ci.dst_pt = &spr_pt;
 
-	_vm->_gfx->getClipInfo(&ci);
+	getClipInfo(&ci);
 
 	if (ci.nodraw) {
 		return SUCCESS;





More information about the Scummvm-git-logs mailing list