[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.153,1.154 events.cpp,1.57,1.58 gfx.cpp,1.53,1.54 gfx.h,1.30,1.31 module.mk,1.25,1.26 saga.h,1.104,1.105
Andrew Kurushin
h00ligan at users.sourceforge.net
Sat Jul 9 10:13:09 CEST 2005
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12523
Modified Files:
actor.cpp events.cpp gfx.cpp gfx.h module.mk saga.h
Log Message:
code cleanups
transitionDissolve -> gfx
del sdebug
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- actor.cpp 9 Jul 2005 16:23:44 -0000 1.153
+++ actor.cpp 9 Jul 2005 17:11:41 -0000 1.154
@@ -1313,9 +1313,10 @@
actor = _actors[i];
if (!actor->inScene)
continue;
-
- _drawOrderList.pushBack(actor, compareFunction);
- calcScreenPosition(actor);
+
+ if (calcScreenPosition(actor)) {
+ _drawOrderList.pushBack(actor, compareFunction);
+ }
}
for (i = 0; i < _objsCount; i++) {
@@ -1325,9 +1326,9 @@
if (obj->sceneNumber != _vm->_scene->currentSceneNumber())
continue;
- _drawOrderList.pushBack(obj, compareFunction);
- if (!calcScreenPosition(obj)) {
- warning("calcScreenPosition return false actorIdx=%i", i);
+
+ if (calcScreenPosition(obj)) {
+ _drawOrderList.pushBack(obj, compareFunction);
}
}
}
Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- events.cpp 9 Jul 2005 16:23:44 -0000 1.57
+++ events.cpp 9 Jul 2005 17:11:41 -0000 1.58
@@ -126,6 +126,7 @@
Surface *backGroundSurface;
BGInfo bgInfo;
+ Rect rect;
event_pc = ((double)event->duration - event->time) / event->duration;
@@ -163,21 +164,26 @@
case EVENT_DISSOLVE:
backGroundSurface = _vm->_render->getBackGroundSurface();
_vm->_scene->getBGInfo(bgInfo);
- _vm->transitionDissolve((byte*)backGroundSurface->pixels, backGroundSurface->w,
- backGroundSurface->h, bgInfo.buffer, bgInfo.bounds.width(), bgInfo.bounds.height(), 0, 0, 0, event_pc);
+ rect.left = rect.top = 0;
+ rect.right = bgInfo.bounds.width();
+ rect.bottom = bgInfo.bounds.height();
+ backGroundSurface->transitionDissolve(bgInfo.buffer, rect, 0, event_pc);
break;
case EVENT_DISSOLVE_BGMASK:
// we dissolve it centered.
// set flag of Dissolve to 1. It is a hack to simulate zero masking.
int w, h;
- byte *mask_buf;
+ byte *maskBuffer;
size_t len;
backGroundSurface = _vm->_render->getBackGroundSurface();
- _vm->_scene->getBGMaskInfo(w, h, mask_buf, len);
- _vm->transitionDissolve((byte*)backGroundSurface->pixels, backGroundSurface->w,
- backGroundSurface->h, mask_buf, w, h, 1,
- (_vm->getDisplayWidth() - w) / 2, (_vm->getDisplayHeight() - h) / 2, event_pc);
+ _vm->_scene->getBGMaskInfo(w, h, maskBuffer, len);
+ rect.left = (_vm->getDisplayWidth() - w) / 2;
+ rect.top = (_vm->getDisplayHeight() - h) / 2;
+ rect.setWidth(w);
+ rect.setHeight(h);
+
+ backGroundSurface->transitionDissolve( maskBuffer, rect, 1, event_pc);
break;
default:
break;
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- gfx.cpp 9 Jul 2005 16:23:44 -0000 1.53
+++ gfx.cpp 9 Jul 2005 17:11:41 -0000 1.54
@@ -124,6 +124,44 @@
}
}
+/**
+* Dissolve one image with another.
+* If flags if set to 1, do zero masking.
+*/
+void Surface::transitionDissolve(const byte *sourceBuffer, const Common::Rect &sourceRect, int flags, double percent) {
+#define XOR_MASK 0xB400;
+ int pixelcount = w * h;
+ int seqlimit = (int)(65535 * percent);
+ int seq = 1;
+ int i, x1, y1;
+ byte color;
+
+ for (i = 0; i < seqlimit; i++) {
+ if (seq & 1) {
+ seq = (seq >> 1) ^ XOR_MASK;
+ } else {
+ seq = seq >> 1;
+ }
+
+ if (seq == 1) {
+ return;
+ }
+
+ if (seq >= pixelcount) {
+ continue;
+ } else {
+ x1 = seq % w;
+ y1 = seq / w;
+
+ if (sourceRect.contains(x1, y1)) {
+ color = sourceBuffer[(x1-sourceRect.left) + sourceRect.width()*(y1-sourceRect.top)];
+ if (flags == 0 || color)
+ ((byte*)pixels)[seq] = color;
+ }
+ }
+ }
+}
+
void Gfx::setPalette(PalEntry *pal) {
int i;
Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- gfx.h 9 Jul 2005 16:23:44 -0000 1.30
+++ gfx.h 9 Jul 2005 17:11:41 -0000 1.31
@@ -87,6 +87,7 @@
struct Surface : Graphics::Surface {
+ void transitionDissolve(const byte *sourceBuffer, const Common::Rect &sourceRect, int flags, double percent);
void drawPalette();
void drawPolyLine(const Point *points, int count, int color);
void blit(const Common::Rect &destRect, const byte *sourceBuffer);
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/module.mk,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- module.mk 23 May 2005 02:23:32 -0000 1.25
+++ module.mk 9 Jul 2005 17:11:41 -0000 1.26
@@ -24,13 +24,11 @@
saga/saveload.o \
saga/scene.o \
saga/script.o \
- saga/sdebug.o \
saga/sfuncs.o \
saga/sndres.o \
saga/sprite.o \
saga/sthread.o \
saga/text.o \
- saga/transitions.o \
saga/input.o \
saga/music.o \
saga/sound.o
Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- saga.h 9 Jul 2005 16:23:45 -0000 1.104
+++ saga.h 9 Jul 2005 17:11:41 -0000 1.105
@@ -585,10 +585,6 @@
int effect_color, int flags);
int textProcessList(TEXTLIST *textlist, long ms);
- int transitionDissolve(byte *dst_img, int dst_w, int dst_h,
- const byte *src_img, int src_w, int src_h, int flags, int x, int y,
- double percent);
-
int processInput(void);
const Point &mousePos() const {
return _mousePos;
More information about the Scummvm-git-logs
mailing list