Add town reputation improvements (#29)
This commit is contained in:
parent
ef067cd954
commit
3592a7232c
|
@ -292,6 +292,9 @@ static void customKarmaFolderInit();
|
|||
static void customKarmaFolderFree();
|
||||
static int customKarmaFolderGetFrmId();
|
||||
|
||||
static void customTownReputationInit();
|
||||
static void customTownReputationFree();
|
||||
|
||||
// 0x431C40
|
||||
static int gCharacterEditorFrmIds[EDITOR_GRAPHIC_COUNT] = {
|
||||
170,
|
||||
|
@ -792,6 +795,7 @@ struct CustomKarmaFolderDescription {
|
|||
};
|
||||
|
||||
static std::vector<CustomKarmaFolderDescription> gCustomKarmaFolderDescriptions;
|
||||
static std::vector<TownReputationEntry> gCustomTownReputationEntries;
|
||||
|
||||
// 0x431DF8
|
||||
int characterEditorShow(bool isCreationMode)
|
||||
|
@ -1293,6 +1297,9 @@ static int characterEditorWindowInit()
|
|||
// SFALL: Custom karma folder.
|
||||
customKarmaFolderInit();
|
||||
|
||||
// SFALL: Custom town reputation.
|
||||
customTownReputationInit();
|
||||
|
||||
soundContinueAll();
|
||||
|
||||
for (i = 0; i < EDITOR_GRAPHIC_COUNT; i++) {
|
||||
|
@ -1855,6 +1862,9 @@ static void characterEditorWindowFree()
|
|||
// SFALL: Custom karma folder.
|
||||
customKarmaFolderFree();
|
||||
|
||||
// SFALL: Custom town reputation.
|
||||
customTownReputationFree();
|
||||
|
||||
messageListFree(&gCharacterEditorMessageList);
|
||||
|
||||
interfaceBarRefresh();
|
||||
|
@ -4516,8 +4526,9 @@ static int characterPrintToFile(const char* fileName)
|
|||
}
|
||||
|
||||
bool hasTownReputationHeading = false;
|
||||
for (int index = 0; index < TOWN_REPUTATION_COUNT; index++) {
|
||||
const TownReputationEntry* pair = &(gTownReputationEntries[index]);
|
||||
// SFALL
|
||||
for (int index = 0; index < gCustomTownReputationEntries.size(); index++) {
|
||||
const TownReputationEntry* pair = &(gCustomTownReputationEntries[index]);
|
||||
if (_wmAreaIsKnown(pair->city)) {
|
||||
if (!hasTownReputationHeading) {
|
||||
fileWriteString("\n", stream);
|
||||
|
@ -5504,8 +5515,9 @@ static void characterEditorDrawKarmaFolder()
|
|||
}
|
||||
|
||||
bool hasTownReputationHeading = false;
|
||||
for (int index = 0; index < TOWN_REPUTATION_COUNT; index++) {
|
||||
const TownReputationEntry* pair = &(gTownReputationEntries[index]);
|
||||
// SFALL
|
||||
for (int index = 0; index < gCustomTownReputationEntries.size(); index++) {
|
||||
const TownReputationEntry* pair = &(gCustomTownReputationEntries[index]);
|
||||
if (_wmAreaIsKnown(pair->city)) {
|
||||
if (!hasTownReputationHeading) {
|
||||
msg = getmsg(&gCharacterEditorMessageList, &gCharacterEditorMessageListItem, 4000);
|
||||
|
@ -7162,3 +7174,53 @@ static int customKarmaFolderGetFrmId()
|
|||
}
|
||||
return gCustomKarmaFolderDescriptions.end()->frmId;
|
||||
}
|
||||
|
||||
static void customTownReputationInit()
|
||||
{
|
||||
char* reputationList = NULL;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CITY_REPUTATION_LIST_KEY, &reputationList);
|
||||
if (reputationList != NULL && *reputationList == '\0') {
|
||||
reputationList = NULL;
|
||||
}
|
||||
|
||||
char* curr = reputationList;
|
||||
while (curr != NULL) {
|
||||
char* next = strchr(curr, ',');
|
||||
if (next != NULL) {
|
||||
*next = '\0';
|
||||
}
|
||||
|
||||
char* sep = strchr(curr, ':');
|
||||
if (sep != NULL) {
|
||||
*sep = '\0';
|
||||
|
||||
TownReputationEntry entry;
|
||||
entry.city = atoi(curr);
|
||||
entry.gvar = atoi(sep + 1);
|
||||
gCustomTownReputationEntries.push_back(std::move(entry));
|
||||
|
||||
*sep = ':';
|
||||
}
|
||||
|
||||
if (next != NULL) {
|
||||
*next = ',';
|
||||
curr = next + 1;
|
||||
} else {
|
||||
curr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (gCustomTownReputationEntries.empty()) {
|
||||
gCustomTownReputationEntries.resize(TOWN_REPUTATION_COUNT);
|
||||
|
||||
for (int index = 0; index < TOWN_REPUTATION_COUNT; index++) {
|
||||
gCustomTownReputationEntries[index].gvar = gTownReputationEntries[index].gvar;
|
||||
gCustomTownReputationEntries[index].city = gTownReputationEntries[index].city;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void customTownReputationFree()
|
||||
{
|
||||
gCustomTownReputationEntries.clear();
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#define SFALL_CONFIG_PLASTIC_EXPLOSIVE_MIN_DAMAGE_KEY "PlasticExplosive_DmgMin"
|
||||
#define SFALL_CONFIG_PLASTIC_EXPLOSIVE_MAX_DAMAGE_KEY "PlasticExplosive_DmgMax"
|
||||
#define SFALL_CONFIG_EXPLOSION_EMITS_LIGHT_KEY "ExplosionsEmitLight"
|
||||
#define SFALL_CONFIG_CITY_REPUTATION_LIST_KEY "CityRepsList"
|
||||
|
||||
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_MULTIPLIER 1
|
||||
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_DIVISOR 3
|
||||
|
|
Loading…
Reference in New Issue