Fix for bald players bug
Hey. I've been working on the bald players problem for 2-3 days now. For those who don't know about the problem, one of the hairstyle for every race/gender combo doesn't show as it should on luclin models and we see a bald player instead of the selected hairstyle.
Here is what I found: -There are two groups of race/gender combos that are affected by this problem. The race/genders that have 3 hairstyle selections and the race/genders that have 4 hairstyle selections. ex:Human/Female: You can choose from 3 different hairstyles. (Values 0 or 1 or 2) Human/Male: You can choose from 4 different hairstyles. (Values 255 or 0 or 1 or 2) *Hairstyle 255 is the bald player model that you can choose on the character creation menu, only available for male characters and troll/ogre female characters. -The problem we want to solve always happen with hairstyle "0". -Instead of getting the value "0" when this is what the user pick on character creation, it somehow end up with the value "255". This is why we see a bald character when choosing hairstyle "0", it actually show hairstyle "255". Note: -The hairstyle 0 is correctly shown on the character selection screen. -The hairstyle 0 is correctly shown after using /facepick, but after zoning or dying the bald player problem comes back. -After selecting hairstyle 0 on character creation menu, the value "0" seems to be stored correctly in pp.hairstyle, but somehow gets lost along the way and is modified to "255". -Could it be because we transfer a value between int, int8, uint8 and int32 variables? Anyway, here is a way to fix the bug: In client.cpp, on line 951, add: Code:
//Temporary fix for missing hairstyle. Code:
//Temporary fix for missing hairstyle. Code:
//Temporary fix for missing hairstyle. *Important: For the fix to work on an old character (if it's affected by the the bug), you have to do a /facepick in game to have it's hairstyle fixed. This only need to be done once. *Any existing character can pick the new hair style with /facepick. *New characters automatically have the bug fixed. *The fix does not affect people who don't use luclin graphic since pre-luclin only uses the variable "face" and is not using the variable "hairstyle". *If this ends up in the EqEmu code, I could also fix other appearance bugs, using different flag values in eyecolor1, that would only add 2-3 lines to the previous code. **(An other appearance bug, for example, is when we select the haircolor 0 (ex.: dark brown for human male), we end up with haircolor 255 (ex.: white for human male)). The best would be to find why the hairstyle value gets switched from "0" to "255". I really start to think it's an int, int8, int32, uint8 problem, but to be honest, I'm not very good with structs and pointers, so after many hours I was not able to find it. But meanwhile (or if no one feels like working on that), this fix solves the problem. |
I just got a message from someone who's line numbers aren't matching with mines for the fix, so I will put some surrounding code to make it easier.
(Oh and can someone tell me how to edit posts? :rolleyes: ) The bug fix: In client.cpp, on (or near) line 951: Old code: Code:
pp.beard = cc->beard; Code:
pp.beard = cc->beard; Old code: Code:
//eq->unknown0140[4] = emu->unknown0140[4]; Code:
//eq->unknown0140[4] = emu->unknown0140[4]; Old code: Code:
m_pp.beard = fc->beard; Code:
m_pp.beard = fc->beard; |
You have five minutes to edit a post after it's made, then you can't. So making a new post is fine. This deserves a fresh bump anyhow, great fix =)
Looking forward to more of your work, this one has been frustrating for a very long time. |
Excellent fix, Thanks very much.
Tested this and it all seems to be working perfect :D |
I improved the fix (If no bug is found, this will be the final version). It now looks better (in the code) and it fixes more visual problems. There was a missing hairstyle, but there was also a missing face, eyecolor, haircolor, beard and beardcolor.
Here is the new fix, please use this one instead of the one in the first post: (I tested it for 10-20 minutes and it seems to works well, but please write in the thread if you still see any visual problems). ***New code is in blue*** In worlddb.cpp, on (or near) line 85: New code: Code:
cs->hair[char_num] = pp->hairstyle; New code: Code:
New code: Code:
New code: Code:
|
I can't find anything referring to 'pp.beard' (or beard for that matter) in client.cpp.
What version source are you working with? |
Quote:
|
I am working with 1118. I didn't know that, but there seem to be a client.cpp in "Zone" and in "World". You need to use the one in "World".
|
Hahah, well two answers is better than none i guess :wink:
|
Ok, I got ya now, I should have searched better.
Thanks for the code BtW :) |
Seems all the NPCs have white hair now. Is that a result of fixing all the different 0 values? I think we were seeing brown hair as the default on NPCs previously because that's what 0 was getting twisted into. Seems that 0 is actually white hair.
Is that the way you understand it to work? |
Quote:
|
Angelox is right, it's not my fix that is in the code. I was quite happy to see that a better code had been written, but i will be honest, i am a bit sad after seeing that my name is not in the changelog, at least as part of the team that helped solve the problem, i spent 25+ hours working on this bug..
Anyway: haircolor 255 = white hairs (when working correctly) haircolor 0 = dark brown hairs (when working correctly) I haven't tried 1120 and i don't know what the new fix is in the code, but this what i can understand from what So_1337 is seeing in game: My fix only affected player characters, this is why we didn't see a change on NPC. From what i understand, the new fix is working on both player and NPC, so we would either need to know what kind of characters it's drawing (Player or NPC) or we would need to update the default NPC model to have brown hair (after the fix). |
I had no idea, my apologies. I saw your fix here and the reports that it was working, then saw that 1120 included a fix for bald players and assumed it to be yours.
Guess we'll have to wait for the full story from KLS. Thanks for the information, guys. |
Yeah I'm sorry, but none of your code was used for the fix, I'm not even sure if it's a full fix atm. But you were the inspiration behind it, I'll add you to the log on next update if you'd like.
|
All times are GMT -4. The time now is 12:32 AM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.