[Scummvm-git-logs] scummvm master -> 5d1b561189b6d7e09b926ebe357940e4bbf76b47
sev-
noreply at scummvm.org
Fri Aug 23 14:06:39 UTC 2024
This automated email contains information about 15 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b84f090971 QDENGINE: Fix incorrectly added code indentation
6939938cb0 QDENGINE: Fix warning
9e2115fd22 QDENGINE: Fix warning
6e21bb0547 QDENGINE: Fix realloc() usage
bc3164a64e QDENGINE: Fix warning. CID 1559625
4f247f6e80 COMMON: Fix potentially uninitalized variable. CID 1559623
cc663cb8ef QDENGINE: Fix warning. CID 1559622
43b0ba3ddb QDENGINE: Fix warning. CID 1559621
d909d67da8 QDENGINE: Rename class variables in AIAStar
22f78ff68c QDENGINE: Rename methods in AIStar
a8053558de QDENGINE: Rename class methods in qdHeuristic
c42a068f64 QDENGINE: Rename is C2PassScale
8d5e2718ef QDENGINE: More renames in 2PassScale.h
8b63056d43 QDENGINE: Renames in util/Filters.h
5d1b561189 QDENGINE: Rename class methods in CLZ77
Commit: b84f090971ab61f0e7914bb243c6998a3c095f26
https://github.com/scummvm/scummvm/commit/b84f090971ab61f0e7914bb243c6998a3c095f26
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:20:15+02:00
Commit Message:
QDENGINE: Fix incorrectly added code indentation
Changed paths:
engines/qdengine/qdcore/qd_interface_dispatcher.cpp
diff --git a/engines/qdengine/qdcore/qd_interface_dispatcher.cpp b/engines/qdengine/qdcore/qd_interface_dispatcher.cpp
index e3efb49c7f9..cf389396090 100644
--- a/engines/qdengine/qdcore/qd_interface_dispatcher.cpp
+++ b/engines/qdengine/qdcore/qd_interface_dispatcher.cpp
@@ -98,9 +98,10 @@ bool qdInterfaceDispatcher::select_screen(const char *screen_name, bool lock_res
debugC(3, kDebugQuant, "qdInterfaceDispatcher::select_screen() Selecting screen: %s", transCyrillic(screen_name));
for (resource_container_t::resource_list_t::const_iterator it = _resources.resource_list().begin(); it != _resources.resource_list().end(); ++it) {
if (p->has_references(*it)) {
- if (!(*it)->is_resource_loaded())
+ if (!(*it)->is_resource_loaded()) {
debugC(3, kDebugQuant, "qdInterfaceDispatcher::select_screen() Resource is used in both screens %s and %s", transCyrillic(_cur_screen->name()), transCyrillic(p->name()));
(*it)->load_resource();
+ }
} else {
if ((*it)->is_resource_loaded() && !_cur_screen->has_references(*it))
(*it)->free_resource();
Commit: 6939938cb06d88e59a664a8998a00d57d11330ff
https://github.com/scummvm/scummvm/commit/6939938cb06d88e59a664a8998a00d57d11330ff
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:20:34+02:00
Commit Message:
QDENGINE: Fix warning
Changed paths:
engines/qdengine/qdcore/qd_sprite.cpp
diff --git a/engines/qdengine/qdcore/qd_sprite.cpp b/engines/qdengine/qdcore/qd_sprite.cpp
index 55633127a12..1d20a5a1920 100644
--- a/engines/qdengine/qdcore/qd_sprite.cpp
+++ b/engines/qdengine/qdcore/qd_sprite.cpp
@@ -194,7 +194,7 @@ void qdSprite::free() {
bool qdSprite::load(const Common::Path fpath) {
set_file(fpath);
- load();
+ return load();
}
bool qdSprite::load() {
Commit: 9e2115fd22062aad0216fccc7dd2ce0c34b72641
https://github.com/scummvm/scummvm/commit/9e2115fd22062aad0216fccc7dd2ce0c34b72641
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:22:28+02:00
Commit Message:
QDENGINE: Fix warning
Changed paths:
engines/qdengine/qdcore/qd_interface_button.cpp
diff --git a/engines/qdengine/qdcore/qd_interface_button.cpp b/engines/qdengine/qdcore/qd_interface_button.cpp
index 73a6591fdf2..47b798ee108 100644
--- a/engines/qdengine/qdcore/qd_interface_button.cpp
+++ b/engines/qdengine/qdcore/qd_interface_button.cpp
@@ -110,8 +110,7 @@ bool qdInterfaceButton::activate_state(const char *state_name) {
}
bool qdInterfaceButton::set_option_value(int value) {
- if (value < 0) value = 0;
- if (value >= _states.size()) value = _states.size() - 1;
+ value = CLIP<int>(value, 0, _states.size() - 1);
activate_state(value);
return true;
Commit: 6e21bb0547ef9aa84948ed4cebb1ec6e103d95ae
https://github.com/scummvm/scummvm/commit/6e21bb0547ef9aa84948ed4cebb1ec6e103d95ae
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:24:03+02:00
Commit Message:
QDENGINE: Fix realloc() usage
Changed paths:
engines/qdengine/system/graphics/rle_compress.cpp
diff --git a/engines/qdengine/system/graphics/rle_compress.cpp b/engines/qdengine/system/graphics/rle_compress.cpp
index 862bea95eb0..71992b1e036 100644
--- a/engines/qdengine/system/graphics/rle_compress.cpp
+++ b/engines/qdengine/system/graphics/rle_compress.cpp
@@ -296,7 +296,7 @@ void RLEBuffer::resize_buffers() {
uint32 len = line_length() * sizeof(uint32);
if (g_buffersLen < len) {
- if (!realloc(g_buffer0, len) || !realloc(g_buffer1, len))
+ if (!(g_buffer0 = (byte *)realloc(g_buffer0, len)) || !(g_buffer1 = (byte *)realloc(g_buffer1, len)))
error("RLEBuffer::resize_buffers(): Cannot realloc buffers");
g_buffersLen = len;
Commit: bc3164a64effacfdad3f9163a9d2589ba6846849
https://github.com/scummvm/scummvm/commit/bc3164a64effacfdad3f9163a9d2589ba6846849
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:29:36+02:00
Commit Message:
QDENGINE: Fix warning. CID 1559625
Changed paths:
engines/qdengine/minigames/puzzle_all.h
diff --git a/engines/qdengine/minigames/puzzle_all.h b/engines/qdengine/minigames/puzzle_all.h
index 2c34a2a6938..14ab61b0cee 100644
--- a/engines/qdengine/minigames/puzzle_all.h
+++ b/engines/qdengine/minigames/puzzle_all.h
@@ -329,7 +329,7 @@ private:
qdMinigameSceneInterface *_scene = nullptr;
qdMinigameObjectInterface *_pieces[24];
- const int *_pieceCoords;
+ const int *_pieceCoords = nullptr;
qdMinigameObjectInterface *_objFinal = nullptr;
qdMinigameObjectInterface *_objRan = nullptr;
Commit: 4f247f6e80997feaa2b30ead423c7c94034a7bd8
https://github.com/scummvm/scummvm/commit/4f247f6e80997feaa2b30ead423c7c94034a7bd8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:33:27+02:00
Commit Message:
COMMON: Fix potentially uninitalized variable. CID 1559623
Changed paths:
common/formats/winexe_pe.cpp
diff --git a/common/formats/winexe_pe.cpp b/common/formats/winexe_pe.cpp
index 4048b8187a2..501ee444f5f 100644
--- a/common/formats/winexe_pe.cpp
+++ b/common/formats/winexe_pe.cpp
@@ -30,6 +30,7 @@ namespace Common {
PEResources::PEResources() {
_exe = nullptr;
+ _disposeFileHandle = DisposeAfterUse::YES;
}
PEResources::~PEResources() {
Commit: cc663cb8ef137d34097555140ad349a925754f45
https://github.com/scummvm/scummvm/commit/cc663cb8ef137d34097555140ad349a925754f45
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:34:35+02:00
Commit Message:
QDENGINE: Fix warning. CID 1559622
Changed paths:
engines/qdengine/qdcore/qd_condition.h
diff --git a/engines/qdengine/qdcore/qd_condition.h b/engines/qdengine/qdcore/qd_condition.h
index 0dbecf214bc..7a1a118ac16 100644
--- a/engines/qdengine/qdcore/qd_condition.h
+++ b/engines/qdengine/qdcore/qd_condition.h
@@ -565,7 +565,7 @@ public:
private:
ConditionType _type;
- const qdNamedObject *_owner;
+ const qdNamedObject *_owner = nullptr;
typedef Std::vector<qdConditionData> data_container_t;
data_container_t _data;
Commit: 43b0ba3ddb0d79efe81c86e4d17c1d26bff274d9
https://github.com/scummvm/scummvm/commit/43b0ba3ddb0d79efe81c86e4d17c1d26bff274d9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:35:52+02:00
Commit Message:
QDENGINE: Fix warning. CID 1559621
Changed paths:
engines/qdengine/qdcore/util/AIAStar.h
diff --git a/engines/qdengine/qdcore/util/AIAStar.h b/engines/qdengine/qdcore/util/AIAStar.h
index 3a3c2525fe4..b17f32e1fe4 100644
--- a/engines/qdengine/qdcore/util/AIAStar.h
+++ b/engines/qdengine/qdcore/util/AIAStar.h
@@ -98,6 +98,7 @@ template<class Heuristic, class TypeH>
AIAStar<Heuristic, TypeH>::AIAStar() {
chart = NULL;
heuristic = NULL;
+ num_find_erase = 0;
}
template<class Heuristic, class TypeH>
Commit: d909d67da851345ce7562387a286824be4d02334
https://github.com/scummvm/scummvm/commit/d909d67da851345ce7562387a286824be4d02334
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:41:48+02:00
Commit Message:
QDENGINE: Rename class variables in AIAStar
Changed paths:
engines/qdengine/qdcore/util/AIAStar.h
diff --git a/engines/qdengine/qdcore/util/AIAStar.h b/engines/qdengine/qdcore/util/AIAStar.h
index b17f32e1fe4..da6739046ec 100644
--- a/engines/qdengine/qdcore/util/AIAStar.h
+++ b/engines/qdengine/qdcore/util/AIAStar.h
@@ -59,15 +59,15 @@ public:
}
};
protected:
- int dx, dy;
- OnePoint *chart;
- type_point_map open_map;
+ int _dx, _dy;
+ OnePoint *_chart;
+ type_point_map _open_map;
- int is_used_num;//ÐÑли is_used_num==used, Ñо ÑÑейка иÑполÑзÑеÑÑÑ
+ int _is_used_num;//ÐÑли _is_used_num==used, Ñо ÑÑейка иÑполÑзÑеÑÑÑ
- int num_point_examine;//колиÑеÑÑво поÑеÑÑннÑÑ
ÑÑеек
- int num_find_erase;//СколÑко ÑÑммаÑно иÑкали ÑÑейки Ð´Ð»Ñ ÑдалениÑ
- Heuristic *heuristic;
+ int _num_point_examine;//колиÑеÑÑво поÑеÑÑннÑÑ
ÑÑеек
+ int _num_find_erase;//СколÑко ÑÑммаÑно иÑкали ÑÑейки Ð´Ð»Ñ ÑдалениÑ
+ Heuristic *_heuristic;
public:
AIAStar();
~AIAStar();
@@ -78,73 +78,73 @@ public:
//Debug
OnePoint *GetInternalBuffer() {
- return chart;
+ return _chart;
};
int GetUsedNum() {
- return is_used_num;
+ return _is_used_num;
}
protected:
void clear();
inline Vect2i PosBy(OnePoint *p) {
- int offset = p - chart;
+ int offset = p - _chart;
Vect2i pos;
- pos.x = offset % dx;
- pos.y = offset / dx;
+ pos.x = offset % _dx;
+ pos.y = offset / _dx;
return pos;
}
};
template<class Heuristic, class TypeH>
AIAStar<Heuristic, TypeH>::AIAStar() {
- chart = NULL;
- heuristic = NULL;
- num_find_erase = 0;
+ _chart = NULL;
+ _heuristic = NULL;
+ _num_find_erase = 0;
}
template<class Heuristic, class TypeH>
-void AIAStar<Heuristic, TypeH>::Init(int _dx, int _dy) {
- dx = _dx;
- dy = _dy;
+void AIAStar<Heuristic, TypeH>::Init(int dx_, int dy_) {
+ _dx = dx_;
+ _dy = dy_;
- int size = dx * dy;
- chart = new OnePoint[size];
+ int size = _dx * _dy;
+ _chart = new OnePoint[size];
clear();
}
template<class Heuristic, class TypeH>
void AIAStar<Heuristic, TypeH>::clear() {
- int size = dx * dy;
- is_used_num = 0;
+ int size = _dx * _dy;
+ _is_used_num = 0;
for (int i = 0; i < size; i++)
- chart[i].used = 0;
+ _chart[i].used = 0;
}
template<class Heuristic, class TypeH>
AIAStar<Heuristic, TypeH>::~AIAStar() {
- delete[] chart;
+ delete[] _chart;
}
template<class Heuristic, class TypeH>
bool AIAStar<Heuristic, TypeH>::FindPath(Vect2i from, Heuristic *hr, Std::vector<Vect2i> &path, int directions_count) {
- num_point_examine = 0;
- num_find_erase = 0;
+ _num_point_examine = 0;
+ _num_find_erase = 0;
- is_used_num++;
- open_map.clear();
+ _is_used_num++;
+ _open_map.clear();
path.clear();
- if (is_used_num == 0)
+ if (_is_used_num == 0)
clear();//ÐÐ»Ñ Ñого, ÑÑÐ¾Ð±Ñ Ð²ÑзвалаÑÑ ÑÑа ÑÑÑоÑка, необÑ
одимо гиганÑкое вÑемÑ
- assert(from.x >= 0 && from.x < dx && from.y >= 0 && from.y < dy);
- heuristic = hr;
+ assert(from.x >= 0 && from.x < _dx && from.y >= 0 && from.y < _dy);
+ _heuristic = hr;
- OnePoint *p = chart + from.y * dx + from.x;
+ OnePoint *p = _chart + from.y * _dx + from.x;
p->g = 0;
- p->h = heuristic->GetH(from.x, from.y);
- p->used = is_used_num;
+ p->h = _heuristic->GetH(from.x, from.y);
+ p->used = _is_used_num;
p->is_open = true;
p->parent = NULL;
- open_map.insert(typename type_point_map::value_type(p->f(), from));
+ _open_map.insert(typename type_point_map::value_type(p->f(), from));
const int sx[8] = { 0, -1, 0, +1, -1, +1, +1, -1,};
const int sy[8] = {-1, 0, +1, 0, -1, -1, +1, +1 };
@@ -154,15 +154,15 @@ bool AIAStar<Heuristic, TypeH>::FindPath(Vect2i from, Heuristic *hr, Std::vector
const int size_child = directions_count;
- while (!open_map.empty()) {
- typename type_point_map::iterator low = open_map.begin();
+ while (!_open_map.empty()) {
+ typename type_point_map::iterator low = _open_map.begin();
Vect2i pt = (*low).second;
- OnePoint *parent = chart + pt.y * dx + pt.x;
+ OnePoint *parent = _chart + pt.y * _dx + pt.x;
parent->is_open = false;
- open_map.erase(low);
+ _open_map.erase(low);
- if (heuristic->IsEndPoint(pt.x, pt.y)) {
+ if (_heuristic->IsEndPoint(pt.x, pt.y)) {
//ÑконÑÑÑÑиÑоваÑÑ Ð¿ÑÑÑ
Vect2i vp;
while (parent) {
@@ -186,35 +186,35 @@ bool AIAStar<Heuristic, TypeH>::FindPath(Vect2i from, Heuristic *hr, Std::vector
//Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð³Ð¾ наÑледника child Ñзла parent
for (int i = 0; i < size_child; i++) {
Vect2i child = Vect2i(pt.x + sx[i], pt.y + sy[i]);
- num_point_examine++;
+ _num_point_examine++;
if (child.x < 0 || child.y < 0 ||
- child.x >= dx || child.y >= dy)continue;
- p = chart + child.y * dx + child.x;
+ child.x >= _dx || child.y >= _dy)continue;
+ p = _chart + child.y * _dx + child.x;
- TypeH addg = heuristic->GetG(pt.x, pt.y, child.x, child.y);
+ TypeH addg = _heuristic->GetG(pt.x, pt.y, child.x, child.y);
TypeH newg = parent->g + addg;
- if (p->used == is_used_num) {
+ if (p->used == _is_used_num) {
if (!p->is_open)continue;
if (p->g <= newg)continue;
- //УдалÑем ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð¸Ð· open_map
+ //УдалÑем ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð¸Ð· _open_map
TypeH f = p->f();
- typename type_point_map::iterator cur = open_map.find(p->f());
+ typename type_point_map::iterator cur = _open_map.find(p->f());
bool erase = false;
- while (cur != open_map.end()) {
+ while (cur != _open_map.end()) {
if ((*cur).first != f)break;
if ((*cur).second.x == child.x && (*cur).second.y == child.y) {
- open_map.erase(cur);
+ _open_map.erase(cur);
erase = true;
break;
}
- num_find_erase++;
+ _num_find_erase++;
cur++;
}
- num_find_erase++;
+ _num_find_erase++;
//assert(erase);
if (!erase)
continue;
@@ -230,12 +230,12 @@ bool AIAStar<Heuristic, TypeH>::FindPath(Vect2i from, Heuristic *hr, Std::vector
}
*/
p->g = newg;
- p->h = heuristic->GetH(child.x, child.y);
+ p->h = _heuristic->GetH(child.x, child.y);
- open_map.insert(typename type_point_map::value_type(p->f(), child));
+ _open_map.insert(typename type_point_map::value_type(p->f(), child));
p->is_open = true;
- p->used = is_used_num;
+ p->used = _is_used_num;
}
}
@@ -246,9 +246,9 @@ template<class Heuristic, class TypeH>
void AIAStar<Heuristic, TypeH>::GetStatistic(
int *p_num_point_examine, int *p_num_find_erase) {
if (p_num_point_examine)
- *p_num_point_examine = num_point_examine;
+ *p_num_point_examine = _num_point_examine;
if (p_num_find_erase)
- *p_num_find_erase = num_find_erase;
+ *p_num_find_erase = _num_find_erase;
}
///////////////////////AIAStarGraph/////////////
@@ -293,14 +293,14 @@ public:
}
};
protected:
- Std::vector<OnePoint> chart;
- type_point_map open_map;
+ Std::vector<OnePoint> _chart;
+ type_point_map _open_map;
- int is_used_num;//ÐÑли is_used_num==used, Ñо ÑÑейка иÑполÑзÑеÑÑÑ
+ int _is_used_num;//ÐÑли _is_used_num==used, Ñо ÑÑейка иÑполÑзÑеÑÑÑ
- int num_point_examine;//колиÑеÑÑво поÑеÑÑннÑÑ
ÑÑеек
- int num_find_erase;//СколÑко ÑÑммаÑно иÑкали ÑÑейки Ð´Ð»Ñ ÑдалениÑ
- Heuristic *heuristic;
+ int _num_point_examine;//колиÑеÑÑво поÑеÑÑннÑÑ
ÑÑеек
+ int _num_find_erase;//СколÑко ÑÑммаÑно иÑкали ÑÑейки Ð´Ð»Ñ ÑдалениÑ
+ Heuristic *_heuristic;
public:
AIAStarGraph();
~AIAStarGraph();
@@ -314,10 +314,10 @@ public:
//Debug
OnePoint *GetInternalBuffer() {
- return chart;
+ return _chart;
};
int GetUsedNum() {
- return is_used_num;
+ return _is_used_num;
}
protected:
void clear();
@@ -328,16 +328,16 @@ protected:
template<class Heuristic, class Node, class TypeH>
AIAStarGraph<Heuristic, Node, TypeH>::AIAStarGraph() {
- heuristic = NULL;
+ _heuristic = NULL;
}
template<class Heuristic, class Node, class TypeH>
void AIAStarGraph<Heuristic, Node, TypeH>::Init(Std::vector<Node> &all_node) {
int size = all_node.size();
- chart.resize(size);
+ _chart.resize(size);
for (int i = 0; i < size; i++) {
- OnePoint *c = &chart[i];
+ OnePoint *c = &_chart[i];
c->node = &all_node[i];
c->node->AIAStarPointer = (void *)c;
}
@@ -346,8 +346,8 @@ void AIAStarGraph<Heuristic, Node, TypeH>::Init(Std::vector<Node> &all_node) {
template<class Heuristic, class Node, class TypeH>
void AIAStarGraph<Heuristic, Node, TypeH>::clear() {
- is_used_num = 0;
- for (auto &it : chart) {
+ _is_used_num = 0;
+ for (auto &it : _chart) {
it.used = 0;
}
}
@@ -358,41 +358,41 @@ AIAStarGraph<Heuristic, Node, TypeH>::~AIAStarGraph() {
template<class Heuristic, class Node, class TypeH>
bool AIAStarGraph<Heuristic, Node, TypeH>::FindPath(Node *from, Heuristic *hr, Std::vector<Node *> &path) {
- num_point_examine = 0;
- num_find_erase = 0;
+ _num_point_examine = 0;
+ _num_find_erase = 0;
- is_used_num++;
- open_map.clear();
+ _is_used_num++;
+ _open_map.clear();
path.clear();
- if (is_used_num == 0)
+ if (_is_used_num == 0)
clear();//ÐÐ»Ñ Ñого, ÑÑÐ¾Ð±Ñ Ð²ÑзвалаÑÑ ÑÑа ÑÑÑоÑка, необÑ
одимо гиганÑкое вÑемÑ
- heuristic = hr;
+ _heuristic = hr;
OnePoint *p = (OnePoint *)from->AIAStarPointer;
Node *from_node = p->node;
p->g = 0;
- p->h = heuristic->GetH(p->node);
- p->used = is_used_num;
+ p->h = _heuristic->GetH(p->node);
+ p->used = _is_used_num;
p->is_open = true;
p->parent = NULL;
- p->self_it = open_map.insert(type_point_map::value_type(p->f(), p));
+ p->self_it = _open_map.insert(type_point_map::value_type(p->f(), p));
- while (!open_map.empty()) {
- typename type_point_map::iterator low = open_map.begin();
+ while (!_open_map.empty()) {
+ typename type_point_map::iterator low = _open_map.begin();
OnePoint *parent = low->second;
Node *node = parent->node;
parent->is_open = false;
- open_map.erase(low);
+ _open_map.erase(low);
- if (heuristic->IsEndPoint(node)) {
+ if (_heuristic->IsEndPoint(node)) {
//ÑконÑÑÑÑиÑоваÑÑ Ð¿ÑÑÑ
Node *np;
while (parent) {
np = PosBy(parent);
- assert(parent->used == is_used_num);
+ assert(parent->used == _is_used_num);
path.push_back(np);
parent = parent->parent;
@@ -406,27 +406,27 @@ bool AIAStarGraph<Heuristic, Node, TypeH>::FindPath(Node *from, Heuristic *hr, S
for (auto &it : *node) {
Node *cur_node = *it;
OnePoint *op = (OnePoint *)cur_node->AIAStarPointer;
- num_point_examine++;
+ _num_point_examine++;
- TypeH addg = heuristic->GetG(node, cur_node);
+ TypeH addg = _heuristic->GetG(node, cur_node);
TypeH newg = parent->g + addg;
- if (op->used == is_used_num) {
+ if (op->used == _is_used_num) {
if (!op->is_open)continue;
if (op->g <= newg)continue;
- open_map.erase(op->self_it);
- num_find_erase++;
+ _open_map.erase(op->self_it);
+ _num_find_erase++;
}
op->parent = parent;
op->g = newg;
- op->h = heuristic->GetH(cur_node);
+ op->h = _heuristic->GetH(cur_node);
- op->self_it = open_map.insert(type_point_map::value_type(op->f(), op));
+ op->self_it = _open_map.insert(type_point_map::value_type(op->f(), op));
op->is_open = true;
- op->used = is_used_num;
+ op->used = _is_used_num;
}
}
@@ -437,9 +437,9 @@ template<class Heuristic, class Node, class TypeH>
void AIAStarGraph<Heuristic, Node, TypeH>::GetStatistic(
int *p_num_point_examine, int *p_num_find_erase) {
if (p_num_point_examine)
- *p_num_point_examine = num_point_examine;
+ *p_num_point_examine = _num_point_examine;
if (p_num_find_erase)
- *p_num_find_erase = num_find_erase;
+ *p_num_find_erase = _num_find_erase;
}
///////////////////////AIFindMaxium/////////////
Commit: 22f78ff68c36e6ff1a5e3c9ea2dcd9aaae1cf4bf
https://github.com/scummvm/scummvm/commit/22f78ff68c36e6ff1a5e3c9ea2dcd9aaae1cf4bf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:46:55+02:00
Commit Message:
QDENGINE: Rename methods in AIStar
Changed paths:
engines/qdengine/qdcore/qd_game_object_moving.cpp
engines/qdengine/qdcore/util/AIAStar.h
diff --git a/engines/qdengine/qdcore/qd_game_object_moving.cpp b/engines/qdengine/qdcore/qd_game_object_moving.cpp
index f5d12502d48..7caa548a163 100644
--- a/engines/qdengine/qdcore/qd_game_object_moving.cpp
+++ b/engines/qdengine/qdcore/qd_game_object_moving.cpp
@@ -416,12 +416,12 @@ bool qdGameObjectMoving::find_path(const Vect3f target, bool lock_target) {
phobj.init(trg);
qdAStar pfobj;
- pfobj.Init(qdCamera::current_camera()->get_grid_sx(), qdCamera::current_camera()->get_grid_sy());
+ pfobj.init(qdCamera::current_camera()->get_grid_sx(), qdCamera::current_camera()->get_grid_sy());
int dirs_count = (allowed_directions_count() > 4) ? 8 : 4;
Std::vector<Vect2i> path_vect;
- pfobj.FindPath(cell_idx, &phobj, path_vect, dirs_count);
+ pfobj.findPath(cell_idx, &phobj, path_vect, dirs_count);
int idx = 0;
bool correct = true;
@@ -448,7 +448,7 @@ bool qdGameObjectMoving::find_path(const Vect3f target, bool lock_target) {
// СÑиÑаем пÑÑÑ Ñ Ð½Ð¾Ð²Ñм конÑом
phobj.init(trg);
- pfobj.FindPath(cell_idx, &phobj, path_vect, dirs_count);
+ pfobj.findPath(cell_idx, &phobj, path_vect, dirs_count);
// ÐÑовеÑÑем пÑÑÑ Ð½Ð° пÑоÑ
одимоÑÑÑ
correct = true;
diff --git a/engines/qdengine/qdcore/util/AIAStar.h b/engines/qdengine/qdcore/util/AIAStar.h
index da6739046ec..c22acd62c9c 100644
--- a/engines/qdengine/qdcore/util/AIAStar.h
+++ b/engines/qdengine/qdcore/util/AIAStar.h
@@ -72,20 +72,20 @@ public:
AIAStar();
~AIAStar();
- void Init(int dx, int dy);
- bool FindPath(Vect2i from, Heuristic *h, Std::vector<Vect2i> &path, int directions_count = 8);
- void GetStatistic(int *num_point_examine, int *num_find_erase);
+ void init(int dx, int dy);
+ bool findPath(Vect2i from, Heuristic *h, Std::vector<Vect2i> &path, int directions_count = 8);
+ void getStatistic(int *num_point_examine, int *num_find_erase);
//Debug
- OnePoint *GetInternalBuffer() {
+ OnePoint *getInternalBuffer() {
return _chart;
};
- int GetUsedNum() {
+ int getUsedNum() {
return _is_used_num;
}
protected:
void clear();
- inline Vect2i PosBy(OnePoint *p) {
+ inline Vect2i posBy(OnePoint *p) {
int offset = p - _chart;
Vect2i pos;
pos.x = offset % _dx;
@@ -102,7 +102,7 @@ AIAStar<Heuristic, TypeH>::AIAStar() {
}
template<class Heuristic, class TypeH>
-void AIAStar<Heuristic, TypeH>::Init(int dx_, int dy_) {
+void AIAStar<Heuristic, TypeH>::init(int dx_, int dy_) {
_dx = dx_;
_dy = dy_;
@@ -125,7 +125,7 @@ AIAStar<Heuristic, TypeH>::~AIAStar() {
}
template<class Heuristic, class TypeH>
-bool AIAStar<Heuristic, TypeH>::FindPath(Vect2i from, Heuristic *hr, Std::vector<Vect2i> &path, int directions_count) {
+bool AIAStar<Heuristic, TypeH>::findPath(Vect2i from, Heuristic *hr, Std::vector<Vect2i> &path, int directions_count) {
_num_point_examine = 0;
_num_find_erase = 0;
@@ -166,12 +166,12 @@ bool AIAStar<Heuristic, TypeH>::FindPath(Vect2i from, Heuristic *hr, Std::vector
//ÑконÑÑÑÑиÑоваÑÑ Ð¿ÑÑÑ
Vect2i vp;
while (parent) {
- vp = PosBy(parent);;
+ vp = posBy(parent);;
path.push_back(vp);
if (parent->parent) {
Vect2i pp;
- pp = PosBy(parent->parent);
+ pp = posBy(parent->parent);
assert(abs(vp.x - pp.x) <= 1 &&
abs(vp.y - pp.y) <= 1);
}
@@ -243,7 +243,7 @@ bool AIAStar<Heuristic, TypeH>::FindPath(Vect2i from, Heuristic *hr, Std::vector
}
template<class Heuristic, class TypeH>
-void AIAStar<Heuristic, TypeH>::GetStatistic(
+void AIAStar<Heuristic, TypeH>::getStatistic(
int *p_num_point_examine, int *p_num_find_erase) {
if (p_num_point_examine)
*p_num_point_examine = _num_point_examine;
@@ -307,21 +307,21 @@ public:
//ÐбÑее колиÑеÑÑво Ñзлов. ÐонÑÑанÑа, коÑоÑÐ°Ñ Ð½Ðµ должна менÑÑÑÑÑ,
//пока ÑÑÑеÑÑвÑÐµÑ ÐºÐ»Ð°ÑÑ, ÑказÑваÑÑий на неÑ.
- void Init(Std::vector<Node> &all_node);
+ void init(Std::vector<Node> &all_node);
- bool FindPath(Node *from, Heuristic *h, Std::vector<Node *> &path);
- void GetStatistic(int *num_point_examine, int *num_find_erase);
+ bool findPath(Node *from, Heuristic *h, Std::vector<Node *> &path);
+ void getStatistic(int *num_point_examine, int *num_find_erase);
//Debug
- OnePoint *GetInternalBuffer() {
+ OnePoint *getInternalBuffer() {
return _chart;
};
- int GetUsedNum() {
+ int getUsedNum() {
return _is_used_num;
}
protected:
void clear();
- inline Node *PosBy(OnePoint *p) {
+ inline Node *posBy(OnePoint *p) {
return p->node;
}
};
@@ -332,7 +332,7 @@ AIAStarGraph<Heuristic, Node, TypeH>::AIAStarGraph() {
}
template<class Heuristic, class Node, class TypeH>
-void AIAStarGraph<Heuristic, Node, TypeH>::Init(Std::vector<Node> &all_node) {
+void AIAStarGraph<Heuristic, Node, TypeH>::init(Std::vector<Node> &all_node) {
int size = all_node.size();
_chart.resize(size);
@@ -357,7 +357,7 @@ AIAStarGraph<Heuristic, Node, TypeH>::~AIAStarGraph() {
}
template<class Heuristic, class Node, class TypeH>
-bool AIAStarGraph<Heuristic, Node, TypeH>::FindPath(Node *from, Heuristic *hr, Std::vector<Node *> &path) {
+bool AIAStarGraph<Heuristic, Node, TypeH>::findPath(Node *from, Heuristic *hr, Std::vector<Node *> &path) {
_num_point_examine = 0;
_num_find_erase = 0;
@@ -434,7 +434,7 @@ bool AIAStarGraph<Heuristic, Node, TypeH>::FindPath(Node *from, Heuristic *hr, S
}
template<class Heuristic, class Node, class TypeH>
-void AIAStarGraph<Heuristic, Node, TypeH>::GetStatistic(
+void AIAStarGraph<Heuristic, Node, TypeH>::getStatistic(
int *p_num_point_examine, int *p_num_find_erase) {
if (p_num_point_examine)
*p_num_point_examine = _num_point_examine;
Commit: a8053558de6fdffb9a8f40ba0ae72c8e179932d4
https://github.com/scummvm/scummvm/commit/a8053558de6fdffb9a8f40ba0ae72c8e179932d4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:50:23+02:00
Commit Message:
QDENGINE: Rename class methods in qdHeuristic
Changed paths:
engines/qdengine/qdcore/util/AIAStar.h
engines/qdengine/qdcore/util/AIAStar_API.cpp
engines/qdengine/qdcore/util/AIAStar_API.h
diff --git a/engines/qdengine/qdcore/util/AIAStar.h b/engines/qdengine/qdcore/util/AIAStar.h
index c22acd62c9c..b9aea8d6982 100644
--- a/engines/qdengine/qdcore/util/AIAStar.h
+++ b/engines/qdengine/qdcore/util/AIAStar.h
@@ -33,8 +33,8 @@
/*
class Heuristic
{
- float GetH(int x,int y);//ÐÑедполагаемÑе заÑÑаÑÑ Ð½Ð° пÑодвижение из pos1 к оконÑаниÑ
- float GetG(int x1,int y1,int x2,int y2);//ÐаÑÑаÑÑ Ð½Ð° пÑодвижение из pos1 в pos2
+ float getH(int x,int y);//ÐÑедполагаемÑе заÑÑаÑÑ Ð½Ð° пÑодвижение из pos1 к оконÑаниÑ
+ float getG(int x1,int y1,int x2,int y2);//ÐаÑÑаÑÑ Ð½Ð° пÑодвижение из pos1 в pos2
bool IsEndPoint(int x,int y);//РекÑÑÑÐ¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° оконÑиÑÑÑÑ Ð·Ð´ÐµÑÑ
//Ñо еÑÑÑ ÐºÐ»Ð°ÑÑ AIAStar позволÑÐµÑ Ð·Ð°Ð´Ð°Ð²Ð°ÑÑ Ð½ÐµÑколÑко ÑоÑек оконÑÐ°Ð½Ð¸Ñ Ð¿Ð¾Ð¸Ñка пÑÑи
};
@@ -139,7 +139,7 @@ bool AIAStar<Heuristic, TypeH>::findPath(Vect2i from, Heuristic *hr, Std::vector
OnePoint *p = _chart + from.y * _dx + from.x;
p->g = 0;
- p->h = _heuristic->GetH(from.x, from.y);
+ p->h = _heuristic->getH(from.x, from.y);
p->used = _is_used_num;
p->is_open = true;
p->parent = NULL;
@@ -162,7 +162,7 @@ bool AIAStar<Heuristic, TypeH>::findPath(Vect2i from, Heuristic *hr, Std::vector
parent->is_open = false;
_open_map.erase(low);
- if (_heuristic->IsEndPoint(pt.x, pt.y)) {
+ if (_heuristic->isEndPoint(pt.x, pt.y)) {
//ÑконÑÑÑÑиÑоваÑÑ Ð¿ÑÑÑ
Vect2i vp;
while (parent) {
@@ -193,7 +193,7 @@ bool AIAStar<Heuristic, TypeH>::findPath(Vect2i from, Heuristic *hr, Std::vector
p = _chart + child.y * _dx + child.x;
- TypeH addg = _heuristic->GetG(pt.x, pt.y, child.x, child.y);
+ TypeH addg = _heuristic->getG(pt.x, pt.y, child.x, child.y);
TypeH newg = parent->g + addg;
if (p->used == _is_used_num) {
@@ -223,14 +223,14 @@ bool AIAStar<Heuristic, TypeH>::findPath(Vect2i from, Heuristic *hr, Std::vector
p->parent = parent;
/*
{
- Vect2i pp=PosBy(parent);
- Vect2i pc=PosBy(p);
+ Vect2i pp=posBy(parent);
+ Vect2i pc=posBy(p);
assert(abs(pc.x-pp.x)<=1 &&
abs(pc.y-pp.y)<=1);
}
*/
p->g = newg;
- p->h = _heuristic->GetH(child.x, child.y);
+ p->h = _heuristic->getH(child.x, child.y);
_open_map.insert(typename type_point_map::value_type(p->f(), child));
@@ -265,8 +265,8 @@ class Node
class Heuristic
{
- float GetH(Node* pos);//ÐÑедполагаемÑе заÑÑаÑÑ Ð½Ð° пÑодвижение из pos1 к оконÑаниÑ
- float GetG(Node* pos1,Node* pos2);//ÐаÑÑаÑÑ Ð½Ð° пÑодвижение из pos1 в pos2
+ float getH(Node* pos);//ÐÑедполагаемÑе заÑÑаÑÑ Ð½Ð° пÑодвижение из pos1 к оконÑаниÑ
+ float getG(Node* pos1,Node* pos2);//ÐаÑÑаÑÑ Ð½Ð° пÑодвижение из pos1 в pos2
bool IsEndPoint(Node* pos);//РекÑÑÑÐ¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° оконÑиÑÑÑÑ Ð·Ð´ÐµÑÑ
//Ñо еÑÑÑ ÐºÐ»Ð°ÑÑ AIAStar позволÑÐµÑ Ð·Ð°Ð´Ð°Ð²Ð°ÑÑ Ð½ÐµÑколÑко ÑоÑек оконÑÐ°Ð½Ð¸Ñ Ð¿Ð¾Ð¸Ñка пÑÑи
};
@@ -371,7 +371,7 @@ bool AIAStarGraph<Heuristic, Node, TypeH>::findPath(Node *from, Heuristic *hr, S
OnePoint *p = (OnePoint *)from->AIAStarPointer;
Node *from_node = p->node;
p->g = 0;
- p->h = _heuristic->GetH(p->node);
+ p->h = _heuristic->getH(p->node);
p->used = _is_used_num;
p->is_open = true;
p->parent = NULL;
@@ -408,7 +408,7 @@ bool AIAStarGraph<Heuristic, Node, TypeH>::findPath(Node *from, Heuristic *hr, S
OnePoint *op = (OnePoint *)cur_node->AIAStarPointer;
_num_point_examine++;
- TypeH addg = _heuristic->GetG(node, cur_node);
+ TypeH addg = _heuristic->getG(node, cur_node);
TypeH newg = parent->g + addg;
if (op->used == _is_used_num) {
@@ -421,7 +421,7 @@ bool AIAStarGraph<Heuristic, Node, TypeH>::findPath(Node *from, Heuristic *hr, S
op->parent = parent;
op->g = newg;
- op->h = _heuristic->GetH(cur_node);
+ op->h = _heuristic->getH(cur_node);
op->self_it = _open_map.insert(type_point_map::value_type(op->f(), op));
@@ -448,7 +448,7 @@ void AIAStarGraph<Heuristic, Node, TypeH>::getStatistic(
struct Maps
{
//ÐнаÑение Ñего нибÑÐ´Ñ Ð² ÑоÑке (x,y)
- TypeH Get(int x,int y);
+ TypeH get(int x,int y);
//ÐалÑнейÑие поиÑки можно пÑекÑаÑиÑÑ
bool IsOptiumGood(TypeH optium,int x,int y);
@@ -460,7 +460,7 @@ template<class Maps>
Vect2i AIFindMinium(int x, int y,
Maps &maps,
int dx, int dy) {
- typename Maps::TypeH optium = maps.Get(x, y);
+ typename Maps::TypeH optium = maps.get(x, y);
int optiumx = x, optiumy = y;
int maxi = MAX(MAX(x, dx - x), MAX(y, dy - y));
@@ -472,7 +472,7 @@ Vect2i AIFindMinium(int x, int y,
cury = y - i;
if (cury >= 0)
for (curx = xmin; curx <= xmax; curx++) {
- typename Maps::TypeH o = maps.Get(curx, cury);
+ typename Maps::TypeH o = maps.get(curx, cury);
if (o < optium) {
optium = o;
optiumx = curx;
@@ -484,7 +484,7 @@ Vect2i AIFindMinium(int x, int y,
cury = y + i;
if (cury < dy)
for (curx = xmin; curx <= xmax; curx++) {
- typename Maps::TypeH o = maps.Get(curx, cury);
+ typename Maps::TypeH o = maps.get(curx, cury);
if (o < optium) {
optium = o;
optiumx = curx;
@@ -496,7 +496,7 @@ Vect2i AIFindMinium(int x, int y,
curx = x - i;
if (curx >= 0)
for (cury = ymin; cury <= ymax; cury++) {
- typename Maps::TypeH o = maps.Get(curx, cury);
+ typename Maps::TypeH o = maps.get(curx, cury);
if (o < optium) {
optium = o;
optiumx = curx;
@@ -508,7 +508,7 @@ Vect2i AIFindMinium(int x, int y,
curx = x + i;
if (curx < dx)
for (cury = ymin; cury <= ymax; cury++) {
- typename Maps::TypeH o = maps.Get(curx, cury);
+ typename Maps::TypeH o = maps.get(curx, cury);
if (o < optium) {
optium = o;
optiumx = curx;
diff --git a/engines/qdengine/qdcore/util/AIAStar_API.cpp b/engines/qdengine/qdcore/util/AIAStar_API.cpp
index ba70cd22ed1..9e13081441c 100644
--- a/engines/qdengine/qdcore/util/AIAStar_API.cpp
+++ b/engines/qdengine/qdcore/util/AIAStar_API.cpp
@@ -34,7 +34,7 @@ qdHeuristic::qdHeuristic() : _camera_ptr(NULL), _object_ptr(NULL) {
qdHeuristic::~qdHeuristic() {
}
-int qdHeuristic::GetH(int x, int y) {
+int qdHeuristic::getH(int x, int y) {
x -= _target.x;
y -= _target.y;
@@ -43,7 +43,7 @@ int qdHeuristic::GetH(int x, int y) {
return static_cast<float>(x * x + y * y);
}
-int qdHeuristic::GetG(int x1, int y1, int x2, int y2) {
+int qdHeuristic::getG(int x1, int y1, int x2, int y2) {
if (!_object_ptr->is_walkable(Vect2s(x2, y2)))
return 10000;
// ÐÐ»Ñ Ð´Ð¸Ð°Ð³Ð¾Ð½Ð°Ð»ÑнÑÑ
пеÑемеÑений ÑмоÑÑим еÑе и пеÑемеÑÐµÐ½Ð¸Ñ Ð¿Ð¾ каÑеÑам,
diff --git a/engines/qdengine/qdcore/util/AIAStar_API.h b/engines/qdengine/qdcore/util/AIAStar_API.h
index bd626dc854b..76dd7316858 100644
--- a/engines/qdengine/qdcore/util/AIAStar_API.h
+++ b/engines/qdengine/qdcore/util/AIAStar_API.h
@@ -36,9 +36,9 @@ public:
qdHeuristic();
~qdHeuristic();
- int GetH(int x, int y);
- int GetG(int x1, int y1, int x2, int y2);
- bool IsEndPoint(int x, int y) {
+ int getH(int x, int y);
+ int getG(int x1, int y1, int x2, int y2);
+ bool isEndPoint(int x, int y) {
return (x == _target.x && y == _target.y);
}
Commit: c42a068f6487491fce762a49748981c069cc59e8
https://github.com/scummvm/scummvm/commit/c42a068f6487491fce762a49748981c069cc59e8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T15:56:49+02:00
Commit Message:
QDENGINE: Rename is C2PassScale
Changed paths:
engines/qdengine/qdcore/qd_sprite.cpp
engines/qdengine/qdcore/util/2PassScale.h
diff --git a/engines/qdengine/qdcore/qd_sprite.cpp b/engines/qdengine/qdcore/qd_sprite.cpp
index 1d20a5a1920..a98c4b5aac1 100644
--- a/engines/qdengine/qdcore/qd_sprite.cpp
+++ b/engines/qdengine/qdcore/qd_sprite.cpp
@@ -1397,7 +1397,7 @@ bool qdSprite::scale(float coeff_x, float coeff_y) {
byte *dest_data = new byte[sx * sy * 4];
- scale_engine.Scale(reinterpret_cast<uint32 *>(src_data), _picture_size.x, _picture_size.y, reinterpret_cast<uint32 *>(dest_data), sx, sy);
+ scale_engine.scale(reinterpret_cast<uint32 *>(src_data), _picture_size.x, _picture_size.y, reinterpret_cast<uint32 *>(dest_data), sx, sy);
delete [] _data;
diff --git a/engines/qdengine/qdcore/util/2PassScale.h b/engines/qdengine/qdcore/util/2PassScale.h
index aefbe5a9773..e69eb4b53d7 100644
--- a/engines/qdengine/qdcore/util/2PassScale.h
+++ b/engines/qdengine/qdcore/util/2PassScale.h
@@ -37,9 +37,9 @@ typedef struct {
} ContributionType; // Contirbution information for a single pixel
typedef struct {
- ContributionType *ContribRow; // Row (or column) of contribution weights
- uint32 WindowSize, // Filter window size (of affecting source pixels)
- LineLength; // Length of line (no. or rows / cols)
+ ContributionType *contribRow; // Row (or column) of contribution weights
+ uint32 windowSize, // Filter window size (of affecting source pixels)
+ lineLength; // Length of line (no. or rows / cols)
} LineContribType; // Contribution information for an entire line (row or column)
template <class FilterClass>
@@ -49,7 +49,7 @@ public:
C2PassScale() : _temp_buffer(65536, 0), _weights_buffer(16384, 0.0), _contribution_buffer(500) { }
virtual ~C2PassScale() { }
- uint32 *Scale(uint32 *pOrigImage, uint32 uOrigWidth, uint32 uOrigHeight, uint32 *pDstImage, uint32 uNewWidth, uint32 uNewHeight);
+ uint32 *scale(uint32 *pOrigImage, uint32 uOrigWidth, uint32 uOrigHeight, uint32 *pDstImage, uint32 uNewWidth, uint32 uNewHeight);
private:
@@ -59,13 +59,13 @@ private:
Std::vector<double> _weights_buffer;
Std::vector<ContributionType> _contribution_buffer;
- LineContribType *AllocContributions(uint32 uLineLength, uint32 uWindowSize);
- LineContribType *CalcContributions(uint32 uLineSize, uint32 uSrcSize, double dScale);
+ LineContribType *allocContributions(uint32 uLineLength, uint32 uWindowSize);
+ LineContribType *calcContributions(uint32 uLineSize, uint32 uSrcSize, double dScale);
- void ScaleRow(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uRow, LineContribType *Contrib);
- void HorizScale(uint32 *pSrc, uint32 uSrcWidth, uint32 uSrcHeight, uint32 *pDst, uint32 uResWidth, uint32 uResHeight);
- void ScaleCol(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uResHeight, uint32 uCol, LineContribType *Contrib);
- void VertScale(uint32 *pSrc, uint32 uSrcWidth, uint32 uSrcHeight, uint32 *pDst, uint32 uResWidth, uint32 uResHeight);
+ void scaleRow(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uRow, LineContribType *Contrib);
+ void horizScale(uint32 *pSrc, uint32 uSrcWidth, uint32 uSrcHeight, uint32 *pDst, uint32 uResWidth, uint32 uResHeight);
+ void scaleCol(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uResHeight, uint32 uCol, LineContribType *Contrib);
+ void vertScale(uint32 *pSrc, uint32 uSrcWidth, uint32 uSrcHeight, uint32 *pDst, uint32 uResWidth, uint32 uResHeight);
static inline byte make_r(uint32 col) {
return reinterpret_cast<byte *>(&col)[2];
@@ -86,16 +86,16 @@ private:
};
template<class FilterClass>
-LineContribType *C2PassScale<FilterClass>::AllocContributions(uint32 uLineLength, uint32 uWindowSize) {
+LineContribType *C2PassScale<FilterClass>::allocContributions(uint32 uLineLength, uint32 uWindowSize) {
static LineContribType line_ct;
- line_ct.WindowSize = uWindowSize;
- line_ct.LineLength = uLineLength;
+ line_ct.windowSize = uWindowSize;
+ line_ct.lineLength = uLineLength;
if (_contribution_buffer.size() < uLineLength)
_contribution_buffer.resize(uLineLength);
- line_ct.ContribRow = &*_contribution_buffer.begin();
+ line_ct.contribRow = &*_contribution_buffer.begin();
if (_weights_buffer.size() < uLineLength * uWindowSize)
_weights_buffer.resize(uLineLength * uWindowSize);
@@ -103,14 +103,14 @@ LineContribType *C2PassScale<FilterClass>::AllocContributions(uint32 uLineLength
double *p = &*_weights_buffer.begin();
for (uint32 u = 0; u < uLineLength; u++) {
- line_ct.ContribRow[u].Weights = p;
+ line_ct.contribRow[u].Weights = p;
p += uWindowSize;
}
return &line_ct;
}
template <class FilterClass>
-LineContribType *C2PassScale<FilterClass>::CalcContributions(uint32 uLineSize, uint32 uSrcSize, double dScale) {
+LineContribType *C2PassScale<FilterClass>::calcContributions(uint32 uLineSize, uint32 uSrcSize, double dScale) {
FilterClass CurFilter;
double dWidth;
@@ -128,7 +128,7 @@ LineContribType *C2PassScale<FilterClass>::CalcContributions(uint32 uLineSize, u
int iWindowSize = 2 * (int)ceil(dWidth) + 1;
// Allocate a new line contributions strucutre
- LineContribType *res = AllocContributions(uLineSize, iWindowSize);
+ LineContribType *res = allocContributions(uLineSize, iWindowSize);
for (uint32 u = 0; u < uLineSize; u++) {
// Scan through line of contributions
@@ -146,20 +146,20 @@ LineContribType *C2PassScale<FilterClass>::CalcContributions(uint32 uLineSize, u
}
}
- res->ContribRow[u].Left = iLeft;
- res->ContribRow[u].Right = iRight;
+ res->contribRow[u].Left = iLeft;
+ res->contribRow[u].Right = iRight;
double dTotalWeight = 0.0; // Zero sum of weights
for (int iSrc = iLeft; iSrc <= iRight; iSrc++) {
// Calculate weights
- dTotalWeight += (res->ContribRow[u].Weights[iSrc - iLeft] = dFScale * CurFilter.Filter(dFScale * (dCenter - (double)iSrc)));
+ dTotalWeight += (res->contribRow[u].Weights[iSrc - iLeft] = dFScale * CurFilter.Filter(dFScale * (dCenter - (double)iSrc)));
}
ASSERT(dTotalWeight >= 0.0); // An error in the filter function can cause this
if (dTotalWeight > 0.0) {
// Normalize weight of neighbouring points
for (int iSrc = iLeft; iSrc <= iRight; iSrc++) {
// Normalize point
- res->ContribRow[u].Weights[iSrc - iLeft] /= dTotalWeight;
+ res->contribRow[u].Weights[iSrc - iLeft] /= dTotalWeight;
}
}
}
@@ -167,7 +167,7 @@ LineContribType *C2PassScale<FilterClass>::CalcContributions(uint32 uLineSize, u
}
template <class FilterClass>
-void C2PassScale<FilterClass>::ScaleRow(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uRow, LineContribType *Contrib) {
+void C2PassScale<FilterClass>::scaleRow(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uRow, LineContribType *Contrib) {
uint32 *pSrcRow = &(pSrc[uRow * uSrcWidth]);
uint32 *pDstRow = &(pRes[uRow * uResWidth]);
for (uint32 x = 0; x < uResWidth; x++) {
@@ -177,15 +177,15 @@ void C2PassScale<FilterClass>::ScaleRow(uint32 *pSrc, uint32 uSrcWidth, uint32 *
double db = 0.0;
double da = 0.0;
- int iLeft = Contrib->ContribRow[x].Left; // Retrieve left boundries
- int iRight = Contrib->ContribRow[x].Right; // Retrieve right boundries
+ int iLeft = Contrib->contribRow[x].Left; // Retrieve left boundries
+ int iRight = Contrib->contribRow[x].Right; // Retrieve right boundries
for (int i = iLeft; i <= iRight; i++) {
// Scan between boundries
// Accumulate weighted effect of each neighboring pixel
- dr += Contrib->ContribRow[x].Weights[i - iLeft] * (double)(make_r(pSrcRow[i]));
- dg += Contrib->ContribRow[x].Weights[i - iLeft] * (double)(make_g(pSrcRow[i]));
- db += Contrib->ContribRow[x].Weights[i - iLeft] * (double)(make_b(pSrcRow[i]));
- da += Contrib->ContribRow[x].Weights[i - iLeft] * (double)(make_a(pSrcRow[i]));
+ dr += Contrib->contribRow[x].Weights[i - iLeft] * (double)(make_r(pSrcRow[i]));
+ dg += Contrib->contribRow[x].Weights[i - iLeft] * (double)(make_g(pSrcRow[i]));
+ db += Contrib->contribRow[x].Weights[i - iLeft] * (double)(make_b(pSrcRow[i]));
+ da += Contrib->contribRow[x].Weights[i - iLeft] * (double)(make_a(pSrcRow[i]));
}
uint32 r = round(dr);
@@ -198,7 +198,7 @@ void C2PassScale<FilterClass>::ScaleRow(uint32 *pSrc, uint32 uSrcWidth, uint32 *
}
template <class FilterClass>
-void C2PassScale<FilterClass>::HorizScale(uint32 *pSrc, uint32 uSrcWidth, uint32 uSrcHeight, uint32 *pDst, uint32 uResWidth, uint32 uResHeight) {
+void C2PassScale<FilterClass>::horizScale(uint32 *pSrc, uint32 uSrcWidth, uint32 uSrcHeight, uint32 *pDst, uint32 uResWidth, uint32 uResHeight) {
TRACE("Performing horizontal scaling...\n");
if (uResWidth == uSrcWidth) {
// No scaling required, just copy
@@ -206,13 +206,13 @@ void C2PassScale<FilterClass>::HorizScale(uint32 *pSrc, uint32 uSrcWidth, uint32
return;
}
// Allocate and calculate the contributions
- LineContribType *Contrib = CalcContributions(uResWidth, uSrcWidth, double(uResWidth) / double(uSrcWidth));
+ LineContribType *Contrib = calcContributions(uResWidth, uSrcWidth, double(uResWidth) / double(uSrcWidth));
for (uint32 u = 0; u < uResHeight; u++)
- ScaleRow(pSrc, uSrcWidth, pDst, uResWidth, u, Contrib); // Scale each row
+ scaleRow(pSrc, uSrcWidth, pDst, uResWidth, u, Contrib); // Scale each row
}
template <class FilterClass>
-void C2PassScale<FilterClass>::ScaleCol(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uResHeight, uint32 uCol, LineContribType *Contrib) {
+void C2PassScale<FilterClass>::scaleCol(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uResHeight, uint32 uCol, LineContribType *Contrib) {
for (uint32 y = 0; y < uResHeight; y++) {
// Loop through column
double dr = 0.0;
@@ -220,16 +220,16 @@ void C2PassScale<FilterClass>::ScaleCol(uint32 *pSrc, uint32 uSrcWidth, uint32 *
double db = 0.0;
double da = 0.0;
- int iLeft = Contrib->ContribRow[y].Left; // Retrieve left boundries
- int iRight = Contrib->ContribRow[y].Right; // Retrieve right boundries
+ int iLeft = Contrib->contribRow[y].Left; // Retrieve left boundries
+ int iRight = Contrib->contribRow[y].Right; // Retrieve right boundries
for (int i = iLeft; i <= iRight; i++) {
// Scan between boundries
// Accumulate weighted effect of each neighboring pixel
uint32 pCurSrc = pSrc[i * uSrcWidth + uCol];
- dr += Contrib->ContribRow[y].Weights[i - iLeft] * (double)(make_r(pCurSrc));
- dg += Contrib->ContribRow[y].Weights[i - iLeft] * (double)(make_g(pCurSrc));
- db += Contrib->ContribRow[y].Weights[i - iLeft] * (double)(make_b(pCurSrc));
- da += Contrib->ContribRow[y].Weights[i - iLeft] * (double)(make_a(pCurSrc));
+ dr += Contrib->contribRow[y].Weights[i - iLeft] * (double)(make_r(pCurSrc));
+ dg += Contrib->contribRow[y].Weights[i - iLeft] * (double)(make_g(pCurSrc));
+ db += Contrib->contribRow[y].Weights[i - iLeft] * (double)(make_b(pCurSrc));
+ da += Contrib->contribRow[y].Weights[i - iLeft] * (double)(make_a(pCurSrc));
}
uint32 r = round(dr);
@@ -242,7 +242,7 @@ void C2PassScale<FilterClass>::ScaleCol(uint32 *pSrc, uint32 uSrcWidth, uint32 *
}
template <class FilterClass>
-void C2PassScale<FilterClass>::VertScale(uint32 *pSrc, uint32 uSrcWidth, uint32 uSrcHeight, uint32 *pDst, uint32 uResWidth, uint32 uResHeight) {
+void C2PassScale<FilterClass>::vertScale(uint32 *pSrc, uint32 uSrcWidth, uint32 uSrcHeight, uint32 *pDst, uint32 uResWidth, uint32 uResHeight) {
TRACE("Performing vertical scaling...");
if (uSrcHeight == uResHeight) {
@@ -251,21 +251,21 @@ void C2PassScale<FilterClass>::VertScale(uint32 *pSrc, uint32 uSrcWidth, uint32
return;
}
// Allocate and calculate the contributions
- LineContribType *Contrib = CalcContributions(uResHeight, uSrcHeight, double(uResHeight) / double(uSrcHeight));
+ LineContribType *Contrib = calcContributions(uResHeight, uSrcHeight, double(uResHeight) / double(uSrcHeight));
for (uint32 u = 0; u < uResWidth; u++)
- ScaleCol(pSrc, uSrcWidth, pDst, uResWidth, uResHeight, u, Contrib); // Scale each column
+ scaleCol(pSrc, uSrcWidth, pDst, uResWidth, uResHeight, u, Contrib); // Scale each column
}
template <class FilterClass>
-uint32 *C2PassScale<FilterClass>::Scale(uint32 *pOrigImage, uint32 uOrigWidth, uint32 uOrigHeight, uint32 *pDstImage, uint32 uNewWidth, uint32 uNewHeight) {
+uint32 *C2PassScale<FilterClass>::scale(uint32 *pOrigImage, uint32 uOrigWidth, uint32 uOrigHeight, uint32 *pDstImage, uint32 uNewWidth, uint32 uNewHeight) {
if (_temp_buffer.size() < uNewWidth * uOrigHeight)
_temp_buffer.resize(uNewWidth * uOrigHeight);
uint32 *pTemp = reinterpret_cast<uint32 *>(&*_temp_buffer.begin());
- HorizScale(pOrigImage, uOrigWidth, uOrigHeight, pTemp, uNewWidth, uOrigHeight);
+ horizScale(pOrigImage, uOrigWidth, uOrigHeight, pTemp, uNewWidth, uOrigHeight);
// Scale temporary image vertically into result image
- VertScale(pTemp, uNewWidth, uOrigHeight, pDstImage, uNewWidth, uNewHeight);
+ vertScale(pTemp, uNewWidth, uOrigHeight, pDstImage, uNewWidth, uNewHeight);
return pDstImage;
}
Commit: 8d5e2718ef35400a73c3e210468d774bd334e8a1
https://github.com/scummvm/scummvm/commit/8d5e2718ef35400a73c3e210468d774bd334e8a1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T16:00:34+02:00
Commit Message:
QDENGINE: More renames in 2PassScale.h
Changed paths:
engines/qdengine/qdcore/util/2PassScale.h
diff --git a/engines/qdengine/qdcore/util/2PassScale.h b/engines/qdengine/qdcore/util/2PassScale.h
index e69eb4b53d7..60bbde84247 100644
--- a/engines/qdengine/qdcore/util/2PassScale.h
+++ b/engines/qdengine/qdcore/util/2PassScale.h
@@ -32,8 +32,8 @@ namespace QDEngine {
namespace scl {
typedef struct {
- double *Weights; // Normalized weights of neighboring pixels
- int Left, Right; // Bounds of source pixels window
+ double *weights; // Normalized weights of neighboring pixels
+ int left, right; // Bounds of source pixels window
} ContributionType; // Contirbution information for a single pixel
typedef struct {
@@ -103,7 +103,7 @@ LineContribType *C2PassScale<FilterClass>::allocContributions(uint32 uLineLength
double *p = &*_weights_buffer.begin();
for (uint32 u = 0; u < uLineLength; u++) {
- line_ct.contribRow[u].Weights = p;
+ line_ct.contribRow[u].weights = p;
p += uWindowSize;
}
return &line_ct;
@@ -111,11 +111,11 @@ LineContribType *C2PassScale<FilterClass>::allocContributions(uint32 uLineLength
template <class FilterClass>
LineContribType *C2PassScale<FilterClass>::calcContributions(uint32 uLineSize, uint32 uSrcSize, double dScale) {
- FilterClass CurFilter;
+ FilterClass curFilter;
double dWidth;
double dFScale = 1.0;
- double dFilterWidth = CurFilter.GetWidth();
+ double dFilterWidth = curFilter.GetWidth();
if (dScale < 1.0) { // Minification
dWidth = dFilterWidth / dScale;
@@ -146,20 +146,20 @@ LineContribType *C2PassScale<FilterClass>::calcContributions(uint32 uLineSize, u
}
}
- res->contribRow[u].Left = iLeft;
- res->contribRow[u].Right = iRight;
+ res->contribRow[u].left = iLeft;
+ res->contribRow[u].right = iRight;
double dTotalWeight = 0.0; // Zero sum of weights
for (int iSrc = iLeft; iSrc <= iRight; iSrc++) {
// Calculate weights
- dTotalWeight += (res->contribRow[u].Weights[iSrc - iLeft] = dFScale * CurFilter.Filter(dFScale * (dCenter - (double)iSrc)));
+ dTotalWeight += (res->contribRow[u].weights[iSrc - iLeft] = dFScale * curFilter.Filter(dFScale * (dCenter - (double)iSrc)));
}
ASSERT(dTotalWeight >= 0.0); // An error in the filter function can cause this
if (dTotalWeight > 0.0) {
// Normalize weight of neighbouring points
for (int iSrc = iLeft; iSrc <= iRight; iSrc++) {
// Normalize point
- res->contribRow[u].Weights[iSrc - iLeft] /= dTotalWeight;
+ res->contribRow[u].weights[iSrc - iLeft] /= dTotalWeight;
}
}
}
@@ -167,7 +167,7 @@ LineContribType *C2PassScale<FilterClass>::calcContributions(uint32 uLineSize, u
}
template <class FilterClass>
-void C2PassScale<FilterClass>::scaleRow(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uRow, LineContribType *Contrib) {
+void C2PassScale<FilterClass>::scaleRow(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uRow, LineContribType *contrib) {
uint32 *pSrcRow = &(pSrc[uRow * uSrcWidth]);
uint32 *pDstRow = &(pRes[uRow * uResWidth]);
for (uint32 x = 0; x < uResWidth; x++) {
@@ -177,15 +177,15 @@ void C2PassScale<FilterClass>::scaleRow(uint32 *pSrc, uint32 uSrcWidth, uint32 *
double db = 0.0;
double da = 0.0;
- int iLeft = Contrib->contribRow[x].Left; // Retrieve left boundries
- int iRight = Contrib->contribRow[x].Right; // Retrieve right boundries
+ int iLeft = contrib->contribRow[x].left; // Retrieve left boundries
+ int iRight = contrib->contribRow[x].right; // Retrieve right boundries
for (int i = iLeft; i <= iRight; i++) {
// Scan between boundries
// Accumulate weighted effect of each neighboring pixel
- dr += Contrib->contribRow[x].Weights[i - iLeft] * (double)(make_r(pSrcRow[i]));
- dg += Contrib->contribRow[x].Weights[i - iLeft] * (double)(make_g(pSrcRow[i]));
- db += Contrib->contribRow[x].Weights[i - iLeft] * (double)(make_b(pSrcRow[i]));
- da += Contrib->contribRow[x].Weights[i - iLeft] * (double)(make_a(pSrcRow[i]));
+ dr += contrib->contribRow[x].weights[i - iLeft] * (double)(make_r(pSrcRow[i]));
+ dg += contrib->contribRow[x].weights[i - iLeft] * (double)(make_g(pSrcRow[i]));
+ db += contrib->contribRow[x].weights[i - iLeft] * (double)(make_b(pSrcRow[i]));
+ da += contrib->contribRow[x].weights[i - iLeft] * (double)(make_a(pSrcRow[i]));
}
uint32 r = round(dr);
@@ -206,13 +206,13 @@ void C2PassScale<FilterClass>::horizScale(uint32 *pSrc, uint32 uSrcWidth, uint32
return;
}
// Allocate and calculate the contributions
- LineContribType *Contrib = calcContributions(uResWidth, uSrcWidth, double(uResWidth) / double(uSrcWidth));
+ LineContribType *contrib = calcContributions(uResWidth, uSrcWidth, double(uResWidth) / double(uSrcWidth));
for (uint32 u = 0; u < uResHeight; u++)
- scaleRow(pSrc, uSrcWidth, pDst, uResWidth, u, Contrib); // Scale each row
+ scaleRow(pSrc, uSrcWidth, pDst, uResWidth, u, contrib); // Scale each row
}
template <class FilterClass>
-void C2PassScale<FilterClass>::scaleCol(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uResHeight, uint32 uCol, LineContribType *Contrib) {
+void C2PassScale<FilterClass>::scaleCol(uint32 *pSrc, uint32 uSrcWidth, uint32 *pRes, uint32 uResWidth, uint32 uResHeight, uint32 uCol, LineContribType *contrib) {
for (uint32 y = 0; y < uResHeight; y++) {
// Loop through column
double dr = 0.0;
@@ -220,16 +220,16 @@ void C2PassScale<FilterClass>::scaleCol(uint32 *pSrc, uint32 uSrcWidth, uint32 *
double db = 0.0;
double da = 0.0;
- int iLeft = Contrib->contribRow[y].Left; // Retrieve left boundries
- int iRight = Contrib->contribRow[y].Right; // Retrieve right boundries
+ int iLeft = contrib->contribRow[y].left; // Retrieve left boundries
+ int iRight = contrib->contribRow[y].right; // Retrieve right boundries
for (int i = iLeft; i <= iRight; i++) {
// Scan between boundries
// Accumulate weighted effect of each neighboring pixel
uint32 pCurSrc = pSrc[i * uSrcWidth + uCol];
- dr += Contrib->contribRow[y].Weights[i - iLeft] * (double)(make_r(pCurSrc));
- dg += Contrib->contribRow[y].Weights[i - iLeft] * (double)(make_g(pCurSrc));
- db += Contrib->contribRow[y].Weights[i - iLeft] * (double)(make_b(pCurSrc));
- da += Contrib->contribRow[y].Weights[i - iLeft] * (double)(make_a(pCurSrc));
+ dr += contrib->contribRow[y].weights[i - iLeft] * (double)(make_r(pCurSrc));
+ dg += contrib->contribRow[y].weights[i - iLeft] * (double)(make_g(pCurSrc));
+ db += contrib->contribRow[y].weights[i - iLeft] * (double)(make_b(pCurSrc));
+ da += contrib->contribRow[y].weights[i - iLeft] * (double)(make_a(pCurSrc));
}
uint32 r = round(dr);
Commit: 8b63056d431f10880e66341a72d4c47117843771
https://github.com/scummvm/scummvm/commit/8b63056d431f10880e66341a72d4c47117843771
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T16:02:28+02:00
Commit Message:
QDENGINE: Renames in util/Filters.h
Changed paths:
engines/qdengine/qdcore/util/2PassScale.h
engines/qdengine/qdcore/util/Filters.h
diff --git a/engines/qdengine/qdcore/util/2PassScale.h b/engines/qdengine/qdcore/util/2PassScale.h
index 60bbde84247..6828f3fb2bc 100644
--- a/engines/qdengine/qdcore/util/2PassScale.h
+++ b/engines/qdengine/qdcore/util/2PassScale.h
@@ -115,7 +115,7 @@ LineContribType *C2PassScale<FilterClass>::calcContributions(uint32 uLineSize, u
double dWidth;
double dFScale = 1.0;
- double dFilterWidth = curFilter.GetWidth();
+ double dFilterWidth = curFilter.getWidth();
if (dScale < 1.0) { // Minification
dWidth = dFilterWidth / dScale;
@@ -152,7 +152,7 @@ LineContribType *C2PassScale<FilterClass>::calcContributions(uint32 uLineSize, u
double dTotalWeight = 0.0; // Zero sum of weights
for (int iSrc = iLeft; iSrc <= iRight; iSrc++) {
// Calculate weights
- dTotalWeight += (res->contribRow[u].weights[iSrc - iLeft] = dFScale * curFilter.Filter(dFScale * (dCenter - (double)iSrc)));
+ dTotalWeight += (res->contribRow[u].weights[iSrc - iLeft] = dFScale * curFilter.filter(dFScale * (dCenter - (double)iSrc)));
}
ASSERT(dTotalWeight >= 0.0); // An error in the filter function can cause this
if (dTotalWeight > 0.0) {
diff --git a/engines/qdengine/qdcore/util/Filters.h b/engines/qdengine/qdcore/util/Filters.h
index 1178a203402..16e5f4b0dd3 100644
--- a/engines/qdengine/qdcore/util/Filters.h
+++ b/engines/qdengine/qdcore/util/Filters.h
@@ -30,17 +30,17 @@ namespace scl {
class CGenericFilter {
public:
- CGenericFilter(double dWidth) : m_dWidth(dWidth) {}
+ CGenericFilter(double dWidth) : _dWidth(dWidth) {}
virtual ~CGenericFilter() {}
- double GetWidth() const {
- return m_dWidth;
+ double getWidth() const {
+ return _dWidth;
}
- void SetWidth(double dWidth) {
- m_dWidth = dWidth;
+ void setWidth(double dWidth) {
+ _dWidth = dWidth;
}
- virtual double Filter(double dVal) = 0;
+ virtual double filter(double dVal) = 0;
protected:
@@ -48,7 +48,7 @@ protected:
#define FILTER_2PI double (2.0 * 3.1415926535897932384626433832795)
#define FILTER_4PI double (4.0 * 3.1415926535897932384626433832795)
- double m_dWidth;
+ double _dWidth;
};
class CBoxFilter : public CGenericFilter {
@@ -56,8 +56,8 @@ public:
CBoxFilter(double dWidth = double(0.5)) : CGenericFilter(dWidth) {}
~CBoxFilter() {}
- double Filter(double dVal) {
- return (fabs(dVal) <= m_dWidth ? 1.0 : 0.0);
+ double filter(double dVal) {
+ return (fabs(dVal) <= _dWidth ? 1.0 : 0.0);
}
};
@@ -66,9 +66,9 @@ public:
CBilinearFilter(double dWidth = double(1.0)) : CGenericFilter(dWidth) {}
~CBilinearFilter() {}
- double Filter(double dVal) {
+ double filter(double dVal) {
dVal = fabs(dVal);
- return (dVal < m_dWidth ? m_dWidth - dVal : 0.0);
+ return (dVal < _dWidth ? _dWidth - dVal : 0.0);
}
};
@@ -77,8 +77,8 @@ public:
CGaussianFilter(double dWidth = double(3.0)) : CGenericFilter(dWidth) {}
~CGaussianFilter() {}
- double Filter(double dVal) {
- if (fabs(dVal) > m_dWidth) {
+ double filter(double dVal) {
+ if (fabs(dVal) > _dWidth) {
return 0.0;
}
return exp(-dVal * dVal / 2.0) / sqrt(FILTER_2PI);
@@ -90,8 +90,8 @@ public:
CHammingFilter(double dWidth = double(0.5)) : CGenericFilter(dWidth) {}
~CHammingFilter() {}
- double Filter(double dVal) {
- if (fabs(dVal) > m_dWidth)
+ double filter(double dVal) {
+ if (fabs(dVal) > _dWidth)
return 0.0;
double dWindow = 0.54 + 0.46 * cos(FILTER_2PI * dVal);
@@ -105,11 +105,11 @@ public:
CBlackmanFilter(double dWidth = double(0.5)) : CGenericFilter(dWidth) {}
~CBlackmanFilter() {}
- double Filter(double dVal) {
- if (fabs(dVal) > m_dWidth)
+ double filter(double dVal) {
+ if (fabs(dVal) > _dWidth)
return 0.0;
- double dN = 2.0 * m_dWidth + 1.0;
+ double dN = 2.0 * _dWidth + 1.0;
return 0.42 + 0.5 * cos(FILTER_2PI * dVal / (dN - 1.0)) + 0.08 * cos(FILTER_4PI * dVal / (dN - 1.0));
}
};
Commit: 5d1b561189b6d7e09b926ebe357940e4bbf76b47
https://github.com/scummvm/scummvm/commit/5d1b561189b6d7e09b926ebe357940e4bbf76b47
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T16:04:58+02:00
Commit Message:
QDENGINE: Rename class methods in CLZ77
Changed paths:
engines/qdengine/qdcore/util/LZ77.cpp
engines/qdengine/qdcore/util/LZ77.h
engines/qdengine/system/graphics/gr_tile_sprite.cpp
diff --git a/engines/qdengine/qdcore/util/LZ77.cpp b/engines/qdengine/qdcore/util/LZ77.cpp
index a542d660ba7..82797e6bd11 100644
--- a/engines/qdengine/qdcore/util/LZ77.cpp
+++ b/engines/qdengine/qdcore/util/LZ77.cpp
@@ -38,21 +38,21 @@ CLZ77::CLZ77() {
CLZ77::~CLZ77() {
}
-int32 CLZ77::LZComp(const byte *s1, const byte *s2, int32 maxlen) {
+int32 CLZ77::lzComp(const byte *s1, const byte *s2, int32 maxlen) {
int32 i;
for (i = 0; i < maxlen; i++)
if (s1[i] != s2[i])
return i;
return maxlen;
}
-const byte *CLZ77::FindLZ(const byte *source, const byte *s, int32 slen, int32 border, int32 mlen, int32 &len) {
+const byte *CLZ77::findLZ(const byte *source, const byte *s, int32 slen, int32 border, int32 mlen, int32 &len) {
int32 maxlen = 0;
int32 limit = slen - (s - source);
const byte *maxp = s - 1;
const byte *p;
len = 0;
for (p = s - 1; p >= source; p--) {
- len = LZComp(p, s, limit);
+ len = lzComp(p, s, limit);
if (len > maxlen) {
maxp = p;
maxlen = len;
@@ -64,13 +64,13 @@ const byte *CLZ77::FindLZ(const byte *source, const byte *s, int32 slen, int32 b
return maxp;
}
-int32 CLZ77::GetMaxEncoded(int32 len) {
+int32 CLZ77::getMaxEncoded(int32 len) {
return len + sizeof(uint32);
}
-int32 CLZ77::GetMaxDecoded(byte *source) {
+int32 CLZ77::getMaxDecoded(byte *source) {
return ((uint32 *)source)[0];
}
-void CLZ77::Encode(byte *target, int32 &tlen, const byte *source, int32 slen) {
+void CLZ77::encode(byte *target, int32 &tlen, const byte *source, int32 slen) {
int32 len, block;
int32 shift, border;
const byte *s, *p;
@@ -97,7 +97,7 @@ void CLZ77::Encode(byte *target, int32 &tlen, const byte *source, int32 slen) {
border = border << 1;
shift--;
}
- p = FindLZ((const byte *)source, s, slen, border, (1 << shift), len);
+ p = findLZ((const byte *)source, s, slen, border, (1 << shift), len);
if (len <= 2) len = 1;
if (len <= 1) {
*t++ = *s++;
@@ -125,7 +125,7 @@ void CLZ77::Encode(byte *target, int32 &tlen, const byte *source, int32 slen) {
// OnStep();
}
}
-int32 CLZ77::Decode(byte *target, int32 &tlen, const byte *source, int32 slen) {
+int32 CLZ77::decode(byte *target, int32 &tlen, const byte *source, int32 slen) {
uint32 i;
uint32 block, len;
uint32 shift, border;
diff --git a/engines/qdengine/qdcore/util/LZ77.h b/engines/qdengine/qdcore/util/LZ77.h
index 52fe80b574e..fbf2d19252f 100644
--- a/engines/qdengine/qdcore/util/LZ77.h
+++ b/engines/qdengine/qdcore/util/LZ77.h
@@ -27,16 +27,16 @@ namespace QDEngine {
class CLZ77 {
private:
- int32 LZComp(const byte *s1, const byte *s2, int32 maxlen);
- const byte *FindLZ(const byte *source, const byte *s, int32 slen, int32 border, int32 mlen, int32 &len);
+ int32 lzComp(const byte *s1, const byte *s2, int32 maxlen);
+ const byte *findLZ(const byte *source, const byte *s, int32 slen, int32 border, int32 mlen, int32 &len);
public:
CLZ77();
virtual ~CLZ77();
- void Encode(byte *target, int32 &tlen, const byte *source, int32 slen);
- int32 Decode(byte *target, int32 &tlen, const byte *source, int32 slen);
- int32 GetMaxEncoded(int32 len);
- int32 GetMaxDecoded(byte *source);
+ void encode(byte *target, int32 &tlen, const byte *source, int32 slen);
+ int32 decode(byte *target, int32 &tlen, const byte *source, int32 slen);
+ int32 getMaxEncoded(int32 len);
+ int32 getMaxDecoded(byte *source);
// virtual void OnStep() = 0;
};
diff --git a/engines/qdengine/system/graphics/gr_tile_sprite.cpp b/engines/qdengine/system/graphics/gr_tile_sprite.cpp
index ad2fd6da833..5ea03970de9 100644
--- a/engines/qdengine/system/graphics/gr_tile_sprite.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_sprite.cpp
@@ -166,7 +166,7 @@ uint32 grTileSprite::compress(const uint32 *in_data, uint32 *out_data, grTileCom
} else if (compress_method == TILE_COMPRESS_LZ77) {
CLZ77 encoder;
int32 len = 0;
- encoder.Encode((byte *)(out_data + 1), len, (const byte *)in_data, GR_TILE_SPRITE_SIZE_BYTES);
+ encoder.encode((byte *)(out_data + 1), len, (const byte *)in_data, GR_TILE_SPRITE_SIZE_BYTES);
assert(len);
out_data[0] = len;
return len / 4 + 2;
@@ -182,7 +182,7 @@ bool grTileSprite::uncompress(const uint32 *in_data, uint32 in_data_length, uint
CLZ77 decoder;
int32 len = 0;
in_data_length = in_data[0];
- decoder.Decode((byte *)out_data, len, (const byte *)(in_data + 1), in_data_length);
+ decoder.decode((byte *)out_data, len, (const byte *)(in_data + 1), in_data_length);
return true;
}
More information about the Scummvm-git-logs
mailing list