[Scummvm-git-logs] scummvm master -> 3eb0b52ea321e449e17382708795f4495c0f4836
Strangerke
noreply at scummvm.org
Mon Jan 27 07:52:31 UTC 2025
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:
3eb0b52ea3 GOT: Add some const, remove unused parameters from boss2CheckHit
Commit: 3eb0b52ea321e449e17382708795f4495c0f4836
https://github.com/scummvm/scummvm/commit/3eb0b52ea321e449e17382708795f4495c0f4836
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-27T08:52:01+01:00
Commit Message:
GOT: Add some const, remove unused parameters from boss2CheckHit
Changed paths:
engines/got/data/highscores.cpp
engines/got/data/level.cpp
engines/got/data/sd_data.cpp
engines/got/game/boss1.cpp
engines/got/game/boss1.h
engines/got/game/boss2.cpp
engines/got/game/boss2.h
engines/got/game/move_patterns.cpp
engines/got/game/object.cpp
engines/got/game/script.cpp
engines/got/views/story.cpp
diff --git a/engines/got/data/highscores.cpp b/engines/got/data/highscores.cpp
index 5692506d2d3..d23e6172edf 100644
--- a/engines/got/data/highscores.cpp
+++ b/engines/got/data/highscores.cpp
@@ -46,7 +46,7 @@ void HighScores::sync(Common::Serializer &s) {
void HighScores::load() {
Common::File f;
- Common::String scoresName = g_engine->getHighScoresSaveName();
+ const Common::String scoresName = g_engine->getHighScoresSaveName();
Common::InSaveFile *sf = g_system->getSavefileManager()->openForLoading(scoresName);
if (sf != nullptr) {
@@ -79,7 +79,7 @@ void HighScores::save() {
delete sf;
}
-void HighScores::add(int area, const Common::String &name, uint total) {
+void HighScores::add(const int area, const Common::String &name, const uint total) {
// Find the index for the new score in the list
int newIndex;
for (newIndex = 0; newIndex < HIGH_SCORES_PER_AREA && total < _scores[area - 1][newIndex]._total; ++newIndex) {
diff --git a/engines/got/data/level.cpp b/engines/got/data/level.cpp
index e6c20d016c8..376d0883d8c 100644
--- a/engines/got/data/level.cpp
+++ b/engines/got/data/level.cpp
@@ -54,13 +54,13 @@ void Level::sync(Common::Serializer &s) {
s.syncBytes(_filler, 3);
}
-void Level::load(int level) {
+void Level::load(const int level) {
Common::MemoryReadStream src(_G(sdData)[level], 512);
Common::Serializer s(&src, nullptr);
sync(s);
}
-void Level::save(int level) {
+void Level::save(const int level) {
Common::MemoryWriteStream dest(_G(sdData)[level], 512);
Common::Serializer s(nullptr, &dest);
sync(s);
diff --git a/engines/got/data/sd_data.cpp b/engines/got/data/sd_data.cpp
index b486d79f75d..2b2a859bbd0 100644
--- a/engines/got/data/sd_data.cpp
+++ b/engines/got/data/sd_data.cpp
@@ -35,7 +35,7 @@ SdData::~SdData() {
}
void SdData::load() {
- Common::String fname = Common::String::format("SDAT%d", _area);
+ const Common::String fname = Common::String::format("SDAT%d", _area);
resourceRead(fname, _data);
}
diff --git a/engines/got/game/boss1.cpp b/engines/got/game/boss1.cpp
index 78fcf498ae7..c0206ca5f40 100644
--- a/engines/got/game/boss1.cpp
+++ b/engines/got/game/boss1.cpp
@@ -174,8 +174,8 @@ done1:
return d;
}
-void boss1CheckHit(const Actor *actor, int x1, int y1, int x2, int y2, int act_num) {
- if (actor->_moveType == 15 && act_num == 4) {
+void boss1CheckHit(const Actor *actor, const int x1, const int y1, const int x2, const int y2, const int actorNum) {
+ if (actor->_moveType == 15 && actorNum == 4) {
if ((!_G(actor[3])._vulnerableCountdown) && (_G(actor[3])._nextFrame != 3) &&
overlap(x1, y1, x2, y2, actor->_x + 6, actor->_y + 4, actor->_x + 14, actor->_y + 20)) {
actorDamaged(&_G(actor[3]), _G(hammer)->_hitStrength);
diff --git a/engines/got/game/boss1.h b/engines/got/game/boss1.h
index 4f8a5f89037..347d8a7b53c 100644
--- a/engines/got/game/boss1.h
+++ b/engines/got/game/boss1.h
@@ -28,7 +28,7 @@ namespace Got {
// Boss 1 - Snake (Jormangund)
extern int boss1Movement(Actor *actor);
-extern void boss1CheckHit(const Actor *actor, int x1, int y1, int x2, int y2, int act_num);
+extern void boss1CheckHit(const Actor *actor, int x1, int y1, int x2, int y2, int actorNum);
extern void boss1SetupLevel();
extern void boss1ClosingSequence1();
extern void boss1ClosingSequence2();
diff --git a/engines/got/game/boss2.cpp b/engines/got/game/boss2.cpp
index adaf0bca656..b1183996433 100644
--- a/engines/got/game/boss2.cpp
+++ b/engines/got/game/boss2.cpp
@@ -22,7 +22,6 @@
#include "got/game/boss2.h"
#include "got/events.h"
#include "got/game/back.h"
-#include "got/game/init.h"
#include "got/game/move.h"
#include "got/game/status.h"
#include "got/gfx/image.h"
@@ -152,7 +151,7 @@ int boss2Movement(Actor *actor) {
return d;
}
-static void bossSet(byte d, int x, int y) {
+static void bossSet(const byte d, const int x, const int y) {
_G(actor[4])._nextFrame = _G(actor[3])._nextFrame;
_G(actor[5])._nextFrame = _G(actor[3])._nextFrame;
_G(actor[6])._nextFrame = _G(actor[3])._nextFrame;
@@ -168,8 +167,8 @@ static void bossSet(byte d, int x, int y) {
_G(actor[6])._y = y + 16;
}
-void boss2CheckHit(Actor *actor, int x1, int y1, int x2, int y2, int act_num) {
- if ((!_G(actor[3])._vulnerableCountdown)) {
+void boss2CheckHit(Actor *actor) {
+ if (!_G(actor[3])._vulnerableCountdown) {
actorDamaged(&_G(actor[3]), _G(hammer)->_hitStrength);
_G(actor[3])._health -= 10;
if (_G(actor[3])._health == 50) {
@@ -300,7 +299,7 @@ static int boss2MovementExplode(Actor *actor) {
// Boss - skull - shake
static int boss2MovementShake(Actor *actor) {
- int rep, an, hx;
+ int rep, hx;
if (_G(hammer)->_active && _G(hammer)->_moveType != 5) {
hx = _G(hammer)->_x;
@@ -353,7 +352,7 @@ static int boss2MovementShake(Actor *actor) {
Common::fill(su, su + 18, 0);
actorAlwaysShoots(&_G(actor[4]), 1);
- an = _G(actor[4])._shotActor;
+ int an = _G(actor[4])._shotActor;
hx = (_G(thor)->_x / 16);
_G(actor[an])._x = _G(thor)->_x; //hx*16;
_G(actor[an])._y = g_events->getRandomNumber(15);
diff --git a/engines/got/game/boss2.h b/engines/got/game/boss2.h
index 2ef18c136a6..27da1e7acfd 100644
--- a/engines/got/game/boss2.h
+++ b/engines/got/game/boss2.h
@@ -28,7 +28,7 @@ namespace Got {
// Boss 2 - Skull (Nognir)
extern int boss2Movement(Actor *actor);
-extern void boss2CheckHit(Actor *actor, int x1, int y1, int x2, int y2, int act_num);
+extern void boss2CheckHit(Actor *actor);
extern void boss2SetupLevel();
extern void boss2ClosingSequence1();
extern void boss2ClosingSequence2();
diff --git a/engines/got/game/move_patterns.cpp b/engines/got/game/move_patterns.cpp
index d0f5c7b8c13..926e4129c03 100644
--- a/engines/got/game/move_patterns.cpp
+++ b/engines/got/game/move_patterns.cpp
@@ -411,7 +411,7 @@ int checkMove1(const int x, const int y, Actor *actor) {
boss1CheckHit(act, x1, y1, x2, y2, i);
break;
case 2:
- boss2CheckHit(act, x1, y1, x2, y2, i);
+ boss2CheckHit(act);
break;
default:
// Area 3 boss Loki isn't checked here
diff --git a/engines/got/game/object.cpp b/engines/got/game/object.cpp
index afd164832cd..23ac2e0ce81 100644
--- a/engines/got/game/object.cpp
+++ b/engines/got/game/object.cpp
@@ -368,7 +368,7 @@ bool useObject(int flag) {
void useItem() {
bool ret = false;
- int kf = _G(keyFlag[key_magic]);
+ const int kf = _G(keyFlag[key_magic]);
if (!kf && _G(tornadoUsed)) {
actorDestroyed(&_G(actor[2]));
diff --git a/engines/got/game/script.cpp b/engines/got/game/script.cpp
index 2c83342fb92..dbcac6e5b3d 100644
--- a/engines/got/game/script.cpp
+++ b/engines/got/game/script.cpp
@@ -400,7 +400,7 @@ int Scripts::getInternalVariable() {
while (true) {
if (!INTERNAL_VARIABLE[i])
return 0; // Lookup internal variable
- int len = strlen(INTERNAL_VARIABLE[i]);
+ const int len = strlen(INTERNAL_VARIABLE[i]);
if (!strncmp(_buffPtr, INTERNAL_VARIABLE[i], len)) {
_buffPtr += len;
break;
diff --git a/engines/got/views/story.cpp b/engines/got/views/story.cpp
index 19858327a55..c33524097e6 100644
--- a/engines/got/views/story.cpp
+++ b/engines/got/views/story.cpp
@@ -102,7 +102,7 @@ bool Story::msgFocus(const FocusMessage &msg) {
}
// Play the opening music
- musicPlay("OPENSONG", 1);
+ musicPlay("OPENSONG", true);
_yp = 0;
_scrolling = false;
More information about the Scummvm-git-logs
mailing list