[Scummvm-git-logs] scummvm master -> a211c59e14f1273e19091ca2509123b642f9e6f6
sev-
noreply at scummvm.org
Mon Oct 28 23:14:39 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a211c59e14 QDENGINE: Renames in triangles.dll minigame
Commit: a211c59e14f1273e19091ca2509123b642f9e6f6
https://github.com/scummvm/scummvm/commit/a211c59e14f1273e19091ca2509123b642f9e6f6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-10-29T00:13:59+01:00
Commit Message:
QDENGINE: Renames in triangles.dll minigame
Changed paths:
engines/qdengine/minigames/adv/m_triangles.cpp
engines/qdengine/minigames/adv/m_triangles.h
diff --git a/engines/qdengine/minigames/adv/m_triangles.cpp b/engines/qdengine/minigames/adv/m_triangles.cpp
index 4afa629fabb..746a95f3099 100644
--- a/engines/qdengine/minigames/adv/m_triangles.cpp
+++ b/engines/qdengine/minigames/adv/m_triangles.cpp
@@ -74,36 +74,36 @@ MinigameTriangle::MinigameTriangle() {
gameType_ = TRIANGLE;
}
- fieldLines_ = fieldWidth_ = 0;
+ _fieldLines = _fieldWidth = 0;
- if (!getParameter("size", fieldLines_, true))
+ if (!getParameter("size", _fieldLines, true))
return;
- if (fieldLines_ < 2)
+ if (_fieldLines < 2)
return;
if (gameType_ == RECTANGLE) {
- if (!getParameter("width", fieldWidth_, true))
+ if (!getParameter("width", _fieldWidth, true))
return;
- if (fieldWidth_ < 2)
+ if (_fieldWidth < 2)
return;
}
switch (gameType_) {
case TRIANGLE:
- fieldSize_ = sqr(fieldLines_);
+ fieldSize_ = sqr(_fieldLines);
break;
case RECTANGLE:
- fieldSize_ = fieldLines_ * fieldWidth_;
+ fieldSize_ = _fieldLines * _fieldWidth;
break;
case HEXAGON:
- assert(fieldLines_ % 2 == 0);
- if (fieldLines_ % 2 != 0)
+ assert(_fieldLines % 2 == 0);
+ if (_fieldLines % 2 != 0)
return;
- fieldSize_ = 3 * sqr(fieldLines_) / 2;
+ fieldSize_ = 3 * sqr(_fieldLines) / 2;
break;
}
- if (!getParameter("animation_time", animationTime_, true))
+ if (!getParameter("animation_time", _animationTime, true))
return;
const char *faceNameBegin = g_runtime->parameter("object_name_begin", "obj_");
@@ -113,50 +113,50 @@ MinigameTriangle::MinigameTriangle() {
char name[64];
name[63] = 0;
for (int num = 0; num < fieldSize_; ++num) {
- nodes_.push_back(Node(num, 0));
- Node& node = nodes_.back();
+ _nodes.push_back(Node(num, 0));
+ Node& node = _nodes.back();
for (int angle = 1; angle <= 3; ++angle) {
snprintf(name, 63, "%s%02d_%1d", faceNameBegin, num + 1, angle);
QDObject obj = g_runtime->getObject(name);
node.face_.push_back(obj);
- positions_.push_back(obj->R());
+ _positions.push_back(obj->R());
}
}
Common::MemoryReadWriteStream gameData(DisposeAfterUse::YES);
- for (auto &it : positions_)
+ for (auto &it : _positions)
it.write(gameData);
if (!g_runtime->processGameData(gameData))
return;
- for (auto &it : positions_)
+ for (auto &it : _positions)
it.read(gameData);
for (int num = 1; num <= 2; ++num) {
for (int angle = 1; angle <= 3; ++angle) {
snprintf(name, 63, "%s%1d_%1d", backNameBegin, num, angle);
- if (!backSides_[(num - 1) * 3 + angle - 1].load(name))
+ if (!_backSides[(num - 1) * 3 + angle - 1].load(name))
return;
}
snprintf(name, 63, "%s%1d", selectNameBegin, num);
- if (!selectBorders_[num - 1].load(name))
+ if (!_selectBorders[num - 1].load(name))
return;
}
- selectDepth_ = nodes_[0].face_[0].depth() - 1000;
+ _selectDepth = _nodes[0].face_[0].depth() - 1000;
- selected_ = -1;
- hovered_ = -1;
+ _selected = -1;
+ _hovered = -1;
- animationState_ = NO_ANIMATION;
+ _animationState = NO_ANIMATION;
animatedNodes_[0] = animatedNodes_[1] = -1;
- animationTimer_ = 0.f;
+ _animationTimer = 0.f;
if (!g_runtime->debugMode())
for (int i = 0; i < 150; ++i) {
- int pos1 = g_runtime->rnd(0, nodes_.size() - 1);
+ int pos1 = g_runtime->rnd(0, _nodes.size() - 1);
for (int j = 0; j < 20; ++j) {
int pos2 = g_runtime->rnd(pos1 - 10, pos1 + 10);
if (compatible(pos1, pos2)) {
@@ -167,20 +167,20 @@ MinigameTriangle::MinigameTriangle() {
}
for (int idx = 0; idx < fieldSize_; ++idx)
- updateNode(nodes_[idx], idx);
+ updateNode(_nodes[idx], idx);
setState(RUNNING);
}
MinigameTriangle::~MinigameTriangle() {
- for (auto &it : nodes_)
+ for (auto &it : _nodes)
it.release();
for (int idx = 0; idx < 2; ++idx)
- selectBorders_[idx].release();
+ _selectBorders[idx].release();
for (int idx = 0; idx < 6; ++idx)
- backSides_[idx].release();
+ _backSides[idx].release();
}
void MinigameTriangle::Node::debugInfo() const {
@@ -216,7 +216,7 @@ void MinigameTriangle::releaseNodeBack(Node& node) {
if (node.back_) {
node.back_.setState(Node::getBackStateName(false, false, false));
for (int type = 0; type < 6; ++type)
- backSides_[type].releaseObject(node.back_);
+ _backSides[type].releaseObject(node.back_);
}
}
@@ -228,7 +228,7 @@ void MinigameTriangle::updateNode(Node& node, int position, int flip, bool quick
if (node.isBack_) {
if (!node.back_)
- node.back_ = backSides_[orientation(position) * 3 + flip].getObject();
+ node.back_ = _backSides[orientation(position) * 3 + flip].getObject();
node.back_->set_R(slotCoord(position, flip));
node.back_->update_screen_R();
node.back_.setState(Node::getBackStateName(node.highlight_, node.animated_, quick));
@@ -244,9 +244,9 @@ void MinigameTriangle::updateNode(Node& node, int position, int flip, bool quick
void MinigameTriangle::highlight(int idx, bool hl) {
if (idx >= 0) {
- assert(idx < (int)nodes_.size());
- nodes_[idx].highlight_ = hl;
- updateNode(nodes_[idx], idx);
+ assert(idx < (int)_nodes.size());
+ _nodes[idx].highlight_ = hl;
+ updateNode(_nodes[idx], idx);
}
}
@@ -256,14 +256,14 @@ void MinigameTriangle::beginSwapNodes(int pos1, int pos2) {
if (pos1 > pos2)
SWAP(pos1, pos2);
- animationState_ = FIRST_PHASE;
- animationTimer_ = animationTime_;
+ _animationState = FIRST_PHASE;
+ _animationTimer = _animationTime;
animatedNodes_[0] = pos1;
animatedNodes_[1] = pos2;
- Node& node1 = nodes_[pos1];
- Node& node2 = nodes_[pos2];
+ Node& node1 = _nodes[pos1];
+ Node& node2 = _nodes[pos2];
node1.animated_ = true;
node2.animated_ = true;
@@ -275,13 +275,13 @@ void MinigameTriangle::beginSwapNodes(int pos1, int pos2) {
updateNode(node2, pos2, destination(pos1, pos2));
debugC(5, kDebugMinigames, ">>>>>>>>>>>>>>>>>>>>>>>>>>> change %d <> %d, 1st phase <<<<<<<<<<<<<<<<<<<<<<<<<<<<", pos1, pos2);
- nodes_[pos1].debugInfo();
- nodes_[pos2].debugInfo();
+ _nodes[pos1].debugInfo();
+ _nodes[pos2].debugInfo();
}
void MinigameTriangle::endSwapNodes(int pos1, int pos2) {
- Node& node1 = nodes_[pos1];
- Node& node2 = nodes_[pos2];
+ Node& node1 = _nodes[pos1];
+ Node& node2 = _nodes[pos2];
bool counted = false;
if (node1.number_ == pos1) { // поÑÑавили на Ñвое меÑÑо
@@ -318,7 +318,7 @@ void MinigameTriangle::endSwapNodes(int pos1, int pos2) {
bool isWin = true;
int position = 0;
- for (auto &it : nodes_) {
+ for (auto &it : _nodes) {
if (it.number_ != position++) {
isWin = false;
break;
@@ -332,17 +332,17 @@ void MinigameTriangle::endSwapNodes(int pos1, int pos2) {
}
bool MinigameTriangle::animate(float dt) {
- if (animationState_ == NO_ANIMATION)
+ if (_animationState == NO_ANIMATION)
return false;
- animationTimer_ -= dt;
- if (animationTimer_ > 0)
+ _animationTimer -= dt;
+ if (_animationTimer > 0)
return true;
- Node& node1 = nodes_[animatedNodes_[0]];
- Node& node2 = nodes_[animatedNodes_[1]];
+ Node& node1 = _nodes[animatedNodes_[0]];
+ Node& node2 = _nodes[animatedNodes_[1]];
- switch (animationState_) {
+ switch (_animationState) {
case FIRST_PHASE: {
node1.rotation_ = getRotate(animatedNodes_[0], animatedNodes_[1]);
node2.rotation_ = getRotate(animatedNodes_[1], animatedNodes_[0]);
@@ -362,8 +362,8 @@ bool MinigameTriangle::animate(float dt) {
updateNode(node1, animatedNodes_[1], destination(animatedNodes_[0], animatedNodes_[1]), true);
updateNode(node2, animatedNodes_[0], destination(animatedNodes_[1], animatedNodes_[0]), true);
- animationTimer_ = 0.f;
- animationState_ = SECOND_PHASE;
+ _animationTimer = 0.f;
+ _animationState = SECOND_PHASE;
debugC(5, kDebugMinigames, ">>>>>>>>>>>>>>>>>>>>>>>>>>> change %d <> %d, 2nd phase 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<", animatedNodes_[0], animatedNodes_[1]);
node1.debugInfo();
@@ -380,8 +380,8 @@ bool MinigameTriangle::animate(float dt) {
SWAP(node1, node2);
- animationTimer_ = animationTime_;
- animationState_ = FIRD_PHASE;
+ _animationTimer = _animationTime;
+ _animationState = FIRD_PHASE;
debugC(5, kDebugMinigames, ">>>>>>>>>>>>>>>>>>>>>>>>>>> change %d <> %d, 2nd phase 2 <<<<<<<<<<<<<<<<<<<<<<<<<<<<", animatedNodes_[0], animatedNodes_[1]);
node2.debugInfo();
@@ -390,8 +390,8 @@ bool MinigameTriangle::animate(float dt) {
return true;
case FIRD_PHASE:
- animationTimer_ = 0.f;
- animationState_ = NO_ANIMATION;
+ _animationTimer = 0.f;
+ _animationState = NO_ANIMATION;
releaseNodeBack(node1);
releaseNodeBack(node2);
@@ -416,8 +416,8 @@ bool MinigameTriangle::animate(float dt) {
void MinigameTriangle::swapNodes(int pos1, int pos2, bool silentQuick) {
if (silentQuick) {
- Node& node1 = nodes_[pos1];
- Node& node2 = nodes_[pos2];
+ Node& node1 = _nodes[pos1];
+ Node& node2 = _nodes[pos2];
node1.rotation_ = getRotate(pos1, pos2);
node2.rotation_ = getRotate(pos2, pos1);
@@ -437,7 +437,7 @@ void MinigameTriangle::swapNodes(int pos1, int pos2, bool silentQuick) {
}
void MinigameTriangle::quant(float dt) {
- if (selected_ >= 0)
+ if (_selected >= 0)
g_runtime->setGameHelpVariant(0);
else
g_runtime->setGameHelpVariant(1);
@@ -447,111 +447,111 @@ void MinigameTriangle::quant(float dt) {
int mousePos = -1;
for (int idx = 0; idx < fieldSize_; ++idx)
- if (nodes_[idx].hit(g_runtime->mousePosition())) {
+ if (_nodes[idx].hit(g_runtime->mousePosition())) {
mousePos = idx;
break;
}
int startAnimation = -1;
- int lastSelected = selected_;
+ int lastSelected = _selected;
if (g_runtime->mouseLeftPressed()) {
if (mousePos < 0) // кликнÑли мимо - Ñнимаем вÑделение
- selected_ = -1;
- else if (selected_ < 0) // ниÑего вÑделено небÑло, пÑоÑÑо вÑделÑем
- selected_ = mousePos;
- else if (selected_ == mousePos) // кликнÑли на вÑделенном - Ñнимаем вÑделение
- selected_ = -1;
- else if (compatible(selected_, mousePos)) { // поменÑÑÑ ÑиÑки меÑÑами
- startAnimation = selected_;
- selected_ = -1;
+ _selected = -1;
+ else if (_selected < 0) // ниÑего вÑделено небÑло, пÑоÑÑо вÑделÑем
+ _selected = mousePos;
+ else if (_selected == mousePos) // кликнÑли на вÑделенном - Ñнимаем вÑделение
+ _selected = -1;
+ else if (compatible(_selected, mousePos)) { // поменÑÑÑ ÑиÑки меÑÑами
+ startAnimation = _selected;
+ _selected = -1;
} else
- selected_ = -1;
+ _selected = -1;
}
- if (selected_ != lastSelected) {
+ if (_selected != lastSelected) {
for (int idx = 0; idx < fieldSize_; ++idx) {
- Node& node = nodes_[idx];
- if (idx == selected_ || compatible(selected_, idx)) { // Ñ ÑÑой ÑиÑкой можно поменÑÑÑÑÑ
+ Node& node = _nodes[idx];
+ if (idx == _selected || compatible(_selected, idx)) { // Ñ ÑÑой ÑиÑкой можно поменÑÑÑÑÑ
if (!node.border_)
- node.border_ = selectBorders_[orientation(idx)].getObject();
- node.border_.setState(Node::getBorderStateName(idx == selected_));
+ node.border_ = _selectBorders[orientation(idx)].getObject();
+ node.border_.setState(Node::getBorderStateName(idx == _selected));
node.border_->set_R(slotCoord(idx));
node.border_->update_screen_R();
- g_runtime->setDepth(node.border_, selectDepth_);
+ g_runtime->setDepth(node.border_, _selectDepth);
} else if (node.border_) {
- selectBorders_[0].releaseObject(node.border_);
- selectBorders_[1].releaseObject(node.border_);
+ _selectBorders[0].releaseObject(node.border_);
+ _selectBorders[1].releaseObject(node.border_);
}
}
}
- if (hovered_ != mousePos || selected_ != lastSelected) {
- highlight(hovered_, false);
- highlight(selected_ >= 0 ? selected_ : lastSelected, false);
+ if (_hovered != mousePos || _selected != lastSelected) {
+ highlight(_hovered, false);
+ highlight(_selected >= 0 ? _selected : lastSelected, false);
- hovered_ = mousePos;
+ _hovered = mousePos;
- if (hovered_ >= 0 && startAnimation < 0) {
- if (selected_ >= 0) {
- if (compatible(selected_, hovered_)) {
- highlight(hovered_, true);
- highlight(selected_, true);
+ if (_hovered >= 0 && startAnimation < 0) {
+ if (_selected >= 0) {
+ if (compatible(_selected, _hovered)) {
+ highlight(_hovered, true);
+ highlight(_selected, true);
}
} else
- highlight(hovered_, true);
+ highlight(_hovered, true);
}
}
if (startAnimation >= 0) {
- hovered_ = -1;
+ _hovered = -1;
swapNodes(startAnimation, mousePos, false);
}
if (g_runtime->mouseRightPressed() && mousePos >= 0) {
debugC(2, kDebugMinigames, "----- DUBUG INFO FOR %d POSITION --------------------", mousePos);
debugC(2, kDebugMinigames, "row = %d, begin = %d, orientation = %d", rowByNum(mousePos), rowBegin(rowByNum(mousePos)), orientation(mousePos));
- nodes_[mousePos].debugInfo();
+ _nodes[mousePos].debugInfo();
}
}
int MinigameTriangle::rowBegin(int row) const {
- if (row == fieldLines_)
+ if (row == _fieldLines)
return fieldSize_;
switch (gameType_) {
case TRIANGLE:
return sqr(row);
case RECTANGLE:
- return row * fieldWidth_;
+ return row * _fieldWidth;
default:
break;
}
//case HEXAGON:
- assert(row >= 0 && row < fieldLines_);
- if (row >= fieldLines_ / 2) {
- row -= fieldLines_ / 2;
- return fieldSize_ / 2 + (2 * fieldLines_ - row) * row;
+ assert(row >= 0 && row < _fieldLines);
+ if (row >= _fieldLines / 2) {
+ row -= _fieldLines / 2;
+ return fieldSize_ / 2 + (2 * _fieldLines - row) * row;
}
- return (fieldLines_ + row) * row;
+ return (_fieldLines + row) * row;
}
int MinigameTriangle::rowByNum(int num) const {
if (num >= fieldSize_)
- return fieldLines_;
+ return _fieldLines;
switch (gameType_) {
case TRIANGLE:
return floor(sqrt((float)num));
case RECTANGLE:
- return num / fieldWidth_;
+ return num / _fieldWidth;
default:
break;
}
//case HEXAGON:
- int row = num < fieldSize_ / 2 ? 0 : fieldLines_ / 2;
- while (row < fieldLines_ && num >= rowBegin(row))
+ int row = num < fieldSize_ / 2 ? 0 : _fieldLines / 2;
+ while (row < _fieldLines && num >= rowBegin(row))
++row;
return row > 0 ? row - 1 : 0;
}
@@ -579,7 +579,7 @@ bool MinigameTriangle::compatible(int num1, int num2) const {
int row1 = rowByNum(num1);
int row2 = rowByNum(num2);
- if (row2 >= fieldLines_)
+ if (row2 >= _fieldLines)
return false;
if (row1 == row2) // в одном Ñлое
@@ -603,7 +603,7 @@ int MinigameTriangle::getRotate(int num1, int num2) const {
};
assert(compatible(num1, num2));
return solves[rowByNum(num1) != rowByNum(num2) ? 0 : (num2 < num1 ? 1 : 2)]
- [orientation(num1)][nodes_[num1].rotation_];
+ [orientation(num1)][_nodes[num1].rotation_];
}
int MinigameTriangle::destination(int num1, int num2) const {
@@ -614,8 +614,8 @@ int MinigameTriangle::destination(int num1, int num2) const {
}
mgVect3f MinigameTriangle::slotCoord(int pos, int angle) const {
- assert(pos * 3 + angle < (int)positions_.size());
- return positions_[pos * 3 + angle];
+ assert(pos * 3 + angle < (int)_positions.size());
+ return _positions[pos * 3 + angle];
}
} // namespace QDEngine
diff --git a/engines/qdengine/minigames/adv/m_triangles.h b/engines/qdengine/minigames/adv/m_triangles.h
index 1e57046e809..6151b00a556 100644
--- a/engines/qdengine/minigames/adv/m_triangles.h
+++ b/engines/qdengine/minigames/adv/m_triangles.h
@@ -79,22 +79,22 @@ public:
private:
GameType gameType_ = TRIANGLE;
- Coords positions_;
- int selectDepth_ = 0;
+ Coords _positions;
+ int _selectDepth = 0;
- int fieldLines_ = 0;
- int fieldWidth_ = 0;
+ int _fieldLines = 0;
+ int _fieldWidth = 0;
int fieldSize_ = 0;
- Nodes nodes_;
- ObjectContainer selectBorders_[2];
- ObjectContainer backSides_[6];
- int selected_ = 0;
- int hovered_ = 0;
+ Nodes _nodes;
+ ObjectContainer _selectBorders[2];
+ ObjectContainer _backSides[6];
+ int _selected = 0;
+ int _hovered = 0;
- AnimationState animationState_ = NO_ANIMATION;
+ AnimationState _animationState = NO_ANIMATION;
int animatedNodes_[2] = { 0 };
- float animationTime_ = 0.0;
- float animationTimer_ = 0.0;
+ float _animationTime = 0.0;
+ float _animationTimer = 0.0;
/// оÑиÑÑиÑÑ ÑÑбаÑÐºÑ ÑиÑки
void releaseNodeBack(Node& node);
More information about the Scummvm-git-logs
mailing list