ILLUSIONS: Replace spaces with tabs
Replace while(1) with do..while loop Removed dead code Renamed FP16 to FixedPoint16 to improve readability
This commit is contained in:
parent
d77dd6c14a
commit
3d9f5ed20f
18 changed files with 218 additions and 223 deletions
|
@ -771,9 +771,6 @@ PointArray *Control::createPath(Common::Point destPt) {
|
|||
PathFinder pathFinder;
|
||||
WidthHeight bgDimensions = _vm->_backgroundInstances->getMasterBgDimensions();
|
||||
PointArray *path = pathFinder.findPath(_vm->_camera, _actor->_position, destPt, walkPoints, walkRects, bgDimensions);
|
||||
for (uint i = 0; i < path->size(); ++i) {
|
||||
//debug(0, "Path(%d) (%d, %d)", i, (*path)[i].x, (*path)[i].y);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
|
@ -784,143 +781,140 @@ void Control::updateActorMovement(uint32 deltaTime) {
|
|||
static const int16 kAngleTbl[] = {60, 0, 120, 0, 60, 0, 120, 0};
|
||||
bool fastWalked = false;
|
||||
|
||||
while (1) {
|
||||
do {
|
||||
|
||||
if (!fastWalked && _vm->testMainActorFastWalk(this)) {
|
||||
fastWalked = true;
|
||||
disappearActor();
|
||||
_actor->_flags |= Illusions::ACTOR_FLAG_8000;
|
||||
_actor->_seqCodeIp = 0;
|
||||
deltaTime = 2;
|
||||
}
|
||||
|
||||
if (_vm->testMainActorCollision(this))
|
||||
break;
|
||||
|
||||
Common::Point prevPt;
|
||||
if (_actor->_pathPointIndex == 0) {
|
||||
if (_actor->_pathInitialPosFlag) {
|
||||
_actor->_pathCtrX = 0;
|
||||
_actor->_pathInitialPos = _actor->_position;
|
||||
_actor->_pathInitialPosFlag = false;
|
||||
}
|
||||
prevPt = _actor->_pathInitialPos;
|
||||
} else {
|
||||
prevPt = (*_actor->_pathNode)[_actor->_pathPointIndex - 1];
|
||||
}
|
||||
|
||||
Common::Point currPt = (*_actor->_pathNode)[_actor->_pathPointIndex];
|
||||
|
||||
int16 deltaX = currPt.x - prevPt.x;
|
||||
int16 deltaY = currPt.y - prevPt.y;
|
||||
|
||||
if (!_actor->_pathFlag50) {
|
||||
|
||||
// TODO Move to own function
|
||||
FP16 angle;
|
||||
if (currPt.x == prevPt.x) {
|
||||
if (prevPt.y >= currPt.y)
|
||||
angle = fixedMul(-0x5A0000, 0x478);
|
||||
else
|
||||
angle = fixedMul(0x5A0000, 0x478);
|
||||
} else {
|
||||
angle = fixedAtan(fixedDiv(deltaY << 16, deltaX << 16));
|
||||
}
|
||||
_actor->_pathAngle = angle;
|
||||
|
||||
// TODO Move to own function
|
||||
int16 v13 = (fixedTrunc(fixedMul(angle, 0x394BB8)) + 360) % 360;
|
||||
if (deltaX >= 0)
|
||||
v13 += 180;
|
||||
v13 = (v13 + 90) % 360;
|
||||
int16 v15 = kAngleTbl[0] / -2;
|
||||
uint newFacing = 1;
|
||||
for (uint i = 0; i < 8; ++i) {
|
||||
v15 += kAngleTbl[i];
|
||||
if (v13 < v15) {
|
||||
newFacing = 1 << i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newFacing != _actor->_facing) {
|
||||
refreshSequenceCode();
|
||||
faceActor(newFacing);
|
||||
if (!fastWalked && _vm->testMainActorFastWalk(this)) {
|
||||
fastWalked = true;
|
||||
disappearActor();
|
||||
_actor->_flags |= Illusions::ACTOR_FLAG_8000;
|
||||
_actor->_seqCodeIp = 0;
|
||||
deltaTime = 2;
|
||||
}
|
||||
|
||||
_actor->_pathFlag50 = true;
|
||||
|
||||
}
|
||||
|
||||
FP16 deltaX24, deltaY24;
|
||||
|
||||
if (_actor->_flags & Illusions::ACTOR_FLAG_400) {
|
||||
|
||||
FP16 v20 = fixedMul((deltaTime + _actor->_pathCtrX) << 16, _actor->_pathCtrY << 16);
|
||||
FP16 v21 = fixedDiv(v20, 100 << 16);
|
||||
FP16 v22 = fixedMul(v21, _actor->_scale << 16);
|
||||
FP16 v23 = fixedDiv(v22, 100 << 16);
|
||||
_actor->_seqCodeValue1 = 100 * _actor->_pathCtrY * deltaTime / 100;
|
||||
if (v23) {
|
||||
FP16 prevDistance = fixedDistance(prevPt.x << 16, prevPt.y << 16, _actor->_posXShl, _actor->_posYShl);
|
||||
FP16 distance = prevDistance + v23;
|
||||
if (prevPt.x > currPt.x)
|
||||
distance = -distance;
|
||||
deltaX24 = fixedMul(fixedCos(_actor->_pathAngle), distance);
|
||||
deltaY24 = fixedMul(fixedSin(_actor->_pathAngle), distance);
|
||||
} else {
|
||||
deltaX24 = _actor->_posXShl - (prevPt.x << 16);
|
||||
deltaY24 = _actor->_posYShl - (prevPt.y << 16);
|
||||
}
|
||||
} else {
|
||||
if (100 * (int)deltaTime <= _actor->_seqCodeValue2)
|
||||
if (_vm->testMainActorCollision(this))
|
||||
break;
|
||||
deltaX24 = deltaX << 16;
|
||||
deltaY24 = deltaY << 16;
|
||||
}
|
||||
|
||||
if (ABS(deltaX24) < ABS(deltaX << 16) ||
|
||||
ABS(deltaY24) < ABS(deltaY << 16)) {
|
||||
FP16 newX = (prevPt.x << 16) + deltaX24;
|
||||
FP16 newY = (prevPt.y << 16) + deltaY24;
|
||||
if (newX == _actor->_posXShl && newY == _actor->_posYShl) {
|
||||
_actor->_pathCtrX += deltaTime;
|
||||
Common::Point prevPt;
|
||||
if (_actor->_pathPointIndex == 0) {
|
||||
if (_actor->_pathInitialPosFlag) {
|
||||
_actor->_pathCtrX = 0;
|
||||
_actor->_pathInitialPos = _actor->_position;
|
||||
_actor->_pathInitialPosFlag = false;
|
||||
}
|
||||
prevPt = _actor->_pathInitialPos;
|
||||
} else {
|
||||
_actor->_pathCtrX = 0;
|
||||
_actor->_posXShl = newX;
|
||||
_actor->_posYShl = newY;
|
||||
_actor->_position.x = fixedTrunc(_actor->_posXShl);
|
||||
_actor->_position.y = fixedTrunc(_actor->_posYShl);
|
||||
prevPt = (*_actor->_pathNode)[_actor->_pathPointIndex - 1];
|
||||
}
|
||||
} else {
|
||||
_actor->_position = currPt;
|
||||
_actor->_posXShl = _actor->_position.x << 16;
|
||||
_actor->_posYShl = _actor->_position.y << 16;
|
||||
--_actor->_pathPointsCount;
|
||||
++_actor->_pathPointIndex;
|
||||
++_actor->_pathPoints;
|
||||
_actor->_pathInitialPosFlag = true;
|
||||
if (_actor->_pathPointsCount == 0) {
|
||||
if (_actor->_flags & Illusions::ACTOR_FLAG_400) {
|
||||
delete _actor->_pathNode;
|
||||
_actor->_flags &= ~Illusions::ACTOR_FLAG_400;
|
||||
|
||||
Common::Point currPt = (*_actor->_pathNode)[_actor->_pathPointIndex];
|
||||
|
||||
int16 deltaX = currPt.x - prevPt.x;
|
||||
int16 deltaY = currPt.y - prevPt.y;
|
||||
|
||||
if (!_actor->_pathFlag50) {
|
||||
|
||||
// TODO Move to own function
|
||||
FixedPoint16 angle;
|
||||
if (currPt.x == prevPt.x) {
|
||||
if (prevPt.y >= currPt.y)
|
||||
angle = fixedMul(-0x5A0000, 0x478);
|
||||
else
|
||||
angle = fixedMul(0x5A0000, 0x478);
|
||||
} else {
|
||||
angle = fixedAtan(fixedDiv(deltaY << 16, deltaX << 16));
|
||||
}
|
||||
_actor->_pathNode = 0;
|
||||
_actor->_pathPoints = 0;
|
||||
_actor->_pathPointsCount = 0;
|
||||
_actor->_pathPointIndex = 0;
|
||||
if (_actor->_notifyId3C) {
|
||||
_vm->notifyThreadId(_actor->_notifyId3C);
|
||||
_actor->_walkCallerThreadId1 = 0;
|
||||
_actor->_pathAngle = angle;
|
||||
|
||||
// TODO Move to own function
|
||||
int16 v13 = (fixedTrunc(fixedMul(angle, 0x394BB8)) + 360) % 360; // 0x394BB8 is 180 / pi
|
||||
if (deltaX >= 0)
|
||||
v13 += 180;
|
||||
v13 = (v13 + 90) % 360;
|
||||
int16 v15 = kAngleTbl[0] / -2;
|
||||
uint newFacing = 1;
|
||||
for (uint i = 0; i < 8; ++i) {
|
||||
v15 += kAngleTbl[i];
|
||||
if (v13 < v15) {
|
||||
newFacing = 1 << i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fastWalked = false;
|
||||
if (newFacing != _actor->_facing) {
|
||||
refreshSequenceCode();
|
||||
faceActor(newFacing);
|
||||
}
|
||||
|
||||
_actor->_pathFlag50 = true;
|
||||
|
||||
}
|
||||
_actor->_pathFlag50 = false;
|
||||
}
|
||||
|
||||
if (!fastWalked)
|
||||
break;
|
||||
FixedPoint16 deltaX24, deltaY24;
|
||||
|
||||
}
|
||||
if (_actor->_flags & Illusions::ACTOR_FLAG_400) {
|
||||
|
||||
FixedPoint16 v20 = fixedMul((deltaTime + _actor->_pathCtrX) << 16, _actor->_pathCtrY << 16);
|
||||
FixedPoint16 v21 = fixedDiv(v20, 100 << 16);
|
||||
FixedPoint16 v22 = fixedMul(v21, _actor->_scale << 16);
|
||||
FixedPoint16 v23 = fixedDiv(v22, 100 << 16);
|
||||
_actor->_seqCodeValue1 = 100 * _actor->_pathCtrY * deltaTime / 100;
|
||||
if (v23) {
|
||||
FixedPoint16 prevDistance = fixedDistance(prevPt.x << 16, prevPt.y << 16, _actor->_posXShl, _actor->_posYShl);
|
||||
FixedPoint16 distance = prevDistance + v23;
|
||||
if (prevPt.x > currPt.x)
|
||||
distance = -distance;
|
||||
deltaX24 = fixedMul(fixedCos(_actor->_pathAngle), distance);
|
||||
deltaY24 = fixedMul(fixedSin(_actor->_pathAngle), distance);
|
||||
} else {
|
||||
deltaX24 = _actor->_posXShl - (prevPt.x << 16);
|
||||
deltaY24 = _actor->_posYShl - (prevPt.y << 16);
|
||||
}
|
||||
} else {
|
||||
if (100 * (int)deltaTime <= _actor->_seqCodeValue2)
|
||||
break;
|
||||
deltaX24 = deltaX << 16;
|
||||
deltaY24 = deltaY << 16;
|
||||
}
|
||||
|
||||
if (ABS(deltaX24) < ABS(deltaX << 16) ||
|
||||
ABS(deltaY24) < ABS(deltaY << 16)) {
|
||||
FixedPoint16 newX = (prevPt.x << 16) + deltaX24;
|
||||
FixedPoint16 newY = (prevPt.y << 16) + deltaY24;
|
||||
if (newX == _actor->_posXShl && newY == _actor->_posYShl) {
|
||||
_actor->_pathCtrX += deltaTime;
|
||||
} else {
|
||||
_actor->_pathCtrX = 0;
|
||||
_actor->_posXShl = newX;
|
||||
_actor->_posYShl = newY;
|
||||
_actor->_position.x = fixedTrunc(_actor->_posXShl);
|
||||
_actor->_position.y = fixedTrunc(_actor->_posYShl);
|
||||
}
|
||||
} else {
|
||||
_actor->_position = currPt;
|
||||
_actor->_posXShl = _actor->_position.x << 16;
|
||||
_actor->_posYShl = _actor->_position.y << 16;
|
||||
--_actor->_pathPointsCount;
|
||||
++_actor->_pathPointIndex;
|
||||
++_actor->_pathPoints;
|
||||
_actor->_pathInitialPosFlag = true;
|
||||
if (_actor->_pathPointsCount == 0) {
|
||||
if (_actor->_flags & Illusions::ACTOR_FLAG_400) {
|
||||
delete _actor->_pathNode;
|
||||
_actor->_flags &= ~Illusions::ACTOR_FLAG_400;
|
||||
}
|
||||
_actor->_pathNode = 0;
|
||||
_actor->_pathPoints = 0;
|
||||
_actor->_pathPointsCount = 0;
|
||||
_actor->_pathPointIndex = 0;
|
||||
if (_actor->_notifyId3C) {
|
||||
_vm->notifyThreadId(_actor->_notifyId3C);
|
||||
_actor->_walkCallerThreadId1 = 0;
|
||||
}
|
||||
fastWalked = false;
|
||||
}
|
||||
_actor->_pathFlag50 = false;
|
||||
}
|
||||
|
||||
} while (fastWalked);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void BbdouCredits::drawTextToControl(uint32 objectId, const char *text, uint ali
|
|||
charToWChar(text, wtext, ARRAYSIZE(wtext));
|
||||
|
||||
// TODO Extract to Actor class
|
||||
Control *control = _vm->getObjectControl(objectId);
|
||||
Control *control = _vm->getObjectControl(objectId);
|
||||
FontResource *font = _vm->_dict->findFont(_currFontId);
|
||||
TextDrawer textDrawer;
|
||||
WidthHeight dimensions;
|
||||
|
|
|
@ -60,7 +60,7 @@ CauseThread_BBDOU::CauseThread_BBDOU(IllusionsEngine_BBDOU *vm, uint32 threadId,
|
|||
_sceneId(sceneId), _verbId(verbId), _objectId2(objectId2), _objectId(objectId) {
|
||||
_type = kTTSpecialThread;
|
||||
}
|
||||
|
||||
|
||||
void CauseThread_BBDOU::onNotify() {
|
||||
_bbdou->_cursor->_data._causeThreadId1 = 0;
|
||||
terminate();
|
||||
|
|
|
@ -168,7 +168,7 @@ Common::Error IllusionsEngine_BBDOU::run() {
|
|||
|
||||
_screen->setColorKey1(0xF81F);
|
||||
|
||||
initInput();
|
||||
initInput();
|
||||
|
||||
initUpdateFunctions();
|
||||
|
||||
|
@ -188,10 +188,10 @@ Common::Error IllusionsEngine_BBDOU::run() {
|
|||
ConfMan.registerDefault("talkspeed", 240);
|
||||
_subtitleDuration = (uint16)ConfMan.getInt("talkspeed");
|
||||
|
||||
_globalSceneId = 0x00010003;
|
||||
|
||||
_globalSceneId = 0x00010003;
|
||||
|
||||
setDefaultTextCoords();
|
||||
|
||||
|
||||
_resSys->loadResource(0x000D0001, 0, 0);
|
||||
|
||||
_doScriptThreadInit = false;
|
||||
|
@ -214,7 +214,7 @@ Common::Error IllusionsEngine_BBDOU::run() {
|
|||
delete _stack;
|
||||
delete _scriptOpcodes;
|
||||
|
||||
delete _soundMan;
|
||||
delete _soundMan;
|
||||
delete _updateFunctions;
|
||||
delete _threads;
|
||||
delete _triggerFunctions;
|
||||
|
@ -230,9 +230,9 @@ Common::Error IllusionsEngine_BBDOU::run() {
|
|||
delete _resSys;
|
||||
delete _resReader;
|
||||
delete _dict;
|
||||
|
||||
|
||||
debug("Ok");
|
||||
|
||||
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
void causeDeclare(uint32 verbId, uint32 objectId2, uint32 objectId, TriggerFunctionCallback *callback);
|
||||
uint32 causeTrigger(uint32 sceneId, uint32 verbId, uint32 objectId2, uint32 objectId, uint32 callingThreadId);
|
||||
|
||||
void setDefaultTextCoords();
|
||||
void setDefaultTextCoords();
|
||||
|
||||
void loadSpecialCode(uint32 resId);
|
||||
void unloadSpecialCode(uint32 resId);
|
||||
|
|
|
@ -488,11 +488,11 @@ void Camera::recalcPan(uint32 currTime) {
|
|||
if (_activeState._panSpeed == 0) {
|
||||
_activeState._time2E = 0;
|
||||
} else {
|
||||
FP16 x1 = _activeState._currPan2.x << 16;
|
||||
FP16 y1 = _activeState._currPan2.y << 16;
|
||||
FP16 x2 = _activeState._panTargetPoint.x << 16;
|
||||
FP16 y2 = _activeState._panTargetPoint.y << 16;
|
||||
FP16 distance = fixedDistance(x1, y1, x2, y2);
|
||||
FixedPoint16 x1 = _activeState._currPan2.x << 16;
|
||||
FixedPoint16 y1 = _activeState._currPan2.y << 16;
|
||||
FixedPoint16 x2 = _activeState._panTargetPoint.x << 16;
|
||||
FixedPoint16 y2 = _activeState._panTargetPoint.y << 16;
|
||||
FixedPoint16 distance = fixedDistance(x1, y1, x2, y2);
|
||||
_activeState._time2E = 60 * fixedTrunc(distance) / _activeState._panSpeed;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,20 +87,20 @@ public:
|
|||
void removeActorType(uint32 id);
|
||||
ActorType *findActorType(uint32 id);
|
||||
|
||||
void addFont(uint32 id, FontResource *fontResource);
|
||||
void addFont(uint32 id, FontResource *fontResource);
|
||||
void removeFont(uint32 id);
|
||||
FontResource *findFont(uint32 id);
|
||||
|
||||
void addSequence(uint32 id, Sequence *sequence);
|
||||
void addSequence(uint32 id, Sequence *sequence);
|
||||
void removeSequence(uint32 id);
|
||||
Sequence *findSequence(uint32 id);
|
||||
|
||||
void addTalkEntry(uint32 id, TalkEntry *talkEntry);
|
||||
void addTalkEntry(uint32 id, TalkEntry *talkEntry);
|
||||
void removeTalkEntry(uint32 id);
|
||||
TalkEntry *findTalkEntry(uint32 id);
|
||||
|
||||
void setObjectControl(uint32 objectId, Control *control);
|
||||
Control *getObjectControl(uint32 objectId);
|
||||
void setObjectControl(uint32 objectId, Control *control);
|
||||
Control *getObjectControl(uint32 objectId);
|
||||
|
||||
protected:
|
||||
DictionaryHashMap<ActorType> _actorTypes;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
|
|
|
@ -213,7 +213,7 @@ Common::Error IllusionsEngine_Duckman::run() {
|
|||
|
||||
delete _fader;
|
||||
|
||||
delete _gameState;
|
||||
delete _gameState;
|
||||
delete _menuSystem;
|
||||
delete _soundMan;
|
||||
delete _updateFunctions;
|
||||
|
|
|
@ -25,23 +25,23 @@
|
|||
|
||||
namespace Illusions {
|
||||
|
||||
FP16 floatToFixed(float value) {
|
||||
FixedPoint16 floatToFixed(float value) {
|
||||
return value * 65536.0;
|
||||
}
|
||||
|
||||
float fixedToFloat(FP16 value) {
|
||||
float fixedToFloat(FixedPoint16 value) {
|
||||
return value / 65536.0;
|
||||
}
|
||||
|
||||
FP16 fixedMul(FP16 a, FP16 b) {
|
||||
FixedPoint16 fixedMul(FixedPoint16 a, FixedPoint16 b) {
|
||||
return ((float)a * b) / 65536.0;
|
||||
}
|
||||
|
||||
FP16 fixedDiv(FP16 a, FP16 b) {
|
||||
FixedPoint16 fixedDiv(FixedPoint16 a, FixedPoint16 b) {
|
||||
return ((float)a / b) * 65536.0;
|
||||
}
|
||||
|
||||
int16 fixedTrunc(FP16 value) {
|
||||
int16 fixedTrunc(FixedPoint16 value) {
|
||||
// CHECKME Not sure if this correct
|
||||
int16 result = (value >> 16) & 0xFFFF;
|
||||
if ((value & 0xFFFF) >= 0x8000)
|
||||
|
@ -49,7 +49,7 @@ int16 fixedTrunc(FP16 value) {
|
|||
return result;
|
||||
}
|
||||
|
||||
FP16 fixedDistance(FP16 x1, FP16 y1, FP16 x2, FP16 y2) {
|
||||
FixedPoint16 fixedDistance(FixedPoint16 x1, FixedPoint16 y1, FixedPoint16 x2, FixedPoint16 y2) {
|
||||
float xd = fixedToFloat(x1) - fixedToFloat(x2);
|
||||
float yd = fixedToFloat(y1) - fixedToFloat(y2);
|
||||
if (xd != 0.0 || yd != 0.0)
|
||||
|
@ -57,16 +57,16 @@ FP16 fixedDistance(FP16 x1, FP16 y1, FP16 x2, FP16 y2) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
FP16 fixedAtan(FP16 value) {
|
||||
FixedPoint16 fixedAtan(FixedPoint16 value) {
|
||||
//return floatToFixed(atan2(1.0, fixedToFloat(value)));
|
||||
return floatToFixed(atan(fixedToFloat(value)));
|
||||
}
|
||||
|
||||
FP16 fixedCos(FP16 value) {
|
||||
FixedPoint16 fixedCos(FixedPoint16 value) {
|
||||
return floatToFixed(cos(fixedToFloat(value)));
|
||||
}
|
||||
|
||||
FP16 fixedSin(FP16 value) {
|
||||
FixedPoint16 fixedSin(FixedPoint16 value) {
|
||||
return floatToFixed(sin(fixedToFloat(value)));
|
||||
}
|
||||
|
||||
|
|
|
@ -27,17 +27,17 @@
|
|||
|
||||
namespace Illusions {
|
||||
|
||||
typedef int32 FP16;
|
||||
typedef int32 FixedPoint16;
|
||||
|
||||
FP16 floatToFixed(float value);
|
||||
float fixedToFloat(FP16 value);
|
||||
FP16 fixedMul(FP16 a, FP16 b);
|
||||
FP16 fixedDiv(FP16 a, FP16 b);
|
||||
int16 fixedTrunc(FP16 value);
|
||||
FP16 fixedDistance(FP16 x1, FP16 y1, FP16 x2, FP16 y2);
|
||||
FP16 fixedAtan(FP16 value);
|
||||
FP16 fixedCos(FP16 value);
|
||||
FP16 fixedSin(FP16 value);
|
||||
FixedPoint16 floatToFixed(float value);
|
||||
float fixedToFloat(FixedPoint16 value);
|
||||
FixedPoint16 fixedMul(FixedPoint16 a, FixedPoint16 b);
|
||||
FixedPoint16 fixedDiv(FixedPoint16 a, FixedPoint16 b);
|
||||
int16 fixedTrunc(FixedPoint16 value);
|
||||
FixedPoint16 fixedDistance(FixedPoint16 x1, FixedPoint16 y1, FixedPoint16 x2, FixedPoint16 y2);
|
||||
FixedPoint16 fixedAtan(FixedPoint16 value);
|
||||
FixedPoint16 fixedCos(FixedPoint16 value);
|
||||
FixedPoint16 fixedSin(FixedPoint16 value);
|
||||
|
||||
} // End of namespace Illusions
|
||||
|
||||
|
|
|
@ -262,12 +262,12 @@ void BaseMenuSystem::placeActorHoverBackground() {
|
|||
|
||||
WidthHeight frameDimensions;
|
||||
v0->getActorFrameDimensions(frameDimensions);
|
||||
|
||||
|
||||
FontResource *font = _vm->_dict->findFont(_activeMenu->_fontId);
|
||||
int charHeight = font->getCharHeight() + font->getLineIncr();
|
||||
if (frameDimensions._height < charHeight)
|
||||
charHeight = frameDimensions._height;
|
||||
|
||||
|
||||
v0->drawActorRect(Common::Rect(textInfoDimensions._width - 1, charHeight), _activeMenu->_fieldE);
|
||||
|
||||
updateActorHoverBackground();
|
||||
|
@ -375,8 +375,8 @@ void BaseMenuSystem::handleClick(uint menuItemIndex, const Common::Point &mouseP
|
|||
debug(0, "BaseMenuSystem::handleClick() menuItemIndex: %d click point: (%d, %d)", menuItemIndex, mousePos.x, mousePos.y);
|
||||
|
||||
if (menuItemIndex == 0) {
|
||||
playSoundEffect14();
|
||||
return;
|
||||
playSoundEffect14();
|
||||
return;
|
||||
}
|
||||
|
||||
MenuItem *menuItem = _activeMenu->getMenuItem(menuItemIndex - 1);
|
||||
|
@ -434,7 +434,7 @@ uint BaseMenuSystem::drawMenuText(BaseMenu *menu) {
|
|||
}
|
||||
|
||||
void BaseMenuSystem::update(Control *cursorControl) {
|
||||
Common::Point mousePos = _vm->_input->getCursorPosition();
|
||||
Common::Point mousePos = _vm->_input->getCursorPosition();
|
||||
setMousePos(mousePos);
|
||||
|
||||
uint newHoveredMenuItemIndex;
|
||||
|
@ -518,7 +518,7 @@ void BaseMenuSystem::setSavegameSlotNum(int slotNum) {
|
|||
}
|
||||
|
||||
void BaseMenuSystem::setSavegameDescription(Common::String desc) {
|
||||
_vm->_savegameDescription = desc;
|
||||
_vm->_savegameDescription = desc;
|
||||
}
|
||||
|
||||
void BaseMenuSystem::updateTimeOut(bool resetTimeOut) {
|
||||
|
@ -672,27 +672,28 @@ void MenuActionLoadGame::execute() {
|
|||
|
||||
// MenuActionSaveGame
|
||||
|
||||
MenuActionSaveGame::MenuActionSaveGame(BaseMenuSystem *menuSystem, uint choiceIndex)
|
||||
: BaseMenuAction(menuSystem), _choiceIndex(choiceIndex) {
|
||||
MenuActionSaveGame::MenuActionSaveGame(BaseMenuSystem *menuSystem, uint choiceIndex)
|
||||
: BaseMenuAction(menuSystem), _choiceIndex(choiceIndex) {
|
||||
}
|
||||
|
||||
void MenuActionSaveGame::execute() {
|
||||
const Plugin *plugin = NULL;
|
||||
EngineMan.findGame(ConfMan.get("gameid"), &plugin);
|
||||
GUI::SaveLoadChooser *dialog;
|
||||
Common::String desc;
|
||||
int slot;
|
||||
|
||||
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
|
||||
slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
||||
desc = dialog->getResultString().c_str();
|
||||
|
||||
delete dialog;
|
||||
|
||||
if (slot >= 0) {
|
||||
_menuSystem->setSavegameSlotNum(slot);
|
||||
_menuSystem->setSavegameDescription(desc);
|
||||
_menuSystem->selectMenuChoiceIndex(_choiceIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void MenuActionSaveGame::execute() {
|
||||
const Plugin *plugin = NULL;
|
||||
EngineMan.findGame(ConfMan.get("gameid"), &plugin);
|
||||
GUI::SaveLoadChooser *dialog;
|
||||
Common::String desc;
|
||||
int slot;
|
||||
|
||||
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
|
||||
slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
||||
desc = dialog->getResultString().c_str();
|
||||
|
||||
delete dialog;
|
||||
|
||||
if (slot >= 0) {
|
||||
_menuSystem->setSavegameSlotNum(slot);
|
||||
_menuSystem->setSavegameDescription(desc);
|
||||
_menuSystem->selectMenuChoiceIndex(_choiceIndex);
|
||||
}
|
||||
}
|
||||
} // End of namespace Illusions
|
||||
|
|
|
@ -116,57 +116,57 @@ public:
|
|||
protected:
|
||||
IllusionsEngine *_vm;
|
||||
MenuStack _menuStack;
|
||||
|
||||
|
||||
uint32 _menuCallerThreadId;
|
||||
bool _isTimeOutEnabled;
|
||||
bool _isTimeOutReached;
|
||||
uint32 _timeOutDuration;
|
||||
uint _timeOutMenuChoiceIndex;
|
||||
uint32 _timeOutStartTime;
|
||||
uint32 _timeOutEndTime;
|
||||
|
||||
bool _isTimeOutEnabled;
|
||||
bool _isTimeOutReached;
|
||||
uint32 _timeOutDuration;
|
||||
uint _timeOutMenuChoiceIndex;
|
||||
uint32 _timeOutStartTime;
|
||||
uint32 _timeOutEndTime;
|
||||
|
||||
Common::Point _savedCursorPos;
|
||||
bool _cursorInitialVisibleFlag;
|
||||
int _savedGameState;
|
||||
int _savedCursorActorIndex;
|
||||
int _savedCursorSequenceId;
|
||||
|
||||
|
||||
bool _isActive;
|
||||
|
||||
|
||||
MenuChoiceOffsets _menuChoiceOffsets;
|
||||
int16 *_menuChoiceOffset;
|
||||
|
||||
|
||||
uint _queryConfirmationChoiceIndex;
|
||||
|
||||
|
||||
uint _field54;
|
||||
uint _menuLinesCount;
|
||||
uint _menuItemCount;
|
||||
|
||||
|
||||
uint _hoveredMenuItemIndex;
|
||||
uint _hoveredMenuItemIndex2;
|
||||
uint _hoveredMenuItemIndex3;
|
||||
|
||||
BaseMenu *_activeMenu;
|
||||
void setMouseCursorToMenuItem(int menuItemIndex);
|
||||
|
||||
|
||||
void calcMenuItemRect(uint menuItemIndex, WRect &rect);
|
||||
bool calcMenuItemMousePos(uint menuItemIndex, Common::Point &pt);
|
||||
bool calcMenuItemIndexAtPoint(Common::Point pt, uint &menuItemIndex);
|
||||
void setMousePos(Common::Point &mousePos);
|
||||
|
||||
|
||||
void activateMenu(BaseMenu *menu);
|
||||
|
||||
|
||||
void updateTimeOut(bool resetTimeOut);
|
||||
|
||||
|
||||
void initActorHoverBackground();
|
||||
void placeActorHoverBackground();
|
||||
void updateActorHoverBackground();
|
||||
void hideActorHoverBackground();
|
||||
|
||||
|
||||
void initActorTextColorRect();
|
||||
void placeActorTextColorRect();
|
||||
void hideActorTextColorRect();
|
||||
|
||||
|
||||
virtual BaseMenu *getMenuById(int menuId) = 0;
|
||||
virtual void playSoundEffect(int sfxId) = 0;
|
||||
};
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
class ActorInstance : public ResourceInstance {
|
||||
public:
|
||||
ActorInstance(IllusionsEngine *vm);
|
||||
ActorInstance(IllusionsEngine *vm);
|
||||
virtual void load(Resource *resource);
|
||||
virtual void unload();
|
||||
virtual void pause();
|
||||
|
|
|
@ -30,8 +30,8 @@ namespace Illusions {
|
|||
void MidiGroupResourceLoader::load(Resource *resource) {
|
||||
debug(1, "MidiGroupResourceLoader::load() Loading midi group %08X...", resource->_resId);
|
||||
|
||||
// TODO
|
||||
|
||||
// TODO
|
||||
|
||||
}
|
||||
|
||||
bool MidiGroupResourceLoader::isFlag(int flag) {
|
||||
|
|
|
@ -141,11 +141,11 @@ public:
|
|||
|
||||
class ScriptInstance : public ResourceInstance {
|
||||
public:
|
||||
ScriptInstance(IllusionsEngine *vm);
|
||||
ScriptInstance(IllusionsEngine *vm);
|
||||
virtual void load(Resource *resource);
|
||||
virtual void unload();
|
||||
public:
|
||||
IllusionsEngine *_vm;
|
||||
IllusionsEngine *_vm;
|
||||
};
|
||||
|
||||
} // End of namespace Illusions
|
||||
|
|
|
@ -61,11 +61,11 @@ public:
|
|||
|
||||
class SoundGroupInstance : public ResourceInstance {
|
||||
public:
|
||||
SoundGroupInstance(IllusionsEngine *vm);
|
||||
SoundGroupInstance(IllusionsEngine *vm);
|
||||
virtual void load(Resource *resource);
|
||||
virtual void unload();
|
||||
public:
|
||||
IllusionsEngine *_vm;
|
||||
IllusionsEngine *_vm;
|
||||
SoundGroupResource *_soundGroupResource;
|
||||
uint32 _resId;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue