mirror of https://github.com/stella-emu/stella.git
allow user defined high score variations
improve Stay Frosty 2 high scores definition add Seawolf high scores definition improve R77 paddle mapping
This commit is contained in:
parent
ff3b69cec7
commit
85eb51c51a
|
@ -72,7 +72,7 @@ Int16 HighScoresManager::peek(uInt16 addr) const
|
|||
else
|
||||
return myOSystem.console().cartridge().internalRamGetValue(addr);
|
||||
}
|
||||
return -1;
|
||||
return NO_VALUE;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -354,8 +354,11 @@ Int32 HighScoresManager::variation() const
|
|||
Properties props;
|
||||
uInt16 addr = varAddress(properties(props));
|
||||
|
||||
if (addr == DEFAULT_ADDRESS)
|
||||
return DEFAULT_VARIATION;
|
||||
if(addr == DEFAULT_ADDRESS)
|
||||
/*if(numVariations() > 1)
|
||||
return DEFAULT_VARIATION;
|
||||
else*/
|
||||
return NO_VALUE;
|
||||
|
||||
return variation(addr, varBCD(props), varZeroBased(props), numVariations(props));
|
||||
}
|
||||
|
@ -365,7 +368,7 @@ Int32 HighScoresManager::score(uInt32 numAddrBytes, uInt32 trailingZeroes,
|
|||
bool isBCD, const ScoreAddresses& scoreAddr) const
|
||||
{
|
||||
if (!myOSystem.hasConsole())
|
||||
return -1;
|
||||
return NO_VALUE;
|
||||
|
||||
Int32 totalScore = 0;
|
||||
|
||||
|
@ -380,13 +383,13 @@ Int32 HighScoresManager::score(uInt32 numAddrBytes, uInt32 trailingZeroes,
|
|||
{
|
||||
score = fromBCD(score);
|
||||
// verify if score is legit
|
||||
if (score == -1)
|
||||
return -1;
|
||||
if (score == NO_VALUE)
|
||||
return NO_VALUE;
|
||||
}
|
||||
totalScore += score;
|
||||
}
|
||||
|
||||
if (totalScore != -1)
|
||||
if (totalScore != NO_VALUE)
|
||||
for (uInt32 i = 0; i < trailingZeroes; ++i)
|
||||
totalScore *= 10;
|
||||
|
||||
|
@ -406,7 +409,7 @@ Int32 HighScoresManager::score() const
|
|||
string addr = getPropIdx(props, PropType::Cart_Addresses, b);
|
||||
|
||||
if (addr.empty())
|
||||
return -1;
|
||||
return NO_VALUE;
|
||||
scoreAddr[b] = stringToIntBase16(addr);
|
||||
}
|
||||
|
||||
|
@ -426,7 +429,7 @@ Int32 HighScoresManager::special() const
|
|||
uInt16 addr = specialAddress(properties(props));
|
||||
|
||||
if (addr == DEFAULT_ADDRESS)
|
||||
return -1;
|
||||
return NO_VALUE;
|
||||
|
||||
return special(addr, specialBCD(props), specialZeroBased(props));
|
||||
}
|
||||
|
@ -435,7 +438,7 @@ Int32 HighScoresManager::special() const
|
|||
Int32 HighScoresManager::special(uInt16 addr, bool varBCD, bool zeroBased) const
|
||||
{
|
||||
if (!myOSystem.hasConsole())
|
||||
return -1;
|
||||
return NO_VALUE;
|
||||
|
||||
Int32 var = peek(addr);
|
||||
|
||||
|
@ -458,7 +461,7 @@ Int32 HighScoresManager::convert(uInt32 val, uInt32 maxVal, bool isBCD, bool zer
|
|||
if (isBCD)
|
||||
val = fromBCD(val);
|
||||
|
||||
if(val == -1)
|
||||
if(val == NO_VALUE)
|
||||
return 0;
|
||||
|
||||
// limit to maxVal's bits
|
||||
|
@ -473,7 +476,7 @@ Int32 HighScoresManager::fromBCD(uInt8 bcd) const
|
|||
{
|
||||
// verify if score is legit
|
||||
if ((bcd & 0xF0) >= 0xA0 || (bcd & 0xF) >= 0xA)
|
||||
return -1;
|
||||
return NO_VALUE;
|
||||
|
||||
return (bcd >> 4) * 10 + bcd % 16;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace HSM {
|
|||
static const uInt32 DEFAULT_VARIATION = 1;
|
||||
static const uInt32 DEFAULT_ADDRESS = 0;
|
||||
|
||||
static const Int32 NO_VALUE = -1;
|
||||
|
||||
using ScoreAddresses = array<Int16, MAX_SCORE_ADDR>;
|
||||
|
||||
struct ScoresInfo {
|
||||
|
|
|
@ -849,19 +849,17 @@ PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultRight
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultLeftPaddlesMapping = {
|
||||
{Event::PaddleZeroAnalog, JOY_CTRL_NONE, JoyAxis::X, JoyDir::ANALOG},
|
||||
#if defined(RETRON77)
|
||||
{Event::PaddleZeroAnalog, JOY_CTRL_NONE, JoyAxis::Z, JoyDir::ANALOG},
|
||||
#else
|
||||
{Event::PaddleZeroAnalog, JOY_CTRL_NONE, JoyAxis::X, JoyDir::ANALOG},
|
||||
#endif
|
||||
// Current code does NOT allow digital and anlog events on the same axis at the same time
|
||||
//{Event::PaddleZeroDecrease, JOY_CTRL_NONE, JoyAxis::X, JoyDir::POS},
|
||||
//{Event::PaddleZeroIncrease, JOY_CTRL_NONE, JoyAxis::X, JoyDir::NEG},
|
||||
{Event::PaddleZeroFire, 0},
|
||||
{Event::PaddleOneAnalog, JOY_CTRL_NONE, JoyAxis::Y, JoyDir::ANALOG},
|
||||
#if defined(RETRON77)
|
||||
{Event::PaddleOneAnalog, JOY_CTRL_NONE, JoyAxis::A3, JoyDir::ANALOG},
|
||||
#else
|
||||
{Event::PaddleOneAnalog, JOY_CTRL_NONE, JoyAxis::Y, JoyDir::ANALOG},
|
||||
#endif
|
||||
// Current code does NOT allow digital and anlog events on the same axis at the same
|
||||
//{Event::PaddleOneDecrease, JOY_CTRL_NONE, JoyAxis::Y, JoyDir::POS},
|
||||
|
@ -871,19 +869,17 @@ PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultLeftP
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultRightPaddlesMapping = {
|
||||
{Event::PaddleTwoAnalog, JOY_CTRL_NONE, JoyAxis::X, JoyDir::ANALOG},
|
||||
#if defined(RETRON77)
|
||||
{Event::PaddleTwoAnalog, JOY_CTRL_NONE, JoyAxis::Z, JoyDir::ANALOG},
|
||||
#else
|
||||
{Event::PaddleTwoAnalog, JOY_CTRL_NONE, JoyAxis::X, JoyDir::ANALOG},
|
||||
#endif
|
||||
// Current code does NOT allow digital and anlog events on the same axis at the same
|
||||
//{Event::PaddleTwoDecrease, JOY_CTRL_NONE, JoyAxis::X, JoyDir::POS},
|
||||
//{Event::PaddleTwoIncrease, JOY_CTRL_NONE, JoyAxis::X, JoyDir::NEG},
|
||||
{Event::PaddleTwoFire, 0},
|
||||
{Event::PaddleThreeAnalog, JOY_CTRL_NONE, JoyAxis::Y, JoyDir::ANALOG},
|
||||
#if defined(RETRON77)
|
||||
{Event::PaddleThreeAnalog, JOY_CTRL_NONE, JoyAxis::A3, JoyDir::ANALOG},
|
||||
#else
|
||||
{Event::PaddleThreeAnalog, JOY_CTRL_NONE, JoyAxis::Y, JoyDir::ANALOG},
|
||||
#endif
|
||||
// Current code does NOT allow digital and anlog events on the same axis at the same
|
||||
//{Event::PaddleThreeDecrease,JOY_CTRL_NONE, JoyAxis::Y, JoyDir::POS},
|
||||
|
|
|
@ -37,8 +37,9 @@
|
|||
|
||||
"Cart.MD5" "541cac55ebcf7891d9d51c415922303f"
|
||||
"Cart.Name" "SF2_20131217_RC8_NTSC"
|
||||
"Cart.Formats" "8"
|
||||
"Cart.Addresses" "1CF7,1CF6,1CF5,1CF4"
|
||||
"Display.Phosphor" "YES"
|
||||
"Cart.Formats" "8,0,B,0,B,0,LEVEL,D,1"
|
||||
"Cart.Addresses" "1CF7,1CF6,1CF5,1CF4,0,18AC"
|
||||
""
|
||||
|
||||
"Cart.MD5" "6dda84fb8e442ecf34241ac0d1d91d69"
|
||||
|
@ -141,6 +142,13 @@
|
|||
"Cart.Addresses" "BD,BE,80,C7"
|
||||
""
|
||||
|
||||
"Cart.MD5" "dde55d9868911407fe8b3fefef396f00"
|
||||
"Cart.Name" "Seawolf (2004) (Xype, Manuel Rotschkar)"
|
||||
"Cart.Variations" "4"
|
||||
"Cart.Formats" "6"
|
||||
"Cart.Addresses" "90,91,92,0"
|
||||
""
|
||||
|
||||
"Cart.MD5" "f0e0addc07971561ab80d9abe1b8d333"
|
||||
"Cart.Manufacturer" "Imagic, Rob Fulop"
|
||||
"Cart.ModelNo" "720000-200, 720101-1B, 720101-1C, IA3200, IA3200C, IX-006-04"
|
||||
|
|
|
@ -65,6 +65,7 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
|
|||
myMode(mode),
|
||||
_max_w(max_w),
|
||||
_max_h(max_h),
|
||||
myVariation(HSM::DEFAULT_VARIATION),
|
||||
myInitials(""),
|
||||
myDirty(false),
|
||||
myHighScoreSaved(false)
|
||||
|
@ -175,7 +176,20 @@ void HighScoresDialog::loadConfig()
|
|||
VarList::push_back(items, buf.str(), i);
|
||||
}
|
||||
myVariationPopup->addItems(items);
|
||||
myVariationPopup->setSelected(instance().highScores().variation());
|
||||
|
||||
Int32 variation = instance().highScores().variation();
|
||||
if(variation != HSM::NO_VALUE)
|
||||
{
|
||||
myVariationPopup->setSelected(variation);
|
||||
myUserDefVar = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// use last selected variation
|
||||
myVariationPopup->setSelected(myVariation);
|
||||
myUserDefVar = true;
|
||||
}
|
||||
|
||||
myVariationPopup->setEnabled(instance().highScores().numVariations() > 1);
|
||||
|
||||
string label = " " + instance().highScores().specialLabel();
|
||||
|
@ -210,7 +224,7 @@ void HighScoresDialog::saveConfig()
|
|||
}
|
||||
// save selected variation
|
||||
saveHighScores(myVariation);
|
||||
if(myVariation == instance().highScores().variation())
|
||||
if(myVariation == instance().highScores().variation() || myUserDefVar)
|
||||
myHighScoreSaved = true;
|
||||
}
|
||||
|
||||
|
@ -277,7 +291,7 @@ void HighScoresDialog::handleVariation(bool init)
|
|||
|
||||
myEditRank = -1;
|
||||
|
||||
if (myVariation == instance().highScores().variation())
|
||||
if (myVariation == instance().highScores().variation() || myUserDefVar)
|
||||
handlePlayedVariation();
|
||||
|
||||
updateWidgets(init);
|
||||
|
@ -367,10 +381,9 @@ void HighScoresDialog::handlePlayedVariation()
|
|||
myDates[r] = myDates[r - 1];
|
||||
}
|
||||
myHighScores[myHighScoreRank] = newScore;
|
||||
//myNames[myHighScoreRank] = "";
|
||||
mySpecials[myHighScoreRank] = newSpecial;
|
||||
myDates[myHighScoreRank] = myNow;
|
||||
myDirty = true;
|
||||
myDirty |= !myUserDefVar; // only ask when the variation was read by defintion
|
||||
}
|
||||
else
|
||||
myHighScoreRank = -1;
|
||||
|
|
|
@ -93,8 +93,9 @@ class HighScoresDialog : public Dialog
|
|||
};
|
||||
|
||||
private:
|
||||
bool myUserDefVar; // allow the user to define the variation
|
||||
bool myDirty;
|
||||
bool myHighScoreSaved; // remember if current high score was already saved (avoids double HS)
|
||||
bool myHighScoreSaved; // remember if current high score was already saved (avoids double HS)
|
||||
unique_ptr<GUI::MessageBox> myConfirmMsg;
|
||||
int _max_w;
|
||||
int _max_h;
|
||||
|
|
Loading…
Reference in New Issue