Only in raw-0.1.0.mod/: Doxyfile Only in raw-0.1.0.mod/: aw Only in raw-0.1.0.mod/: bank.d Only in raw-0.1.0.mod/: bank.o diff -u -r raw-0.1.0/engine.cpp raw-0.1.0.mod/engine.cpp --- raw-0.1.0/engine.cpp 2004-04-19 21:01:30.000000000 +0200 +++ raw-0.1.0.mod/engine.cpp 2004-04-30 14:03:16.000000000 +0200 @@ -31,7 +31,8 @@ _stub->init("Out Of This World"); setup(); // XXX - _log.restartAt(0x3E80); // demo starts at 0x3E81 + //_log.restartAt(0x3E80); // demo starts at 0x3E81 + _log.restartAt(0x3E80); while (!_stub->_pi.quit) { _log.setupScripts(); _log.inp_updatePlayer(); Only in raw-0.1.0.mod/: engine.cpp~ Only in raw-0.1.0.mod/: engine.d Only in raw-0.1.0.mod/: engine.o Only in raw-0.1.0.mod/: file.d Only in raw-0.1.0.mod/: file.o Only in raw-0.1.0.mod/: html Only in raw-0.1.0.mod/: latex diff -u -r raw-0.1.0/logic.cpp raw-0.1.0.mod/logic.cpp --- raw-0.1.0/logic.cpp 2004-04-21 20:20:36.000000000 +0200 +++ raw-0.1.0.mod/logic.cpp 2004-04-24 13:38:33.000000000 +0200 @@ -230,7 +230,7 @@ if (!_fastMode) { // XXX experimental int32 delay = _stub->getTimeStamp() - tstamp; - int32 pause = _scriptVars[VAR_PAUSE_SLICES] * 20 - delay; + int32 pause = _scriptVars[VAR_PAUSE_SLICES] * 10 - delay; if (pause > 0) { _stub->sleep(pause); } @@ -475,7 +475,7 @@ _stub->_pi.pause = false; while (!_stub->_pi.pause) { _stub->processEvents(); - _stub->sleep(200); + _stub->sleep(20); } } _stub->_pi.pause = false; Only in raw-0.1.0.mod/: logic.cpp~ Only in raw-0.1.0.mod/: logic.d Only in raw-0.1.0.mod/: logic.o diff -u -r raw-0.1.0/main.cpp raw-0.1.0.mod/main.cpp --- raw-0.1.0/main.cpp 2004-04-21 20:53:42.000000000 +0200 +++ raw-0.1.0.mod/main.cpp 2004-04-30 14:09:17.000000000 +0200 @@ -51,7 +51,7 @@ return 0; } } - g_debugMask = DBG_INFO; + g_debugMask = DBG_INFO | DBG_BANK;// | DBG_VIDEO | DBG_LOGIC; SystemStub *stub = SystemStub_SDL_create(); Engine *e = new Engine(stub, dataPath, savePath); e->run(); Only in raw-0.1.0.mod/: main.cpp~ Only in raw-0.1.0.mod/: main.d Only in raw-0.1.0.mod/: main.o Only in raw-0.1.0.mod/: n=1 Only in raw-0.1.0.mod/: out.ps Only in raw-0.1.0.mod/: raw Only in raw-0.1.0.mod/: raw.png Only in raw-0.1.0.mod/: raw.svg Only in raw-0.1.0.mod/: raw.svg~ Only in raw-0.1.0.mod/: raw2.png Only in raw-0.1.0.mod/: raw3.png Only in raw-0.1.0.mod/: resource.d Only in raw-0.1.0.mod/: resource.o diff -u -r raw-0.1.0/sdlstub.cpp raw-0.1.0.mod/sdlstub.cpp --- raw-0.1.0/sdlstub.cpp 2004-04-21 20:29:56.000000000 +0200 +++ raw-0.1.0.mod/sdlstub.cpp 2004-04-30 03:05:32.000000000 +0200 @@ -83,7 +83,7 @@ error("Unable to allocate offscreen buffer"); } _fullscreen = false; - _scaler = 1; + _scaler = 0; prepareGfxMode(); } @@ -229,7 +229,7 @@ void SDLStub::prepareGfxMode() { int w = SCREEN_W * _scalers[_scaler].factor; int h = SCREEN_H * _scalers[_scaler].factor; - _screen = SDL_SetVideoMode(w, h, 16, _fullscreen ? (SDL_FULLSCREEN | SDL_HWSURFACE) : SDL_HWSURFACE); + _screen = SDL_SetVideoMode(640, 480, 16, _fullscreen ? (SDL_FULLSCREEN | SDL_HWSURFACE) : SDL_HWSURFACE); if (!_screen) { error("SDLStub::prepareGfxMode() unable to allocate _screen buffer"); } Only in raw-0.1.0.mod/: sdlstub.cpp~ Only in raw-0.1.0.mod/: sdlstub.d Only in raw-0.1.0.mod/: sdlstub.o Only in raw-0.1.0.mod/: serializer.d Only in raw-0.1.0.mod/: serializer.o Only in raw-0.1.0.mod/: staticres.d Only in raw-0.1.0.mod/: staticres.o Only in raw-0.1.0.mod/: util.d Only in raw-0.1.0.mod/: util.o diff -u -r raw-0.1.0/video.cpp raw-0.1.0.mod/video.cpp --- raw-0.1.0/video.cpp 2004-04-21 20:27:44.000000000 +0200 +++ raw-0.1.0.mod/video.cpp 2004-04-30 13:38:50.000000000 +0200 @@ -16,6 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include "video.h" #include "resource.h" #include "serializer.h" @@ -77,12 +78,37 @@ } } -void Video::fillPolygon(uint16 color, uint16 zoom, const Point &pt) { +void Video::fillPolygon(uint16 color, uint16 zoom, const Point &pt_) { + Point pt = pt_; + +// pt.x += rand()%10; +// pt.y += rand()%10; + if (_pg.bbw == 0 && _pg.bbh == 1 && _pg.numPoints == 4) { drawPoint(color, pt.x, pt.y); return; } - + //fillpolygon: zoom: " << zoom << " color: " << color << " points: "; + + /* if (color < 0x10) { + std::cout << "" << std::endl; + } else if (color > 0x10) { + std::cout << "" << std::endl; + } else { + std::cout << "" << std::endl; + } */ + //std::cout << "" << std::endl; + + std::cout << "" << std::endl; + std::cout << "" << std::endl; + + int16 x1 = pt.x - _pg.bbw / 2; int16 x2 = pt.x + _pg.bbw / 2; int16 y1 = pt.y - _pg.bbh / 2; @@ -104,20 +130,28 @@ --j; drawLine pdl; + if (color < 0x10) { - pdl = &Video::drawLineN; + pdl = &Video::drawLineN; // normal } else if (color > 0x10) { pdl = &Video::drawLineP; } else { pdl = &Video::drawLineT; - } - + } + //pdl = &Video::drawLineP; + uint32 cpt1 = x1 << 16; uint32 cpt2 = x2 << 16; while (1) { _pg.numPoints -= 2; if (_pg.numPoints == 0) { + + //_stub->copyRect(0, 0, 320, 200, _pagePtrs[1], 160); + //_stub->copyRect(0, 0, 320, 200, _pagePtrs[2], 160); + //_stub->copyRect(0, 240, 320, 200, _pagePtrs[2], 160); + //_stub->copyRect(320, 240, 320, 200, _pagePtrs[3], 160); + return; } uint16 h; @@ -255,7 +289,6 @@ } void Video::drawLineT(int16 x1, int16 x2, uint8 color) { - debug(DBG_VIDEO, "drawLineT(%d, %d, %d)", x1, x2, color); int16 xmax = MAX(x1, x2); int16 xmin = MIN(x1, x2); uint8 *p = _curPagePtr1 + _hliney * 160 + xmin / 2; @@ -287,39 +320,37 @@ } void Video::drawLineN(int16 x1, int16 x2, uint8 color) { - debug(DBG_VIDEO, "drawLineN(%d, %d, %d)", x1, x2, color); - int16 xmax = MAX(x1, x2); - int16 xmin = MIN(x1, x2); - uint8 *p = _curPagePtr1 + _hliney * 160 + xmin / 2; - - uint16 w = xmax / 2 - xmin / 2 + 1; - uint8 cmaske = 0; - uint8 cmasks = 0; - if (xmin & 1) { - --w; - cmasks = 0xF0; - } - if (!(xmax & 1)) { - --w; - cmaske = 0x0F; - } - - uint8 colb = ((color & 0xF) << 4) | (color & 0xF); - if (cmasks != 0) { - *p = (*p & cmasks) | (colb & 0x0F); - ++p; - } - while (w--) { - *p++ = colb; - } - if (cmaske != 0) { - *p = (*p & cmaske) | (colb & 0xF0); - ++p; - } + int16 xmax = MAX(x1, x2); + int16 xmin = MIN(x1, x2); + uint8 *p = _curPagePtr1 + _hliney * 160 + xmin / 2; + + uint16 w = xmax / 2 - xmin / 2 + 1; + uint8 cmaske = 0; + uint8 cmasks = 0; + if (xmin & 1) { + --w; + cmasks = 0xF0; + } + if (!(xmax & 1)) { + --w; + cmaske = 0x0F; + } + + uint8 colb = ((color & 0xF) << 4) | (color & 0xF); + if (cmasks != 0) { + *p = (*p & cmasks) | (colb & 0x0F); + ++p; + } + while (w--) { + *p++ = colb; + } + if (cmaske != 0) { + *p = (*p & cmaske) | (colb & 0xF0); + ++p; + } } void Video::drawLineP(int16 x1, int16 x2, uint8 color) { - debug(DBG_VIDEO, "drawLineP(%d, %d, %d)", x1, x2, color); int16 xmax = MAX(x1, x2); int16 xmin = MIN(x1, x2); uint16 off = _hliney * 160 + xmin / 2; @@ -380,6 +411,10 @@ } void Video::fillPage(uint8 page, uint8 color) { + std::cout << "" << std::endl; + std::cout << "" << std::endl; + debug(DBG_VIDEO, "Video::fillPage(%d, %d)", page, color); uint8 *p = getPagePtr(page); uint8 c = (color << 4) | color; @@ -440,11 +475,12 @@ uint8 *Video::allocPage() { uint8 *buf = (uint8 *)malloc(VID_PAGE_SIZE); - memset(buf, 0, VID_PAGE_SIZE); + // memset(buf, 0, VID_PAGE_SIZE); return buf; } void Video::changePal(uint8 palNum) { + std::cout << "changePal: " << (int)palNum << std::endl; if (palNum < 32) { uint8 *p = _res->_segVideoPal + palNum * 32; uint8 pal[16 * 3]; @@ -455,14 +491,50 @@ pal[i * 3 + 0] = ((c1 & 0x0F) << 2) | ((c1 & 0x0F) >> 2); // r pal[i * 3 + 1] = ((c2 & 0xF0) >> 2) | ((c2 & 0xF0) >> 6); // g pal[i * 3 + 2] = ((c2 & 0x0F) >> 2) | ((c2 & 0x0F) << 2); // b + std::cout << "Palette: " << i << " " + << (int)pal[i * 3 + 0] << " " + << (int)pal[i * 3 + 1] << " " + << (int)pal[i * 3 + 2] + << std::endl; } _stub->setPalette(0, 16, pal); _curPal = palNum; } } +std::string +Video::get_color_as_string(uint8 color) +{ + char tmp[256]; + Color c = get_color(color); + snprintf(tmp, 256, "#%02x%02x%02x", c.r*4, c.g*4, c.b*4); + //snprintf(tmp, 256, "#%d %d %d", int(c.r)*4, int(c.g)*4, int(c.b)*4); + //snprintf(tmp, 256, "#%d", (int)color); + return tmp; +} + +Color +Video::get_color(uint8 color) +{ + //color = ((color & 0xF) << 4) | (color & 0xF); + //color += 1; + + Color c; + uint8 *p = _res->_segVideoPal + 1 * 32; + uint8 c1 = *(p + 0 + 2*color); + uint8 c2 = *(p + 1 + 2*color); + + c.r = ((c1 & 0x0F) << 2) | ((c1 & 0x0F) >> 2); // r + c.g = ((c2 & 0xF0) >> 2) | ((c2 & 0xF0) >> 6); // g + c.b = ((c2 & 0x0F) >> 2) | ((c2 & 0x0F) << 2); // b + + //std::cout << "Color: " << (int)c.r << " " << (int)c.g << " " << (int)c.b << std::endl; + + return c; +} + void Video::updateDisplay(uint8 page) { - debug(DBG_VIDEO, "Video::updateDisplay(%d)", page); + std::cout << "Video::updateDisplay(" << int(page) << ")" << std::endl; if (page != 0xFE) { if (page == 0xFF) { SWAP(_curPagePtr2, _curPagePtr3); @@ -474,7 +546,8 @@ changePal(_newPal); _newPal = 0xFF; } - _stub->copyRect(0, 0, 320, 200, _curPagePtr2, 160); + _stub->copyRect(0, 0, 320, 200, _curPagePtr1, 160); + std::cout <<"flipdisplay" << std::endl; } void Video::saveOrLoad(Serializer &ser) { Only in raw-0.1.0.mod/: video.cpp~ Only in raw-0.1.0.mod/: video.d diff -u -r raw-0.1.0/video.h raw-0.1.0.mod/video.h --- raw-0.1.0/video.h 2004-04-19 19:58:38.000000000 +0200 +++ raw-0.1.0.mod/video.h 2004-04-30 12:17:30.000000000 +0200 @@ -19,6 +19,7 @@ #ifndef __VIDEO_H__ #define __VIDEO_H__ +#include #include "intern.h" struct StrEntry { @@ -38,6 +39,13 @@ void init(const uint8 *p, uint16 zoom); }; +struct Color +{ + int r; + int b; + int g; +}; + struct Resource; struct Serializer; struct SystemStub; @@ -88,6 +96,8 @@ uint8 *allocPage(); void changePal(uint8 pal); void updateDisplay(uint8 page); + Color get_color(uint8 color); + std::string get_color_as_string(uint8 color); void saveOrLoad(Serializer &ser); }; Only in raw-0.1.0.mod/: video.h~ Only in raw-0.1.0.mod/: video.o