mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 17:57:14 +00:00
ZVISION: Convert all for-loops to use pre-increment instead of post-increment
This commit is contained in:
parent
239493305d
commit
ffaffa2bc4
@ -76,7 +76,7 @@ void CursorManager::changeCursor(const Common::String &cursorName, bool pushed)
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_CURSORS; i++) {
|
||||
for (int i = 0; i < NUM_CURSORS; ++i) {
|
||||
if (_engine->getGameId() == GID_NEMESIS) {
|
||||
if (cursorName.equals(_cursorNames[i])) {
|
||||
_currentCursor = cursorName;
|
||||
|
@ -229,7 +229,7 @@ bool LeverControl::onMouseMove(const Common::Point &screenSpacePos, const Common
|
||||
int angle = calculateVectorAngle(_lastMousePos, backgroundImageSpacePos);
|
||||
_lastMousePos = backgroundImageSpacePos;
|
||||
|
||||
for (Common::List<Direction>::iterator iter = _frameInfo[_currentFrame].directions.begin(); iter != _frameInfo[_currentFrame].directions.end(); iter++) {
|
||||
for (Common::List<Direction>::iterator iter = _frameInfo[_currentFrame].directions.begin(); iter != _frameInfo[_currentFrame].directions.end(); ++iter) {
|
||||
if (angle >= (int)iter->angle - ANGLE_DELTA && angle <= (int)iter->angle + ANGLE_DELTA) {
|
||||
_currentFrame = iter->toFrame;
|
||||
renderFrame(_currentFrame);
|
||||
|
@ -44,7 +44,7 @@ uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes)
|
||||
break;
|
||||
uint mask = 1;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
if ((flagbyte & mask) == mask) {
|
||||
byte data = _source->readByte();
|
||||
if (_source->eos()) {
|
||||
@ -70,7 +70,7 @@ uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes)
|
||||
uint16 length = (high & 0xF) + 2;
|
||||
uint16 offset = low | ((high & 0xF0)<<4);
|
||||
|
||||
for(int j = 0; j <= length; j++) {
|
||||
for(int j = 0; j <= length; ++j) {
|
||||
byte temp = _window[(offset + j) & 0xFFF];
|
||||
_window[_windowCursor] = temp;
|
||||
destination[destinationCursor++] = temp;
|
||||
|
@ -35,7 +35,7 @@ struct Puzzle {
|
||||
Puzzle() : key(0), flags(0) {}
|
||||
|
||||
~Puzzle() {
|
||||
for (Common::List<ResultAction *>::iterator iter = resultActions.begin(); iter != resultActions.end(); iter++) {
|
||||
for (Common::List<ResultAction *>::iterator iter = resultActions.begin(); iter != resultActions.end(); ++iter) {
|
||||
delete *iter;
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ RenderManager::~RenderManager() {
|
||||
_currentBackground.free();
|
||||
_backBuffer.free();
|
||||
|
||||
for (Common::HashMap<uint32, AlphaDataEntry>::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) {
|
||||
for (Common::HashMap<uint32, AlphaDataEntry>::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); ++iter) {
|
||||
iter->_value.data->free();
|
||||
delete iter->_value.data;
|
||||
}
|
||||
@ -118,14 +118,14 @@ void RenderManager::renderBackbufferToScreen() {
|
||||
void RenderManager::processAlphaEntries() {
|
||||
// TODO: Add dirty rectangling support. AKA only draw an entry if the _backbufferDirtyRect intersects/contains the entry Rect
|
||||
|
||||
for (Common::HashMap<uint32, AlphaDataEntry>::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); iter++) {
|
||||
for (Common::HashMap<uint32, AlphaDataEntry>::iterator iter = _alphaDataEntries.begin(); iter != _alphaDataEntries.end(); ++iter) {
|
||||
uint32 destOffset = 0;
|
||||
uint32 sourceOffset = 0;
|
||||
uint16 *backbufferPtr = (uint16 *)_backBuffer.getBasePtr(iter->_value.destX + _workingWindow.left, iter->_value.destY + _workingWindow.top);
|
||||
uint16 *entryPtr = (uint16 *)iter->_value.data->getPixels();
|
||||
|
||||
for (int32 y = 0; y < iter->_value.height; y++) {
|
||||
for (int32 x = 0; x < iter->_value.width; x++) {
|
||||
for (int32 y = 0; y < iter->_value.height; ++y) {
|
||||
for (int32 x = 0; x < iter->_value.width; ++x) {
|
||||
uint16 color = entryPtr[sourceOffset + x];
|
||||
if (color != iter->_value.alphaColor) {
|
||||
backbufferPtr[destOffset + x] = color;
|
||||
@ -151,7 +151,7 @@ void RenderManager::clearWorkingWindowTo555Color(uint16 color) {
|
||||
uint16 colorIn565 = _pixelFormat.RGBToColor(r, g, b);
|
||||
uint16 *bufferPtr = (uint16 *)_workingWindowBuffer.getPixels();
|
||||
|
||||
for (uint32 i = 0; i < workingWindowSize; i++) {
|
||||
for (uint32 i = 0; i < workingWindowSize; ++i) {
|
||||
bufferPtr[i] = colorIn565;
|
||||
}
|
||||
}
|
||||
@ -293,10 +293,10 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics:
|
||||
if (isTransposed) {
|
||||
uint16 *dest = (uint16 *)destination.getPixels();
|
||||
|
||||
for (uint32 y = 0; y < imageHeight; y++) {
|
||||
for (uint32 y = 0; y < imageHeight; ++y) {
|
||||
uint32 columnIndex = y * imageWidth;
|
||||
|
||||
for (uint32 x = 0; x < imageWidth; x++) {
|
||||
for (uint32 x = 0; x < imageWidth; ++x) {
|
||||
dest[columnIndex + x] = buffer[x * imageHeight + y];
|
||||
}
|
||||
}
|
||||
@ -320,8 +320,8 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i
|
||||
uint32 sourceOffset = 0;
|
||||
uint16 *workingWindowBufferPtr = (uint16 *)_workingWindowBuffer.getBasePtr(destX, destY);
|
||||
|
||||
for (int32 y = 0; y < height; y++) {
|
||||
for (int32 x = 0; x < width; x++) {
|
||||
for (int32 y = 0; y < height; ++y) {
|
||||
for (int32 x = 0; x < width; ++x) {
|
||||
workingWindowBufferPtr[destOffset + x] = buffer[sourceOffset + x];
|
||||
}
|
||||
|
||||
@ -353,8 +353,8 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i
|
||||
uint32 destOffset = 0;
|
||||
uint16 *surfacePtr = (uint16 *)entry.data->getPixels();
|
||||
|
||||
for (int32 y = 0; y < height; y++) {
|
||||
for (int32 x = 0; x < width; x++) {
|
||||
for (int32 y = 0; y < height; ++y) {
|
||||
for (int32 x = 0; x < width; ++x) {
|
||||
surfacePtr[destOffset + x] = buffer[sourceOffset + x];
|
||||
}
|
||||
|
||||
@ -509,10 +509,10 @@ Graphics::Surface *RenderManager::tranposeSurface(const Graphics::Surface *surfa
|
||||
const uint16 *source = (const uint16 *)surface->getPixels();
|
||||
uint16 *dest = (uint16 *)tranposedSurface->getPixels();
|
||||
|
||||
for (uint32 y = 0; y < tranposedSurface->h; y++) {
|
||||
for (uint32 y = 0; y < tranposedSurface->h; ++y) {
|
||||
uint32 columnIndex = y * tranposedSurface->w;
|
||||
|
||||
for (uint32 x = 0; x < tranposedSurface->w; x++) {
|
||||
for (uint32 x = 0; x < tranposedSurface->w; ++x) {
|
||||
dest[columnIndex + x] = source[x * surface->w + y];
|
||||
}
|
||||
}
|
||||
|
@ -103,10 +103,10 @@ uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) {
|
||||
void RenderTable::mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 destWidth, const Common::Rect &subRect) {
|
||||
uint32 destOffset = 0;
|
||||
|
||||
for (int16 y = subRect.top; y < subRect.bottom; y++) {
|
||||
for (int16 y = subRect.top; y < subRect.bottom; ++y) {
|
||||
uint32 sourceOffset = y * _numColumns;
|
||||
|
||||
for (int16 x = subRect.left; x < subRect.right; x++) {
|
||||
for (int16 x = subRect.left; x < subRect.right; ++x) {
|
||||
uint32 normalizedX = x - subRect.left;
|
||||
uint32 index = sourceOffset + x;
|
||||
|
||||
@ -144,7 +144,7 @@ void RenderTable::generatePanoramaLookupTable() {
|
||||
float fovInRadians = (_panoramaOptions.fieldOfView * M_PI / 180.0f);
|
||||
float cylinderRadius = halfHeight / tan(fovInRadians);
|
||||
|
||||
for (uint x = 0; x < _numColumns; x++) {
|
||||
for (uint x = 0; x < _numColumns; ++x) {
|
||||
// Add an offset of 0.01 to overcome zero tan/atan issue (vertical line on half of screen)
|
||||
// Alpha represents the horizontal angle between the viewer at the center of a cylinder and x
|
||||
float alpha = atan(((float)x - halfWidth + 0.01f) / cylinderRadius);
|
||||
@ -155,7 +155,7 @@ void RenderTable::generatePanoramaLookupTable() {
|
||||
|
||||
float cosAlpha = cos(alpha);
|
||||
|
||||
for (uint y = 0; y < _numRows; y++) {
|
||||
for (uint y = 0; y < _numRows; ++y) {
|
||||
// To calculate y in cylinder coordinates, we can do similar triangles comparison,
|
||||
// comparing the triangle from the center to the screen and from the center to the edge of the cylinder
|
||||
int32 yInCylinderCoords = int32(floor(halfHeight + ((float)y - halfHeight) * cosAlpha));
|
||||
@ -176,7 +176,7 @@ void RenderTable::generateTiltLookupTable() {
|
||||
float fovInRadians = (_tiltOptions.fieldOfView * M_PI / 180.0f);
|
||||
float cylinderRadius = halfWidth / tan(fovInRadians);
|
||||
|
||||
for (uint y = 0; y < _numRows; y++) {
|
||||
for (uint y = 0; y < _numRows; ++y) {
|
||||
|
||||
// Add an offset of 0.01 to overcome zero tan/atan issue (horizontal line on half of screen)
|
||||
// Alpha represents the vertical angle between the viewer at the center of a cylinder and y
|
||||
@ -189,7 +189,7 @@ void RenderTable::generateTiltLookupTable() {
|
||||
float cosAlpha = cos(alpha);
|
||||
uint32 columnIndex = y * _numColumns;
|
||||
|
||||
for (uint x = 0; x < _numColumns; x++) {
|
||||
for (uint x = 0; x < _numColumns; ++x) {
|
||||
// To calculate x in cylinder coordinates, we can do similar triangles comparison,
|
||||
// comparing the triangle from the center to the screen and from the center to the edge of the cylinder
|
||||
int32 xInCylinderCoords = int32(floor(halfWidth + ((float)x - halfWidth) * cosAlpha));
|
||||
|
@ -63,14 +63,14 @@ RlfAnimation::RlfAnimation(const Common::String &fileName, bool stream)
|
||||
_frames = new Frame[_frameCount];
|
||||
|
||||
// Read in each frame
|
||||
for (uint i = 0; i < _frameCount; i++) {
|
||||
for (uint i = 0; i < _frameCount; ++i) {
|
||||
_frames[i] = readNextFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RlfAnimation::~RlfAnimation() {
|
||||
for (uint i = 0; i < _frameCount; i++) {
|
||||
for (uint i = 0; i < _frameCount; ++i) {
|
||||
delete[] _frames[i].encodedData;
|
||||
}
|
||||
delete[] _frames;
|
||||
@ -165,7 +165,7 @@ void RlfAnimation::seekToFrame(int frameNumber) {
|
||||
|
||||
int closestFrame = _currentFrame;
|
||||
int distance = (int)frameNumber - _currentFrame;
|
||||
for (Common::List<uint>::const_iterator iter = _completeFrames.begin(); iter != _completeFrames.end(); iter++) {
|
||||
for (Common::List<uint>::const_iterator iter = _completeFrames.begin(); iter != _completeFrames.end(); ++iter) {
|
||||
int newDistance = (int)frameNumber - (int)(*iter);
|
||||
if (newDistance > 0 && (closestFrame == -1 || newDistance < distance)) {
|
||||
closestFrame = (*iter);
|
||||
@ -173,7 +173,7 @@ void RlfAnimation::seekToFrame(int frameNumber) {
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = closestFrame; i <= frameNumber; i++) {
|
||||
for (int i = closestFrame; i <= frameNumber; ++i) {
|
||||
applyFrameToCurrent(i);
|
||||
}
|
||||
|
||||
|
@ -43,13 +43,13 @@ ScriptManager::ScriptManager(ZVision *engine)
|
||||
}
|
||||
|
||||
ScriptManager::~ScriptManager() {
|
||||
for (Common::List<Puzzle *>::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) {
|
||||
for (Common::List<Puzzle *>::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) {
|
||||
delete (*iter);
|
||||
}
|
||||
for (Common::List<Puzzle *>::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) {
|
||||
for (Common::List<Puzzle *>::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); ++iter) {
|
||||
delete (*iter);
|
||||
}
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
delete (*iter);
|
||||
}
|
||||
}
|
||||
@ -66,12 +66,12 @@ void ScriptManager::update(uint deltaTimeMillis) {
|
||||
|
||||
void ScriptManager::createReferenceTable() {
|
||||
// Iterate through each local Puzzle
|
||||
for (Common::List<Puzzle *>::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); activePuzzleIter++) {
|
||||
for (Common::List<Puzzle *>::iterator activePuzzleIter = _activePuzzles.begin(); activePuzzleIter != _activePuzzles.end(); ++activePuzzleIter) {
|
||||
Puzzle *puzzlePtr = (*activePuzzleIter);
|
||||
|
||||
// Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle
|
||||
for (Common::List<Common::List<Puzzle::CriteriaEntry> >::iterator criteriaIter = (*activePuzzleIter)->criteriaList.begin(); criteriaIter != (*activePuzzleIter)->criteriaList.end(); criteriaIter++) {
|
||||
for (Common::List<Puzzle::CriteriaEntry>::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); entryIter++) {
|
||||
for (Common::List<Common::List<Puzzle::CriteriaEntry> >::iterator criteriaIter = (*activePuzzleIter)->criteriaList.begin(); criteriaIter != (*activePuzzleIter)->criteriaList.end(); ++criteriaIter) {
|
||||
for (Common::List<Puzzle::CriteriaEntry>::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); ++entryIter) {
|
||||
_referenceTable[entryIter->key].push_back(puzzlePtr);
|
||||
|
||||
// If the argument is a key, add a reference to it as well
|
||||
@ -83,12 +83,12 @@ void ScriptManager::createReferenceTable() {
|
||||
}
|
||||
|
||||
// Iterate through each global Puzzle
|
||||
for (Common::List<Puzzle *>::iterator globalPuzzleIter = _globalPuzzles.begin(); globalPuzzleIter != _globalPuzzles.end(); globalPuzzleIter++) {
|
||||
for (Common::List<Puzzle *>::iterator globalPuzzleIter = _globalPuzzles.begin(); globalPuzzleIter != _globalPuzzles.end(); ++globalPuzzleIter) {
|
||||
Puzzle *puzzlePtr = (*globalPuzzleIter);
|
||||
|
||||
// Iterate through each CriteriaEntry and add a reference from the criteria key to the Puzzle
|
||||
for (Common::List<Common::List<Puzzle::CriteriaEntry> >::iterator criteriaIter = (*globalPuzzleIter)->criteriaList.begin(); criteriaIter != (*globalPuzzleIter)->criteriaList.end(); criteriaIter++) {
|
||||
for (Common::List<Puzzle::CriteriaEntry>::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); entryIter++) {
|
||||
for (Common::List<Common::List<Puzzle::CriteriaEntry> >::iterator criteriaIter = (*globalPuzzleIter)->criteriaList.begin(); criteriaIter != (*globalPuzzleIter)->criteriaList.end(); ++criteriaIter) {
|
||||
for (Common::List<Puzzle::CriteriaEntry>::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); ++entryIter) {
|
||||
_referenceTable[entryIter->key].push_back(puzzlePtr);
|
||||
|
||||
// If the argument is a key, add a reference to it as well
|
||||
@ -100,7 +100,7 @@ void ScriptManager::createReferenceTable() {
|
||||
}
|
||||
|
||||
// Remove duplicate entries
|
||||
for (Common::HashMap<uint32, Common::Array<Puzzle *> >::iterator referenceTableIter = _referenceTable.begin(); referenceTableIter != _referenceTable.end(); referenceTableIter++) {
|
||||
for (Common::HashMap<uint32, Common::Array<Puzzle *> >::iterator referenceTableIter = _referenceTable.begin(); referenceTableIter != _referenceTable.end(); ++referenceTableIter) {
|
||||
removeDuplicateEntries(referenceTableIter->_value);
|
||||
}
|
||||
}
|
||||
@ -113,7 +113,7 @@ void ScriptManager::updateNodes(uint deltaTimeMillis) {
|
||||
// Remove the node
|
||||
iter = _activeControls.erase(iter);
|
||||
} else {
|
||||
iter++;
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,10 +132,10 @@ void ScriptManager::checkPuzzleCriteria() {
|
||||
// Check each Criteria
|
||||
|
||||
bool criteriaMet = false;
|
||||
for (Common::List<Common::List<Puzzle::CriteriaEntry> >::iterator criteriaIter = puzzle->criteriaList.begin(); criteriaIter != puzzle->criteriaList.end(); criteriaIter++) {
|
||||
for (Common::List<Common::List<Puzzle::CriteriaEntry> >::iterator criteriaIter = puzzle->criteriaList.begin(); criteriaIter != puzzle->criteriaList.end(); ++criteriaIter) {
|
||||
criteriaMet = false;
|
||||
|
||||
for (Common::List<Puzzle::CriteriaEntry>::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); entryIter++) {
|
||||
for (Common::List<Puzzle::CriteriaEntry>::iterator entryIter = criteriaIter->begin(); entryIter != criteriaIter->end(); ++entryIter) {
|
||||
// Get the value to compare against
|
||||
uint argumentValue;
|
||||
if (entryIter->argumentIsAKey)
|
||||
@ -179,7 +179,7 @@ void ScriptManager::checkPuzzleCriteria() {
|
||||
setStateValue(puzzle->key, 1);
|
||||
|
||||
bool shouldContinue = true;
|
||||
for (Common::List<ResultAction *>::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); resultIter++) {
|
||||
for (Common::List<ResultAction *>::iterator resultIter = puzzle->resultActions.begin(); resultIter != puzzle->resultActions.end(); ++resultIter) {
|
||||
shouldContinue = shouldContinue && (*resultIter)->execute(_engine);
|
||||
if (!shouldContinue) {
|
||||
break;
|
||||
@ -194,7 +194,7 @@ void ScriptManager::checkPuzzleCriteria() {
|
||||
}
|
||||
|
||||
void ScriptManager::cleanStateTable() {
|
||||
for (Common::HashMap<uint32, uint32>::iterator iter = _globalState.begin(); iter != _globalState.end(); iter++) {
|
||||
for (Common::HashMap<uint32, uint32>::iterator iter = _globalState.begin(); iter != _globalState.end(); ++iter) {
|
||||
// If the value is equal to zero, we can purge it since getStateValue()
|
||||
// will return zero if _globalState doesn't contain a key
|
||||
if (iter->_value == 0) {
|
||||
@ -215,7 +215,7 @@ void ScriptManager::setStateValue(uint32 key, uint value) {
|
||||
_globalState[key] = value;
|
||||
|
||||
if (_referenceTable.contains(key)) {
|
||||
for (Common::Array<Puzzle *>::iterator iter = _referenceTable[key].begin(); iter != _referenceTable[key].end(); iter++) {
|
||||
for (Common::Array<Puzzle *>::iterator iter = _referenceTable[key].begin(); iter != _referenceTable[key].end(); ++iter) {
|
||||
_puzzlesToCheck.push((*iter));
|
||||
}
|
||||
}
|
||||
@ -230,7 +230,7 @@ void ScriptManager::addControl(Control *control) {
|
||||
}
|
||||
|
||||
Control *ScriptManager::getControl(uint32 key) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
if ((*iter)->getKey() == key) {
|
||||
return (*iter);
|
||||
}
|
||||
@ -240,7 +240,7 @@ Control *ScriptManager::getControl(uint32 key) {
|
||||
}
|
||||
|
||||
void ScriptManager::enableControl(uint32 key) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
if ((*iter)->getKey() == key) {
|
||||
(*iter)->enable();
|
||||
break;
|
||||
@ -249,7 +249,7 @@ void ScriptManager::enableControl(uint32 key) {
|
||||
}
|
||||
|
||||
void ScriptManager::disableControl(uint32 key) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
if ((*iter)->getKey() == key) {
|
||||
(*iter)->disable();
|
||||
break;
|
||||
@ -258,7 +258,7 @@ void ScriptManager::disableControl(uint32 key) {
|
||||
}
|
||||
|
||||
void ScriptManager::focusControl(uint32 key) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
uint32 controlKey = (*iter)->getKey();
|
||||
|
||||
if (controlKey == key) {
|
||||
@ -272,20 +272,20 @@ void ScriptManager::focusControl(uint32 key) {
|
||||
}
|
||||
|
||||
void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
(*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptManager::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
(*iter)->onMouseUp(screenSpacePos, backgroundImageSpacePos);
|
||||
}
|
||||
}
|
||||
|
||||
bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
|
||||
bool cursorWasChanged = false;
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
cursorWasChanged = cursorWasChanged || (*iter)->onMouseMove(screenSpacePos, backgroundImageSpacePos);
|
||||
}
|
||||
|
||||
@ -293,13 +293,13 @@ bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Commo
|
||||
}
|
||||
|
||||
void ScriptManager::onKeyDown(Common::KeyState keyState) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
(*iter)->onKeyDown(keyState);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptManager::onKeyUp(Common::KeyState keyState) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
(*iter)->onKeyUp(keyState);
|
||||
}
|
||||
}
|
||||
@ -314,11 +314,11 @@ void ScriptManager::changeLocation(char world, char room, char node, char view,
|
||||
// Clear all the containers
|
||||
_referenceTable.clear();
|
||||
_puzzlesToCheck.clear();
|
||||
for (Common::List<Puzzle *>::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) {
|
||||
for (Common::List<Puzzle *>::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) {
|
||||
delete (*iter);
|
||||
}
|
||||
_activePuzzles.clear();
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
delete (*iter);
|
||||
}
|
||||
_activeControls.clear();
|
||||
@ -343,12 +343,12 @@ void ScriptManager::changeLocation(char world, char room, char node, char view,
|
||||
_engine->getRenderManager()->setBackgroundPosition(offset);
|
||||
|
||||
// Enable all the controls
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
(*iter)->enable();
|
||||
}
|
||||
|
||||
// Add all the local puzzles to the queue to be checked
|
||||
for (Common::List<Puzzle *>::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) {
|
||||
for (Common::List<Puzzle *>::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) {
|
||||
// Reset any Puzzles that have the flag ONCE_PER_INST
|
||||
if (((*iter)->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) {
|
||||
setStateValue((*iter)->key, 0);
|
||||
@ -358,7 +358,7 @@ void ScriptManager::changeLocation(char world, char room, char node, char view,
|
||||
}
|
||||
|
||||
// Add all the global puzzles to the queue to be checked
|
||||
for (Common::List<Puzzle *>::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); iter++) {
|
||||
for (Common::List<Puzzle *>::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); ++iter) {
|
||||
// Reset any Puzzles that have the flag ONCE_PER_INST
|
||||
if (((*iter)->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) {
|
||||
setStateValue((*iter)->key, 0);
|
||||
@ -382,7 +382,7 @@ void ScriptManager::serializeStateTable(Common::WriteStream *stream) {
|
||||
// Write the number of state value entries
|
||||
stream->writeUint32LE(_globalState.size());
|
||||
|
||||
for (Common::HashMap<uint32, uint32>::iterator iter = _globalState.begin(); iter != _globalState.end(); iter++) {
|
||||
for (Common::HashMap<uint32, uint32>::iterator iter = _globalState.begin(); iter != _globalState.end(); ++iter) {
|
||||
// Write out the key/value pair
|
||||
stream->writeUint32LE(iter->_key);
|
||||
stream->writeUint32LE(iter->_value);
|
||||
@ -396,7 +396,7 @@ void ScriptManager::deserializeStateTable(Common::SeekableReadStream *stream) {
|
||||
// Read the number of key/value pairs
|
||||
uint32 numberOfPairs = stream->readUint32LE();
|
||||
|
||||
for (uint32 i = 0; i < numberOfPairs; i++) {
|
||||
for (uint32 i = 0; i < numberOfPairs; ++i) {
|
||||
uint32 key = stream->readUint32LE();
|
||||
uint32 value = stream->readUint32LE();
|
||||
// Directly access the state table so we don't trigger Puzzle checks
|
||||
@ -408,14 +408,14 @@ void ScriptManager::serializeControls(Common::WriteStream *stream) {
|
||||
// Count how many controls need to save their data
|
||||
// Because WriteStream isn't seekable
|
||||
uint32 numberOfControlsNeedingSerialization = 0;
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
if ((*iter)->needsSerialization()) {
|
||||
numberOfControlsNeedingSerialization++;
|
||||
}
|
||||
}
|
||||
stream->writeUint32LE(numberOfControlsNeedingSerialization);
|
||||
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
(*iter)->serialize(stream);
|
||||
}
|
||||
}
|
||||
@ -423,9 +423,9 @@ void ScriptManager::serializeControls(Common::WriteStream *stream) {
|
||||
void ScriptManager::deserializeControls(Common::SeekableReadStream *stream) {
|
||||
uint32 numberOfControls = stream->readUint32LE();
|
||||
|
||||
for (uint32 i = 0; i < numberOfControls; i++) {
|
||||
for (uint32 i = 0; i < numberOfControls; ++i) {
|
||||
uint32 key = stream->readUint32LE();
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
|
||||
for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
|
||||
if ((*iter)->getKey() == key) {
|
||||
(*iter)->deserialize(stream);
|
||||
break;
|
||||
|
@ -41,7 +41,7 @@ StringManager::StringManager(ZVision *engine)
|
||||
}
|
||||
|
||||
StringManager::~StringManager() {
|
||||
for (Common::HashMap<Common::String, TruetypeFont *>::iterator iter = _fonts.begin(); iter != _fonts.end(); iter++) {
|
||||
for (Common::HashMap<Common::String, TruetypeFont *>::iterator iter = _fonts.begin(); iter != _fonts.end(); ++iter) {
|
||||
delete iter->_value;
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,7 @@ void StringManager::parseStrFile(const Common::String &fileName) {
|
||||
uint textStringCursor = 0;
|
||||
bool inTag = false;
|
||||
|
||||
for (uint i = 0; i < asciiLine.size(); i++) {
|
||||
for (uint i = 0; i < asciiLine.size(); ++i) {
|
||||
switch (asciiLine[i]) {
|
||||
case '<':
|
||||
inTag = true;
|
||||
|
@ -70,7 +70,7 @@ template<class T>
|
||||
void removeDuplicateEntries(Common::Array<T> &container) {
|
||||
Common::sort(container.begin(), container.end());
|
||||
|
||||
for (uint i = 0; i + 1 < container.size(); i++) {
|
||||
for (uint i = 0; i + 1 < container.size(); ++i) {
|
||||
while (i + 1 < container.size() && container[i] == container[i + 1]) {
|
||||
container.remove_at(i + 1);
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ void scaleBuffer(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight,
|
||||
const byte *srcPtr = src;
|
||||
|
||||
if (bytesPerPixel == 1) {
|
||||
for (uint32 y = 0; y < srcHeight; y++) {
|
||||
for (uint32 x = 0; x < srcWidth; x++) {
|
||||
for (uint32 y = 0; y < srcHeight; ++y) {
|
||||
for (uint32 x = 0; x < srcWidth; ++x) {
|
||||
const byte color = *srcPtr++;
|
||||
|
||||
for (uint i = 0; i < scaleAmount; i++) {
|
||||
for (uint i = 0; i < scaleAmount; ++i) {
|
||||
dst[i] = color;
|
||||
dst[pitch + i] = color;
|
||||
}
|
||||
@ -56,12 +56,12 @@ void scaleBuffer(const byte *src, byte *dst, uint32 srcWidth, uint32 srcHeight,
|
||||
dst += pitch;
|
||||
}
|
||||
} else if (bytesPerPixel == 2) {
|
||||
for (uint32 y = 0; y < srcHeight; y++) {
|
||||
for (uint32 x = 0; x < srcWidth; x++) {
|
||||
for (uint32 y = 0; y < srcHeight; ++y) {
|
||||
for (uint32 x = 0; x < srcWidth; ++x) {
|
||||
const byte color = *srcPtr++;
|
||||
const byte color2 = *srcPtr++;
|
||||
|
||||
for (uint i = 0; i < scaleAmount; i++) {
|
||||
for (uint i = 0; i < scaleAmount; ++i) {
|
||||
uint index = i *2;
|
||||
|
||||
dst[index] = color;
|
||||
|
@ -78,7 +78,7 @@ void ZfsArchive::readHeaders(Common::SeekableReadStream *stream) {
|
||||
nextOffset = stream->readUint32LE();
|
||||
|
||||
// Read in each entry header
|
||||
for (uint32 i = 0; i < _header.filesPerBlock; i++) {
|
||||
for (uint32 i = 0; i < _header.filesPerBlock; ++i) {
|
||||
ZfsEntryHeader entryHeader;
|
||||
|
||||
entryHeader.name = readEntryName(stream);
|
||||
@ -149,7 +149,7 @@ Common::SeekableReadStream *ZfsArchive::createReadStreamForMember(const Common::
|
||||
}
|
||||
|
||||
void ZfsArchive::unXor(byte *buffer, uint32 length, const byte *xorKey) const {
|
||||
for (uint32 i = 0; i < length; i++)
|
||||
for (uint32 i = 0; i < length; ++i)
|
||||
buffer[i] ^= xorKey[i % 4];
|
||||
}
|
||||
|
||||
|
@ -165,13 +165,13 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath,
|
||||
SoundParams soundParams;
|
||||
|
||||
if (engine->getGameId() == GID_NEMESIS) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
if (zNemSoundParamLookupTable[i].identifier == (fileName[6]))
|
||||
soundParams = zNemSoundParamLookupTable[i];
|
||||
}
|
||||
}
|
||||
else if (engine->getGameId() == GID_GRANDINQUISITOR) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
if (zgiSoundParamLookupTable[i].identifier == (fileName[7]))
|
||||
soundParams = zgiSoundParamLookupTable[i];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user