Skip to content

Commit ede1761

Browse files
committed
Set TotalTreasureCollected to 0 to auto-weight treasure count
1 parent 3a57338 commit ede1761

File tree

11 files changed

+136
-86
lines changed

11 files changed

+136
-86
lines changed

Docs/Snippets/ServerConfiguration.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"SpawnInvulnerableSecs": 4,
5252
"TotalKills": 10,
5353
"TotalLaps": 3,
54-
"TotalTreasureCollected": 100,
54+
"TotalTreasureCollected": 0,
5555

5656
/* Playlist can contain unlimited number of entries */
5757
"Playlist":
@@ -66,7 +66,7 @@
6666
"SpawnInvulnerableSecs": 4,
6767
"TotalKills": 10,
6868
"TotalLaps": 3,
69-
"TotalTreasureCollected": 100
69+
"TotalTreasureCollected": 0
7070
},
7171
{
7272
"LevelName": "battle1",
@@ -78,7 +78,7 @@
7878
"SpawnInvulnerableSecs": 4,
7979
"TotalKills": 10,
8080
"TotalLaps": 3,
81-
"TotalTreasureCollected": 100
81+
"TotalTreasureCollected": 0
8282
}
8383
],
8484

Sources/Jazz2/Actors/Collectibles/GemGiant.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace Jazz2::Actors::Collectibles
5959

6060
PlaySfx("Break"_s);
6161

62-
std::int32_t count = Random().Next(5, 16);
62+
std::int32_t count = Random().Next(5, 12);
6363
for (int i = 0; i < count; i++) {
6464
float fx = Random().NextFloat(-16.0f, 16.0f);
6565
float fy = Random().NextFloat(-2.0f, 2.0f);

Sources/Jazz2/Actors/Collectibles/GemRing.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace Jazz2::Actors::Collectibles
2222
{
2323
async_await CollectibleBase::OnActivatedAsync(details);
2424

25-
int length = (details.Params[0] > 0 ? details.Params[0] : 8);
25+
std::int32_t length = (details.Params[0] > 0 ? details.Params[0] : 8);
2626
_speed = (details.Params[1] > 0 ? details.Params[1] : 8) * 0.00625f;
2727
_untouched = false;
2828

@@ -32,7 +32,7 @@ namespace Jazz2::Actors::Collectibles
3232

3333
auto& resolver = ContentResolver::Get();
3434
if (!resolver.IsHeadless()) {
35-
for (int i = 0; i < length; i++) {
35+
for (std::int32_t i = 0; i < length; i++) {
3636
ChainPiece& piece = _pieces.emplace_back();
3737
piece.Scale = 0.8f;
3838
piece.Command = std::make_unique<RenderCommand>(RenderCommand::Type::Sprite);
@@ -98,12 +98,12 @@ namespace Jazz2::Actors::Collectibles
9898
if (res != nullptr && res->Base->TextureDiffuse != nullptr) {
9999
Vector2i texSize = res->Base->TextureDiffuse->size();
100100

101-
for (int i = 0; i < _pieces.size(); i++) {
101+
for (std::int32_t i = 0; i < _pieces.size(); i++) {
102102
auto command = _pieces[i].Command.get();
103103

104-
int curAnimFrame = res->FrameOffset + (i % res->FrameCount);
105-
int col = curAnimFrame % res->Base->FrameConfiguration.X;
106-
int row = curAnimFrame / res->Base->FrameConfiguration.X;
104+
std::int32_t curAnimFrame = res->FrameOffset + (i % res->FrameCount);
105+
std::int32_t col = curAnimFrame % res->Base->FrameConfiguration.X;
106+
std::int32_t row = curAnimFrame / res->Base->FrameConfiguration.X;
107107
float texScaleX = (float(res->Base->FrameDimensions.X) / float(texSize.X));
108108
float texBiasX = (float(res->Base->FrameDimensions.X * col) / float(texSize.X));
109109
float texScaleY = (float(res->Base->FrameDimensions.Y) / float(texSize.Y));

Sources/Jazz2/Actors/Solid/GemBarrel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Jazz2::Actors::Solid
2121
{
2222
Movable = true;
2323

24-
uint8_t eventParam = 0;
24+
std::uint8_t eventParam = 0;
2525
AddContent(EventType::Gem, details.Params[0], &eventParam, sizeof(eventParam));
2626
eventParam = 1;
2727
AddContent(EventType::Gem, details.Params[1], &eventParam, sizeof(eventParam));

Sources/Jazz2/Actors/Solid/GemCrate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Jazz2::Actors::Solid
2121
{
2222
Movable = true;
2323

24-
uint8_t eventParam = 0;
24+
std::uint8_t eventParam = 0;
2525
AddContent(EventType::Gem, details.Params[0], &eventParam, sizeof(eventParam));
2626
eventParam = 1;
2727
AddContent(EventType::Gem, details.Params[1], &eventParam, sizeof(eventParam));

Sources/Jazz2/Events/EventMap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,12 @@ namespace Jazz2::Events
270270
_eventLayout[x + y * _layoutSize.X].Event != EventType::Empty);
271271
}
272272

273-
void EventMap::ForEachEvent(EventType eventType, Function<bool(EventTile&, std::int32_t, std::int32_t)>&& forEachCallback) const
273+
void EventMap::ForEachEvent(Function<bool(EventTile&, std::int32_t, std::int32_t)>&& forEachCallback) const
274274
{
275275
for (std::int32_t y = 0; y < _layoutSize.Y; y++) {
276276
for (std::int32_t x = 0; x < _layoutSize.X; x++) {
277277
auto& event = _eventLayout[x + y * _layoutSize.X];
278-
if (event.Event == eventType && !forEachCallback(event, x, y)) {
278+
if (event.Event != EventType::Empty && !forEachCallback(event, x, y)) {
279279
return;
280280
}
281281
}

Sources/Jazz2/Events/EventMap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ namespace Jazz2::Events
7272
EventType GetEventByPosition(std::int32_t x, std::int32_t y, std::uint8_t** eventParams);
7373
/** @brief Returns `true` if specified tile position contains an event */
7474
bool HasEventByPosition(std::int32_t x, std::int32_t y) const;
75-
/** @brief Calls specified callback function for each event found by type */
76-
void ForEachEvent(EventType eventType, Function<bool(EventTile&, std::int32_t, std::int32_t)>&& forEachCallback) const;
75+
/** @brief Calls specified callback function for each event */
76+
void ForEachEvent(Function<bool(EventTile&, std::int32_t, std::int32_t)>&& forEachCallback) const;
7777
/** @brief Returns `true` if specified position contains hurt event */
7878
bool IsHurting(float x, float y, Direction dir);
7979
/** @overload */

0 commit comments

Comments
 (0)