Decompile fn_23818 (FormatMonsterSpeech)
Batch #1903 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_23818 FormatMonsterSpeech: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/Contents/MonsterSpeech.cpp
This commit is contained in:
parent
ef13e565dd
commit
2ae8a409c7
3 changed files with 126 additions and 1 deletions
|
|
@ -106,7 +106,10 @@ public:
|
|||
/* 0FAC */ const char* const* m_jobNamesEnd;
|
||||
/* 0FB0 */ unsigned char unknown_0FB0[0x34];
|
||||
/* 0FE4 */ std::list<std::uint32_t> m_pingSamples;
|
||||
/* 0FEC */ unsigned char unknown_0FEC[0x6C];
|
||||
/* 0FEC */ unsigned char unknown_0FEC[0x24];
|
||||
/* 1010 */ std::uint32_t unknown_1010;
|
||||
/* 1014 */ unsigned char unknown_1014[4];
|
||||
/* 1018 */ char unknown_1018[0x40];
|
||||
/* 1058 */ int m_petActionTable[5][5][7];
|
||||
/* 1314 */ unsigned char unknown_1314[0x258];
|
||||
/* 156C */ XmlDocument m_petTalkTable;
|
||||
|
|
|
|||
121
Source/Contents/MonsterSpeech.cpp
Normal file
121
Source/Contents/MonsterSpeech.cpp
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
#include "Client/Mode/ActiveGameMode.h"
|
||||
#include "Client/Mode/CGameMode.h"
|
||||
#include "Client/Session.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
// STRING: st_16737
|
||||
static const char monsterSpeechFather[] = "아빠";
|
||||
// STRING: st_16738
|
||||
static const char monsterSpeechOlderBrotherHonorific[] = "형님";
|
||||
// STRING: st_16739
|
||||
static const char monsterSpeechOlderBrother[] = "오빠";
|
||||
// STRING: st_16740
|
||||
static const char monsterSpeechYoungMaster[] = "도련님";
|
||||
// STRING: st_16741
|
||||
static const char monsterSpeechBrother[] = "형씨";
|
||||
// STRING: st_16742
|
||||
static const char monsterSpeechYoungMasterTopic[] = "도련님은";
|
||||
// STRING: st_16743
|
||||
static const char monsterSpeechYoungMasterObject[] = "도련님을";
|
||||
// STRING: st_16744
|
||||
static const char monsterSpeechYoungMasterWith[] = "도련님과";
|
||||
// STRING: st_16745
|
||||
static const char monsterSpeechMother[] = "엄마";
|
||||
// STRING: st_16746
|
||||
static const char monsterSpeechOlderSisterHonorific[] = "누님";
|
||||
// STRING: st_16747
|
||||
static const char monsterSpeechOlderSister[] = "언니";
|
||||
// STRING: st_16748
|
||||
static const char monsterSpeechYoungLady[] = "아가씨";
|
||||
// STRING: st_16749
|
||||
static const char monsterSpeechYoungLadyTopic[] = "아가씨는";
|
||||
// STRING: st_16750
|
||||
static const char monsterSpeechYoungLadyObject[] = "아가씨를";
|
||||
// STRING: st_16751
|
||||
static const char monsterSpeechYoungLadyWith[] = "아가씨와";
|
||||
|
||||
// GLOBAL: gl_24523
|
||||
unsigned char monsterSpeechReplacementCount = 13;
|
||||
|
||||
// GLOBAL: gl_24524
|
||||
const char* monsterSpeechReplacements[26] = {
|
||||
monsterSpeechFather,
|
||||
monsterSpeechOlderBrotherHonorific,
|
||||
monsterSpeechOlderBrother,
|
||||
monsterSpeechYoungMaster,
|
||||
monsterSpeechBrother,
|
||||
monsterSpeechYoungMasterTopic,
|
||||
monsterSpeechYoungMasterObject,
|
||||
monsterSpeechYoungMasterWith,
|
||||
monsterSpeechFather,
|
||||
monsterSpeechFather,
|
||||
monsterSpeechFather,
|
||||
monsterSpeechFather,
|
||||
monsterSpeechFather,
|
||||
monsterSpeechMother,
|
||||
monsterSpeechOlderSisterHonorific,
|
||||
monsterSpeechOlderSister,
|
||||
monsterSpeechYoungLady,
|
||||
monsterSpeechYoungLady,
|
||||
monsterSpeechYoungLadyTopic,
|
||||
monsterSpeechYoungLadyObject,
|
||||
monsterSpeechYoungLadyWith,
|
||||
monsterSpeechMother,
|
||||
monsterSpeechMother,
|
||||
monsterSpeechMother,
|
||||
monsterSpeechMother,
|
||||
monsterSpeechMother,
|
||||
};
|
||||
|
||||
// OFFSET: 0x00E12870
|
||||
// FUNCTION: fn_23818
|
||||
void FormatMonsterSpeech(char* text, char* output, std::uint32_t aid, int feminine) {
|
||||
char* source = *text == '\t' ? text + 1 : text;
|
||||
std::sprintf(output, source);
|
||||
|
||||
int offset = 0;
|
||||
int length = 0;
|
||||
char* cursor = output;
|
||||
while (feminine && monsterSpeechReplacementCount) {
|
||||
char* found = nullptr;
|
||||
for (int index = 0; index < monsterSpeechReplacementCount; ++index) {
|
||||
found = std::strstr(cursor, monsterSpeechReplacements[index]);
|
||||
if (found) {
|
||||
const char* replacement = monsterSpeechReplacements[monsterSpeechReplacementCount + index];
|
||||
length = static_cast<int>(std::strlen(replacement));
|
||||
std::strcpy(found, replacement);
|
||||
offset = static_cast<int>(found - output);
|
||||
std::strcat(found, source + offset + length);
|
||||
cursor = found + length;
|
||||
break;
|
||||
}
|
||||
cursor = output + offset + length;
|
||||
}
|
||||
if (!found) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string name = static_cast<CGameMode*>(g_world.ActiveGameMode())->nameCard.Name(aid);
|
||||
const char* speaker;
|
||||
if (!name.empty()) {
|
||||
speaker = name.c_str();
|
||||
} else if (aid == g_session.unknown_1010) {
|
||||
speaker = g_session.unknown_1018;
|
||||
} else {
|
||||
*output = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
std::sprintf(source, "%s : ", speaker);
|
||||
std::strcat(source, output);
|
||||
std::strcpy(output, source);
|
||||
const std::size_t end = std::strlen(output) - 1;
|
||||
if (output[end] == '\t') {
|
||||
output[end] = '\0';
|
||||
}
|
||||
}
|
||||
|
|
@ -379,6 +379,7 @@
|
|||
"Source/Contents/Models/ModelSpatial.cpp": 3,
|
||||
"Source/Contents/Models/ModelTextureAnimation.cpp": 3,
|
||||
"Source/Contents/MonsterResources.cpp": 4,
|
||||
"Source/Contents/MonsterSpeech.cpp": 4,
|
||||
"Source/Contents/MovementRoute.cpp": 4,
|
||||
"Source/Contents/MovementRouteInterpolation.cpp": 4,
|
||||
"Source/Contents/Movies/BinkMovie.cpp": 3,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue