|
From: Chad M. <cmm...@us...> - 2006-11-04 17:44:12
|
Update of /cvsroot/seq/showeq/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv3140/src Modified Files: interface.cpp itemdbtool.cpp main.cpp map.cpp player.cpp player.h spawn.cpp spawn.h spawnshell.cpp spawnshell.h spellshell.cpp Log Message: Release 5.6.1. Better handle hover mode death Process ZoneEntry for auras as a newSpawn. Index: player.h =================================================================== RCS file: /cvsroot/seq/showeq/src/player.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- player.h 30 Sep 2006 21:18:25 -0000 1.25 +++ player.h 4 Nov 2006 17:44:08 -0000 1.26 @@ -96,6 +96,8 @@ uint16_t defaultRace() const { return m_defaultRace; } uint8_t defaultClass() const { return m_defaultClass; } + virtual void killSpawn(); + // ZBTEMP: compatibility code uint16_t getPlayerID() const { return id(); } int16_t headingDegrees() const { return m_headingDegrees; } Index: main.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/main.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- main.cpp 5 Oct 2005 15:29:08 -0000 1.35 +++ main.cpp 4 Nov 2006 17:44:07 -0000 1.36 @@ -13,6 +13,11 @@ #ifdef __linux__ #include <linux/version.h> + +// Newer kernel versions put this in utsversion +#ifndef UTS_RELEASE +#include <linux/utsversion.h> +#endif #endif #include <sys/utsname.h> Index: spawnshell.h =================================================================== RCS file: /cvsroot/seq/showeq/src/spawnshell.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- spawnshell.h 30 Sep 2006 21:18:25 -0000 1.24 +++ spawnshell.h 4 Nov 2006 17:44:08 -0000 1.25 @@ -103,6 +103,7 @@ void newDoorSpawns(const uint8_t*, size_t, uint8_t); void newDoorSpawn(const doorStruct&, size_t, uint8_t); void zoneSpawns(const uint8_t* zspawns, size_t len); + void zoneEntry(const uint8_t* spawn); void newSpawn(const uint8_t* spawn); void newSpawn(const spawnStruct& s); void playerUpdate(const uint8_t*pupdate, size_t, uint8_t); @@ -123,6 +124,7 @@ void consMessage(const uint8_t* con, size_t, uint8_t); void deleteSpawn(const uint8_t* delspawn); void killSpawn(const uint8_t* deadspawn); + void respawnFromHover(const uint8_t* respawn); void corpseLoc(const uint8_t* corpseLoc); void playerChangedID(uint16_t playerID); Index: spawn.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/spawn.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- spawn.cpp 30 Sep 2006 21:18:25 -0000 1.34 +++ spawn.cpp 4 Nov 2006 17:44:08 -0000 1.35 @@ -351,38 +351,37 @@ setConsidered(false); } -Spawn::Spawn(Spawn& s, uint16_t id) - : Item(tSpawn, id) +Spawn::Spawn(Spawn* s, uint16_t id) : Item(tSpawn, id) { - setName(s.name()); - setLastName(s.lastName()); - Item::setPoint(s.x(), s.y(), s.z()); - setPetOwnerID(s.petOwnerID()); - setLight(s.light()); - setGender(s.gender()); - setDeity(s.deity()); - setRace(s.race()); - setClassVal(s.classVal()); - setHP(s.HP()); - setMaxHP(s.maxHP()); - setGuildID(s.guildID()); - setLevel(s.level()); - for (int i = 0; i <= tLastCoreWearSlot; i++) - setEquipment(i, s.equipment(i)); - setEquipment(tUnknown1, SlotEmpty); - setTypeflag(s.typeflag()); - setGM(s.gm()); - setNPC(s.NPC()); - setAnimation(s.animation()); - setDeltas(s.deltaX(), s.deltaY(), s.deltaZ()); - setHeading(s.heading(), s.deltaHeading()); - setConsidered(s.considered()); + setName(s->name()); + setLastName(s->lastName()); + Item::setPoint(s->x(), s->y(), s->z()); + setPetOwnerID(s->petOwnerID()); + setLight(s->light()); + setGender(s->gender()); + setDeity(s->deity()); + setRace(s->race()); + setClassVal(s->classVal()); + setHP(s->HP()); + setMaxHP(s->maxHP()); + setGuildID(s->guildID()); + setLevel(s->level()); + for (int i = 0; i <= tLastCoreWearSlot; i++) + setEquipment(i, s->equipment(i)); + setEquipment(tUnknown1, SlotEmpty); + setTypeflag(s->typeflag()); + setGM(s->gm()); + setNPC(s->NPC()); + setAnimation(s->animation()); + setDeltas(s->deltaX(), s->deltaY(), s->deltaZ()); + setHeading(s->heading(), s->deltaHeading()); + setConsidered(s->considered()); - // the new copy will own the spawn track list - m_spawnTrackList.setAutoDelete(false); - m_spawnTrackList = s.m_spawnTrackList; - s.m_spawnTrackList.setAutoDelete(false); - m_spawnTrackList.setAutoDelete(true); + // the new copy will own the spawn track list + m_spawnTrackList.setAutoDelete(false); + m_spawnTrackList = s->m_spawnTrackList; + s->m_spawnTrackList.setAutoDelete(false); + m_spawnTrackList.setAutoDelete(true); } Spawn::~Spawn() @@ -393,11 +392,8 @@ void Spawn::update(const spawnStruct* s) { - if (m_name.find(Spawn_Corpse_Designator) == -1) - { - setName(s->name); - setLastName(s->lastName); - } + setName(s->name); + setLastName(s->lastName); setPos(s->x >> 3, s->y >> 3, s->z >> 3); setPetOwnerID(s->petOwnerId); Index: spawn.h =================================================================== RCS file: /cvsroot/seq/showeq/src/spawn.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- spawn.h 30 Sep 2006 21:18:25 -0000 1.21 +++ spawn.h 4 Nov 2006 17:44:08 -0000 1.22 @@ -208,7 +208,7 @@ // restore spawn from QDataStream Spawn(QDataStream&, uint16_t id); - Spawn(Spawn&, uint16_t id); + Spawn(Spawn*, uint16_t id); virtual ~Spawn(); // save spawn to QDataStream @@ -297,7 +297,7 @@ void backfill(const spawnStruct* s); // change spawn state - void killSpawn(); + virtual void killSpawn(); // spawn specific set methods void setDeltas(int16_t deltaX, int16_t deltaY, int16_t deltaZ); Index: itemdbtool.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/itemdbtool.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- itemdbtool.cpp 13 Sep 2005 15:23:11 -0000 1.12 +++ itemdbtool.cpp 4 Nov 2006 17:44:07 -0000 1.13 @@ -7,6 +7,11 @@ #ifdef __linux__ #include <linux/version.h> + +// Newer kernel versions move this to utsversion.h +#ifndef UTS_RELEASE +#include <linux/utsversion.h> +#endif #endif #include <sys/utsname.h> Index: spellshell.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/spellshell.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- spellshell.cpp 2 Mar 2006 01:03:14 -0000 1.13 +++ spellshell.cpp 4 Nov 2006 17:44:08 -0000 1.14 @@ -468,28 +468,44 @@ void SpellShell::killSpawn(const Item* deceased) { - uint16_t id = deceased->id(); - SpellItem* spell; - - if (m_lastPlayerSpell && (m_lastPlayerSpell->targetId() == id)) - m_lastPlayerSpell = 0; + uint16_t id = deceased->id(); - QValueList<SpellItem*>::Iterator it = m_spellList.begin(); - while(it != m_spellList.end()) - { - spell = *it; - if (spell->targetId() == id) + if (id == m_player->id()) { - it = m_spellList.remove(it); - emit delSpell(spell); - delete spell; + // We're dead. No more buffs for us. + clear(); } else - ++it; - } + { + SpellItem* spell; + + if (m_lastPlayerSpell && (m_lastPlayerSpell->targetId() == id)) + { + m_lastPlayerSpell = 0; + } + + QValueList<SpellItem*>::Iterator it = m_spellList.begin(); + while(it != m_spellList.end()) + { + spell = *it; + if (spell->targetId() == id) + { + it = m_spellList.remove(it); + emit delSpell(spell); + delete spell; + } + else + { + ++it; + } + } + + if (m_spellList.count() == 0) + { + m_timer->stop(); + } + } - if (m_spellList.count() == 0) - m_timer->stop(); } void SpellShell::timeout() Index: map.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/map.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- map.cpp 18 Sep 2005 04:10:16 -0000 1.43 +++ map.cpp 4 Nov 2006 17:44:07 -0000 1.44 @@ -3037,14 +3037,12 @@ tmp.setPen (NoPen); tmp.setFont (m_param.font()); - if ((m_player->validPos()) || - ((!m_zoneMgr->isZoning()) && - (m_player->id() != 0))) + if (m_player->validPos() && !m_zoneMgr->isZoning() && m_player->id() != 0) { if (m_showPlayerBackground) paintPlayerBackground(m_param, tmp); - if (m_showPlayerView) + if (m_showPlayerView && ! m_player->isCorpse()) paintPlayerView(m_param, tmp); if (m_showPlayer) @@ -3186,12 +3184,28 @@ void Map::paintPlayer(MapParameters& param, QPainter& p) { #ifdef DEBUGMAP - seqDebug("Paint player position"); + seqDebug("Paint player position"); #endif - p.setPen(gray); - p.setBrush(white); - p.drawEllipse(m_param.playerXOffset() - 3, - m_param.playerYOffset() - 3, 6, 6); + + if (! m_player->isCorpse()) + { + // White dot for non-corpse + p.setPen(gray); + p.setBrush(white); + p.drawEllipse(m_param.playerXOffset() - 3, + m_param.playerYOffset() - 3, 6, 6); + } + else + { + // Corpse icon for a corpse. + MapIcon mapIcon = m_mapIcons->icon(tIconTypeSpawnPlayerCorpse); + + p.setPen(mapIcon.highlightPen()); + p.setBrush(mapIcon.highlightBrush()); + + m_mapIcons->paintItemIcon(param, p, mapIcon, m_player, + param.playerOffset()); + } } void Map::paintDrops(MapParameters& param, Index: player.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/player.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- player.cpp 11 Oct 2006 01:29:42 -0000 1.53 +++ player.cpp 4 Nov 2006 17:44:08 -0000 1.54 @@ -21,7 +21,7 @@ #include <qdatastream.h> -//#define DEBUG_PLAYER +#define DEBUG_PLAYER //---------------------------------------------------------------------- // constants @@ -192,6 +192,17 @@ updateLastChanged(); } +void Player::killSpawn() +{ +#ifdef DEBUG_PLAYER + seqDebug("Player: killSpawn()"); +#endif + // We're dead. No buffs for us. + + // Call our parent. + Spawn::killSpawn(); +} + void Player::setUseAutoDetectedSettings(bool enable) { m_useAutoDetectedSettings = enable; Index: interface.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/interface.cpp,v retrieving revision 1.76 retrieving revision 1.77 diff -u -d -r1.76 -r1.77 --- interface.cpp 30 Sep 2006 21:18:24 -0000 1.76 +++ interface.cpp 4 Nov 2006 17:44:07 -0000 1.77 @@ -1986,9 +1986,9 @@ m_packet->connect2("OP_NewSpawn", SP_Zone, DIR_Server, "spawnStruct", SZC_Match, m_spawnShell, SLOT(newSpawn(const uint8_t*))); -// m_packet->connect2("OP_ZoneEntry", SP_Zone, DIR_Server, -// "ServerZoneEntryStruct", SZC_Match, -// m_spawnShell, SLOT(newSpawn(const uint8_t*))); + m_packet->connect2("OP_ZoneEntry", SP_Zone, DIR_Server, + "ServerZoneEntryStruct", SZC_Match, + m_spawnShell, SLOT(zoneEntry(const uint8_t*))); m_packet->connect2("OP_MobUpdate", SP_Zone, DIR_Server|DIR_Client, "spawnPositionUpdate", SZC_Match, m_spawnShell, SLOT(updateSpawns(const uint8_t*))); @@ -2013,6 +2013,9 @@ m_packet->connect2("OP_Death", SP_Zone, DIR_Server, "newCorpseStruct", SZC_Match, m_spawnShell, SLOT(killSpawn(const uint8_t*))); + m_packet->connect2("OP_RespawnFromHover", SP_Zone, DIR_Server, + "uint8_t", SZC_None, + m_spawnShell, SLOT(respawnFromHover(const uint8_t*))); m_packet->connect2("OP_Shroud", SP_Zone, DIR_Server, "spawnShroudSelf", SZC_None, m_spawnShell, SLOT(shroudSpawn(const uint8_t*, size_t, uint8_t))); Index: spawnshell.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/spawnshell.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- spawnshell.cpp 30 Sep 2006 21:18:25 -0000 1.48 +++ spawnshell.cpp 4 Nov 2006 17:44:08 -0000 1.49 @@ -481,6 +481,32 @@ } } +void SpawnShell::zoneEntry(const uint8_t* data) +{ + const spawnStruct* spawn = (const spawnStruct*)data; + +#ifdef SPAWNSHELL_DIAG + seqDebug("SpawnShell::zoneEntry(spawnStruct *(name='%s'))", spawn->name); +#endif + + // Zone Entry. This is a semi-filled in spawnStruct that we + // see for ourself when entering a zone. We also get sent this + // when shrouding and when respawning from corpse hover mode. Auras + // also get sent this sometimes. + if (spawn->NPC == 0) + { + // Align the player instance with these values + m_player->update(spawn); + + emit changeItem(m_player, tSpawnChangedALL); + } + else + { + // Auras. + newSpawn(data); + } +} + void SpawnShell::newSpawn(const uint8_t* data) { // if zoning, then don't do anything @@ -589,8 +615,7 @@ const playerSpawnPosStruct *pupdate = (const playerSpawnPosStruct *)data; - if ((dir != DIR_Client) && - (pupdate->spawnId != m_player->id())) // PC Corpse Movement + if (dir != DIR_Client) { int16_t y = pupdate->y >> 3; int16_t x = pupdate->x >> 3; @@ -757,63 +782,77 @@ uint8_t animation) { #ifdef SPAWNSHELL_DIAG - seqDebug("SpawnShell::updateSpawn(id=%d, x=%d, y=%d, z=%d, xVel=%d, yVel=%d, zVel=%d)", id, x, y, z, xVel, yVel, zVel); + seqDebug("SpawnShell::updateSpawn(id=%d, x=%d, y=%d, z=%d, xVel=%d, yVel=%d, zVel=%d)", + id, x, y, z, xVel, yVel, zVel); #endif - Item* item = m_spawns.find(id); + Item* item; + + if (id == m_player->id()) + { + item = m_player; + } + else + { + item = m_spawns.find(id); + } - if (item != NULL) - { - Spawn* spawn = (Spawn*)item; + if (item != NULL) + { + Spawn* spawn = (Spawn*)item; - spawn->setPos(x, y, z, - showeq_params->walkpathrecord, - showeq_params->walkpathlength); - spawn->setAnimation(animation); + spawn->setPos(x, y, z, + showeq_params->walkpathrecord, + showeq_params->walkpathlength); + spawn->setAnimation(animation); - spawn->setDeltas(xVel, yVel, zVel); - spawn->setHeading(heading, deltaHeading); + spawn->setDeltas(xVel, yVel, zVel); + spawn->setHeading(heading, deltaHeading); - // Distance - if (!showeq_params->fast_machine) - item->setDistanceToPlayer(m_player->calcDist2DInt(*item)); - else - item->setDistanceToPlayer(m_player->calcDist(*item)); + // Distance + if (!showeq_params->fast_machine) + item->setDistanceToPlayer(m_player->calcDist2DInt(*item)); + else + item->setDistanceToPlayer(m_player->calcDist(*item)); - spawn->updateLast(); - item->updateLastChanged(); - emit changeItem(item, tSpawnChangedPosition); - } - else if (showeq_params->createUnknownSpawns) - { - // not the player, so check if it's a recently deleted spawn - for (int i =0; i < m_cntDeadSpawnIDs; i++) - { - // check dead spawn list for spawnID, if it was deleted, shouldn't - // see new position updates, so therefore this is probably - // for a new spawn (spawn ID being reused) - if ((m_deadSpawnID[i] != 0) && (m_deadSpawnID[i] == id)) - { - // found a match, ignore it - m_deadSpawnID[i] = 0; + spawn->updateLast(); + item->updateLastChanged(); + emit changeItem(item, tSpawnChangedPosition); + } + else if (showeq_params->createUnknownSpawns) + { + // not the player, so check if it's a recently deleted spawn + for (int i =0; i < m_cntDeadSpawnIDs; i++) + { + // check dead spawn list for spawnID, if it was deleted, shouldn't + // see new position updates, so therefore this is probably + // for a new spawn (spawn ID being reused) + if ((m_deadSpawnID[i] != 0) && (m_deadSpawnID[i] == id)) + { + // found a match, ignore it + m_deadSpawnID[i] = 0; - seqInfo("(%d) had been removed from the zone, but saw a position update on it, so assuming bogus update.", - id); + seqInfo("(%d) had been removed from the zone, but saw a position update on it, so assuming bogus update.", + id); - return; - } - } + return; + } + } - item = new Spawn(id, x, y, z, xVel, yVel, zVel, - heading, deltaHeading, animation); - updateFilterFlags(item); - updateRuntimeFilterFlags(item); - m_spawns.insert(id, item); - emit addItem(item); + item = new Spawn(id, x, y, z, xVel, yVel, zVel, + heading, deltaHeading, animation); + updateFilterFlags(item); + updateRuntimeFilterFlags(item); + m_spawns.insert(id, item); + emit addItem(item); - // send notification of new spawn count - emit numSpawns(m_spawns.count()); - } +#ifdef SPAWNSHELL_DIAG + seqDebug("SpawnShell::updateSpawn created unknown spawn (id=%u)", id); +#endif + + // send notification of new spawn count + emit numSpawns(m_spawns.count()); + } } void SpawnShell::updateSpawns(const uint8_t* data) @@ -1099,7 +1138,15 @@ #endif Item* item; - item = m_spawns.find(deadspawn->spawnId); + if (deadspawn->spawnId != m_player->id()) + { + item = m_spawns.find(deadspawn->spawnId); + } + else + { + item = m_player; + } + if (item != NULL) { Spawn* spawn = (Spawn*)item; @@ -1119,6 +1166,43 @@ } } +void SpawnShell::respawnFromHover(const uint8_t* data) +{ +#ifdef SPAWNSHELL_DIAG + seqDebug("SpawnShell::respawnFromHover()"); +#endif + + // Our old player is a corpse, but we're rising from the dead. So + // we need to pop a corpse to represent our deadselves, invalidate + // the player, and then let the OP_ZoneEntry that is coming for the repop + // fix the player. + uint16_t corpseId = m_player->id(); + + // invalidate the player by severing it from its Id. + m_player->setID(0); + + // Pop a corpse + Spawn* corpse = new Spawn((Spawn*) m_player, corpseId); + + updateFilterFlags(corpse); + updateRuntimeFilterFlags(corpse); + m_spawns.insert(corpse->id(), corpse); + + if (corpse->guildID() < MAX_GUILDS) + { + corpse->setGuildTag(m_guildMgr->guildIdToName(corpse->guildID())); + } + else + { + corpse->setGuildTag(""); + } + + emit addItem(corpse); + + // send notification of new spawn count + emit numSpawns(m_spawns.count()); +} + void SpawnShell::corpseLoc(const uint8_t* data) { const corpseLocStruct* corpseLoc = (const corpseLocStruct*)data; |