mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-20 16:59:06 +00:00
PRINCE: O_SETBACKANIMDATA(), O_GETBACKANIMDATA()
This commit is contained in:
parent
2b2170f88a
commit
6657a7d8cc
@ -137,6 +137,36 @@ struct Anim {
|
||||
int16 _relY;
|
||||
Animation *_animData;
|
||||
Animation *_shadowData;
|
||||
|
||||
enum AnimOffsets {
|
||||
kAnimState = 10,
|
||||
kAnimFrame = 14,
|
||||
kAnimLastFrame = 16,
|
||||
kAnimX = 26
|
||||
};
|
||||
|
||||
int16 getAnimData(Anim::AnimOffsets offset) {
|
||||
switch (offset) {
|
||||
case kAnimState:
|
||||
return _state;
|
||||
case kAnimFrame:
|
||||
return _frame;
|
||||
case kAnimLastFrame:
|
||||
return _lastFrame;
|
||||
case kAnimX:
|
||||
return _x;
|
||||
default:
|
||||
error("getAnimData() - Wrong offset type: %d", (int) offset);
|
||||
}
|
||||
}
|
||||
|
||||
void setAnimData(Anim::AnimOffsets offset, int16 value) {
|
||||
if (offset == kAnimX) {
|
||||
_x = value;
|
||||
} else {
|
||||
error("setAnimData() - Wrong offset: %d, value: %d", (int) offset, value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct BackgroundAnim {
|
||||
|
@ -1152,10 +1152,13 @@ void Interpreter::O_CHANGEBACKFRAMES() {
|
||||
}
|
||||
|
||||
void Interpreter::O_GETBACKANIMDATA() {
|
||||
uint16 flag = readScript<uint16>();
|
||||
uint16 anim = readScript<uint16>();
|
||||
uint16 animOffset = readScript<uint16>();
|
||||
debugInterpreter("O_GETBACKANIMDATA flag %d, anim %d, animOffset %d", flag, anim, animOffset);
|
||||
Flags::Id flagId = readScriptFlagId();
|
||||
uint16 animNumber = readScript<uint16>();
|
||||
uint16 animDataOffset = readScript<uint16>();
|
||||
int currAnim = _vm->_backAnimList[animNumber]._seq._currRelative;
|
||||
int16 value = _vm->_backAnimList[animNumber].backAnims[currAnim].getAnimData((Anim::AnimOffsets)(animDataOffset));
|
||||
_flags->setFlagValue((Flags::Id)(flagId), value);
|
||||
debugInterpreter("O_GETBACKANIMDATA flag %04X (%s), animNumber %d, animDataOffset %d, value %d", flagId, Flags::getFlagName(flagId), animNumber, animDataOffset, value);
|
||||
}
|
||||
|
||||
void Interpreter::O_GETANIMDATA() {
|
||||
@ -1557,11 +1560,13 @@ void Interpreter::O_RUNHERO() {
|
||||
}
|
||||
|
||||
void Interpreter::O_SETBACKANIMDATA() {
|
||||
uint16 animId = readScriptFlagValue();
|
||||
uint16 animOffset = readScriptFlagValue();
|
||||
uint16 wart = readScriptFlagValue();
|
||||
|
||||
debugInterpreter("O_SETBACKANIMDATA animId %d, animOffset %d, wart %d", animId, animOffset, wart);
|
||||
uint16 animNumber = readScript<uint16>();
|
||||
uint16 animDataOffset = readScript<uint16>();
|
||||
Flags::Id flagId = readScriptFlagId();
|
||||
uint16 value = _flags->getFlagValue((Flags::Id)(flagId));
|
||||
int currAnim = _vm->_backAnimList[animNumber]._seq._currRelative;
|
||||
_vm->_backAnimList[animNumber].backAnims[currAnim].setAnimData((Anim::AnimOffsets)(animDataOffset), value);
|
||||
debugInterpreter("O_SETBACKANIMDATA flag %04X (%s), animNumber %d, animDataOffset %d, value %d", flagId, Flags::getFlagName(flagId), animNumber, animDataOffset, value);
|
||||
}
|
||||
|
||||
void Interpreter::O_VIEWFLC() {
|
||||
|
Loading…
Reference in New Issue
Block a user