CRYOMNI3D: Rename unsigned int to uint

This commit is contained in:
Le Philousophe 2019-05-26 18:29:57 +02:00 committed by Eugene Sandulenko
parent 222f6b0e4c
commit ff197718c2
32 changed files with 607 additions and 606 deletions

View File

@ -136,7 +136,7 @@ void CryOmni3DEngine::playHNM(const Common::String &filename, Audio::Mixer::Soun
uint16 height = videoDecoder->getHeight();
bool skipVideo = false;
unsigned int frameNum = 0;
uint frameNum = 0;
while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
if (videoDecoder->needsUpdate()) {
const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
@ -224,7 +224,7 @@ void CryOmni3DEngine::setCursor(const Graphics::Cursor &cursor) const {
cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor());
}
void CryOmni3DEngine::setCursor(unsigned int cursorId) const {
void CryOmni3DEngine::setCursor(uint cursorId) const {
const Graphics::Cursor &cursor = _sprites.getCursor(cursorId);
g_system->setMouseCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(),
cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor());
@ -234,7 +234,7 @@ bool CryOmni3DEngine::pollEvents() {
Common::Event event;
bool hasEvents = false;
unsigned int oldMouseButton = getCurrentMouseButton();
uint oldMouseButton = getCurrentMouseButton();
while (g_system->getEventManager()->pollEvent(event)) {
if (event.type == Common::EVENT_KEYDOWN) {
@ -245,7 +245,7 @@ bool CryOmni3DEngine::pollEvents() {
g_system->delayMillis(10);
_dragStatus = kDragStatus_NoDrag;
unsigned int currentMouseButton = getCurrentMouseButton();
uint currentMouseButton = getCurrentMouseButton();
if (!oldMouseButton && currentMouseButton == 1) {
// Starting the drag
_dragStatus = kDragStatus_Pressed;
@ -276,11 +276,11 @@ bool CryOmni3DEngine::pollEvents() {
return hasEvents;
}
void CryOmni3DEngine::setAutoRepeatClick(unsigned int millis) {
void CryOmni3DEngine::setAutoRepeatClick(uint millis) {
_autoRepeatNextEvent = g_system->getMillis() + millis;
}
unsigned int CryOmni3DEngine::getCurrentMouseButton() {
uint CryOmni3DEngine::getCurrentMouseButton() {
int mask = g_system->getEventManager()->getButtonState();
if (mask & 0x1) {
return 1;
@ -325,13 +325,13 @@ bool CryOmni3DEngine::checkKeysPressed() {
}
}
bool CryOmni3DEngine::checkKeysPressed(unsigned int numKeys, ...) {
bool CryOmni3DEngine::checkKeysPressed(uint numKeys, ...) {
bool found = false;
Common::KeyCode kc = getNextKey().keycode;
while (!found && kc != Common::KEYCODE_INVALID) {
va_list va;
va_start(va, numKeys);
for (unsigned int i = 0; i < numKeys; i++) {
for (uint i = 0; i < numKeys; i++) {
// Compiler says that KeyCode is promoted to int, so we need this ugly cast
Common::KeyCode match = (Common::KeyCode) va_arg(va, int);
if (match == kc) {
@ -372,19 +372,19 @@ void CryOmni3DEngine::fadeOutPalette() {
uint16 delta[256 * 3];
g_system->getPaletteManager()->grabPalette(palOut, 0, 256);
for (unsigned int i = 0; i < 256 * 3; i++) {
for (uint i = 0; i < 256 * 3; i++) {
palWork[i] = palOut[i] << 8;
delta[i] = palWork[i] / 25;
}
for (unsigned int step = 0; step < 25 && !g_engine->shouldQuit(); step++) {
for (unsigned int i = 0; i < 256 * 3; i++) {
for (uint step = 0; step < 25 && !g_engine->shouldQuit(); step++) {
for (uint i = 0; i < 256 * 3; i++) {
palWork[i] -= delta[i];
palOut[i] = palWork[i] >> 8;
}
setPalette(palOut, 0, 256);
// Wait 50ms between each steps but refresh screen every 10ms
for (unsigned int i = 0; i < 5; i++) {
for (uint i = 0; i < 5; i++) {
g_system->updateScreen();
g_system->delayMillis(10);
}
@ -399,19 +399,19 @@ void CryOmni3DEngine::fadeInPalette(const byte *palette) {
memset(palOut, 0, sizeof(palOut));
memset(palWork, 0, sizeof(palWork));
for (unsigned int i = 0; i < 256 * 3; i++) {
for (uint i = 0; i < 256 * 3; i++) {
delta[i] = (palette[i] << 8) / 25;
}
setBlackPalette();
for (unsigned int step = 0; step < 25 && !g_engine->shouldQuit(); step++) {
for (unsigned int i = 0; i < 256 * 3; i++) {
for (uint step = 0; step < 25 && !g_engine->shouldQuit(); step++) {
for (uint i = 0; i < 256 * 3; i++) {
palWork[i] += delta[i];
palOut[i] = palWork[i] >> 8;
}
setPalette(palOut, 0, 256);
// Wait 50ms between each steps but refresh screen every 10ms
for (unsigned int i = 0; i < 5; i++) {
for (uint i = 0; i < 5; i++) {
g_system->updateScreen();
g_system->delayMillis(10);
}

View File

@ -107,8 +107,8 @@ public:
void fillSurface(byte color);
void setCursor(const Graphics::Cursor &cursor) const;
void setCursor(unsigned int cursorId) const;
typedef void (CryOmni3DEngine::*HNMCallback)(unsigned int frameNum);
void setCursor(uint cursorId) const;
typedef void (CryOmni3DEngine::*HNMCallback)(uint frameNum);
void playHNM(const Common::String &filename,
Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType,
HNMCallback beforeDraw = nullptr, HNMCallback afterDraw = nullptr);
@ -117,13 +117,13 @@ public:
bool pollEvents();
Common::Point getMousePos();
void setMousePos(const Common::Point &point);
unsigned int getCurrentMouseButton();
uint getCurrentMouseButton();
Common::KeyState getNextKey();
bool checkKeysPressed();
bool checkKeysPressed(unsigned int numKeys, ...);
bool checkKeysPressed(uint numKeys, ...);
void clearKeys() { _keysPressed.clear(); }
void waitMouseRelease();
void setAutoRepeatClick(unsigned int millis);
void setAutoRepeatClick(uint millis);
DragStatus getDragStatus() { return _dragStatus; }
Common::String prepareFileName(const Common::String &baseName, const char *extension) const {
@ -136,7 +136,7 @@ public:
virtual bool displayToolbar(const Graphics::Surface *original) = 0;
virtual bool hasPlaceDocumentation() = 0;
virtual bool displayPlaceDocumentation() = 0;
virtual unsigned int displayOptions() = 0;
virtual uint displayOptions() = 0;
virtual bool shouldAbort() { return g_engine->shouldQuit(); }
virtual void makeTranslucent(Graphics::Surface &dst, const Graphics::Surface &src) const = 0;
@ -161,11 +161,11 @@ protected:
DragStatus _dragStatus;
Common::Point _dragStart;
unsigned int _autoRepeatNextEvent;
uint _autoRepeatNextEvent;
private:
unsigned int _lockPaletteStartRW;
unsigned int _lockPaletteEndRW;
uint _lockPaletteStartRW;
uint _lockPaletteEndRW;
};
} // End of namespace CryOmni3D

View File

@ -42,7 +42,7 @@ void DialogsManager::loadGTO(const Common::String &gtoFileName) {
delete[] _gtoBuffer;
_gtoBuffer = nullptr;
unsigned int gtoSize = gtoFile.size();
uint gtoSize = gtoFile.size();
_gtoBuffer = new char[gtoSize];
gtoFile.read(_gtoBuffer, gtoSize);
gtoFile.close();
@ -54,7 +54,7 @@ void DialogsManager::loadGTO(const Common::String &gtoFileName) {
void DialogsManager::populateLabels() {
/* Get labels count and populate the labels array */
unsigned int numLabels;
uint numLabels;
const char *labelsP = strstr(_gtoBuffer, "LABELS=");
if (labelsP) {
labelsP += sizeof("LABELS=") - 1;
@ -77,7 +77,7 @@ void DialogsManager::populateLabels() {
}
const char *DialogsManager::findLabel(const char *label, const char **realLabel) const {
unsigned int labelLen = 0;
uint labelLen = 0;
/* Truncate input label */
for (const char *labelP = label;
*labelP != '\0' &&
@ -115,7 +115,7 @@ Common::String DialogsManager::getLabelSound(const char *label) const {
}
const char *DialogsManager::findSequence(const char *sequence) const {
unsigned int sequenceLen = strlen(sequence);
uint sequenceLen = strlen(sequence);
const char *lineP;
for (lineP = _gtoBuffer; lineP != nullptr; lineP = nextLine(lineP)) {
@ -226,7 +226,7 @@ const char *DialogsManager::previousMatch(const char *currentPtr, const char *st
return nullptr;
}
unsigned int matchLen = strlen(str);
uint matchLen = strlen(str);
for (; currentPtr >= _gtoBuffer; currentPtr--) {
if (*currentPtr == str[0]) {
if (!strncmp(currentPtr, str, matchLen)) {
@ -308,7 +308,7 @@ bool DialogsManager::play(const Common::String &sequence, bool &slowStop) {
for (; *questionEnd != '>'; questionEnd++) { }
questions.push_back(Common::String(questionStart, questionEnd));
}
unsigned int eocInserted = -1;
uint eocInserted = -1;
if (!endOfConversationFound && questions.size() > 0) {
eocInserted = questions.size();
questions.push_back(_endOfConversationText);
@ -321,7 +321,7 @@ bool DialogsManager::play(const Common::String &sequence, bool &slowStop) {
if (gotoList[0].label.hasPrefix("JOU")) {
// We must give a subject
unsigned int playerChoice = askPlayerQuestions(video, questions);
uint playerChoice = askPlayerQuestions(video, questions);
didSomething = true;
// -1 when shouldQuit
if (playerChoice == -1u || playerChoice == eocInserted) {

View File

@ -48,14 +48,14 @@ public:
_ignoreNoEndOfConversation(false) { }
virtual ~DialogsManager();
void init(unsigned int size, const Common::String &endOfConversationText) { _dialogsVariables.resize(size); _endOfConversationText = endOfConversationText; }
void init(uint size, const Common::String &endOfConversationText) { _dialogsVariables.resize(size); _endOfConversationText = endOfConversationText; }
void loadGTO(const Common::String &gtoFile);
void setupVariable(unsigned int id, const Common::String &variable) { _dialogsVariables[id] = DialogVariable(variable, 'N'); }
void setupVariable(uint id, const Common::String &variable) { _dialogsVariables[id] = DialogVariable(variable, 'N'); }
void reinitVariables();
unsigned int size() const { return _dialogsVariables.size(); }
byte &operator[](unsigned int idx) { return _dialogsVariables[idx].value; }
const byte &operator[](unsigned int idx) const { return _dialogsVariables[idx].value; }
uint size() const { return _dialogsVariables.size(); }
byte &operator[](uint idx) { return _dialogsVariables[idx].value; }
const byte &operator[](uint idx) const { return _dialogsVariables[idx].value; }
byte &operator[](const Common::String &name) { return find(name).value; }
const byte &operator[](const Common::String &name) const { return find(name).value; }
@ -69,8 +69,8 @@ protected:
virtual void playDialog(const Common::String &video, const Common::String &sound,
const Common::String &text, const SubtitlesSettings &settings) = 0;
virtual void displayMessage(const Common::String &text) = 0;
virtual unsigned int askPlayerQuestions(const Common::String &video,
const Common::StringArray &questions) = 0;
virtual uint askPlayerQuestions(const Common::String &video,
const Common::StringArray &questions) = 0;
private:
struct Goto {

View File

@ -163,7 +163,7 @@ void ZonFixedImage::loadZones(const Common::String &image) {
}
}
Common::Point ZonFixedImage::getZoneCenter(unsigned int zoneId) const {
Common::Point ZonFixedImage::getZoneCenter(uint zoneId) const {
if (zoneId >= _zones.size()) {
error("Invalid zoneId %u/%u", zoneId, _zones.size());
}

View File

@ -35,16 +35,16 @@ struct Surface;
namespace CryOmni3D {
struct FixedImageConfiguration {
unsigned int spriteNothing;
unsigned int spriteLow;
unsigned int spriteHigh;
unsigned int spriteLeft;
unsigned int spriteRight;
unsigned int spriteQuestion;
unsigned int spriteListen;
unsigned int spriteSee;
unsigned int spriteUse;
unsigned int spriteSpeak;
uint spriteNothing;
uint spriteLow;
uint spriteHigh;
uint spriteLeft;
uint spriteRight;
uint spriteQuestion;
uint spriteListen;
uint spriteSee;
uint spriteUse;
uint spriteSpeak;
int16 toolbarTriggerY;
};
@ -74,13 +74,13 @@ public:
void updateSurface(const Graphics::Surface *newSurface);
const Graphics::Surface *surface() const { return _imageSurface; }
void changeCallback(CallbackFunctor *callback) { delete _callback; _callback = callback; }
Common::Point getZoneCenter(unsigned int zoneId) const;
void disableZone(unsigned int zoneId) { _zones[zoneId].valid = false; }
Common::Point getZoneCenter(uint zoneId) const;
void disableZone(uint zoneId) { _zones[zoneId].valid = false; }
ZonesMode _zonesMode;
/* These attributes are read by the image handler to check what action player did */
unsigned int _currentZone;
uint _currentZone;
bool _exit;
bool _zoneLow;
bool _zoneHigh;

View File

@ -73,10 +73,10 @@ void FontManager::loadFont(Common::ReadStream &font_fl) {
font_fl.read(font->comment, sizeof(font->comment));
//debug("Comment %s", font.comment);
for (unsigned int i = 0; i < Font::kCharactersCount; i++) {
for (uint i = 0; i < Font::kCharactersCount; i++) {
uint16 h = font_fl.readUint16BE();
uint16 w = font_fl.readUint16BE();
unsigned int sz = font->chars[i].setup(w, h);
uint sz = font->chars[i].setup(w, h);
//debug("Char %d sz %dx%d %d", i, w, h, sz);
font->chars[i].offX = font_fl.readSint16BE();
font->chars[i].offY = font_fl.readSint16BE();
@ -100,7 +100,7 @@ void FontManager::setCurrentFont(int currentFont) {
setSpaceWidth(0);
}
void FontManager::setSpaceWidth(unsigned int additionalSpace) {
void FontManager::setSpaceWidth(uint additionalSpace) {
if (_currentFont) {
_spaceWidth = additionalSpace + _currentFont->chars[0].printedWidth;
} else {
@ -108,16 +108,16 @@ void FontManager::setSpaceWidth(unsigned int additionalSpace) {
}
}
unsigned int FontManager::displayStr_(unsigned int x, unsigned int y,
const Common::String &text) const {
unsigned int offset = 0;
uint FontManager::displayStr_(uint x, uint y,
const Common::String &text) const {
uint offset = 0;
for (Common::String::const_iterator it = text.begin(); it != text.end(); it++) {
offset += displayChar(x + offset, y, *it);
}
return offset;
}
unsigned int FontManager::displayChar(unsigned int x, unsigned int y, unsigned char c) const {
uint FontManager::displayChar(uint x, uint y, unsigned char c) const {
if (!_currentFont) {
error("There is no current font");
}
@ -154,8 +154,8 @@ unsigned int FontManager::displayChar(unsigned int x, unsigned int y, unsigned c
#endif
}
unsigned int FontManager::getStrWidth(const Common::String &text) const {
unsigned int width = 0;
uint FontManager::getStrWidth(const Common::String &text) const {
uint width = 0;
for (Common::String::const_iterator it = text.begin(); it != text.end(); it++) {
unsigned char c = *it;
if (c == ' ') {
@ -181,12 +181,12 @@ bool FontManager::displayBlockText(const Common::String &text,
if (begin != text.end()) {
_blockTextRemaining = nullptr;
while (ptr != text.end() && !notEnoughSpace) {
unsigned int finalPos;
uint finalPos;
bool has_cr;
calculateWordWrap(text, &ptr, &finalPos, &has_cr, words);
unsigned int spacesWidth = (words.size() - 1) * _spaceWidth;
unsigned int remainingSpace = (_blockRect.right - finalPos);
unsigned int spaceConsumed = 0;
uint spacesWidth = (words.size() - 1) * _spaceWidth;
uint remainingSpace = (_blockRect.right - finalPos);
uint spaceConsumed = 0;
double spaceWidthPerWord;
if (words.size() == 1) {
spaceWidthPerWord = _spaceWidth;
@ -194,7 +194,7 @@ bool FontManager::displayBlockText(const Common::String &text,
spaceWidthPerWord = (double)spacesWidth / (double)words.size();
}
Common::Array<Common::String>::const_iterator word;
unsigned int word_i;
uint word_i;
for (word = words.begin(), word_i = 0; word != words.end(); word++, word_i++) {
_blockPos.x += displayStr_(_blockPos.x, _blockPos.y, *word);
if (!_justifyText || has_cr) {
@ -218,7 +218,7 @@ bool FontManager::displayBlockText(const Common::String &text,
return notEnoughSpace;
}
unsigned int FontManager::getLinesCount(const Common::String &text, unsigned int width) {
uint FontManager::getLinesCount(const Common::String &text, uint width) {
if (text.size() == 0) {
// One line even if it's empty
return 1;
@ -228,13 +228,13 @@ unsigned int FontManager::getLinesCount(const Common::String &text, unsigned int
return getStrWidth(text) / width + 3;
}
unsigned int lineCount = 0;
uint lineCount = 0;
Common::String::const_iterator textP = text.begin();
unsigned int len = text.size();
uint len = text.size();
while (len > 0) {
Common::String buffer;
unsigned int lineWidth = 0;
uint lineWidth = 0;
lineCount++;
while (lineWidth < width && len > 0 && *textP != '\r') {
buffer += *(textP++);
@ -277,12 +277,12 @@ unsigned int FontManager::getLinesCount(const Common::String &text, unsigned int
}
void FontManager::calculateWordWrap(const Common::String &text,
Common::String::const_iterator *position, unsigned int *finalPos, bool *hasCr,
Common::String::const_iterator *position, uint *finalPos, bool *hasCr,
Common::Array<Common::String> &words) const {
*hasCr = false;
unsigned int offset = 0;
uint offset = 0;
bool wordWrap = false;
unsigned int lineWidth = _blockRect.right - _blockRect.left;
uint lineWidth = _blockRect.right - _blockRect.left;
Common::String::const_iterator ptr = *position;
words.clear();
@ -299,7 +299,7 @@ void FontManager::calculateWordWrap(const Common::String &text,
Common::String::const_iterator begin = ptr;
for (; ptr != text.end() && *ptr != '\r' && *ptr != ' '; ptr++) { }
Common::String word(begin, ptr);
unsigned int width = getStrWidth(word);
uint width = getStrWidth(word);
if (width + offset >= lineWidth) {
wordWrap = true;
// word is too long: just put pointer back at begining
@ -329,10 +329,10 @@ FontManager::Character::~Character() {
delete[] data;
}
unsigned int FontManager::Character::setup(uint16 width, uint16 height) {
uint FontManager::Character::setup(uint16 width, uint16 height) {
w = width;
h = height;
unsigned int sz = w * h;
uint sz = w * h;
data = new byte[sz];
return sz;
}

View File

@ -44,22 +44,22 @@ public:
void loadFonts(const Common::Array<Common::String> &fontFiles);
void setCurrentFont(int currentFont);
unsigned int getCurrentFont() { return _currentFontId; }
uint getCurrentFont() { return _currentFontId; }
void setTransparentBackground(bool transparent) { _transparentBackground = transparent; }
void setSpaceWidth(unsigned int additionalSpace);
void setSpaceWidth(uint additionalSpace);
void setForeColor(byte color) { _foreColor = color; }
void setLineHeight(int h) { _lineHeight = h; }
int lineHeight() { return _lineHeight; }
void setCharSpacing(unsigned int w) { _charSpacing = w; }
void setCharSpacing(uint w) { _charSpacing = w; }
void setSurface(Graphics::ManagedSurface *surface) { _currentSurface = surface; }
int getFontMaxHeight() { return _currentFont->maxHeight; }
void displayInt(unsigned int x, unsigned int y, int value) const { displayStr_(x, y, Common::String::format("%d", value)); }
void displayStr(unsigned int x, unsigned int y, const Common::String &text) const { displayStr_(x, y, text); }
unsigned int getStrWidth(const Common::String &text) const;
void displayInt(uint x, uint y, int value) const { displayStr_(x, y, Common::String::format("%d", value)); }
void displayStr(uint x, uint y, const Common::String &text) const { displayStr_(x, y, text); }
uint getStrWidth(const Common::String &text) const;
unsigned int getLinesCount(const Common::String &text, unsigned int width);
uint getLinesCount(const Common::String &text, uint width);
void setupBlock(const Common::Rect &block, bool justifyText = false) { _blockRect = block; _blockPos.x = block.left; _blockPos.y = block.top; _justifyText = justifyText; }
bool displayBlockText(const Common::String &text) { return displayBlockText(text, text.begin()); }
@ -69,10 +69,10 @@ public:
private:
void loadFont(Common::ReadStream &font_fl);
unsigned int displayStr_(unsigned int x, unsigned int y, const Common::String &text) const;
unsigned int displayChar(unsigned int x, unsigned int y, unsigned char c) const;
uint displayStr_(uint x, uint y, const Common::String &text) const;
uint displayChar(uint x, uint y, unsigned char c) const;
void calculateWordWrap(const Common::String &text, Common::String::const_iterator *position,
unsigned int *finalPos, bool *has_br, Common::Array<Common::String> &words) const;
uint *finalPos, bool *has_br, Common::Array<Common::String> &words) const;
struct Character {
uint16 h;
@ -86,7 +86,7 @@ private:
Character();
~Character();
unsigned int setup(uint16 width, uint16 height);
uint setup(uint16 width, uint16 height);
};
struct Font {
@ -99,10 +99,10 @@ private:
Common::Array<Font *> _fonts;
const Font *_currentFont;
unsigned int _currentFontId;
uint _currentFontId;
bool _transparentBackground;
unsigned int _spaceWidth;
unsigned int _charSpacing;
uint _spaceWidth;
uint _charSpacing;
byte _foreColor;

View File

@ -28,7 +28,7 @@
namespace CryOmni3D {
MouseBoxes::MouseBoxes(unsigned int size) {
MouseBoxes::MouseBoxes(uint size) {
_boxes.resize(size);
}
@ -36,7 +36,7 @@ MouseBoxes::~MouseBoxes() {
}
void MouseBoxes::reset() {
unsigned int sz = _boxes.size();
uint sz = _boxes.size();
_boxes.clear();
_boxes.resize(sz);
}

View File

@ -37,7 +37,7 @@ class FontManager;
class MouseBoxes {
public:
MouseBoxes(unsigned int size);
MouseBoxes(uint size);
virtual ~MouseBoxes();
void reset();

View File

@ -25,7 +25,7 @@
namespace CryOmni3D {
Object *Objects::findObjectByNameID(unsigned int nameID) {
Object *Objects::findObjectByNameID(uint nameID) {
for (iterator it = begin(); it != end(); it++) {
if (it->valid() && it->idOBJ() == nameID) {
return it;
@ -34,7 +34,7 @@ Object *Objects::findObjectByNameID(unsigned int nameID) {
error("nameID not found %u", nameID);
}
Object *Objects::findObjectByIconID(unsigned int iconID) {
Object *Objects::findObjectByIconID(uint iconID) {
for (iterator it = begin(); it != end(); it++) {
if (it->valid() && it->idCA() == iconID) {
return it;
@ -60,12 +60,12 @@ void Inventory::add(Object *obj) {
error("No more room in inventory");
}
void Inventory::remove(unsigned int position) {
void Inventory::remove(uint position) {
(*this)[position] = nullptr;
(*_changeCallback)(-1u);
}
void Inventory::removeByIconID(unsigned int iconID) {
void Inventory::removeByIconID(uint iconID) {
for (iterator it = begin(); it != end(); it++) {
if ((*it) && (*it)->idCA() == iconID) {
deselectObject();
@ -76,7 +76,7 @@ void Inventory::removeByIconID(unsigned int iconID) {
// Don't bail out
}
void Inventory::removeByNameID(unsigned int nameID) {
void Inventory::removeByNameID(uint nameID) {
for (iterator it = begin(); it != end(); it++) {
if ((*it) && (*it)->idOBJ() == nameID) {
deselectObject();
@ -87,7 +87,7 @@ void Inventory::removeByNameID(unsigned int nameID) {
// Don't bail out
}
bool Inventory::inInventoryByIconID(unsigned int iconID) const {
bool Inventory::inInventoryByIconID(uint iconID) const {
for (const_iterator it = begin(); it != end(); it++) {
if ((*it) && (*it)->idCA() == iconID) {
return true;
@ -96,7 +96,7 @@ bool Inventory::inInventoryByIconID(unsigned int iconID) const {
return false;
}
bool Inventory::inInventoryByNameID(unsigned int nameID) const {
bool Inventory::inInventoryByNameID(uint nameID) const {
for (const_iterator it = begin(); it != end(); it++) {
if ((*it) && (*it)->idOBJ() == nameID) {
return true;

View File

@ -38,39 +38,39 @@ public:
Object() : _valid(false), _idCA(-1), _idCl(-1), _idSA(-1), _idSl(-1), _idOBJ(-1),
_viewCallback(nullptr) {}
Object(const Sprites &sprites, unsigned int idCA, unsigned int idOBJ) : _idCA(idCA),
Object(const Sprites &sprites, uint idCA, uint idOBJ) : _idCA(idCA),
_idCl(sprites.calculateSpriteId(idCA, 1)), _idSA(sprites.calculateSpriteId(idCA, 2)),
_idSl(sprites.calculateSpriteId(idCA, 3)),
_valid(true), _idOBJ(idOBJ), _viewCallback(nullptr) {}
~Object() { delete _viewCallback; }
unsigned int valid() const { return _valid; }
unsigned int idCA() const { return _idCA; }
unsigned int idCl() const { return _idCl; }
unsigned int idSA() const { return _idSA; }
unsigned int idSl() const { return _idSl; }
unsigned int idOBJ() const { return _idOBJ; }
uint valid() const { return _valid; }
uint idCA() const { return _idCA; }
uint idCl() const { return _idCl; }
uint idSA() const { return _idSA; }
uint idSl() const { return _idSl; }
uint idOBJ() const { return _idOBJ; }
ViewCallback viewCallback() const { return _viewCallback; }
// Takes ownership of the pointer
void setViewCallback(ViewCallback callback) { _viewCallback = callback; }
void rename(unsigned int newIdOBJ) { _idOBJ = newIdOBJ; }
void rename(uint newIdOBJ) { _idOBJ = newIdOBJ; }
private:
unsigned int _idOBJ;
unsigned int _idCA;
unsigned int _idCl;
unsigned int _idSA;
unsigned int _idSl;
uint _idOBJ;
uint _idCA;
uint _idCl;
uint _idSA;
uint _idSl;
bool _valid;
ViewCallback _viewCallback;
};
class Objects : public Common::Array<Object> {
public:
Object *findObjectByNameID(unsigned int nameID);
Object *findObjectByIconID(unsigned int iconID);
Object *findObjectByNameID(uint nameID);
Object *findObjectByIconID(uint iconID);
private:
};
@ -78,15 +78,15 @@ class Inventory : public Common::Array<Object *> {
public:
Inventory() : _selectedObject(nullptr), _changeCallback(nullptr) { }
~Inventory() { delete _changeCallback; }
void init(unsigned int count, Common::Functor1<unsigned int, void> *changeCallback) { _changeCallback = changeCallback; resize(count); }
void init(uint count, Common::Functor1<uint, void> *changeCallback) { _changeCallback = changeCallback; resize(count); }
void clear();
void add(Object *);
void remove(unsigned int position);
void removeByNameID(unsigned int nameID);
void removeByIconID(unsigned int iconID);
bool inInventoryByNameID(unsigned int nameID) const;
bool inInventoryByIconID(unsigned int iconID) const;
void remove(uint position);
void removeByNameID(uint nameID);
void removeByIconID(uint iconID);
bool inInventoryByNameID(uint nameID) const;
bool inInventoryByIconID(uint iconID) const;
Object *selectedObject() const { return _selectedObject; }
void setSelectedObject(Object *obj) { _selectedObject = obj; }
@ -94,7 +94,7 @@ public:
private:
Object *_selectedObject;
Common::Functor1<unsigned int, void> *_changeCallback;
Common::Functor1<uint, void> *_changeCallback;
};
} // End of namespace CryOmni3D

View File

@ -142,14 +142,14 @@ void Omni3DManager::updateImageCoords() {
double tmp = (2048 * 65536) - 2048 * 65536 / (2. * M_PI) * _alpha;
unsigned int k = 0;
for (unsigned int i = 0; i < 31; i++) {
uint k = 0;
for (uint i = 0; i < 31; i++) {
double v11 = _anglesH[i] + _beta;
double v26 = sin(v11);
double v25 = cos(v11) * _hypothenusesH[i];
unsigned int offset = 80;
unsigned int j;
uint offset = 80;
uint j;
for (j = 0; j < 20; j++) {
double v16 = atan2(_oppositeV[j], v25);
double v17 = v16 * _helperValue;
@ -187,12 +187,12 @@ const Graphics::Surface *Omni3DManager::getSurface() {
}
if (_dirty) {
unsigned int off = 2;
uint off = 2;
byte *dst = (byte *)_surface.getBasePtr(0, 0);
const byte *src = (const byte *)_sourceSurface->getBasePtr(0, 0);
for (unsigned int i = 0; i < 30; i++) {
for (unsigned int j = 0; j < 40; j++) {
for (uint i = 0; i < 30; i++) {
for (uint j = 0; j < 40; j++) {
int x1 = (_imageCoords[off + 2] - _imageCoords[off + 0]) >> 4;
int y1 = (_imageCoords[off + 3] - _imageCoords[off + 1]) >> 4;
int x1_ = (_imageCoords[off + 82 + 2] - _imageCoords[off + 82 + 0]) >> 4;
@ -208,14 +208,14 @@ const Graphics::Surface *Omni3DManager::getSurface() {
int x2 = (((_imageCoords[off + 0] >> 0) * 2) + dx2) >> 1;
int y2 = (((_imageCoords[off + 1] >> 5) * 2) + dy2) >> 1;
for (unsigned int y = 0; y < 16; y++) {
unsigned int px = (x2 * 2 + x1) * 16;
unsigned int py = (y2 * 2 + y1) / 2;
unsigned int deltaX = x1 * 32;
unsigned int deltaY = y1;
for (uint y = 0; y < 16; y++) {
uint px = (x2 * 2 + x1) * 16;
uint py = (y2 * 2 + y1) / 2;
uint deltaX = x1 * 32;
uint deltaY = y1;
for (unsigned int x = 0; x < 16; x++) {
unsigned int srcOff = (py & 0x1ff800) | (px >> 21);
for (uint x = 0; x < 16; x++) {
uint srcOff = (py & 0x1ff800) | (px >> 21);
dst[x] = src[srcOff];
px += deltaX;
py += deltaY;
@ -257,7 +257,7 @@ Common::Point Omni3DManager::mapMouseCoords(const Common::Point &mouse) {
int smallX = mouse.x & 0xf, squareX = mouse.x >> 4;
int smallY = mouse.y & 0xf, squareY = mouse.y >> 4;
unsigned int off = 82 * squareY + 2 * squareX;
uint off = 82 * squareY + 2 * squareX;
pt.x = ((_imageCoords[off + 2] +
smallY * ((_imageCoords[off + 84] - _imageCoords[off + 2]) >> 4) +

View File

@ -72,7 +72,7 @@ void Sprites::loadSprites(Common::ReadStream &spr_fl) {
uint16 w = spr_fl.readUint16BE();
uint16 h = spr_fl.readUint16BE();
unsigned int sz = cursor->setup(w, h);
uint sz = cursor->setup(w, h);
cursor->_offX = spr_fl.readUint32BE();
cursor->_offY = spr_fl.readUint32BE();
@ -81,7 +81,7 @@ void Sprites::loadSprites(Common::ReadStream &spr_fl) {
}
}
void Sprites::setupMapTable(const unsigned int *table, unsigned int size) {
void Sprites::setupMapTable(const uint *table, uint size) {
delete _map;
_map = nullptr;
// Reset the reverse mapping
@ -89,11 +89,11 @@ void Sprites::setupMapTable(const unsigned int *table, unsigned int size) {
(*it)->_constantId = -1;
}
if (table) {
_map = new Common::Array<unsigned int>(table, size);
_map = new Common::Array<uint>(table, size);
// Sweep all the mapping and set its reverse values
unsigned int i = 0;
for (Common::Array<unsigned int>::const_iterator it = _map->begin(); it != _map->end(); it++, i++) {
uint i = 0;
for (Common::Array<uint>::const_iterator it = _map->begin(); it != _map->end(); it++, i++) {
_cursors[*it]->_constantId = i;
}
@ -101,7 +101,7 @@ void Sprites::setupMapTable(const unsigned int *table, unsigned int size) {
// Normally we don't have any unreachable sprties from constants,
// as it could be time consuming, this should be fixed in the static map
// Count unswept values
unsigned int unswept = 0;
uint unswept = 0;
for (Common::Array<CryoCursor *>::iterator it = _cursors.begin(); it != _cursors.end(); it++) {
if ((*it)->_constantId == -1u) {
unswept++;
@ -128,13 +128,13 @@ void Sprites::setupMapTable(const unsigned int *table, unsigned int size) {
}
}
void Sprites::setSpriteHotspot(unsigned int spriteId, unsigned int x, unsigned int y) {
void Sprites::setSpriteHotspot(uint spriteId, uint x, uint y) {
MAP_ID(spriteId);
_cursors[spriteId]->_offX = x;
_cursors[spriteId]->_offY = y;
}
void Sprites::replaceSprite(unsigned int oldSpriteId, unsigned int newSpriteId) {
void Sprites::replaceSprite(uint oldSpriteId, uint newSpriteId) {
MAP_ID(oldSpriteId);
MAP_ID(newSpriteId);
if (_cursors[oldSpriteId]->refCnt > 1) {
@ -146,11 +146,11 @@ void Sprites::replaceSprite(unsigned int oldSpriteId, unsigned int newSpriteId)
_cursors[oldSpriteId]->refCnt++;
}
void Sprites::replaceSpriteColor(unsigned int spriteId, byte currentColor, byte newColor) {
void Sprites::replaceSpriteColor(uint spriteId, byte currentColor, byte newColor) {
MAP_ID(spriteId);
byte *data = _cursors[spriteId]->_data;
unsigned int size = _cursors[spriteId]->_width * _cursors[spriteId]->_height;
uint size = _cursors[spriteId]->_width * _cursors[spriteId]->_height;
for (; size > 0; size--, data++) {
if (*data == currentColor) {
*data = newColor;
@ -158,7 +158,7 @@ void Sprites::replaceSpriteColor(unsigned int spriteId, byte currentColor, byte
}
}
unsigned int Sprites::getSpritesCount() const {
uint Sprites::getSpritesCount() const {
if (_map) {
return _map->size();
} else {
@ -166,7 +166,7 @@ unsigned int Sprites::getSpritesCount() const {
}
}
unsigned int Sprites::revMapSpriteId(unsigned int id) const {
uint Sprites::revMapSpriteId(uint id) const {
if (_map) {
if (id >= _cursors.size()) {
error("revMapSpriteId is out of bounds: %d/%d", id, _cursors.size());
@ -177,14 +177,14 @@ unsigned int Sprites::revMapSpriteId(unsigned int id) const {
return id;
}
unsigned int Sprites::calculateSpriteId(unsigned int baseId, unsigned int offset) const {
uint Sprites::calculateSpriteId(uint baseId, uint offset) const {
if (_map) {
MAP_ID(baseId);
baseId += offset;
if (baseId >= _cursors.size()) {
error("Calculate sprite is out of bounds: %d/%d", baseId, _cursors.size());
}
unsigned int spriteId = _cursors[baseId]->_constantId;
uint spriteId = _cursors[baseId]->_constantId;
if (spriteId == -1u) {
error("Sprite %d is unreachable", baseId);
}
@ -194,7 +194,7 @@ unsigned int Sprites::calculateSpriteId(unsigned int baseId, unsigned int offset
}
}
const Graphics::Surface &Sprites::getSurface(unsigned int spriteId) const {
const Graphics::Surface &Sprites::getSurface(uint spriteId) const {
MAP_ID(spriteId);
CryoCursor *cursor = _cursors[spriteId];
@ -204,7 +204,7 @@ const Graphics::Surface &Sprites::getSurface(unsigned int spriteId) const {
return *_surface;
}
const Graphics::Cursor &Sprites::getCursor(unsigned int spriteId) const {
const Graphics::Cursor &Sprites::getCursor(uint spriteId) const {
MAP_ID(spriteId);
return *_cursors[spriteId];
@ -219,10 +219,10 @@ Sprites::CryoCursor::~CryoCursor() {
delete[] _data;
}
unsigned int Sprites::CryoCursor::setup(uint16 width, uint16 height) {
uint Sprites::CryoCursor::setup(uint16 width, uint16 height) {
_width = width;
_height = height;
unsigned int sz = _width * _height;
uint sz = _width * _height;
_data = new byte[sz];
return sz;
}

View File

@ -44,23 +44,23 @@ public:
virtual ~Sprites();
void loadSprites(Common::ReadStream &spr_fl);
void setupMapTable(const unsigned int *table, unsigned int size);
void setupMapTable(const uint *table, uint size);
void setSpriteHotspot(unsigned int spriteId, unsigned int x, unsigned int y);
void setSpriteHotspot(uint spriteId, uint x, uint y);
void replaceSprite(unsigned int oldSpriteId, unsigned int newSpriteId);
void replaceSprite(uint oldSpriteId, uint newSpriteId);
unsigned int getSpritesCount() const;
uint getSpritesCount() const;
void replaceSpriteColor(unsigned int spriteId, byte currentColor, byte newColor);
void replaceSpriteColor(uint spriteId, byte currentColor, byte newColor);
const Graphics::Surface &getSurface(unsigned int spriteId) const;
const Graphics::Cursor &getCursor(unsigned int spriteId) const;
const Graphics::Surface &getSurface(uint spriteId) const;
const Graphics::Cursor &getCursor(uint spriteId) const;
unsigned int revMapSpriteId(unsigned int id) const;
unsigned int calculateSpriteId(unsigned int baseId, unsigned int offset) const;
uint revMapSpriteId(uint id) const;
uint calculateSpriteId(uint baseId, uint offset) const;
byte getKeyColor(unsigned int spriteId) const { return 0; }
byte getKeyColor(uint spriteId) const { return 0; }
private:
class CryoCursor : public Graphics::Cursor {
@ -77,17 +77,17 @@ private:
virtual byte getPaletteStartIndex() const override { return 0; }
virtual uint16 getPaletteCount() const override { return 0; }
unsigned int setup(uint16 width, uint16 height);
uint setup(uint16 width, uint16 height);
uint16 _width;
uint16 _height;
int16 _offX;
int16 _offY;
unsigned int _constantId;
uint _constantId;
byte *_data;
unsigned int refCnt;
uint refCnt;
CryoCursor();
virtual ~CryoCursor();
@ -96,7 +96,7 @@ private:
// Pointer to avoid to mutate Sprites when asking for a cursor
Graphics::Surface *_surface;
Common::Array<CryoCursor *> _cursors;
Common::Array<unsigned int> *_map;
Common::Array<uint> *_map;
};
} // End of namespace CryOmni3D

View File

@ -25,7 +25,7 @@
namespace CryOmni3D {
namespace Versailles {
const unsigned int CryOmni3DEngine_Versailles::kSpritesMapTable[] = {
const uint CryOmni3DEngine_Versailles::kSpritesMapTable[] = {
/* 0 */ 242, 240, 243, 241, 256, 93, 97, 94, 160, 98, 178, 161, 179, 196, 197, 244,
/* 16 */ 142, 245, 143, 254, 95, 99, 113, 96, 100, 180, 114, 181, 73, 144, 74, 250,
/* 32 */ 202, 145, 170, 251, 203, 130, 206, 171, 49, 131, 207, 115, 116, 222, 75, 85,
@ -43,7 +43,7 @@ const unsigned int CryOmni3DEngine_Versailles::kSpritesMapTable[] = {
/* 224 */ 80, 221, 1, 263, 78, 67, 174, 212, 68, 175, 213, 190, 191, 238, 0, 239,
/* 240 */ 224, 77, 146, 2, 147, 79, 158, 176, 159, 177, 194, 192, 195, 193, /*-1u, -1u*/
};
const unsigned int CryOmni3DEngine_Versailles::kSpritesMapTableSize = ARRAYSIZE(kSpritesMapTable);
const uint CryOmni3DEngine_Versailles::kSpritesMapTableSize = ARRAYSIZE(kSpritesMapTable);
const LevelInitialState CryOmni3DEngine_Versailles::kLevelInitialStates[] = {
{ 1, M_PI, 0. }, // Level 1
@ -504,7 +504,7 @@ void CryOmni3DEngine_Versailles::setupDialogVariables() {
SET_DIAL_VARIABLE(136, "{CURRENT_GAME_TIME5}");
SET_DIAL_VARIABLE(137, "{JOUEUR_POSSEDE_EPIGRAPHE}");
#undef SET_DIAL_VARIABLE
for (unsigned int i = 0; i < ARRAYSIZE(videoSubSettings); i++) {
for (uint i = 0; i < ARRAYSIZE(videoSubSettings); i++) {
const VideoSubSetting &vss = videoSubSettings[i];
_dialogsMan.registerSubtitlesSettings(
vss.videoName,

View File

@ -52,7 +52,7 @@ bool Versailles_DialogsManager::play(const Common::String &sequence) {
if (didSth && slowStop) {
if (_engine->showSubtitles()) {
bool skip = false;
unsigned int end = g_system->getMillis() + 2000;
uint end = g_system->getMillis() + 2000;
while (!g_engine->shouldQuit() && g_system->getMillis() < end && !skip) {
g_system->updateScreen();
if (_engine->pollEvents() &&
@ -150,11 +150,11 @@ void Versailles_DialogsManager::playDialog(const Common::String &video, const Co
if (_engine->showSubtitles()) {
Common::Rect block = settings.textRect;
unsigned int lines = fontManager.getLinesCount(text, block.width() - 8);
uint lines = fontManager.getLinesCount(text, block.width() - 8);
if (lines == 0) {
lines = 5;
}
unsigned int blockHeight = fontManager.lineHeight() * lines + 6;
uint blockHeight = fontManager.lineHeight() * lines + 6;
block.setHeight(blockHeight);
if (block.bottom >= 480) {
@ -181,13 +181,13 @@ void Versailles_DialogsManager::playDialog(const Common::String &video, const Co
// Empty wave file
delete audioDecoder;
unsigned int duration = 100 * text.size();
uint duration = 100 * text.size();
if (duration < 1000) {
duration = 1000;
}
bool skipWait = false;
unsigned int end = g_system->getMillis() + duration;
uint end = g_system->getMillis() + duration;
while (!g_engine->shouldQuit() && g_system->getMillis() < end && !skipWait) {
if (_engine->pollEvents() && _engine->checkKeysPressed(1, Common::KEYCODE_SPACE)) {
skipWait = true;
@ -238,7 +238,7 @@ void Versailles_DialogsManager::displayMessage(const Common::String &text) {
_engine->displayMessageBoxWarp(text);
}
unsigned int Versailles_DialogsManager::askPlayerQuestions(const Common::String &video,
uint Versailles_DialogsManager::askPlayerQuestions(const Common::String &video,
const Common::StringArray &questions) {
if (_lastImage.empty()) {
loadFrame(video);
@ -258,11 +258,11 @@ unsigned int Versailles_DialogsManager::askPlayerQuestions(const Common::String
int16 tops[5];
int16 bottoms[5];
int16 currentHeight = 0;
unsigned int questionId = 0;
uint questionId = 0;
for (Common::StringArray::const_iterator it = questions.begin(); it != questions.end();
it++, questionId++) {
tops[questionId] = currentHeight;
unsigned int lines = fontManager.getLinesCount(*it, 598);
uint lines = fontManager.getLinesCount(*it, 598);
if (lines == 0) {
lines = 1;
}
@ -288,7 +288,7 @@ unsigned int Versailles_DialogsManager::askPlayerQuestions(const Common::String
bool finished = false;
bool update = true;
unsigned int selectedQuestion = -1;
uint selectedQuestion = -1;
while (!finished) {
if (update) {
update = false;

View File

@ -50,8 +50,8 @@ protected:
void playDialog(const Common::String &video, const Common::String &sound,
const Common::String &text, const SubtitlesSettings &settings) override;
void displayMessage(const Common::String &text) override;
unsigned int askPlayerQuestions(const Common::String &video,
const Common::StringArray &questions) override;
uint askPlayerQuestions(const Common::String &video,
const Common::StringArray &questions) override;
private:
CryOmni3DEngine_Versailles *_engine;

View File

@ -97,7 +97,7 @@ void Versailles_Documentation::init(const Sprites *sprites, FontManager *fontMan
error("Can't open %s", kAllDocsFile);
}
unsigned int allDocsSize = allDocsFile.size();
uint allDocsSize = allDocsFile.size();
char *allDocs = new char[allDocsSize + 1];
char *end = allDocs + allDocsSize;
allDocsFile.read(allDocs, allDocsSize);
@ -188,7 +188,7 @@ void Versailles_Documentation::handleDocInGame(const Common::String &record) {
bool end = false;
while (!end) {
inGamePrepareRecord(docSurface, boxes);
unsigned int action = inGameHandleRecord(docSurface, boxes, nextRecord);
uint action = inGameHandleRecord(docSurface, boxes, nextRecord);
switch (action) {
case 0:
// Back
@ -280,7 +280,7 @@ Common::String Versailles_Documentation::docAreaHandleSummary() {
Image::BitmapDecoder bmpDecoder;
Common::File file;
for (unsigned int i = 0; i < ARRAYSIZE(categories); i++) {
for (uint i = 0; i < ARRAYSIZE(categories); i++) {
if (!categories[i].bmp) {
// No BMP to load
continue;
@ -330,14 +330,14 @@ Common::String Versailles_Documentation::docAreaHandleSummary() {
g_system->showMouse(true);
bool redraw = true;
unsigned int hoveredBox = -1;
unsigned int selectedBox = -1;
uint hoveredBox = -1;
uint selectedBox = -1;
while (selectedBox == -1u) {
if (redraw) {
// Draw without worrying of already modified areas, that's handled when recomputing hoveredBox
for (unsigned int i = 0; i < ARRAYSIZE(categories); i++) {
unsigned int foreColor = 243;
for (uint i = 0; i < ARRAYSIZE(categories); i++) {
uint foreColor = 243;
if (i == hoveredBox) {
foreColor = 241;
if (categories[hoveredBox].highlightedImg.getPixels() != nullptr) {
@ -347,8 +347,8 @@ Common::String Versailles_Documentation::docAreaHandleSummary() {
}
_fontManager->setForeColor(foreColor);
if (categories[i].title) {
unsigned int x = categories[i].linesPos.right - _fontManager->getStrWidth(*categories[i].title);
unsigned int y = categories[i].linesPos.bottom - _fontManager->getFontMaxHeight() - 5;
uint x = categories[i].linesPos.right - _fontManager->getStrWidth(*categories[i].title);
uint y = categories[i].linesPos.bottom - _fontManager->getFontMaxHeight() - 5;
_fontManager->displayStr(x, y, *categories[i].title);
// Draw line to text
@ -373,7 +373,7 @@ Common::String Versailles_Documentation::docAreaHandleSummary() {
// Don't change highlighted icon when clicking
Common::Point mouse = _engine->getMousePos();
bool foundBox = false;
for (unsigned int i = 0; i < ARRAYSIZE(categories); i++) {
for (uint i = 0; i < ARRAYSIZE(categories); i++) {
if (boxes.hitTest(i, mouse)) {
foundBox = true;
if (i != hoveredBox) {
@ -446,11 +446,11 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() {
_fontManager->setCurrentFont(0);
MouseBoxes boxes(ARRAYSIZE(kTimelineEntries) + 1);
for (unsigned int box_id = 0; box_id < ARRAYSIZE(kTimelineEntries); box_id++) {
for (uint box_id = 0; box_id < ARRAYSIZE(kTimelineEntries); box_id++) {
boxes.setupBox(box_id, kTimelineEntries[box_id].x, kTimelineEntries[box_id].y,
kTimelineEntries[box_id].x + 30, kTimelineEntries[box_id].y + 20);
}
const unsigned int leaveBoxId = ARRAYSIZE(kTimelineEntries);
const uint leaveBoxId = ARRAYSIZE(kTimelineEntries);
boxes.setupBox(leaveBoxId, 639 - _sprites->getCursor(105).getWidth(),
479 - _sprites->getCursor(105).getHeight(), 640, 480);
@ -458,13 +458,13 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() {
g_system->showMouse(true);
bool redraw = true;
unsigned int hoveredBox = -1;
unsigned int selectedBox = -1;
uint hoveredBox = -1;
uint selectedBox = -1;
while (selectedBox == -1u) {
if (redraw) {
// Draw without worrying of already modified areas, that's handled when recomputing hoveredBox
for (unsigned int i = 0; i < ARRAYSIZE(kTimelineEntries); i++) {
for (uint i = 0; i < ARRAYSIZE(kTimelineEntries); i++) {
_fontManager->setForeColor(i == hoveredBox ? 241 : 243);
_fontManager->displayStr(kTimelineEntries[i].x, kTimelineEntries[i].y, kTimelineEntries[i].year);
}
@ -482,7 +482,7 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() {
if (!_engine->getCurrentMouseButton()) {
// Don't change highlighted date when clicking
bool foundBox = false;
for (unsigned int i = 0; i < ARRAYSIZE(kTimelineEntries); i++) {
for (uint i = 0; i < ARRAYSIZE(kTimelineEntries); i++) {
if (boxes.hitTest(i, mouse)) {
foundBox = true;
if (i != hoveredBox) {
@ -526,8 +526,8 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() {
}
}
unsigned int Versailles_Documentation::docAreaHandleRecords(const Common::String &record) {
unsigned int action = -1;
uint Versailles_Documentation::docAreaHandleRecords(const Common::String &record) {
uint action = -1;
_currentRecord = record;
_visitTrace.clear();
@ -639,7 +639,7 @@ void Versailles_Documentation::docAreaPrepareNavigation() {
_categoryStartRecord = "VS00";
_categoryEndRecord = "VS37";
_categoryTitle = (*_messages)[72];
unsigned int id = atoi(_currentRecord.c_str() + 2);
uint id = atoi(_currentRecord.c_str() + 2);
if (id >= 16 && id <= 40) {
_currentMapLayout = true;
}
@ -681,7 +681,7 @@ void Versailles_Documentation::docAreaPrepareRecord(Graphics::ManagedSurface &su
_fontManager->setCharSpacing(1);
_fontManager->setSurface(&surface);
_fontManager->setForeColor(243);
for (unsigned int box_id = 10; box_id < ARRAYSIZE(kTimelineEntries) + 10; box_id++) {
for (uint box_id = 10; box_id < ARRAYSIZE(kTimelineEntries) + 10; box_id++) {
boxes.display(box_id, *_fontManager);
}
}
@ -689,7 +689,7 @@ void Versailles_Documentation::docAreaPrepareRecord(Graphics::ManagedSurface &su
drawRecordBoxes(surface, true, boxes);
}
unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &surface,
uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &surface,
MouseBoxes &boxes, Common::String &nextRecord) {
// Hovering is only handled for timeline entries
_engine->setCursor(181);
@ -697,8 +697,8 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf
bool first = true;
bool redraw = true;
unsigned int hoveredBox = -1;
unsigned int action = -1;
uint hoveredBox = -1;
uint action = -1;
while (action == -1u) {
if (redraw) {
@ -716,7 +716,7 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf
Common::Point mouse = _engine->getMousePos();
if (_currentInTimeline) {
bool foundBox = false;
for (unsigned int i = 10; i < 10 + ARRAYSIZE(kTimelineEntries); i++) {
for (uint i = 10; i < 10 + ARRAYSIZE(kTimelineEntries); i++) {
if (boxes.hitTest(i, mouse)) {
foundBox = true;
if (i != hoveredBox) {
@ -764,8 +764,8 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf
items.push_back(it->title);
}
Common::Rect iconRect = boxes.getBoxRect(2);
unsigned int selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top),
true, 20, items);
uint selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top),
true, 20, items);
if (selectedItem != -1u) {
nextRecord = _currentLinks[selectedItem].record;
action = 2;
@ -776,8 +776,8 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf
items.push_back(it->title);
}
Common::Rect iconRect = boxes.getBoxRect(3);
unsigned int selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top),
true, 20, items);
uint selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top),
true, 20, items);
if (selectedItem != -1u) {
nextRecord = _allLinks[selectedItem].record;
action = 3;
@ -792,7 +792,7 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf
Common::StringArray items;
items.push_back((*_messages)[61]);
items.push_back((*_messages)[62]);
unsigned int selectedItem = handlePopupMenu(surface, boxes.getBoxOrigin(1), false, 20, items);
uint selectedItem = handlePopupMenu(surface, boxes.getBoxOrigin(1), false, 20, items);
if (selectedItem == 0) {
action = 1;
} else if (selectedItem == 1) {
@ -808,7 +808,7 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf
// Handle quit menu
Common::StringArray items;
items.push_back((*_messages)[60]);
unsigned int selectedItem = handlePopupMenu(surface, boxes.getBoxOrigin(6), false, 20, items);
uint selectedItem = handlePopupMenu(surface, boxes.getBoxOrigin(6), false, 20, items);
if (selectedItem == 0) {
action = 6;
}
@ -841,7 +841,7 @@ unsigned int Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurf
action = -1;
continue;
}
unsigned int recordId = hmIt->_value.id;
uint recordId = hmIt->_value.id;
if (action == 4) {
recordId++;
} else if (action == 5) {
@ -865,16 +865,16 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
Common::Rect areaPos;
const char *record;
const char *bmp;
unsigned int messageId;
uint messageId;
const Common::String *message;
Common::Point messagePos;
Graphics::Surface highlightedImg;
Area(const Common::Point &areaPos_, const char *bmp_, unsigned int messageId_,
Area(const Common::Point &areaPos_, const char *bmp_, uint messageId_,
const char *record_ = nullptr) :
areaPos(areaPos_.x, areaPos_.y, areaPos_.x, areaPos_.y), record(record_), bmp(bmp_),
messageId(messageId_), message(nullptr) { }
Area(const Common::Rect &areaPos_, unsigned int messageId_, const char *record_ = nullptr) :
Area(const Common::Rect &areaPos_, uint messageId_, const char *record_ = nullptr) :
areaPos(areaPos_), record(record_), bmp(nullptr), messageId(messageId_), message(nullptr) { }
} areas[] = {
Area(Common::Point(174, 181), "APL.bmp", 74),
@ -905,7 +905,7 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
Image::BitmapDecoder bmpDecoder;
Common::File file;
for (unsigned int i = 0; i < ARRAYSIZE(areas); i++) {
for (uint i = 0; i < ARRAYSIZE(areas); i++) {
if (areas[i].bmp) {
if (!file.open(areas[i].bmp)) {
error("Failed to open BMP file: %s", areas[i].bmp);
@ -920,7 +920,7 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
areas[i].areaPos.setHeight(areas[i].highlightedImg.h);
}
areas[i].message = &(*_messages)[areas[i].messageId];
unsigned int lineWidth = _fontManager->getStrWidth(*areas[i].message);
uint lineWidth = _fontManager->getStrWidth(*areas[i].message);
areas[i].messagePos.x = (areas[i].areaPos.left + areas[i].areaPos.right) / 2 - lineWidth / 2;
areas[i].messagePos.y = areas[i].areaPos.top - 40;
if (areas[i].messagePos.x < 8) {
@ -956,8 +956,8 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
g_system->showMouse(true);
bool redraw = true;
unsigned int hoveredBox = -1;
unsigned int selectedBox = -1;
uint hoveredBox = -1;
uint selectedBox = -1;
while (selectedBox == -1u) {
if (redraw) {
@ -967,10 +967,10 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
mapSurface.transBlitFrom(areas[hoveredBox].highlightedImg,
Common::Point(areas[hoveredBox].areaPos.left, areas[hoveredBox].areaPos.top));
} else {
unsigned int middleX = (areas[hoveredBox].areaPos.left + areas[hoveredBox].areaPos.right) / 2;
unsigned int middleY = (areas[hoveredBox].areaPos.top + areas[hoveredBox].areaPos.bottom) / 2;
unsigned int spriteX = middleX - _sprites->getCursor(163).getWidth() / 2;
unsigned int spriteY = middleY - _sprites->getCursor(163).getHeight() / 2;
uint middleX = (areas[hoveredBox].areaPos.left + areas[hoveredBox].areaPos.right) / 2;
uint middleY = (areas[hoveredBox].areaPos.top + areas[hoveredBox].areaPos.bottom) / 2;
uint spriteX = middleX - _sprites->getCursor(163).getWidth() / 2;
uint spriteY = middleY - _sprites->getCursor(163).getHeight() / 2;
mapSurface.transBlitFrom(_sprites->getSurface(163), Common::Point(spriteX, spriteY),
_sprites->getKeyColor(163));
}
@ -988,7 +988,7 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
_sprites->getKeyColor(105));
/*
// For debugging only
for(unsigned int i = 0; i < ARRAYSIZE(areas); i++) {
for(uint i = 0; i < ARRAYSIZE(areas); i++) {
mapSurface.frameRect(areas[i].areaPos, 0);
}
*/
@ -1005,8 +1005,8 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
if (!_engine->getCurrentMouseButton()) {
// Don't change highlighted icon when clicking
bool foundBox = false;
unsigned int oldHoveredBox = hoveredBox;
for (unsigned int i = 0; i < ARRAYSIZE(areas); i++) {
uint oldHoveredBox = hoveredBox;
for (uint i = 0; i < ARRAYSIZE(areas); i++) {
if (boxes.hitTest(i, mouse)) {
if (i != hoveredBox) {
hoveredBox = i;
@ -1064,18 +1064,18 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() {
Common::Rect areaPos;
bool fillArea;
const char *record;
unsigned int messageId;
uint messageId;
Common::String message;
Common::Point messagePos;
Common::Rect areaPos1;
Common::Rect areaPos2;
Area(const Common::Rect &areaPos_, const char *record_, bool fillArea_ = true,
unsigned int messageId_ = -1) :
uint messageId_ = -1) :
areaPos(areaPos_), record(record_), fillArea(fillArea_), messageId(messageId_) { }
Area(const Common::Rect &areaPos_, const Common::Rect &areaPos1_,
const Common::Rect &areaPos2_, const char *record_, bool fillArea_ = true,
unsigned int messageId_ = -1) :
uint messageId_ = -1) :
areaPos(areaPos_), areaPos1(areaPos1_), areaPos2(areaPos2_),
record(record_), fillArea(fillArea_), messageId(messageId_) { }
} areas[] = {
@ -1117,14 +1117,14 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() {
MouseBoxes boxes(ARRAYSIZE(areas) + 1);
for (unsigned int i = 0; i < ARRAYSIZE(areas); i++) {
for (uint i = 0; i < ARRAYSIZE(areas); i++) {
if (areas[i].messageId != -1u) {
areas[i].message = (*_messages)[areas[i].messageId];
} else {
areas[i].message = getRecordTitle(areas[i].record);
}
unsigned int lineWidth = _fontManager->getStrWidth(areas[i].message);
unsigned int right;
uint lineWidth = _fontManager->getStrWidth(areas[i].message);
uint right;
if (areas[i].areaPos2.right) {
right = areas[i].areaPos2.right;
} else {
@ -1173,8 +1173,8 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() {
g_system->showMouse(true);
bool redraw = true;
unsigned int hoveredBox = -1;
unsigned int selectedBox = -1;
uint hoveredBox = -1;
uint selectedBox = -1;
while (selectedBox == -1u) {
if (redraw) {
@ -1198,10 +1198,10 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() {
mapSurface.fillRect(rect, 243);
}
} else {
unsigned int middleX = (areas[hoveredBox].areaPos.left + areas[hoveredBox].areaPos.right) / 2;
unsigned int middleY = (areas[hoveredBox].areaPos.top + areas[hoveredBox].areaPos.bottom) / 2;
unsigned int spriteX = middleX - _sprites->getCursor(163).getWidth() / 2;
unsigned int spriteY = middleY - _sprites->getCursor(163).getHeight() / 2;
uint middleX = (areas[hoveredBox].areaPos.left + areas[hoveredBox].areaPos.right) / 2;
uint middleY = (areas[hoveredBox].areaPos.top + areas[hoveredBox].areaPos.bottom) / 2;
uint spriteX = middleX - _sprites->getCursor(163).getWidth() / 2;
uint spriteY = middleY - _sprites->getCursor(163).getHeight() / 2;
mapSurface.transBlitFrom(_sprites->getSurface(163), Common::Point(spriteX, spriteY),
_sprites->getKeyColor(163));
}
@ -1218,7 +1218,7 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() {
_sprites->getKeyColor(105));
/*
// For debugging only
for(unsigned int i = 0; i < ARRAYSIZE(areas); i++) {
for(uint i = 0; i < ARRAYSIZE(areas); i++) {
mapSurface.frameRect(areas[i].areaPos, 0);
if (areas[i].areaPos1.right) {
mapSurface.frameRect(areas[i].areaPos1, 0);
@ -1241,8 +1241,8 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() {
if (!_engine->getCurrentMouseButton()) {
// Don't change highlighted icon when clicking
bool foundBox = false;
unsigned int oldHoveredBox = hoveredBox;
for (unsigned int i = 0; i < ARRAYSIZE(areas); i++) {
uint oldHoveredBox = hoveredBox;
for (uint i = 0; i < ARRAYSIZE(areas); i++) {
if (boxes.hitTest(i, mouse)) {
if (i != hoveredBox) {
hoveredBox = i;
@ -1313,7 +1313,7 @@ void Versailles_Documentation::inGamePrepareRecord(Graphics::ManagedSurface &sur
_currentHasMap = false;
if (_currentRecord.hasPrefix("VS")) {
unsigned int id = atoi(_currentRecord.c_str() + 2);
uint id = atoi(_currentRecord.c_str() + 2);
if (id >= 16 && id <= 40) {
_currentMapLayout = true;
}
@ -1334,12 +1334,12 @@ void Versailles_Documentation::inGamePrepareRecord(Graphics::ManagedSurface &sur
drawRecordBoxes(surface, false, boxes);
}
unsigned int Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurface &surface,
uint Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurface &surface,
MouseBoxes &boxes, Common::String &nextRecord) {
_engine->setCursor(181);
g_system->showMouse(true);
unsigned int action = -1;
uint action = -1;
g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.w, surface.h);
@ -1360,8 +1360,8 @@ unsigned int Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurfa
items.push_back(it->title);
}
Common::Rect iconRect = boxes.getBoxRect(2);
unsigned int selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top),
true, 20, items);
uint selectedItem = handlePopupMenu(surface, Common::Point(iconRect.right, iconRect.top),
true, 20, items);
if (selectedItem != -1u) {
nextRecord = _currentLinks[selectedItem].record;
action = 2;
@ -1464,7 +1464,7 @@ void Versailles_Documentation::drawRecordData(Graphics::ManagedSurface &surface,
Common::String text = getRecordData(_currentRecord, title, subtitle, caption, hyperlinks);*/
unsigned int lineHeight = 21;
uint lineHeight = 21;
_fontManager->setCurrentFont(4);
_fontManager->setTransparentBackground(true);
_fontManager->setSpaceWidth(1);
@ -1539,22 +1539,22 @@ void Versailles_Documentation::drawRecordData(Graphics::ManagedSurface &surface,
void Versailles_Documentation::setupRecordBoxes(bool inDocArea, MouseBoxes &boxes) {
// Layout of bar in doc area is Quit | Back | | Previous | Category | Next | | Trace | Hyperlinks | All records
// Layout of bar in game is ==> Trace | Hyperlinks | Quit
unsigned int allRecordsX = 640 - _sprites->getCursor(19).getWidth();
unsigned int hyperlinksX = allRecordsX - _sprites->getCursor(242).getWidth() - 10;
unsigned int traceX = hyperlinksX - _sprites->getCursor(105).getWidth() - 10;
uint allRecordsX = 640 - _sprites->getCursor(19).getWidth();
uint hyperlinksX = allRecordsX - _sprites->getCursor(242).getWidth() - 10;
uint traceX = hyperlinksX - _sprites->getCursor(105).getWidth() - 10;
if (_visitTrace.size()) {
boxes.setupBox(0, traceX, 480 - _sprites->getCursor(105).getHeight() - 3,
traceX + _sprites->getCursor(105).getWidth(), 480);
}
if (inDocArea) {
unsigned int backX = _sprites->getCursor(225).getWidth() + 10; //Right to quit button
uint backX = _sprites->getCursor(225).getWidth() + 10; //Right to quit button
_fontManager->setCurrentFont(0);
_fontManager->setTransparentBackground(true);
_fontManager->setSpaceWidth(0);
_fontManager->setCharSpacing(1);
unsigned int categoryHalfWidth = _fontManager->getStrWidth(_categoryTitle) / 2;
uint categoryHalfWidth = _fontManager->getStrWidth(_categoryTitle) / 2;
unsigned nextX = 320 + categoryHalfWidth + 20;
unsigned prevX = 320 - categoryHalfWidth - 20 - _sprites->getCursor(76).getWidth();
@ -1574,13 +1574,13 @@ void Versailles_Documentation::setupRecordBoxes(bool inDocArea, MouseBoxes &boxe
// Map
boxes.setupBox(8, 403, 305, 622, 428);
if (_currentInTimeline) {
for (unsigned int box_id = 0; box_id < ARRAYSIZE(kTimelineEntries); box_id++) {
for (uint box_id = 0; box_id < ARRAYSIZE(kTimelineEntries); box_id++) {
boxes.setupBox(10 + box_id, kTimelineEntries[box_id].x, kTimelineEntries[box_id].y,
kTimelineEntries[box_id].x + 30, kTimelineEntries[box_id].y + 15, kTimelineEntries[box_id].year);
}
}
} else {
unsigned int quitInGameX = 640 - _sprites->getCursor(105).getWidth();
uint quitInGameX = 640 - _sprites->getCursor(105).getWidth();
boxes.setupBox(1, quitInGameX, 480 - _sprites->getCursor(105).getHeight(),
quitInGameX + _sprites->getCursor(105).getWidth(), 480);
}
@ -1629,28 +1629,28 @@ void Versailles_Documentation::drawRecordBoxes(Graphics::ManagedSurface &surface
}
}
unsigned int Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSurface
uint Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSurface
&originalSurface,
const Common::Point &anchor, bool rightAligned, unsigned int itemHeight,
const Common::Point &anchor, bool rightAligned, uint itemHeight,
const Common::StringArray &items) {
unsigned int maxTextWidth = 0;
uint maxTextWidth = 0;
_fontManager->setCurrentFont(4);
_fontManager->setTransparentBackground(true);
_fontManager->setCharSpacing(1);
for (Common::StringArray::const_iterator it = items.begin(); it != items.end(); it++) {
unsigned int width = _fontManager->getStrWidth(*it);
uint width = _fontManager->getStrWidth(*it);
if (width > maxTextWidth) {
maxTextWidth = width;
}
}
unsigned int width = maxTextWidth + 2 * kPopupMenuMargin;
unsigned int height = itemHeight * items.size() + 2 * kPopupMenuMargin;
uint width = maxTextWidth + 2 * kPopupMenuMargin;
uint height = itemHeight * items.size() + 2 * kPopupMenuMargin;
unsigned int hiddenItems = 0;
uint hiddenItems = 0;
int top = anchor.y - height;
while (top < 0) {
hiddenItems++;
@ -1669,7 +1669,7 @@ unsigned int Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSu
surface.copyFrom(originalSurface);
MouseBoxes boxes(shownItems);
for (unsigned int i = 0; i < shownItems; i++) {
for (uint i = 0; i < shownItems; i++) {
boxes.setupBox(i, popupRect.left + kPopupMenuMargin,
popupRect.top + kPopupMenuMargin + i * itemHeight,
popupRect.right - kPopupMenuMargin,
@ -1680,12 +1680,12 @@ unsigned int Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSu
bool fullRedraw = true;
bool redraw = true;
unsigned int hoveredBox = -1;
unsigned int action = -1;
unsigned int lastShownItem = items.size() - 1;
unsigned int firstShownItem = lastShownItem - shownItems + 1;
uint hoveredBox = -1;
uint action = -1;
uint lastShownItem = items.size() - 1;
uint firstShownItem = lastShownItem - shownItems + 1;
unsigned int slowScrollNextEvent = g_system->getMillis() + 250;
uint slowScrollNextEvent = g_system->getMillis() + 250;
Common::Point mouse;
@ -1695,7 +1695,7 @@ unsigned int Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSu
surface.fillRect(popupRect, 247);
fullRedraw = false;
}
for (unsigned int i = 0; i < shownItems; i++) {
for (uint i = 0; i < shownItems; i++) {
if (i == 0 && firstShownItem != 0) {
// There are items before the first one: display an arrow
surface.transBlitFrom(_sprites->getSurface(162),
@ -1727,8 +1727,8 @@ unsigned int Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSu
}
mouse = _engine->getMousePos();
unsigned int newHovered = -1;
for (unsigned int i = 0; i < shownItems; i++) {
uint newHovered = -1;
for (uint i = 0; i < shownItems; i++) {
if (boxes.hitTest(i, mouse)) {
newHovered = i;
break;
@ -1808,7 +1808,7 @@ char *Versailles_Documentation::getDocPartAddress(char *start, char *end, const
}
char *foundPos = nullptr;
const char *pattern;
unsigned int patternLen;
uint patternLen;
for (const char **patternP = patterns; *patternP && !foundPos; patternP++) {
pattern = *patternP;
patternLen = strlen(pattern);
@ -1886,7 +1886,7 @@ const char *Versailles_Documentation::getRecordSubtitle(char *start, char *end)
return nullptr;
}
unsigned int ln = strlen(ret);
uint ln = strlen(ret);
char *p = ret + ln + 1; // Got to end of line and check next line
for (; p < end && *p && *p != '\r' && *p != '=' ; p++) { }
if (*p == '=') {
@ -1907,7 +1907,7 @@ void Versailles_Documentation::getRecordHyperlinks(char *start, char *end,
const char *const hyperlinksPatterns[] = { "SAVOIR-PLUS 1=", "SAVOIR-PLUS 2=", "SAVOIR-PLUS 3=" };
hyperlinks.clear();
for (unsigned int hyperlinkId = 0; hyperlinkId < ARRAYSIZE(hyperlinksPatterns); hyperlinkId++) {
for (uint hyperlinkId = 0; hyperlinkId < ARRAYSIZE(hyperlinksPatterns); hyperlinkId++) {
const char *patterns[] = { hyperlinksPatterns[hyperlinkId], nullptr };
const char *ret = getDocPartAddress(start, end, patterns);
if (ret) {

View File

@ -53,16 +53,16 @@ private:
Common::String docAreaHandleTimeline();
Common::String docAreaHandleGeneralMap();
Common::String docAreaHandleCastleMap();
unsigned int docAreaHandleRecords(const Common::String &record);
uint docAreaHandleRecords(const Common::String &record);
void docAreaPrepareNavigation();
void docAreaPrepareRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes);
unsigned int docAreaHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes,
Common::String &nextRecord);
uint docAreaHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes,
Common::String &nextRecord);
void inGamePrepareRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes);
unsigned int inGameHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes,
Common::String &nextRecord);
uint inGameHandleRecord(Graphics::ManagedSurface &surface, MouseBoxes &boxes,
Common::String &nextRecord);
void setupRecordBoxes(bool inDocArea, MouseBoxes &boxes);
void setupTimelineBoxes(MouseBoxes &boxes);
@ -71,14 +71,14 @@ private:
const Common::String &subtitle, const Common::String &caption);
void drawRecordBoxes(Graphics::ManagedSurface &surface, bool inDocArea, MouseBoxes &boxes);
unsigned int handlePopupMenu(const Graphics::ManagedSurface &surface,
const Common::Point &anchor, bool rightAligned, unsigned int itemHeight,
const Common::StringArray &items);
uint handlePopupMenu(const Graphics::ManagedSurface &surface,
const Common::Point &anchor, bool rightAligned, uint itemHeight,
const Common::StringArray &items);
struct RecordInfo {
unsigned int id;
unsigned int position;
unsigned int size;
uint id;
uint position;
uint size;
};
struct LinkInfo {
@ -88,8 +88,8 @@ private:
struct TimelineEntry {
char year[8];
unsigned int x;
unsigned int y;
uint x;
uint y;
};
static const TimelineEntry kTimelineEntries[];
@ -112,7 +112,7 @@ private:
static const char *kAllDocsFile;
static const char *kLinksDocsFile;
static const unsigned int kPopupMenuMargin = 5;
static const uint kPopupMenuMargin = 5;
CryOmni3DEngine *_engine;
FontManager *_fontManager;
@ -122,7 +122,7 @@ private:
Common::StringArray _recordsOrdered;
Common::HashMap<Common::String, RecordInfo> _records;
char *_linksData;
unsigned int _linksSize;
uint _linksSize;
Common::Array<LinkInfo> _allLinks;

View File

@ -116,7 +116,7 @@ Common::Error CryOmni3DEngine_Versailles::run() {
_transparentNewStop = 254;
// Inventory has a size of 50
_inventory.init(50, new Common::Functor1Mem<unsigned int, void, Toolbar>(&_toolbar,
_inventory.init(50, new Common::Functor1Mem<uint, void, Toolbar>(&_toolbar,
&Toolbar::inventoryChanged));
// Init toolbar after we have setup sprites and fonts
@ -152,7 +152,7 @@ Common::Error CryOmni3DEngine_Versailles::run() {
bool stopGame = false;
while (!stopGame) {
bool exitLoop = false;
unsigned int nextStep = 0;
uint nextStep = 0;
#if defined(DEBUG_FAST_START) && DEBUG_FAST_START>=2
nextStep = 27;
// Called in options
@ -300,7 +300,7 @@ void CryOmni3DEngine_Versailles::setupSprites() {
}
_sprites.loadSprites(file);
for (unsigned int i = 0; i < _sprites.getSpritesCount(); i++) {
for (uint i = 0; i < _sprites.getSpritesCount(); i++) {
const Graphics::Cursor &cursor = _sprites.getCursor(i);
if (cursor.getWidth() != 32 || cursor.getHeight() != 32) {
_sprites.setSpriteHotspot(i, 8, 8);
@ -367,7 +367,7 @@ void CryOmni3DEngine_Versailles::setMainPaletteColor(byte color, byte red, byte
}
struct transparentScore {
unsigned int score;
uint score;
byte redScaled;
byte greenScaled;
@ -380,8 +380,8 @@ static transparentScore transparentCalculateScore(byte red, byte green, byte blu
transparentScore ret;
ret.score = 10 * (blue + 3 * (red + 2 * green)) / 30;
if (ret.score) {
ret.redScaled = ((unsigned int)red) * 256 / ret.score;
ret.greenScaled = ((unsigned int)green) * 256 / ret.score;
ret.redScaled = ((uint)red) * 256 / ret.score;
ret.greenScaled = ((uint)green) * 256 / ret.score;
} else {
ret.redScaled = 0;
ret.greenScaled = 0;
@ -393,26 +393,26 @@ void CryOmni3DEngine_Versailles::calculateTransparentMapping() {
// Calculate colors proximity array
transparentScore *proximities = new transparentScore[256];
for (unsigned int i = _transparentSrcStart; i < _transparentSrcStop; i++) {
for (uint i = _transparentSrcStart; i < _transparentSrcStop; i++) {
proximities[i] = transparentCalculateScore(_mainPalette[3 * i + 0], _mainPalette[3 * i + 1],
_mainPalette[3 * i + 2]);
}
unsigned int newColorsNextId = _transparentNewStart;
unsigned int newColorsCount = 0;
for (unsigned int i = _transparentDstStart; i < _transparentDstStop; i++) {
byte transparentRed = ((unsigned int)_mainPalette[3 * i + 0]) * 60 / 128;
byte transparentGreen = ((unsigned int)_mainPalette[3 * i + 1]) * 50 / 128;
byte transparentBlue = ((unsigned int)_mainPalette[3 * i + 2]) * 35 / 128;
uint newColorsNextId = _transparentNewStart;
uint newColorsCount = 0;
for (uint i = _transparentDstStart; i < _transparentDstStop; i++) {
byte transparentRed = ((uint)_mainPalette[3 * i + 0]) * 60 / 128;
byte transparentGreen = ((uint)_mainPalette[3 * i + 1]) * 50 / 128;
byte transparentBlue = ((uint)_mainPalette[3 * i + 2]) * 35 / 128;
// Find nearest color
transparentScore newColorScore = transparentCalculateScore(transparentRed, transparentGreen,
transparentBlue);
unsigned int distanceMin = -1u;
unsigned int nearestId = -1u;
for (unsigned int j = _transparentSrcStart; j < _transparentSrcStop; j++) {
uint distanceMin = -1u;
uint nearestId = -1u;
for (uint j = _transparentSrcStart; j < _transparentSrcStop; j++) {
if (j != i && newColorScore.dScore(proximities[j]) < 15) {
unsigned int distance = newColorScore.dRed(proximities[j]) + newColorScore.dGreen(proximities[j]);
uint distance = newColorScore.dRed(proximities[j]) + newColorScore.dGreen(proximities[j]);
if (distance < distanceMin) {
distanceMin = distance;
nearestId = j;
@ -450,8 +450,8 @@ void CryOmni3DEngine_Versailles::makeTranslucent(Graphics::Surface &dst,
const byte *srcP = (const byte *) src.getPixels();
byte *dstP = (byte *) dst.getPixels();
for (unsigned int y = 0; y < dst.h; y++) {
for (unsigned int x = 0; x < dst.w; x++) {
for (uint y = 0; y < dst.h; y++) {
for (uint x = 0; x < dst.w; x++) {
dstP[x] = _transparentPaletteMap[srcP[x]];
}
dstP += dst.pitch;
@ -608,7 +608,7 @@ void CryOmni3DEngine_Versailles::changeLevel(int level) {
if (_currentLevel == 1) {
_dialogsMan.reinitVariables();
for (Common::Array<unsigned int>::iterator it = _gameVariables.begin(); it != _gameVariables.end();
for (Common::Array<uint>::iterator it = _gameVariables.begin(); it != _gameVariables.end();
it++) {
*it = 0;
}
@ -667,7 +667,7 @@ void CryOmni3DEngine_Versailles::initNewLevel(int level) {
// Create a first SearchSet in which we will add all others to easily cleanup the mess
Common::SearchSet *visitFiles = new Common::SearchSet();
for (unsigned int lvl = 1; lvl <= 7; lvl++) {
for (uint lvl = 1; lvl <= 7; lvl++) {
Common::SearchSet *visitFilesAnimacti = new Common::SearchSet();
Common::SearchSet *visitFilesWarp = new Common::SearchSet();
Common::SearchSet *visitFilesImgFix = new Common::SearchSet();
@ -719,7 +719,7 @@ void CryOmni3DEngine_Versailles::setupLevelWarps(int level) {
_omni3dMan.setBeta(initialState.beta);
}
void CryOmni3DEngine_Versailles::setGameTime(unsigned int newTime, unsigned int level) {
void CryOmni3DEngine_Versailles::setGameTime(uint newTime, uint level) {
if (_currentLevel != level) {
error("Level %u != current level %u", level, _currentLevel);
}
@ -804,7 +804,7 @@ void CryOmni3DEngine_Versailles::gameStep() {
if (_forcePaletteUpdate) {
redrawWarp();
}
unsigned int actionId = handleWarp();
uint actionId = handleWarp();
debug("handleWarp returned %u", actionId);
// Don't handle keyboard for levels 4 and 5, it was a debug leftover
@ -888,7 +888,7 @@ void CryOmni3DEngine_Versailles::doGameOver() {
void CryOmni3DEngine_Versailles::doPlaceChange() {
const Place *nextPlace = _wam.findPlaceById(_nextPlaceId);
unsigned int state = _placeStates[_nextPlaceId].state;
uint state = _placeStates[_nextPlaceId].state;
if (state == -1u) {
state = 0;
}
@ -942,9 +942,9 @@ void CryOmni3DEngine_Versailles::doPlaceChange() {
}
}
void CryOmni3DEngine_Versailles::setPlaceState(unsigned int placeId, unsigned int newState) {
unsigned int numStates = _wam.findPlaceById(placeId)->getNumStates();
unsigned int oldState = _placeStates[placeId].state;
void CryOmni3DEngine_Versailles::setPlaceState(uint placeId, uint newState) {
uint numStates = _wam.findPlaceById(placeId)->getNumStates();
uint oldState = _placeStates[placeId].state;
if (newState > numStates) {
warning("CryOmni3DEngine_Versailles::setPlaceState: newState '%d' > numStates '%d'",
@ -959,9 +959,9 @@ void CryOmni3DEngine_Versailles::setPlaceState(unsigned int placeId, unsigned in
}
}
void CryOmni3DEngine_Versailles::executeTransition(unsigned int nextPlaceId) {
void CryOmni3DEngine_Versailles::executeTransition(uint nextPlaceId) {
const Transition *transition;
unsigned int animationId = determineTransitionAnimation(_currentPlaceId, nextPlaceId, &transition);
uint animationId = determineTransitionAnimation(_currentPlaceId, nextPlaceId, &transition);
_nextPlaceId = nextPlaceId;
@ -992,7 +992,7 @@ void CryOmni3DEngine_Versailles::executeTransition(unsigned int nextPlaceId) {
_omni3dMan.setAlpha(transition->dstAlpha);
_omni3dMan.setBeta(-transition->dstBeta);
unsigned int nextState = _placeStates[nextPlaceId].state;
uint nextState = _placeStates[nextPlaceId].state;
if (nextState == -1u) {
nextState = 0;
}
@ -1001,7 +1001,7 @@ void CryOmni3DEngine_Versailles::executeTransition(unsigned int nextPlaceId) {
warpFile.toUppercase();
if (warpFile.hasPrefix("NOT_STOP")) {
debug("Got not stop");
unsigned int transitionNum;
uint transitionNum;
// Determine transition to take
if (nextPlace->getNumTransitions() == 1) {
// Only one
@ -1012,7 +1012,7 @@ void CryOmni3DEngine_Versailles::executeTransition(unsigned int nextPlaceId) {
} else {
transitionNum = 0;
}
unsigned int nextNextPlaceId = nextPlace->transitions[transitionNum].dstId;
uint nextNextPlaceId = nextPlace->transitions[transitionNum].dstId;
animationId = determineTransitionAnimation(nextPlaceId, nextNextPlaceId, &transition);
animation = animationId == -1u ? "" : transition->animations[animationId];
@ -1038,7 +1038,7 @@ void CryOmni3DEngine_Versailles::executeTransition(unsigned int nextPlaceId) {
}
}
void CryOmni3DEngine_Versailles::fakeTransition(unsigned int dstPlaceId) {
void CryOmni3DEngine_Versailles::fakeTransition(uint dstPlaceId) {
// No need of animation, caller will take care
// We just setup the camera in good place for the caller
const Place *srcPlace = _wam.findPlaceById(_currentPlaceId);
@ -1050,8 +1050,8 @@ void CryOmni3DEngine_Versailles::fakeTransition(unsigned int dstPlaceId) {
_omni3dMan.setBeta(-transition->dstBeta);
}
unsigned int CryOmni3DEngine_Versailles::determineTransitionAnimation(unsigned int srcPlaceId,
unsigned int dstPlaceId, const Transition **transition_) {
uint CryOmni3DEngine_Versailles::determineTransitionAnimation(uint srcPlaceId,
uint dstPlaceId, const Transition **transition_) {
const Place *srcPlace = _wam.findPlaceById(srcPlaceId);
const Place *dstPlace = _wam.findPlaceById(dstPlaceId);
const Transition *transition = srcPlace->findTransition(dstPlaceId);
@ -1060,12 +1060,12 @@ unsigned int CryOmni3DEngine_Versailles::determineTransitionAnimation(unsigned i
*transition_ = transition;
}
unsigned int srcNumStates = srcPlace->getNumStates();
unsigned int dstNumStates = dstPlace->getNumStates();
unsigned int animsNum = transition->getNumAnimations();
uint srcNumStates = srcPlace->getNumStates();
uint dstNumStates = dstPlace->getNumStates();
uint animsNum = transition->getNumAnimations();
unsigned int srcState = _placeStates[srcPlaceId].state;
unsigned int dstState = _placeStates[dstPlaceId].state;
uint srcState = _placeStates[srcPlaceId].state;
uint dstState = _placeStates[dstPlaceId].state;
if (srcState >= srcNumStates) {
error("Invalid src state");
@ -1108,11 +1108,11 @@ int CryOmni3DEngine_Versailles::handleWarp() {
bool leftButtonPressed = false;
bool firstDraw = true;
bool moving = true;
unsigned int actionId;
uint actionId;
g_system->showMouse(true);
while (!leftButtonPressed && !exit) {
int xDelta = 0, yDelta = 0;
unsigned int movingCursor = -1;
uint movingCursor = -1;
pollEvents();
Common::Point mouse = getMousePos();
@ -1195,8 +1195,8 @@ int CryOmni3DEngine_Versailles::handleWarp() {
return actionId;
}
bool CryOmni3DEngine_Versailles::handleWarpMouse(unsigned int *actionId,
unsigned int movingCursor) {
bool CryOmni3DEngine_Versailles::handleWarpMouse(uint *actionId,
uint movingCursor) {
fixActionId(actionId);
if (getCurrentMouseButton() == 2 ||
@ -1265,10 +1265,10 @@ bool CryOmni3DEngine_Versailles::handleWarpMouse(unsigned int *actionId,
return false;
}
void CryOmni3DEngine_Versailles::fixActionId(unsigned int *actionId) const {
void CryOmni3DEngine_Versailles::fixActionId(uint *actionId) const {
PlaceStateActionKey mask = PlaceStateActionKey(_currentPlaceId, _placeStates[_currentPlaceId].state,
*actionId);
Common::HashMap<PlaceStateActionKey, unsigned int>::const_iterator it = _actionMasks.find(mask);
Common::HashMap<PlaceStateActionKey, uint>::const_iterator it = _actionMasks.find(mask);
if (it != _actionMasks.end()) {
*actionId = it->_value;
return;
@ -1382,9 +1382,9 @@ void CryOmni3DEngine_Versailles::animateCursor(const Object *obj) {
bool cursorWasVisible = g_system->showMouse(true);
for (unsigned int i = 4; i > 0; i--) {
for (uint i = 4; i > 0; i--) {
// Wait 100ms
for (unsigned int j = 10; j > 0; j--) {
for (uint j = 10; j > 0; j--) {
// pollEvents sleeps 10ms
pollEvents();
g_system->updateScreen();
@ -1392,7 +1392,7 @@ void CryOmni3DEngine_Versailles::animateCursor(const Object *obj) {
setCursor(obj->idSA());
g_system->updateScreen();
// Wait 100ms
for (unsigned int j = 10; j > 0; j--) {
for (uint j = 10; j > 0; j--) {
// pollEvents sleeps 10ms
pollEvents();
g_system->updateScreen();
@ -1471,7 +1471,7 @@ void CryOmni3DEngine_Versailles::displayObject(const Common::String &imgName,
setMousePos(Common::Point(320, 240)); // Center of screen
}
void CryOmni3DEngine_Versailles::executeSeeAction(unsigned int actionId) {
void CryOmni3DEngine_Versailles::executeSeeAction(uint actionId) {
if (_currentLevel == 7 && _currentPlaceId != 20) {
// Don't display fixed images unless it's the bomb
// Not enough time for paintings
@ -1487,7 +1487,7 @@ void CryOmni3DEngine_Versailles::executeSeeAction(unsigned int actionId) {
}
}
void CryOmni3DEngine_Versailles::executeSpeakAction(unsigned int actionId) {
void CryOmni3DEngine_Versailles::executeSpeakAction(uint actionId) {
PlaceActionKey key(_currentPlaceId, actionId);
Common::HashMap<PlaceActionKey, Common::String>::iterator it = _whoSpeaksWhere.find(key);
g_system->showMouse(true);
@ -1502,14 +1502,14 @@ void CryOmni3DEngine_Versailles::executeSpeakAction(unsigned int actionId) {
}
}
void CryOmni3DEngine_Versailles::executeDocAction(unsigned int actionId) {
void CryOmni3DEngine_Versailles::executeDocAction(uint actionId) {
if (_currentLevel == 7) {
// Not enough time for doc
displayMessageBoxWarp(13);
return;
}
Common::HashMap<unsigned int, const char *>::iterator it = _docPeopleRecord.find(actionId);
Common::HashMap<uint, const char *>::iterator it = _docPeopleRecord.find(actionId);
if (it == _docPeopleRecord.end() || !it->_value) {
warning("Missing documentation record for action %u", actionId);
return;
@ -1537,7 +1537,7 @@ void CryOmni3DEngine_Versailles::handleFixedImg(const FixedImgCallback &callback
}
}
unsigned int CryOmni3DEngine_Versailles::getFakeTransition(unsigned int actionId) const {
uint CryOmni3DEngine_Versailles::getFakeTransition(uint actionId) const {
for (const FakeTransitionActionPlace *ft = kFakeTransitions; ft->actionId != 0; ft++) {
if (ft->actionId == actionId) {
return ft->placeId;
@ -1571,11 +1571,11 @@ void CryOmni3DEngine_Versailles::playInGameVideo(const Common::String &filename,
}
void CryOmni3DEngine_Versailles::loadBMPs(const char *pattern, Graphics::Surface *bmps,
unsigned int count) {
uint count) {
Image::BitmapDecoder bmpDecoder;
Common::File file;
for (unsigned int i = 0; i < count; i++) {
for (uint i = 0; i < count; i++) {
Common::String bmp = Common::String::format(pattern, i);
if (!file.open(bmp)) {

View File

@ -51,10 +51,10 @@ class ZonFixedImage;
namespace CryOmni3D {
namespace Versailles {
struct PlaceStateActionKey {
unsigned int placeId;
unsigned int placeState;
unsigned int actionId;
PlaceStateActionKey(unsigned int placeId_, unsigned int placeState_, unsigned int actionId_) :
uint placeId;
uint placeState;
uint actionId;
PlaceStateActionKey(uint placeId_, uint placeState_, uint actionId_) :
placeId(placeId_), placeState(placeState_), actionId(actionId_) {}
bool operator==(const PlaceStateActionKey &other) const {
@ -63,9 +63,9 @@ struct PlaceStateActionKey {
};
struct PlaceActionKey {
unsigned int placeId;
unsigned int actionId;
PlaceActionKey(unsigned int placeId_, unsigned int actionId_) :
uint placeId;
uint actionId;
PlaceActionKey(uint placeId_, uint actionId_) :
placeId(placeId_), actionId(actionId_) {}
bool operator==(const PlaceActionKey &other) const {
@ -170,7 +170,7 @@ struct SoundIds {
struct PlaceState {
typedef void (CryOmni3DEngine_Versailles::*InitFunc)();
typedef bool (CryOmni3DEngine_Versailles::*FilterEventFunc)(unsigned int *event);
typedef bool (CryOmni3DEngine_Versailles::*FilterEventFunc)(uint *event);
PlaceState() : initPlace(nullptr), filterEvent(nullptr), docImage(nullptr), state(0) {}
PlaceState(InitFunc initPlace_, FilterEventFunc filterEvent_, const char *docImage_) :
@ -179,18 +179,18 @@ struct PlaceState {
InitFunc initPlace;
FilterEventFunc filterEvent;
const char *docImage;
unsigned int state;
uint state;
};
struct LevelInitialState {
unsigned int placeId;
uint placeId;
double alpha;
double beta;
};
struct FakeTransitionActionPlace {
unsigned int actionId;
unsigned int placeId;
uint actionId;
uint placeId;
};
typedef void (CryOmni3DEngine_Versailles::*FixedImgCallback)(ZonFixedImage *);
@ -198,14 +198,14 @@ typedef void (CryOmni3DEngine_Versailles::*FixedImgCallback)(ZonFixedImage *);
struct MsgBoxParameters {
int font;
byte foreColor;
unsigned int lineHeight;
unsigned int spaceWidth;
unsigned int charSpacing;
unsigned int initialWidth;
unsigned int incrementWidth;
unsigned int initialHeight;
unsigned int incrementHeight;
unsigned int timeoutChar;
uint lineHeight;
uint spaceWidth;
uint charSpacing;
uint initialWidth;
uint incrementWidth;
uint initialHeight;
uint incrementHeight;
uint timeoutChar;
};
class CryOmni3DEngine_Versailles : public CryOmni3DEngine {
@ -230,7 +230,7 @@ public:
virtual bool displayToolbar(const Graphics::Surface *original) override { return _toolbar.displayToolbar(original); };
virtual bool hasPlaceDocumentation() override;
virtual bool displayPlaceDocumentation() override;
virtual unsigned int displayOptions() override;
virtual uint displayOptions() override;
virtual bool shouldAbort() override { return g_engine->shouldQuit() || _abortCommand != AbortNoAbort; }
private:
@ -256,65 +256,65 @@ private:
void initDocPeopleRecord();
void setupLevelActionsMask();
unsigned int currentGameTime() const { return _gameVariables[GameVariables::kCurrentTime]; }
void setGameTime(unsigned int newTime, unsigned int level);
uint currentGameTime() const { return _gameVariables[GameVariables::kCurrentTime]; }
void setGameTime(uint newTime, uint level);
void updateGameTimeDialVariables();
void gameStep();
void doGameOver();
void setPlaceState(unsigned int placeId, unsigned int newState);
void setPlaceState(uint placeId, uint newState);
void doPlaceChange();
void executeTransition(unsigned int nextPlaceId);
void fakeTransition(unsigned int dstPlaceId);
unsigned int determineTransitionAnimation(unsigned int srcId, unsigned int dstId,
const Transition **transition);
void executeTransition(uint nextPlaceId);
void fakeTransition(uint dstPlaceId);
uint determineTransitionAnimation(uint srcId, uint dstId,
const Transition **transition);
unsigned int getFakeTransition(unsigned int actionId) const;
void fixActionId(unsigned int *actionId) const;
uint getFakeTransition(uint actionId) const;
void fixActionId(uint *actionId) const;
int handleWarp();
bool handleWarpMouse(unsigned int *actionId, unsigned int movingCuror);
bool handleWarpMouse(uint *actionId, uint movingCuror);
void animateWarpTransition(const Transition *transition);
void redrawWarp();
void handleFixedImg(const FixedImgCallback &callback);
void executeSeeAction(unsigned int actionId);
void executeSeeAction(uint actionId);
void executeSpeakAction(unsigned int actionId);
void executeSpeakAction(uint actionId);
void setupDialogShows();
bool preprocessDialog(const Common::String &sequence);
void postprocessDialog(const Common::String &sequence);
void executeDocAction(unsigned int actionId);
void executeDocAction(uint actionId);
void drawMenuTitle(Graphics::ManagedSurface *surface, byte color);
unsigned int displayFilePicker(const Graphics::Surface *bgFrame, bool saveMode,
Common::String &saveName);
unsigned int displayYesNoBox(Graphics::ManagedSurface &surface, const Common::Rect &position,
unsigned int msg_id);
uint displayFilePicker(const Graphics::Surface *bgFrame, bool saveMode,
Common::String &saveName);
uint displayYesNoBox(Graphics::ManagedSurface &surface, const Common::Rect &position,
uint msg_id);
void displayMessageBox(const MsgBoxParameters &params, const Graphics::Surface *surface,
unsigned int msg_id, const Common::Point &position,
uint msg_id, const Common::Point &position,
const Common::Functor0<void> &callback) { displayMessageBox(params, surface, _messages[msg_id], position, callback); }
void displayMessageBox(const MsgBoxParameters &params, const Graphics::Surface *surface,
const Common::String &msg, const Common::Point &position,
const Common::Functor0<void> &callback);
void displayMessageBoxWarp(const Common::String &message);
void displayMessageBoxWarp(unsigned int msg_id) { displayMessageBoxWarp(_messages[msg_id]); }
void displayMessageBoxWarp(uint msg_id) { displayMessageBoxWarp(_messages[msg_id]); }
void displayCredits();
void warpMsgBoxCB();
bool canVisit() const;
Common::String getSaveFileName(bool visit, unsigned int saveNum) const;
Common::String getSaveFileName(bool visit, uint saveNum) const;
void getSavesList(bool visit, Common::Array<Common::String> &saveNames);
void saveGame(bool visit, unsigned int saveNum, const Common::String &saveName);
bool loadGame(bool visit, unsigned int saveNum);
void saveGame(bool visit, uint saveNum, const Common::String &saveName);
bool loadGame(bool visit, uint saveNum);
void animateCursor(const Object *object);
void collectObject(Object *object, const ZonFixedImage *fimg = nullptr,
bool showObject = true);
void collectObject(unsigned int nameID, const ZonFixedImage *fimg = nullptr,
void collectObject(uint nameID, const ZonFixedImage *fimg = nullptr,
bool showObject = true) { collectObject(_objects.findObjectByNameID(nameID), fimg, showObject); }
typedef void (CryOmni3DEngine_Versailles::*DisplayObjectHook)(Graphics::ManagedSurface &surface);
void displayObject(const Common::String &imgName, DisplayObjectHook hook = nullptr);
@ -326,10 +326,10 @@ private:
void playInGameVideo(const Common::String &filename, bool restoreCursorPalette = true);
void loadBMPs(const char *pattern, Graphics::Surface *bmps, unsigned int count);
void loadBMPs(const char *pattern, Graphics::Surface *bmps, uint count);
unsigned int getMusicId(unsigned int level, unsigned int placeId) const;
bool musicWouldChange(unsigned int level, unsigned int placeId) const;
uint getMusicId(uint level, uint placeId) const;
bool musicWouldChange(uint level, uint placeId) const;
void musicUpdate();
void musicPause();
void musicResume();
@ -337,11 +337,11 @@ private:
void musicSetQuiet(bool quiet);
Common::StringArray _messages;
static const unsigned int kSpritesMapTable[];
static const unsigned int kSpritesMapTableSize;
static const uint kSpritesMapTable[];
static const uint kSpritesMapTableSize;
static const LevelInitialState kLevelInitialStates[];
static const FakeTransitionActionPlace kFakeTransitions[];
Common::HashMap<unsigned int, FixedImgCallback> _imgScripts;
Common::HashMap<uint, FixedImgCallback> _imgScripts;
Common::Array<Common::String> _paintingsTitles;
Toolbar _toolbar;
@ -353,35 +353,35 @@ private:
bool _forceRedrawWarp;
byte *_transparentPaletteMap;
unsigned int _transparentSrcStart;
unsigned int _transparentSrcStop;
unsigned int _transparentDstStart;
unsigned int _transparentDstStop;
unsigned int _transparentNewStart;
unsigned int _transparentNewStop;
uint _transparentSrcStart;
uint _transparentSrcStop;
uint _transparentDstStart;
uint _transparentDstStop;
uint _transparentNewStart;
uint _transparentNewStop;
bool _isPlaying;
bool _isVisiting;
AbortCommand _abortCommand;
unsigned int _loadedSave;
uint _loadedSave;
int _omni3dSpeed;
unsigned int _currentLevel;
uint _currentLevel;
Versailles_DialogsManager _dialogsMan;
Omni3DManager _omni3dMan;
ZonFixedImage *_fixedImage;
Common::Array<unsigned int> _gameVariables;
Common::Array<uint> _gameVariables;
Common::Array<PlaceState> _placeStates;
Common::HashMap<PlaceStateActionKey, unsigned int> _actionMasks;
Common::HashMap<PlaceStateActionKey, uint> _actionMasks;
Common::HashMap<PlaceActionKey, Common::String> _whoSpeaksWhere;
Common::HashMap<unsigned int, const char *> _docPeopleRecord;
Common::HashMap<uint, const char *> _docPeopleRecord;
bool _transitionAnimateWarp;
unsigned int _nextPlaceId;
uint _nextPlaceId;
WAMParser _wam;
unsigned int _currentPlaceId;
uint _currentPlaceId;
const Place *_currentPlace;
const Image::ImageDecoder *_currentWarpImage;
@ -401,17 +401,17 @@ private:
void syncCountdown();
inline bool countDown() { if (_countingDown) { return doCountDown(); } else { return false; } }
inline void drawCountdown(Graphics::ManagedSurface *surface = nullptr) { if (_countingDown) { doDrawCountdown(surface); } }
void drawCountdownVideo(unsigned int frameNum) { drawCountdown(); }
void drawCountdownVideo(uint frameNum) { drawCountdown(); }
bool _countingDown;
unsigned int _countdownNextEvent;
uint _countdownNextEvent;
char _countdownValue[6];
Graphics::ManagedSurface _countdownSurface;
bool doCountDown();
void doDrawCountdown(Graphics::ManagedSurface *surface);
// Objects
template<unsigned int ID>
template<uint ID>
void genericDisplayObject();
void obj_105();
void obj_106();
@ -425,9 +425,9 @@ private:
void obj_142hk(Graphics::ManagedSurface &surface);
// Fixed image
template<unsigned int ID>
template<uint ID>
void genericDumbImage(ZonFixedImage *fimg);
template<unsigned int ID>
template<uint ID>
void genericPainting(ZonFixedImage *fimg);
#define IMG_CB(name) void img_ ## name(ZonFixedImage *fimg)
IMG_CB(31101);
@ -460,7 +460,7 @@ private:
IMG_CB(34174d);
IMG_CB(34174e);
IMG_CB(34174f);
static const unsigned int kSafeDigitsCount = 12;
static const uint kSafeDigitsCount = 12;
static const unsigned short kSafeDigitsX[];
static const unsigned short kSafeDigitsY[];
static const char *kSafeDates[];
@ -504,7 +504,7 @@ private:
IMG_CB(44161d);
IMG_CB(44161e);
IMG_CB(44161f);
static const unsigned int kEpigraphMaxLetters = 32;
static const uint kEpigraphMaxLetters = 32;
static const char *kEpigraphContent;
static const char *kEpigraphPassword;
bool handleEpigraph(ZonFixedImage *fimg);
@ -527,20 +527,20 @@ private:
IMG_CB(88003d);
IMG_CB(88003e);
IMG_CB(88003f);
static const unsigned int kBombPasswordSmallLength = 40;
static const unsigned int kBombPasswordMaxLength = 60;
static const uint kBombPasswordSmallLength = 40;
static const uint kBombPasswordMaxLength = 60;
static const unsigned short kBombLettersPos[2][kBombPasswordMaxLength][2];
static const char *kBombPassword;
bool handleBomb(ZonFixedImage *fimg);
void drawBombLetters(Graphics::ManagedSurface &surface, const Graphics::Surface(&bmpLetters)[26],
const unsigned int kBombPasswordLength,
const uint kBombPasswordLength,
const unsigned char (&bombPossibilites)[kBombPasswordMaxLength][5],
const unsigned char (&bombCurrentLetters)[kBombPasswordMaxLength]);
IMG_CB(88004);
IMG_CB(88004b);
#undef IMG_CB
#define FILTER_EVENT(level, place) bool filterEventLevel ## level ## Place ## place(unsigned int *event)
#define FILTER_EVENT(level, place) bool filterEventLevel ## level ## Place ## place(uint *event)
#define INIT_PLACE(level, place) void initPlaceLevel ## level ## Place ## place()
FILTER_EVENT(1, 1);
FILTER_EVENT(1, 2);

View File

@ -129,7 +129,7 @@ void CryOmni3DEngine_Versailles::setupObjects() {
#undef SET_OBJECT
}
template<unsigned int ID>
template<uint ID>
void CryOmni3DEngine_Versailles::genericDisplayObject() {
displayObject(imagesObjects[ID]);
}
@ -189,7 +189,7 @@ void CryOmni3DEngine_Versailles::obj_126hk(Graphics::ManagedSurface &surface) {
drawEpigraphLetters(surface, bmpLetters, kEpigraphPassword);
for (unsigned int i = 0; i < 26; i++) {
for (uint i = 0; i < 26; i++) {
bmpLetters[i].free();
}
}
@ -238,7 +238,7 @@ void CryOmni3DEngine_Versailles::obj_142hk(Graphics::ManagedSurface &surface) {
Common::Point(448, 356),
};
unsigned int id = _currentPlaceId - 14;
uint id = _currentPlaceId - 14;
assert(id < ARRAYSIZE(markers));
/*
@ -249,8 +249,8 @@ void CryOmni3DEngine_Versailles::obj_142hk(Graphics::ManagedSurface &surface) {
for(id = 0; id < ARRAYSIZE(markers); id++) {
*/
// Why - 20? Ask to game creators, it's like that in the code
unsigned int spriteX = markers[id].x - _sprites.getCursor(4).getWidth() / 2 - 20;
unsigned int spriteY = markers[id].y - _sprites.getCursor(4).getHeight() / 2;
uint spriteX = markers[id].x - _sprites.getCursor(4).getWidth() / 2 - 20;
uint spriteY = markers[id].y - _sprites.getCursor(4).getHeight() / 2;
surface.transBlitFrom(_sprites.getSurface(4), Common::Point(spriteX, spriteY),
_sprites.getKeyColor(4));
/*
@ -424,7 +424,7 @@ void CryOmni3DEngine_Versailles::setupImgScripts() {
}
// Generic handler for dumb fixed images
template<unsigned int ID>
template<uint ID>
void CryOmni3DEngine_Versailles::genericDumbImage(ZonFixedImage *fimg) {
fimg->load(imagesPaintings[ID]);
while (1) {
@ -446,7 +446,7 @@ void CryOmni3DEngine_Versailles::genericDumbImage(ZonFixedImage *fimg) {
} while (false)
// Generic handler for paintings fixed images
template<unsigned int ID>
template<uint ID>
void CryOmni3DEngine_Versailles::genericPainting(ZonFixedImage *fimg) {
fimg->load(imagesPaintings[ID]);
while (1) {
@ -1189,7 +1189,7 @@ bool CryOmni3DEngine_Versailles::handleSafe(ZonFixedImage *fimg) {
Graphics::ManagedSurface tempSurf;
loadBMPs("coff_%02d.bmp", bmpDigits, 10);
for (unsigned int i = 0; i < kSafeDigitsCount; i++) {
for (uint i = 0; i < kSafeDigitsCount; i++) {
safeDigits[i] = rnd.getRandomNumber(9);
}
@ -1236,7 +1236,7 @@ bool CryOmni3DEngine_Versailles::handleSafe(ZonFixedImage *fimg) {
}
}
for (unsigned int i = 0; i < 10; i++) {
for (uint i = 0; i < 10; i++) {
bmpDigits[i].free();
}
return success;
@ -1247,7 +1247,7 @@ const unsigned short CryOmni3DEngine_Versailles::kSafeDigitsY[] = { 148, 230, 31
void CryOmni3DEngine_Versailles::drawSafeDigits(Graphics::ManagedSurface &surface,
const Graphics::Surface(&bmpDigits)[10], const unsigned char (&safeDigits)[kSafeDigitsCount]) {
for (unsigned int i = 0; i < ARRAYSIZE(safeDigits); i++) {
for (uint i = 0; i < ARRAYSIZE(safeDigits); i++) {
const Graphics::Surface &digit = bmpDigits[safeDigits[i]];
Common::Point dst(kSafeDigitsX[i % 4], kSafeDigitsY[i / 4]);
surface.transBlitFrom(digit, dst);
@ -1256,13 +1256,13 @@ void CryOmni3DEngine_Versailles::drawSafeDigits(Graphics::ManagedSurface &surfac
const char *CryOmni3DEngine_Versailles::kSafeDates[] = { "1643", "1668", "1674" };
bool CryOmni3DEngine_Versailles::checkSafeDigits(unsigned char (&safeDigits)[kSafeDigitsCount]) {
unsigned int dateChecked;
uint dateChecked;
for (dateChecked = 0; dateChecked < ARRAYSIZE(kSafeDates); dateChecked++) {
const char *checkDate = kSafeDates[dateChecked];
// Find the date in one of safe digits lines
unsigned int line;
uint line;
for (line = 0; line < kSafeDigitsCount; line += 4) {
unsigned int digit;
uint digit;
for (digit = 0; digit < 4; digit++) {
if (safeDigits[line + digit] != checkDate[digit] - '0') {
break;
@ -1506,7 +1506,7 @@ IMG_CB(41802) {
break;
}
if (fimg->_usedObject && fimg->_currentZone == 0) {
unsigned int objID = fimg->_usedObject->idOBJ();
uint objID = fimg->_usedObject->idOBJ();
if (objID == 100) {
playInGameVideo("12E2_24");
// Force reload of the place
@ -1553,7 +1553,7 @@ IMG_CB(41802b) {
break;
}
if (fimg->_usedObject && fimg->_currentZone == 0) {
unsigned int objID = fimg->_usedObject->idOBJ();
uint objID = fimg->_usedObject->idOBJ();
if (objID == 100) {
playInGameVideo("12E2_24");
// Force reload of the place
@ -1598,7 +1598,7 @@ IMG_CB(41802c) {
break;
}
if (fimg->_usedObject && fimg->_currentZone == 0) {
unsigned int objID = fimg->_usedObject->idOBJ();
uint objID = fimg->_usedObject->idOBJ();
if (objID == 100) {
playInGameVideo("12E2_24");
// Force reload of the place
@ -1633,7 +1633,7 @@ IMG_CB(41802d) {
break;
}
if (fimg->_usedObject && fimg->_currentZone == 0) {
unsigned int objID = fimg->_usedObject->idOBJ();
uint objID = fimg->_usedObject->idOBJ();
if (objID == 100) {
playInGameVideo("12E2_24");
// Force reload of the place
@ -2397,7 +2397,7 @@ bool CryOmni3DEngine_Versailles::handleEpigraph(ZonFixedImage *fimg) {
}
}
for (unsigned int i = 0; i < 26; i++) {
for (uint i = 0; i < 26; i++) {
bmpLetters[i].free();
}
return success;
@ -2408,8 +2408,8 @@ const char *CryOmni3DEngine_Versailles::kEpigraphPassword = "LELOUPETLATETE";
void CryOmni3DEngine_Versailles::drawEpigraphLetters(Graphics::ManagedSurface &surface,
const Graphics::Surface(&bmpLetters)[26], const Common::String &letters) {
for (unsigned int i = 0; i < letters.size() && i < kEpigraphMaxLetters; i++) {
unsigned int letterId = 0;
for (uint i = 0; i < letters.size() && i < kEpigraphMaxLetters; i++) {
uint letterId = 0;
if (letters[i] >= 'A' && letters[i] <= 'Z') {
letterId = letters[i] - 'A';
}
@ -2930,20 +2930,20 @@ bool CryOmni3DEngine_Versailles::handleBomb(ZonFixedImage *fimg) {
unsigned char bombCurrentLetters[60];
Graphics::ManagedSurface tempSurf;
const unsigned int kBombPasswordLength = strlen(kBombPassword);
const uint kBombPasswordLength = strlen(kBombPassword);
if (kBombPasswordLength >= kBombPasswordMaxLength) {
error("Bomb password is too long");
}
loadBMPs("bomb_%02d.bmp", bmpLetters, 26);
for (unsigned int i = 0; i < kBombPasswordLength; i++) {
for (uint i = 0; i < kBombPasswordLength; i++) {
bombPossibilites[i][0] = toupper(kBombPassword[i]);
for (unsigned int j = 1; j < 5; j++) {
for (uint j = 1; j < 5; j++) {
bool foundSameLetter;
do {
foundSameLetter = false;
bombPossibilites[i][j] = rnd.getRandomNumberRng('A', 'Z');
for (unsigned int k = 0; k < j; k++) {
for (uint k = 0; k < j; k++) {
if (bombPossibilites[i][k] == bombPossibilites[i][j]) {
foundSameLetter = true;
}
@ -2984,7 +2984,7 @@ bool CryOmni3DEngine_Versailles::handleBomb(ZonFixedImage *fimg) {
// Check if password is OK
success = true;
for (unsigned int i = 0; i < kBombPasswordLength; i++) {
for (uint i = 0; i < kBombPasswordLength; i++) {
unsigned char letterChar = bombPossibilites[i][bombCurrentLetters[i]];
if (letterChar != kBombPassword[i]) {
success = false;
@ -3003,7 +3003,7 @@ bool CryOmni3DEngine_Versailles::handleBomb(ZonFixedImage *fimg) {
}
}
for (unsigned int i = 0; i < 26; i++) {
for (uint i = 0; i < 26; i++) {
bmpLetters[i].free();
}
return success;
@ -3034,13 +3034,13 @@ const unsigned short CryOmni3DEngine_Versailles::kBombLettersPos[2][kBombPasswor
};
void CryOmni3DEngine_Versailles::drawBombLetters(Graphics::ManagedSurface &surface,
const Graphics::Surface(&bmpLetters)[26], const unsigned int kBombPasswordLength,
const Graphics::Surface(&bmpLetters)[26], const uint kBombPasswordLength,
const unsigned char (&bombPossibilites)[kBombPasswordMaxLength][5],
const unsigned char (&bombCurrentLetters)[kBombPasswordMaxLength]) {
unsigned int table = kBombPasswordLength <= kBombPasswordSmallLength ? 0 : 1;
for (unsigned int i = 0; i < kBombPasswordLength; i++) {
uint table = kBombPasswordLength <= kBombPasswordSmallLength ? 0 : 1;
for (uint i = 0; i < kBombPasswordLength; i++) {
unsigned char letterChar = bombPossibilites[i][bombCurrentLetters[i]];
unsigned int letterId = 0;
uint letterId = 0;
if (letterChar >= 'A' && letterChar <= 'Z') {
letterId = letterChar - 'A';
}
@ -3103,7 +3103,7 @@ IMG_CB(88004b) {
#undef IMG_CB
// Init place and filter event
#define FILTER_EVENT(level, place) bool CryOmni3DEngine_Versailles::filterEventLevel ## level ## Place ## place(unsigned int *event)
#define FILTER_EVENT(level, place) bool CryOmni3DEngine_Versailles::filterEventLevel ## level ## Place ## place(uint *event)
#define INIT_PLACE(level, place) void CryOmni3DEngine_Versailles::initPlaceLevel ## level ## Place ## place()
FILTER_EVENT(1, 1) {
@ -3194,7 +3194,7 @@ FILTER_EVENT(1, 7) {
FILTER_EVENT(1, 14) {
if (*event == 31141 && _placeStates[14].state == 0) {
// Open the curtain
unsigned int fakePlaceId = getFakeTransition(*event);
uint fakePlaceId = getFakeTransition(*event);
fakeTransition(fakePlaceId);
playInGameVideo("10D2_1");
setPlaceState(14, 1);
@ -3236,7 +3236,7 @@ FILTER_EVENT(1, 14) {
_placeStates[14].state);
}
unsigned int fakePlaceId = getFakeTransition(*event);
uint fakePlaceId = getFakeTransition(*event);
fakeTransition(fakePlaceId);
playInGameVideo(video);
@ -3257,7 +3257,7 @@ FILTER_EVENT(2, 1) {
_dialogsMan["{JOUEUR-MONTRE-UN-PAMPHLET}"] = 'N';
_dialogsMan["{JOUEUR-MONTRE-TOUT-AUTRE-OBJET}"] = 'N';
_dialogsMan["{JOUEUR-MONTRE-PAPIER-ECRIT-ENCRE-SYMPATHIQUE}"] = 'N';
unsigned int idOBJ = _inventory.selectedObject()->idOBJ();
uint idOBJ = _inventory.selectedObject()->idOBJ();
if (idOBJ == 96 || idOBJ == 101 || idOBJ == 115 ||
idOBJ == 125 || idOBJ == 127) {
_dialogsMan["{JOUEUR-MONTRE-UN-PAMPHLET}"] = 'Y';
@ -3373,7 +3373,7 @@ FILTER_EVENT(2, 2) {
assert(callback != nullptr);
// Adjust viewpoint for video
unsigned int fakePlaceId = getFakeTransition(*event);
uint fakePlaceId = getFakeTransition(*event);
fakeTransition(fakePlaceId);
playInGameVideo(video);
@ -3395,7 +3395,7 @@ FILTER_EVENT(2, 2) {
FILTER_EVENT(2, 5) {
if (*event == 22501 && _inventory.selectedObject()) {
unsigned int idOBJ = _inventory.selectedObject()->idOBJ();
uint idOBJ = _inventory.selectedObject()->idOBJ();
if (idOBJ == 96) {
if (!_inventory.inInventoryByNameID(101)) {
_dialogsMan["{JOUEUR-MONTRE-PAMPHLET-ARTS}"] = 'Y';
@ -3480,7 +3480,7 @@ FILTER_EVENT(2, 9) {
FILTER_EVENT(2, 11) {
if (*event == 22111 && _inventory.selectedObject()) {
bool gameOver = false;
unsigned int idOBJ = _inventory.selectedObject()->idOBJ();
uint idOBJ = _inventory.selectedObject()->idOBJ();
if (idOBJ == 107) {
_dialogsMan["{JOUEUR-MONTRE-TITRE-FABLE-APPARU-SUR-ESQUISSE}"] = 'Y';
} else if (idOBJ == 109) {
@ -3510,7 +3510,7 @@ FILTER_EVENT(2, 11) {
FILTER_EVENT(2, 12) {
if (*event == 22121 && _inventory.selectedObject()) {
unsigned int idOBJ = _inventory.selectedObject()->idOBJ();
uint idOBJ = _inventory.selectedObject()->idOBJ();
if (idOBJ == 105) {
_dialogsMan["{LE JOUEUR-PRESENTE-AUTRES-ESQUISSES-OU-ESQUISSE-NON-TRIEES}"] = 'Y';
_dialogsMan["{JOUEUR-A-MONTRE-ESQUISSES-NON-TRIEES-LEBRUN}"] = 'Y';
@ -3967,7 +3967,7 @@ FILTER_EVENT(4, 15) {
FILTER_EVENT(4, 16) {
if (*event == 24161 && _inventory.selectedObject()) {
unsigned int idOBJ = _inventory.selectedObject()->idOBJ();
uint idOBJ = _inventory.selectedObject()->idOBJ();
if (idOBJ == 124) {
_dialogsMan["{JOUEUR-DONNE-REPAS}"] = 'Y';
} else {
@ -4012,7 +4012,7 @@ FILTER_EVENT(4, 17) {
setPlaceState(17, 1);
return false;
} else if (*event == 34172) {
unsigned int fakePlaceId = getFakeTransition(*event);
uint fakePlaceId = getFakeTransition(*event);
fakeTransition(fakePlaceId);
handleFixedImg(&CryOmni3DEngine_Versailles::img_34172);
return false;
@ -4035,7 +4035,7 @@ INIT_PLACE(5, 6) {
FILTER_EVENT(5, 9) {
if (*event == 25090 && _inventory.selectedObject()) {
unsigned int idOBJ = _inventory.selectedObject()->idOBJ();
uint idOBJ = _inventory.selectedObject()->idOBJ();
if (currentGameTime() < 4) {
if (idOBJ == 125 && _gameVariables[GameVariables::kStateLampoonReligion] == 3) {
_dialogsMan["{JOUEUR-MONTRE-PAMPHLET-RELIGION}"] = 'Y';
@ -4096,7 +4096,7 @@ FILTER_EVENT(5, 9) {
FILTER_EVENT(5, 14) {
if (*event == 25142 && _inventory.selectedObject()) {
unsigned int idOBJ = _inventory.selectedObject()->idOBJ();
uint idOBJ = _inventory.selectedObject()->idOBJ();
if (idOBJ == 125) {
_dialogsMan["{JOUEUR-MONTRE-PAMPHLET-RELIGION}"] = 'Y';
} else {
@ -4263,7 +4263,7 @@ FILTER_EVENT(5, 23) {
FILTER_EVENT(5, 27) {
if (*event == 25270) {
if (_inventory.selectedObject()) {
unsigned int idOBJ = _inventory.selectedObject()->idOBJ();
uint idOBJ = _inventory.selectedObject()->idOBJ();
if (idOBJ == 115) {
_dialogsMan["{JOUEUR-MONTRE-PAMPHLET-ARCHITECTURE}"] = 'Y';
} else if (idOBJ == 125) {
@ -4328,7 +4328,7 @@ FILTER_EVENT(5, 29) {
FILTER_EVENT(5, 33) {
if (*event == 35330 && !_gameVariables[GameVariables::kLoweredChandelier]) {
unsigned int fakePlaceId = getFakeTransition(*event);
uint fakePlaceId = getFakeTransition(*event);
fakeTransition(fakePlaceId);
playInGameVideo("LUSTRE");
@ -4571,7 +4571,7 @@ FILTER_EVENT(7, 20) {
void CryOmni3DEngine_Versailles::initCountdown() {
strcpy(_countdownValue, "05:00");
if (_gameVariables[GameVariables::kSavedCountdown]) {
unsigned int counter = _gameVariables[GameVariables::kSavedCountdown];
uint counter = _gameVariables[GameVariables::kSavedCountdown];
_countdownValue[4] = counter;
counter >>= 8;
_countdownValue[3] = counter;
@ -4583,7 +4583,7 @@ void CryOmni3DEngine_Versailles::initCountdown() {
}
void CryOmni3DEngine_Versailles::syncCountdown() {
unsigned int counter = 0;
uint counter = 0;
counter |= _countdownValue[0];
counter <<= 8;
counter |= _countdownValue[1];

View File

@ -60,7 +60,7 @@ void CryOmni3DEngine_Versailles::drawMenuTitle(Graphics::ManagedSurface *surface
_fontManager.setCurrentFont(oldFont);
}
unsigned int CryOmni3DEngine_Versailles::displayOptions() {
uint CryOmni3DEngine_Versailles::displayOptions() {
Common::Array<int> menuEntries;
menuEntries.push_back(26);
menuEntries.push_back(27);
@ -84,9 +84,9 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() {
int drawState = 1;
unsigned int volumeCursorMiddleY = _sprites.getCursor(102).getHeight() / 2;
unsigned int volume = CLIP(ConfMan.getInt("sfx_volume"), 0, 256);
unsigned int soundVolumeY = ((283 * (256 - volume)) >> 8) + 101;
uint volumeCursorMiddleY = _sprites.getCursor(102).getHeight() / 2;
uint volume = CLIP(ConfMan.getInt("sfx_volume"), 0, 256);
uint soundVolumeY = ((283 * (256 - volume)) >> 8) + 101;
byte volumeForeColor = 243;
Graphics::ManagedSurface optionsSurface;
@ -98,10 +98,10 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() {
setCursor(181);
g_system->showMouse(true);
unsigned int hoveredBox = -1;
unsigned int selectedBox;
uint hoveredBox = -1;
uint selectedBox;
int selectedMsg = 0;
unsigned int volumeBox;
uint volumeBox;
bool resetScreen = true;
bool forceEvents = true;
@ -132,10 +132,10 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() {
optionsSurface.hLine(544, 429, 613, volumeForeColor); // minus 1 because hLine draws inclusive
boxes.reset();
unsigned int boxId = 0;
unsigned int top = 195;
unsigned int bottom;
unsigned int width;
uint boxId = 0;
uint top = 195;
uint bottom;
uint width;
for (Common::Array<int>::iterator it = menuEntries.begin(); it != menuEntries.end(); it++) {
if (*it == 30 && !ConfMan.getBool("subtitles")) {
@ -156,7 +156,7 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() {
} else if (*it == -42 && canVisit()) {
*it = 42;
} else if (*it == 48) {
unsigned int omni3D_speed = ConfMan.getInt("omni3d_speed");
uint omni3D_speed = ConfMan.getInt("omni3d_speed");
switch (omni3D_speed) {
case 1:
*it = 51;
@ -215,7 +215,7 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() {
if (pollEvents() || forceEvents) { // always call pollEvents
forceEvents = false;
Common::Point mouse = getMousePos();
unsigned int boxId = 0;
uint boxId = 0;
Common::Array<int>::iterator it;
for (it = menuEntries.begin(); it != menuEntries.end(); it++) {
if (boxes.hitTest(boxId, mouse)) {
@ -319,7 +319,7 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() {
Common::String saveName;
bool wasVisiting = _isVisiting;
_isVisiting = false;
unsigned int saveNumber = displayFilePicker(bgFrame, false, saveName);
uint saveNumber = displayFilePicker(bgFrame, false, saveName);
if (saveNumber == -1u) {
_isVisiting = wasVisiting;
drawState = 1;
@ -334,7 +334,7 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() {
Common::String saveName;
bool wasVisiting = _isVisiting;
_isVisiting = true;
unsigned int saveNumber = displayFilePicker(bgFrame, false, saveName);
uint saveNumber = displayFilePicker(bgFrame, false, saveName);
if (saveNumber == -1u) {
_isVisiting = wasVisiting;
drawState = 1;
@ -347,7 +347,7 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() {
waitMouseRelease();
} else if (selectedMsg == 29) {
Common::String saveName;
unsigned int saveNumber = displayFilePicker(bgFrame, true, saveName);
uint saveNumber = displayFilePicker(bgFrame, true, saveName);
if (saveNumber != -1u) {
saveGame(_isVisiting, saveNumber, saveName);
}
@ -475,11 +475,11 @@ unsigned int CryOmni3DEngine_Versailles::displayOptions() {
return selectedMsg;
}
unsigned int CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurface &surface,
const Common::Rect &position, unsigned int msg_id) {
unsigned int confirmWidth = _fontManager.getStrWidth(_messages[53]);
unsigned int cancelWidth = _fontManager.getStrWidth(_messages[54]);
unsigned int oldFont = _fontManager.getCurrentFont();
uint CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurface &surface,
const Common::Rect &position, uint msg_id) {
uint confirmWidth = _fontManager.getStrWidth(_messages[53]);
uint cancelWidth = _fontManager.getStrWidth(_messages[54]);
uint oldFont = _fontManager.getCurrentFont();
_fontManager.setSurface(&surface);
_fontManager.setForeColor(240);
@ -500,11 +500,11 @@ unsigned int CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurfac
bool end = false;
bool redraw = true;
unsigned int result = -1u;
uint result = -1u;
while (!end || redraw) {
if (redraw) {
for (unsigned int boxId = 0; boxId < 2; boxId++) {
for (uint boxId = 0; boxId < 2; boxId++) {
if (boxId == result) {
_fontManager.setForeColor(240);
} else {
@ -520,7 +520,7 @@ unsigned int CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurfac
if (pollEvents()) {
Common::Point mouse = getMousePos();
unsigned int hit_result = -1u;
uint hit_result = -1u;
if (boxes.hitTest(1, mouse)) {
hit_result = 1;
} else if (boxes.hitTest(0, mouse)) {
@ -549,7 +549,7 @@ unsigned int CryOmni3DEngine_Versailles::displayYesNoBox(Graphics::ManagedSurfac
return result;
}
unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFrame,
uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFrame,
bool saveMode, Common::String &saveName) {
Graphics::ManagedSurface surface(bgFrame->w, bgFrame->h, bgFrame->format);
surface.blitFrom(*bgFrame);
@ -579,10 +579,10 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa
// Yes/No buttons
const Common::String &okMsg = _messages[53];
unsigned int okWidth = _fontManager.getStrWidth(okMsg);
uint okWidth = _fontManager.getStrWidth(okMsg);
boxes.setupBox(6, 246, 430, 246 + okWidth, 450, &okMsg);
const Common::String &cancelMsg = _messages[54];
unsigned int cancelWidth = _fontManager.getStrWidth(cancelMsg);
uint cancelWidth = _fontManager.getStrWidth(cancelMsg);
boxes.setupBox(7, 146, 430, 146 + cancelWidth, 450, &cancelMsg);
// Up/Down buttons
@ -593,19 +593,19 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa
setCursor(181);
unsigned int fileListOffset = CLIP(ConfMan.getInt(_isVisiting ? "visits_list_off" :
"saves_list_off"), 0, 100 - 6);
uint fileListOffset = CLIP(ConfMan.getInt(_isVisiting ? "visits_list_off" :
"saves_list_off"), 0, 100 - 6);
unsigned int boxHovered = -1;
unsigned int boxSelected = -1;
uint boxHovered = -1;
uint boxSelected = -1;
bool textCursorState = false;
unsigned int textCursorNextState = 0;
unsigned int textCursorPos = -1;
uint textCursorNextState = 0;
uint textCursorPos = -1;
bool autoRepeatInhibit = false;
unsigned int autoRepeatDelay = 250;
unsigned int autoRepeatEndInhibit = 0;
uint autoRepeatDelay = 250;
uint autoRepeatEndInhibit = 0;
bool finished = false;
bool filesListChanged = true;
@ -613,7 +613,7 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa
while (!finished) {
if (filesListChanged || redraw) {
if (filesListChanged) {
for (unsigned int file = 0, fileY = 280; file < 6; file++, fileY += 20) {
for (uint file = 0, fileY = 280; file < 6; file++, fileY += 20) {
boxes.setupBox(file, 146, fileY, 408, fileY + 14, &savesList[file + fileListOffset]);
}
// Redraw background as file list changed
@ -621,7 +621,7 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa
filesListChanged = false;
}
// Don't redraw the scroll buttons
for (unsigned int box = 0; box < 8; box++) {
for (uint box = 0; box < 8; box++) {
if (box == boxSelected) {
// Selected
_fontManager.setForeColor(240);
@ -661,12 +661,12 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa
g_system->updateScreen();
pollEvents();
Common::KeyState key = getNextKey();
unsigned int mousePressed = getCurrentMouseButton();
uint mousePressed = getCurrentMouseButton();
if (!mousePressed) {
bool boxFound = false;
// Don't handle scroll arrows hovering
for (unsigned int box = 0; box < 8; box++) {
for (uint box = 0; box < 8; box++) {
if (boxes.hitTest(box, getMousePos())) {
boxFound = true;
if (boxHovered != box) {
@ -733,7 +733,7 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa
}
if (g_system->getMillis() > textCursorNextState) {
textCursorNextState = g_system->getMillis() + 200; // Blink at 200ms period
unsigned int width = _fontManager.getStrWidth(savesList[boxSelected + fileListOffset]);
uint width = _fontManager.getStrWidth(savesList[boxSelected + fileListOffset]);
Common::Rect boxRct = boxes.getBoxRect(boxSelected);
textCursorPos = boxRct.left + width;
textCursorState = !textCursorState;
@ -742,7 +742,7 @@ unsigned int CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surfa
}
if (!autoRepeatInhibit) {
bool autoRepeatTrigger = false;
unsigned int oldFileListOffset = fileListOffset;
uint oldFileListOffset = fileListOffset;
if (mousePressed) {
if (boxes.hitTest(8, getMousePos()) && fileListOffset > 0) {
fileListOffset--;
@ -827,9 +827,9 @@ void CryOmni3DEngine_Versailles::displayMessageBox(const MsgBoxParameters &param
_fontManager.setSpaceWidth(params.spaceWidth);
_fontManager.setCharSpacing(params.charSpacing);
unsigned int width = params.initialWidth;
unsigned int height = params.initialHeight;
unsigned int lineCount = 0;
uint width = params.initialWidth;
uint height = params.initialHeight;
uint lineCount = 0;
Common::Point pt = position;
Common::Rect rct;
@ -868,7 +868,7 @@ void CryOmni3DEngine_Versailles::displayMessageBox(const MsgBoxParameters &param
tooLarge = true;
}
lineCount = _fontManager.getLinesCount(msg, rct.width() - 12);
if (lineCount && lineCount * _fontManager.lineHeight() + 18 < (unsigned int)rct.height()) {
if (lineCount && lineCount * _fontManager.lineHeight() + 18 < (uint)rct.height()) {
notEnough = false;
}
}
@ -889,7 +889,7 @@ void CryOmni3DEngine_Versailles::displayMessageBox(const MsgBoxParameters &param
dstSurface.w, dstSurface.h);
waitMouseRelease();
unsigned int disappearTime = g_system->getMillis() + msg.size() * params.timeoutChar * 10;
uint disappearTime = g_system->getMillis() + msg.size() * params.timeoutChar * 10;
bool finished = false;
while (!finished) {
g_system->updateScreen();
@ -962,8 +962,8 @@ void CryOmni3DEngine_Versailles::displayCredits() {
char line[256];
bool end = false;
bool calculatedScreen = false;
unsigned int lineHeight = 20;
unsigned int currentY = 0;
uint lineHeight = 20;
uint currentY = 0;
int32 fileOffset = 0;
bool skipScreen = false;
@ -985,7 +985,7 @@ void CryOmni3DEngine_Versailles::displayCredits() {
}
skipScreen = false;
// Wait
unsigned int endScreenTime = g_system->getMillis() + 6000;
uint endScreenTime = g_system->getMillis() + 6000;
while (g_system->getMillis() < endScreenTime && !skipScreen) {
g_system->updateScreen();
if (pollEvents()) {
@ -1054,7 +1054,7 @@ void CryOmni3DEngine_Versailles::displayCredits() {
} else {
// Text
if (calculatedScreen) {
unsigned int width = _fontManager.getStrWidth(line);
uint width = _fontManager.getStrWidth(line);
// Center around 315
_fontManager.displayStr(315 - width / 2, currentY, line);
}

View File

@ -52,7 +52,7 @@ void CryOmni3DEngine_Versailles::musicUpdate() {
return;
}
unsigned int musicId = getMusicId(_currentLevel, _currentPlaceId);
uint musicId = getMusicId(_currentLevel, _currentPlaceId);
const char *musicBName = kMusicFiles[_currentLevel - 1][musicId];
assert(musicBName != nullptr);
@ -131,15 +131,15 @@ void CryOmni3DEngine_Versailles::musicSetQuiet(bool quiet) {
}
}
bool CryOmni3DEngine_Versailles::musicWouldChange(unsigned int level, unsigned int placeId) const {
unsigned int musicId = getMusicId(level, placeId);
bool CryOmni3DEngine_Versailles::musicWouldChange(uint level, uint placeId) const {
uint musicId = getMusicId(level, placeId);
const char *musicFile = kMusicFiles[_currentLevel - 1][musicId];
return musicFile != _musicCurrentFile;
}
unsigned int CryOmni3DEngine_Versailles::getMusicId(unsigned int level,
unsigned int placeId) const {
uint CryOmni3DEngine_Versailles::getMusicId(uint level,
uint placeId) const {
// No need of place state
switch (level) {
case 1:

View File

@ -34,7 +34,7 @@ namespace Versailles {
#define SAVE_DESCRIPTION_LEN 20
Common::String CryOmni3DEngine_Versailles::getSaveFileName(bool visit, unsigned int saveNum) const {
Common::String CryOmni3DEngine_Versailles::getSaveFileName(bool visit, uint saveNum) const {
return Common::String::format("%s%s.%04u", _targetName.c_str(), visit ? "_visit" : "", saveNum);
}
@ -108,12 +108,12 @@ void CryOmni3DEngine_Versailles::getSavesList(bool visit, Common::StringArray &s
}
}
for (unsigned int i = saveNames.size(); i < 100; i++) {
for (uint i = saveNames.size(); i < 100; i++) {
saveNames.push_back(_messages[55]);
}
}
void CryOmni3DEngine_Versailles::saveGame(bool visit, unsigned int saveNum,
void CryOmni3DEngine_Versailles::saveGame(bool visit, uint saveNum,
const Common::String &saveName) {
if (visit && saveNum == 1) {
error("Can't erase bootstrap visit");
@ -149,17 +149,17 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, unsigned int saveNum,
// Dialog variables
assert(_dialogsMan.size() < 200);
for (unsigned int i = 0; i < _dialogsMan.size(); i++) {
for (uint i = 0; i < _dialogsMan.size(); i++) {
out->writeByte(_dialogsMan[i]);
}
for (unsigned int i = _dialogsMan.size(); i < 200; i++) {
for (uint i = _dialogsMan.size(); i < 200; i++) {
out->writeByte(0);
}
// Inventory
assert(_inventory.size() == 50);
for (Inventory::const_iterator it = _inventory.begin(); it != _inventory.end(); it++) {
unsigned int objId = -1;
uint objId = -1;
if (*it != nullptr) {
// Inventory contains pointers to objects stored in _objects
objId = *it - _objects.begin();
@ -178,20 +178,20 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, unsigned int saveNum,
// Places states
assert(_placeStates.size() <= 100);
Common::Array<PlaceState>::const_iterator placeIt = _placeStates.begin();
for (unsigned int i = 0; placeIt != _placeStates.end(); placeIt++, i++) {
for (uint i = 0; placeIt != _placeStates.end(); placeIt++, i++) {
out->writeUint32BE(placeIt->state);
}
for (unsigned int i = _placeStates.size(); i < 100; i++) {
for (uint i = _placeStates.size(); i < 100; i++) {
out->writeUint32BE(0);
}
// Game variables
assert(_gameVariables.size() < 100);
for (Common::Array<unsigned int>::const_iterator it = _gameVariables.begin();
for (Common::Array<uint>::const_iterator it = _gameVariables.begin();
it != _gameVariables.end(); it++) {
out->writeUint32BE(*it);
}
for (unsigned int i = _gameVariables.size(); i < 100; i++) {
for (uint i = _gameVariables.size(); i < 100; i++) {
out->writeUint32BE(0);
}
@ -200,7 +200,7 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, unsigned int saveNum,
delete out;
}
bool CryOmni3DEngine_Versailles::loadGame(bool visit, unsigned int saveNum) {
bool CryOmni3DEngine_Versailles::loadGame(bool visit, uint saveNum) {
Common::SeekableReadStream *in;
if (visit && saveNum == 1) {
@ -241,17 +241,17 @@ bool CryOmni3DEngine_Versailles::loadGame(bool visit, unsigned int saveNum) {
// Dialog variables
assert(_dialogsMan.size() < 200);
for (unsigned int i = 0; i < _dialogsMan.size(); i++) {
for (uint i = 0; i < _dialogsMan.size(); i++) {
_dialogsMan[i] = in->readByte();
}
for (unsigned int i = _dialogsMan.size(); i < 200; i++) {
for (uint i = _dialogsMan.size(); i < 200; i++) {
in->readByte();
}
// Inventory
assert(_inventory.size() == 50);
for (Inventory::iterator it = _inventory.begin(); it != _inventory.end(); it++) {
unsigned int objId = in->readUint32BE();
uint objId = in->readUint32BE();
if (objId >= _objects.size()) {
objId = -1;
}
@ -276,17 +276,17 @@ bool CryOmni3DEngine_Versailles::loadGame(bool visit, unsigned int saveNum) {
// Places states
// Store them and use them once we called initNewLevel, we can't call it before because it needs _gameVariables (and especially kCurrentTime) to be correctly set
uint32 placesStates[100];
for (unsigned int i = 0; i < 100; i++) {
for (uint i = 0; i < 100; i++) {
placesStates[i] = in->readUint32BE();
}
// Game variables
assert(_gameVariables.size() < 100);
for (Common::Array<unsigned int>::iterator it = _gameVariables.begin(); it != _gameVariables.end();
for (Common::Array<uint>::iterator it = _gameVariables.begin(); it != _gameVariables.end();
it++) {
*it = in->readUint32BE();
}
for (unsigned int i = _gameVariables.size(); i < 100; i++) {
for (uint i = _gameVariables.size(); i < 100; i++) {
in->readUint32BE();
}
@ -305,7 +305,7 @@ bool CryOmni3DEngine_Versailles::loadGame(bool visit, unsigned int saveNum) {
_omni3dMan.setBeta(beta);
// _placeStates has just been resized in initNewLevel
unsigned int i = 0;
uint i = 0;
for (Common::Array<PlaceState>::iterator placeIt = _placeStates.begin();
placeIt != _placeStates.end() && i < ARRAYSIZE(placesStates); placeIt++, i++) {
placeIt->state = placesStates[i];

View File

@ -73,7 +73,7 @@ Toolbar::~Toolbar() {
_destSurface.free();
}
void Toolbar::inventoryChanged(unsigned int newPosition) {
void Toolbar::inventoryChanged(uint newPosition) {
if (newPosition != -1u && newPosition > _inventoryOffset) {
_inventoryOffset = newPosition - 7;
}
@ -103,8 +103,8 @@ const {
return it;
}
unsigned int Toolbar::captureEvent(const Common::Point &mousePos, unsigned int dragStatus) {
unsigned int result = 0;
uint Toolbar::captureEvent(const Common::Point &mousePos, uint dragStatus) {
uint result = 0;
Common::Array<Zone>::const_iterator it = hitTestZones(mousePos);
if (it != _zones.end()) {
result = (this->*(it->callback))(dragStatus);
@ -162,7 +162,7 @@ void Toolbar::updateZones() {
}
}
unsigned int Toolbar::callbackInventory(unsigned int invId, unsigned int dragStatus) {
uint Toolbar::callbackInventory(uint invId, uint dragStatus) {
if (!_inventoryEnabled) {
return 0;
}
@ -206,7 +206,7 @@ unsigned int Toolbar::callbackInventory(unsigned int invId, unsigned int dragSta
}
unsigned int Toolbar::callbackInventoryPrev(unsigned int dragStatus) {
uint Toolbar::callbackInventoryPrev(uint dragStatus) {
if (!_inventoryEnabled) {
return 0;
}
@ -221,7 +221,7 @@ unsigned int Toolbar::callbackInventoryPrev(unsigned int dragStatus) {
return 0;
}
unsigned int Toolbar::callbackInventoryNext(unsigned int dragStatus) {
uint Toolbar::callbackInventoryNext(uint dragStatus) {
if (!_inventoryEnabled) {
return 0;
}
@ -235,7 +235,7 @@ unsigned int Toolbar::callbackInventoryNext(unsigned int dragStatus) {
return 0;
}
unsigned int Toolbar::callbackViewObject(unsigned int dragStatus) {
uint Toolbar::callbackViewObject(uint dragStatus) {
if (!_inventoryEnabled) {
return 0;
}
@ -274,7 +274,7 @@ unsigned int Toolbar::callbackViewObject(unsigned int dragStatus) {
}
}
unsigned int Toolbar::callbackOptions(unsigned int dragStatus) {
uint Toolbar::callbackOptions(uint dragStatus) {
_mouse_in_options = true;
switch (dragStatus) {
@ -300,7 +300,7 @@ unsigned int Toolbar::callbackOptions(unsigned int dragStatus) {
}
}
unsigned int Toolbar::callbackDocumentation(unsigned int dragStatus) {
uint Toolbar::callbackDocumentation(uint dragStatus) {
_mouse_in_options = true;
switch (dragStatus) {
@ -372,7 +372,7 @@ void Toolbar::drawToolbar(const Graphics::Surface *original) {
if (_inventoryEnabled && _inventoryHovered != -1u) {
Object *obj = (*_inventory)[_inventoryHovered];
unsigned int zoneId = _inventoryHovered - _inventoryOffset;
uint zoneId = _inventoryHovered - _inventoryOffset;
if (zoneId >= 8) {
// The object is hidden: huh?
return;
@ -383,8 +383,8 @@ void Toolbar::drawToolbar(const Graphics::Surface *original) {
_fontManager->setCurrentFont(5);
_fontManager->setTransparentBackground(true);
const Common::String &objName = (*_messages)[obj->idOBJ()];
unsigned int x = 195 - _fontManager->getStrWidth(objName);
unsigned int startX = _zones[zoneId].rect.left + kTextOffset;
uint x = 195 - _fontManager->getStrWidth(objName);
uint startX = _zones[zoneId].rect.left + kTextOffset;
_fontManager->displayStr(x, 38 + _position, objName);
_destSurface.hLine(x, 54 + _position, startX - 1, 243); // minus 1 because hLine draws inclusive
_destSurface.vLine(startX, 42 + _position, 54 + _position, 243);
@ -546,8 +546,8 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) {
// The 2nd above condition is maybe useless because when the mouse button is down the selected object is always null
bool shouldHover = false;
Common::Array<Zone>::const_iterator zoneIt = hitTestZones(mousePosInToolbar);
unsigned int zoneId = zoneIt - _zones.begin();
unsigned int inventoryId = zoneId + _inventoryOffset;
uint zoneId = zoneIt - _zones.begin();
uint inventoryId = zoneId + _inventoryOffset;
if (zoneId < 8 && inventoryId < _inventory->size() && (*_inventory)[inventoryId] != nullptr) {
// It's the inventory
shouldHover = true;

View File

@ -51,13 +51,13 @@ public:
Graphics::Surface &getBackgroundSurface() { return _bgSurface; }
bool displayToolbar(const Graphics::Surface *original);
void inventoryChanged(unsigned int newPosition);
unsigned int inventoryOffset() const { return _inventoryOffset; }
void setInventoryOffset(unsigned int offset) { _inventoryOffset = offset; }
void inventoryChanged(uint newPosition);
uint inventoryOffset() const { return _inventoryOffset; }
void setInventoryOffset(uint offset) { _inventoryOffset = offset; }
void setInventoryEnabled(bool enabled) { _inventoryEnabled = enabled; }
private:
typedef unsigned int (Toolbar::*ZoneCallback)(unsigned int dragStatus);
typedef uint(Toolbar::*ZoneCallback)(uint dragStatus);
struct Zone {
Common::Rect rect;
uint16 imageMain;
@ -73,21 +73,21 @@ private:
Inventory *_inventory;
CryOmni3DEngine *_engine;
static const unsigned int kTextOffset = 13;
static const uint kTextOffset = 13;
void addZone(uint16 cursorMainId, uint16 cursorSecondaryId, Common::Point position,
ZoneCallback callback);
void updateZones();
Common::Array<Zone>::const_iterator hitTestZones(const Common::Point &mousePos) const;
unsigned int captureEvent(const Common::Point &mousePos, unsigned int dragStatus);
uint captureEvent(const Common::Point &mousePos, uint dragStatus);
void drawToolbar(const Graphics::Surface *original);
void handleToolbarEvents(const Graphics::Surface *original);
bool _inventoryEnabled;
unsigned int _inventoryMaxOffset;
unsigned int _inventoryOffset;
unsigned int _inventoryHovered;
unsigned int _inventorySelected;
uint _inventoryMaxOffset;
uint _inventoryOffset;
uint _inventoryHovered;
uint _inventorySelected;
Object *_backup_selected_object;
bool _mouse_in_options;
@ -96,19 +96,19 @@ private:
bool _parentMustRedraw;
bool _shortExit;
unsigned int _position;
uint _position;
Graphics::Surface _bgSurface;
Graphics::ManagedSurface _destSurface;
template<unsigned int N>
unsigned int callbackInventory(unsigned int dragStatus) { return callbackInventory(N, dragStatus); }
unsigned int callbackInventory(unsigned int invId, unsigned int dragStatus);
unsigned int callbackInventoryPrev(unsigned int dragStatus);
unsigned int callbackInventoryNext(unsigned int dragStatus);
unsigned int callbackViewObject(unsigned int dragStatus);
unsigned int callbackOptions(unsigned int dragStatus);
unsigned int callbackDocumentation(unsigned int dragStatus);
template<uint N>
uint callbackInventory(uint dragStatus) { return callbackInventory(N, dragStatus); }
uint callbackInventory(uint invId, uint dragStatus);
uint callbackInventoryPrev(uint dragStatus);
uint callbackInventoryNext(uint dragStatus);
uint callbackViewObject(uint dragStatus);
uint callbackOptions(uint dragStatus);
uint callbackDocumentation(uint dragStatus);
};
} // End of namespace Versailles

View File

@ -82,7 +82,8 @@ bool HNMDecoder::loadStream(Common::SeekableReadStream *stream) {
frameCount = 0;
}
_videoTrack = new HNM4VideoTrack(width, height, frameSize, frameCount, _regularFrameDelay, _initialPalette);
_videoTrack = new HNM4VideoTrack(width, height, frameSize, frameCount, _regularFrameDelay,
_initialPalette);
if (soundBits != 0 && soundChannels != 0) {
// HNM4 is 22050Hz
_audioTrack = new DPCMAudioTrack(soundChannels, soundBits, 22050, getSoundType());
@ -202,8 +203,8 @@ void HNMDecoder::HNM4VideoTrack::decodePalette(Common::SeekableReadStream *strea
if (size < 2) {
break;
}
unsigned int start = stream->readByte();
unsigned int count = stream->readByte();
uint start = stream->readByte();
uint count = stream->readByte();
size -= 2;
if (start == 255 && count == 255) {
@ -244,7 +245,7 @@ void HNMDecoder::HNM4VideoTrack::decodeInterframe(Common::SeekableReadStream *st
uint16 width = _surface.w;
bool eop = false;
unsigned int currentPos = 0;
uint currentPos = 0;
while (!eop) {
if (size < 1) {
@ -344,7 +345,7 @@ void HNMDecoder::HNM4VideoTrack::decodeIntraframe(Common::SeekableReadStream *st
_nextNextFrameDelay = -1u;
}
HNMDecoder::DPCMAudioTrack::DPCMAudioTrack(uint16 channels, uint16 bits, unsigned int sampleRate,
HNMDecoder::DPCMAudioTrack::DPCMAudioTrack(uint16 channels, uint16 bits, uint sampleRate,
Audio::Mixer::SoundType soundType) : AudioTrack(soundType), _audioStream(nullptr),
_gotLUT(false), _lastSample(0) {
if (bits != 16) {
@ -369,7 +370,7 @@ Audio::Timestamp HNMDecoder::DPCMAudioTrack::decodeSound(Common::SeekableReadStr
stream->read(_lut, 256 * sizeof(*_lut));
size -= 256 * sizeof(*_lut);
#ifndef SCUMM_LITTLE_ENDIAN
for (unsigned int i = 0; i < 256; i++) {
for (uint i = 0; i < 256; i++) {
_lut[i] = FROM_LE_16(_lut[i]);
}
#endif

View File

@ -98,7 +98,7 @@ private:
class DPCMAudioTrack : public AudioTrack {
public:
DPCMAudioTrack(uint16 channels, uint16 bits, unsigned int sampleRate,
DPCMAudioTrack(uint16 channels, uint16 bits, uint sampleRate,
Audio::Mixer::SoundType soundType);
~DPCMAudioTrack();

View File

@ -37,13 +37,13 @@ void WAMParser::loadStream(Common::ReadStream &stream) {
stream.read(str, 16);
stream.readUint32LE();
unsigned int nPlaces = stream.readByte();
uint nPlaces = stream.readByte();
//debug("nPlaces = %u", nPlaces);
for (unsigned int i = 0; i < nPlaces; i++) {
for (uint i = 0; i < nPlaces; i++) {
Place place;
unsigned int nWarps = stream.readByte();
uint nWarps = stream.readByte();
//debug("nWarps = %u", nWarps);
for (unsigned int k = 0; k < 8; k++) {
for (uint k = 0; k < 8; k++) {
stream.read(str, 16);
//debug("Warp: %.16s", str);
if (nWarps > 0) {
@ -58,20 +58,20 @@ void WAMParser::loadStream(Common::ReadStream &stream) {
Place *oldPlace = findPlaceById_(place.placeId);
if (oldPlace) {
debug("Found duplicate place %u at %u, removing it", place.placeId,
(unsigned int)(oldPlace - _places.begin()));
(uint)(oldPlace - _places.begin()));
_places.erase(oldPlace);
}
//debug("nPlaceId = %u", place.placeId);
stream.readUint32LE();
unsigned int nTransitions = stream.readByte();
uint nTransitions = stream.readByte();
//debug("nTransitions = %u", nTransitions);
unsigned int nZones = stream.readByte();
uint nZones = stream.readByte();
//debug("nZones = %u", nZones);
for (unsigned int j = 0; j < nTransitions; j++) {
for (uint j = 0; j < nTransitions; j++) {
Transition trans;
stream.readUint32LE();
unsigned int nAnimations = stream.readByte();
for (unsigned int k = 0; k < 8; k++) {
uint nAnimations = stream.readByte();
for (uint k = 0; k < 8; k++) {
stream.read(str, 16);
if (nAnimations > 0) {
trans.animations.push_back(str);
@ -87,7 +87,7 @@ void WAMParser::loadStream(Common::ReadStream &stream) {
trans.dstBeta = stream.readDoubleLE();
place.transitions.push_back(trans);
}
for (unsigned int j = 0; j < nZones; j++) {
for (uint j = 0; j < nZones; j++) {
Zone zone;
zone.zoneId = stream.readSint32LE();
zone.rct.left = stream.readSint32LE();
@ -101,7 +101,7 @@ void WAMParser::loadStream(Common::ReadStream &stream) {
}
}
const Place *WAMParser::findPlaceById(unsigned int placeId) const {
const Place *WAMParser::findPlaceById(uint placeId) const {
for (Common::Array<Place>::const_iterator it = _places.begin(); it != _places.end(); it++) {
if (it->placeId == placeId) {
return it;
@ -110,7 +110,7 @@ const Place *WAMParser::findPlaceById(unsigned int placeId) const {
return nullptr;
}
Place *WAMParser::findPlaceById_(unsigned int placeId) {
Place *WAMParser::findPlaceById_(uint placeId) {
for (Common::Array<Place>::iterator it = _places.begin(); it != _places.end(); it++) {
if (it->placeId == placeId) {
return it;
@ -179,7 +179,7 @@ void Place::setupWarpConstraints(Omni3DManager &omni3d) const {
}
}
unsigned int Place::hitTest(const Common::Point &point) const {
uint Place::hitTest(const Common::Point &point) const {
for (Common::Array<Zone>::const_iterator it = zones.begin(); it != zones.end(); it++) {
if (it->action) {
if (it->rct.contains(point)) {
@ -203,7 +203,7 @@ unsigned int Place::hitTest(const Common::Point &point) const {
return 0;
}
const Transition *Place::findTransition(unsigned int nextPlaceId) const {
const Transition *Place::findTransition(uint nextPlaceId) const {
for (Common::Array<Transition>::const_iterator it = transitions.begin(); it != transitions.end();
it++) {
if (it->dstId == nextPlaceId) {

View File

@ -36,43 +36,43 @@ namespace CryOmni3D {
class Omni3DManager;
struct Zone {
unsigned int zoneId;
unsigned int action;
uint zoneId;
uint action;
Common::Rect rct;
};
struct Transition {
unsigned int dstId;
uint dstId;
double srcAlpha;
double srcBeta;
double dstAlpha;
double dstBeta;
Common::Array<Common::String> animations;
unsigned int getNumAnimations() const { return animations.size(); }
uint getNumAnimations() const { return animations.size(); }
};
struct Place {
unsigned int placeId;
uint placeId;
Common::Array<Common::String> warps;
Common::Array<Transition> transitions;
Common::Array<Zone> zones;
unsigned int getNumStates() const { return warps.size(); }
unsigned int getNumTransitions() const { return transitions.size(); }
uint getNumStates() const { return warps.size(); }
uint getNumTransitions() const { return transitions.size(); }
void setupWarpConstraints(Omni3DManager &omni3d) const;
unsigned int hitTest(const Common::Point &point) const;
const Transition *findTransition(unsigned int nextPlaceId) const;
uint hitTest(const Common::Point &point) const;
const Transition *findTransition(uint nextPlaceId) const;
};
class WAMParser {
public:
void loadStream(Common::ReadStream &stream);
const Place *findPlaceById(unsigned int placeId) const;
const Place *findPlaceById(uint placeId) const;
private:
// For duplicate finding
// We use a different name because else it gets chosen before the const one and fails because it's private
Place *findPlaceById_(unsigned int placeId);
Place *findPlaceById_(uint placeId);
Common::Array<Place> _places;
};