make Game::Cave::TekiInfo::read equivalent (#221)

This commit is contained in:
Mateo 2024-11-11 18:34:43 -05:00 committed by GitHub
parent 916aeba828
commit 87b87f0b88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -82,7 +82,7 @@ void TekiInfo::read(Stream& stream)
} }
parsedBuffer[0] = '\0'; parsedBuffer[0] = '\0';
char* parsedString = parsedBuffer; char* parsedString = inputBuffer;
int parsedVarIndex = 0; int parsedVarIndex = 0;
u32 parsedIntValue = 0; u32 parsedIntValue = 0;
char* inputPtr = inputString; char* inputPtr = inputString;
@ -91,25 +91,23 @@ void TekiInfo::read(Stream& stream)
bool isUnderscore = false; bool isUnderscore = false;
if (*inputPtr == '_') { if (*inputPtr == '_') {
if (parsedString == parsedBuffer) { if (parsedString == inputBuffer) {
parsedString[parsedVarIndex] = '\0'; parsedString[parsedVarIndex] = '\0';
EnemyInfo* enemyInfoPtr = gEnemyInfo;
int enemyIndex = 0; int enemyIndex = 0;
while (gEnemyInfoNum > enemyIndex) { while (gEnemyInfoNum > enemyIndex) {
if (strcmp(enemyInfoPtr->mName, parsedString) == 0) { if (strcmp(gEnemyInfo[enemyIndex].mName, parsedString) == 0) {
isUnderscore = true; isUnderscore = true;
break; break;
} }
enemyInfoPtr++;
enemyIndex++; enemyIndex++;
} }
} }
} }
if (isUnderscore) { if (isUnderscore) {
parsedString = inputBuffer; parsedString = parsedBuffer;
parsedVarIndex = 0; parsedVarIndex = 0;
} else { } else {
parsedString[parsedVarIndex] = *inputPtr; parsedString[parsedVarIndex] = *inputPtr;
@ -120,7 +118,7 @@ void TekiInfo::read(Stream& stream)
inputPtr++; inputPtr++;
} }
parsedString[parsedVarIndex] = '\0'; parsedString[parsedVarIndex] = '\0';
mEnemyID = static_cast<EnemyTypeID::EEnemyTypeID>(generalEnemyMgr->getEnemyID(parsedBuffer, EFlag_CanBeSpawned)); mEnemyID = static_cast<EnemyTypeID::EEnemyTypeID>(generalEnemyMgr->getEnemyID(inputBuffer, EFlag_CanBeSpawned));
if (parsedBuffer[0] != '\0') { if (parsedBuffer[0] != '\0') {
pelletMgr->makeOtakaraItemCode(parsedBuffer, mOtakaraItemCode); pelletMgr->makeOtakaraItemCode(parsedBuffer, mOtakaraItemCode);
@ -131,7 +129,6 @@ void TekiInfo::read(Stream& stream)
mType = static_cast<BaseGen::CaveGenType>(stream.readInt()); mType = static_cast<BaseGen::CaveGenType>(stream.readInt());
inputPtr = generalEnemyMgr->getEnemyName(mEnemyID, EFlag_CanBeSpawned); inputPtr = generalEnemyMgr->getEnemyName(mEnemyID, EFlag_CanBeSpawned);
mName = inputPtr; mName = inputPtr;
return;
/* /*
.loc_0x0: .loc_0x0: