| 2 |
|
#include <string.h> |
| 3 |
|
#include <time.h> |
| 4 |
|
|
| 5 |
+ |
#include "Daodan.h" |
| 6 |
|
#include "Daodan_Config.h" |
| 7 |
|
#include "Daodan_Patch.h" |
| 8 |
|
#include "Patches/Utility.h" |
| 12 |
|
|
| 13 |
|
#include "Inifile_Reader.h" |
| 14 |
|
|
| 14 |
– |
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) |
| 15 |
– |
|
| 15 |
|
static const char* iniName = "daodan.ini"; |
| 16 |
|
static const char* helpFile = "daodan_help.txt"; |
| 17 |
|
|
| 18 |
|
static const char* defaultSection = "options"; |
| 19 |
|
|
| 20 |
< |
static char invalidCurParamaters[1000] = ""; |
| 21 |
< |
static char invalidTotalParamaters[3000] = ""; |
| 20 |
> |
static char invalidCurParamaters[2000] = ""; |
| 21 |
> |
static char invalidTotalParamaters[4000] = ""; |
| 22 |
|
|
| 23 |
|
void DDrConfig_PrintHelp(); |
| 24 |
|
|
| 46 |
|
{ 0, 0, 0, {0}, {0} } |
| 47 |
|
} }, |
| 48 |
|
{ "gameplay", "Gameplay", { |
| 49 |
+ |
{ "bindablecheats", |
| 50 |
+ |
"Allows cheats to be bound to keys. Requires 'customactions' and 'cheattable' to be true.", |
| 51 |
+ |
C_BOOL, |
| 52 |
+ |
{.intBoolVal = true}, |
| 53 |
+ |
{.intBoolVal = true} }, |
| 54 |
+ |
{ "characterawareness", |
| 55 |
+ |
"Makes AI remember the player.", |
| 56 |
+ |
C_BOOL, |
| 57 |
+ |
{.intBoolVal = true}, |
| 58 |
+ |
{.intBoolVal = true} }, |
| 59 |
|
{ "cheatsenabled", |
| 60 |
|
"Enables cheats without having to beat the game first.", |
| 61 |
|
C_BOOL, |
| 71 |
|
C_BOOL, |
| 72 |
|
{.intBoolVal = true}, |
| 73 |
|
{.intBoolVal = true} }, |
| 74 |
+ |
{ "customactions", |
| 75 |
+ |
"Allows more actions to be bound through Daodan.", |
| 76 |
+ |
C_BOOL, |
| 77 |
+ |
{.intBoolVal = true}, |
| 78 |
+ |
{.intBoolVal = true} }, |
| 79 |
|
{ "kickguns", |
| 80 |
|
"EXPERIMENTAL! Unfinished, do not use.", |
| 81 |
|
C_BOOL, |
| 299 |
|
break; |
| 300 |
|
case C_CMD: |
| 301 |
|
break; |
| 302 |
+ |
case C_FLOAT: |
| 303 |
+ |
STARTUPMESSAGE("Option %s.%s = %f (def %f)", config[s].name, co->name, co->value.floatVal, co->defaultValue.floatVal); |
| 304 |
+ |
break; |
| 305 |
|
default: |
| 306 |
|
STARTUPMESSAGE("Option %s.%s = %d (def %d)", config[s].name, co->name, co->value.intBoolVal, co->defaultValue.intBoolVal); |
| 307 |
|
} |
| 363 |
|
switch (type) { |
| 364 |
|
case C_INT: |
| 365 |
|
return "Int"; |
| 366 |
+ |
case C_FLOAT: |
| 367 |
+ |
return "Float"; |
| 368 |
|
case C_BOOL: |
| 369 |
|
return "Bool"; |
| 370 |
|
case C_STRING: |
| 395 |
|
return (boolV ? "true" : "false"); |
| 396 |
|
case C_CMD: |
| 397 |
|
return 0; |
| 398 |
+ |
case C_FLOAT: |
| 399 |
+ |
val = malloc(50); |
| 400 |
+ |
sprintf(val, "%f", optVal->floatVal); |
| 401 |
+ |
return val; |
| 402 |
|
default: |
| 403 |
|
val = malloc(20); |
| 404 |
|
sprintf(val, "%d", boolV); |
| 419 |
|
return 0; |
| 420 |
|
case C_INT: |
| 421 |
|
return opt->defaultValue.intBoolVal != opt->value.intBoolVal; |
| 422 |
+ |
case C_FLOAT: |
| 423 |
+ |
return opt->defaultValue.floatVal != opt->value.floatVal; |
| 424 |
|
} |
| 425 |
|
return 0; |
| 426 |
|
} |
| 537 |
|
case C_INT: |
| 538 |
|
co->value.intBoolVal = strtol(value, NULL, 0); |
| 539 |
|
break; |
| 540 |
+ |
case C_FLOAT: |
| 541 |
+ |
co->value.floatVal = strtof(value, NULL); |
| 542 |
+ |
break; |
| 543 |
|
case C_BOOL: |
| 544 |
|
co->value.intBoolVal = !_stricmp(value, "true"); |
| 545 |
|
break; |
| 558 |
|
STARTUPMESSAGE("Config value type unknown: %d", co->type); |
| 559 |
|
} |
| 560 |
|
} else { |
| 561 |
< |
char buf[50]; |
| 561 |
> |
char buf[100]; |
| 562 |
|
if (!_stricmp(section, "*")) |
| 563 |
< |
sprintf_s(buf, sizeof(buf), " %s\n", name); |
| 563 |
> |
sprintf(buf, " %s\n", name); |
| 564 |
|
else |
| 565 |
< |
sprintf_s(buf, sizeof(buf), " %s.%s\n", section, name); |
| 565 |
> |
sprintf(buf, " %s.%s\n", section, name); |
| 566 |
|
if (strlen(buf) + strlen(invalidCurParamaters) < sizeof(invalidCurParamaters) - 1) { |
| 567 |
|
strcpy(invalidCurParamaters + strlen(invalidCurParamaters), buf); |
| 568 |
|
} |
| 620 |
|
|
| 621 |
|
if (strlen(invalidCurParamaters) > 0) |
| 622 |
|
{ |
| 623 |
< |
sprintf_s(invalidTotalParamaters, sizeof(invalidTotalParamaters), "In %s:\n%s\n", iniName, invalidCurParamaters); |
| 623 |
> |
sprintf(invalidTotalParamaters, "In %s:\n%s\n", iniName, invalidCurParamaters); |
| 624 |
|
invalidCurParamaters[0] = 0; |
| 625 |
|
} |
| 626 |
|
|
| 630 |
|
|
| 631 |
|
if (strlen(invalidCurParamaters) > 0) |
| 632 |
|
{ |
| 633 |
< |
sprintf_s(invalidTotalParamaters, sizeof(invalidTotalParamaters), "%sOn command line:\n%s\n", invalidTotalParamaters, invalidCurParamaters); |
| 633 |
> |
sprintf(invalidTotalParamaters, "%sOn command line:\n%s\n", invalidTotalParamaters, invalidCurParamaters); |
| 634 |
|
} |
| 635 |
|
|
| 636 |
|
if (strlen(invalidTotalParamaters) > 0) |
| 637 |
|
{ |
| 638 |
< |
char msg[3200]; |
| 639 |
< |
sprintf_s(msg, sizeof(msg), "Invalid parameters given:\n%sContinue launching Oni?", invalidTotalParamaters); |
| 638 |
> |
char msg[4096]; |
| 639 |
> |
sprintf(msg, "Invalid parameters given:\n%sContinue launching Oni?", invalidTotalParamaters); |
| 640 |
|
int res = MessageBox(NULL, msg, "Parameters invalid", MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1); |
| 641 |
|
if (res == IDNO) { |
| 642 |
|
exit(0); |