1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

implement peep_give_real_name

This commit is contained in:
zsilencer
2015-10-06 23:52:37 -06:00
parent 06c33dfd8a
commit 468a6c15fa

View File

@@ -8459,7 +8459,33 @@ static void peep_head_for_nearest_ride_with_flags(rct_peep *peep, int rideTypeFl
*/
static void peep_give_real_name(rct_peep *peep)
{
RCT2_CALLPROC_X(0x0069C483, 0, 0, 0, 0, (int)peep, 0, 0);
// Generate a name_string_idx from the peep id using bit twiddling
uint32 eax = peep->id + 0xF0B;
uint16 dx = 0;
dx |= ((eax & 0x400) ? 1 : 0) << 13;
dx |= ((eax & 0x2000) ? 1 : 0) << 12;
dx |= ((eax & 0x800) ? 1 : 0) << 11;
dx |= ((eax & 0x400) ? 1 : 0) << 10;
dx |= ((eax & 0x1) ? 1 : 0) << 9;
dx |= ((eax & 0x40) ? 1 : 0) << 8;
dx |= ((eax & 0x2) ? 1 : 0) << 7;
dx |= ((eax & 0x4) ? 1 : 0) << 6;
dx |= ((eax & 0x100) ? 1 : 0) << 5;
dx |= ((eax & 0x20) ? 1 : 0) << 4;
dx |= ((eax & 0x80) ? 1 : 0) << 3;
dx |= ((eax & 0x8) ? 1 : 0) << 2;
dx |= ((eax & 0x200) ? 1 : 0) << 1;
dx |= ((eax & 0x10) ? 1 : 0) << 0;
eax = dx & 0xF;
dx *= 4;
eax *= 4096;
dx += eax;
if (dx < eax) {
dx += 0x1000;
}
dx /= 4;
dx += 0xA000;
peep->name_string_idx = dx;
}
/**