mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 23:43:34 +00:00
DRAGONS: work on cursor type changes
This commit is contained in:
parent
c1307c375f
commit
65700ca2a6
@ -24,6 +24,7 @@
|
||||
#include "dragons.h"
|
||||
#include "dragonini.h"
|
||||
#include "inventory.h"
|
||||
#include "scene.h"
|
||||
|
||||
namespace Dragons {
|
||||
|
||||
@ -45,6 +46,7 @@ void Cursor::init(ActorManager *actorManager, DragonINIResource *dragonINIResour
|
||||
|
||||
dragonINIResource->getFlickerRecord()->actor = _actor; //TODO is this correct?
|
||||
dragonINIResource->getFlickerRecord()->field_1a_flags_maybe |= Dragons::INI_FLAG_1;
|
||||
_iniUnderCursor = 0;
|
||||
}
|
||||
|
||||
void Cursor::update() {
|
||||
@ -58,8 +60,8 @@ void Cursor::update() {
|
||||
_sequenceID = 1;
|
||||
}
|
||||
|
||||
_actor->x_pos = _x;
|
||||
_actor->y_pos = _y;
|
||||
_actor->x_pos = _x + _vm->_scene->_camera.x;
|
||||
_actor->y_pos = _y + _vm->_scene->_camera.y;
|
||||
|
||||
// 0x80028104
|
||||
}
|
||||
@ -77,4 +79,37 @@ void Cursor::updatePosition(int16 x, int16 y) {
|
||||
_y = y;
|
||||
}
|
||||
|
||||
int16 Cursor::updateINIUnderCursor() {
|
||||
if (_vm->isFlagSet(Dragons::ENGINE_FLAG_10)) {
|
||||
int16 xOffset = 0;
|
||||
if (_vm->_inventory->getSequenceId() == 0 || _vm->_inventory->getSequenceId() == 2) {
|
||||
if (_vm->_inventory->getPositionIndex() == 1 || _vm->_inventory->getPositionIndex() == 3) {
|
||||
xOffset = 0x32;
|
||||
}
|
||||
}
|
||||
Common::Point inventoryPosition = _vm->_inventory->getPosition();
|
||||
if (_x >= inventoryPosition.x + 0xa + xOffset
|
||||
&& _x < inventoryPosition.x + 0x35 + xOffset
|
||||
&& _y >= inventoryPosition.y + 0xa
|
||||
&& _y < inventoryPosition.y + 0x25) {
|
||||
_iniUnderCursor = 0x8001;
|
||||
return _iniUnderCursor;
|
||||
}
|
||||
|
||||
if (_x >= inventoryPosition.x + 0x36
|
||||
&& _x < inventoryPosition.x + 0x5f
|
||||
&& _y >= inventoryPosition.y + 0xa
|
||||
&& _y < inventoryPosition.y + 0x25
|
||||
&& _vm->_inventory->getPositionIndex() != 0
|
||||
&& _vm->_inventory->getPositionIndex() != 2) {
|
||||
_iniUnderCursor = 0x8002;
|
||||
return _iniUnderCursor;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 0x80028940
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // End of namespace Dragons
|
||||
|
@ -38,6 +38,7 @@ private:
|
||||
int16 _y;
|
||||
Actor *_actor;
|
||||
int32 _sequenceID;
|
||||
uint16 _iniUnderCursor;
|
||||
|
||||
public:
|
||||
Cursor(DragonsEngine *vm);
|
||||
@ -45,6 +46,7 @@ public:
|
||||
void update();
|
||||
void updateVisibility();
|
||||
void updatePosition(int16 x, int16 y);
|
||||
int16 updateINIUnderCursor();
|
||||
};
|
||||
|
||||
} // End of namespace Dragons
|
||||
|
@ -174,10 +174,20 @@ void DragonsEngine::gameLoop() {
|
||||
if (flickerIni->sceneId == getCurrentSceneId()) {
|
||||
uint16 id = getIniFromImg();
|
||||
if (id != 0) {
|
||||
error("todo 0x80026cb0 run script");
|
||||
// 0x80026cac
|
||||
error("todo 0x80026cac run script");
|
||||
} else {
|
||||
// 0x80026d34
|
||||
// $s4_1 = 0;
|
||||
}
|
||||
} else {
|
||||
// 0x80026d34
|
||||
// $s4_1 = 0;
|
||||
}
|
||||
|
||||
// 0x80026d38
|
||||
_cursor->updateINIUnderCursor();
|
||||
|
||||
runINIScripts();
|
||||
|
||||
_scene->draw();
|
||||
@ -462,9 +472,11 @@ void DragonsEngine::engineFlag0x20UpdateFunction() {
|
||||
if ((_flags & (Dragons::ENGINE_FLAG_80000000 | Dragons::ENGINE_FLAG_8)) == 8) {
|
||||
_cursor->update();
|
||||
}
|
||||
//TODO
|
||||
//TODO 0x80027be4
|
||||
|
||||
uint16 currentSceneId = _scene->getSceneId();
|
||||
|
||||
// 0x80027db8
|
||||
if (!_inventory->isVisible()) {
|
||||
for (uint16 i = 0; i < _dragonINIResource->totalRecords(); i++) {
|
||||
DragonINI *ini = getINI(i);
|
||||
@ -476,6 +488,10 @@ void DragonsEngine::engineFlag0x20UpdateFunction() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (run_func_ptr_unk_countdown_timer != 0) {
|
||||
run_func_ptr_unk_countdown_timer--;
|
||||
}
|
||||
} else {
|
||||
run_func_ptr_unk_countdown_timer = 1;
|
||||
}
|
||||
|
@ -78,4 +78,8 @@ void Inventory::updateVisibility() {
|
||||
_actor->priorityLayer = _vm->isFlagSet(Dragons::ENGINE_FLAG_10) ? (int16)6 : (int16)0;
|
||||
}
|
||||
|
||||
Common::Point Inventory::getPosition() {
|
||||
return positionTable[_screenPositionIndex];
|
||||
}
|
||||
|
||||
} // End of namespace Dragons
|
@ -49,6 +49,8 @@ public:
|
||||
}
|
||||
|
||||
int16 getType() { return _type; }
|
||||
int16 getPositionIndex() { return _screenPositionIndex; }
|
||||
Common::Point getPosition();
|
||||
|
||||
bool isVisible() {
|
||||
return _type != 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user