Compare commits

..

4 Commits

Author SHA1 Message Date
FinnHornhoover
2464e4adda
Merge e88ef52d12 into 4592fc42af 2023-10-10 20:06:43 +00:00
FinnHornhoover
e88ef52d12
commented out default config value
Co-authored-by: Gent Semaj <gsemaj@proton.me>
2023-10-10 23:06:42 +03:00
FinnHornhoover
30b2f4eb36 added config option for racing score modes 2023-10-10 22:36:10 +03:00
gsemaj
4592fc42af
CI/CD improvements
- PR builds will now run even if they weren't opened as drafts
- PR builds will now re-run when they get new commits
- Builds can now be manually triggered from GitHub
2023-10-10 14:35:07 -04:00
6 changed files with 15 additions and 24 deletions

View File

@ -9,12 +9,13 @@ on:
- CMakeLists.txt - CMakeLists.txt
- Makefile - Makefile
pull_request: pull_request:
types: ready_for_review types: [opened, reopened, synchronize, ready_for_review]
paths: paths:
- src/** - src/**
- vendor/** - vendor/**
- CMakeLists.txt - CMakeLists.txt
- Makefile - Makefile
workflow_dispatch:
jobs: jobs:
ubuntu-build: ubuntu-build:

View File

@ -51,6 +51,11 @@ motd=Welcome to OpenFusion!
# and pre-Academy builds must *not* contain it. # and pre-Academy builds must *not* contain it.
#enabledpatches=1013 #enabledpatches=1013
# Use Original FusionFall's racing score and reward calculation?
# Set false to use Retro's calculation, make sure you have the correct
# patch(es) loaded.
#ogracingscores=true
# xdt json filename # xdt json filename
#xdtdata=xdt.json #xdtdata=xdt.json
# NPC json filename # NPC json filename

View File

@ -101,17 +101,13 @@ static void racingEnd(CNSocket* sock, CNPacketData* data) {
EPInfo& epInfo = EPData[mapNum]; EPInfo& epInfo = EPData[mapNum];
EPRace& epRace = EPRaces[sock]; EPRace& epRace = EPRaces[sock];
// if there are no divide-by-zero dangers, and at least one factor has been specified
// we switch over to OG scoring
bool useOGScoring = (epInfo.maxPods > 0) && (epInfo.maxTime > 0) && (
(epInfo.scaleFactor > 0.0) || (epInfo.podFactor > 0.0) || (epInfo.timeFactor > 0.0));
uint64_t now = getTime() / 1000; uint64_t now = getTime() / 1000;
int timeDiff = now - epRace.startTime; int timeDiff = now - epRace.startTime;
int podsCollected = epRace.collectedRings.size(); int podsCollected = epRace.collectedRings.size();
int score = 0, fm = 0; int score = 0, fm = 0;
if (useOGScoring) { if (settings::OGRACINGSCORES) {
score = std::min(epInfo.maxScore, (int)std::exp( score = std::min(epInfo.maxScore, (int)std::exp(
(epInfo.podFactor * podsCollected) / epInfo.maxPods (epInfo.podFactor * podsCollected) / epInfo.maxPods
- (epInfo.timeFactor * timeDiff) / epInfo.maxTime - (epInfo.timeFactor * timeDiff) / epInfo.maxTime

View File

@ -589,28 +589,12 @@ static void loadDrops(json& dropData) {
// time limit isn't stored in the XDT, so we include it in the reward table instead // time limit isn't stored in the XDT, so we include it in the reward table instead
epInfo.maxTime = (int)race["TimeLimit"]; epInfo.maxTime = (int)race["TimeLimit"];
// update max score (if present) // the following has to be present based on the score calculation method
if (race.find("ScoreCap") != race.end()) { if (settings::OGRACINGSCORES) {
epInfo.maxScore = (int)race["ScoreCap"]; epInfo.maxScore = (int)race["ScoreCap"];
}
// update max pods (if present)
if (race.find("TotalPods") != race.end()) {
epInfo.maxPods = (int)race["TotalPods"]; epInfo.maxPods = (int)race["TotalPods"];
}
// update scale factor (if present)
if (race.find("ScaleFactor") != race.end()) {
epInfo.scaleFactor = (double)race["ScaleFactor"]; epInfo.scaleFactor = (double)race["ScaleFactor"];
}
// update pod factor (if present)
if (race.find("PodFactor") != race.end()) {
epInfo.podFactor = (double)race["PodFactor"]; epInfo.podFactor = (double)race["PodFactor"];
}
// update time factor (if present)
if (race.find("TimeFactor") != race.end()) {
epInfo.timeFactor = (double)race["TimeFactor"]; epInfo.timeFactor = (double)race["TimeFactor"];
} }

View File

@ -67,6 +67,9 @@ int settings::MONITORINTERVAL = 5000;
// event mode settings // event mode settings
int settings::EVENTMODE = 0; int settings::EVENTMODE = 0;
// racing score mode
bool settings::OGRACINGSCORES = true;
void settings::init() { void settings::init() {
INIReader reader("config.ini"); INIReader reader("config.ini");
@ -111,6 +114,7 @@ void settings::init() {
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE); EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG); DISABLEFIRSTUSEFLAG = reader.GetBoolean("shard", "disablefirstuseflag", DISABLEFIRSTUSEFLAG);
ANTICHEAT = reader.GetBoolean("shard", "anticheat", ANTICHEAT); ANTICHEAT = reader.GetBoolean("shard", "anticheat", ANTICHEAT);
OGRACINGSCORES = reader.GetBoolean("shard", "ogracingscores", OGRACINGSCORES);
MONITORENABLED = reader.GetBoolean("monitor", "enabled", MONITORENABLED); MONITORENABLED = reader.GetBoolean("monitor", "enabled", MONITORENABLED);
MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT); MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT);
MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL); MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL);

View File

@ -38,6 +38,7 @@ namespace settings {
extern int MONITORPORT; extern int MONITORPORT;
extern int MONITORINTERVAL; extern int MONITORINTERVAL;
extern bool DISABLEFIRSTUSEFLAG; extern bool DISABLEFIRSTUSEFLAG;
extern bool OGRACINGSCORES;
void init(); void init();
} }