mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
ACCESS: Beginnings of animation manager
This commit is contained in:
parent
3fb6c99017
commit
1171400ccb
@ -31,6 +31,7 @@ namespace Access {
|
||||
|
||||
AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) :
|
||||
_gameDescription(gameDesc), Engine(syst), _randomSource("Access") {
|
||||
_animation = nullptr;
|
||||
_debugger = nullptr;
|
||||
_events = nullptr;
|
||||
_files = nullptr;
|
||||
@ -53,7 +54,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
|
||||
_inactive = nullptr;
|
||||
_manPal1 = nullptr;
|
||||
_music = nullptr;
|
||||
_anim = nullptr;
|
||||
_title = nullptr;
|
||||
_converseMode = 0;
|
||||
_startInvItem = 0;
|
||||
@ -122,6 +122,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
|
||||
}
|
||||
|
||||
AccessEngine::~AccessEngine() {
|
||||
delete _animation;
|
||||
delete _debugger;
|
||||
delete _events;
|
||||
delete _files;
|
||||
@ -140,7 +141,6 @@ AccessEngine::~AccessEngine() {
|
||||
delete[] _inactive;
|
||||
delete[] _manPal1;
|
||||
delete[] _music;
|
||||
delete[] _anim;
|
||||
delete[] _title;
|
||||
}
|
||||
|
||||
@ -166,6 +166,7 @@ void AccessEngine::initialize() {
|
||||
}
|
||||
|
||||
// Create sub-objects of the engine
|
||||
_animation = new AnimationManager(this);
|
||||
_debugger = new Debugger(this);
|
||||
_events = new EventsManager(this);
|
||||
_files = new FileManager(this);
|
||||
@ -224,11 +225,6 @@ void AccessEngine::freeCells() {
|
||||
}
|
||||
}
|
||||
|
||||
void AccessEngine::freeAnimationData() {
|
||||
delete[] _anim;
|
||||
_anim = nullptr;
|
||||
}
|
||||
|
||||
void AccessEngine::freeInactiveData() {
|
||||
delete[] _inactive;
|
||||
_inactive = nullptr;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "common/util.h"
|
||||
#include "engines/engine.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "access\/animation.h"
|
||||
#include "access/data.h"
|
||||
#include "access/debugger.h"
|
||||
#include "access/events.h"
|
||||
@ -100,6 +101,7 @@ protected:
|
||||
*/
|
||||
virtual void playGame() = 0;
|
||||
public:
|
||||
AnimationManager *_animation;
|
||||
Debugger *_debugger;
|
||||
EventsManager *_events;
|
||||
FileManager *_files;
|
||||
@ -135,7 +137,6 @@ public:
|
||||
byte *_inactive;
|
||||
byte *_manPal1;
|
||||
byte *_music;
|
||||
byte *_anim;
|
||||
byte *_title;
|
||||
int _converseMode;
|
||||
int _startInvItem;
|
||||
@ -209,8 +210,6 @@ public:
|
||||
|
||||
int getRandomNumber(int maxNumber);
|
||||
|
||||
void freeAnimationData();
|
||||
|
||||
void loadCells(Common::Array<RoomInfo::CellIdent> &cells);
|
||||
|
||||
/**
|
||||
|
79
engines/access/animation.cpp
Normal file
79
engines/access/animation.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
/* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/endian.h"
|
||||
#include "access/animation.h"
|
||||
|
||||
namespace Access {
|
||||
|
||||
AnimationManager::AnimationManager(AccessEngine *vm) : Manager(vm) {
|
||||
_anim = nullptr;
|
||||
_animation = nullptr;
|
||||
}
|
||||
|
||||
AnimationManager::~AnimationManager() {
|
||||
delete[] _anim;
|
||||
delete _animation;
|
||||
}
|
||||
|
||||
void AnimationManager::freeAnimationData() {
|
||||
delete[] _anim;
|
||||
_anim = nullptr;
|
||||
_animation = nullptr;
|
||||
}
|
||||
|
||||
void AnimationManager::clearTimers() {
|
||||
for (uint i = 0; i < _animationTimers.size(); ++i)
|
||||
delete _animationTimers[i];
|
||||
|
||||
_animationTimers.clear();
|
||||
}
|
||||
|
||||
Animation *AnimationManager::setAnimation(int animId) {
|
||||
Animation *anim = findAnimation(animId);
|
||||
|
||||
anim->_countdownTicks = anim->_ticks;
|
||||
anim->_frameNumber = 0;
|
||||
|
||||
anim->_currentLoopCount = (anim->_type != 3 && anim->_type != 4) ? 0 :
|
||||
anim->_loopCount;
|
||||
anim->_field10 = 0;
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
void AnimationManager::setAnimTimer(Animation *anim) {
|
||||
|
||||
}
|
||||
|
||||
Animation *AnimationManager::findAnimation(int animId) {
|
||||
_animation = new Animation(_anim + READ_LE_UINT16(_anim + animId * 4 + 2));
|
||||
return _animation;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
Animation::Animation(const byte *data) {
|
||||
|
||||
}
|
||||
|
||||
} // End of namespace Access
|
68
engines/access/animation.h
Normal file
68
engines/access/animation.h
Normal file
@ -0,0 +1,68 @@
|
||||
/* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ACCESS_ANIMATION_H
|
||||
#define ACCESS_ANIMATION_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/array.h"
|
||||
#include "access/data.h"
|
||||
|
||||
namespace Access {
|
||||
|
||||
class Animation;
|
||||
|
||||
class AnimationManager : public Manager {
|
||||
private:
|
||||
Animation *findAnimation(int animId);
|
||||
public:
|
||||
const byte *_anim;
|
||||
Animation *_animation;
|
||||
Common::Array<Animation *> _animationTimers;
|
||||
public:
|
||||
AnimationManager(AccessEngine *vm);
|
||||
~AnimationManager();
|
||||
void freeAnimationData();
|
||||
void clearTimers();
|
||||
|
||||
Animation *setAnimation(int animId);
|
||||
|
||||
void setAnimTimer(Animation *anim);
|
||||
};
|
||||
|
||||
class Animation {
|
||||
public:
|
||||
int _type;
|
||||
int _scaling;
|
||||
int _frameNumber;
|
||||
int _ticks;
|
||||
int _loopCount;
|
||||
int _countdownTicks;
|
||||
int _currentLoopCount;
|
||||
int _field10;
|
||||
public:
|
||||
Animation(const byte *data);
|
||||
};
|
||||
|
||||
} // End of namespace Access
|
||||
|
||||
#endif /* ACCESS_ANIMATION_H */
|
@ -1,6 +1,7 @@
|
||||
MODULE := engines/access
|
||||
|
||||
MODULE_OBJS := \
|
||||
animation.o \
|
||||
asurface.o \
|
||||
access.o \
|
||||
data.o \
|
||||
|
@ -144,7 +144,7 @@ void Room::clearRoom() {
|
||||
_vm->_sound->freeSounds();
|
||||
_vm->_numAnimTimers = 0;
|
||||
|
||||
_vm->freeAnimationData();
|
||||
_vm->_animation->freeAnimationData();
|
||||
_vm->_scripts->freeScriptData();
|
||||
_vm->freeCells();
|
||||
freePlayField();
|
||||
@ -198,9 +198,9 @@ void Room::loadRoomData(const byte *roomData) {
|
||||
roomInfo._scriptFile._subfile);
|
||||
|
||||
// Load animation data
|
||||
_vm->freeAnimationData();
|
||||
_vm->_animation->freeAnimationData();
|
||||
if (roomInfo._animFile._fileNum != -1)
|
||||
_vm->_anim = _vm->_files->loadFile(roomInfo._animFile._fileNum,
|
||||
_vm->_animation->_anim = _vm->_files->loadFile(roomInfo._animFile._fileNum,
|
||||
roomInfo._animFile._subfile);
|
||||
|
||||
_vm->_scaleI = roomInfo._scaleI;
|
||||
@ -312,6 +312,10 @@ void Room::buildColumn(int playX, int screenX) {
|
||||
}
|
||||
}
|
||||
|
||||
void Room::init4Quads() {
|
||||
error("TODO: init4Quads");
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
RoomInfo::RoomInfo(const byte *data) {
|
||||
|
@ -101,6 +101,8 @@ public:
|
||||
void clearRoom();
|
||||
|
||||
void buildColumn(int playX, int screenX);
|
||||
|
||||
void init4Quads();
|
||||
};
|
||||
|
||||
|
||||
|
@ -35,6 +35,7 @@ namespace Access {
|
||||
Screen::Screen(AccessEngine *vm) : _vm(vm) {
|
||||
create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
|
||||
Common::fill(&_tempPalette[0], &_tempPalette[PALETTE_SIZE], 0);
|
||||
_vesaMode = 0;
|
||||
_vesaCurrentWin = 0;
|
||||
_currentPanel = 0;
|
||||
_hideFlag = true;
|
||||
|
@ -54,6 +54,7 @@ private:
|
||||
|
||||
bool clip(Common::Rect &r);
|
||||
public:
|
||||
int _vesaMode;
|
||||
bool _loadPalFlag;
|
||||
bool _scrollFlag;
|
||||
int _scrollThreshold;
|
||||
|
@ -87,7 +87,7 @@ void Scripts::executeCommand(int commandIndex, const byte *&pScript) {
|
||||
&Scripts::CMDSETTEX, &Scripts::CMDNEWROOM, &Scripts::CMDCONVERSE,
|
||||
&Scripts::CMDCHECKFRAME, &Scripts::CMDCHECKANIM, &Scripts::CMDSND,
|
||||
&Scripts::CMDRETNEG, &Scripts::cmdRetPos, &Scripts::cmdCheckLoc,
|
||||
&Scripts::CMDSETANIM, &Scripts::CMDDISPINV, &Scripts::CMDSETTIMER,
|
||||
&Scripts::cmdSetAnim, &Scripts::CMDDISPINV, &Scripts::CMDSETTIMER,
|
||||
&Scripts::CMDSETTIMER, &Scripts::CMDCHECKTIMER, &Scripts::CMDSETTRAVEL,
|
||||
&Scripts::CMDSETTRAVEL, &Scripts::CMDSETVID, &Scripts::CMDPLAYVID,
|
||||
&Scripts::CMDPLOTIMAGE, &Scripts::CMDSETDISPLAY, &Scripts::CMDSETBUFFER,
|
||||
@ -104,7 +104,7 @@ void Scripts::executeCommand(int commandIndex, const byte *&pScript) {
|
||||
&Scripts::cmdPlayerOn, &Scripts::CMDDEAD, &Scripts::CMDFADEOUT,
|
||||
&Scripts::CMDENDVID, &Scripts::CMDHELP, &Scripts::CMDCYCLEBACK,
|
||||
&Scripts::CMDCHAPTER, &Scripts::CMDSETHELP, &Scripts::CMDCENTERPANEL,
|
||||
&Scripts::CMDMAINPANEL, &Scripts::CMDRETFLASH
|
||||
&Scripts::cmdMainPanel, &Scripts::CMDRETFLASH
|
||||
};
|
||||
|
||||
(this->*COMMAND_LIST[commandIndex])(pScript);
|
||||
@ -217,7 +217,12 @@ void Scripts::cmdCheckLoc(const byte *&pScript) {
|
||||
pScript += 2;
|
||||
}
|
||||
|
||||
void Scripts::CMDSETANIM(const byte *&pScript) { }
|
||||
void Scripts::cmdSetAnim(const byte *&pScript) {
|
||||
int animId = *pScript++;
|
||||
Animation *anim = _vm->_animation->setAnimation(animId);
|
||||
_vm->_animation->setAnimTimer(anim);
|
||||
}
|
||||
|
||||
void Scripts::CMDDISPINV(const byte *&pScript) { }
|
||||
void Scripts::CMDSETTIMER(const byte *&pScript) { }
|
||||
void Scripts::CMDCHECKTIMER(const byte *&pScript) { }
|
||||
@ -266,7 +271,14 @@ void Scripts::CMDCYCLEBACK(const byte *&pScript) { }
|
||||
void Scripts::CMDCHAPTER(const byte *&pScript) { }
|
||||
void Scripts::CMDSETHELP(const byte *&pScript) { }
|
||||
void Scripts::CMDCENTERPANEL(const byte *&pScript) { }
|
||||
void Scripts::CMDMAINPANEL(const byte *&pScript) { }
|
||||
|
||||
void Scripts::cmdMainPanel(const byte *&pScript) {
|
||||
if (_vm->_screen->_vesaMode) {
|
||||
_vm->_room->init4Quads();
|
||||
_vm->_screen->setPanel(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Scripts::CMDRETFLASH(const byte *&pScript) { }
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ protected:
|
||||
void CMDSND(const byte *&pScript);
|
||||
void CMDRETNEG(const byte *&pScript);
|
||||
void cmdCheckLoc(const byte *&pScript);
|
||||
void CMDSETANIM(const byte *&pScript);
|
||||
void cmdSetAnim(const byte *&pScript);
|
||||
void CMDDISPINV(const byte *&pScript);
|
||||
void CMDSETTIMER(const byte *&pScript);
|
||||
void CMDCHECKTIMER(const byte *&pScript);
|
||||
@ -109,7 +109,7 @@ protected:
|
||||
void CMDCHAPTER(const byte *&pScript);
|
||||
void CMDSETHELP(const byte *&pScript);
|
||||
void CMDCENTERPANEL(const byte *&pScript);
|
||||
void CMDMAINPANEL(const byte *&pScript);
|
||||
void cmdMainPanel(const byte *&pScript);
|
||||
void CMDRETFLASH(const byte *&pScript);
|
||||
public:
|
||||
const byte *_script;
|
||||
|
Loading…
x
Reference in New Issue
Block a user