diff --git a/ChangeLog b/ChangeLog index 266ce07..25b754b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +- screen clipping of gfx_AddUpdateRect + - draw_field, draw_player and restore player function fixed, problems with position on the field is greater as the fieldsize. (SDL BadValue) diff --git a/configure.in b/configure.in index ad053fd..7fcd5e9 100644 --- a/configure.in +++ b/configure.in @@ -86,7 +86,7 @@ fi dnl Set PACKAGE DATA & DOC DIR packagedatadir=share/${PACKAGE} -packagedocdir=doc/${PACKAGE} +packagedocdir=share/doc/${PACKAGE} dnl Set PACKAGE DIRS in config.h. packagepixmapsdir=${packagedatadir}/pixmaps diff --git a/src/gfx.c b/src/gfx.c index 22007ea..c681fa6 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -1,4 +1,4 @@ -/* $Id: gfx.c,v 1.21 2003/06/16 21:03:16 stpohle Exp $ */ +/* $Id: gfx.c,v 1.22 2003/06/20 22:59:21 stpohle Exp $ */ /* gfx.c */ #include @@ -595,12 +595,33 @@ gfx_shutdown () void gfx_AddUpdateRect (int x, int y, int w, int h) { + /* clipping of the box */ + if (x >= gfx.res.x || y >= gfx.res.y || y+h <= 0 || x+w <= 0) + return; + if (UpdateRects_nr >= MAX_UPDATERECTS) return; - UpdateRects[UpdateRects_nr].x = x; - UpdateRects[UpdateRects_nr].y = y; - UpdateRects[UpdateRects_nr].w = w; - UpdateRects[UpdateRects_nr].h = h; + + if (x < 0) + UpdateRects[UpdateRects_nr].x = 0; + else + UpdateRects[UpdateRects_nr].x = x; + + if (y < 0) + UpdateRects[UpdateRects_nr].y = 0; + else + UpdateRects[UpdateRects_nr].y = y; + + if (w+x >= gfx.res.x) + UpdateRects[UpdateRects_nr].w = gfx.res.x - x; + else + UpdateRects[UpdateRects_nr].w = w; + + if (h+y >= gfx.res.y) + UpdateRects[UpdateRects_nr].h = gfx.res.y - y; + else + UpdateRects[UpdateRects_nr].h = h; + UpdateRects_nr++; };