From d007bb6c7b519137585c53373ec085b57528b17d Mon Sep 17 00:00:00 2001 From: mekolat Date: Sun, 24 Apr 2016 13:06:34 -0400 Subject: fix npc gender for ManaPlus --- src/map/clif.cpp | 10 +++++++++- src/map/npc-parse.cpp | 5 ++++- src/map/script-fun.cpp | 1 + src/mmo/enums.hpp | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 31ecaf8..81ae02f 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -913,7 +913,15 @@ void clif_npc0078(dumb_ptr nd, Buffer& buf) fixed_78.pos.x = nd->bl_x; fixed_78.pos.y = nd->bl_y; fixed_78.pos.dir = nd->dir; - fixed_78.sex = nd->sex; + + // ManaPlus uses a different sex enum for npcs... + if (nd->sex == SEX::FEMALE) + fixed_78.sex = SEX::UNSPECIFIED; + else if (nd->sex == SEX::MALE) + fixed_78.sex = SEX::NEUTRAL; + else if (nd->sex == SEX::NEUTRAL) + fixed_78.sex = SEX::__OTHER; + buf = create_fpacket<0x0078, 54>(fixed_78); } diff --git a/src/map/npc-parse.cpp b/src/map/npc-parse.cpp index 164d793..99e6267 100644 --- a/src/map/npc-parse.cpp +++ b/src/map/npc-parse.cpp @@ -142,6 +142,7 @@ bool npc_load_warp(ast::npc::Warp& warp) nd->bl_id = npc_get_new_npc_id(); nd->n = map_addnpc(m, nd); + nd->sex = SEX::UNSPECIFIED; nd->bl_prev = nd->bl_next = nullptr; nd->bl_m = m; nd->bl_x = x; @@ -208,6 +209,7 @@ bool npc_load_shop(ast::npc::Shop& shop) } } + nd->sex = SEX::UNSPECIFIED; nd->bl_prev = nd->bl_next = nullptr; nd->bl_m = m; nd->bl_x = x; @@ -435,6 +437,7 @@ bool npc_load_script_none(ast::script::ScriptBody& body, ast::npc::ScriptNone& s nd->name = script_none.name.data; + nd->sex = SEX::UNSPECIFIED; nd->bl_prev = nd->bl_next = nullptr; nd->bl_m = borrow(undefined_gat); nd->bl_x = 0; @@ -542,7 +545,7 @@ bool npc_load_script_map(ast::script::ScriptBody& body, ast::npc::ScriptMap& scr } nd->name = script_map.name.data; - + nd->sex = SEX::UNSPECIFIED; nd->bl_prev = nd->bl_next = nullptr; nd->bl_m = m; nd->bl_x = x; diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index b39a763..fc555ad 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -1145,6 +1145,7 @@ void builtin_puppet(ScriptState *st) // PlayerName::SpellName nd->name = npc; + nd->sex = SEX::UNSPECIFIED; // Dynamically set location nd->bl_m = m; diff --git a/src/mmo/enums.hpp b/src/mmo/enums.hpp index 9a8f8ea..2564ec9 100644 --- a/src/mmo/enums.hpp +++ b/src/mmo/enums.hpp @@ -115,6 +115,7 @@ enum class SEX : uint8_t // TODO switch to Option where appropriate. UNSPECIFIED = 2, NEUTRAL = 3, + __OTHER = 4, // used in ManaPlus only }; inline char sex_to_char(SEX sex) -- cgit v1.2.3-60-g2f50