diff options
author | Gregory Montoir | 2003-10-09 13:14:16 +0000 |
---|---|---|
committer | Gregory Montoir | 2003-10-09 13:14:16 +0000 |
commit | d03dfdb6f781efcb380f4db1646b85db85b20518 (patch) | |
tree | 70efa306fcde4376b2ccb70ee103146caf8e2782 /queen | |
parent | 21480a2289f216e38b872ceb038d3e661d4a01ce (diff) | |
download | scummvm-rg350-d03dfdb6f781efcb380f4db1646b85db85b20518.tar.gz scummvm-rg350-d03dfdb6f781efcb380f4db1646b85db85b20518.tar.bz2 scummvm-rg350-d03dfdb6f781efcb380f4db1646b85db85b20518.zip |
minor additions to walk class + get/set functions for Logic::_area
svn-id: r10699
Diffstat (limited to 'queen')
-rw-r--r-- | queen/defs.h | 7 | ||||
-rw-r--r-- | queen/logic.cpp | 20 | ||||
-rw-r--r-- | queen/logic.h | 10 | ||||
-rw-r--r-- | queen/structs.h | 5 | ||||
-rw-r--r-- | queen/walk.cpp | 64 | ||||
-rw-r--r-- | queen/walk.h | 24 |
6 files changed, 100 insertions, 30 deletions
diff --git a/queen/defs.h b/queen/defs.h index e05b39bc5a..e6cfb175ff 100644 --- a/queen/defs.h +++ b/queen/defs.h @@ -65,6 +65,13 @@ enum { }; +//! GameState vars +enum { + VAR_DRESSING_MODE = 19, // 0=normal clothes, 1=underwear, 2=dress + VAR_INTRO_PLAYED = 117 +}; + + } // End of namespace Queen #endif diff --git a/queen/logic.cpp b/queen/logic.cpp index 0c14adf345..8a5ae0e67a 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -240,8 +240,20 @@ uint16 Logic::objMax(int room) { return _objMax[room]; } -Area *Logic::area(int index, int subIndex) { - return &_area[index][subIndex]; +Area *Logic::area(int room, int num) { + return &_area[room][num]; +} + +Area *Logic::currentRoomArea(int num) { + return &_area[_currentRoom][num]; +} + +uint16 Logic::areaMax(int room) { + return _areaMax[room]; +} + +uint16 Logic::currentRoomAreaMax() { + return _areaMax[_currentRoom]; } uint16 Logic::walkOffCount() { @@ -444,6 +456,10 @@ void Logic::joeWalk(uint16 walk) { _joe.walk = walk; } +void Logic::joeScale(uint16 scale) { + _joe.scale = scale; +} + int16 Logic::gameState(int index) { if (index >= 0 && index < GAME_STATE_COUNT) return _gameState[index]; diff --git a/queen/logic.h b/queen/logic.h index d895ffe50e..fc1d42b7ac 100644 --- a/queen/logic.h +++ b/queen/logic.h @@ -62,19 +62,24 @@ public: uint16 findBob(uint16 obj); // FIXME: move that to QueenDisplay ? uint16 findFrame(uint16 obj); // FIXME: move that to QueenDisplay ? - Area *area(int index, int subIndex); + Area *area(int room, int num); + Area *currentRoomArea(int num); + uint16 areaMax(int room); + uint16 currentRoomAreaMax(); uint16 walkOffCount(); WalkOffData *walkOffData(int index); uint16 joeFacing() { return _joe.facing; } uint16 joeX() { return _joe.x; } uint16 joeY() { return _joe.y; } - uint16 joeWalk() { return _joe.walk; } + uint16 joeWalk() { return _joe.walk; } + uint16 joeScale() { return _joe.scale; } void joeFacing(uint16 dir); void joeX(uint16 x); void joeY(uint16 y); void joeWalk(uint16 walk); + void joeScale(uint16 scale); int16 gameState(int index); void gameState(int index, int16 newValue); @@ -129,6 +134,7 @@ protected: uint16 x, y; uint16 facing; uint16 walk; + uint16 scale; } _joe; int16 _gameState[GAME_STATE_COUNT]; diff --git a/queen/structs.h b/queen/structs.h index 37ebcb72e5..b45b1ff37b 100644 --- a/queen/structs.h +++ b/queen/structs.h @@ -132,6 +132,7 @@ struct CmdListData { int16 verb; int16 nounObj1; int16 nounObj2; + int16 song; // >0: playbefore, <0: playafter bool setAreas; bool setObjects; bool setItems; @@ -157,8 +158,8 @@ struct CmdObject { struct CmdInventory { int16 id; - int16 dstItem; // <0 : delete, >0 : add - int16 srcItem; // >0 : valid + int16 dstItem; // <0: delete, >0: add + int16 srcItem; // >0: valid }; diff --git a/queen/walk.cpp b/queen/walk.cpp index 13a60e5f1e..f8af32db6e 100644 --- a/queen/walk.cpp +++ b/queen/walk.cpp @@ -26,13 +26,37 @@ namespace Queen { +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} +}; + Walk::Walk(Logic *logic, Graphics *graphics) : _logic(logic), _graphics(graphics) { } -uint16 Walk::joeFace(uint16 prevFacing, uint16 scale) { +uint16 Walk::joeFace(uint16 prevFacing) { BobSlot *pbs = _graphics->bob(0); uint16 frame; if (_logic->currentRoom() == 108) { @@ -48,7 +72,7 @@ uint16 Walk::joeFace(uint16 prevFacing, uint16 scale) { } // FIXME: handle prevFacing pbs->frameNum = frame + FRAMES_JOE_XTRA; - pbs->scale = scale; + pbs->scale = _logic->joeScale(); pbs->xflip = (_logic->joeFacing() == DIR_LEFT); _graphics->update(); // joePrevFacing = joeFacing; @@ -78,7 +102,7 @@ void Walk::animatePersonPrepare() { WalkData *pwd = &_walkData[i]; mpa->wx = pwd->dx; mpa->wy = pwd->dy; - mpa->walkingArea = &_roomAreas[ pwd->area ]; + mpa->walkingArea = _logic->currentRoomArea(pwd->area); // &_roomAreas[ pwd->area ]; if (mpa->wx < 0) { mpa->setFrames(11, 16 + FRAMES_JOE_XTRA, DIR_LEFT); @@ -111,7 +135,8 @@ void Walk::animatePerson() { uint16 i; BobSlot *pbs = _graphics->bob(0); _logic->joeFacing(_moveAnim[1].facing); - joeFace(_logic->joeFacing(), _moveAnim[1].walkingArea->calcScale(pbs->y)); + _logic->joeScale(_moveAnim[1].walkingArea->calcScale(pbs->y)); + joeFace(_logic->joeFacing()); bool interrupted = false; for (i = 1; i <= _walkDataCount && !interrupted; ++i) { MovePersonAnim *mpa = &_moveAnim[i]; @@ -128,6 +153,7 @@ void Walk::animatePerson() { while (pbs->moving) { // adjust Joe's movespeed according to scale pbs->scale = mpa->walkingArea->calcScale(pbs->y); + _logic->joeScale(pbs->scale); if (pbs->xmajor) { pbs->speed = pbs->scale * 6 / 100; } @@ -172,7 +198,6 @@ void Walk::joeSetup() { void Walk::joeMove(int direction, uint16 oldx, uint16 oldy, uint16 newx, uint16 newy, bool inCutaway) { - // CAN=0 initWalkData(); @@ -200,13 +225,16 @@ void Walk::joeMove(int direction, uint16 oldx, uint16 oldy, uint16 newx, uint16 // SPEAK(JOE_RESPstr[4],"JOE",find_cd_desc(4)) } //MOVE_JOE_EXIT: + if (direction > 0) { + _logic->joeFacing(direction); + } +// joePrevFacing = _logic->joeFacing(); + joeFace(0); } -void Walk::setCurrentRoomAreas(const Area* roomAreas, uint16 roomAreasCount) { - - _roomAreas = roomAreas; - _roomAreasCount = roomAreasCount; +void Walk::personMove(const char* name, uint16 endx, uint16 endy, uint16 image, int dir) { + warning("Walk::personMove() unimplemented"); } @@ -233,8 +261,8 @@ void Walk::calc(uint16 oldPos, uint16 newPos, uint16 oldx, uint16 oldy, uint16 x for (i = 2; i <= _areaListCount; ++i) { uint16 a1 = _areaList[i - 1]; uint16 a2 = _areaList[i]; - const Area *pa1 = &_roomAreas[ a1 ]; - const Area *pa2 = &_roomAreas[ a2 ]; + const Area *pa1 = _logic->currentRoomArea(a1); //&_roomAreas[ a1 ]; + const Area *pa2 = _logic->currentRoomArea(a2); uint16 x1 = calcC(pa1->box.x1, pa1->box.x2, pa2->box.x1, pa2->box.x2, px); uint16 y1 = calcC(pa1->box.y1, pa1->box.y2, pa2->box.y1, pa2->box.y2, py); incWalkData(px, py, x1, y1, a1); @@ -260,14 +288,14 @@ uint16 Walk::calcC(uint16 c1, uint16 c2, uint16 c3, uint16 c4, uint16 lastc) { int16 Walk::findAreaPosition(uint16 *x, uint16 *y, bool recalibrate) { uint16 i; uint16 pos = 1; - const Box *b = &_roomAreas[1].box; + const Box *b = &_logic->currentRoomArea(1)->box; uint16 tx = b->x1; uint16 bx = b->x2; uint16 ty = b->y1; uint16 by = b->y2; uint16 prevClosestFace = 640; - for (i = 1; i <= _roomAreasCount; ++i) { - b = &_roomAreas[i].box; + for (i = 1; i <= _logic->currentRoomAreaMax(); ++i) { + b = &_logic->currentRoomArea(i)->box; uint16 dx1 = ABS(b->x1 - *x); uint16 dx2 = ABS(b->x2 - *x); uint16 dy1 = ABS(b->y1 - *y); @@ -296,7 +324,7 @@ int16 Walk::findAreaPosition(uint16 *x, uint16 *y, bool recalibrate) { // we now have the closest area near X,Y, so we can recalibrate // the X,Y coord to be in this area if (recalibrate) { - b = &_roomAreas[pos].box; + b = &_logic->currentRoomArea(pos)->box; if(*x < b->x1) *x = b->x1; if(*x > b->x2) *x = b->x2; if(*y < b->y1) *y = b->y1; @@ -310,9 +338,9 @@ uint16 Walk::findFreeArea(uint16 area) const { uint16 testArea; uint16 freeArea = 0; - uint16 map = ABS(_roomAreas[area].mapNeighbours); - for (testArea = 1; testArea <= _roomAreasCount; ++testArea) { - int b = _roomAreasCount - testArea; + uint16 map = ABS(_logic->currentRoomArea(area)->mapNeighbours); + for (testArea = 1; testArea <= _logic->currentRoomAreaMax(); ++testArea) { + int b = _logic->currentRoomAreaMax() - testArea; if (map & (1 << b)) { // connecting area, check if it's been struck off if(!isAreaStruck(testArea)) { diff --git a/queen/walk.h b/queen/walk.h index 4f6e57624b..b95c5bfb95 100644 --- a/queen/walk.h +++ b/queen/walk.h @@ -53,6 +53,19 @@ struct MovePersonAnim { }; +struct MovePersonData { + const char *name; + int16 walkLeft1, walkLeft2; + int16 walkRight1, walkRight2; + int16 walkBack1, walkBack2; + int16 walkFront1, walkFront2; + uint16 frontStandingFrame; + uint16 backStandingFrame; + uint16 animSpeed; + uint16 moveSpeed; +}; + + class Logic; class Graphics; @@ -62,18 +75,18 @@ public: Walk(Logic* logic, Graphics* graphics); void joeSetup(); - - void setCurrentRoomAreas(const Area* roomAreas, uint16 roomAreasCount); //! MOVE_JOE() void joeMove(int dir, uint16 oldx, uint16 oldy, uint16 newx, uint16 newy, bool inCutaway); //! FACE_JOE() - uint16 joeFace(uint16 prevFacing, uint16 scale); + uint16 joeFace(uint16 prevFacing); + //! MOVE_OTHER + void personMove(const char* name, uint16 endx, uint16 endy, uint16 image, int dir); -private: +private: void joeMoveBlock(); @@ -107,12 +120,11 @@ private: MovePersonAnim _moveAnim[15]; + static MovePersonData _moveData[]; uint16 _walkDataCount; WalkData _walkData[16]; - uint16 _roomAreasCount; - const Area* _roomAreas; uint16 _areaStrikeCount; uint16 _areaStrike[MAX_AREAS + 1]; uint16 _areaListCount; |