ILLUSIONS: Formatting fixes

Simplified some point arithmetic
Lock fixedpoint calcs to float rather than double
This commit is contained in:
Eric Fry 2018-06-28 22:50:20 +10:00 committed by Eugene Sandulenko
parent fee1f3d8cb
commit 8e43261d13
12 changed files with 19 additions and 33 deletions

View file

@ -618,7 +618,6 @@ void Control::startTalkActor(uint32 sequenceId, byte *entryTblPtr, uint32 thread
} }
void Control::sequenceActor() { void Control::sequenceActor() {
if (_actor->_pauseCtr > 0) if (_actor->_pauseCtr > 0)
return; return;
@ -665,7 +664,6 @@ void Control::sequenceActor() {
//debug(1, "Sequence has finished"); //debug(1, "Sequence has finished");
_actor->_seqCodeIp = 0; _actor->_seqCodeIp = 0;
} }
} }
void Control::setActorIndex(int actorIndex) { void Control::setActorIndex(int actorIndex) {

View file

@ -531,10 +531,7 @@ void BbdouSpecialCode::setCursorControlRoutine(uint32 objectId, int num) {
} }
Common::Point BbdouSpecialCode::getBackgroundCursorPos(Common::Point cursorPos) { Common::Point BbdouSpecialCode::getBackgroundCursorPos(Common::Point cursorPos) {
Common::Point pt = _vm->_camera->getScreenOffset(); return _vm->_camera->getScreenOffset() + cursorPos;
pt.x += cursorPos.x;
pt.y += cursorPos.y;
return pt;
} }
void BbdouSpecialCode::showBubble(uint32 objectId, uint32 overlappedObjectId, uint32 holdingObjectId, void BbdouSpecialCode::showBubble(uint32 objectId, uint32 overlappedObjectId, uint32 holdingObjectId,

View file

@ -140,7 +140,6 @@ SaveStateList IllusionsMetaEngine::listSaves(const char *target) const {
pattern += ".???"; pattern += ".???";
Common::StringArray filenames; Common::StringArray filenames;
filenames = saveFileMan->listSavefiles(pattern.c_str()); filenames = saveFileMan->listSavefiles(pattern.c_str());
Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList; SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot // Obtain the last 3 digits of the filename, since they correspond to the save slot
@ -155,6 +154,7 @@ SaveStateList IllusionsMetaEngine::listSaves(const char *target) const {
} }
} }
} }
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList; return saveList;
} }

View file

@ -983,10 +983,7 @@ uint32 IllusionsEngine_Duckman::getObjectActorTypeId(uint32 objectId) {
} }
Common::Point IllusionsEngine_Duckman::convertMousePos(Common::Point mousePos) { Common::Point IllusionsEngine_Duckman::convertMousePos(Common::Point mousePos) {
Common::Point screenOffsPt = _camera->getScreenOffset(); return mousePos + _camera->getScreenOffset();
mousePos.x += screenOffsPt.x;
mousePos.y += screenOffsPt.y;
return mousePos;
} }
void IllusionsEngine_Duckman::startCursorSequence() { void IllusionsEngine_Duckman::startCursorSequence() {

View file

@ -52,7 +52,7 @@ int16 fixedTrunc(FixedPoint16 value) {
FixedPoint16 fixedDistance(FixedPoint16 x1, FixedPoint16 y1, FixedPoint16 x2, FixedPoint16 y2) { FixedPoint16 fixedDistance(FixedPoint16 x1, FixedPoint16 y1, FixedPoint16 x2, FixedPoint16 y2) {
float xd = fixedToFloat(x1) - fixedToFloat(x2); float xd = fixedToFloat(x1) - fixedToFloat(x2);
float yd = fixedToFloat(y1) - fixedToFloat(y2); float yd = fixedToFloat(y1) - fixedToFloat(y2);
if (xd != 0.0 || yd != 0.0) if (xd != 0.0f || yd != 0.0f)
return floatToFixed(sqrt(xd * xd + yd * yd)); return floatToFixed(sqrt(xd * xd + yd * yd));
return 0; return 0;
} }

View file

@ -76,8 +76,7 @@ void NamedPoints::load(uint count, Common::SeekableReadStream &stream) {
void loadPoint(Common::SeekableReadStream &stream, Common::Point &pt) { void loadPoint(Common::SeekableReadStream &stream, Common::Point &pt) {
pt.x = stream.readSint16LE(); pt.x = stream.readSint16LE();
pt.y = stream.readSint16LE(); pt.y = stream.readSint16LE();
debug(0, "loadPoint() x: %d; y: %d", debug(0, "loadPoint() x: %d; y: %d", pt.x, pt.y);
pt.x, pt.y);
} }
} // End of namespace Illusions } // End of namespace Illusions

View file

@ -171,11 +171,6 @@ protected:
virtual void playSoundEffect(int sfxId) = 0; virtual void playSoundEffect(int sfxId) = 0;
}; };
/*
*/
class MenuTextBuilder { class MenuTextBuilder {
public: public:
MenuTextBuilder(); MenuTextBuilder();

View file

@ -30,7 +30,7 @@ PointArray *PathFinder::findPath(Camera *camera, Common::Point sourcePt, Common:
PointArray *walkPoints, PathLines *walkRects, WidthHeight bgDimensions) { PointArray *walkPoints, PathLines *walkRects, WidthHeight bgDimensions) {
Common::Point cameraPt = camera->getScreenOffset(); Common::Point cameraPt = camera->getScreenOffset();
_screenRect.p0 = cameraPt; _screenRect.p0 = cameraPt;
_screenRect.p1.x = cameraPt.x + 320; //TODO fix me get screen dimentions here. _screenRect.p1.x = cameraPt.x + 320; //TODO fix me get screen dimensions here.
_screenRect.p1.y = cameraPt.y + 200; _screenRect.p1.y = cameraPt.y + 200;
_walkPoints = walkPoints; _walkPoints = walkPoints;
_walkRects = walkRects; _walkRects = walkRects;

View file

@ -74,7 +74,7 @@ int TalkThread_Duckman::onUpdate() {
if (_vm->checkActiveTalkThreads()) if (_vm->checkActiveTalkThreads())
return kTSYield; return kTSYield;
_status = 3; _status = 3;
// Fallthrough to status 2 // fall through
case 2: case 2:
talkEntry = getTalkResourceEntry(_talkId); talkEntry = getTalkResourceEntry(_talkId);
@ -101,13 +101,13 @@ int TalkThread_Duckman::onUpdate() {
if (_objectId == 0 || _durationMult == 0) if (_objectId == 0 || _durationMult == 0)
_flags |= 8; _flags |= 8;
_status = 3; _status = 3;
// Fallthrough to status 3 // fall through
case 3: case 3:
if (!(_flags & 4) && !_vm->_soundMan->isVoiceCued()) if (!(_flags & 4) && !_vm->_soundMan->isVoiceCued())
return kTSYield; return kTSYield;
_status = 4; _status = 4;
// Fallthrough to status 4 // fall through
case 4: case 4:
if (!(_flags & 8) ) { if (!(_flags & 8) ) {