Skip to content

Commit

Permalink
add option to cut map to a certain number of objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco149 committed Feb 10, 2019
1 parent e91b7d4 commit 66d00d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ void usage() {
"useful for maps with incorrect star rating\n"
" default: uses computed aim stars\n"
" example: 2.4aim\n"
"\n"
"-end[n]\n"
" cuts map to a certain number of objects\n"
);
}

Expand Down Expand Up @@ -874,6 +877,7 @@ int main(int argc, char* argv[]) {
float singletap_threshold = 125.0f;
int mode_override = MODE_STD;
float speed_override = 0, aim_override = 0;
int end;

/* parse arguments ------------------------------------------------- */
me = argv[0];
Expand Down Expand Up @@ -1000,6 +1004,10 @@ int main(int argc, char* argv[]) {
continue;
}

if (sscanf(a, "-end%d", &end) == 1) {
continue;
}

if (!strcmp(a, "-taiko")) {
overrides |= OVERRIDE_MODE;
mode_override = MODE_TAIKO;
Expand Down Expand Up @@ -1091,6 +1099,10 @@ int main(int argc, char* argv[]) {
map.cs = cs_override;
}

if (end > 0 && end < map.nobjects) {
map.nobjects = end;
}

/* diff calc --------------------------------------------------------- */
result = d_init(&stars);
if (result < 0) {
Expand Down
5 changes: 5 additions & 0 deletions oppai.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct ezpp {
int score_version;
float accuracy_percent;
int n300, n100, n50;
int end; /* if set, the map will be cut to this object index */

/* outputs */
float stars;
Expand Down Expand Up @@ -2908,6 +2909,10 @@ int ezpp(ezpp_t* ez, char* mapfile) {
goto cleanup;
}

if (ez->end > 0 && ez->end < map.nobjects) {
map.nobjects = ez->end;
}

if (ez->ar_override) {
map.ar = ez->ar_override;
}
Expand Down

0 comments on commit 66d00d7

Please sign in to comment.