Skip to content

Commit

Permalink
Fix wrong pattern arg count causing savefile offset (#129)
Browse files Browse the repository at this point in the history
* Fix wrong pattern arg count causing savefile offset
* Version 1.1
  • Loading branch information
Unreal-Dan authored Sep 22, 2023
1 parent 619933c commit b1657b9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions VortexEngine/src/Menus/MenuList/Randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ bool Randomizer::rollPattern(Random &ctx, Mode *pMode, LedPos pos)
newPat = PATTERN_BLEND;
// this is the number of blinks to a complementary color
args.arg7 = ctx.next8(0, 3);
// up to arg7 is filled now
args.numArgs = 7;
}
return pMode->setPattern(newPat, pos, &args);
}
Expand Down
2 changes: 1 addition & 1 deletion VortexEngine/src/Patterns/Pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void Pattern::serialize(ByteStream &buffer) const
PatternArgs defaults = PatternBuilder::getDefaultArgs(m_patternID);
// generate a bitmap of which args are defaulted
uint8_t argmap = ARG_NONE;
for (uint32_t i = 0; i < args.numArgs; ++i) {
for (uint32_t i = 0; i < MAX_ARGS; ++i) {
if (args.args[i] != defaults.args[i]) {
ARGMAP_SET(argmap, i);
}
Expand Down
2 changes: 1 addition & 1 deletion VortexEngine/src/Patterns/PatternArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ uint8_t PatternArgs::operator[](int index) const
void PatternArgs::serialize(ByteStream &buffer, ArgMap argmap) const
{
buffer.serialize(argmap);
for (uint8_t i = 0; i < numArgs; ++i) {
for (uint8_t i = 0; i < MAX_ARGS; ++i) {
if (ARGMAP_ISSET(argmap, i)) {
buffer.serialize(args[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion VortexEngine/src/VortexConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// a savefile produced by 1.1 should be loadable by an engine on 1.2
// and vice versa. But an engine on 2.0 cannot share savefiles with
// either of the engines on version 1.1 or 1.2
#define VORTEX_VERSION_MINOR 0
#define VORTEX_VERSION_MINOR 1

// produces a number like 1.0
#define VORTEX_VERSION_NUMBER VORTEX_VERSION_MAJOR.VORTEX_VERSION_MINOR
Expand Down

0 comments on commit b1657b9

Please sign in to comment.