2013-06-27 12:13:00 +02:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
|
|
|
|
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
|
|
|
|
*/
|
|
|
|
|
2013-09-07 19:09:06 +02:00
|
|
|
/* Original name TRIP5 / Trippancy V - the sprite animation subsystem */
|
2013-06-27 12:13:00 +02:00
|
|
|
|
2013-09-07 19:09:06 +02:00
|
|
|
#ifndef AVALANCHE_ANIMATION_H
|
|
|
|
#define AVALANCHE_ANIMATION_H
|
2013-06-27 12:13:00 +02:00
|
|
|
|
2013-07-24 17:02:08 +02:00
|
|
|
#include "avalanche/graphics.h"
|
2013-07-18 15:13:23 +02:00
|
|
|
|
2013-06-27 12:13:00 +02:00
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/str.h"
|
|
|
|
|
|
|
|
namespace Avalanche {
|
2013-06-29 10:13:02 +02:00
|
|
|
class AvalancheEngine;
|
|
|
|
|
2013-09-05 07:47:40 +02:00
|
|
|
struct adxtype { // Second revision of ADX type
|
2013-09-07 19:09:06 +02:00
|
|
|
// CHECKME: Useless?
|
|
|
|
Common::String _name; // name of character
|
|
|
|
Common::String _comment; // comment
|
|
|
|
//
|
|
|
|
byte _frameNum; // number of pictures
|
2013-09-05 07:47:40 +02:00
|
|
|
byte seq; // how many in one stride
|
2013-09-07 19:09:06 +02:00
|
|
|
byte _fgBubbleCol, _bgBubbleCol; // foreground & background bubble colors
|
2013-09-05 07:47:40 +02:00
|
|
|
byte accinum; // the number according to Acci (1=Avvy, etc.)
|
2013-06-29 10:13:02 +02:00
|
|
|
};
|
|
|
|
|
2013-09-07 23:42:34 +02:00
|
|
|
struct AnimationSaver {
|
|
|
|
byte _id;
|
|
|
|
byte _facingDir;
|
|
|
|
byte _stepNum;
|
|
|
|
int16 _x;
|
|
|
|
int16 _y;
|
|
|
|
int8 _moveX;
|
|
|
|
int8 _moveY;
|
|
|
|
bool _visible;
|
|
|
|
bool _homing;
|
|
|
|
bool _doCheck;
|
|
|
|
byte _count;
|
|
|
|
byte _xWidth, _speedX, _speedY;
|
|
|
|
byte _animCount;
|
|
|
|
int16 _homingX;
|
|
|
|
int16 _homingY;
|
|
|
|
bool _callEachStepFl;
|
|
|
|
byte _eachStepProc;
|
|
|
|
bool _vanishIfStill;
|
2013-06-29 10:13:02 +02:00
|
|
|
};
|
|
|
|
|
2013-09-07 19:09:06 +02:00
|
|
|
class Animation;
|
2013-06-29 10:13:02 +02:00
|
|
|
|
2013-09-07 19:09:06 +02:00
|
|
|
class AnimationType {
|
2013-06-29 10:13:02 +02:00
|
|
|
public:
|
2013-07-18 15:13:23 +02:00
|
|
|
SpriteInfo _info;
|
|
|
|
|
2013-09-07 19:09:06 +02:00
|
|
|
adxtype _stat; // vital statistics
|
2013-09-07 23:42:34 +02:00
|
|
|
byte _facingDir, _stepNum;
|
2013-09-07 19:09:06 +02:00
|
|
|
int16 _x, _y; // current xy coords
|
|
|
|
int16 _oldX[2], _oldY[2]; // last xy coords
|
2013-09-07 23:03:27 +02:00
|
|
|
int8 _moveX, _moveY; // amount to move sprite by, each step
|
|
|
|
byte _id;
|
2013-09-07 23:42:34 +02:00
|
|
|
bool _quick, _visible, _homing, _doCheck;
|
2013-09-07 21:38:25 +02:00
|
|
|
int16 _homingX, _homingY; // homing x & y coords
|
2013-09-07 23:42:34 +02:00
|
|
|
byte _count; // counts before changing step
|
2013-09-07 23:03:27 +02:00
|
|
|
byte _speedX, _speedY; // x & y speed
|
|
|
|
byte _animCount; // total number of sprites
|
2013-09-07 23:42:34 +02:00
|
|
|
bool _vanishIfStill; // Do we show this sprite if it's still?
|
2013-06-29 10:13:02 +02:00
|
|
|
|
2013-09-07 23:42:34 +02:00
|
|
|
bool _callEachStepFl; // Do we call the eachstep procedure?
|
|
|
|
byte _eachStepProc;
|
2013-06-29 10:13:02 +02:00
|
|
|
|
2013-09-07 23:42:34 +02:00
|
|
|
void init(byte spritenum, bool doCheck, Animation *tr);
|
2013-09-05 07:47:40 +02:00
|
|
|
// loads & sets up the sprite
|
|
|
|
void original(); // just sets Quick to false
|
|
|
|
void andexor(); // drops sprite onto screen
|
|
|
|
void turn(byte whichway); // turns him round
|
|
|
|
void appear(int16 wx, int16 wy, byte wf); // switches him on
|
|
|
|
void bounce(); // bounces off walls.
|
|
|
|
void walk(); // prepares for andexor, etc.
|
|
|
|
void walkto(byte pednum); // home in on a point
|
|
|
|
void stophoming(); // self-explanatory
|
|
|
|
void homestep(); // calculates ix & iy for one homing step
|
|
|
|
void speed(int8 xx, int8 yy); // sets ix & iy, non-homing, etc
|
2013-09-07 23:03:27 +02:00
|
|
|
void stopWalk(); // Stops the sprite from moving
|
2013-09-05 07:47:40 +02:00
|
|
|
void chatter(); // Sets up talk vars
|
2013-09-07 23:42:34 +02:00
|
|
|
void setupSaver(AnimationSaver &sav);
|
|
|
|
void unload_saver(AnimationSaver sav);
|
2013-06-29 10:13:02 +02:00
|
|
|
|
2013-09-05 07:47:40 +02:00
|
|
|
void savedata(Common::File &f); // Self-explanatory,
|
|
|
|
void loaddata(Common::File &f); // really.
|
2013-06-29 10:13:02 +02:00
|
|
|
|
|
|
|
void save_data_to_mem(uint16 &where);
|
|
|
|
void load_data_from_mem(uint16 &where);
|
2013-09-07 19:09:06 +02:00
|
|
|
AnimationType *done();
|
2013-06-29 10:13:02 +02:00
|
|
|
|
|
|
|
private:
|
2013-09-07 19:09:06 +02:00
|
|
|
Animation *_tr;
|
2013-06-29 10:13:02 +02:00
|
|
|
|
2013-09-07 20:02:14 +02:00
|
|
|
bool checkCollision();
|
2013-09-04 17:54:08 +02:00
|
|
|
int8 sgn(int16 val);
|
2013-06-29 10:13:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const int16 maxgetset = 35;
|
|
|
|
|
|
|
|
class getsettype {
|
|
|
|
public:
|
2013-09-06 16:23:57 +02:00
|
|
|
ByteField gs[maxgetset];
|
2013-06-29 10:13:02 +02:00
|
|
|
byte numleft;
|
|
|
|
|
|
|
|
getsettype *init();
|
2013-09-06 16:23:57 +02:00
|
|
|
void remember(ByteField r);
|
|
|
|
void recall(ByteField &r);
|
2013-06-29 10:13:02 +02:00
|
|
|
};
|
|
|
|
|
2013-09-07 19:09:06 +02:00
|
|
|
class Animation {
|
2013-06-29 10:13:02 +02:00
|
|
|
public:
|
2013-09-07 19:09:06 +02:00
|
|
|
friend class AnimationType;
|
2013-09-04 14:08:00 +02:00
|
|
|
friend class getsettype;
|
2013-06-27 12:13:00 +02:00
|
|
|
|
2013-09-07 23:42:34 +02:00
|
|
|
static const byte kDirUp = 0;
|
|
|
|
static const byte kDirRight = 1;
|
|
|
|
static const byte kDirDown = 2;
|
|
|
|
static const byte kDirLeft = 3;
|
|
|
|
static const byte kDirUpRight = 4;
|
|
|
|
static const byte kDirDownRight = 5;
|
|
|
|
static const byte kDirDownLeft = 6;
|
|
|
|
static const byte kDirUpLeft = 7;
|
|
|
|
static const byte kDirStopped = 8;
|
2013-09-07 09:14:14 +02:00
|
|
|
|
|
|
|
static const int16 kSpriteNumbMax = 5; // current max no. of sprites
|
2013-06-27 12:13:00 +02:00
|
|
|
|
2013-09-07 23:42:34 +02:00
|
|
|
static const byte kProcFollowAvvyY = 1;
|
|
|
|
static const byte kProcBackAndForth = 2;
|
|
|
|
static const byte kProcFaceAvvy = 3;
|
|
|
|
static const byte kProcArrow = 4;
|
|
|
|
static const byte kProcsPludwick = 5; // Unused
|
|
|
|
static const byte kProcGrabAvvy = 6;
|
|
|
|
static const byte kProcGeida = 7;
|
2013-06-27 12:13:00 +02:00
|
|
|
|
2013-09-07 19:09:06 +02:00
|
|
|
Animation(AvalancheEngine *vm);
|
|
|
|
~Animation();
|
2013-09-05 15:48:30 +02:00
|
|
|
|
2013-09-07 20:02:14 +02:00
|
|
|
void animLink();
|
2013-06-27 12:13:00 +02:00
|
|
|
void get_back_loretta();
|
|
|
|
void loadtrip();
|
|
|
|
void call_special(uint16 which);
|
2013-09-07 23:42:34 +02:00
|
|
|
void openDoor(byte whither, byte ped, byte magicnum); // Handles slidey-open doors.
|
2013-06-27 12:13:00 +02:00
|
|
|
void catamove(byte ped);
|
2013-09-07 23:03:27 +02:00
|
|
|
void stopWalking();
|
2013-06-27 12:13:00 +02:00
|
|
|
void tripkey(char dir);
|
2013-09-04 17:54:08 +02:00
|
|
|
void rwsp(byte t, byte dir);
|
2013-06-27 12:13:00 +02:00
|
|
|
void apped(byte trn, byte np);
|
|
|
|
void getback();
|
|
|
|
void fliproom(byte room, byte ped);
|
2013-08-23 16:58:22 +02:00
|
|
|
bool infield(byte which); // Returns true if you're within field "which".
|
|
|
|
bool neardoor(); // Returns True if you're near a door.
|
2013-06-27 12:13:00 +02:00
|
|
|
void readstick();
|
|
|
|
void newspeed();
|
|
|
|
void new_game_for_trippancy();
|
2013-06-29 10:13:02 +02:00
|
|
|
void take_a_step(byte &tripnum);
|
2013-07-24 13:11:24 +02:00
|
|
|
void handleMoveKey(const Common::Event &event); // To replace tripkey().
|
|
|
|
|
2013-09-07 19:09:06 +02:00
|
|
|
AnimationType tr[kSpriteNumbMax];
|
2013-06-27 12:13:00 +02:00
|
|
|
getsettype getset[2];
|
|
|
|
byte aa[1600];
|
|
|
|
|
|
|
|
bool mustexclaim;
|
|
|
|
uint16 saywhat;
|
|
|
|
|
2013-06-29 10:13:02 +02:00
|
|
|
private:
|
|
|
|
AvalancheEngine *_vm;
|
|
|
|
|
2013-09-07 01:26:28 +02:00
|
|
|
// CHECKME: Useless?
|
|
|
|
// ByteField r;
|
|
|
|
// int16 beforex, beforey;
|
2013-06-29 10:13:02 +02:00
|
|
|
|
|
|
|
byte checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl);
|
|
|
|
byte geida_ped(byte which);
|
|
|
|
void dawndelay();
|
2013-09-07 23:03:27 +02:00
|
|
|
void hideInCupboard();
|
2013-06-29 10:13:02 +02:00
|
|
|
void follow_avvy_y(byte tripnum);
|
|
|
|
void back_and_forth(byte tripnum);
|
|
|
|
void face_avvy(byte tripnum);
|
|
|
|
void arrow_procs(byte tripnum);
|
|
|
|
void grab_avvy(byte tripnum);
|
|
|
|
void spin(byte whichway, byte &tripnum);
|
|
|
|
void geida_procs(byte tripnum);
|
|
|
|
void call_andexors();
|
|
|
|
void getsetclear();
|
|
|
|
};
|
2013-06-27 12:13:00 +02:00
|
|
|
|
|
|
|
} // End of namespace Avalanche.
|
|
|
|
|
2013-09-07 19:09:06 +02:00
|
|
|
#endif // AVALANCHE_ANIMATION_H
|