ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Daodan_Config.c
(Generate patch)

Comparing Daodan/src/Daodan_Config.c (file contents):
Revision 1007 by alloc, Fri Jul 4 15:42:25 2014 UTC vs.
Revision 1162 by rossy, Sun Oct 24 02:50:32 2021 UTC

# Line 2 | Line 2
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"
# Line 11 | Line 12
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  
# Line 47 | Line 46 | ConfigSection_t config[] = {
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,
# Line 62 | Line 71 | ConfigSection_t config[] = {
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,
# Line 285 | Line 299 | void DDrConfig_Print()
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                          }
# Line 346 | Line 363 | const char* DDrConfig_GetOptionTypeName(
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:
# Line 376 | Line 395 | const char* DDrConfig_GetOptionValueStri
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);
# Line 396 | Line 419 | char DDrConfig_NonDefaultOptionValue(Con
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   }
# Line 512 | Line 537 | void DDrIniCallback(const char* section,
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)