[Scummvm-cvs-logs] CVS: scummvm/queen display.cpp,1.58.2.1,1.58.2.2 display.h,1.42,1.42.2.1 graphics.cpp,1.94.2.2,1.94.2.3
Gregory Montoir
cyx at users.sourceforge.net
Thu Mar 18 14:04:00 CET 2004
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17875/queen
Modified Files:
Tag: branch-0-6-0
display.cpp display.h graphics.cpp
Log Message:
minor cleanup
Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.58.2.1
retrieving revision 1.58.2.2
diff -u -d -r1.58.2.1 -r1.58.2.2
--- display.cpp 21 Feb 2004 08:51:07 -0000 1.58.2.1
+++ display.cpp 18 Mar 2004 21:53:20 -0000 1.58.2.2
@@ -115,10 +115,7 @@
}
uint offset = (y / 4) * 160 + (x / 4);
- if (offset >= sizeof(_dynalum.msk)) {
- debug(6, "Graphics::dynalumUpdate(%d, %d) - invalid offset: %08x", x, y, offset);
- return;
- }
+ assert(offset < sizeof(_dynalum.msk));
uint8 colMask = _dynalum.msk[offset];
debug(9, "Display::dynalumUpdate(%d, %d) - colMask = %d", x, y, colMask);
@@ -331,7 +328,7 @@
j += jdir;
if(j <= 0 || j >= 14) {
jdir = -jdir;
- if (_vm->randomizer.getRandomNumber(1)) {
+ if (_rnd.getRandomNumber(1)) {
if (ABS(jdir) == 1) {
jdir *= 2;
} else {
@@ -937,8 +934,8 @@
uint8 buf[32 * 32];
while (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) {
for(int i = 0; i < 2; ++i) {
- uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - 32 - 2) + 1;
- uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - 32 - 2) + 1;
+ uint16 x = _rnd.getRandomNumber(SCREEN_W - 32 - 2) + 1;
+ uint16 y = _rnd.getRandomNumber(SCREEN_H - 32 - 2) + 1;
uint8 *p = _screenBuf + SCREEN_W * y + x;
uint8 *q = buf;
uint16 h = 32;
@@ -947,16 +944,9 @@
p += SCREEN_W;
q += 32;
}
- if (_vm->randomizer.getRandomNumber(1)) {
- --x;
- } else {
- ++x;
- }
- if (_vm->randomizer.getRandomNumber(1)) {
- --y;
- } else {
- ++y;
- }
+ const int inc[] = { -1, 1 };
+ x += inc[_rnd.getRandomNumber(1)];
+ y += inc[_rnd.getRandomNumber(1)];
_system->copy_rect(buf, 32, x, y, 32, 32);
_system->update_screen();
_vm->input()->delay(10);
@@ -966,11 +956,11 @@
void Display::blankScreenEffect2() {
while (_vm->input()->idleTime() >= Input::DELAY_SCREEN_BLANKER) {
- uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - 2);
- uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - 2);
+ uint16 x = _rnd.getRandomNumber(SCREEN_W - 2);
+ uint16 y = _rnd.getRandomNumber(SCREEN_H - 2);
uint8 *p = _screenBuf + y * SCREEN_W + x;
uint8 c = 0;
- switch (_vm->randomizer.getRandomNumber(3)) {
+ switch (_rnd.getRandomNumber(3)) {
case 0:
c = *p;
break;
@@ -1003,8 +993,8 @@
memset(_screenBuf, 0, SCREEN_W * SCREEN_H);
_system->copy_rect(_screenBuf, SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
} else {
- uint16 x = _vm->randomizer.getRandomNumber(SCREEN_W - 2);
- uint16 y = _vm->randomizer.getRandomNumber(SCREEN_H - 2);
+ uint16 x = _rnd.getRandomNumber(SCREEN_W - 2);
+ uint16 y = _rnd.getRandomNumber(SCREEN_H - 2);
uint8 *p = _screenBuf + SCREEN_W * y + x;
uint8 p0 = *p;
uint8 p1 = *(p + 1);
Index: display.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.h,v
retrieving revision 1.42
retrieving revision 1.42.2.1
diff -u -d -r1.42 -r1.42.2.1
--- display.h 13 Feb 2004 16:27:36 -0000 1.42
+++ display.h 18 Mar 2004 21:53:20 -0000 1.42.2.1
@@ -168,6 +168,7 @@
bool _gotTick;
+ Common::RandomSource _rnd;
Dynalum _dynalum;
OSystem *_system;
QueenEngine *_vm;
Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.94.2.2
retrieving revision 1.94.2.3
diff -u -d -r1.94.2.2 -r1.94.2.3
--- graphics.cpp 7 Mar 2004 10:44:43 -0000 1.94.2.2
+++ graphics.cpp 18 Mar 2004 21:53:20 -0000 1.94.2.3
@@ -303,37 +303,19 @@
assert(new_w * new_h < BOB_SHRINK_BUF_SIZE);
if (new_w != 0 && new_h != 0) {
-
_shrinkBuffer.width = new_w;
_shrinkBuffer.height = new_h;
- uint32 shrinker = (100 << 0x10) / percentage;
- uint16 x_scale = shrinker >> 0x10;
- uint16 y_scale = x_scale * bf->width;
- shrinker &= 0xFFFF;
-
- uint8* src = bf->data;
+ uint16 x, y;
+ uint16 sh[GAME_SCREEN_WIDTH];
+ for (x = 0; x < MAX(new_h, new_w); ++x) {
+ sh[x] = x * 100 / percentage;
+ }
uint8* dst = _shrinkBuffer.data;
-
- uint32 y_count = 0;
- while (new_h--) {
- uint16 i;
- uint32 x_count = 0;
- uint8 *p = src;
- for(i = 0; i < new_w; ++i) {
- *dst++ = *p;
- p += x_scale;
- x_count += shrinker;
- if (x_count > 0xFFFF) {
- ++p;
- x_count &= 0xFFFF;
- }
- }
- src += y_scale;
- y_count += shrinker;
- if (y_count > 0xFFFF) {
- src += bf->width;
- y_count &= 0xFFFF;
+ for (y = 0; y < new_h; ++y) {
+ uint8 *p = bf->data + sh[y] * bf->width;
+ for(x = 0; x < new_w; ++x) {
+ *dst++ = *(p + sh[x]);
}
}
}
More information about the Scummvm-git-logs
mailing list