ASYLUM: Implement cursor animation
git-svn-id: http://asylumengine.googlecode.com/svn/trunk@635 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
parent
9b4c9572ea
commit
7877692768
9 changed files with 191 additions and 154 deletions
|
@ -167,7 +167,7 @@ void AsylumEngine::startGame(ResourcePackId sceneId, StartGameType type) {
|
||||||
error("[AsylumEngine::startGame] Subsystems not initialized properly!");
|
error("[AsylumEngine::startGame] Subsystems not initialized properly!");
|
||||||
|
|
||||||
// Load the default mouse cursor
|
// Load the default mouse cursor
|
||||||
_cursor->set(MAKE_RESOURCE(kResourcePackSound, 14));
|
_cursor->set(MAKE_RESOURCE(kResourcePackSound, 14), 0, kCursorAnimationNone);
|
||||||
_cursor->hide();
|
_cursor->hide();
|
||||||
|
|
||||||
// Clear the graphic list
|
// Clear the graphic list
|
||||||
|
@ -314,6 +314,9 @@ void AsylumEngine::handleEvents() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Animate cursor
|
||||||
|
_cursor->animate();
|
||||||
|
|
||||||
// Send update event to our event handler
|
// Send update event to our event handler
|
||||||
AsylumEvent updateEvt = AsylumEvent(EVENT_ASYLUM_UPDATE);
|
AsylumEvent updateEvt = AsylumEvent(EVENT_ASYLUM_UPDATE);
|
||||||
_handler->handleEvent(updateEvt);
|
_handler->handleEvent(updateEvt);
|
||||||
|
@ -373,6 +376,14 @@ void AsylumEngine::switchEventHandler(EventHandler *handler) {
|
||||||
_handler->handleEvent(init);
|
_handler->handleEvent(init);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AsylumEngine::notify(AsylumEventType type) {
|
||||||
|
if (_handler == NULL)
|
||||||
|
error("[AsylumEngine::notify] Invalid handler parameter (cannot be NULL)!");
|
||||||
|
|
||||||
|
AsylumEvent evt(type);
|
||||||
|
_handler->handleEvent(evt);
|
||||||
|
}
|
||||||
|
|
||||||
EventHandler *AsylumEngine::getPuzzle(uint32 index) {
|
EventHandler *AsylumEngine::getPuzzle(uint32 index) {
|
||||||
if (index >= ARRAYSIZE(_puzzles))
|
if (index >= ARRAYSIZE(_puzzles))
|
||||||
error("[AsylumEngine::getPuzzleEventHandler] Invalid index (was: %d - max: %d)", index, ARRAYSIZE(_puzzles));
|
error("[AsylumEngine::getPuzzleEventHandler] Invalid index (was: %d - max: %d)", index, ARRAYSIZE(_puzzles));
|
||||||
|
|
|
@ -168,6 +168,13 @@ public:
|
||||||
*/
|
*/
|
||||||
void switchEventHandler(EventHandler *handler);
|
void switchEventHandler(EventHandler *handler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the current event handler of an event
|
||||||
|
*
|
||||||
|
* @param type The event type.
|
||||||
|
*/
|
||||||
|
void notify(AsylumEventType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a message handler.
|
* Gets a message handler.
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,14 +32,15 @@
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
enum AsylumEventType {
|
enum AsylumEventType {
|
||||||
EVENT_ASYLUM_INIT = 0xFFF0,
|
EVENT_ASYLUM_MIDI = 953,
|
||||||
EVENT_ASYLUM_DEINIT = 0xFFF1,
|
EVENT_ASYLUM_CHANGECD = 5120,
|
||||||
EVENT_ASYLUM_UPDATE = 0xFFF2,
|
EVENT_ASYLUM_INIT = 5122,
|
||||||
EVENT_ASYLUM_MUSIC = 0xFFF3,
|
EVENT_ASYLUM_UPDATE = 5121,
|
||||||
EVENT_ASYLUM_MIDI = 0xFFF4,
|
EVENT_ASYLUM_DEINIT = 5123,
|
||||||
EVENT_ASYLUM_ACTIVATE = 0xFFF5,
|
EVENT_ASYLUM_CURSOR = 5124,
|
||||||
|
EVENT_ASYLUM_MUSIC = 5376,
|
||||||
|
|
||||||
EVENT_ASYLUM_CHANGECD = 0xFFFE
|
EVENT_ASYLUM_ACTIVATE = 0xFFF0
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AsylumEvent : public Common::Event {
|
struct AsylumEvent : public Common::Event {
|
||||||
|
|
|
@ -68,7 +68,7 @@ void BlowUpPuzzleVCR::open() {
|
||||||
getScreen()->draw(getWorld()->graphicResourceIds[0], 0, 0, 0, 0);
|
getScreen()->draw(getWorld()->graphicResourceIds[0], 0, 0, 0, 0);
|
||||||
|
|
||||||
// Set mouse cursor
|
// Set mouse cursor
|
||||||
_cursor->set(getWorld()->graphicResourceIds[28], 0, 2);
|
_cursor->set(getWorld()->graphicResourceIds[28]);
|
||||||
_cursor->show();
|
_cursor->show();
|
||||||
|
|
||||||
_leftClickUp = false;
|
_leftClickUp = false;
|
||||||
|
@ -422,13 +422,13 @@ void BlowUpPuzzleVCR::updateCursorInPolyRegion() {
|
||||||
|| (inPolyRegion(_cursor->position().x, _cursor->position().y, kBlackHole) && _holesState[kPluggedOnYellow])) {
|
|| (inPolyRegion(_cursor->position().x, _cursor->position().y, kBlackHole) && _holesState[kPluggedOnYellow])) {
|
||||||
if (_cursor->currentFrame != 2) { // reset cursor
|
if (_cursor->currentFrame != 2) { // reset cursor
|
||||||
_cursor->show();
|
_cursor->show();
|
||||||
_cursor->set(MAKE_RESOURCE(kResourcePackShared, 2), 0, 2);
|
_cursor->set(MAKE_RESOURCE(kResourcePackShared, 2));
|
||||||
_cursor->animate();
|
_cursor->animate();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_cursor->currentFrame != 0) { // reset cursor
|
if (_cursor->currentFrame != 0) { // reset cursor
|
||||||
_cursor->show();
|
_cursor->show();
|
||||||
_cursor->set(MAKE_RESOURCE(kResourcePackShared, 0), 0, 2);
|
_cursor->set(MAKE_RESOURCE(kResourcePackShared, 0));
|
||||||
_cursor->animate();
|
_cursor->animate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,7 @@ bool Encounter::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_data_455BD0 = 0;
|
_data_455BD0 = 0;
|
||||||
getCursor()->set(getWorld()->cursorResources[kCursorResourceTalkNPC], -1, 2);
|
getCursor()->set(getWorld()->cursorResources[kCursorResourceTalkNPC], -1, kCursorAnimationMirror);
|
||||||
|
|
||||||
if (!getSharedData()->getMatteBarHeight())
|
if (!getSharedData()->getMatteBarHeight())
|
||||||
initScript(_item->scriptResourceId);
|
initScript(_item->scriptResourceId);
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#include "asylum/system/graphics.h"
|
#include "asylum/system/graphics.h"
|
||||||
|
|
||||||
|
#include "asylum/asylum.h"
|
||||||
|
|
||||||
#include "common/events.h"
|
#include "common/events.h"
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
#include "graphics/cursorman.h"
|
#include "graphics/cursorman.h"
|
||||||
|
@ -36,8 +38,8 @@ namespace Asylum {
|
||||||
const uint32 CURSOR_UPDATE_TICKS = 100;
|
const uint32 CURSOR_UPDATE_TICKS = 100;
|
||||||
|
|
||||||
Cursor::Cursor(AsylumEngine *engine) : _vm(engine),
|
Cursor::Cursor(AsylumEngine *engine) : _vm(engine),
|
||||||
graphicResourceId(kResourceNone), currentFrame(0), frameCount(0), counter(0), flags(0),
|
graphicResourceId(kResourceNone), currentFrame(0), lastFrameIndex(0), counter(0), animation(kCursorAnimationNone),
|
||||||
_cursorRes(NULL), _cursorTicks(0), _cursor_byte_45756C(0), _state(0) {
|
_cursorRes(NULL), _nextTick(0), _frameStep(0), _state(0) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,18 +50,6 @@ Cursor::~Cursor() {
|
||||||
_vm = NULL;
|
_vm = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void Cursor::load(int32 index) {
|
|
||||||
if (cursorLoaded)
|
|
||||||
delete _cursorResource;
|
|
||||||
|
|
||||||
_cursorResource = new GraphicResource(_vm, index);
|
|
||||||
_cursorStep = 1;
|
|
||||||
_curFrame = 0;
|
|
||||||
cursorLoaded = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void Cursor::hide() const {
|
void Cursor::hide() const {
|
||||||
CursorMan.showMouse(false);
|
CursorMan.showMouse(false);
|
||||||
}
|
}
|
||||||
|
@ -68,33 +58,53 @@ void Cursor::show() const {
|
||||||
CursorMan.showMouse(true);
|
CursorMan.showMouse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cursor::set(ResourceId resourceId, int32 cntr, byte flgs, int32 frames) {
|
void Cursor::set(ResourceId resourceId, int32 counter, CursorAnimation animation, int32 frames) {
|
||||||
if (_cursorRes)
|
hide();
|
||||||
delete _cursorRes;
|
|
||||||
|
|
||||||
|
delete _cursorRes;
|
||||||
_cursorRes = new GraphicResource(_vm, resourceId);
|
_cursorRes = new GraphicResource(_vm, resourceId);
|
||||||
|
|
||||||
|
// Set next update
|
||||||
|
_nextTick = _vm->getTick() + 100;
|
||||||
|
|
||||||
|
// Get frame count
|
||||||
if (frames >= 0)
|
if (frames >= 0)
|
||||||
frameCount = frames;
|
lastFrameIndex = frames;
|
||||||
else
|
else
|
||||||
frameCount = _cursorRes->count();
|
lastFrameIndex = _cursorRes->count() - 1;
|
||||||
this->flags = flgs;
|
|
||||||
this->counter = cntr;
|
this->animation = animation;
|
||||||
|
this->counter = counter;
|
||||||
currentFrame = 0;
|
currentFrame = 0;
|
||||||
_cursor_byte_45756C = 1;
|
_frameStep = 1;
|
||||||
|
|
||||||
|
// Do not animate if no frames (and the other way around)
|
||||||
|
if (lastFrameIndex == 0 || animation == kCursorAnimationNone) {
|
||||||
|
lastFrameIndex = 0;
|
||||||
|
animation = kCursorAnimationNone;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastFrameIndex >= _cursorRes->count())
|
||||||
|
lastFrameIndex = _cursorRes->count() - 1;
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cursor::update() {
|
void Cursor::update() {
|
||||||
if (!_cursorRes)
|
if (!_cursorRes)
|
||||||
error("[Cursor::update] Cursor resources not initialized properly!");
|
error("[Cursor::update] Cursor resources not initialized properly!");
|
||||||
|
|
||||||
GraphicFrame *fra = _cursorRes->getFrame(currentFrame);
|
Common::Point hotspot = getHotspot(currentFrame);
|
||||||
CursorMan.replaceCursor((byte *)fra->surface.pixels,
|
|
||||||
fra->surface.w,
|
GraphicFrame *frame = _cursorRes->getFrame(currentFrame);
|
||||||
fra->surface.h,
|
CursorMan.replaceCursor((byte *)frame->surface.pixels,
|
||||||
0, 0, 0);
|
frame->surface.w,
|
||||||
|
frame->surface.h,
|
||||||
|
hotspot.x,
|
||||||
|
hotspot.y,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cursor::setState(const Common::Event &evt) {
|
void Cursor::setState(const Common::Event &evt) {
|
||||||
|
@ -128,73 +138,63 @@ void Cursor::setState(const Common::Event &evt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void Cursor::set(byte *data, byte width, byte height) {
|
|
||||||
CursorMan.replaceCursor(data, width, height, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Cursor::set(int32 frame) {
|
|
||||||
if (frame >= 0) {
|
|
||||||
GraphicFrame *mouseCursor = _cursorResource->getFrame(frame);
|
|
||||||
set((byte *)mouseCursor->surface.pixels, mouseCursor->surface.w, mouseCursor->surface.h);
|
|
||||||
_curFrame = frame;
|
|
||||||
} else {
|
|
||||||
_cursorStep = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void Cursor::animate() {
|
void Cursor::animate() {
|
||||||
/*
|
if (isHidden() || !animation || _nextTick > _vm->getTick())
|
||||||
_curFrame += _cursorStep;
|
return;
|
||||||
if (_curFrame == 0)
|
|
||||||
_cursorStep = 1;
|
|
||||||
if (_curFrame == _cursorResource->getFrameCount() - 1)
|
|
||||||
_cursorStep = -1;
|
|
||||||
|
|
||||||
set(_curFrame);
|
bool notifyHandler = false;
|
||||||
*/
|
int32 frame = 0;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
if (animation == kCursorAnimationLinear) {
|
||||||
void Cursor::update(WorldStats *ws, int32 currentAction) {
|
if (currentFrame == lastFrameIndex) {
|
||||||
uint32 newCursor = 0;
|
currentFrame = frame = 0;
|
||||||
|
} else {
|
||||||
|
currentFrame += _frameStep;
|
||||||
|
frame = currentFrame;
|
||||||
|
}
|
||||||
|
} else if (animation == kCursorAnimationMirror) {
|
||||||
|
currentFrame += _frameStep;
|
||||||
|
frame = currentFrame;
|
||||||
|
|
||||||
// Change cursor
|
if (currentFrame == 0 || currentFrame == lastFrameIndex)
|
||||||
switch (currentAction) {
|
_frameStep = -_frameStep;
|
||||||
case kWalkN:
|
|
||||||
newCursor = ws->curScrollUp;
|
|
||||||
break;
|
|
||||||
case kWalkNE:
|
|
||||||
newCursor = ws->curScrollUpRight;
|
|
||||||
break;
|
|
||||||
case kWalkNW:
|
|
||||||
newCursor = ws->curScrollUpLeft;
|
|
||||||
break;
|
|
||||||
case kWalkS:
|
|
||||||
newCursor = ws->curScrollDown;
|
|
||||||
break;
|
|
||||||
case kWalkSE:
|
|
||||||
newCursor = ws->curScrollDownRight;
|
|
||||||
break;
|
|
||||||
case kWalkSW:
|
|
||||||
newCursor = ws->curScrollDownLeft;
|
|
||||||
break;
|
|
||||||
case kWalkW:
|
|
||||||
newCursor = ws->curScrollLeft;
|
|
||||||
break;
|
|
||||||
case kWalkE:
|
|
||||||
newCursor = ws->curScrollRight;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME Added the newCursor > 0 check because cursors
|
if (frame == 0) {
|
||||||
// aren't working properly with the new actor code
|
if (counter != -1) {
|
||||||
if (_cursorResource->getEntryNum() != newCursor && newCursor > 0)
|
--counter;
|
||||||
load(newCursor);
|
|
||||||
|
if (!counter) {
|
||||||
|
animation = kCursorAnimationNone;
|
||||||
|
notifyHandler = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_nextTick = _vm->getTick() + 100;
|
||||||
|
|
||||||
|
if (notifyHandler)
|
||||||
|
_vm->notify(EVENT_ASYLUM_CURSOR);
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Common::Point Cursor::getHotspot(uint32 frameIndex) {
|
||||||
|
Common::Point point;
|
||||||
|
|
||||||
|
uint32 resFlags = _cursorRes->getData().flags;
|
||||||
|
|
||||||
|
if (BYTE1(resFlags) & 0x10) {
|
||||||
|
if (frameIndex >= 0 && frameIndex > _cursorRes->count()) {
|
||||||
|
GraphicFrame *frame = _cursorRes->getFrame(currentFrame);
|
||||||
|
|
||||||
|
point.x = frame->x;
|
||||||
|
point.y = frame->y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return point;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
bool Cursor::isHidden() const {
|
bool Cursor::isHidden() const {
|
||||||
return !CursorMan.isVisible();
|
return !CursorMan.isVisible();
|
||||||
|
|
|
@ -42,6 +42,12 @@ enum CursorState {
|
||||||
kCursorMiddle = 3
|
kCursorMiddle = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum CursorAnimation {
|
||||||
|
kCursorAnimationNone = 0,
|
||||||
|
kCursorAnimationLinear = 1,
|
||||||
|
kCursorAnimationMirror = 2
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asylum cursors are GraphicResources, and are stored in
|
* Asylum cursors are GraphicResources, and are stored in
|
||||||
* ResourcePacks, as are all game assets.
|
* ResourcePacks, as are all game assets.
|
||||||
|
@ -61,25 +67,23 @@ public:
|
||||||
*/
|
*/
|
||||||
void hide() const;
|
void hide() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query if the cursor is hidden.
|
||||||
|
*
|
||||||
|
* @return true if hidden, false if not.
|
||||||
|
*/
|
||||||
bool isHidden() const;
|
bool isHidden() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current cursor instance to the graphic resource provide.
|
* Set the current cursor instance to the graphic resource provide. The frames parameter defaults to -1, which in this case means that the frame count
|
||||||
* The frames parameter defaults to -1, which in this case means that the
|
* should be derived from the graphic resource as opposed to being explicitly set.
|
||||||
* frame count should be derived from the graphic resource as opposed to being
|
|
||||||
* explicitly set.
|
|
||||||
*/
|
|
||||||
void set(ResourceId resourceId, int32 cntr = 0, byte flgs = 0, int32 frames = -1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scene-based update to the current cursor. This
|
|
||||||
* checks whether the cursor should be updated depending
|
|
||||||
* on the MainActor's current action.
|
|
||||||
*
|
*
|
||||||
* TODO this probably doesn't belong here, but on the
|
* @param resourceId Identifier for the resource.
|
||||||
* scene, where it originally was
|
* @param counter The counter.
|
||||||
|
* @param animation The animation type
|
||||||
|
* @param frames The frames.
|
||||||
*/
|
*/
|
||||||
//void update(WorldStats *ws, int32 currentAction);
|
void set(ResourceId resourceId, int32 counter = 0, CursorAnimation animation = kCursorAnimationMirror, int32 frames = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next logical frame from the currently loaded
|
* Get the next logical frame from the currently loaded
|
||||||
|
@ -87,8 +91,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void animate();
|
void animate();
|
||||||
|
|
||||||
void update();
|
|
||||||
|
|
||||||
void setState(const Common::Event &evt);
|
void setState(const Common::Event &evt);
|
||||||
byte getState() { return _state; }
|
byte getState() { return _state; }
|
||||||
|
|
||||||
|
@ -97,18 +99,16 @@ public:
|
||||||
*/
|
*/
|
||||||
const Common::Point position() const;
|
const Common::Point position() const;
|
||||||
|
|
||||||
// NOTE
|
// NOTE: The original engine contains a function that assigns global variables to a
|
||||||
// .text:00435060 contains a function that assigns global variables to a
|
|
||||||
// struct associated with cursor graphics info. Since this functionality only
|
// struct associated with cursor graphics info. Since this functionality only
|
||||||
// ever seems to be used to reference cursor info, the struct members
|
// ever seems to be used to reference cursor info, the struct members
|
||||||
// may as well be class members in order to simplify the logic a bit
|
// may as well be class members in order to simplify the logic a bit
|
||||||
|
|
||||||
ResourceId graphicResourceId;
|
ResourceId graphicResourceId;
|
||||||
uint32 currentFrame; // assuming field_4c is the current frame pointer
|
uint32 currentFrame;
|
||||||
// since it's generally initialized to zero
|
uint32 lastFrameIndex;
|
||||||
int32 frameCount;
|
int32 counter;
|
||||||
int32 counter; // cursor counter
|
CursorAnimation animation;
|
||||||
byte flags;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AsylumEngine *_vm;
|
AsylumEngine *_vm;
|
||||||
|
@ -124,12 +124,30 @@ private:
|
||||||
/** the point of the cursor that triggers click hits */
|
/** the point of the cursor that triggers click hits */
|
||||||
Common::Point _hotspot;
|
Common::Point _hotspot;
|
||||||
|
|
||||||
// The number of millis between
|
// The number of milliseconds between cursor gfx updates
|
||||||
// cursor gfx updates
|
uint32 _nextTick;
|
||||||
uint32 _cursorTicks;
|
|
||||||
|
|
||||||
byte _cursor_byte_45756C;
|
int32 _frameStep;
|
||||||
}; // end of class Cursor
|
|
||||||
|
/**
|
||||||
|
* Updates the cursor
|
||||||
|
*/
|
||||||
|
void update();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the cursor current frame.
|
||||||
|
*/
|
||||||
|
void updateFrame();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the hotspot for a specific frame.
|
||||||
|
*
|
||||||
|
* @param frameIndex Zero-based index of the frame.
|
||||||
|
*
|
||||||
|
* @return The hotspot.
|
||||||
|
*/
|
||||||
|
Common::Point getHotspot(uint32 frameIndex);
|
||||||
|
};
|
||||||
|
|
||||||
} // end of namespace Asylum
|
} // end of namespace Asylum
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ void MainMenu::setup() {
|
||||||
|
|
||||||
void MainMenu::leave() {
|
void MainMenu::leave() {
|
||||||
_activeScreen = kMenuNone;
|
_activeScreen = kMenuNone;
|
||||||
getCursor()->set(MAKE_RESOURCE(kResourcePackShared, 2), 0, 2);
|
getCursor()->set(MAKE_RESOURCE(kResourcePackShared, 2));
|
||||||
getText()->loadFont(kFontYellow);
|
getText()->loadFont(kFontYellow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ bool MainMenu::init() {
|
||||||
// TODO: save dialog key codes into sntrm_k.txt (need to figure out why they use such thing) (address 00411CD0)
|
// TODO: save dialog key codes into sntrm_k.txt (need to figure out why they use such thing) (address 00411CD0)
|
||||||
|
|
||||||
if (_needEyeCursorInit) {
|
if (_needEyeCursorInit) {
|
||||||
getCursor()->set(MAKE_RESOURCE(kResourcePackShared, 3), 0, 2);
|
getCursor()->set(MAKE_RESOURCE(kResourcePackShared, 3));
|
||||||
} else {
|
} else {
|
||||||
// Init the game if not already done
|
// Init the game if not already done
|
||||||
if (!_initGame) {
|
if (!_initGame) {
|
||||||
|
@ -374,7 +374,7 @@ bool MainMenu::init() {
|
||||||
setupMusic();
|
setupMusic();
|
||||||
|
|
||||||
getCursor()->hide();
|
getCursor()->hide();
|
||||||
getCursor()->set(MAKE_RESOURCE(kResourcePackShared, 2), 0, 2);
|
getCursor()->set(MAKE_RESOURCE(kResourcePackShared, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_gameStarted)
|
if (_gameStarted)
|
||||||
|
@ -637,7 +637,7 @@ bool MainMenu::click(const AsylumEvent &evt) {
|
||||||
if (_activeScreen == kMenuNone)
|
if (_activeScreen == kMenuNone)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
getCursor()->set(MAKE_RESOURCE(kResourcePackShared, 3), 0, 2);
|
getCursor()->set(MAKE_RESOURCE(kResourcePackShared, 3));
|
||||||
getText()->loadFont(kFontYellow);
|
getText()->loadFont(kFontYellow);
|
||||||
|
|
||||||
switch (_activeScreen) {
|
switch (_activeScreen) {
|
||||||
|
|
|
@ -114,7 +114,7 @@ void Scene::enter(ResourcePackId packId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the cursor to magnifying glass
|
// Set the cursor to magnifying glass
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass]);
|
getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass], 0, kCursorAnimationNone);
|
||||||
getCursor()->show();
|
getCursor()->show();
|
||||||
|
|
||||||
// Clear the graphic queue
|
// Clear the graphic queue
|
||||||
|
@ -300,7 +300,7 @@ bool Scene::init() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceScrollUp]);
|
getCursor()->set(_ws->cursorResources[kCursorResourceScrollUp], 0, kCursorAnimationNone);
|
||||||
_ws->coordinates[0] = -1;
|
_ws->coordinates[0] = -1;
|
||||||
getScreen()->clear();
|
getScreen()->clear();
|
||||||
getText()->loadFont(_ws->font1);
|
getText()->loadFont(_ws->font1);
|
||||||
|
@ -958,7 +958,7 @@ void Scene::updateCursor(ActorDirection direction, Common::Rect rect) {
|
||||||
|
|
||||||
if (getEncounter()->getFlag6()) {
|
if (getEncounter()->getFlag6()) {
|
||||||
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceTalkNPC])
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceTalkNPC])
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -969,7 +969,7 @@ void Scene::updateCursor(ActorDirection direction, Common::Rect rect) {
|
||||||
ResourceId resourceId =_ws->cursorResources[direction];
|
ResourceId resourceId =_ws->cursorResources[direction];
|
||||||
|
|
||||||
if (direction >= kDirectionN && getCursor()->graphicResourceId != resourceId)
|
if (direction >= kDirectionN && getCursor()->graphicResourceId != resourceId)
|
||||||
getCursor()->set(resourceId, 0, 2);
|
getCursor()->set(resourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -977,7 +977,7 @@ void Scene::updateCursor(ActorDirection direction, Common::Rect rect) {
|
||||||
|
|
||||||
if (player->getStatus() == kActorStatus6 || player->getStatus() == kActorStatus10) {
|
if (player->getStatus() == kActorStatus6 || player->getStatus() == kActorStatus10) {
|
||||||
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceHand])
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceHand])
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceHand], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceHand]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -987,18 +987,18 @@ void Scene::updateCursor(ActorDirection direction, Common::Rect rect) {
|
||||||
|
|
||||||
ResourceId id = _ws->cursorResourcesAlternate[player->getField638() + 31];
|
ResourceId id = _ws->cursorResourcesAlternate[player->getField638() + 31];
|
||||||
if (getCursor()->graphicResourceId != id)
|
if (getCursor()->graphicResourceId != id)
|
||||||
getCursor()->set(id, 0, 0);
|
getCursor()->set(id, 0, kCursorAnimationNone);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (hitTestScene(type) == -1) {
|
if (hitTestScene(type) == -1) {
|
||||||
ResourceId id = _ws->cursorResourcesAlternate[player->getField638() + 31];
|
ResourceId id = _ws->cursorResourcesAlternate[player->getField638() + 31];
|
||||||
if (getCursor()->graphicResourceId != id)
|
if (getCursor()->graphicResourceId != id)
|
||||||
getCursor()->set(id, 0, 0);
|
getCursor()->set(id, 0, kCursorAnimationNone);
|
||||||
} else {
|
} else {
|
||||||
ResourceId id = _ws->cursorResourcesAlternate[player->getField638() + 47];
|
ResourceId id = _ws->cursorResourcesAlternate[player->getField638() + 47];
|
||||||
uint32 frameCount = GraphicResource::getFrameCount(_vm, id);
|
uint32 frameCount = GraphicResource::getFrameCount(_vm, id);
|
||||||
if (getCursor()->graphicResourceId != id)
|
if (getCursor()->graphicResourceId != id)
|
||||||
getCursor()->set(id, 0, ((frameCount <= 1) - 1) & 2);
|
getCursor()->set(id, 0, (CursorAnimation)(((frameCount <= 1) - 1) & 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1008,7 +1008,7 @@ void Scene::updateCursor(ActorDirection direction, Common::Rect rect) {
|
||||||
if (mouse.x >= rect.left && mouse.x <= rightLimit && mouse.y >= rect.top && mouse.y <= rect.bottom && hitTestPlayer()) {
|
if (mouse.x >= rect.left && mouse.x <= rightLimit && mouse.y >= rect.top && mouse.y <= rect.bottom && hitTestPlayer()) {
|
||||||
if (player->getReaction(0)) {
|
if (player->getReaction(0)) {
|
||||||
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceGrabPointer])
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceGrabPointer])
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceGrabPointer], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceGrabPointer]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1017,11 +1017,11 @@ void Scene::updateCursor(ActorDirection direction, Common::Rect rect) {
|
||||||
int32 index = hitTest(type);
|
int32 index = hitTest(type);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
if (_ws->chapter != kChapter2 || _playerIndex != 10) {
|
if (_ws->chapter != kChapter2 || _playerIndex != 10) {
|
||||||
if (getCursor()->flags || getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceMagnifyingGlass])
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceMagnifyingGlass] || getCursor()->animation)
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass]);
|
||||||
} else {
|
} else {
|
||||||
if (getCursor()->flags || getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceTalkNPC2])
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceTalkNPC2] || getCursor()->animation)
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC2], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1047,23 +1047,23 @@ void Scene::updateCursor(ActorDirection direction, Common::Rect rect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actionType & kActionTypeFind) {
|
if (actionType & kActionTypeFind) {
|
||||||
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceMagnifyingGlass] || getCursor()->flags != 2)
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceMagnifyingGlass] || getCursor()->animation != kCursorAnimationMirror)
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass]);
|
||||||
} else if (actionType & kActionTypeTalk) {
|
} else if (actionType & kActionTypeTalk) {
|
||||||
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceTalkNPC])
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceTalkNPC])
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC]);
|
||||||
} else if (actionType & kActionTypeGrab) {
|
} else if (actionType & kActionTypeGrab) {
|
||||||
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceHand])
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceHand])
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceHand], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceHand]);
|
||||||
} else if (actionType & kActionType16) {
|
} else if (actionType & kActionType16) {
|
||||||
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceTalkNPC2] || getCursor()->flags != 2)
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceTalkNPC2] || getCursor()->animation != kCursorAnimationMirror)
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC2], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC2]);
|
||||||
} else if (_ws->chapter != kChapter2 && _playerIndex != 10) {
|
} else if (_ws->chapter != kChapter2 && _playerIndex != 10) {
|
||||||
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceMagnifyingGlass] || getCursor()->flags)
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceMagnifyingGlass] || getCursor()->animation)
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass]);
|
||||||
} else {
|
} else {
|
||||||
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceTalkNPC2] || getCursor()->flags)
|
if (getCursor()->graphicResourceId != _ws->cursorResources[kCursorResourceTalkNPC2] || getCursor()->animation)
|
||||||
getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC2], 0, 2);
|
getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue