diff options
author | Travis Howell | 2004-09-14 06:21:11 +0000 |
---|---|---|
committer | Travis Howell | 2004-09-14 06:21:11 +0000 |
commit | b42731afabd4d7b229b4de241f8b24b2fb1b1cf8 (patch) | |
tree | 6b4c44be7cd5c251e88979236017343af68888b7 /scumm | |
parent | 674cdf130b9c096d06b4c2987b6cb264c4b1d8c2 (diff) | |
download | scummvm-rg350-b42731afabd4d7b229b4de241f8b24b2fb1b1cf8.tar.gz scummvm-rg350-b42731afabd4d7b229b4de241f8b24b2fb1b1cf8.tar.bz2 scummvm-rg350-b42731afabd4d7b229b4de241f8b24b2fb1b1cf8.zip |
Load POLD resources in HE80+ games
Some more WIP on polygons
svn-id: r15107
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 4 | ||||
-rw-r--r-- | scumm/script_v7he.cpp | 49 | ||||
-rw-r--r-- | scumm/script_v80he.cpp | 2 | ||||
-rw-r--r-- | scumm/script_v90he.cpp | 2 | ||||
-rw-r--r-- | scumm/scumm.cpp | 33 | ||||
-rw-r--r-- | scumm/scumm.h | 2 |
6 files changed, 79 insertions, 13 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index a583f651a2..6dad8c7d47 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -620,20 +620,18 @@ protected: int getCharsetOffsets(int chr); void arrrays_unk2(int dst, int src, int len2, int len); - void polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, int vert2y, - int vert3x, int vert3y, int vert4x, int vert4y); void polygonErase(int fromId, int toId); bool polygonContains(WizPolygon &pol, int x, int y); bool polygonDefined(int id); int polygonHit(int id, int x, int y); - /* HE version 70 script opcodes */ void o7_cursorCommand(); void o7_startSound(); void o7_pickupObject(); void o7_getActorRoom(); void o7_resourceRoutines(); + void o7_findObject(); void o7_quitPauseRestart(); void o7_kernelSetFunctions(); void o7_unknownED(); diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index faab9296a6..cd4420c799 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -246,7 +246,7 @@ void ScummEngine_v7he::setupOpcodes() { OPCODE(o6_verbOps), OPCODE(o6_getActorFromXY), /* A0 */ - OPCODE(o6_findObject), + OPCODE(o7_findObject), OPCODE(o6_pseudoRoom), OPCODE(o6_getActorElevation), OPCODE(o6_getVerbEntrypoint), @@ -699,6 +699,43 @@ void ScummEngine_v7he::o7_resourceRoutines() { } } +void ScummEngine_v7he::o7_findObject() { + int i, b; + byte a; + const int mask = 0xF; + + int y = pop(); + int x = pop(); + + + for (i = 1; i < _numLocalObjects; i++) { + if ((_objs[i].obj_nr < 1) || getClass(_objs[i].obj_nr, kObjectClassUntouchable)) + continue; + + if (polygonDefined(_objs[i].obj_nr)) { + if (polygonHit(_objs[i].obj_nr, x, y) != 0) { + push(_objs[i].obj_nr); + return; + } + } + + b = i; + do { + a = _objs[b].parentstate; + b = _objs[b].parent; + if (b == 0) { + if (_objs[i].x_pos <= x && _objs[i].width + _objs[i].x_pos > x && + _objs[i].y_pos <= y && _objs[i].height + _objs[i].y_pos > y) { + push(_objs[i].obj_nr); + return; + } + break; + } + } while ((_objs[b].state & mask) == a); + } + push(0);; +} + void ScummEngine_v7he::o7_quitPauseRestart() { byte subOp = fetchScriptByte(); int par1; @@ -1033,11 +1070,11 @@ void ScummEngine_v7he::o7_polygonOps() { } } -void ScummEngine_v7he::polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, +void ScummEngine::polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, int vert2y, int vert3x, int vert3y, int vert4x, int vert4y) { int i; - debug(1, "polygonStore(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d", id, flag, vert1x, + debug(1, "polygonStore(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", id, flag, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y); for (i = 0; i < _WizNumPolygons; i++) @@ -1045,7 +1082,7 @@ void ScummEngine_v7he::polygonStore(int id, bool flag, int vert1x, int vert1y, i break; if (i == _WizNumPolygons) { - error("ScummEngine_v7he::polygonStore: out of polygon slot, max = %d", + error("ScummEngine::polygonStore: out of polygon slot, max = %d", _WizNumPolygons); } @@ -1068,7 +1105,7 @@ void ScummEngine_v7he::polygonStore(int id, bool flag, int vert1x, int vert1y, i _WizPolygons[i].bound.right = -10000; _WizPolygons[i].bound.bottom = -10000; - for (int j = 0; j < 4; j++) { + for (int j = 0; j < 5; j++) { _WizPolygons[i].bound.left = MIN(_WizPolygons[i].bound.left, _WizPolygons[i].vert[j].x); _WizPolygons[i].bound.top = MIN(_WizPolygons[i].bound.top, _WizPolygons[i].vert[j].y); _WizPolygons[i].bound.right = MAX(_WizPolygons[i].bound.right, _WizPolygons[i].vert[j].x); @@ -1131,8 +1168,6 @@ bool ScummEngine_v7he::polygonContains(WizPolygon &pol, int x, int y) { diry = curdir; } - //r = true; - return r; } diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp index 2b0a5e33ac..7f1bb8965f 100644 --- a/scumm/script_v80he.cpp +++ b/scumm/script_v80he.cpp @@ -245,7 +245,7 @@ void ScummEngine_v80he::setupOpcodes() { OPCODE(o72_verbOps), OPCODE(o6_getActorFromXY), /* A0 */ - OPCODE(o6_findObject), + OPCODE(o7_findObject), OPCODE(o6_pseudoRoom), OPCODE(o6_getActorElevation), OPCODE(o6_getVerbEntrypoint), diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index 6c9f17b954..f1fe987854 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -245,7 +245,7 @@ void ScummEngine_v90he::setupOpcodes() { OPCODE(o90_unknown9E), OPCODE(o6_getActorFromXY), /* A0 */ - OPCODE(o6_findObject), + OPCODE(o7_findObject), OPCODE(o6_pseudoRoom), OPCODE(o6_getActorElevation), OPCODE(o6_getVerbEntrypoint), diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 53d2a954f0..782b21a0c0 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -2812,7 +2812,7 @@ void ScummEngine::initRoomSubBlocks() { } } - // Actor Palette in HE 7.0 games + // Actor Palette in HE 70 games if (_heversion == 70) { ptr = findResourceData(MKID('REMP'), roomptr); if (ptr) { @@ -2824,6 +2824,37 @@ void ScummEngine::initRoomSubBlocks() { } } + // Polygons in HE 80+ games + if (_heversion >= 80) { + ptr = findResourceData(MKID('POLD'), roomptr); + if (ptr) { + int slots = READ_LE_UINT32(ptr); + ptr += 4; + debug(1, "Loading %d polygon slots\n", slots); + + bool flag = 1; + int id, points, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y; + while (slots--) { + id = READ_LE_UINT32(ptr); + points = READ_LE_UINT32(ptr + 4); + if (points != 4) + error("Illegal polygon with %d points", points); + vert1x = READ_LE_UINT32(ptr + 8); + vert1y = READ_LE_UINT32(ptr + 12); + vert2x = READ_LE_UINT32(ptr + 16); + vert2y = READ_LE_UINT32(ptr + 20); + vert3x = READ_LE_UINT32(ptr + 24); + vert3y = READ_LE_UINT32(ptr + 28); + vert4x = READ_LE_UINT32(ptr + 32); + vert4y = READ_LE_UINT32(ptr + 36); + + ptr += 40; + polygonStore(id, flag, vert1x, vert1y, vert2x, vert2y, vert3x, vert3y, vert4x, vert4y); + } + } + + } + // Transparent color if (_features & GF_OLD_BUNDLE) gdi._transparentColor = 255; diff --git a/scumm/scumm.h b/scumm/scumm.h index 6bdd394735..cf9684a3c3 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -701,6 +701,8 @@ protected: void loadRoomObjects(); void loadRoomObjectsSmall(); void loadRoomObjectsOldBundle(); + void polygonStore(int id, bool flag, int vert1x, int vert1y, int vert2x, int vert2y, + int vert3x, int vert3y, int vert4x, int vert4y); virtual void readArrayFromIndexFile(); virtual void readMAXS(int blockSize); |