[Scummvm-cvs-logs] SF.net SVN: scummvm: [29863] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sat Dec 15 21:56:06 CET 2007
Revision: 29863
http://scummvm.svn.sourceforge.net/scummvm/?rev=29863&view=rev
Author: peres001
Date: 2007-12-15 12:56:05 -0800 (Sat, 15 Dec 2007)
Log Message:
-----------
Added halfbrite effect to Nippon Safes Amiga. Implementation is not complete, since the spotlight during Donna's dance is not moving yet.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/callables_ns.cpp
scummvm/trunk/engines/parallaction/graphics.cpp
scummvm/trunk/engines/parallaction/graphics.h
Modified: scummvm/trunk/engines/parallaction/callables_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables_ns.cpp 2007-12-15 12:02:47 UTC (rev 29862)
+++ scummvm/trunk/engines/parallaction/callables_ns.cpp 2007-12-15 20:56:05 UTC (rev 29863)
@@ -620,21 +620,17 @@
}
void Parallaction_ns::_c_projector(void*) {
-#ifdef HALFBRITE
static int dword_16032 = 0;
-// Bitmap bm;
-// InitBitMap(&bm);
+ _gfx->setHalfbriteMode(true);
- if (dword_16032 != 0) {
-/* // keep drawing spotlight in its final place
- _gfx->flatBlitCnv(&scnv, 110, 25, Gfx::kBitFront);
- BltBitMap(&bm, 0, 0, &_screen._bitMap, 110, 25, a3->??, a3->??, 0x20, 0x20);
-*/ return;
- }
-
- _gfx->setHalfbriteMode(true);
-/*
+// if (dword_16032 != 0) {
+ // keep drawing spotlight in its final place
+ _gfx->setProjectorPos(110, 25);
+ printf("FIXED: %i, %i\n", 110, 25);
+ return;
+// }
+#ifdef HALFBRITE
// move spot light around the stage
int d7, d6;
for (d7 = 0; d7 < 150; d7++) {
@@ -647,7 +643,7 @@
d1 >>= 1;
d6 = 50 - d1;
} else {
- int d1 = d7 / 100;
+ int d1 = d7 % 100;
if (d1 < 0)
d1++;
@@ -655,36 +651,28 @@
d6 = d1;
}
- BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+20, d6, a3->??, a3->??, 0x20, 0x20);
- sub_1590C(d6 + a3->??);
- BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+20, d6, a3->??, a3->??, 0xFA, 0x20);
+ printf("%i, %i, ", d7+20, d6);
+// BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+20, d6, a3->??, a3->??, 0x20, 0x20);
}
for (d7 = 50; d7 > -10; d7--) {
- BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0x20, 0x20);
- sub_1590C(d6 + a3->??);
- BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0xFA, 0x20);
+ printf("%i, %i, ", d7+120, d6);
+// BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0x20, 0x20);
}
- BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0x20, 0x20);
- _gfx->flatBlitCnv(&scnv, d7+120, d6, Gfx::kBitFront);
-*/
-
+ printf("%i, %i\n", d7+120, d6);
+// BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0x20, 0x20);
+#endif
dword_16032 = 1;
return;
-#endif
}
void Parallaction_ns::_c_HBOff(void*) {
-#ifdef HALFBRITE
_gfx->setHalfbriteMode(false);
-#endif
}
void Parallaction_ns::_c_HBOn(void*) {
-#ifdef HALFBRITE
_gfx->setHalfbriteMode(true);
-#endif
}
Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp 2007-12-15 12:02:47 UTC (rev 29862)
+++ scummvm/trunk/engines/parallaction/graphics.cpp 2007-12-15 20:56:05 UTC (rev 29863)
@@ -25,6 +25,7 @@
#include "common/system.h"
#include "common/file.h"
+#include "graphics/primitives.h"
#include "parallaction/parallaction.h"
@@ -32,7 +33,41 @@
namespace Parallaction {
+void halfbritePixel(int x, int y, int color, void *data) {
+ byte *buffer = (byte*)data;
+ buffer[x + y * _vm->_screenWidth] &= ~0x20;
+}
+void drawCircleLine(int xCenter, int yCenter, int x, int y, int color, void (*plotProc)(int, int, int, void *), void *data){
+ Graphics::drawLine(xCenter + x, yCenter + y, xCenter - x, yCenter + y, color, plotProc, data);
+ Graphics::drawLine(xCenter + x, yCenter - y, xCenter - x, yCenter - y, color, plotProc, data);
+ Graphics::drawLine(xCenter + y, yCenter + x, xCenter - y, yCenter + x, color, plotProc, data);
+ Graphics::drawLine(xCenter + y, yCenter - x, xCenter - y, yCenter - x, color, plotProc, data);
+}
+
+void drawCircle(int xCenter, int yCenter, int radius, int color, void (*plotProc)(int, int, int, void *), void *data) {
+ int x = 0;
+ int y = radius;
+ int p = 1 - radius;
+
+ /* Plot first set of points */
+ drawCircleLine(xCenter, yCenter, x, y, color, plotProc, data);
+
+ while (x < y) {
+ x++;
+ if (p < 0)
+ p += 2*x + 1;
+ else {
+ y--;
+ p += 2 * (x-y) + 1;
+ }
+ drawCircleLine(xCenter, yCenter, x, y, color, plotProc, data);
+ }
+}
+
+
+
+
Palette::Palette() {
int gameType = _vm->getGameType();
@@ -110,7 +145,7 @@
uint Palette::fillRGBA(byte *rgba) {
byte r, g, b;
- byte *hbPal = rgba + _size;
+ byte *hbPal = rgba + _colors * 4;
for (uint32 i = 0; i < _colors; i++) {
r = (_data[i*3] << 2) | (_data[i*3] >> 4);
@@ -269,22 +304,24 @@
void Gfx::setHalfbriteMode(bool enable) {
-#ifdef HALFBRITE
if (_vm->getPlatform() != Common::kPlatformAmiga) return;
if (enable == _halfbrite) return;
- byte *buf = _buffers[kBitBack];
- for (uint32 i = 0; i < SCREEN_SIZE; i++)
- *buf++ ^= 0x20;
+ _halfbrite = !_halfbrite;
- buf = _buffers[kBitFront];
- for (uint32 i = 0; i < SCREEN_SIZE; i++)
- *buf++ ^= 0x20;
+ if (!enable) {
+ _hbCircleRadius = 0;
+ }
+}
- _halfbrite = !_halfbrite;
-#endif
+#define HALFBRITE_CIRCLE_RADIUS 48
+void Gfx::setProjectorPos(int x, int y) {
+ _hbCircleRadius = HALFBRITE_CIRCLE_RADIUS;
+ _hbCirclePos.x = x + _hbCircleRadius;
+ _hbCirclePos.y = y + _hbCircleRadius;
}
+
void Gfx::drawInventory() {
if ((_engineFlags & kEngineInventory) == 0) {
@@ -325,7 +362,20 @@
}
void Gfx::updateScreen() {
- g_system->copyRectToScreen((const byte*)_buffers[kBitFront]->pixels, _buffers[kBitFront]->pitch, _screenX, _screenY, _vm->_screenWidth, _vm->_screenHeight);
+ if (_halfbrite) {
+ Graphics::Surface *surf = g_system->lockScreen();
+ byte *src = (byte*)_buffers[kBitFront]->pixels;
+ byte *dst = (byte*)surf->pixels;
+ for (int i = 0; i < surf->w*surf->h; i++) {
+ *dst++ = *src++ | 0x20;
+ }
+ if (_hbCircleRadius > 0) {
+ drawCircle(_hbCirclePos.x, _hbCirclePos.y, _hbCircleRadius, 0, &halfbritePixel, surf->pixels);
+ }
+ g_system->unlockScreen();
+ } else {
+ g_system->copyRectToScreen((const byte*)_buffers[kBitFront]->pixels, _buffers[kBitFront]->pitch, _screenX, _screenY, _vm->_screenWidth, _vm->_screenHeight);
+ }
drawInventory();
@@ -854,6 +904,7 @@
memset(_palettefx, 0, sizeof(_palettefx));
_halfbrite = false;
+ _hbCircleRadius = 0;
_font = NULL;
Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h 2007-12-15 12:02:47 UTC (rev 29862)
+++ scummvm/trunk/engines/parallaction/graphics.h 2007-12-15 20:56:05 UTC (rev 29863)
@@ -283,6 +283,7 @@
// amiga specific
void setHalfbriteMode(bool enable);
+ void setProjectorPos(int x, int y);
// misc
int16 queryMask(int16 v);
@@ -315,6 +316,10 @@
Font *_font;
bool _halfbrite;
+ Common::Point _hbCirclePos;
+ int _hbCircleRadius;
+
+
protected:
struct Balloon {
uint16 x;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list