Decompile fn_06983 (CEZ2STREffectMgr::InfoInserter::operator())
Batch #4218 by youko: 0 byte-identical, 1 confirmed by peer review. - fn_06983 CEZ2STREffectMgr::InfoInserter::operator(): logic confirmed by peer review Peer-reviewed-by: Yommy, superintelligence, zindokar Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
8000c59027
commit
08d3ab0ae8
2 changed files with 65 additions and 3 deletions
|
|
@ -9,8 +9,10 @@
|
|||
#include "Contents/Effects/EffectPrimitiveState.h"
|
||||
#include "Contents/Effects/Particle.h"
|
||||
#include "Contents/World/World.h"
|
||||
#include "Network/TextEncoding.h"
|
||||
#include "Resource/World/TerrainResource.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <new>
|
||||
#include <string>
|
||||
|
|
@ -469,6 +471,43 @@ void CEZ2STREffect::Slot16(int argument) {
|
|||
this->SetEventFrame(0, this->frameStep + 1);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00700070
|
||||
// FUNCTION: fn_06983
|
||||
void CEZ2STREffectMgr::InfoInserter::operator()(const std::pair<const std::string, EZ2STREffectRecord>& entry) const {
|
||||
const EZ2STREffectRecord& record = entry.second;
|
||||
if (record.name.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
EZ2STREffectInfo info;
|
||||
info.id = static_cast<int>(this->manager->effects.size());
|
||||
info.name = static_cast<const std::string&>(FromUtf8(record.name, g_textCodePage));
|
||||
info.offsetX = static_cast<float>(record.offsetX);
|
||||
if (record.unknown_0028) {
|
||||
info.unknown_0024 |= 1;
|
||||
}
|
||||
if (record.unknown_0029) {
|
||||
info.unknown_0024 |= 2;
|
||||
}
|
||||
info.offsetY = static_cast<float>(record.offsetY);
|
||||
if (record.unknown_002A) {
|
||||
info.unknown_0024 |= 4;
|
||||
}
|
||||
info.unknown_0028 = static_cast<const std::string&>(FromUtf8(record.unknown_002C, g_textCodePage));
|
||||
if (record.unknown_0044) {
|
||||
info.unknown_0024 |= 8;
|
||||
}
|
||||
info.unknown_0040[0] = record.unknown_0048[0];
|
||||
info.unknown_0040[1] = record.unknown_0048[1];
|
||||
if (record.unknown_0050) {
|
||||
info.unknown_0024 |= 16;
|
||||
}
|
||||
|
||||
std::string key = FromUtf8(entry.first, g_textCodePage);
|
||||
std::transform(key.begin(), key.end(), key.begin(), [](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
||||
this->manager->effects.insert(std::make_pair(key, info));
|
||||
}
|
||||
|
||||
// OFFSET: 0x00700A10
|
||||
// FUNCTION: fn_06988
|
||||
EZ2STREffectInfo* CEZ2STREffectMgr::FindById(int id) {
|
||||
|
|
|
|||
|
|
@ -9,21 +9,41 @@
|
|||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
struct EZ2STREffectInfo {
|
||||
/* 0000 */ int id;
|
||||
/* 0000 */ int id = 0;
|
||||
/* 0004 */ std::string name;
|
||||
/* 001C */ float offsetX;
|
||||
/* 0020 */ float offsetY;
|
||||
/* 0024 */ int unknown_0024;
|
||||
/* 0024 */ int unknown_0024 = 0;
|
||||
/* 0028 */ std::string unknown_0028;
|
||||
/* 0040 */ int unknown_0040[2];
|
||||
/* 0040 */ int unknown_0040[2] = {-1, 0};
|
||||
};
|
||||
|
||||
struct EZ2STREffectRecord {
|
||||
/* 0000 */ std::string name;
|
||||
/* 0018 */ double offsetX;
|
||||
/* 0020 */ double offsetY;
|
||||
/* 0028 */ bool unknown_0028;
|
||||
/* 0029 */ bool unknown_0029;
|
||||
/* 002A */ bool unknown_002A;
|
||||
/* 002C */ std::string unknown_002C;
|
||||
/* 0044 */ bool unknown_0044;
|
||||
/* 0048 */ int unknown_0048[2];
|
||||
/* 0050 */ bool unknown_0050;
|
||||
};
|
||||
|
||||
class CEZ2STREffectMgr : public Singleton<CEZ2STREffectMgr> {
|
||||
public:
|
||||
/* 0004 */ std::map<std::string, EZ2STREffectInfo> effects;
|
||||
|
||||
struct InfoInserter {
|
||||
/* 0000 */ CEZ2STREffectMgr* manager;
|
||||
|
||||
void operator()(const std::pair<const std::string, EZ2STREffectRecord>& entry) const;
|
||||
};
|
||||
|
||||
EZ2STREffectInfo* FindById(int id);
|
||||
int EffectId(const std::string& name);
|
||||
};
|
||||
|
|
@ -83,6 +103,9 @@ public:
|
|||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(EZ2STREffectInfo) == 0x48);
|
||||
static_assert(sizeof(CEZ2STREffectMgr) == 0xC);
|
||||
static_assert(sizeof(EZ2STREffectRecord) == 0x58);
|
||||
static_assert(offsetof(EZ2STREffectRecord, unknown_002C) == 0x2C);
|
||||
static_assert(offsetof(EZ2STREffectRecord, unknown_0050) == 0x50);
|
||||
static_assert(offsetof(EZ2STREmitter, currentFrame) == 0x3CC4);
|
||||
static_assert(offsetof(EZ2STREmitter, looping) == 0x3F5C);
|
||||
static_assert(offsetof(EZ2STREmitter, unknown_3F98) == 0x3F98);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue