From c0740fd21f80e56cecf3ab19a1a93368fcdd9b63 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 22 Oct 2023 09:13:29 -0700 Subject: [PATCH] fix v2 visual checks again --- src/PlayerSubordinates.cc | 82 ++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/src/PlayerSubordinates.cc b/src/PlayerSubordinates.cc index 5e6f4338..73d6b16c 100644 --- a/src/PlayerSubordinates.cc +++ b/src/PlayerSubordinates.cc @@ -41,46 +41,43 @@ void PlayerDispDataDCPCV3::enforce_lobby_join_limits(GameVersion target_version) uint16_t face; uint16_t head; uint16_t hair; - uint16_t hair_r; - uint16_t hair_g; - uint16_t hair_b; }; static constexpr ClassMaxes v1_v2_class_maxes[14] = { - {0x0009, 0x0004, 0x0005, 0x0000, 0x0007, 0x0100, 0x0100, 0x0100}, - {0x0009, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0000, 0x0009, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0009, 0x0004, 0x0005, 0x0000, 0x0007, 0x0100, 0x0100, 0x0100}, - {0x0000, 0x0009, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0000, 0x0009, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0009, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0009, 0x0004, 0x0005, 0x0000, 0x0007, 0x0100, 0x0100, 0x0100}, - {0x0009, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0009, 0x0004, 0x0005, 0x0000, 0x0007}, + {0x0009, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0000, 0x0009, 0x0000, 0x0005, 0x0000}, + {0x0009, 0x0004, 0x0005, 0x0000, 0x0007}, + {0x0000, 0x0009, 0x0000, 0x0005, 0x0000}, + {0x0000, 0x0009, 0x0000, 0x0005, 0x0000}, + {0x0009, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0009, 0x0004, 0x0005, 0x0000, 0x0007}, + {0x0009, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, }; static constexpr ClassMaxes v3_v4_class_maxes[19] = { - {0x0012, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0012, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0000, 0x0019, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0012, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0000, 0x0019, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0000, 0x0019, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0012, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0012, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0012, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0000, 0x0019, 0x0000, 0x0005, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0012, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0012, 0x0004, 0x0005, 0x0000, 0x000A, 0x0100, 0x0100, 0x0100}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0100, 0x0100, 0x0100}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0100, 0x0100, 0x0100}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, - {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}}; + {0x0012, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0012, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0000, 0x0019, 0x0000, 0x0005, 0x0000}, + {0x0012, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0000, 0x0019, 0x0000, 0x0005, 0x0000}, + {0x0000, 0x0019, 0x0000, 0x0005, 0x0000}, + {0x0012, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0012, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0012, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0000, 0x0019, 0x0000, 0x0005, 0x0000}, + {0x0012, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0012, 0x0004, 0x0005, 0x0000, 0x000A}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0001}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0001}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000}}; const ClassMaxes* maxes; if ((target_version == GameVersion::PC) || (target_version == GameVersion::DC)) { @@ -129,14 +126,11 @@ void PlayerDispDataDCPCV3::enforce_lobby_join_limits(GameVersion target_version) } // V1/V2 has fewer costumes and android skins, so substitute them here - this->visual.costume %= maxes->costume; - this->visual.skin %= maxes->skin; - this->visual.face %= maxes->face; - this->visual.head %= maxes->head; - this->visual.hair %= maxes->hair; - this->visual.hair_r %= maxes->hair_r; - this->visual.hair_g %= maxes->hair_g; - this->visual.hair_b %= maxes->hair_b; + this->visual.costume = maxes->costume ? (this->visual.costume % maxes->costume) : 0; + this->visual.skin = maxes->skin ? (this->visual.skin % maxes->skin) : 0; + this->visual.face = maxes->face ? (this->visual.face % maxes->face) : 0; + this->visual.head = maxes->head ? (this->visual.head % maxes->head) : 0; + this->visual.hair = maxes->hair ? (this->visual.hair % maxes->hair) : 0; this->visual.compute_name_color_checksum(); this->visual.class_flags = class_flags_for_class(this->visual.char_class);