aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/prince/font.h8
-rw-r--r--engines/prince/prince.cpp1
-rw-r--r--engines/prince/script.cpp47
3 files changed, 30 insertions, 26 deletions
diff --git a/engines/prince/font.h b/engines/prince/font.h
index 8b622ce08a..1afafa3be3 100644
--- a/engines/prince/font.h
+++ b/engines/prince/font.h
@@ -41,13 +41,13 @@ public:
bool load(Common::SeekableReadStream &stream);
- virtual int getFontHeight() const override;
+ virtual int getFontHeight() const override;
- virtual int getMaxCharWidth() const override;
+ virtual int getMaxCharWidth() const override;
- virtual int getCharWidth(byte chr) const override;
+ virtual int getCharWidth(byte chr) const override;
- virtual void drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) const override;
+ virtual void drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) const override;
virtual int getKerningOffset(byte left, byte right) const { return -2; }
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 2fc4407f6e..6d01cf2017 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -546,4 +546,5 @@ void PrinceEngine::mainLoop() {
}
} // End of namespace Prince
+
/* vim: set tabstop=4 expandtab!: */
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index 55264a35a6..1aacda4f0b 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -44,7 +44,7 @@ Script::Script(PrinceEngine *vm) :
}
Script::~Script() {
- delete[] _code;
+ delete[] _code;
}
void Script::setFlag(Flags::Id flagId, uint16 value) {
@@ -52,27 +52,27 @@ void Script::setFlag(Flags::Id flagId, uint16 value) {
}
bool Script::loadFromStream(Common::SeekableReadStream &stream) {
- _codeSize = stream.size();
- _code = new byte[_codeSize];
+ _codeSize = stream.size();
+ _code = new byte[_codeSize];
- if (!_code)
- return false;
+ if (!_code)
+ return false;
stream.read(_code, _codeSize);
// Initialize the script
_fgOpcodePC = READ_LE_UINT32(_code + 4);
_bgOpcodePC = 0;
- return true;
+ return true;
}
void Script::debugScript(const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;
- va_start(va, s);
- vsnprintf(buf, STRINGBUFLEN, s, va);
- va_end(va);
+ va_start(va, s);
+ vsnprintf(buf, STRINGBUFLEN, s, va);
+ va_end(va);
Common::String str = Common::String::format("@0x%04X: ", _lastInstruction);
str += Common::String::format("op %04d: ", _lastOpcode);
@@ -124,28 +124,28 @@ uint32 Script::step(uint32 opcodePC) {
}
uint8 Script::getCodeByte(uint32 address) {
- if (address >= _codeSize)
- error("Trying to read a script byte at address 0x%04X, while the "
- "script is just 0x%04X bytes long", address, _codeSize);
- return _code[address];
+ if (address >= _codeSize)
+ error("Trying to read a script byte at address 0x%04X, while the "
+ "script is just 0x%04X bytes long", address, _codeSize);
+ return _code[address];
}
uint8 Script::readScript8bits() {
- uint8 data = getCodeByte(_currentInstruction);
- _currentInstruction++;
- return data;
+ uint8 data = getCodeByte(_currentInstruction);
+ _currentInstruction++;
+ return data;
}
uint16 Script::readScript16bits() {
- uint8 lower = readScript8bits();
- uint8 upper = readScript8bits();
- return lower | (upper << 8);
+ uint8 lower = readScript8bits();
+ uint8 upper = readScript8bits();
+ return lower | (upper << 8);
}
uint32 Script::readScript32bits() {
- uint16 lower = readScript16bits();
- uint16 upper = readScript16bits();
- return lower | (upper << 16);
+ uint16 lower = readScript16bits();
+ uint16 upper = readScript16bits();
+ return lower | (upper << 16);
}
void Script::O_WAITFOREVER() {
@@ -316,6 +316,7 @@ void Script::O__CALL() {
_currentInstruction += address - 4;
debugScript("O__CALL 0x%04X", _currentInstruction);
}
+
void Script::O_RETURN() {
// Get the return address
if (_stacktop > 0) {
@@ -326,11 +327,13 @@ void Script::O_RETURN() {
error("Return: Stack is empty");
}
}
+
void Script::O_GO() {
int32 opPC = readScript32bits();
debugScript("O_GO 0x%04X", opPC);
_currentInstruction += opPC - 4;
}
+
void Script::O_BACKANIMUPDATEOFF() {
uint16 slotId = readScript32bits();
debugScript("O_BACKANIMUPDATEOFF slotId %d", slotId);