mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-18 18:30:59 +00:00
DIRECTOR: Factored out XPFloat reading
This commit is contained in:
parent
a9e5a2fa01
commit
126cba16cf
@ -22,7 +22,6 @@
|
||||
#include "common/config-manager.h"
|
||||
#include "common/file.h"
|
||||
#include "common/substream.h"
|
||||
#include "common/xpfloat.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/cast.h"
|
||||
@ -1242,10 +1241,7 @@ ScriptContext *LingoCompiler::compileLingoV4(Common::SeekableReadStreamEndian &s
|
||||
// Floats are stored as an "80 bit IEEE Standard 754 floating
|
||||
// point number (Standard Apple Numeric Environment [SANE] data type
|
||||
// Extended).
|
||||
uint16 signAndExponent = READ_BE_UINT16(&constsStore[pointer]);
|
||||
uint64 mantissa = READ_BE_UINT64(&constsStore[pointer+2]);
|
||||
|
||||
constant.u.f = Common::XPFloat(signAndExponent, mantissa).toDouble(Common::XPFloat::kSemanticsSANE);
|
||||
constant.u.f = readAppleFloat80(&constsStore[pointer]);
|
||||
} else if (length == 8) {
|
||||
constant.u.f = READ_BE_FLOAT64(&constsStore[pointer]);
|
||||
} else {
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "common/punycode.h"
|
||||
#include "common/str-array.h"
|
||||
#include "common/tokenizer.h"
|
||||
#include "common/xpfloat.h"
|
||||
#include "common/compression/deflate.h"
|
||||
|
||||
#include "director/types.h"
|
||||
@ -1650,4 +1651,15 @@ void DirectorEngine::delayMillis(uint32 delay) {
|
||||
_system->delayMillis(delay);
|
||||
}
|
||||
|
||||
double readAppleFloat80(byte *ptr) {
|
||||
// Floats in an "80 bit IEEE Standard 754 floating
|
||||
// point number (Standard Apple Numeric Environment [SANE] data type
|
||||
// Extended).
|
||||
|
||||
uint16 signAndExponent = READ_BE_UINT16(&ptr[0]);
|
||||
uint64 mantissa = READ_BE_UINT64(&ptr[2]);
|
||||
|
||||
return Common::XPFloat(signAndExponent, mantissa).toDouble(Common::XPFloat::kSemanticsSANE);
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
|
@ -70,6 +70,8 @@ Common::Path dumpFactoryName(const char *prefix, const char *name, const char *e
|
||||
|
||||
bool isButtonSprite(SpriteType spriteType);
|
||||
|
||||
double readAppleFloat80(byte *ptr);
|
||||
|
||||
class RandomState {
|
||||
public:
|
||||
uint32 _seed;
|
||||
|
Loading…
x
Reference in New Issue
Block a user