cleanup/remaining Walk cutaway calls

svn-id: r11056
This commit is contained in:
Gregory Montoir 2003-11-02 16:47:31 +00:00
parent 082bed6940
commit c4404baa45
4 changed files with 177 additions and 73 deletions

View File

@ -1923,9 +1923,12 @@ void Logic::joeUseUnderwear() {
}
void Logic::playCutaway(const char* cutFile) {
void Logic::playCutaway(const char *cutFile, char *next) {
char next[20];
char nextFile[20];
if (next == NULL) {
next = nextFile;
}
Cutaway::run(cutFile, next, _graphics, _input, this, _resource, _sound);
}
@ -2192,6 +2195,127 @@ void Logic::checkPlayer() {
}
void Logic::customMoveJoe(int facing, uint16 areaNum, uint16 walkDataNum) {
// queen.c l.2838-2911
debug(9, "customMoveJoe(%d, %d, %d)\n", facing, areaNum, walkDataNum);
// Stop animating Joe
_graphics->bob(0)->animating = false;
// Make Joe face the right direction
joeFacing(facing);
joeFace();
_newRoom = 0;
_entryObj = 0;
char nextCut[20];
memset(nextCut, 0, sizeof(nextCut));
switch (_currentRoom) {
case 4:
joeSpeak(16);
break;
case 6:
playCutaway("c6c.CUT", nextCut);
break;
case 14:
playCutaway("c14b.CUT", nextCut);
break;
case 16:
if (areaNum == 3) {
playCutaway("c16a.CUT", nextCut);
}
break;
case 17:
if (walkDataNum == 4) {
playCutaway("c17a.CUT", nextCut);
}
else if (walkDataNum == 2) {
playCutaway("c17b.CUT", nextCut);
}
break;
case 22:
playCutaway("c22a.CUT", nextCut);
break;
case 26:
playCutaway("c26b.CUT", nextCut);
break;
case 30:
playCutaway("c30a.CUT", nextCut);
break;
case 32:
playCutaway("c32c.CUT", nextCut);
break;
case 50:
if (areaNum == 6) {
if (_gameState[21] == 0) {
playCutaway("c50d.CUT", nextCut);
while (nextCut[0] != '\0') {
playCutaway(nextCut, nextCut);
}
_gameState[21] = 1;
} else {
playCutaway("c50h.CUT", nextCut);
}
}
break;
case 53:
playCutaway("c53b.CUT", nextCut);
break;
case 55:
joeSpeak(19);
break;
case 71:
joeSpeak(21);
break;
case 73:
// don't play next Cutaway
if (_gameState[VAR_ROOM73_CUTAWAY] == 0) {
playCutaway("c73a.CUT");
_gameState[VAR_ROOM73_CUTAWAY] = 1;
joeUseUnderwear();
joeFace();
}
else if (_gameState[VAR_ROOM73_CUTAWAY] == 1) {
playCutaway("c73b.CUT");
_gameState[VAR_ROOM73_CUTAWAY] = 2;
}
else if (_gameState[VAR_ROOM73_CUTAWAY] == 2) {
playCutaway("c73c.CUT");
}
break;
case 100:
if (areaNum == 7) {
joeSpeak(17);
}
break;
case 101:
if (areaNum == 5 && _gameState[187] == 0) {
playCutaway("c101b.CUT", nextCut);
}
break;
case 103:
if (areaNum == 3) {
if (_gameState[35] == 1) {
playCutaway("c103e.CUT", nextCut);
}
else if (_gameState[35] == 0) {
playCutaway("c103b.CUT", nextCut);
_gameState[35] = 1;
}
}
break;
}
while (strlen(nextCut) > 4 &&
scumm_stricmp(nextCut + strlen(nextCut) - 4, ".cut") == 0) {
playCutaway(nextCut, nextCut);
}
}
void Logic::update() {
_graphics->update(_currentRoom);
_input->delay();

View File

@ -226,18 +226,13 @@ public:
//! GRAB_DIR
void joeGrabDirection(StateGrab grab, uint16 speed);
//! USE_DRESS
void joeUseDress(bool showCut);
//! USE_CLOTHES
void joeUseClothes(bool showCut);
//! USE_UNDERWEAR
void joeUseUnderwear();
void joeSpeak(uint16 descNum, bool objectType = false);
void playCutaway(const char* cutFile);
void playCutaway(const char *cutFile, char *next = NULL);
const char* objectOrItemName(int16 obj) const;
@ -269,6 +264,8 @@ public:
void checkPlayer();
void customMoveJoe(int facing, uint16 areaNum, uint16 walkDataNum);
void update();

View File

@ -28,28 +28,28 @@
namespace Queen {
const MovePersonData Walk::_moveData[] = {
{"COMPY", -1, -6, 1, 6, 0, 0, 0, 0,12,12,1,14},
{"DEINO", -1, -8, 1, 8, 0, 0, 0, 0,11,11,1,10},
{"FAYE", -1, -6, 1, 6,13,18, 7,12,19,22,2, 5},
{"GUARDS", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7,2, 5},
{"PRINCESS1", -1, -6, 1, 6,13,18, 7,12,19,21,2, 5},
{"PRINCESS2", -1, -6, 1, 6,13,18, 7,12,19,21,2, 5},
{"AMGUARD", -1, -6, 1, 6,13,18, 7,12,19,21,2, 5},
{"SPARKY", -1, -6, 1, 6,13,18, 7,12,21,20,2, 5},
{"LOLA_SHOWER", -1, -6,55,60, 0, 0, 0, 0, 7, 7,2, 5},
{"LOLA", -24,-29,24,29, 0, 0, 0, 0,30,30,2, 5},
{"BOB", -15,-20,15,20,21,26, 0, 0,27,29,2, 5},
{"CHEF", -1, -4, 1, 4, 0, 0, 0, 0, 1, 5,2, 4},
{"HENRY", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7,2, 6},
{"ANDERSON", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7,2, 5},
{"JASPAR", -4, -9, 4, 9,16,21,10,15, 1, 3,1,10},
{"PYGMY", -7,-12, 7,12, 0, 0, 0, 0,27,27,2, 5},
{"FRANK", 7, 12, 1, 6, 0, 0, 0, 0,13,13,2, 4},
{"WEDGEWOOD", -20,-25,20,25, 0, 0, 0, 0, 1, 1,1, 5},
{"TMPD", -1, -6, 1, 6,13,18, 7,12,19,21,2, 5},
{"IAN", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7,2, 6},
{"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0}
const MovePersonData Walk::MOVE_DATA[] = {
{"COMPY", -1, -6, 1, 6, 0, 0, 0, 0, 12, 12, 1, 14},
{"DEINO", -1, -8, 1, 8, 0, 0, 0, 0, 11, 11, 1, 10},
{"FAYE", -1, -6, 1, 6, 13, 18, 7, 12, 19, 22, 2, 5},
{"GUARDS", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 5},
{"PRINCESS1", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5},
{"PRINCESS2", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5},
{"AMGUARD", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5},
{"SPARKY", -1, -6, 1, 6, 13, 18, 7, 12, 21, 20, 2, 5},
{"LOLA_SHOWER", -1, -6, 55, 60, 0, 0, 0, 0, 7, 7, 2, 5},
{"LOLA", -24, -29, 24, 29, 0, 0, 0, 0, 30, 30, 2, 5},
{"BOB", -15, -20, 15, 20, 21, 26, 0, 0, 27, 29, 2, 5},
{"CHEF", -1, -4, 1, 4, 0, 0, 0, 0, 1, 5, 2, 4},
{"HENRY", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 6},
{"ANDERSON", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 5},
{"JASPAR", -4, -9, 4, 9, 16, 21, 10, 15, 1, 3, 1, 10},
{"PYGMY", -7, -12, 7, 12, 0, 0, 0, 0, 27, 27, 2, 5},
{"FRANK", 7, 12, 1, 6, 0, 0, 0, 0, 13, 13, 2, 4},
{"WEDGEWOOD", -20, -25, 20, 25, 0, 0, 0, 0, 1, 1, 1, 5},
{"TMPD", -1, -6, 1, 6, 13, 18, 7, 12, 19, 21, 2, 5},
{"IAN", -1, -6, 1, 6, 0, 0, 0, 0, 7, 7, 2, 6},
{"*", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
@ -59,23 +59,6 @@ Walk::Walk(Logic *logic, Graphics *graphics)
}
void Walk::joeMoveBlock(int facing, uint16 areaNum, uint16 walkDataNum) {
warning("Walk::moveJoeBlock() partially implemented");
_graphics->bob(0)->animating = false;
// Make Joe face the right direction
_joeMoveBlock = true;
_logic->joeFacing(facing);
_logic->joeFace();
_logic->newRoom(0);
_logic->entryObj(0);
// XXX cutaway calls
}
void Walk::animateJoePrepare() {
// queen.c l.2748-2788
uint16 i;
@ -133,7 +116,9 @@ bool Walk::animateJoe() {
// area has been turned off, see if we should execute a cutaway
if (pwd->area->mapNeighbours < 0) {
joeMoveBlock(pwd->anim.facing, pwd->areaNum, i);
// queen.c l.2838-2911
_logic->customMoveJoe(pwd->anim.facing, pwd->areaNum, i);
_joeMoveBlock = true;
return interrupted;
}
if (lastDirection != pwd->anim.facing) {
@ -157,7 +142,7 @@ bool Walk::animateJoe() {
pbs->speed = 1;
}
_logic->checkPlayer();
if (_logic->joeWalk() == 2) { // || cutQuit
if (_logic->joeWalk() == 2) { // XXX || cutQuit
// we are about to do something else, so stop walking
interrupted = true;
pbs->moving = false;
@ -299,7 +284,7 @@ void Walk::animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum,
else {
pbs->speed = scale * (mpd->moveSpeed / 2) / 100;
}
// if (cutQuit)
// XXX if (cutQuit)
}
}
}
@ -386,7 +371,7 @@ int16 Walk::personMove(const Person *pp, uint16 endx, uint16 endy, uint16 curIma
calc(oldPos, newPos, oldx, oldy, endx, endy);
// find MovePersonData associated to Person
const MovePersonData *mpd = _moveData;
const MovePersonData *mpd = MOVE_DATA;
while (mpd->name[0] != '*') {
if (scumm_stricmp(mpd->name, pp->name) == 0) {
break;

View File

@ -28,9 +28,6 @@
namespace Queen {
#define MAX_AREAS 11
struct MovePersonAnim {
int16 firstFrame;
int16 lastFrame;
@ -48,7 +45,7 @@ struct WalkData {
// int16 sign; // never used
int16 dx, dy;
const Area *area;
uint16 areaNum; // extra stuff for joeMoveBlock
uint16 areaNum; // extra stuff for customMoveJoe
MovePersonAnim anim;
};
@ -72,65 +69,66 @@ class Graphics;
class Walk {
public:
Walk(Logic* logic, Graphics* graphics);
Walk(Logic *logic, Graphics *graphics);
//! MOVE_JOE()
int16 joeMove(int direction, uint16 endx, uint16 endy, bool inCutaway);
//! MOVE_OTHER
int16 personMove(const Person *pp, uint16 endx, uint16 endy, uint16 curImage, int direction);
enum {
MAX_WALK_DATA = 16
};
private:
void joeMoveBlock(int facing, uint16 areaNum, uint16 walkDataNum);
void animateJoePrepare();
bool animateJoe();
void animatePersonPrepare(const MovePersonData *mpd, int direction);
void animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum, uint16 bankNum, int direction);
//! CALC_X, CALC_Y
//! compute transition coordinate
static uint16 calcC(uint16 c1, uint16 c2, uint16 c3, uint16 c4, uint16 lastc);
//! FIND_OLDP, FIND_NEWP
//! find area for position
int16 findAreaPosition(uint16 *x, uint16 *y, bool recalibrate);
//! FIND_FREE_AREA, find an area not already struck
//! find an area not already struck
uint16 findFreeArea(uint16 area) const;
//!
//! return true if the area is already on the walking path
bool isAreaStruck(uint16 area) const;
//! CALC_PATH, calculates the path list from oldArea to newArea
//! calculates the path list from oldArea to newArea
bool calcPath(uint16 oldArea, uint16 newArea);
//! resets path computed in calcPath()
void initWalkData();
//! CALC_WALK
//! add an area to the path
void incWalkData(uint16 px, uint16 py, uint16 x, uint16 y, uint16 area);
//! equivalent to l.2432,2469 MOVE_OTHER() and l.2696,2744 MOVE_JOE()
//! compute path (and populates _walkData) from current position to the new one
void calc(uint16 oldPos, uint16 newPos, uint16 oldx, uint16 oldy, uint16 x, uint16 y);
static const MovePersonData _moveData[];
WalkData _walkData[MAX_WALK_DATA];
uint16 _walkDataCount;
WalkData _walkData[16];
uint16 _areaStrike[MAX_WALK_DATA];
uint16 _areaStrikeCount;
uint16 _areaStrike[MAX_AREAS + 1];
uint16 _areaListCount;
uint16 _areaList[MAX_AREAS + 1];
//! set if joeMoveBlock() is called in joeAnimate()
uint16 _areaList[MAX_WALK_DATA];
uint16 _areaListCount;
//! set if customMoveJoe() is called in joeAnimate()
bool _joeMoveBlock;
Logic *_logic;
Graphics *_graphics;
static const MovePersonData MOVE_DATA[];
};