diff --git a/Source/debug.cpp b/Source/debug.cpp index fafded43..4055572e 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -57,7 +57,6 @@ enum class DebugGridTextItem : uint16_t { DebugGridTextItem SelectedDebugGridTextItem; -int DebugPlayerId; int DebugMonsterId; // Used for debugging level generation @@ -670,6 +669,24 @@ std::string DebugCmdQuestInfo(const string_view parameter) return fmt::format("\nQuest: {}\nActive: {} Var1: {} Var2: {}", QuestsData[quest._qidx]._qlstr, quest._qactive, quest._qvar1, quest._qvar2); } +std::string DebugCmdPlayerInfo(const string_view parameter) +{ + int playerId = atoi(parameter.data()); + if (playerId < 0 || playerId >= MAX_PLRS) + return "My friend, we need a valid playerId."; + auto &player = Players[playerId]; + if (!player.plractive) + return "Player is not active"; + + const Point target = player.GetTargetPosition(); + return fmt::format("Plr {} is {}\nLvl: {} Changing: {}\nTile.x: {} Tile.y: {} Target.x: {} Target.y: {}\nMode: {} destAction: {} walkpath[0]: {}\nInvincible:{} HitPoints:{}", + playerId, player._pName, + player.plrlevel, player._pLvlChanging, + player.position.tile.x, player.position.tile.y, target.x, target.y, + player._pmode, player.destAction, player.walkpath[0], + player._pInvincible ? 1 : 0, player._pHitPoints); +} + std::vector DebugCmdList = { { "help", "Prints help overview or help for a specific command.", "({command})", &DebugCmdHelp }, { "give gold", "Fills the inventory with gold.", "", &DebugCmdGiveGoldCheat }, @@ -698,6 +715,7 @@ std::vector DebugCmdList = { { "scrollview", "Toggles scroll view feature (with shift+mouse).", "", &DebugCmdScrollView }, { "iteminfo", "Shows info of currently selected item.", "", &DebugCmdItemInfo }, { "questinfo", "Shows info of quests.", "{id}", &DebugCmdQuestInfo }, + { "playerinfo", "Shows info of player.", "{playerid}", &DebugCmdPlayerInfo }, }; } // namespace @@ -712,33 +730,6 @@ void FreeDebugGFX() pSquareCel = std::nullopt; } -void PrintDebugPlayer(bool bNextPlayer) -{ - char dstr[128]; - - if (bNextPlayer) - DebugPlayerId = ((BYTE)DebugPlayerId + 1) & 3; - - auto &player = Players[DebugPlayerId]; - - sprintf(dstr, "Plr %i : Active = %i", DebugPlayerId, player.plractive ? 1 : 0); - NetSendCmdString(1 << MyPlayerId, dstr); - - if (player.plractive) { - sprintf(dstr, " Plr %i is %s", DebugPlayerId, player._pName); - NetSendCmdString(1 << MyPlayerId, dstr); - sprintf(dstr, " Lvl = %i : Change = %i", player.plrlevel, player._pLvlChanging ? 1 : 0); - NetSendCmdString(1 << MyPlayerId, dstr); - const Point target = player.GetTargetPosition(); - sprintf(dstr, " x = %i, y = %i : tx = %i, ty = %i", player.position.tile.x, player.position.tile.y, target.x, target.y); - NetSendCmdString(1 << MyPlayerId, dstr); - sprintf(dstr, " mode = %i : daction = %i : walk[0] = %i", player._pmode, player.destAction, player.walkpath[0]); - NetSendCmdString(1 << MyPlayerId, dstr); - sprintf(dstr, " inv = %i : hp = %i", player._pInvincible ? 1 : 0, player._pHitPoints); - NetSendCmdString(1 << MyPlayerId, dstr); - } -} - void GetDebugMonster() { int mi1 = pcursmonst; diff --git a/Source/debug.h b/Source/debug.h index b48c2492..84997cc4 100644 --- a/Source/debug.h +++ b/Source/debug.h @@ -25,7 +25,6 @@ extern bool DebugScrollViewEnabled; void FreeDebugGFX(); void LoadDebugGFX(); -void PrintDebugPlayer(bool bNextPlayer); void GetDebugMonster(); void NextDebugMonster(); void SetDebugLevelSeedInfos(uint32_t mid1Seed, uint32_t mid2Seed, uint32_t mid3Seed, uint32_t endSeed); diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 259a8bfb..c071716c 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -569,12 +569,6 @@ void PressChar(char vkey) } return; #ifdef _DEBUG - case 'D': - PrintDebugPlayer(true); - return; - case 'd': - PrintDebugPlayer(false); - return; case 'M': NextDebugMonster(); return;