rename some methods (purely cosmetic) and fix some walking problems when closing Journal screen

svn-id: r11373
This commit is contained in:
Gregory Montoir 2003-11-26 20:40:43 +00:00
parent a5d8cacdad
commit 871c4f8342
7 changed files with 79 additions and 57 deletions

View File

@ -563,7 +563,7 @@ int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, const Verb &v, bool
_logic->joeFace();
}
else {
p = _walk->joeMove(facing, x, y, false); // XXX inCutaway parameter
p = _walk->moveJoe(facing, x, y, false); // XXX inCutaway parameter
// XXX if(P != 0) P = FIND_VERB
}
}
@ -843,7 +843,8 @@ bool Command::executeIfCutaway(const char *description) {
if (strlen(description) > 4 &&
scumm_stricmp(description + strlen(description) - 4, ".cut") == 0) {
_graphics->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS);
// _graphics->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS);
clear(true);
char nextCutaway[20];
memset(nextCutaway, 0, sizeof(nextCutaway));
@ -863,7 +864,8 @@ bool Command::executeIfDialog(const char *description) {
scumm_stricmp(description + strlen(description) - 4, ".dog") == 0) {
char cutaway[20];
_graphics->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS);
// _graphics->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS);
clear(true);
_logic->dialogue(description, _selCmd.noun, cutaway);
@ -891,7 +893,8 @@ bool Command::handleBadCommand(bool walk) {
if (_selCmd.action.isNone()) {
_graphics->textClear(CmdText::COMMAND_Y_POS, CmdText::COMMAND_Y_POS);
}
_walk->joeMove(0, _selPosX, _selPosY, false); // XXX inCutaway parameter
debug(0, "_walk->moveJoe(%d, %d)", _selPosX, _selPosY);
_walk->moveJoe(0, _selPosX, _selPosY, false); // XXX inCutaway parameter
return true;
}
// check to see if one of the objects is hidden

View File

@ -1129,7 +1129,7 @@ void Cutaway::handlePersonRecord(
if (object.objectNumber == OBJECT_JOE) {
if (object.moveToX || object.moveToY) {
_walk->joeMove(0, object.moveToX, object.moveToY, true);
_walk->moveJoe(0, object.moveToX, object.moveToY, true);
}
}
else {
@ -1145,7 +1145,7 @@ void Cutaway::handlePersonRecord(
}
if (object.moveToX || object.moveToY)
_walk->personMove(
_walk->movePerson(
&p,
object.moveToX, object.moveToY,
_currentImage + 1, // XXX CI+1
@ -1181,6 +1181,7 @@ void Cutaway::handlePersonRecord(
char voiceFilePrefix[MAX_STRING_SIZE];
findCdCut(_basename, index, voiceFilePrefix);
Talk::speak(sentence, (object.objectNumber == OBJECT_JOE) ? NULL : &p, voiceFilePrefix,
_graphics, _input, _logic, _resource, _sound);
}

View File

@ -32,7 +32,6 @@ namespace Queen {
// - misc
// * better Journal integration in Logic
// * get rid of g_engine global
// * walking issues (try to get rid of walkgameload)
// - save/load code related
// * new format (SCVM [ver]32 [flags]32) all BE
// * move code from Resource to Journal
@ -92,6 +91,8 @@ void Journal::use() {
g_system->delay_msecs(20);
}
_graphics->textClear(0, GAME_SCREEN_HEIGHT - 1);
_graphics->cameraBob(0);
if (_quitCleanly) {
restore();
}
@ -145,12 +146,7 @@ void Journal::prepare() {
void Journal::restore() {
_graphics->textClear(0, GAME_SCREEN_HEIGHT - 1);
// XXX in_journal=0;
_display->fullscreen(false);
_graphics->cameraBob(0);
_logic->joeX(_prevJoeX);
_logic->joeY(_prevJoeY);

View File

@ -1244,7 +1244,7 @@ void Logic::roomDisplay(const char *room, RoomDisplayMode mode, uint16 scale, in
}
// }
if (pod != NULL) {
_walk->joeMove(0, pod->x, pod->y, inCutaway);
_walk->moveJoe(0, pod->x, pod->y, inCutaway);
}
}
@ -2556,15 +2556,26 @@ void Logic::useJournal() {
Talk::speak("This is a demo, so I can't load or save games*14", NULL, "", _graphics, _input, this, _resource, _sound);
}
else {
// XXX (execute.c l.428-437 & queen.c l.350-365)
// XXX save some vars
//
// XXX tmpbamflag=bamflag;
// XXX bamflag=0;
// XXX in_journal=1;
_cmd->clear(false);
Journal j(this, _graphics, _display, _sound, &_settings);
j.use();
// XXX restore vars
// _graphics->bob(0)->moving = false;
// joeWalk(JWM_EXECUTE); // make sure we exit Move_Joe()
// XXX _walk->stopJoe();
_walk->stopJoe();
// XXX restore vars
//
// XXX in_journal=0;
// XXX bamflag=tmpbamflag;
// XXX TALKQUIT=CUTQUIT=0; Make sure that we turn off cut stuff in case we use Journal during cutaways
}
}

View File

@ -101,7 +101,7 @@ void Walk::animateJoePrepare() {
}
bool Walk::animateJoe() {
void Walk::animateJoe() {
// queen.c l.2789-2835
uint16 lastDirection = 0;
uint16 i;
@ -109,8 +109,7 @@ bool Walk::animateJoe() {
_logic->joeFacing(_walkData[1].anim.facing);
_logic->joeScale(_walkData[1].area->calcScale(pbs->y));
_logic->joeFace();
bool interrupted = false;
for (i = 1; i <= _walkDataCount && !interrupted; ++i) {
for (i = 1; i <= _walkDataCount && !_joeInterrupted; ++i) {
WalkData *pwd = &_walkData[i];
@ -119,7 +118,7 @@ bool Walk::animateJoe() {
// queen.c l.2838-2911
_logic->customMoveJoe(pwd->anim.facing, pwd->areaNum, i);
_joeMoveBlock = true;
return interrupted;
return;
}
if (lastDirection != pwd->anim.facing) {
_graphics->bobAnimNormal(0, pwd->anim.firstFrame, pwd->anim.lastFrame, 1, false, false);
@ -142,16 +141,17 @@ bool Walk::animateJoe() {
pbs->speed = 1;
}
_logic->checkPlayer();
// FIXME it would nice to be able to get rid of these 3 lines
// as stopJoe() should be do the same...
if (_logic->joeWalk() == JWM_EXECUTE) { // XXX || cutQuit
// we are about to do something else, so stop walking
interrupted = true;
_joeInterrupted = true;
pbs->moving = false;
}
}
lastDirection = pwd->anim.facing;
}
_logic->joeFacing(lastDirection);
return interrupted;
}
@ -290,12 +290,14 @@ void Walk::animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum,
}
int16 Walk::joeMove(int direction, int16 endx, int16 endy, bool inCutaway) {
int16 Walk::moveJoe(int direction, int16 endx, int16 endy, bool inCutaway) {
_joeMoveBlock = false;
int16 can = 0;
initWalkData();
_joeInterrupted = false;
uint16 oldx = _graphics->bob(0)->x;
uint16 oldy = _graphics->bob(0)->y;
@ -304,7 +306,7 @@ int16 Walk::joeMove(int direction, int16 endx, int16 endy, bool inCutaway) {
uint16 oldPos = _logic->zoneInArea(ZONE_ROOM, oldx, oldy);
uint16 newPos = _logic->zoneInArea(ZONE_ROOM, endx, endy);
debug(9, "Walk::joeMove(%d, %d, %d, %d, %d) - old = %d, new = %d", direction, oldx, oldy, endx, endy, oldPos, newPos);
debug(9, "Walk::moveJoe(%d, %d, %d, %d, %d) - old = %d, new = %d", direction, oldx, oldy, endx, endy, oldPos, newPos);
// if in cutaway, allow Joe to walk anywhere
if(newPos == 0 && inCutaway) {
@ -314,7 +316,8 @@ int16 Walk::joeMove(int direction, int16 endx, int16 endy, bool inCutaway) {
if (calc(oldPos, newPos, oldx, oldy, endx, endy)) {
if (_walkDataCount > 0) {
animateJoePrepare();
if(animateJoe()) {
animateJoe();
if (_joeInterrupted) {
can = -1;
}
}
@ -343,14 +346,10 @@ int16 Walk::joeMove(int direction, int16 endx, int16 endy, bool inCutaway) {
}
int16 Walk::personMove(const Person *pp, int16 endx, int16 endy, uint16 curImage, int direction) {
if (curImage > MAX_FRAMES_NUMBER) {
error("[Walk::personMove] curImage is invalid: %i", curImage);
}
int16 Walk::movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage, int direction) {
if (endx == 0 && endy == 0) {
warning("Walk::personMove() - endx == 0 && endy == 0");
warning("Walk::movePerson() - endx == 0 && endy == 0");
return 0;
}
@ -373,7 +372,7 @@ int16 Walk::personMove(const Person *pp, int16 endx, int16 endy, uint16 curImage
uint16 oldPos = _logic->zoneInArea(ZONE_ROOM, oldx, oldy);
uint16 newPos = _logic->zoneInArea(ZONE_ROOM, endx, endy);
debug(9, "Walk::personMove(%d, %d, %d, %d, %d) - old = %d, new = %d", direction, oldx, oldy, endx, endy, oldPos, newPos);
debug(9, "Walk::movePerson(%d, %d, %d, %d, %d) - old = %d, new = %d", direction, oldx, oldy, endx, endy, oldPos, newPos);
// find MovePersonData associated to Person
const MovePersonData *mpd = _moveData;
@ -399,7 +398,7 @@ int16 Walk::personMove(const Person *pp, int16 endx, int16 endy, uint16 curImage
standingFrame = 29 + FRAMES_JOE_XTRA + bobNum;
}
else {
warning("Walk::personMove() - Wrong bob number : %d", bobNum);
warning("Walk::movePerson() - Wrong bob number : %d", bobNum);
}
// make other person face the right direction
BobSlot *pbs = _graphics->bob(bobNum);
@ -427,6 +426,14 @@ int16 Walk::personMove(const Person *pp, int16 endx, int16 endy, uint16 curImage
}
void Walk::stopJoe() {
_graphics->bob(0)->moving = false;
_joeInterrupted = true;
}
bool Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y) {
// if newPos is outside of an AREA then traverse Y axis until an AREA is found

View File

@ -71,18 +71,20 @@ public:
Walk(Logic *logic, Graphics *graphics);
int16 joeMove(int direction, int16 endx, int16 endy, bool inCutaway);
int16 personMove(const Person *pp, int16 endx, int16 endy, uint16 curImage, int direction);
int16 moveJoe(int direction, int16 endx, int16 endy, bool inCutaway);
int16 movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage, int direction);
void stopJoe();
enum {
MAX_WALK_DATA = 16
};
private:
void animateJoePrepare();
bool animateJoe();
void animateJoe();
void animatePersonPrepare(const MovePersonData *mpd, int direction);
void animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum, uint16 bankNum, int direction);
@ -121,6 +123,8 @@ private:
uint16 _areaList[MAX_WALK_DATA];
uint16 _areaListCount;
bool _joeInterrupted;
//! set if customMoveJoe() is called in joeAnimate()
bool _joeMoveBlock;

View File

@ -74,13 +74,12 @@ Czone
CUTAWAY
=======
action_special_move Cutaway::actionSpecialMove
action_special_move() Cutaway::actionSpecialMove
CUTAWAY() Cutaway::run
MAKE_COMPLEX_ANIM() Cutaway::makeComplexAnimation
SCENE_START() Logic::sceneStart
SCENE_END() Logic::sceneStop
-
CUTJOEF
CUTON Input::_cutawayRunning
CUTQUIT Input::_cutawayQuit
FINAL_ROOM Cutaway::_finalRoom
@ -130,7 +129,7 @@ freeframes() Graphics::frameEraseAll(false)
invbob() Graphics::bobDrawInventoryItem
loadbackdrop() Graphics::loadBackdrop
loadpanel() Graphics::loadPanel
MAKE_SPEAK_BOB Graphics::bobSetText
MAKE_SPEAK_BOB() Graphics::bobSetText
makeanim() Graphics::bobAnimNormal
movebob() Graphics::bobMove
pastebob() Graphics::bobPaste
@ -181,9 +180,10 @@ USE_UNDERWEAR() Logic::joeUseUnderwear
USE_CLOTHES() Logic::joeUseClothes
USE_DRESS() Logic::joeUseDress
-
CUTJOEF
JOE_RESPstr Logic::_joeResponse
JOEF,JX,JY,JDIR Logic::_joe.*
JOEWALK Logic::_joe.walk (legal values = 0,1,2,3)
JOEWALK Logic::_joe.walk
JOURNAL
@ -199,9 +199,9 @@ waitmousezone() *not needed*
-
choice Journal::_currentSaveSlot
decbase Journal::_currentSavePage
in_journal *not needed ?*
in_journal *not needed* (the hack in puttext() seems useless and CHECK_PARALLAX() is never called)
save_descriptions Journal::_saveDescriptions
walkgameload
walkgameload *not needed ?*
LOGIC
@ -270,11 +270,11 @@ WALK_OFF_MAX Logic::_numWalkOffs
PERSONS
=======
ALLOCATE_PERSON Logic::personAllocate
ALLOCATE_PERSON() Logic::personAllocate
CREATE_ANIM() Logic::animCreate
SET_PERSON_DATA Logic::personSetData
SETUP_PERSON Logic::personSetup
OBJ_PERSON Logic::objectForPerson
SET_PERSON_DATA() Logic::personSetData
SETUP_PERSON() Logic::personSetup
OBJ_PERSON() Logic::objectForPerson
-
PERSON_FACE
PERSON_FACE_MAX
@ -358,11 +358,11 @@ FIND_STATE() State::findState*
TALK
====
FIND_SACTION() Talk::findSpeechParameters
MOVE_SPEAK
SPEAK Talk::speak
SPEAK_SUB Talk::speakSegment
talk Talk::talk
TALK_PROC Talk::talk
MOVE_SPEAK()
SPEAK() Talk::speak
SPEAK_SUB() Talk::speakSegment
talk() Talk::talk
TALK_PROC() Talk::talk
-
A1,A12
actiondata Talk::_speechParameters
@ -405,8 +405,8 @@ CALCSCALE() Area::calcScale
FIND_FREE_AREA Walk::findFreeArea
FIND_NEWP() Walk::findAreaPosition
FIND_OLDP() Walk::findAreaPosition
MOVE_JOE() Walk::joeMove
MOVE_OTHER() Walk::personMove
MOVE_JOE() Walk::moveJoe
MOVE_OTHER() Walk::movePerson
-
AREALIST Walk::_areaList
AREASTRIKE Walk::_areaStrike
@ -430,7 +430,7 @@ zones Logic::_zones
==========
in() defs.h InRange() macro
find_cd_cut() findCdCut
find_cd_desc() *not needed, see Logic::joeSpeak()*
find_cd_desc() *not needed* (see Logic::joeSpeak())
-
Kstr
bank9