Decompile fn_23481 (CSession::GetWeaponHitWaveName)

Batch #7324 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_23481 CSession::GetWeaponHitWaveName: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, alisonrag, willerthal, superintelligence
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-10-31 06:09:26 +00:00
commit 2aec9ad64c
2 changed files with 43 additions and 0 deletions

View file

@ -55,6 +55,48 @@ const char* CSession::GetHitWaveName(int job) {
return weaponWaves[weapon].c_str();
}
// OFFSET: 0x00DE3680
// FUNCTION: fn_23481
const char* CSession::GetWeaponHitWaveName(int weapon) {
const int realWeapon = GetRealWeaponId(weapon);
if (realWeapon == -1) {
switch (std::rand() % 4) {
case 0:
return "_enemy_hit_normal1.wav";
case 1:
return "_enemy_hit_normal2.wav";
case 2:
return "_enemy_hit_normal3.wav";
case 3:
return "_enemy_hit_normal4.wav";
}
}
const std::vector<std::string>& weaponWaves = reinterpret_cast<const std::vector<std::string>&>(this->unknown_525C[0x18]);
if (weaponWaves.empty() || weaponWaves.size() <= static_cast<unsigned int>(realWeapon)) {
return nullptr;
}
if (this->GetDisplayJob() == 4046 || this->GetDisplayJob() == 4225) {
return weaponWaves[realWeapon].c_str();
}
if (realWeapon == 0) {
switch (std::rand() % 4) {
case 0:
return "_hit_fist1.wav";
case 1:
return "_hit_fist2.wav";
case 2:
return "_hit_fist3.wav";
case 3:
return "_hit_fist4.wav";
}
}
return weaponWaves[realWeapon].c_str();
}
// OFFSET: 0x00DE5BD0
// FUNCTION: fn_23494
void CSession::InitJobHitWaveNames() {