[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.146,1.147 actor.h,1.80,1.81 isomap.cpp,1.51,1.52 isomap.h,1.22,1.23 script.h,1.90,1.91 sfuncs.cpp,1.130,1.131
Andrew Kurushin
h00ligan at users.sourceforge.net
Fri Jul 1 10:32:31 CEST 2005
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6402
Modified Files:
actor.cpp actor.h isomap.cpp isomap.h script.h sfuncs.cpp
Log Message:
implemented sfPickClimbOutPos, sfTossRif
Komodo dragon now works
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- actor.cpp 30 Jun 2005 09:09:59 -0000 1.146
+++ actor.cpp 1 Jul 2005 17:29:22 -0000 1.147
@@ -847,7 +847,10 @@
if (!actor->inScene)
continue;
- //todo: dragon stuff
+ if ((_vm->getGameType() == GType_ITE) && (i == ACTOR_DRAGON_INDEX)) {
+ moveDragon(actor);
+ continue;
+ }
/* if (actor->index == 2)
debug(9, "Action: %d Flags: %x", actor->currentAction, actor->flags);*/
@@ -1619,7 +1622,9 @@
if (_vm->_scene->getFlags() & kSceneFlagISO) {
- //todo: dragon stuff
+ if ((_vm->getGameType() == GType_ITE) && (actor->index == ACTOR_DRAGON_INDEX)) {
+ return false;
+ }
actor->finalTarget = toLocation;
actor->walkStepsCount = 0;
Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.h,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- actor.h 29 Jun 2005 20:00:44 -0000 1.80
+++ actor.h 1 Jul 2005 17:29:22 -0000 1.81
@@ -64,6 +64,7 @@
#define ACTOR_SPEECH_ACTORS_MAX 8
#define ACTOR_DRAGON_TURN_MOVES 4
+#define ACTOR_DRAGON_INDEX 133
#define ACTOR_NO_ENTRANCE -1
Index: isomap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- isomap.cpp 29 Jun 2005 20:00:44 -0000 1.51
+++ isomap.cpp 1 Jul 2005 17:29:23 -0000 1.52
@@ -997,14 +997,13 @@
pathCell->cost = cost;
}
-IsoTileData *IsoMap::getTile(int16 u, int16 v, int16 z) {
+int16 IsoMap::getTileIndex(int16 u, int16 v, int16 z) {
int16 mtileU;
int16 mtileV;
int16 uc;
int16 vc;
int16 u0;
int16 v0;
- int16 tileIndex;
int16 platformIndex;
int16 metaTileIndex;
@@ -1044,14 +1043,20 @@
platformIndex = _metaTileList[metaTileIndex].stack[z];
if (platformIndex < 0) {
- return NULL;
+ return 0;
}
if (_tilePlatformsCount <= platformIndex) {
error("IsoMap::getTile wrong platformIndex");
}
- tileIndex = _tilePlatformList[platformIndex].tiles[u0][v0];
+ return _tilePlatformList[platformIndex].tiles[u0][v0];
+}
+
+IsoTileData *IsoMap::getTile(int16 u, int16 v, int16 z) {
+ int16 tileIndex;
+
+ tileIndex = getTileIndex(u, v, z);
if (tileIndex == 0) {
return NULL;
@@ -1255,6 +1260,74 @@
result.v() = ((vBase + bestV) << 4) + 8;
}
+bool IsoMap::findNearestChasm(int16 &u0, int16 &v0, uint16 &direction) {
+ int16 u, v;
+ uint16 i;
+ u = u0;
+ v = v0;
+
+ for (i = 1; i < 5; i++) {
+ if (getTile( u - i, v, 6) == NULL) {
+ u0 = u - i - 1;
+ v0 = v;
+ direction = kDirDownLeft;
+ return true;
+ }
+
+ if (getTile( u, v - i, 6) == NULL) {
+ u0 = u;
+ v0 = v - i - 1;
+ direction = kDirDownRight;
+ return true;
+ }
+
+ if (getTile( u - i, v - i, 6) == NULL) {
+ u0 = u - i - 1;
+ v0 = v - i - 1;
+ direction = kDirDown;
+ return true;
+ }
+
+ if (getTile( u + i, v - i, 6) == NULL) {
+ u0 = u + i + 1;
+ v0 = v - i - 1;
+ direction = kDirDownRight;
+ return true;
+ }
+
+ if (getTile( u - i, v + i, 6) == NULL) {
+ u0 = u + i + 1;
+ v0 = v - i - 1;
+ direction = kDirLeft;
+ return true;
+ }
+ }
+
+ for (i = 1; i < 5; i++) {
+ if (getTile( u + i, v, 6) == NULL) {
+ u0 = u + i + 1;
+ v0 = v;
+ direction = kDirUpRight;
+ return true;
+ }
+
+ if (getTile( u, v + i, 6) == NULL) {
+ u0 = u;
+ v0 = v + i + 1;
+ direction = kDirUpLeft;
+ return true;
+ }
+
+ if (getTile( u + i, v + i, 6) == NULL) {
+ u0 = u + i + 1;
+ v0 = v + i + 1;
+ direction = kDirUp;
+ return true;
+ }
+ }
+ return false;
+}
+
void IsoMap::findDragonTilePath(ActorData* actor,const Location &start, const Location &end, uint16 initialDirection) {
byte *res;
int i;
Index: isomap.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/isomap.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- isomap.h 29 Jun 2005 20:00:44 -0000 1.22
+++ isomap.h 1 Jul 2005 17:29:23 -0000 1.23
@@ -168,11 +168,13 @@
void screenPointToTileCoords(const Point &position, Location &location);
void placeOnTileMap(const Location &start, Location &result, int16 distance, uint16 direction);
void findDragonTilePath(ActorData* actor, const Location &start, const Location &end, uint16 initialDirection);
+ bool findNearestChasm(int16 &u0, int16 &v0, uint16 &direction);
void findTilePath(ActorData* actor, const Location &start, const Location &end);
bool nextTileTarget(ActorData* actor);
void setTileDoorState(int doorNumber, int doorState);
Point getMapPosition() { return _mapPosition; }
void setMapPosition(int x, int y);
+ int16 getTileIndex(int16 u, int16 v, int16 z);
private:
void drawTiles(SURFACE *ds, const Location *location);
Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- script.h 20 Jun 2005 12:17:21 -0000 1.90
+++ script.h 1 Jul 2005 17:29:23 -0000 1.91
@@ -527,8 +527,8 @@
void sfGetActorY(SCRIPTFUNC_PARAMS);
void sfEraseDelta(SCRIPTFUNC_PARAMS);
void sfPlayMusic(SCRIPTFUNC_PARAMS);
- void SF_pickClimbOutPos(SCRIPTFUNC_PARAMS);
- void SF_tossRif(SCRIPTFUNC_PARAMS);
+ void sfPickClimbOutPos(SCRIPTFUNC_PARAMS);
+ void sfTossRif(SCRIPTFUNC_PARAMS);
void sfShowControls(SCRIPTFUNC_PARAMS);
void SF_showMap(SCRIPTFUNC_PARAMS);
void sfPuzzleWon(SCRIPTFUNC_PARAMS);
Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- sfuncs.cpp 25 Jun 2005 15:55:43 -0000 1.130
+++ sfuncs.cpp 1 Jul 2005 17:29:23 -0000 1.131
@@ -117,8 +117,8 @@
OPCODE(sfGetActorY),
OPCODE(sfEraseDelta),
OPCODE(sfPlayMusic),
- OPCODE(SF_pickClimbOutPos),
- OPCODE(SF_tossRif),
+ OPCODE(sfPickClimbOutPos),
+ OPCODE(sfTossRif),
OPCODE(sfShowControls),
OPCODE(SF_showMap),
OPCODE(sfPuzzleWon),
@@ -1593,19 +1593,47 @@
}
// Script function #64 (0x40)
-void Script::SF_pickClimbOutPos(SCRIPTFUNC_PARAMS) {
- for (int i = 0; i < nArgs; i++)
- thread->pop();
+void Script::sfPickClimbOutPos(SCRIPTFUNC_PARAMS) {
+ int16 u, v, t;
+ ActorData *protagonist = _vm->_actor->_protagonist;
+ while (true) {
- error("STUB: SF_pickClimbOutPos(), %d args", nArgs);
+ u = (_vm->_rnd.getRandomNumber(63) & 63) + 40;
+ v = (_vm->_rnd.getRandomNumber(63) & 63) + 40;
+ t = _vm->_isoMap->getTileIndex(u, v, 6);
+ if (t == 65) {
+ protagonist->location.u() = (u << 4) + 4;
+ protagonist->location.v() = (v << 4) + 4;
+ protagonist->location.z = 48;
+ break;
+ }
+
+ }
}
// Script function #65 (0x41)
-void Script::SF_tossRif(SCRIPTFUNC_PARAMS) {
- for (int i = 0; i < nArgs; i++)
- thread->pop();
+void Script::sfTossRif(SCRIPTFUNC_PARAMS) {
+ int16 uc , vc;
+ uint16 direction;
+ ActorData *protagonist = _vm->_actor->_protagonist;
- error("STUB: SF_tossRif(), %d args", nArgs);
+ uc = protagonist->location.u() >> 4;
+ vc = protagonist->location.v() >> 4;
+ if (_vm->_isoMap->findNearestChasm(uc, vc, direction)) {
+ uc <<= 4;
+ vc <<= 4;
+ protagonist->facingDirection = direction;
+
+ protagonist->finalTarget.u() = uc;
+ protagonist->finalTarget.v() = vc;
+ protagonist->finalTarget.z = -40;
+ protagonist->currentAction = kActionFall;
+ protagonist->actionCycle = 24;
+ protagonist->fallAcceleration = - 20;
+ protagonist->fallVelocity = - (protagonist->fallAcceleration * 16) / 2 - (44 / 12);
+ protagonist->fallPosition = protagonist->location.z << 4;
+ protagonist->actionCycle--;
+ }
}
// Script function #66 (0x42)
More information about the Scummvm-git-logs
mailing list