mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 01:46:42 +00:00
PRINCE: lightX, lightY and setShadowScale()
This commit is contained in:
parent
4bf4847cc3
commit
3751e7ba25
@ -34,6 +34,7 @@ Hero::Hero() : _number(0), _visible(false), _state(MOVE), _middleX(0), _middleY(
|
||||
, _boreNum(1), _currHeight(0), _moveDelay(0), _shadMinus(1), _moveSetType(0)
|
||||
, _lastDirection(DOWN), _destDirection(DOWN), _talkTime(0), _boredomTime(0), _phase(0)
|
||||
, _specAnim(0), _drawX(0), _drawY(0), _randomSource("prince"), _zoomFactor(0), _scaleValue(0)
|
||||
, _shadZoomFactor(0), _shadScaleValue(0)
|
||||
{
|
||||
_zoomBitmap = new Animation();
|
||||
_shadowBitmap = new Animation();
|
||||
@ -277,6 +278,19 @@ void Hero::selectZoom() {
|
||||
setScale(zoomBitmapValue);
|
||||
}
|
||||
|
||||
void Hero::setShadowScale(int32 shadowScale) {
|
||||
shadowScale = 100 - shadowScale;
|
||||
if (shadowScale == 0) {
|
||||
_shadZoomFactor = 0;
|
||||
_shadScaleValue = 10000;
|
||||
} else {
|
||||
_shadZoomFactor = shadowScale;
|
||||
_shadScaleValue = 10000 / _shadZoomFactor;
|
||||
}
|
||||
debug("_shadZoomFactor: %d", _shadZoomFactor);
|
||||
debug("_shadScaleValue: %d", _shadScaleValue);
|
||||
}
|
||||
|
||||
void Hero::specialAnim() {
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,7 @@ public:
|
||||
void checkNak();
|
||||
Graphics::Surface *zoomSprite(Graphics::Surface *heroFrame);
|
||||
void showHeroAnimFrame();
|
||||
void setShadowScale(int32 shadowScale);
|
||||
void specialAnim();
|
||||
void getState();
|
||||
|
||||
@ -124,6 +125,11 @@ public:
|
||||
int16 _moveSetType;
|
||||
int8 _zoomFactor;
|
||||
int16 _scaleValue;
|
||||
int16 _lightX; // for hero's shadow
|
||||
int16 _lightY;
|
||||
int32 _shadZoomFactor;
|
||||
int32 _shadScaleValue;
|
||||
|
||||
|
||||
// Coords array of coordinates
|
||||
// DirTab array of directions
|
||||
|
@ -288,6 +288,12 @@ bool PrinceEngine::loadLocation(uint16 locationNr) {
|
||||
Resource::loadResource(_mainHero->_shadowBitmap, "shadow2", false);
|
||||
}
|
||||
|
||||
_mainHero->_lightX = _script->getLightX(_locationNr);
|
||||
_mainHero->_lightY = _script->getLightY(_locationNr);
|
||||
debug("lightX: %d", _mainHero->_lightX);
|
||||
debug("lightY: %d", _mainHero->_lightX);
|
||||
_mainHero->setShadowScale(_script->getShadowScale(_locationNr));
|
||||
|
||||
_mobList.clear();
|
||||
Resource::loadResource(_mobList, "mob.lst", false);
|
||||
|
||||
|
@ -132,7 +132,7 @@ bool Script::loadFromStream(Common::SeekableReadStream &stream) {
|
||||
return false;
|
||||
|
||||
stream.read(_data, _dataSize);
|
||||
|
||||
|
||||
Common::MemoryReadStream scriptDataStream(_data, _dataSize);
|
||||
scriptDataStream.seek(getRoomTableOffset()+64);
|
||||
debug("room table offset %d", scriptDataStream.pos());
|
||||
|
@ -42,6 +42,7 @@ namespace Detail {
|
||||
template <> inline uint8 LittleEndianReader<uint8>(void *data) { return *(uint8*)(data); }
|
||||
template <> inline uint16 LittleEndianReader<uint16>(void *data) { return READ_LE_UINT16(data); }
|
||||
template <> inline uint32 LittleEndianReader<uint32>(void *data) { return READ_LE_UINT32(data); }
|
||||
template <> inline int8 LittleEndianReader<int8>(void *data) { return *(int8*)(data); }
|
||||
}
|
||||
|
||||
class Room {
|
||||
@ -89,6 +90,9 @@ public:
|
||||
// Some magic numbers for now, data stored in header
|
||||
uint32 getRoomTableOffset() { return read<uint32>(0); }
|
||||
uint32 getStartGameOffset() { return read<uint32>(4); }
|
||||
int8 getLightX(int locationNr) { return read<int8>(4*15 + locationNr*8); }
|
||||
int8 getLightY(int locationNr) { return read<int8>(4*15 + locationNr*8 + 2); }
|
||||
uint16 getShadowScale(int locationNr) { return read<uint16>(4*15 + locationNr*8 + 4); }
|
||||
|
||||
const char *getString(uint32 offset) {
|
||||
return (const char *)(&_data[offset]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user