[Scummvm-cvs-logs] scummvm master -> 3de0b4e3f2c762128fdf9c9e6954af4b8abffbda
sev-
sev at scummvm.org
Sun Aug 14 13:25:33 CEST 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3de0b4e3f2 Merge pull request #60 from tramboi/master
Commit: 3de0b4e3f2c762128fdf9c9e6954af4b8abffbda
https://github.com/scummvm/scummvm/commit/3de0b4e3f2c762128fdf9c9e6954af4b8abffbda
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-08-14T04:17:51-07:00
Commit Message:
Merge pull request #60 from tramboi/master
DREAMWEB: Fixes, cleaning and more functions ported to C++
Changed paths:
A engines/dreamweb/print.cpp
A engines/dreamweb/sprite.cpp
A engines/dreamweb/vgagrafx.cpp
devtools/tasmrecover/dreamweb/sprite.asm
devtools/tasmrecover/tasm-recover
engines/dreamweb/dreamgen.cpp
engines/dreamweb/dreamgen.h
engines/dreamweb/module.mk
engines/dreamweb/runtime.h
engines/dreamweb/structs.h
engines/dreamweb/stubs.cpp
engines/dreamweb/stubs.h
diff --cc engines/dreamweb/stubs.cpp
index 5ba3796,da37df9..0a28073
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@@ -1654,4 -669,300 +669,299 @@@ void DreamGenContext::cancelch1()
engine->stopSound(1);
}
+ void DreamGenContext::getroomspaths() {
+ es = data.word(kReels);
+ bx = data.byte(kRoomnum) * 144;
+ }
+
+ uint8 *DreamGenContext::getroomspathsCPP() {
+ void *result = segRef(data.word(kReels)).ptr(data.byte(kRoomnum) * 144, 144);
+ return (uint8 *)result;
+ }
+
+ void DreamGenContext::makebackob() {
+ if (data.byte(kNewobs) == 0)
+ return;
+ uint8 priority = es.byte(si+5);
+ uint8 type = es.byte(si+8);
+ Sprite *sprite = makesprite(data.word(kObjectx), data.word(kObjecty), addr_backobject, data.word(kSetframes), 0);
+
+ // Recover es:bx from sprite
+ es = data.word(kBuffers);
+ bx = kSpritetable;
+ Sprite *sprites = (Sprite *)es.ptr(bx, sizeof(Sprite) * 16);
+ bx += sizeof(Sprite) * (sprite - sprites);
+ //
+ sprite->setObjData(si);
+ if (priority == 255)
+ priority = 0;
+ sprite->priority = priority;
+ sprite->type = type;
+ sprite->b16 = 0;
+ sprite->delay = 0;
+ sprite->frame = 0;
+ }
+
+ void DreamGenContext::getroomdata() {
+ bx = kRoomdata + sizeof(Room) * al;
+ }
+
+ void DreamGenContext::getroomdata(uint8 roomIndex) {
+ getroomdata(roomIndex);
+ }
+
+ void DreamGenContext::startloading() {
+ const Room *room = (Room *)cs.ptr(bx, sizeof(Room));
+ startloading(room);
+ }
+
+ void DreamGenContext::readheader() {
+ ax = engine->readFromFile(cs.ptr(kFileheader, kHeaderlen), kHeaderlen);
+ es = cs;
+ di = kFiledata;
+ }
+
+ void DreamGenContext::startloading(const Room *room) {
+ data.byte(kCombatcount) = 0;
+ data.byte(kRoomssample) = room->roomsSample;
+ data.byte(kMapx) = room->mapX;
+ data.byte(kMapy) = room->mapY;
+ data.byte(kLiftflag) = room->liftFlag;
+ data.byte(kManspath) = room->b21;
+ data.byte(kDestination) = room->b21;
+ data.byte(kFinaldest) = room->b21;
+ data.byte(kFacing) = room->b22;
+ data.byte(kTurntoface) = room->b22;
+ data.byte(kCounttoopen) = room->countToOpen;
+ data.byte(kLiftpath) = room->liftPath;
+ data.byte(kDoorpath) = room->doorPath;
+ data.byte(kLastweapon) = -1;
+ al = room->b27;
+ push(ax);
+ al = room->b31;
+ ah = data.byte(kReallocation);
+ data.byte(kReallocation) = al;
+ dx = bx;
+ Common::String name = getFilename(*this);
+ engine->openFile(name);
+ cs.word(kHandle) = 1; //only one handle
+ flags._c = false;
+ readheader();
+ allocateload();
+ ds = ax;
+ data.word(kBackdrop) = ax;
+ dx = (0);
+ loadseg();
+ ds = data.word(kWorkspace);
+ dx = (0);
+ cx = 132*66;
+ al = 0;
+ fillspace();
+ loadseg();
+ sortoutmap();
+ allocateload();
+ data.word(kSetframes) = ax;
+ ds = ax;
+ dx = (0);
+ loadseg();
+ ds = data.word(kSetdat);
+ dx = 0;
+ cx = (64*128);
+ al = 255;
+ fillspace();
+ loadseg();
+ allocateload();
+ data.word(kReel1) = ax;
+ ds = ax;
+ dx = 0;
+ loadseg();
+ allocateload();
+ data.word(kReel2) = ax;
+ ds = ax;
+ dx = 0;
+ loadseg();
+ allocateload();
+ data.word(kReel3) = ax;
+ ds = ax;
+ dx = 0;
+ loadseg();
+ allocateload();
+ data.word(kReels) = ax;
+ ds = ax;
+ dx = 0;
+ loadseg();
+ allocateload();
+ data.word(kPeople) = ax;
+ ds = ax;
+ dx = 0;
+ loadseg();
+ allocateload();
+ data.word(kSetdesc) = ax;
+ ds = ax;
+ dx = 0;
+ loadseg();
+ allocateload();
+ data.word(kBlockdesc) = ax;
+ ds = ax;
+ dx = 0;
+ loadseg();
+ allocateload();
+ data.word(kRoomdesc) = ax;
+ ds = ax;
+ dx = 0;
+ loadseg();
+ allocateload();
+ data.word(kFreeframes) = ax;
+ ds = ax;
+ dx = 0;
+ loadseg();
+ ds = data.word(kFreedat);
+ dx = 0;
+ cx = (16*80);
+ al = 255;
+ fillspace();
+ loadseg();
+ allocateload();
+ data.word(kFreedesc) = ax;
+ ds = ax;
+ dx = (0);
+ loadseg();
+ closefile();
+ findroominloc();
+ deletetaken();
+ setallchanges();
+ autoappear();
+ al = data.byte(kNewlocation);
+ getroomdata();
+ data.byte(kLastweapon) = -1;
+ data.byte(kMandead) = 0;
+ data.word(kLookcounter) = 160;
+ data.byte(kNewlocation) = 255;
+ data.byte(kLinepointer) = 254;
+ ax = pop();
+ if (al != 255) {
+ data.byte(kManspath) = al;
+ push(bx);
+ autosetwalk();
+ bx = pop();
+ }
+ findxyfrompath();
+ }
+
+ void DreamGenContext::fillspace() {
+ memset(ds.ptr(dx, cx), al, cx);
+ }
+
+ void DreamGenContext::dealwithspecial(uint8 firstParam, uint8 secondParam) {
+ uint8 type = firstParam - 220;
+ if (type == 0) {
+ al = secondParam;
+ placesetobject();
+ data.byte(kHavedoneobs) = 1;
+ } else if (type == 1) {
+ al = secondParam;
+ removesetobject();
+ data.byte(kHavedoneobs) = 1;
+ } else if (type == 2) {
+ al = secondParam;
+ placefreeobject();
+ data.byte(kHavedoneobs) = 1;
+ } else if (type == 3) {
+ al = secondParam;
+ removefreeobject();
+ data.byte(kHavedoneobs) = 1;
+ } else if (type == 4) {
+ switchryanoff();
+ } else if (type == 5) {
+ data.byte(kTurntoface) = secondParam;
+ data.byte(kFacing) = secondParam;
+ switchryanon();
+ } else if (type == 6) {
+ data.byte(kNewlocation) = secondParam;
+ } else {
+ movemap();
+ }
+ }
+
+ void DreamGenContext::plotreel() {
+ Reel *reel = getreelstartCPP();
+ while (true) {
+ if (reel->x < 220)
+ break;
+ if (reel->x == 255)
+ break;
+ dealwithspecial(reel->x, reel->y);
+ ++data.word(kReelpointer);
+ reel += 8;
+ }
+
+ for (size_t i = 0; i < 8; ++i) {
+ if (reel->frame() != 0xffff)
+ showreelframe(reel);
+ ++reel;
+ }
+ soundonreels();
+ }
+
+ void DreamGenContext::crosshair() {
+ uint8 frame;
+ if ((data.byte(kCommandtype) != 3) && (data.byte(kCommandtype) < 10)) {
+ frame = 9;
+ } else {
+ frame = 29;
+ }
+ const Frame *src = (const Frame *)segRef(data.word(kIcons1)).ptr(0, 0);
+ uint8 width, height;
+ showframe(src, kZoomx + 24, kZoomy + 19, frame, 0, &width, &height);
+ }
+
+ void DreamGenContext::deltextline() {
+ uint16 x = data.word(kTextaddressx);
+ uint16 y = data.word(kTextaddressy);
+ if (data.byte(kForeignrelease) != 0)
+ y -= 3;
+ multiput(segRef(data.word(kBuffers)).ptr(kTextunder, 0), x, y, kUndertextsizex, kUndertextsizey);
+ }
+
+ void DreamGenContext::autosetwalk() {
+ al = data.byte(kManspath);
+ if (data.byte(kFinaldest) == al)
+ return;
+ const uint8 *roomsPaths = getroomspathsCPP();
+ checkdest(roomsPaths);
+ data.word(kLinestartx) = roomsPaths[data.byte(kManspath) * 8 + 0] - 12;
+ data.word(kLinestarty) = roomsPaths[data.byte(kManspath) * 8 + 1] - 12;
+ data.word(kLineendx) = roomsPaths[data.byte(kDestination) * 8 + 0] - 12;
+ data.word(kLineendy) = roomsPaths[data.byte(kDestination) * 8 + 1] - 12;
+ bresenhams();
+ if (data.byte(kLinedirection) != 0) {
+ data.byte(kLinepointer) = data.byte(kLinelength) - 1;
+ data.byte(kLinedirection) = 1;
+ return;
+ }
+ data.byte(kLinepointer) = 0;
+ }
+
+ void DreamGenContext::checkdest(const uint8 *roomsPaths) {
+ const uint8 *p = roomsPaths + 12 * 8;
+ ah = data.byte(kManspath) << 4;
+ al = data.byte(kDestination);
+ uint8 destination = data.byte(kDestination);
+ for (size_t i = 0; i < 24; ++i) {
+ dh = p[0] & 0xf0;
+ dl = p[0] & 0x0f;
+ if (ax == dx) {
+ data.byte(kDestination) = p[1] & 0x0f;
+ return;
+ }
+ dl = (p[0] & 0xf0) >> 4;
+ dh = (p[0] & 0x0f) << 4;
+ if (ax == dx) {
+ destination = p[1] & 0x0f;
+ }
+ p += 2;
+ }
+ data.byte(kDestination) = destination;
+ }
+
} /*namespace dreamgen */
-
More information about the Scummvm-git-logs
mailing list