mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-01 15:09:47 +00:00
PRINCE: freeHeroAnim(), O_SETHEROANIM()
This commit is contained in:
parent
8b9d3bedf2
commit
2749f97dd9
@ -37,7 +37,7 @@ Hero::Hero(PrinceEngine *vm, GraphicsMan *graph) : _vm(vm), _graph(graph)
|
|||||||
, _number(0), _visible(false), _state(MOVE), _middleX(0), _middleY(0)
|
, _number(0), _visible(false), _state(MOVE), _middleX(0), _middleY(0)
|
||||||
, _boreNum(1), _currHeight(0), _moveDelay(0), _shadMinus(0), _moveSetType(0)
|
, _boreNum(1), _currHeight(0), _moveDelay(0), _shadMinus(0), _moveSetType(0)
|
||||||
, _lastDirection(kHeroDirDown), _destDirection(kHeroDirDown), _talkTime(0), _boredomTime(0), _phase(0)
|
, _lastDirection(kHeroDirDown), _destDirection(kHeroDirDown), _talkTime(0), _boredomTime(0), _phase(0)
|
||||||
, _specAnim(0), _drawX(0), _drawY(0), _drawZ(0), _zoomFactor(0), _scaleValue(0)
|
, _specAnim(nullptr), _drawX(0), _drawY(0), _drawZ(0), _zoomFactor(0), _scaleValue(0)
|
||||||
, _shadZoomFactor(0), _shadScaleValue(0), _shadLineLen(0), _shadDrawX(0), _shadDrawY(0)
|
, _shadZoomFactor(0), _shadScaleValue(0), _shadLineLen(0), _shadDrawX(0), _shadDrawY(0)
|
||||||
, _frameXSize(0), _frameYSize(0), _scaledFrameXSize(0), _scaledFrameYSize(0), _color(0)
|
, _frameXSize(0), _frameYSize(0), _scaledFrameXSize(0), _scaledFrameYSize(0), _color(0)
|
||||||
, _coords(nullptr), _dirTab(nullptr), _currCoords(nullptr), _currDirTab(nullptr), _step(0)
|
, _coords(nullptr), _dirTab(nullptr), _currCoords(nullptr), _currDirTab(nullptr), _step(0)
|
||||||
@ -52,6 +52,7 @@ Hero::~Hero() {
|
|||||||
free(_zoomBitmap);
|
free(_zoomBitmap);
|
||||||
free(_shadowBitmap);
|
free(_shadowBitmap);
|
||||||
delete[] _shadowLine;
|
delete[] _shadowLine;
|
||||||
|
freeHeroAnim();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Hero::loadAnimSet(uint32 animSetNr) {
|
bool Hero::loadAnimSet(uint32 animSetNr) {
|
||||||
@ -971,9 +972,11 @@ void Hero::freeOldMove() {
|
|||||||
_state = Hero::STAY;
|
_state = Hero::STAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
|
||||||
void Hero::freeHeroAnim() {
|
void Hero::freeHeroAnim() {
|
||||||
|
if (_specAnim != nullptr) {
|
||||||
|
delete _specAnim;
|
||||||
|
_specAnim = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ public:
|
|||||||
int16 _boredomTime; // Boredom current boredom time in frames
|
int16 _boredomTime; // Boredom current boredom time in frames
|
||||||
uint16 _boreNum; // Bore anim frame
|
uint16 _boreNum; // Bore anim frame
|
||||||
int16 _talkTime; // TalkTime time of talk anim
|
int16 _talkTime; // TalkTime time of talk anim
|
||||||
int32 _specAnim; // SpecAnim additional anim
|
Animation *_specAnim; // additional anim
|
||||||
|
|
||||||
uint16 _currHeight; // height of current anim phase
|
uint16 _currHeight; // height of current anim phase
|
||||||
|
|
||||||
|
@ -181,6 +181,10 @@ int32 Script::getOptionStandardOffset(int option) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8 *Script::getHeroAnimName(int offset) {
|
||||||
|
return &_data[offset];
|
||||||
|
}
|
||||||
|
|
||||||
void Script::setBackAnimId(int offset, int animId) {
|
void Script::setBackAnimId(int offset, int animId) {
|
||||||
WRITE_UINT32(&_data[offset], animId);
|
WRITE_UINT32(&_data[offset], animId);
|
||||||
}
|
}
|
||||||
@ -1167,8 +1171,30 @@ void Interpreter::O_WAITTEXT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Interpreter::O_SETHEROANIM() {
|
void Interpreter::O_SETHEROANIM() {
|
||||||
uint16 hero = readScriptFlagValue();
|
uint16 heroId = readScriptFlagValue();
|
||||||
int32 offset = readScript<uint32>();
|
int32 offset = readScript<uint32>();
|
||||||
|
Hero *hero = nullptr;
|
||||||
|
if (!heroId) {
|
||||||
|
hero = _vm->_mainHero;
|
||||||
|
} else {
|
||||||
|
hero = _vm->_secondHero;
|
||||||
|
}
|
||||||
|
if (hero != nullptr) {
|
||||||
|
hero->freeHeroAnim();
|
||||||
|
if (hero ->_specAnim == nullptr) {
|
||||||
|
hero->_specAnim = new Animation();
|
||||||
|
if (offset < 100) {
|
||||||
|
const Common::String animName = Common::String::format("AN%02d", offset);
|
||||||
|
Resource::loadResource(hero->_specAnim, animName.c_str(), true);
|
||||||
|
} else {
|
||||||
|
const Common::String animName = Common::String((const char *)_script->getHeroAnimName(offset));
|
||||||
|
Common::String normalizedPath = lastPathComponent(animName, '\\');
|
||||||
|
Resource::loadResource(hero->_specAnim, normalizedPath.c_str(), true);
|
||||||
|
}
|
||||||
|
hero->_phase = 0;
|
||||||
|
hero->_state = Hero::SPEC;
|
||||||
|
}
|
||||||
|
}
|
||||||
debugInterpreter("O_SETHEROANIM hero %d, offset %d", hero, offset);
|
debugInterpreter("O_SETHEROANIM hero %d, offset %d", hero, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ public:
|
|||||||
int32 getShadowScale(int locationNr);
|
int32 getShadowScale(int locationNr);
|
||||||
uint8 *getRoomOffset(int locationNr);
|
uint8 *getRoomOffset(int locationNr);
|
||||||
int32 getOptionStandardOffset(int option);
|
int32 getOptionStandardOffset(int option);
|
||||||
|
uint8 *getHeroAnimName(int offset);
|
||||||
void setBackAnimId(int offset, int animId);
|
void setBackAnimId(int offset, int animId);
|
||||||
void setObjId(int offset, int objId);
|
void setObjId(int offset, int objId);
|
||||||
void installBackAnims(Common::Array<BackgroundAnim> &backAnimList, int offset);
|
void installBackAnims(Common::Array<BackgroundAnim> &backAnimList, int offset);
|
||||||
|
Loading…
Reference in New Issue
Block a user