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() {
if (_actor->_pauseCtr > 0)
return;
@ -665,7 +664,6 @@ void Control::sequenceActor() {
//debug(1, "Sequence has finished");
_actor->_seqCodeIp = 0;
}
}
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 pt = _vm->_camera->getScreenOffset();
pt.x += cursorPos.x;
pt.y += cursorPos.y;
return pt;
return _vm->_camera->getScreenOffset() + cursorPos;
}
void BbdouSpecialCode::showBubble(uint32 objectId, uint32 overlappedObjectId, uint32 holdingObjectId,

View File

@ -140,7 +140,6 @@ SaveStateList IllusionsMetaEngine::listSaves(const char *target) const {
pattern += ".???";
Common::StringArray filenames;
filenames = saveFileMan->listSavefiles(pattern.c_str());
Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
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
@ -155,6 +154,7 @@ SaveStateList IllusionsMetaEngine::listSaves(const char *target) const {
}
}
}
Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}

View File

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

View File

@ -27,14 +27,14 @@
namespace Illusions {
enum SliderActionType {
SFX,
MUSIC,
VOICE,
TEXT_DURATION
};
enum SliderActionType {
SFX,
MUSIC,
VOICE,
TEXT_DURATION
};
enum {
enum {
kDuckmanMainMenu,
kDuckmanLoadGameMenu,
kDuckmanLoadGameFailedMenu,
@ -52,7 +52,7 @@ namespace Illusions {
class IllusionsEngine_Duckman;
class MenuActionUpdateSlider;
class DuckmanMenuSystem : public BaseMenuSystem {
class DuckmanMenuSystem : public BaseMenuSystem {
public:
DuckmanMenuSystem(IllusionsEngine_Duckman *vm);
~DuckmanMenuSystem();

View File

@ -52,7 +52,7 @@ int16 fixedTrunc(FixedPoint16 value) {
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)
if (xd != 0.0f || yd != 0.0f)
return floatToFixed(sqrt(xd * xd + yd * yd));
return 0;
}

View File

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

View File

@ -242,7 +242,7 @@ int IllusionsEngine::convertPanXCoord(int16 x) {
int16 diff = x - _camera->getCurrentPan().x;
int16 absX = ABS(diff);
int newX = 0;
if ( absX < 160) {
if (absX < 160) {
newX = (diff << 7) / 320;
} else if (diff < 0) {
newX = -64;

View File

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

View File

@ -30,7 +30,7 @@ PointArray *PathFinder::findPath(Camera *camera, Common::Point sourcePt, Common:
PointArray *walkPoints, PathLines *walkRects, WidthHeight bgDimensions) {
Common::Point cameraPt = camera->getScreenOffset();
_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;
_walkPoints = walkPoints;
_walkRects = walkRects;

View File

@ -60,7 +60,7 @@ protected:
};
// Convenience macros
#define ARG_SKIP(x) opCall.skip(x);
#define ARG_SKIP(x) opCall.skip(x);
#define ARG_BYTE(name) byte name = opCall.readByte(); debug(5, "ARG_BYTE(" #name " = %d)", name);
#define ARG_INT16(name) int16 name = opCall.readSint16(); debug(5, "ARG_INT16(" #name " = %d)", name);
#define ARG_UINT32(name) uint32 name = opCall.readUint32(); debug(5, "ARG_UINT32(" #name " = %08X)", name);

View File

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