mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-18 15:48:48 +00:00
AVALANCHE: Some more refactoring
This commit is contained in:
parent
5f0361c03a
commit
1c3fcf22a1
@ -104,7 +104,7 @@ void AnimationType::init(byte spritenum, bool doCheck) {
|
||||
_y = 0;
|
||||
_quick = true;
|
||||
_visible = false;
|
||||
_speedX = 3;
|
||||
_speedX = kWalk;
|
||||
_speedY = 1;
|
||||
_homing = false;
|
||||
_moveX = 0;
|
||||
@ -1376,6 +1376,23 @@ Direction Animation::getOldDirection() {
|
||||
return _oldDirection;
|
||||
}
|
||||
|
||||
void Animation::setAvvyClothes(int id) {
|
||||
AnimationType *spr = _sprites[0];
|
||||
if (spr->_id == id)
|
||||
return;
|
||||
|
||||
int16 x = spr->_x;
|
||||
int16 y = spr->_y;
|
||||
spr->remove();
|
||||
spr->init(id, true);
|
||||
spr->appear(x, y, kDirLeft);
|
||||
spr->_visible = false;
|
||||
}
|
||||
|
||||
int Animation::getAvvyClothes() {
|
||||
return _sprites[0]->_id;
|
||||
}
|
||||
|
||||
void Animation::resetVariables() {
|
||||
_geidaSpin = 0;
|
||||
_geidaTime = 0;
|
||||
|
@ -42,29 +42,25 @@ enum Direction {
|
||||
|
||||
class AnimationType {
|
||||
public:
|
||||
// Former SpriteInfo structure
|
||||
byte _id;
|
||||
|
||||
byte _xLength, _yLength;
|
||||
ManiType *_mani[24];
|
||||
SilType *_sil[24];
|
||||
|
||||
// Former Stat structure
|
||||
byte _frameNum; // Number of pictures.
|
||||
byte _seq; // How many in one stride.
|
||||
Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors.
|
||||
byte _characterId; // The number according to Acci. (1=Avvy, etc.)
|
||||
//
|
||||
byte _count; // Counts before changing step.
|
||||
|
||||
Direction _facingDir;
|
||||
byte _stepNum;
|
||||
int16 _x, _y; // Current xy coords.
|
||||
int8 _moveX, _moveY; // Amount to move sprite by, each step.
|
||||
byte _id;
|
||||
bool _quick, _visible, _homing, _doCheck;
|
||||
int16 _homingX, _homingY; // Homing x & y coords.
|
||||
byte _count; // Counts before changing step.
|
||||
byte _speedX, _speedY; // x & y speed.
|
||||
bool _vanishIfStill; // Do we show this sprite if it's still?
|
||||
bool _callEachStepFl; // Do we call the eachstep procedure?
|
||||
byte _speedX, _speedY;
|
||||
bool _vanishIfStill;
|
||||
bool _callEachStepFl;
|
||||
byte _eachStepProc;
|
||||
|
||||
AnimationType(Animation *anim);
|
||||
@ -78,7 +74,6 @@ public:
|
||||
void walk();
|
||||
void walkTo(byte pednum);
|
||||
void stopHoming();
|
||||
void homeStep();
|
||||
void setSpeed(int8 xx, int8 yy);
|
||||
void stopWalk();
|
||||
void chatter();
|
||||
@ -88,9 +83,11 @@ private:
|
||||
Animation *_anim;
|
||||
|
||||
int16 _oldX[2], _oldY[2]; // Last xy coords.
|
||||
Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors.
|
||||
|
||||
bool checkCollision();
|
||||
int8 getSign(int16 val);
|
||||
void homeStep();
|
||||
};
|
||||
|
||||
class Animation {
|
||||
@ -132,6 +129,9 @@ public:
|
||||
Direction getDirection();
|
||||
Direction getOldDirection();
|
||||
|
||||
void setAvvyClothes(int id);
|
||||
int getAvvyClothes();
|
||||
|
||||
void resetVariables();
|
||||
void synchronize(Common::Serializer &sz);
|
||||
private:
|
||||
|
@ -164,9 +164,6 @@ public:
|
||||
static const bool kThing = true;
|
||||
static const bool kPerson = false;
|
||||
|
||||
// These following static constants should be included in CFG when it's written.
|
||||
static const int16 kWalk = 3;
|
||||
static const int16 kRun = 5;
|
||||
static const char kSpludwicksOrder[3];
|
||||
|
||||
static const uint16 kNotes[12];
|
||||
|
@ -851,7 +851,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {
|
||||
|
||||
case kRoomLustiesRoom:
|
||||
_npcFacing = 1; // du Lustie.
|
||||
if (_animation->_sprites[0]->_id == 0) // Avvy in his normal clothes
|
||||
if (_animation->getAvvyClothes() == 0) // Avvy in his normal clothes
|
||||
_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks);
|
||||
else if (!_enteredLustiesRoomAsMonk) // already
|
||||
// Presumably, Avvy dressed as a monk.
|
||||
|
@ -124,6 +124,10 @@ enum ControlCharacter {
|
||||
static const int16 kScreenWidth = 640;
|
||||
static const int16 kScreenHeight = 200;
|
||||
|
||||
static const int16 kWalk = 3;
|
||||
static const int16 kRun = 5;
|
||||
|
||||
|
||||
} // End of namespace Avalanche
|
||||
|
||||
#endif // AVALANCHE_ENUMS_H
|
||||
|
@ -394,7 +394,7 @@ void GraphicManager::drawMenuItem(int x1, int y1, int x2, int y2) {
|
||||
}
|
||||
|
||||
void GraphicManager::drawSpeedBar(int speed) {
|
||||
if (speed == _vm->kRun) {
|
||||
if (speed == kRun) {
|
||||
_surface.drawLine(336, 199, 338, 199, kColorLightblue);
|
||||
_surface.drawLine(371, 199, 373, 199, kColorYellow);
|
||||
} else {
|
||||
|
@ -62,7 +62,9 @@ void HeadType::highlight() {
|
||||
_menu->_activeMenuItem._activeNum = _position;
|
||||
_menu->_menuActive = true;
|
||||
|
||||
_menu->_vm->_currentMouse = 177; // Force redraw of cursor.
|
||||
// Force reload and redraw of cursor.
|
||||
_menu->_vm->_currentMouse = 177;
|
||||
|
||||
}
|
||||
|
||||
bool HeadType::parseAltTrigger(char key) {
|
||||
@ -431,7 +433,7 @@ void Menu::setupMenuAction() {
|
||||
_activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor());
|
||||
_activeMenuItem.setupOption("Look around", 'L', "f8", true);
|
||||
_activeMenuItem.setupOption("Inventory", 'I', "Tab", true);
|
||||
if (_vm->_animation->_sprites[0]->_speedX == _vm->kWalk)
|
||||
if (_vm->_animation->_sprites[0]->_speedX == kWalk)
|
||||
_activeMenuItem.setupOption("Run fast", 'R', "^R", true);
|
||||
else
|
||||
_activeMenuItem.setupOption("Walk slowly", 'W', "^W", true);
|
||||
@ -596,10 +598,10 @@ void Menu::runMenuAction() {
|
||||
break;
|
||||
case 5: {
|
||||
AnimationType *avvy = _vm->_animation->_sprites[0];
|
||||
if (avvy->_speedX == _vm->kWalk)
|
||||
avvy->_speedX = _vm->kRun;
|
||||
if (avvy->_speedX == kWalk)
|
||||
avvy->_speedX = kRun;
|
||||
else
|
||||
avvy->_speedX = _vm->kWalk;
|
||||
avvy->_speedX = kWalk;
|
||||
_vm->_animation->updateSpeed();
|
||||
}
|
||||
break;
|
||||
|
@ -1926,15 +1926,8 @@ void Parser::doThat() {
|
||||
i = 3;
|
||||
else
|
||||
i = 0;
|
||||
Avalanche::AnimationType *spr = _vm->_animation->_sprites[0];
|
||||
if (spr->_id != i) {
|
||||
int16 x = spr->_x;
|
||||
int16 y = spr->_y;
|
||||
spr->remove();
|
||||
spr->init(i, true);
|
||||
spr->appear(x, y, kDirLeft);
|
||||
spr->_visible = false;
|
||||
}
|
||||
|
||||
_vm->_animation->setAvvyClothes(i);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user