From 0c7245fa09f06f457ff01b5fe38adc46b771d1b7 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Wed, 8 Jun 2022 22:01:25 +0300 Subject: [PATCH] Add player model settings See #29 --- src/art.cc | 45 +++++++++++++++++++++++++++++++++++++++++---- src/art.h | 5 +++++ src/sfall_config.cc | 4 ++++ src/sfall_config.h | 4 ++++ 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/art.cc b/src/art.cc index fc4ab4d..31ed7a1 100644 --- a/src/art.cc +++ b/src/art.cc @@ -7,11 +7,24 @@ #include "memory.h" #include "object.h" #include "proto.h" +#include "sfall_config.h" #include #include #include +// 0x5002D8 +char gDefaultJumpsuitMaleFileName[] = "hmjmps"; + +// 0x05002E0 +char gDefaultJumpsuitFemaleFileName[] = "hfjmps"; + +// 0x5002E8 +char gDefaultTribalMaleFileName[] = "hmwarr"; + +// 0x5002F0 +char gDefaultTribalFemaleFileName[] = "hfprim"; + // 0x510738 ArtListDescription gArtListDescriptions[OBJ_TYPE_COUNT] = { { 0, "items", 0, 0, 0 }, @@ -153,18 +166,42 @@ int artInit() return -1; } + char* jumpsuitMaleFileName = NULL; + configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_JUMPSUIT_MALE_KEY, &jumpsuitMaleFileName); + if (jumpsuitMaleFileName == NULL || jumpsuitMaleFileName[0] != '\0') { + jumpsuitMaleFileName = gDefaultJumpsuitMaleFileName; + } + + char* jumpsuitFemaleFileName = NULL; + configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_JUMPSUIT_FEMALE_KEY, &jumpsuitFemaleFileName); + if (jumpsuitFemaleFileName == NULL || jumpsuitFemaleFileName[0] == '\0') { + jumpsuitFemaleFileName = gDefaultJumpsuitFemaleFileName; + } + + char* tribalMaleFileName = NULL; + configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_MALE_KEY, &tribalMaleFileName); + if (tribalMaleFileName == NULL || tribalMaleFileName[0] == '\0') { + tribalMaleFileName = gDefaultTribalMaleFileName; + } + + char *tribalFemaleFileName = NULL; + configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_FEMALE_KEY, &tribalFemaleFileName); + if (tribalFemaleFileName == NULL || tribalFemaleFileName[0] == '\0') { + tribalFemaleFileName = gDefaultTribalFemaleFileName; + } + ptr = gArtListDescriptions[1].fileNames; for (i = 0; i < gArtListDescriptions[1].fileNamesLength; i++) { - if (compat_stricmp(ptr, "hmjmps") == 0) { + if (compat_stricmp(ptr, jumpsuitMaleFileName) == 0) { _art_vault_person_nums[DUDE_NATIVE_LOOK_JUMPSUIT][GENDER_MALE] = i; - } else if (compat_stricmp(ptr, "hfjmps") == 0) { + } else if (compat_stricmp(ptr, jumpsuitFemaleFileName) == 0) { _art_vault_person_nums[DUDE_NATIVE_LOOK_JUMPSUIT][GENDER_FEMALE] = i; } - if (compat_stricmp(ptr, "hmwarr") == 0) { + if (compat_stricmp(ptr, tribalMaleFileName) == 0) { _art_vault_person_nums[DUDE_NATIVE_LOOK_TRIBAL][GENDER_MALE] = i; _art_vault_guy_num = i; - } else if (compat_stricmp(ptr, "hfprim") == 0) { + } else if (compat_stricmp(ptr, tribalFemaleFileName) == 0) { _art_vault_person_nums[DUDE_NATIVE_LOOK_TRIBAL][GENDER_FEMALE] = i; } diff --git a/src/art.h b/src/art.h index 38258f8..7c96067 100644 --- a/src/art.h +++ b/src/art.h @@ -124,6 +124,11 @@ typedef enum DudeNativeLook { DUDE_NATIVE_LOOK_COUNT, } DudeNativeLook; +extern char gDefaultJumpsuitMaleFileName[]; +extern char gDefaultJumpsuitFemaleFileName[]; +extern char gDefaultTribalMaleFileName[]; +extern char gDefaultTribalFemaleFileName[]; + extern ArtListDescription gArtListDescriptions[OBJ_TYPE_COUNT]; extern bool gArtLanguageInitialized; extern const char* _head1; diff --git a/src/sfall_config.cc b/src/sfall_config.cc index cc08b3d..3e82246 100644 --- a/src/sfall_config.cc +++ b/src/sfall_config.cc @@ -21,6 +21,10 @@ bool sfallConfigInit(int argc, char** argv) } // Initialize defaults. + configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_JUMPSUIT_MALE_KEY, ""); + configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_JUMPSUIT_FEMALE_KEY, ""); + configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_MALE_KEY, ""); + configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_FEMALE_KEY, ""); configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_BIG_FONT_COLOR, 0); configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MAIN_MENU_FONT_COLOR, 0); configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_SKIP_OPENING_MOVIES_KEY, 0); diff --git a/src/sfall_config.h b/src/sfall_config.h index 7c21f42..be583be 100644 --- a/src/sfall_config.h +++ b/src/sfall_config.h @@ -7,6 +7,10 @@ #define SFALL_CONFIG_MISC_KEY "Misc" +#define SFALL_CONFIG_DUDE_NATIVE_LOOK_JUMPSUIT_MALE_KEY "MaleDefaultModel" +#define SFALL_CONFIG_DUDE_NATIVE_LOOK_JUMPSUIT_FEMALE_KEY "FemaleDefaultModel" +#define SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_MALE_KEY "MaleStartModel" +#define SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_FEMALE_KEY "FemaleStartModel" #define SFALL_CONFIG_MAIN_MENU_BIG_FONT_COLOR "MainMenuBigFontColour" #define SFALL_CONFIG_MAIN_MENU_FONT_COLOR "MainMenuFontColour" #define SFALL_CONFIG_SKIP_OPENING_MOVIES_KEY "SkipOpeningMovies"