TRECISION: end of inc/dec operand harmonization, fix function comment header format

This commit is contained in:
Strangerke 2021-05-22 20:54:29 +01:00 committed by SupSuper
parent 6bcae873cb
commit 63dc1fc7e5
10 changed files with 200 additions and 197 deletions

View file

@ -382,9 +382,9 @@ void Renderer3D::shadowScanEdge(int32 x1, int32 y1, int32 x2, int32 y2) {
}
}
/*------------------------------------------------
Initialize a 3D Room
--------------------------------------------------*/
/**
* Initialize a 3D Room
*/
void Renderer3D::init3DRoom() {
_vm->_cx = (MAXX - 1) / 2;
_vm->_cy = (MAXY - 1) / 2;
@ -406,9 +406,9 @@ void Renderer3D::resetZBuffer(int x1, int y1, int x2, int y2) {
*d++ = 0x7FFF;
}
/*------------------------------------------------
Change the clipping area
--------------------------------------------------*/
/**
* Change the clipping area
*/
void Renderer3D::setClipping(int16 x1, int16 y1, int16 x2, int16 y2) {
_minXClip = x1;
_minYClip = y1;
@ -422,10 +422,10 @@ void Renderer3D::setZBufferRegion(int16 sx, int16 sy, int16 dx) {
_zBufWid = dx;
}
/*------------------------------------------------
Determines whether a triangle has clockwise
or counterclockwise vertices
--------------------------------------------------*/
/**
* Determines whether a triangle has clockwise
* or counterclockwise vertices
*/
int8 Renderer3D::clockWise(int16 x1, int16 y1, int16 x2, int16 y2, int16 x3, int16 y3) {
x2 -= x1;
y2 -= y1;
@ -454,9 +454,9 @@ int8 Renderer3D::clockWise(int16 x1, int16 y1, int16 x2, int16 y2, int16 x3, int
return 0;
}
/*------------------------------------------------
Draw the character
--------------------------------------------------*/
/**
* Draw the character
*/
void Renderer3D::drawCharacter(uint8 flag) {
if (!_vm->_flagShowCharacter)
return;
@ -896,7 +896,7 @@ void Renderer3D::paintScreen(bool flag) {
// For every box from the horizon forward...
// Copy per level
for (int liv = _vm->_pathFind->_numSortPanel; liv >= 0; liv--) {
for (int liv = _vm->_pathFind->_numSortPanel; liv >= 0; --liv) {
uint16 curBox = _vm->_pathFind->_sortPan[liv]._num;
// draws all objects and animations that intersect the boundaries and refer to the current box
@ -929,10 +929,10 @@ void Renderer3D::paintScreen(bool flag) {
//
}
/* -------------------------------------------------
Draw all objects and animations that intersect
boundaries belonging to curbox
--------------------------------------------------*/
/**
* Draw all objects and animations that intersect
* boundaries belonging to curbox
*/
void Renderer3D::paintObjAnm(uint16 curBox) {
_vm->_animMgr->refreshAnim(curBox);
@ -1204,7 +1204,7 @@ void PathFinding3D::findPath() {
_panel[b]._x2, _panel[b]._z2,
_pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z,
_curX, _curZ))
inters++;
++inters;
} else {
if (_panel[b]._col1 & 0x80) {
if (intersectLineLine(_panel[b]._x1, _panel[b]._z1,
@ -1213,7 +1213,7 @@ void PathFinding3D::findPath() {
_curX, _curZ))
if (_vm->dist2D(_x3d, _z3d, _pathNode[_numPathNodes - 1]._x, _pathNode[_numPathNodes - 1]._z) > EPSILON &&
_vm->dist2D(_x3d, _z3d, _curX, _curZ) > EPSILON)
inters++;
++inters;
} else {
if (intersectLineLine(_panel[b]._x1, _panel[b]._z1,
_panel[_panel[b]._col1 & 0x7F]._x1, _panel[_panel[b]._col1 & 0x7F]._z1,
@ -1291,9 +1291,9 @@ void PathFinding3D::findPath() {
actor->_px -= actor->_dx;
actor->_pz -= actor->_dz;
}
/*------------------------------------------------
Look for the shorter route avoiding obstacle
--------------------------------------------------*/
/**
* Look for the shorter route avoiding obstacle
*/
void PathFinding3D::findShortPath() {
SPathNode tempPath[MAXPATHNODES];
float len1, len2;
@ -1523,9 +1523,9 @@ void PathFinding3D::findShortPath() {
}
}
/*------------------------------------------------
Evaluate path length
--------------------------------------------------*/
/**
* Evaluate path length
*/
float PathFinding3D::evalPath(int a, float destX, float destZ, int nearP) {
int b = 0;
float len = 0.0f;
@ -1582,9 +1582,9 @@ float PathFinding3D::evalPath(int a, float destX, float destZ, int nearP) {
return len;
}
/*------------------------------------------------
Check if a point is inside a panel
--------------------------------------------------*/
/**
* Check if a point is inside a panel
*/
bool PathFinding3D::pointInside(int pan, float x, float z) const {
if (pan < 0)
return false;
@ -1797,9 +1797,9 @@ void PathFinding3D::lookAt(float x, float z) {
_step[_lastStep]._theta = theta;
}
/*------------------------------------------------
Build list containing all the frames
--------------------------------------------------*/
/**
* Build list containing all the frames
*/
void PathFinding3D::buildFramelist() {
// check that it never crosses or touches a narrow panel
for (int a = 1; a < _numPathNodes; ++a) {
@ -2131,9 +2131,9 @@ void PathFinding3D::buildFramelist() {
lookAt(_lookX, _lookZ);
}
/*------------------------------------------------
Take the next frame walk
--------------------------------------------------*/
/**
* Take the next frame walk
*/
int PathFinding3D::nextStep() {
Actor *actor = _vm->_actor;
actor->_px = _step[_curStep]._px;
@ -2156,16 +2156,16 @@ int PathFinding3D::nextStep() {
return true;
}
/*------------------------------------------------
View route
--------------------------------------------------*/
/**
* View route
*/
void PathFinding3D::displayPath() {
buildFramelist();
}
/*------------------------------------------------
Check if two panels are in the same block
--------------------------------------------------*/
/**
* Check if two panels are in the same block
*/
bool PathFinding3D::findAttachedPanel(int srcPanel, int destPanel) {
// if at least one is on the floor, return false
if (srcPanel < 0 || destPanel < 0)
@ -2201,9 +2201,9 @@ bool PathFinding3D::findAttachedPanel(int srcPanel, int destPanel) {
}
}
/*------------------------------------------------
Compare route distance (qsort)
--------------------------------------------------*/
/**
* Compare route distance (qsort)
*/
int pathCompare(const void *arg1, const void *arg2) {
const SPathNode *p1 = (const SPathNode *)arg1;
const SPathNode *p2 = (const SPathNode *)arg2;
@ -2217,16 +2217,16 @@ int pathCompare(const void *arg1, const void *arg2) {
return 0;
}
/*------------------------------------------------
sort the nodes of the path found
--------------------------------------------------*/
/**
* sort the nodes of the path found
*/
void PathFinding3D::sortPath() {
qsort(&_pathNode[0], _numPathNodes, sizeof(SPathNode), pathCompare);
}
/*------------------------------------------------
Initializes sort panel
--------------------------------------------------*/
/**
* Initializes sort panel
*/
void PathFinding3D::initSortPan() {
_numSortPanel = 31;
@ -2338,9 +2338,9 @@ void PathFinding3D::reset(uint16 idx,float px, float pz, float theta) {
_step[idx]._curPanel = _curPanel;
}
/*------------------------------------------------
Compare panel distance (qsort)
--------------------------------------------------*/
/**
* Compare panel distance (qsort)
*/
int panelCompare(const void *arg1, const void *arg2) {
const SSortPan *p1 = (const SSortPan *)arg1;
const SSortPan *p2 = (const SSortPan *)arg2;
@ -2354,16 +2354,16 @@ int panelCompare(const void *arg1, const void *arg2) {
return 0;
}
/*------------------------------------------------
Sort the panels
--------------------------------------------------*/
/**
* Sort the panels
*/
void PathFinding3D::sortPanel() {
qsort(&_sortPan[0], _numSortPanel, sizeof(SSortPan), panelCompare);
}
/*------------------------------------------------
Find the 3D point corresponding to the 2D point
--------------------------------------------------*/
/**
* Find the 3D point corresponding to the 2D point
*/
void PathFinding3D::whereIs(int px, int py) {
float inters = 32000.0f;
@ -2386,7 +2386,7 @@ void PathFinding3D::whereIs(int px, int py) {
}
// try all the panels and choose the closest one
for (int b = 0; b < _panelNum; b++) {
for (int b = 0; b < _panelNum; ++b) {
if (intersectLinePanel(&_panel[b], x, y, z)) {
float temp = _vm->dist3D(_vm->_actor->_camera->_ex, _vm->_actor->_camera->_ey, _vm->_actor->_camera->_ez, _x3d, _y3d, _z3d);
@ -2408,9 +2408,9 @@ void PathFinding3D::whereIs(int px, int py) {
_vm->_actor->_pz -= _vm->_actor->_dz;
}
/*------------------------------------------------
Brings out point from inner panel
--------------------------------------------------*/
/**
* Brings out point from inner panel
*/
void PathFinding3D::pointOut() {
const float largeValue = 60.0f; // 30 cm = 15 enlarge * 2
@ -2430,7 +2430,7 @@ void PathFinding3D::pointOut() {
nz /= temp;
// move the point on the wide panel
for (int b = 0; b < _panelNum; b++) {
for (int b = 0; b < _panelNum; ++b) {
panel = &_panel[b];
// Only check the external panels with the same flag
if ((panel->_flags & 0x80000000) && (panel->_flags & (_panel[_curPanel]._flags & 0x7FFFFFFF))) {
@ -2517,9 +2517,9 @@ void PathFinding3D::pointOut() {
_curZ = z;
}
/*------------------------------------------------
Projects 2D point in a 3D world
--------------------------------------------------*/
/**
* Projects 2D point in a 3D world
*/
void PathFinding3D::invPointProject(int x, int y) {
float px = (float)(x - _vm->_cx) / _vm->_actor->_camera->_fovX;
float py = (float)(y - _vm->_cy) / _vm->_actor->_camera->_fovY;
@ -2533,9 +2533,9 @@ void PathFinding3D::invPointProject(int x, int y) {
_z3d += _vm->_actor->_camera->_ez;
}
/*------------------------------------------------
Intersects a 3D line with the panel
--------------------------------------------------*/
/**
* Intersects a 3D line with the panel
*/
bool PathFinding3D::intersectLinePanel(SPan *p, float x, float y, float z) {
// If it's an enlarged panel
if (p->_flags & 0x80000000)
@ -2588,9 +2588,9 @@ bool PathFinding3D::intersectLinePanel(SPan *p, float x, float y, float z) {
return false;
}
/*------------------------------------------------
Intersects 3D line with the floor
--------------------------------------------------*/
/**
* Intersects 3D line with the floor
*/
bool PathFinding3D::intersectLineFloor(float x, float y, float z) {
float x1 = _vm->_actor->_camera->_ex;
float y1 = _vm->_actor->_camera->_ey;
@ -2622,9 +2622,9 @@ bool PathFinding3D::intersectLineFloor(float x, float y, float z) {
return false;
}
/*------------------------------------------------
Intersects a 2D line with a 2D line
--------------------------------------------------*/
/**
* Intersects a 2D line with a 2D line
*/
bool PathFinding3D::intersectLineLine(float xa, float ya, float xb, float yb, float xc, float yc, float xd, float yd) {
float divisor = (float)((xb - xa) * (yd - yc) - (yb - ya) * (xd - xc));
if (_vm->floatComp(divisor, 0.0f) == 0)
@ -2642,9 +2642,9 @@ bool PathFinding3D::intersectLineLine(float xa, float ya, float xb, float yb, fl
return true;
}
/*------------------------------------------------
Tells after which panel the character stands
--------------------------------------------------*/
/**
* Tells after which panel the character stands
*/
void PathFinding3D::actorOrder() {
const float largeValue = 15.0f; // 30 cm (max)
Actor *actor = _vm->_actor;

View file

@ -269,7 +269,7 @@ void AnimTypeManager::processAtFrame(ATFHandle *h, int type, int atf) {
_vm->_textMgr->someoneSay(307 + _oneSpeakDialogCount, oDONNA1D, 0);
if (_oneSpeakDialogCount < 6)
_oneSpeakDialogCount++;
++_oneSpeakDialogCount;
break;
case 2:
@ -307,7 +307,7 @@ void AnimTypeManager::init(uint16 an, uint16 obj) {
void AnimTypeManager::next() {
for (int i = 0; i < 3; ++i) {
if (!(_animType[i]._status & ATF_WAITTEXT) || !_vm->_flagCharacterSpeak)
_animType[i]._curFrame++;
++_animType[i]._curFrame;
}
}
@ -324,7 +324,7 @@ void AnimTypeManager::end(int type) {
uint16 flag = _vm->_animMgr->_animTab[_vm->_room[_vm->_curRoom]._bkgAnim]._flag;
for (int32 a = 0; a < MAXATFRAME; a++) {
for (int32 a = 0; a < MAXATFRAME; ++a) {
// if it's time to run this AtFrame
if (anim->_atFrame[a]._numFrame == 0 && anim->_atFrame[a]._type) {
const uint8 child = anim->_atFrame[a]._child;
@ -345,14 +345,14 @@ void AnimTypeManager::handler(int type) {
return;
if (h->_curFrame == 0)
h->_curFrame++;
++h->_curFrame;
// if this ATFrame has already been applied
if (h->_curFrame <= h->_lastFrame)
return;
uint16 flag = _vm->_animMgr->_animTab[_vm->_room[_vm->_curRoom]._bkgAnim]._flag;
for (int32 a = 0; a < MAXATFRAME; a++) {
for (int32 a = 0; a < MAXATFRAME; ++a) {
// if it's time to run this AtFrame
if ((anim->_atFrame[a]._numFrame > h->_lastFrame) && (anim->_atFrame[a]._numFrame <= h->_curFrame) && (anim->_atFrame[a]._numFrame != 0)) {
if (anim->_atFrame[a]._child == 0 ||

View file

@ -66,13 +66,14 @@ void DialogManager::showChoices(uint16 i) {
_lastPos = -1;
_vm->_graphicsMgr->clearScreenBufferTop();
for (int c = 0; c < MAXDISPCHOICES; c++)
for (int c = 0; c < MAXDISPCHOICES; ++c)
_dispChoice[c] = 0;
_curDispChoice = 0;
for (int c = dialog->_firstChoice; c < dialog->_firstChoice + dialog->_choiceNumb; ++c) {
if (!(_choice[c]._flag & DLGCHOICE_HIDE)) {
_dispChoice[_curDispChoice++] = c;
_dispChoice[_curDispChoice] = c;
++_curDispChoice;
dialogPrint(x, y, HWHITE, _vm->_sentence[_choice[c]._sentenceIndex]);
y += CARHEI;
}
@ -91,7 +92,7 @@ void DialogManager::updateChoices(int16 dmx, int16 dmy) {
_curPos = -1;
if ((_curPos != _lastPos) && ((_curPos != -1) || (_lastPos != -1))) {
for (int c = 0; c < MAXDISPCHOICES; c++) {
for (int c = 0; c < MAXDISPCHOICES; ++c) {
if (_dispChoice[c] != 0) {
if (c == _curPos)
dialogPrint(10, 5 + c * CARHEI, HGREEN, _vm->_sentence[_choice[_dispChoice[c]]._sentenceIndex]);
@ -122,19 +123,19 @@ void DialogManager::playDialog(uint16 i) {
int skip = 0;
int curChoice = 0;
for (int c = _dialog[_curDialog]._firstChoice; c < (_dialog[_curDialog]._firstChoice + _dialog[_curDialog]._choiceNumb); ++c) {
for (int c = _dialog[_curDialog]._firstChoice; c < _dialog[_curDialog]._firstChoice + _dialog[_curDialog]._choiceNumb; ++c) {
if (!(_choice[c]._flag & DLGCHOICE_HIDE))
curChoice++;
++curChoice;
}
if ((_curDialog == dC581) && !(_choice[262]._flag & DLGCHOICE_HIDE))
skip++;
if ((_curDialog == dC581) && (curChoice == 1))
skip++;
if ((_curDialog == dSHOPKEEPER1A) && (curChoice == 1))
skip++;
if (_curDialog == dC581 && !(_choice[262]._flag & DLGCHOICE_HIDE))
++skip;
if (_curDialog == dC581 && curChoice == 1)
++skip;
if (_curDialog == dSHOPKEEPER1A && curChoice == 1)
++skip;
// if there's a pre-dialog
if ((_dialog[i]._startLen > 0) && !skip)
if (_dialog[i]._startLen > 0 && !skip)
_vm->_animMgr->playMovie(_dialog[i]._startAnim, 0, _dialog[i]._startLen - 1);
else {
_vm->_animMgr->smkToggleAudio(1, false);
@ -388,7 +389,7 @@ void DialogManager::afterChoice() {
break;
case dF491:
for (int c = oPULSANTE1AD; c <= oPULSANTE33AD; c++) {
for (int c = oPULSANTE1AD; c <= oPULSANTE33AD; ++c) {
if (!_vm->_obj[c]._goRoom) {
_vm->_obj[c]._goRoom = kRoom4A;
_vm->setObjectVisible(c, true);
@ -523,7 +524,7 @@ void DialogManager::afterChoice() {
// If there's only one option, show it immediately, otherwise show available choices
int res = 0;
for (int c = dialog->_firstChoice; c < dialog->_firstChoice + dialog->_choiceNumb; c++) {
for (int c = dialog->_firstChoice; c < dialog->_firstChoice + dialog->_choiceNumb; ++c) {
if (!(_choice[c]._flag & DLGCHOICE_HIDE)) {
if (_choice[c]._flag & DLGCHOICE_EXITNOW) {
if (res == 0)
@ -545,9 +546,9 @@ void DialogManager::afterChoice() {
// If no option is visible, close the dialog
res = 0;
for (int c = dialog->_firstChoice; c < dialog->_firstChoice + dialog->_choiceNumb; c++) {
for (int c = dialog->_firstChoice; c < dialog->_firstChoice + dialog->_choiceNumb; ++c) {
if (!(_choice[c]._flag & DLGCHOICE_HIDE))
res++;
++res;
}
if (res == 0) {
@ -564,7 +565,8 @@ void DialogManager::dialogHandler(int numFrame) {
if (_vm->_flagDialogActive && !_vm->_flagDialogMenuActive) {
_vm->_graphicsMgr->hideCursor();
if (numFrame == _subTitles[_curSubTitle]._startFrame) {
int i = _curSubTitle++;
int i = _curSubTitle;
++_curSubTitle;
_vm->_drawText._rect.left = _subTitles[i]._x;
_vm->_drawText._rect.top = _subTitles[i]._y;
_vm->_drawText.tcol = _subTitles[i]._color;
@ -595,12 +597,12 @@ void DialogManager::playChoice(uint16 i) {
choice->_flag |= DLGCHOICE_HIDE;
// Disable other choices
for (int c = 0; c < MAXDISPCHOICES; c++) {
for (int c = 0; c < MAXDISPCHOICES; ++c) {
_choice[choice->_off[c]]._flag |= DLGCHOICE_HIDE;
_choice[choice->_on[c]]._flag &= ~DLGCHOICE_HIDE;
}
for (int c = _curSubTitle; c < endSubTitle; c++)
for (int c = _curSubTitle; c < endSubTitle; ++c)
totalLength += _subTitles[c]._length;
_vm->_graphicsMgr->hideCursor();
@ -633,21 +635,21 @@ bool DialogManager::showCharacterAfterDialog() const {
}
void DialogManager::syncGameStream(Common::Serializer &ser) {
for (int a = 0; a < MAXCHOICE; a++) {
for (int a = 0; a < MAXCHOICE; ++a) {
DialogChoice *choice = &_choice[a];
ser.syncAsUint16LE(choice->_flag);
ser.syncAsUint16LE(choice->_sentenceIndex);
ser.syncAsUint16LE(choice->_firstSubTitle);
ser.syncAsUint16LE(choice->_subTitleNumb);
for (int i = 0; i < MAXDISPCHOICES; i++)
for (int i = 0; i < MAXDISPCHOICES; ++i)
ser.syncAsUint16LE(choice->_on[i]);
for (int i = 0; i < MAXDISPCHOICES; i++)
for (int i = 0; i < MAXDISPCHOICES; ++i)
ser.syncAsUint16LE(choice->_off[i]);
ser.syncAsUint16LE(choice->_startFrame);
ser.syncAsUint16LE(choice->_nextDialog);
}
for (int a = 0; a < MAXDIALOG; a++) {
for (int a = 0; a < MAXDIALOG; ++a) {
Dialog *dialog = &_dialog[a];
ser.syncAsUint16LE(dialog->_flag);
ser.syncAsUint16LE(dialog->_interlocutor);
@ -655,7 +657,7 @@ void DialogManager::syncGameStream(Common::Serializer &ser) {
ser.syncAsUint16LE(dialog->_startLen);
ser.syncAsUint16LE(dialog->_firstChoice);
ser.syncAsUint16LE(dialog->_choiceNumb);
for (int i = 0; i < MAXNEWSMKPAL; i++)
for (int i = 0; i < MAXNEWSMKPAL; ++i)
ser.syncAsUint16LE(dialog->_newPal[i]);
}
}

View file

@ -55,9 +55,9 @@ bool FastFile::open(const Common::String &name) {
int numFiles = _stream->readUint32LE();
_fileEntries.resize(numFiles);
for (int i = 0; i < numFiles; i++) {
for (int i = 0; i < numFiles; ++i) {
FileEntry *entry = &_fileEntries[i];
for (int j = 0; j < 12; j++)
for (int j = 0; j < 12; ++j)
entry->name += _stream->readByte();
entry->offset = _stream->readUint32LE();
}
@ -126,7 +126,7 @@ void FastFile::decompress(const unsigned char *src, uint32 srcSize, unsigned cha
for (uint16 i = 0; i < num; ++i) {
*d++ = *cs++;
bytesWritten++;
++bytesWritten;
assert(bytesWritten <= decompSize);
}
@ -136,7 +136,7 @@ void FastFile::decompress(const unsigned char *src, uint32 srcSize, unsigned cha
assert(bytesWritten <= decompSize);
} else {
*d++ = *s++;
bytesWritten++;
++bytesWritten;
assert(bytesWritten <= decompSize);
}
}

View file

@ -103,7 +103,7 @@ void GraphicsManager::copyToScreenBuffer(const Graphics::Surface *surface, int x
}
void GraphicsManager::copyToScreenBufferInner(const Graphics::Surface *surface, int x, int y) {
for (int curY = 0; curY < surface->h; curY++) {
for (int curY = 0; curY < surface->h; ++curY) {
// NOTE: We use surface width for the pitch so that memcpy works
// correcly with surfaces from getSubArea()
memcpy(_screenBuffer.getBasePtr(x, y + curY), surface->getBasePtr(0, curY), surface->w * 2);
@ -114,8 +114,8 @@ void GraphicsManager::blitToScreenBuffer(const Graphics::Surface *surface, int x
const uint16 mask = (uint16)_screenFormat.RGBToColor(palette[0], palette[1], palette[2]);
Graphics::Surface *surface16 = surface->convertTo(_screenFormat, palette);
for (int curY = 0; curY < surface16->h; curY++) {
for (int curX = 0; curX < surface16->w; curX++) {
for (int curY = 0; curY < surface16->h; ++curY) {
for (int curX = 0; curX < surface16->w; ++curX) {
const int destX = x + curX;
const int destY = y + curY;
const uint16 pixel = (uint16)surface16->getPixel(curX, curY);
@ -149,9 +149,9 @@ uint16 *GraphicsManager::getScreenBufferPtr() {
void GraphicsManager::readSurface(Common::SeekableReadStream *stream, Graphics::Surface *surface, uint16 width, uint16 height, uint16 count) {
surface->create(width * count, height, kImageFormat);
for (uint16 i = 0; i < count; i++) {
for (uint16 y = 0; y < height; y++) {
for (uint16 x = 0; x < width; x++) {
for (uint16 i = 0; i < count; ++i) {
for (uint16 y = 0; y < height; ++y) {
for (uint16 x = 0; x < width; ++x) {
surface->setPixel(width * i + x, y, stream->readUint16LE());
}
}
@ -188,7 +188,7 @@ void GraphicsManager::setSaveSlotThumbnail(byte iconSlot, Graphics::Surface *thu
thumbnail->free();
delete thumbnail;
for (uint16 y = 0; y < ICONDY; y++) {
for (uint16 y = 0; y < ICONDY; ++y) {
memcpy(_saveSlotThumbnails.getBasePtr(ICONDX * iconSlot, y), scaled->getBasePtr(0, y), ICONDX * 2);
}
@ -254,17 +254,17 @@ void GraphicsManager::updatePixelFormat(uint16 *p, uint32 len) const {
return;
uint8 r, g, b;
for (uint32 a = 0; a < len; a++) {
for (uint32 a = 0; a < len; ++a) {
const uint16 t = p[a];
kImageFormat.colorToRGB(t, r, g, b);
p[a] = _screenFormat.RGBToColor(r, g, b);
}
}
/*------------------------------------------------
Shadow Pixel
(dark) 0..8 (light)
--------------------------------------------------*/
/**
* Shadow Pixel
* (dark) 0..8 (light)
*/
void GraphicsManager::shadow(uint16 x, uint16 y, uint8 num) {
const uint16 val = _screenBuffer.getPixel(x, y);
const uint16 shadow =
@ -282,9 +282,9 @@ void GraphicsManager::pixelAliasing(uint16 x, uint16 y) {
_screenBuffer.setPixel(x, y, aliasing(px1, px2, 2)); // 25% 75%
}
/*------------------------------------------------
Aliasing Pixel
--------------------------------------------------*/
/**
* Aliasing Pixel
*/
uint16 GraphicsManager::aliasing(uint32 val1, uint32 val2, uint8 num) {
// 0: 0% val1 100% val2
// 1: 12% val1 87% val2
@ -388,13 +388,13 @@ void GraphicsManager::drawObj(SDObj d) {
if (d.drawMask && d.objIndex >= 0) {
uint8 *mask = _vm->_maskPointers[d.objIndex];
for (uint16 b = d.rect.top; b < d.rect.bottom; b++) {
for (uint16 b = d.rect.top; b < d.rect.bottom; ++b) {
uint16 sco = 0;
uint16 c = 0;
while (sco < d.rect.width()) {
if (c == 0) { // jump
sco += *mask;
mask++;
++mask;
c = 1;
} else { // copy
@ -420,7 +420,7 @@ void GraphicsManager::drawObj(SDObj d) {
}
}
} else {
for (uint16 b = d.l.top; b < d.l.bottom; b++) {
for (uint16 b = d.l.top; b < d.l.bottom; ++b) {
memcpy(_screenBuffer.getBasePtr(d.rect.left + d.l.left, d.rect.top + b),
buf + (b * d.rect.width()) + d.l.left, d.l.width() * 2);
}
@ -440,7 +440,7 @@ void GraphicsManager::drawChar(byte curChar, uint16 sColor, uint16 tColor, uint1
uint16 fontDataOffset = 768;
const uint16 charWidth = getCharWidth(curChar);
for (uint16 y = line * CARHEI; y < (line + 1) * CARHEI; y++) {
for (uint16 y = line * CARHEI; y < (line + 1) * CARHEI; ++y) {
uint16 curPos = 0;
uint16 curColor = sColor;
@ -462,7 +462,7 @@ void GraphicsManager::drawChar(byte curChar, uint16 sColor, uint16 tColor, uint1
}
curPos += _font[charOffset + fontDataOffset];
fontDataOffset++;
++fontDataOffset;
if (curColor == sColor)
curColor = 0;
@ -497,7 +497,7 @@ void GraphicsManager::drawCharPixel(uint16 y, uint16 charLeft, uint16 charRight,
if (dst && size > 0) {
uint16 *d = dst;
for (uint32 i = 0; i < size; i++)
for (uint32 i = 0; i < size; ++i)
*d++ = color;
}
}
@ -510,7 +510,7 @@ void GraphicsManager::initCursor() {
const uint16 cursorColor = (uint16)_screenFormat.RGBToColor(255, 255, 255);
for (int i = 0; i < cw; i++) {
for (int i = 0; i < cw; ++i) {
if (i >= 8 && i <= 12 && i != 10)
continue;
cursor[cx * cw + i] = cursorColor; // horizontal

View file

@ -64,15 +64,15 @@ LogicManager::LogicManager(TrecisionEngine *vm) : _vm(vm) {
LogicManager::~LogicManager() {}
void LogicManager::syncGameStream(Common::Serializer &ser) {
for (int i = 0; i < 7; i++)
for (int i = 0; i < 7; ++i)
ser.syncAsUint16LE(_comb35[i]);
for (int i = 0; i < 4; i++)
for (int i = 0; i < 4; ++i)
ser.syncAsUint16LE(_comb49[i]);
for (int i = 0; i < 6; i++)
for (int i = 0; i < 6; ++i)
ser.syncAsUint16LE(_comb4CT[i]);
for (int i = 0; i < 6; i++)
for (int i = 0; i < 6; ++i)
ser.syncAsUint16LE(_comb58[i]);
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; ++i)
ser.syncAsUint16LE(_wheelPos[i]);
ser.syncAsUint16LE(_wheel);
ser.syncAsUint16LE(_count35);
@ -295,7 +295,7 @@ void LogicManager::startCharacterAnimations() {
break;
}
i++;
++i;
} while (characterAnimations[i]._curRoom != 0);
if (_vm->_curRoom == kRoom18 && _vm->_oldRoom == kRoom17 && !(_vm->_room[kRoom18]._flag & kObjFlagDone)) {
@ -1528,7 +1528,7 @@ void LogicManager::useInventoryWithScreen(bool *updateInventory, bool *printSent
_vm->setObjectAnim(oSLOT41, a414);
else
_vm->_textMgr->characterSay(2015);
_slotMachine41Counter++;
++_slotMachine41Counter;
*printSentence = false;
} else if ((_vm->_useWith[WITH] == oFESSURA41) && ((_vm->_obj[oFUCILE42]._anim == 0) || (_vm->_obj[oFUCILE42]._anim == a428) || (_vm->_obj[oFUCILE42]._anim == a429))) {
_vm->_textMgr->characterSay(2010);
@ -2326,7 +2326,7 @@ bool LogicManager::mouseExamine(uint16 curObj) {
case oEXIT58T:
_count58 = 0;
for (int a = 0; a < 6; a++)
for (int a = 0; a < 6; ++a)
_vm->setObjectVisible(oLED158 + a, false);
_vm->changeRoom(_vm->_obj[oEXIT58T]._goRoom);
break;
@ -2594,7 +2594,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
case oEXIT58T:
_count58 = 0;
for (uint8 a = 0; a < 6; a++)
for (uint8 a = 0; a < 6; ++a)
_vm->setObjectVisible(oLED158 + a, false);
_vm->changeRoom(_vm->_obj[oEXIT58T]._goRoom);
break;
@ -2843,7 +2843,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
case oFORO549:
case oFORO649:
case oFORO749:
for (int a = oASTAC49; a <= oASTA749; a++)
for (int a = oASTAC49; a <= oASTA749; ++a)
_vm->setObjectVisible(a, false);
_vm->setObjectVisible(oASTAC49 + curObj - oFOROC49, true);
_comb49[3] = _comb49[2];
@ -2880,7 +2880,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
case oASTA549:
case oASTA649:
case oASTA749:
for (int a = oASTAC49; a <= oASTA749; a++)
for (int a = oASTAC49; a <= oASTA749; ++a)
_vm->setObjectVisible(a, false);
_vm->setObjectVisible(oASTAC49, true);
_vm->changeRoom(kRoom49, a496, 1);
@ -2898,7 +2898,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
case oNUMERO94C:
case oNUMERO04C: {
int a;
for (a = 0; a < 6; a++) {
for (a = 0; a < 6; ++a) {
if (_comb4CT[a] == 0) {
_vm->setObjectVisible(a + oAST14C, true);
_comb4CT[a] = curObj - oNUMERO14C + 1;
@ -2912,14 +2912,14 @@ bool LogicManager::mouseOperate(uint16 curObj) {
_vm->waitDelay(60);
if ((_comb4CT[0] == 5) && (_comb4CT[1] == 6) && (_comb4CT[2] == 2) &&
(_comb4CT[3] == 3) && (_comb4CT[4] == 9) && (_comb4CT[5] == 6)) {
for (a = 0; a < 6; a++) {
for (a = 0; a < 6; ++a) {
_comb4CT[a] = 0;
_vm->setObjectVisible(oAST14C + a, false);
}
_vm->changeRoom(kRoom51, 0, 1);
_vm->_flagCharacterExists = true;
} else {
for (a = 0; a < 6; a++) {
for (a = 0; a < 6; ++a) {
_comb4CT[a] = 0;
_vm->setObjectVisible(oAST14C + a, false);
}
@ -2962,7 +2962,7 @@ bool LogicManager::mouseOperate(uint16 curObj) {
break;
case oPULSANTECD:
for (int a = oPULSANTE1AD; a <= oPULSANTE33AD; a++) {
for (int a = oPULSANTE1AD; a <= oPULSANTE33AD; ++a) {
if ((_vm->_obj[a]._goRoom == _vm->_obj[oEXIT41D]._goRoom) ||
((_vm->_obj[a]._goRoom == kRoom45) && (_vm->_obj[oEXIT41D]._goRoom == kRoom45S))) {
_vm->_textMgr->characterSay(903);
@ -3076,14 +3076,14 @@ bool LogicManager::mouseOperate(uint16 curObj) {
_vm->_soundMgr->play(wPAD1 + curObj - oTASTO158);
_vm->setObjectVisible(oLED158 + _count58, true);
_count58++;
++_count58;
if (_count58 < 6)
break;
_vm->_renderer->paintScreen(false);
_vm->waitDelay(60);
_count58 = 0;
for (int a = 0; a < 6; a++)
for (int a = 0; a < 6; ++a)
_vm->setObjectVisible(oLED158 + a, false);
if ((_comb58[0] == oTASTO058) && (_comb58[1] == oTASTO258) && (_comb58[2] == oTASTO358) &&
@ -3183,7 +3183,7 @@ bool LogicManager::mouseTalk(uint16 curObj) {
break;
case ocNEGOZIANTE1A:
for (int c = _vm->_dialogMgr->_dialog[dSHOPKEEPER1A]._firstChoice; c < (_vm->_dialogMgr->_dialog[dSHOPKEEPER1A]._firstChoice + _vm->_dialogMgr->_dialog[dSHOPKEEPER1A]._choiceNumb); c++) {
for (int c = _vm->_dialogMgr->_dialog[dSHOPKEEPER1A]._firstChoice; c < (_vm->_dialogMgr->_dialog[dSHOPKEEPER1A]._firstChoice + _vm->_dialogMgr->_dialog[dSHOPKEEPER1A]._choiceNumb); ++c) {
if (!(_vm->_dialogMgr->_choice[c]._flag & DLGCHOICE_HIDE)) {
_vm->_dialogMgr->playDialog(_vm->_obj[curObj]._goRoom);
retVal = false;
@ -3529,7 +3529,7 @@ bool LogicManager::operateInventory() {
break;
case kItemPositioner:
for (int a = oROOM41; a <= oROOM45B; a++)
for (int a = oROOM41; a <= oROOM45B; ++a)
_vm->setObjectVisible(a, false);
_vm->changeRoom(kRoom41D);
_vm->_obj[oEXIT41D]._goRoom = _vm->_curRoom;
@ -3575,7 +3575,7 @@ void LogicManager::doMouseGame() {
const uint16 displacerRoom = oROOM41 + _vm->_obj[_vm->_curObj]._goRoom - kRoom41;
if ((_vm->_curObj >= oPULSANTE1AD) && (_vm->_curObj <= oPULSANTE33AD)) {
if (!_vm->isObjectVisible(displacerRoom)) {
for (int a = oROOM41; a <= oROOM4X; a++) {
for (int a = oROOM41; a <= oROOM4X; ++a) {
if (_vm->isObjectVisible(a))
_vm->setObjectVisible(a, false);
}
@ -3587,7 +3587,7 @@ void LogicManager::doMouseGame() {
_vm->setObjectVisible(displacerRoom, true);
}
} else {
for (int a = oROOM41; a <= oROOM4X; a++) {
for (int a = oROOM41; a <= oROOM4X; ++a) {
if (_vm->isObjectVisible(a))
_vm->setObjectVisible(a, false);
}

View file

@ -44,7 +44,8 @@ void Scheduler::process() {
retry = false;
switch (_token) {
case CLASS_GAME:
if (_counter++ <= 30) {
if (_counter <= 30) {
++_counter;
_token = CLASS_ANIM;
if (_vm->_gameQueue.getMessage(&_vm->_curMessage))
_vm->_curMessage = &_vm->_idleMsg;
@ -100,7 +101,7 @@ void Scheduler::doEvent(uint8 cls, uint8 event, uint8 priority,
if (lq->_tail == MAXMESSAGE)
lq->_tail = 0;
lq->_len++;
++lq->_len;
if (lq == &_vm->_gameQueue && lq->_len > _maxMessageGame)
_maxMessageGame = lq->_len;
@ -154,7 +155,7 @@ void MessageQueue::orderEvents() {
for (uint8 pos = predEvent(_tail); pos != _head; pos = predEvent(pos)) {
if (_event[pos]->_priority > _event[predEvent(pos)]->_priority) {
if (_event[pos]->_priority < MP_HIGH)
_event[pos]->_priority++;
++_event[pos]->_priority;
SWAP(_event[pos], _event[predEvent(pos)]);
}
}

View file

@ -42,7 +42,7 @@ void SScriptFrame::sendFrame(Scheduler *scheduler) {
}
void TrecisionEngine::endScript() {
_curStack--;
--_curStack;
if (_curStack == 0) {
_flagScriptActive = false;
_graphicsMgr->showCursor();
@ -51,7 +51,7 @@ void TrecisionEngine::endScript() {
}
void TrecisionEngine::playScript(uint16 id) {
_curStack++;
++_curStack;
_flagScriptActive = true;
_graphicsMgr->hideCursor();
_curScriptFrame[_curStack] = _script[id]._firstFrame;
@ -61,7 +61,7 @@ void TrecisionEngine::playScript(uint16 id) {
void TrecisionEngine::evalScript() {
if (_characterQueue.testEmptyCharacterQueue4Script() && _gameQueue.testEmptyQueue(MC_DIALOG)) {
_curScriptFrame[_curStack]++;
++_curScriptFrame[_curStack];
_graphicsMgr->hideCursor();
processScriptFrame();
@ -83,7 +83,7 @@ void TrecisionEngine::processScriptFrame() {
SScriptFrame *nextFrame = &_scriptFrame[_curScriptFrame[_curStack] + 1];
curFrame->sendFrame(_scheduler);
if (curFrame->_noWait && !nextFrame->isEmptyEvent()) {
_curScriptFrame[_curStack]++;
++_curScriptFrame[_curStack];
loop = true;
}
}
@ -525,7 +525,7 @@ void TrecisionEngine::doMouseTake(uint16 curObj) {
// Remove object being taken
if (del) {
if (curAction) {
for (uint16 j = 0; j < MAXATFRAME; j++) {
for (uint16 j = 0; j < MAXATFRAME; ++j) {
SAtFrame *frame = &_animMgr->_animTab[curAction]._atFrame[j];
if (frame->_type == ATFCLR && frame->_index == curObj)
break;

View file

@ -78,7 +78,7 @@ void TextManager::formattingSuperString() {
_subStringAgain = true;
while (_subStringAgain) {
formattingOneString();
_subStringUsed++;
++_subStringUsed;
}
}
@ -87,7 +87,7 @@ void TextManager::formattingOneString() {
memset(_subString[_subStringUsed], '\0', MAXLENSUBSTRING);
const uint16 available = (_superString.size() - _subStringStart);
for (i = 0; i < available; i++) {
for (i = 0; i < available; ++i) {
switch (_superString[i + _subStringStart]) {
case '\0':
_subStringAgain = false;
@ -152,7 +152,7 @@ void TextManager::characterContinueTalk() {
if (!_talkTime)
_talkTime = Common::String(_subString[_curSubString]).size() * 5 / 2 + 50;
_curSubString++;
++_curSubString;
_vm->_scheduler->doEvent(MC_STRING, ME_CHARACTERSPEAKING, MP_DEFAULT, 0, 0, 0, 0);
}
@ -199,7 +199,7 @@ void TextManager::someoneContinueTalk() {
if (!_talkTime)
_talkTime = Common::String(_subString[_curSubString]).size() * 5 / 2 + 50;
_curSubString++;
++_curSubString;
_vm->_scheduler->doEvent(MC_STRING, ME_SOMEONESPEAKING, MP_DEFAULT, 0, 0, 0, 0);
}

View file

@ -36,16 +36,16 @@ namespace Trecision {
char *TrecisionEngine::getNextSentence() {
while (*_textPtr) {
*_textPtr = ~(*_textPtr);
_textPtr++;
++_textPtr;
}
_textPtr++;
++_textPtr;
return _textPtr;
}
/*-------------------------------------------------
/**
* Compute string length from character begin to end
*-------------------------------------------------*/
*/
uint16 TrecisionEngine::textLength(const Common::String &text, uint16 begin, uint16 end) {
if (text.empty())
return 0;
@ -54,7 +54,7 @@ uint16 TrecisionEngine::textLength(const Common::String &text, uint16 begin, uin
end = text.size();
uint16 retVal = 0;
for (uint16 c = begin; c < end; c++)
for (uint16 c = begin; c < end; ++c)
retVal += _graphicsMgr->getCharWidth(text[c]);
return retVal;
@ -117,13 +117,13 @@ uint32 TrecisionEngine::readTime() {
}
bool TrecisionEngine::checkMask(Common::Point pos) {
for (int8 a = MAXOBJINROOM - 1; a >= 0; a--) {
for (int8 a = MAXOBJINROOM - 1; a >= 0; --a) {
uint16 checkedObj = _room[_curRoom]._object[a];
Common::Rect lim = _obj[checkedObj]._lim;
lim.translate(0, TOP);
// Trecision includes the bottom and right coordinates
lim.right++;
lim.bottom++;
++lim.right;
++lim.bottom;
if (checkedObj && isObjectVisible(checkedObj)) {
if (lim.contains(pos)) {
@ -138,7 +138,7 @@ bool TrecisionEngine::checkMask(Common::Point pos) {
int16 d = _obj[checkedObj]._rect.left;
uint16 max = _obj[checkedObj]._rect.bottom;
for (uint16 b = _obj[checkedObj]._rect.top; b < max; b++) {
for (uint16 b = _obj[checkedObj]._rect.top; b < max; ++b) {
bool insideObj = false;
int16 e = 0;
while (e < _obj[checkedObj]._rect.width()) {
@ -150,7 +150,7 @@ bool TrecisionEngine::checkMask(Common::Point pos) {
}
e += *mask;
mask++;
++mask;
insideObj = true;
} else { // inside an object
if (b + TOP == pos.y) {
@ -161,7 +161,7 @@ bool TrecisionEngine::checkMask(Common::Point pos) {
}
e += *mask;
mask++;
++mask;
insideObj = false;
}
}
@ -248,9 +248,9 @@ void TrecisionEngine::processMouse() {
}
}
/*------------------------------------------------
Fake distance between two 2D points
--------------------------------------------------*/
/**
* Fake distance between two 2D points
*/
float TrecisionEngine::dist2D(float x1, float y1, float x2, float y2) {
const double dx = x1 - x2;
const double dy = y1 - y2;
@ -258,9 +258,9 @@ float TrecisionEngine::dist2D(float x1, float y1, float x2, float y2) {
return (float)sqrt(dx * dx + dy * dy);
}
/*------------------------------------------------
Distance between two 3D points
--------------------------------------------------*/
/**
* Distance between two 3D points
*/
float TrecisionEngine::dist3D(float x1, float y1, float z1, float x2, float y2, float z2) {
const double dx = x1 - x2;
const double dy = y1 - y2;
@ -285,7 +285,7 @@ bool TrecisionEngine::isIconArea(Common::Point pos) {
}
int TrecisionEngine::getRoomObjectIndex(uint16 objectId) {
for (uint16 index = 0; index < MAXOBJINROOM; index++) {
for (uint16 index = 0; index < MAXOBJINROOM; ++index) {
const uint16 curObjId = _room[_curRoom]._object[index];
if (curObjId == 0)
return -1;
@ -317,9 +317,9 @@ void SDText::set(Common::Rect rect, Common::Rect subtitleRect, uint16 ptcol, uin
}
}
/*-------------------------------------------------------------
calcHeight - Computes and returns the dy of the current text
--------------------------------------------------------------*/
/**
* calcHeight - Computes and returns the dy of the current text
*/
uint16 SDText::calcHeight(TrecisionEngine *vm) {
if (text.empty())
return 0;
@ -336,17 +336,17 @@ uint16 SDText::calcHeight(TrecisionEngine *vm) {
uint16 curInit = 0;
while (a < text.size()) {
a++;
++a;
if (a < text.size() && text[a] == ' ') {
if (vm->textLength(text, curInit, a) <= _rect.width())
lastSpace = a;
else if (vm->textLength(text, curInit, lastSpace) <= _rect.width()) {
uint16 b;
for (b = curInit; b < lastSpace; b++)
for (b = curInit; b < lastSpace; ++b)
_drawTextLines[curLine][b - curInit] = text[b];
_drawTextLines[curLine][b - curInit] = '\0';
curLine++;
++curLine;
curInit = lastSpace + 1;
@ -357,7 +357,7 @@ uint16 SDText::calcHeight(TrecisionEngine *vm) {
} else if (a == text.size()) {
if (vm->textLength(text, curInit, a) <= _rect.width()) {
uint16 b;
for (b = curInit; b < a; b++)
for (b = curInit; b < a; ++b)
_drawTextLines[curLine][b - curInit] = text[b];
_drawTextLines[curLine][b - curInit] = '\0';
@ -368,17 +368,17 @@ uint16 SDText::calcHeight(TrecisionEngine *vm) {
if (vm->textLength(text, curInit, lastSpace) <= _rect.width()) {
uint16 b;
for (b = curInit; b < lastSpace; b++)
for (b = curInit; b < lastSpace; ++b)
_drawTextLines[curLine][b - curInit] = text[b];
_drawTextLines[curLine][b - curInit] = '\0';
curLine++;
++curLine;
curInit = lastSpace + 1;
tmpDy += CARHEI;
if (curInit < text.size()) {
for (b = curInit; b < text.size(); b++)
for (b = curInit; b < text.size(); ++b)
_drawTextLines[curLine][b - curInit] = text[b];
_drawTextLines[curLine][b - curInit] = '\0';
@ -405,7 +405,7 @@ void SDText::draw(TrecisionEngine *vm, Graphics::Surface *externalSurface) {
const uint16 curDy = calcHeight(vm);
for (uint16 line = 0; line < curDy / CARHEI; line++) {
for (uint16 line = 0; line < curDy / CARHEI; ++line) {
Common::String curText = _drawTextLines[line];
uint16 inc = (_rect.width() - vm->textLength(curText)) / 2;
@ -413,7 +413,7 @@ void SDText::draw(TrecisionEngine *vm, Graphics::Surface *externalSurface) {
curText = vm->_sysText[kMessageError];
}
for (uint index = 0; index < curText.size(); index++) {
for (uint index = 0; index < curText.size(); ++index) {
const byte curChar = curText[index];
if (index == curText.size() - 1 && vm->_blinkLastDTextChar != MASKCOL)