void SpawnShell::updateSpawns(const mobUpdateStruct* updates) { // if zoning, then don't do anything if (m_zoneMgr->isZoning()) return; for (int a = 0; a < updates->numUpdates; a++) { // I have done some checking. It appears that this feild // (animation) contains the curent animation loop of the mob // in question (walking/running/standing etc.. // 0 = staning. When this is 0 the mob stops moving in the game // even though the velocity numbers arent 0. this fix should reduce // drift when a mob stops moving. (or turns) updateSpawn(updates->spawnUpdate[a].spawnId, updates->spawnUpdate[a].x, updates->spawnUpdate[a].y, updates->spawnUpdate[a].z, updates->spawnUpdate[a].deltaX, updates->spawnUpdate[a].deltaY, updates->spawnUpdate[a].deltaZ, updates->spawnUpdate[a].heading, updates->spawnUpdate[a].deltaHeading, updates->spawnUpdate[a].animation); } }
void SpawnShell::playerUpdate(const playerPosStruct *pupdate, uint32_t, uint8_t dir) { // if zoning, then don't do anything if (m_zoneMgr->isZoning()) return; if ((dir != DIR_CLIENT) && (pupdate->spawnId != m_player->id())) // PC Corpse Movement { updateSpawn(pupdate->spawnId, pupdate->x, pupdate->y, pupdate->z, 0, 0, 0, pupdate->heading, 0, 0); } }
void SpawnShell::playerUpdate(const playerSpawnPosStruct *pupdate, uint32_t, uint8_t dir) { // if zoning, then don't do anything if (m_zoneMgr->isZoning()) return; if ((dir != DIR_CLIENT) && (pupdate->spawnId != m_player->id())) // PC Corpse Movement { int16_t y = pupdate->y >> 3; int16_t x = pupdate->x >> 3; int16_t z = pupdate->z >> 3; int16_t dy = pupdate->deltaY >> 2; int16_t dx = pupdate->deltaX >> 2; int16_t dz = pupdate->deltaZ >> 2; updateSpawn(pupdate->spawnId, x, y, z, dx, dy, dz, pupdate->heading, pupdate->deltaHeading,pupdate->animation); if (pupdate->spawnId==1193) printf("Spawn(%d) moved by dx=%d dy=%d dz=%d heading=%d delhead=%d animation=%d\n",pupdate->spawnId,dx,dy,dz,pupdate->heading,pupdate->deltaHeading,pupdate->animation); }
void SpawnShell::playerUpdate(const uint8_t* data, size_t, uint8_t dir) { // if zoning, then don't do anything if (m_zoneMgr->isZoning()) return; const playerSpawnPosStruct *pupdate = (const playerSpawnPosStruct *)data; if ((dir != DIR_Client) && (pupdate->spawnId != m_player->id())) // PC Corpse Movement { int16_t y = pupdate->y >> 3; int16_t x = pupdate->x >> 3; int16_t z = pupdate->z >> 3; int16_t dy = pupdate->deltaY >> 2; int16_t dx = pupdate->deltaX >> 2; int16_t dz = pupdate->deltaZ >> 2; updateSpawn(pupdate->spawnId, x, y, z, dx, dy, dz, pupdate->heading, pupdate->deltaHeading,pupdate->animation); }
void SpawnShell::playerUpdate(const uint8_t* data, size_t len, uint8_t dir) { // if zoning, then don't do anything if (m_zoneMgr->isZoning()) return; #if 0 // Dump position updates for debugging client update changes for (int i=0; i<len; i++) { printf("%.2x", data[i]); if ((i+1) % 8 == 0) { printf(" "); } else { printf(" "); } } printf("\n"); #endif const playerSpawnPosStruct *pupdate = (const playerSpawnPosStruct *)data; if ((dir != DIR_Client) && (pupdate->spawnId != m_player->id())) // PC Corpse Movement { int16_t y = pupdate->y >> 3; int16_t x = pupdate->x >> 3; int16_t z = pupdate->z >> 3; int16_t dy = pupdate->deltaY >> 2; int16_t dx = pupdate->deltaX >> 2; int16_t dz = pupdate->deltaZ >> 2; #if 0 // Debug positioning without having to recompile everything... #pragma pack(1) struct pos { /*0000*/ uint16_t spawnId; // spawn id of the thing moving /*0002*/ signed deltaHeading:10; // change in heading signed x:19; // x coord signed padding0002:3; // ***Placeholder /*0006*/ signed y:19; // y coord signed animation:10; // ***Placeholder (seems like speed) signed padding0006:3; // animation /*0010*/ signed z:19; // z coord signed deltaY:13; // change in y /*0014*/ signed deltaX:13; // change in x unsigned heading:12; // heading signed padding0014:7; // ***Placeholder /*0018*/ signed deltaZ:13; // change in z signed padding0018:19; // ***Placeholder /*0022*/ }; #pragma pack(0) struct pos *p = (struct pos *)data; printf("[%.2x](%f, %f, %f), dx %f dy %f dz %f head %f dhead %f anim %d (%x, %x, %x, %x)\n", p->spawnId, float(p->x)/8.0, float(p->y/8.0), float(p->z)/8.0, float(p->deltaX)/4.0, float(p->deltaY)/4.0, float(p->deltaZ)/4.0, float(p->heading), float(p->deltaHeading), p->animation, p->padding0002, p->padding0006, p->padding0014, p->padding0018); #endif updateSpawn(pupdate->spawnId, x, y, z, dx, dy, dz, pupdate->heading, pupdate->deltaHeading,pupdate->animation); }