Browse Source

clang-format all files in {Source,test}/

Also includes a few manual tweaks to comments and newlines for better results.

Co-authored-by: Anders Jenbo <anders@jenbo.dk>
pull/3607/head
Gleb Mazovetskiy 4 years ago committed by Anders Jenbo
parent
commit
7e1fea6f76
  1. 2
      Source/DiabloUI/art.cpp
  2. 2
      Source/DiabloUI/art_draw.cpp
  3. 2
      Source/DiabloUI/button.cpp
  4. 2
      Source/DiabloUI/diabloui.cpp
  5. 4
      Source/DiabloUI/diabloui.h
  6. 4
      Source/DiabloUI/mainmenu.cpp
  7. 2
      Source/DiabloUI/selok.cpp
  8. 2
      Source/DiabloUI/selstart.cpp
  9. 18
      Source/DiabloUI/ui_item.h
  10. 2
      Source/appfat.cpp
  11. 2
      Source/control.h
  12. 2
      Source/controls/devices/game_controller.cpp
  13. 2
      Source/controls/devices/joystick.h
  14. 2
      Source/controls/devices/kbcontroller.h
  15. 2
      Source/controls/game_controls.cpp
  16. 4
      Source/controls/game_controls.h
  17. 4
      Source/controls/keymapper.hpp
  18. 2
      Source/controls/plrctrls.cpp
  19. 2
      Source/controls/touch/renderers.cpp
  20. 2
      Source/dead.h
  21. 4
      Source/debug.cpp
  22. 4
      Source/drlg_l2.cpp
  23. 2
      Source/drlg_l4.cpp
  24. 1
      Source/dthread.h
  25. 8
      Source/dvlnet/base_protocol.h
  26. 2
      Source/dvlnet/frame_queue.h
  27. 7
      Source/dvlnet/packet.h
  28. 10
      Source/dvlnet/protocol_zt.h
  29. 7
      Source/dvlnet/tcp_client.h
  30. 11
      Source/dvlnet/tcp_server.h
  31. 2
      Source/dvlnet/zerotier_lwip.h
  32. 4
      Source/dvlnet/zerotier_native.cpp
  33. 2
      Source/dx.cpp
  34. 2
      Source/encrypt.cpp
  35. 2
      Source/engine/animationinfo.h
  36. 8
      Source/engine/demomode.cpp
  37. 6
      Source/engine/direction.hpp
  38. 6
      Source/engine/point.hpp
  39. 2
      Source/engine/render/cel_render.hpp
  40. 2
      Source/engine/render/common_impl.h
  41. 4
      Source/engine/surface.hpp
  42. 4
      Source/init.cpp
  43. 26
      Source/inv.cpp
  44. 2
      Source/inv.h
  45. 2
      Source/items.h
  46. 10
      Source/loadsave.cpp
  47. 1
      Source/miniwin/miniwin.h
  48. 2
      Source/miniwin/misc_msg.cpp
  49. 4
      Source/misdat.cpp
  50. 14
      Source/misdat.h
  51. 24
      Source/missiles.h
  52. 2
      Source/monstdat.cpp
  53. 8
      Source/monster.h
  54. 2
      Source/mpq/mpq_writer.hpp
  55. 4
      Source/msg.cpp
  56. 2
      Source/nthread.cpp
  57. 6
      Source/objects.cpp
  58. 4
      Source/objects.h
  59. 2
      Source/pack.h
  60. 4
      Source/panels/charpanel.cpp
  61. 2
      Source/path.h
  62. 2
      Source/pfile.h
  63. 2
      Source/platform/ctr/asio/net/if.c
  64. 2
      Source/platform/ctr/asio/sys/socket.c
  65. 4
      Source/platform/ctr/asio/sys/uio.c
  66. 59
      Source/platform/ctr/messagebox.cpp
  67. 4
      Source/platform/ctr/random.cpp
  68. 136
      Source/platform/ctr/sockets.cpp
  69. 2
      Source/platform/ctr/system.cpp
  70. 2
      Source/platform/switch/asio/net/if.c
  71. 2
      Source/platform/switch/asio/sys/signal.c
  72. 2
      Source/platform/switch/docking.cpp
  73. 7
      Source/platform/switch/keyboard.cpp
  74. 4
      Source/platform/switch/network.cpp
  75. 111
      Source/platform/switch/random.cpp
  76. 5
      Source/platform/vita/keyboard.cpp
  77. 8
      Source/platform/vita/network.cpp
  78. 4
      Source/platform/vita/random.cpp
  79. 12
      Source/player.h
  80. 8
      Source/qol/autopickup.cpp
  81. 8
      Source/qol/autopickup.h
  82. 8
      Source/qol/common.cpp
  83. 8
      Source/qol/common.h
  84. 8
      Source/qol/itemlabels.h
  85. 8
      Source/qol/monhealthbar.cpp
  86. 8
      Source/qol/monhealthbar.h
  87. 8
      Source/qol/xpbar.cpp
  88. 8
      Source/qol/xpbar.h
  89. 2
      Source/quests.h
  90. 2
      Source/scrollrt.cpp
  91. 1
      Source/sha.cpp
  92. 2
      Source/sound.cpp
  93. 2
      Source/sound.h
  94. 2
      Source/storm/storm_net.hpp
  95. 14
      Source/storm/storm_svid.cpp
  96. 6
      Source/town.h
  97. 2
      Source/towners.h
  98. 2
      Source/utils/file_util.cpp
  99. 2
      Source/utils/file_util.h
  100. 2
      Source/utils/language.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

2
Source/DiabloUI/art.cpp

@ -7,9 +7,9 @@
#include "engine/assets.hpp"
#include "utils/display.h"
#include "utils/log.hpp"
#include "utils/pcx.hpp"
#include "utils/sdl_compat.h"
#include "utils/sdl_wrap.h"
#include "utils/pcx.hpp"
namespace devilution {
namespace {

2
Source/DiabloUI/art_draw.cpp

@ -1,9 +1,9 @@
#include "DiabloUI/art_draw.h"
#include "DiabloUI/diabloui.h"
#include "palette.h"
#include "utils/display.h"
#include "utils/sdl_compat.h"
#include "palette.h"
namespace devilution {

2
Source/DiabloUI/button.cpp

@ -1,5 +1,5 @@
#include "DiabloUI/art_draw.h"
#include "DiabloUI/button.h"
#include "DiabloUI/art_draw.h"
#include "DiabloUI/diabloui.h"
#include "DiabloUI/errorart.h"
#include "engine/render/text_render.hpp"

2
Source/DiabloUI/diabloui.cpp

@ -3,9 +3,9 @@
#include <algorithm>
#include <string>
#ifdef USE_SDL1
#include <cassert>
#include <codecvt>
#include <locale>
#include <cassert>
#endif
#include "DiabloUI/art_draw.h"

4
Source/DiabloUI/diabloui.h

@ -1,9 +1,9 @@
#pragma once
#include <cstdint>
#include <SDL.h>
#include <array>
#include <cstddef>
#include <SDL.h>
#include <cstdint>
#include "DiabloUI/art.h"
#include "DiabloUI/ui_item.h"

4
Source/DiabloUI/mainmenu.cpp

@ -1,12 +1,12 @@
#include "control.h"
#include "DiabloUI/diabloui.h"
#include "DiabloUI/selok.h"
#include "control.h"
#include "utils/language.h"
namespace devilution {
namespace {
int mainmenu_attract_time_out; //seconds
int mainmenu_attract_time_out; // seconds
uint32_t dwAttractTicks;
std::vector<std::unique_ptr<UiItemBase>> vecMainMenuDialog;

2
Source/DiabloUI/selok.cpp

@ -2,8 +2,8 @@
#include "DiabloUI/diabloui.h"
#include "control.h"
#include "utils/language.h"
#include "engine/render/text_render.hpp"
#include "utils/language.h"
namespace devilution {

2
Source/DiabloUI/selstart.cpp

@ -1,7 +1,7 @@
#include "selstart.h"
#include "control.h"
#include "DiabloUI/diabloui.h"
#include "control.h"
#include "options.h"
#include "utils/language.h"

18
Source/DiabloUI/ui_item.h

@ -105,7 +105,7 @@ public:
m_iFlags &= ~flag;
}
//protected:
// protected:
UiType m_type;
SDL_Rect m_rect;
UiFlags m_iFlags;
@ -125,7 +125,7 @@ public:
~UiImage() {};
//private:
// private:
Art *m_art;
bool m_animated;
int m_frame;
@ -201,7 +201,7 @@ public:
{
}
//private:
// private:
Art *m_bg;
Art *m_thumb;
Art *m_arrow;
@ -218,7 +218,7 @@ public:
{
}
//private:
// private:
const char *m_text;
void (*m_action)();
};
@ -236,7 +236,7 @@ public:
{
}
//private:
// private:
const char *m_hint;
char *m_value;
std::size_t m_max_length;
@ -255,7 +255,7 @@ public:
{
}
//private:
// private:
const char *m_text;
};
@ -279,7 +279,7 @@ public:
PRESSED,
};
//private:
// private:
Art *m_art;
const char *m_text;
@ -302,7 +302,7 @@ public:
~UiListItem() {};
//private:
// private:
const char *m_text;
int m_value;
UiFlags uiFlags;
@ -355,7 +355,7 @@ public:
return m_spacing;
}
//private:
// private:
Sint16 m_x, m_y;
Uint16 m_width, m_height;
std::vector<UiListItem *> m_vecItems;

2
Source/appfat.cpp

@ -9,8 +9,8 @@
#include <fmt/format.h>
#include "diablo.h"
#include "storm/storm_net.hpp"
#include "multi.h"
#include "storm/storm_net.hpp"
#include "utils/language.h"
#include "utils/sdl_thread.h"
#include "utils/ui_fwd.h"

2
Source/control.h

@ -133,7 +133,7 @@ void DoSpeedBook();
/**
* Clears panel button flags.
*/
*/
void ClearPanBtn();
/**

2
Source/controls/devices/game_controller.cpp

@ -7,8 +7,8 @@
#include "controls/controller_motion.h"
#include "controls/devices/joystick.h"
#include "utils/log.hpp"
#include "utils/sdl_ptrs.h"
#include "utils/sdl2_backports.h"
#include "utils/sdl_ptrs.h"
#include "utils/stubs.h"
namespace devilution {

2
Source/controls/devices/joystick.h

@ -9,8 +9,8 @@
#include "utils/sdl2_to_1_2_backports.h"
#endif
#include "controls/controller_buttons.h"
#include "controls/controller.h"
#include "controls/controller_buttons.h"
namespace devilution {

2
Source/controls/devices/kbcontroller.h

@ -6,8 +6,8 @@
#endif
#if HAS_KBCTRL == 1
#include <SDL.h>
#include "controls/controller_buttons.h"
#include <SDL.h>
namespace devilution {

2
Source/controls/game_controls.cpp

@ -277,7 +277,7 @@ bool GetGameAction(const SDL_Event &event, ControllerButtonEvent ctrlEvent, Game
CalcViewportGeometry();
}
#else
// Not mapped. Reserved for future use.
/* Not mapped. Reserved for future use. */
#endif
return true;
case ControllerButton_BUTTON_B: // Right button

4
Source/controls/game_controls.h

@ -1,10 +1,10 @@
#pragma once
#include <cstdint>
#include <SDL.h>
#include <cstdint>
#include "controls/controller.h"
#include "./axis_direction.h"
#include "controls/controller.h"
namespace devilution {

4
Source/controls/keymapper.hpp

@ -1,10 +1,10 @@
#pragma once
#include <cstddef>
#include <string>
#include <functional>
#include <vector>
#include <string>
#include <unordered_map>
#include <vector>
namespace devilution {

2
Source/controls/plrctrls.cpp

@ -647,7 +647,7 @@ Size GetItemSizeOnSlot(int slot)
/**
* Search for the first slot occupied by an item in the inventory.
*/
*/
int FindFirstSlotOnItem(int8_t itemInvId)
{
if (itemInvId == 0)

2
Source/controls/touch/renderers.cpp

@ -1,5 +1,5 @@
#include "control.h"
#include "controls/touch/renderers.h"
#include "control.h"
#include "cursor.h"
#include "diablo.h"
#include "doom.h"

2
Source/dead.h

@ -8,8 +8,8 @@
#include <array>
#include <cstdint>
#include "engine/point.hpp"
#include "engine.h"
#include "engine/point.hpp"
namespace devilution {

4
Source/debug.cpp

@ -20,11 +20,11 @@
#include "lighting.h"
#include "monstdat.h"
#include "monster.h"
#include "quests.h"
#include "setmaps.h"
#include "spells.h"
#include "towners.h"
#include "utils/language.h"
#include "quests.h"
namespace devilution {
@ -57,7 +57,7 @@ enum class DebugGridTextItem : uint16_t {
cursorcoords,
objectindex,
//take dPiece as index
// take dPiece as index
nBlockTable,
nSolidTable,
nTransTable,

4
Source/drlg_l2.cpp

@ -11,11 +11,11 @@
#include "diablo.h"
#include "engine/load_file.hpp"
#include "engine/random.hpp"
#include "engine/size.hpp"
#include "gendung.h"
#include "player.h"
#include "quests.h"
#include "setmaps.h"
#include "engine/size.hpp"
namespace devilution {
@ -37,7 +37,7 @@ int Room_Min = 4;
const int DirXadd[5] = { 0, 0, 1, 0, -1 };
const int DirYadd[5] = { 0, -1, 0, 1, 0 };
const ShadowStruct SPATSL2[2] = { { 6, 3, 0, 3, 48, 0, 50 }, { 9, 3, 0, 3, 48, 0, 50 } };
//short word_48489A = 0;
// short word_48489A = 0;
const BYTE BTYPESL2[161] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 17, 18, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const BYTE BSTYPESL2[161] = { 0, 1, 2, 3, 0, 0, 6, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 6, 6, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 6, 2, 2, 2, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 3, 1, 1, 3, 3, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

2
Source/drlg_l4.cpp

@ -34,7 +34,7 @@ int SP4x2;
int SP4y2;
BYTE L4dungeon[80][80];
BYTE dung[20][20];
//int dword_52A4DC;
// int dword_52A4DC;
/**
* A lookup table for the 16 possible patterns of a 2x2 area,

1
Source/dthread.h

@ -6,6 +6,7 @@
#pragma once
#include <memory>
#include "utils/stdcompat/cstddef.hpp"
namespace devilution {

8
Source/dvlnet/base_protocol.h

@ -1,9 +1,9 @@
#pragma once
#include <string>
#include <set>
#include <map>
#include <memory>
#include <set>
#include <string>
#include "dvlnet/base.h"
#include "dvlnet/packet.h"
@ -209,7 +209,7 @@ void base_protocol<P>::handle_join_request(packet &pkt, endpoint sender)
}
}
if (i >= MAX_PLRS) {
//already full
// already full
return;
}
for (plr_t j = 0; j < MAX_PLRS; ++j) {
@ -268,7 +268,7 @@ void base_protocol<P>::recv_ingame(packet &pkt, endpoint sender)
connected_table[pkt.Source()] = true;
peers[pkt.Source()] = sender;
if (pkt.Destination() != plr_self && pkt.Destination() != PLR_BROADCAST)
return; //packet not for us, drop
return; // packet not for us, drop
RecvLocal(pkt);
}

2
Source/dvlnet/frame_queue.h

@ -1,9 +1,9 @@
#pragma once
#include <cstdint>
#include <deque>
#include <exception>
#include <vector>
#include <cstdint>
namespace devilution {
namespace net {

7
Source/dvlnet/packet.h

@ -1,10 +1,11 @@
#pragma once
#include <cstdint>
#include <string>
#include <memory>
#include <array>
#include <cstdint>
#include <cstring>
#include <memory>
#include <string>
#ifdef PACKET_ENCRYPTION
#include <sodium.h>
#endif

10
Source/dvlnet/protocol_zt.h

@ -1,13 +1,13 @@
#pragma once
#include <string>
#include <set>
#include <algorithm>
#include <array>
#include <atomic>
#include <deque>
#include <map>
#include <exception>
#include <array>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include "dvlnet/frame_queue.h"

7
Source/dvlnet/tcp_client.h

@ -1,15 +1,16 @@
#pragma once
#include <string>
#include <memory>
#include <string>
#include <asio/ts/buffer.hpp>
#include <asio/ts/internet.hpp>
#include <asio/ts/io_context.hpp>
#include <asio/ts/net.hpp>
#include "dvlnet/packet.h"
#include "dvlnet/frame_queue.h"
#include "dvlnet/base.h"
#include "dvlnet/frame_queue.h"
#include "dvlnet/packet.h"
#include "dvlnet/tcp_server.h"
namespace devilution {

11
Source/dvlnet/tcp_server.h

@ -1,16 +1,17 @@
#pragma once
#include <string>
#include <memory>
#include <array>
#include <memory>
#include <string>
#include <asio/ts/buffer.hpp>
#include <asio/ts/internet.hpp>
#include <asio/ts/io_context.hpp>
#include <asio/ts/net.hpp>
#include "dvlnet/packet.h"
#include "dvlnet/abstract_net.h"
#include "dvlnet/frame_queue.h"
#include "dvlnet/packet.h"
#include "multi.h"
namespace devilution {
@ -76,5 +77,5 @@ private:
void DropConnection(const scc &con);
};
} //namespace net
} //namespace devilution
} // namespace net
} // namespace devilution

2
Source/dvlnet/zerotier_lwip.h

@ -1,3 +1,5 @@
#pragma once
namespace devilution {
namespace net {

4
Source/dvlnet/zerotier_native.cpp

@ -20,7 +20,7 @@
namespace devilution {
namespace net {
//static constexpr uint64_t zt_earth = 0x8056c2e21c000001;
// static constexpr uint64_t zt_earth = 0x8056c2e21c000001;
static constexpr uint64_t ZtNetwork = 0xa84ac5c10a7ebb5f;
static std::atomic_bool zt_network_ready(false);
@ -29,7 +29,7 @@ static std::atomic_bool zt_joined(false);
static void Callback(struct zts_callback_msg *msg)
{
//printf("callback %i\n", msg->eventCode);
// printf("callback %i\n", msg->eventCode);
if (msg->eventCode == ZTS_EVENT_NODE_ONLINE) {
Log("ZeroTier: ZTS_EVENT_NODE_ONLINE, nodeId={:x}", (unsigned long long)msg->node->address);
zt_node_online = true;

2
Source/dx.cpp

@ -308,7 +308,7 @@ void RenderPresent()
#ifndef USE_SDL1
if (renderer != nullptr) {
if (SDL_UpdateTexture(texture.get(), nullptr, surface->pixels, surface->pitch) <= -1) { //pitch is 2560
if (SDL_UpdateTexture(texture.get(), nullptr, surface->pixels, surface->pitch) <= -1) { // pitch is 2560
ErrSdl();
}

2
Source/encrypt.cpp

@ -4,9 +4,9 @@
* Implementation of functions for compression and decompressing MPQ data.
*/
#include <SDL.h>
#include <array>
#include <cctype>
#include <memory>
#include <array>
#include "encrypt.h"
#include "pkware.h"

2
Source/engine/animationinfo.h

@ -69,7 +69,7 @@ public:
/**
* @brief Calculates the progress of the current animation as a fraction (0.0f to 1.0f)
*/
*/
float GetAnimationProgress() const;
/**

8
Source/engine/demomode.cpp

@ -6,16 +6,16 @@
#include <deque>
#include <fstream>
#include <sstream>
#include <iostream>
#include <sstream>
#include "demomode.h"
#include "utils/display.h"
#include "utils/paths.h"
#include "menu.h"
#include "options.h"
#include "nthread.h"
#include "options.h"
#include "pfile.h"
#include "utils/display.h"
#include "utils/paths.h"
namespace devilution {

6
Source/engine/direction.hpp

@ -19,21 +19,21 @@ enum class Direction : std::uint8_t {
/** Maps from direction to a left turn from the direction. */
constexpr Direction Left(Direction facing)
{
//Direction left[8] = { Direction::SouthEast, Direction::South, Direction::SouthWest, Direction::West, Direction::NorthWest, Direction::North, Direction::NorthEast, Direction::East };
// Direction left[8] = { Direction::SouthEast, Direction::South, Direction::SouthWest, Direction::West, Direction::NorthWest, Direction::North, Direction::NorthEast, Direction::East };
return static_cast<Direction>((static_cast<std::underlying_type_t<Direction>>(facing) + 7) % 8);
}
/** Maps from direction to a right turn from the direction. */
constexpr Direction Right(Direction facing)
{
//Direction right[8] = { Direction::SouthWest, Direction::West, Direction::NorthWest, Direction::North, Direction::NorthEast, Direction::East, Direction::SouthEast, Direction::South };
// Direction right[8] = { Direction::SouthWest, Direction::West, Direction::NorthWest, Direction::North, Direction::NorthEast, Direction::East, Direction::SouthEast, Direction::South };
return static_cast<Direction>((static_cast<std::underlying_type_t<Direction>>(facing) + 1) % 8);
}
/** Maps from direction to the opposite direction. */
constexpr Direction Opposite(Direction facing)
{
//Direction opposite[8] = { Direction::North, Direction::NorthEast, Direction::East, Direction::SouthEast, Direction::South, Direction::SouthWest, Direction::West, Direction::NorthWest };
// Direction opposite[8] = { Direction::North, Direction::NorthEast, Direction::East, Direction::SouthEast, Direction::South, Direction::SouthWest, Direction::West, Direction::NorthWest };
return static_cast<Direction>((static_cast<std::underlying_type_t<Direction>>(facing) + 4) % 8);
}

6
Source/engine/point.hpp

@ -125,10 +125,10 @@ struct Point {
* In practice it is likely that ApproxDistance gives the same result, especially for nearby points.
* @param other Point to which we want the distance
* @return Exact magnitude of vector this -> other
*/
*/
int ExactDistance(Point other) const
{
auto vector = *this - other; //No need to call abs() as we square the values anyway
auto vector = *this - other; // No need to call abs() as we square the values anyway
// Casting multiplication operands to a wide type to address overflow warnings
return static_cast<int>(std::sqrt(static_cast<int64_t>(vector.deltaX) * vector.deltaX + static_cast<int64_t>(vector.deltaY) * vector.deltaY));
@ -159,7 +159,7 @@ struct Point {
* @param stream output stream, expected to have overloads for int and char*
* @param point Object to display
* @return the stream, to allow chaining
*/
*/
friend std::ostream &operator<<(std::ostream &stream, const Point &point)
{
return stream << "(x: " << point.x << ", y: " << point.y << ")";

2
Source/engine/render/cel_render.hpp

@ -8,9 +8,9 @@
#include <utility>
#include "engine.h"
#include "items.h"
#include "engine/cel_sprite.hpp"
#include "engine/point.hpp"
#include "items.h"
namespace devilution {

2
Source/engine/render/common_impl.h

@ -5,8 +5,8 @@
*/
#pragma once
#include <cstdint>
#include <cstddef>
#include <cstdint>
#include "engine.h"
#include "lighting.h"

4
Source/engine/surface.hpp

@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
#include <cstddef>
#include <cstdint>
#include <SDL_version.h>
@ -9,8 +9,8 @@
#include <SDL_rect.h>
#include <SDL_surface.h>
#else
#include <SDL_video.h>
#include "utils/sdl2_to_1_2_backports.h"
#include <SDL_video.h>
#endif
#include "engine/point.hpp"

4
Source/init.cpp

@ -14,10 +14,10 @@
#include "DiabloUI/diabloui.h"
#include "dx.h"
#include "options.h"
#include "pfile.h"
#include "engine/assets.hpp"
#include "mpq/mpq_reader.hpp"
#include "options.h"
#include "pfile.h"
#include "utils/language.h"
#include "utils/log.hpp"
#include "utils/paths.h"

26
Source/inv.cpp

@ -1207,22 +1207,22 @@ void DrawInv(const Surface &out)
CelDrawTo(out, GetPanelPosition(UiPanels::Inventory, { 0, 351 }), *pInvCels, 1);
Size slotSize[] = {
{ 2, 2 }, //head
{ 1, 1 }, //left ring
{ 1, 1 }, //right ring
{ 1, 1 }, //amulet
{ 2, 3 }, //left hand
{ 2, 3 }, //right hand
{ 2, 2 }, // head
{ 1, 1 }, // left ring
{ 1, 1 }, // right ring
{ 1, 1 }, // amulet
{ 2, 3 }, // left hand
{ 2, 3 }, // right hand
{ 2, 3 }, // chest
};
Point slotPos[] = {
{ 133, 59 }, //head
{ 48, 205 }, //left ring
{ 249, 205 }, //right ring
{ 205, 60 }, //amulet
{ 17, 160 }, //left hand
{ 248, 160 }, //right hand
{ 133, 59 }, // head
{ 48, 205 }, // left ring
{ 249, 205 }, // right ring
{ 205, 60 }, // amulet
{ 17, 160 }, // left hand
{ 248, 160 }, // right hand
{ 133, 160 }, // chest
};
@ -2084,7 +2084,7 @@ bool UseInvItem(int pnum, int cii)
item = &player.SpdList[c];
speedlist = true;
//If selected speedlist item exists in InvList, use the InvList item.
// If selected speedlist item exists in InvList, use the InvList item.
for (int i = 0; i < player._pNumInv && sgOptions.Gameplay.bAutoRefillBelt; i++) {
if (player.InvList[i]._iMiscId == item->_iMiscId && player.InvList[i]._iSpell == item->_iSpell) {
c = i;

2
Source/inv.h

@ -168,7 +168,7 @@ void AutoGetItem(int pnum, Item *item, int ii);
* @param idx The overarching type of the target item
* @param createInfo Flags used to describe the specific subtype of the target item
* @return An index into ActiveItems or -1 if no matching item was found
*/
*/
int FindGetItem(int32_t iseed, _item_indexes idx, uint16_t ci);
void SyncGetItem(Point position, int32_t iseed, _item_indexes idx, uint16_t ci);
bool CanPut(Point position);

2
Source/items.h

@ -8,9 +8,9 @@
#include <cstdint>
#include "DiabloUI/ui_item.h"
#include "engine.h"
#include "engine/animationinfo.h"
#include "engine/point.hpp"
#include "engine.h"
#include "itemdat.h"
#include "monster.h"
#include "utils/stdcompat/optional.hpp"

10
Source/loadsave.cpp

@ -23,9 +23,9 @@
#include "inv.h"
#include "lighting.h"
#include "missiles.h"
#include "mpq/mpq_writer.hpp"
#include "pfile.h"
#include "stores.h"
#include "mpq/mpq_writer.hpp"
#include "utils/endian.hpp"
#include "utils/language.h"
@ -890,7 +890,7 @@ void LoadMatchingItems(LoadHelper &file, const int n, Item *pItem)
* @param file interface to the save file
* @return a map converting from item indexes as recorded in the save file to the appropriate Items array index, used by LoadDroppedItemLocations
* @see LoadDroppedItemLocations
*/
*/
std::unordered_map<uint8_t, uint8_t> LoadDroppedItems(LoadHelper &file)
{
std::unordered_map<uint8_t, uint8_t> itemIndexes = { { 0, 0 } };
@ -915,7 +915,7 @@ std::unordered_map<uint8_t, uint8_t> LoadDroppedItems(LoadHelper &file)
* @brief Helper to initialise dItem based on runtime item indexes
* @param file interface to the save file
* @param indexMap a map converting from save file item indexes to the appropriate Items array index
*/
*/
void LoadDroppedItemLocations(LoadHelper &file, const std::unordered_map<uint8_t, uint8_t> &indexMap)
{
for (int j = 0; j < MAXDUNY; j++) {
@ -1506,7 +1506,7 @@ void SavePortal(SaveHelper *file, int i)
* @param file interface to the save file
* @return a map converting from runtime item indexes to the relative position in the save file, used by SaveDroppedItemLocations
* @see SaveDroppedItemLocations
*/
*/
std::unordered_map<uint8_t, uint8_t> SaveDroppedItems(SaveHelper &file)
{
// Vanilla Diablo/Hellfire initialise the ActiveItems and AvailableItems arrays based on saved data, so write valid values for compatibility
@ -1527,7 +1527,7 @@ std::unordered_map<uint8_t, uint8_t> SaveDroppedItems(SaveHelper &file)
* @brief Saves the position of dropped items (in dItem)
* @param file interface to the save file
* @param indexMap a map converting from runtime item indexes to the relative position in the save file
*/
*/
void SaveDroppedItemLocations(SaveHelper &file, const std::unordered_map<uint8_t, uint8_t> &itemIndexes)
{
for (int j = 0; j < MAXDUNY; j++) {

1
Source/miniwin/miniwin.h

@ -1,6 +1,5 @@
#pragma once
#include <cstdint>
#include <cctype>
#include <cmath>
#include <cstdint>

2
Source/miniwin/misc_msg.cpp

@ -3,9 +3,9 @@
#include <deque>
#include <string>
#ifdef USE_SDL1
#include <cassert>
#include <codecvt>
#include <locale>
#include <cassert>
#endif
#include "control.h"

4
Source/misdat.cpp

@ -5,9 +5,9 @@
*/
#include "misdat.h"
#include "missiles.h"
#include "engine/load_file.hpp"
#include "engine/cel_header.hpp"
#include "engine/load_file.hpp"
#include "missiles.h"
namespace devilution {

14
Source/misdat.h

@ -8,8 +8,8 @@
#include <cstdint>
#include <vector>
#include "engine.h"
#include "effects.h"
#include "engine.h"
#include "utils/stdcompat/cstddef.hpp"
namespace devilution {
@ -96,16 +96,16 @@ typedef enum missile_graphic_id : uint8_t {
*/
enum class MissileMovementDistrubution {
/**
* @brief No movement distribution is calculated. Normally this means the missile doesn't move at all.
*/
* @brief No movement distribution is calculated. Normally this means the missile doesn't move at all.
*/
Disabled,
/**
* @brief The missile moves and if it hits a enemey it stops (for example firebolt)
*/
* @brief The missile moves and if it hits a enemey it stops (for example firebolt)
*/
Blockable,
/**
* @brief The missile moves and even it hits a enemy it keeps moving (for example flame wave)
*/
* @brief The missile moves and even it hits a enemy it keeps moving (for example flame wave)
*/
Unblockable,
};

24
Source/missiles.h

@ -7,9 +7,9 @@
#include <cstdint>
#include "miniwin/miniwin.h"
#include "engine.h"
#include "engine/point.hpp"
#include "miniwin/miniwin.h"
#include "misdat.h"
#include "monster.h"
#include "spelldat.h"
@ -38,17 +38,17 @@ struct MissilePosition {
Displacement traveled;
/**
* @brief Specifies the location (tile) while rendering
*/
* @brief Specifies the location (tile) while rendering
*/
Point tileForRendering;
/**
* @brief Specifies the location (offset) while rendering
*/
* @brief Specifies the location (offset) while rendering
*/
Displacement offsetForRendering;
/**
* @brief Stops the missile (set velocity to zero and set offset to last renderer location; shouldn't matter cause the missile don't move anymore)
*/
* @brief Stops the missile (set velocity to zero and set offset to last renderer location; shouldn't matter cause the missile don't move anymore)
*/
void StopMissile()
{
velocity = {};
@ -130,8 +130,8 @@ struct Missile {
int var7;
bool limitReached;
/**
* @brief For moving missiles lastCollisionTargetHash contains the last entity (player or monster) that was checked in CheckMissileCol (needed to avoid multiple hits for a entity at the same tile).
*/
* @brief For moving missiles lastCollisionTargetHash contains the last entity (player or monster) that was checked in CheckMissileCol (needed to avoid multiple hits for a entity at the same tile).
*/
int16_t lastCollisionTargetHash;
};
@ -172,14 +172,14 @@ bool PlayerMHit(int pnum, Monster *monster, int dist, int mind, int maxd, missil
* @brief Sets the missile sprite to the given sheet frame
* @param missile this object
* @param dir Sprite frame, typically representing a direction but there are some exceptions (arrows being 1 indexed, directionless spells)
*/
*/
void SetMissDir(Missile &missile, int dir);
/**
* @brief Sets the sprite for this missile so it matches the given Direction
* @param missile this object
* @param dir Desired facing
*/
*/
inline void SetMissDir(Missile &missile, Direction dir)
{
SetMissDir(missile, static_cast<int>(dir));
@ -189,7 +189,7 @@ inline void SetMissDir(Missile &missile, Direction dir)
* @brief Sets the sprite for this missile so it matches the given Direction16
* @param missile this object
* @param dir Desired facing at a 22.8125 degree resolution
*/
*/
inline void SetMissDir(Missile &missile, Direction16 dir)
{
SetMissDir(missile, static_cast<int>(dir));

2
Source/monstdat.cpp

@ -3,8 +3,8 @@
*
* Implementation of all monster data.
*/
#include "items.h"
#include "monstdat.h"
#include "items.h"
#include "monster.h"
#include "textdat.h"

8
Source/monster.h

@ -5,8 +5,8 @@
*/
#pragma once
#include <cstdint>
#include <array>
#include <cstdint>
#include <functional>
#include "engine.h"
@ -15,11 +15,11 @@
#include "engine/cel_sprite.hpp"
#include "engine/point.hpp"
#include "miniwin/miniwin.h"
#include "utils/stdcompat/optional.hpp"
#include "monstdat.h"
#include "sound.h"
#include "spelldat.h"
#include "textdat.h"
#include "utils/stdcompat/optional.hpp"
namespace devilution {
@ -224,7 +224,7 @@ struct Monster { // note: missing field _mAFNum
* @brief Sets the current cell sprite to match the desired direction and animation sequence
* @param graphic Animation sequence of interest
* @param direction Desired direction the monster should be visually facing
*/
*/
void ChangeAnimationData(MonsterGraphic graphic, Direction direction)
{
auto &animationData = this->MType->GetAnimData(graphic);
@ -237,7 +237,7 @@ struct Monster { // note: missing field _mAFNum
/**
* @brief Sets the current cell sprite to match the desired animation sequence using the direction the monster is currently facing
* @param graphic Animation sequence of interest
*/
*/
void ChangeAnimationData(MonsterGraphic graphic)
{
this->ChangeAnimationData(graphic, this->_mdir);

2
Source/mpq/mpq_writer.hpp

@ -7,8 +7,8 @@
#include <cstdint>
#include "utils/stdcompat/cstddef.hpp"
#include "utils/logged_fstream.hpp"
#include "utils/stdcompat/cstddef.hpp"
namespace devilution {

4
Source/msg.cpp

@ -28,9 +28,9 @@
#include "spells.h"
#include "storm/storm_net.hpp"
#include "sync.h"
#include "tmsg.h"
#include "town.h"
#include "towners.h"
#include "tmsg.h"
#include "trigs.h"
#include "utils/language.h"
@ -2170,7 +2170,7 @@ Point GetItemPosition(Point position)
return position;
}
} //namespace
} // namespace
void DeltaLoadLevel()
{

2
Source/nthread.cpp

@ -4,10 +4,10 @@
* Implementation of functions for managing game ticks.
*/
#include "nthread.h"
#include "diablo.h"
#include "engine/demomode.h"
#include "gmenu.h"
#include "nthread.h"
#include "storm/storm_net.hpp"
#include "utils/sdl_mutex.h"
#include "utils/sdl_thread.h"

6
Source/objects.cpp

@ -443,7 +443,7 @@ void AddCandles()
*
* @param affectedArea The map region to be updated when this object is activated by the player.
* @param msg The quest text to play when the player activates the book.
*/
*/
void AddBookLever(Rectangle affectedArea, _speech_id msg)
{
int cnt = 0;
@ -5396,9 +5396,9 @@ void GetObjectStr(const Object &object)
case OBJ_BARREL:
case OBJ_BARRELEX:
if (currlevel >= 17 && currlevel <= 20) // for hive levels
strcpy(infostr, _("Pod")); //Then a barrel is called a pod
strcpy(infostr, _("Pod")); // Then a barrel is called a pod
else if (currlevel >= 21 && currlevel <= 24) // for crypt levels
strcpy(infostr, _("Urn")); //Then a barrel is called an urn
strcpy(infostr, _("Urn")); // Then a barrel is called an urn
else
strcpy(infostr, _("Barrel"));
break;

4
Source/objects.h

@ -98,7 +98,7 @@ struct Object {
* initialized by IntializeQuestBook().
*
* @param mapRange The region to be updated when this object is activated.
*/
*/
constexpr void InitializeBook(Rectangle mapRange)
{
SetMapRange(mapRange);
@ -265,7 +265,7 @@ void SyncObjectAnim(Object &object);
/**
* @brief Updates the text drawn in the info box to describe the given object
* @param object The currently highlighted object
*/
*/
void GetObjectStr(const Object &object);
void OperateNakrulLever();
void SyncNakrulRoom();

2
Source/pack.h

@ -7,9 +7,9 @@
#include <cstdint>
#include "player.h"
#include "inv.h"
#include "items.h"
#include "player.h"
namespace devilution {

4
Source/panels/charpanel.cpp

@ -7,10 +7,10 @@
#include "DiabloUI/art_draw.h"
#include "control.h"
#include "player.h"
#include "utils/display.h"
#include "engine/render/cel_render.hpp"
#include "engine/render/text_render.hpp"
#include "player.h"
#include "utils/display.h"
#include "utils/language.h"
namespace devilution {

2
Source/path.h

@ -37,7 +37,7 @@ bool IsTileWalkable(Point position, bool ignoreDoors = false);
/**
* @brief Checks if the position contains an object, player, monster, or solid dungeon piece
*/
*/
bool IsTileOccupied(Point position);
/**

2
Source/pfile.h

@ -5,9 +5,9 @@
*/
#pragma once
#include "DiabloUI/diabloui.h"
#include "mpq/mpq_writer.hpp"
#include "player.h"
#include "DiabloUI/diabloui.h"
namespace devilution {

2
Source/platform/ctr/asio/net/if.c

@ -1,6 +1,6 @@
#include <stddef.h>
#include <errno.h>
#include <net/if.h>
#include <stddef.h>
unsigned int if_nametoindex(const char *__ifname)
{

2
Source/platform/ctr/asio/sys/socket.c

@ -1,7 +1,7 @@
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <errno.h>
ssize_t stream_recvmsg(int socket, struct msghdr *message, int flags)
{

4
Source/platform/ctr/asio/sys/uio.c

@ -1,6 +1,6 @@
#include <sys/uio.h>
#include <sys/types.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/uio.h>
ssize_t readv(int __fd, const struct iovec *__iovec, int __count)
{

59
Source/platform/ctr/messagebox.cpp

@ -1,29 +1,30 @@
#include <3ds.h>
#include <SDL.h>
#include <fmt/core.h>
#include "utils/sdl2_to_1_2_backports.h"
int SDL_ShowSimpleMessageBox(Uint32 flags,
const char *title,
const char *message,
SDL_Surface *window)
{
if (SDL_ShowCursor(SDL_DISABLE) <= -1)
SDL_Log("%s", SDL_GetError());
bool init = !gspHasGpuRight();
auto text = fmt::format("{}\n\n{}", title, message);
if (init)
gfxInitDefault();
errorConf error;
errorInit(&error, ERROR_TEXT, CFG_LANGUAGE_EN);
errorText(&error, text.c_str());
errorDisp(&error);
if (init)
gfxExit();
return 0;
}
#include <3ds.h>
#include <SDL.h>
#include <fmt/core.h>
#include "utils/sdl2_to_1_2_backports.h"
int SDL_ShowSimpleMessageBox(Uint32 flags,
const char *title,
const char *message,
SDL_Surface *window)
{
if (SDL_ShowCursor(SDL_DISABLE) <= -1)
SDL_Log("%s", SDL_GetError());
bool init = !gspHasGpuRight();
auto text = fmt::format("{}\n\n{}", title, message);
if (init)
gfxInitDefault();
errorConf error;
errorInit(&error, ERROR_TEXT, CFG_LANGUAGE_EN);
errorText(&error, text.c_str());
errorDisp(&error);
if (init)
gfxExit();
return 0;
}

4
Source/platform/ctr/random.cpp

@ -1,6 +1,6 @@
#include <sys/types.h>
#include <sodium.h>
#include <3ds.h>
#include <sodium.h>
#include <sys/types.h>
static const char *randombytes_ctrrandom_implementation_name()
{

136
Source/platform/ctr/sockets.cpp

@ -1,66 +1,70 @@
#include <malloc.h>
#include <3ds.h>
#include "utils/log.hpp"
namespace devilution {
constexpr auto SOC_ALIGN = 0x1000;
constexpr auto SOC_BUFFERSIZE = 0x100000;
static u32 *socBuffer;
static bool initialized;
static bool waitForWifi()
{
// 100 ms
constexpr s64 sleepNano = 100 * 1000 * 1000;
// 5 sec
constexpr int loopCount = 5 * 1000 / 100;
uint32_t wifi = 0;
for (int i = 0; i < loopCount; ++i) {
if (R_SUCCEEDED(ACU_GetWifiStatus(&wifi)) && wifi)
return true;
svcSleepThread(sleepNano);
}
return false;
}
void n3ds_socExit()
{
if (socBuffer == nullptr)
return;
socExit();
free(socBuffer);
socBuffer = nullptr;
}
void n3ds_socInit()
{
if (!waitForWifi()) {
LogError("n3ds_socInit: Wifi off");
return;
}
socBuffer = (u32 *)memalign(SOC_ALIGN, SOC_BUFFERSIZE);
if (socBuffer == nullptr) {
LogError("n3ds_socInit: memalign() failed");
return;
}
Result result = socInit(socBuffer, SOC_BUFFERSIZE);
if (!R_SUCCEEDED(result)) {
LogError("n3ds_socInit: socInit() failed");
free(socBuffer);
return;
}
if (!initialized)
atexit([]() { n3ds_socExit(); });
initialized = true;
}
} // namespace devilution
#include "platform/ctr/sockets.hpp"
#include <malloc.h>
#include <3ds.h>
#include "utils/log.hpp"
namespace devilution {
constexpr auto SOC_ALIGN = 0x1000;
constexpr auto SOC_BUFFERSIZE = 0x100000;
static u32 *socBuffer;
static bool initialized;
static bool waitForWifi()
{
// 100 ms
constexpr s64 sleepNano = 100 * 1000 * 1000;
// 5 sec
constexpr int loopCount = 5 * 1000 / 100;
uint32_t wifi = 0;
for (int i = 0; i < loopCount; ++i) {
if (R_SUCCEEDED(ACU_GetWifiStatus(&wifi)) && wifi)
return true;
svcSleepThread(sleepNano);
}
return false;
}
void n3ds_socExit()
{
if (socBuffer == nullptr)
return;
socExit();
free(socBuffer);
socBuffer = nullptr;
}
void n3ds_socInit()
{
if (!waitForWifi()) {
LogError("n3ds_socInit: Wifi off");
return;
}
socBuffer = (u32 *)memalign(SOC_ALIGN, SOC_BUFFERSIZE);
if (socBuffer == nullptr) {
LogError("n3ds_socInit: memalign() failed");
return;
}
Result result = socInit(socBuffer, SOC_BUFFERSIZE);
if (!R_SUCCEEDED(result)) {
LogError("n3ds_socInit: socInit() failed");
free(socBuffer);
return;
}
if (!initialized)
atexit([]() { n3ds_socExit(); });
initialized = true;
}
} // namespace devilution

2
Source/platform/ctr/system.cpp

@ -1,6 +1,6 @@
#include <3ds.h>
#include <cstdlib>
#include <cstdio>
#include <cstdlib>
#include "platform/ctr/cfgu_service.hpp"
#include "platform/ctr/random.hpp"

2
Source/platform/switch/asio/net/if.c

@ -1,6 +1,6 @@
#include <stddef.h>
#include <errno.h>
#include <net/if.h>
#include <stddef.h>
unsigned int if_nametoindex(const char *__ifname)
{

2
Source/platform/switch/asio/sys/signal.c

@ -1,5 +1,5 @@
#include <sys/signal.h>
#include <errno.h>
#include <sys/signal.h>
int pthread_sigmask(int, const sigset_t *, sigset_t *)
{

2
Source/platform/switch/docking.cpp

@ -1,7 +1,7 @@
#include "platform/switch/docking.h"
#include <switch.h>
#include <SDL.h>
#include <switch.h>
#include "diablo.h"
#include "utils/display.h"

7
Source/platform/switch/keyboard.cpp

@ -1,7 +1,10 @@
#include "platform/switch/keyboard.h"
#include <cstring>
#include <switch.h>
#include <SDL.h>
#include "platform/switch/keyboard.h"
#include <switch.h>
#include "utils/utf8.hpp"
static void switch_keyboard_get(const char *guide_text, char *initial_text, int max_len, int multiline, char *buf)

4
Source/platform/switch/network.cpp

@ -1,7 +1,7 @@
#include "platform/switch/network.h"
#include <cstdlib>
#include <unistd.h>
#include <switch.h>
#include "platform/switch/network.h"
#include <unistd.h>
static int nxlink_sock = -1; // for stdio on Switch

111
Source/platform/switch/random.cpp

@ -1,54 +1,57 @@
#include <sys/types.h>
#include <sodium.h>
extern "C" {
#include <switch/sf/service.h>
#include <switch/services/csrng.h>
}
static const char *randombytes_switchrandom_implementation_name()
{
return "switchrandom";
}
static bool randombytes_switchrandom_tryfill(void *const buf, const size_t size)
{
Result res;
Service *csrngService = csrngGetServiceSession();
if (!serviceIsActive(csrngService)) {
res = csrngInitialize();
if (!R_SUCCEEDED(res))
return false;
}
res = csrngGetRandomBytes(buf, size);
return R_SUCCEEDED(res);
}
static uint32_t randombytes_switchrandom()
{
uint32_t num;
if (!randombytes_switchrandom_tryfill(&num, sizeof(uint32_t)))
sodium_misuse();
return num;
}
static void randombytes_switchrandom_buf(void *const buf, const size_t size)
{
if (!randombytes_switchrandom_tryfill(buf, size))
sodium_misuse();
}
struct randombytes_implementation randombytes_switchrandom_implementation = {
randombytes_switchrandom_implementation_name,
randombytes_switchrandom,
nullptr,
nullptr,
randombytes_switchrandom_buf,
nullptr
};
void randombytes_switchrandom_init()
{
randombytes_set_implementation(&randombytes_switchrandom_implementation);
atexit(csrngExit);
}
#include "platform/switch/random.hpp"
#include <sys/types.h>
#include <sodium.h>
extern "C" {
#include <switch/services/csrng.h>
#include <switch/sf/service.h>
}
static const char *randombytes_switchrandom_implementation_name()
{
return "switchrandom";
}
static bool randombytes_switchrandom_tryfill(void *const buf, const size_t size)
{
Result res;
Service *csrngService = csrngGetServiceSession();
if (!serviceIsActive(csrngService)) {
res = csrngInitialize();
if (!R_SUCCEEDED(res))
return false;
}
res = csrngGetRandomBytes(buf, size);
return R_SUCCEEDED(res);
}
static uint32_t randombytes_switchrandom()
{
uint32_t num;
if (!randombytes_switchrandom_tryfill(&num, sizeof(uint32_t)))
sodium_misuse();
return num;
}
static void randombytes_switchrandom_buf(void *const buf, const size_t size)
{
if (!randombytes_switchrandom_tryfill(buf, size))
sodium_misuse();
}
struct randombytes_implementation randombytes_switchrandom_implementation = {
randombytes_switchrandom_implementation_name,
randombytes_switchrandom,
nullptr,
nullptr,
randombytes_switchrandom_buf,
nullptr
};
void randombytes_switchrandom_init()
{
randombytes_set_implementation(&randombytes_switchrandom_implementation);
atexit(csrngExit);
}

5
Source/platform/vita/keyboard.cpp

@ -1,9 +1,10 @@
#include "platform/vita/keyboard.h"
#include <cstring>
#include <SDL.h>
#include <psp2/types.h>
#include <psp2/ime_dialog.h>
#include "platform/vita/keyboard.h"
#include <psp2/types.h>
static void utf16_to_utf8(const uint16_t *src, uint8_t *dst)
{

8
Source/platform/vita/network.cpp

@ -1,10 +1,12 @@
#include <cstdlib>
#include "platform/vita/network.h"
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include "platform/vita/network.h"
#include <psp2/sysmodule.h>
#include <psp2/net/net.h>
#include <psp2/net/netctl.h>
#include <psp2/sysmodule.h>
void vita_enable_network()
{

4
Source/platform/vita/random.cpp

@ -1,6 +1,6 @@
#include <sys/types.h>
#include <sodium.h>
#include <psp2/kernel/rng.h>
#include <sodium.h>
#include <sys/types.h>
static const char *randombytes_vitarandom_implementation_name()
{

12
Source/player.h

@ -110,9 +110,9 @@ enum class PlayerWeaponGraphic : uint8_t {
enum PLR_MODE : uint8_t {
PM_STAND,
PM_WALK, //Movement towards N, NW, or NE
PM_WALK2, //Movement towards S, SW, or SE
PM_WALK3, //Movement towards W or E
PM_WALK, // Movement towards N, NW, or NE
PM_WALK2, // Movement towards S, SW, or SE
PM_WALK3, // Movement towards W or E
PM_ATTACK,
PM_RATTACK,
PM_BLOCK,
@ -429,7 +429,7 @@ struct Player {
int GetMeleePiercingToHit() const
{
int hper = GetMeleeToHit();
//in hellfire armor piercing ignores % of enemy armor instead, no way to include it here
// in hellfire armor piercing ignores % of enemy armor instead, no way to include it here
if (!gbIsHellfire)
hper += _pIEnAc;
return hper;
@ -451,7 +451,7 @@ struct Player {
int GetRangedPiercingToHit() const
{
int hper = GetRangedToHit();
//in hellfire armor piercing ignores % of enemy armor instead, no way to include it here
// in hellfire armor piercing ignores % of enemy armor instead, no way to include it here
if (!gbIsHellfire)
hper += _pIEnAc;
return hper;
@ -514,7 +514,7 @@ struct Player {
* The stored value is unused...
* @see _pHPPer
* @return The players current hit points as a percentage of their maximum (from 0 to 80%)
*/
*/
int UpdateHitPointPercentage()
{
if (_pMaxHP <= 0) { // divide by zero guard

8
Source/qol/autopickup.cpp

@ -1,8 +1,8 @@
/**
* @file autopickup.cpp
*
* QoL feature for automatically picking up gold
*/
* @file autopickup.cpp
*
* QoL feature for automatically picking up gold
*/
#include "options.h"
#include "player.h"

8
Source/qol/autopickup.h

@ -1,8 +1,8 @@
/**
* @file autopickup.h
*
* QoL feature for automatically picking up gold
*/
* @file autopickup.h
*
* QoL feature for automatically picking up gold
*/
#pragma once

8
Source/qol/common.cpp

@ -1,8 +1,8 @@
/**
* @file common.h
*
* Common functions for QoL features
*/
* @file common.h
*
* Common functions for QoL features
*/
#include <SDL.h>

8
Source/qol/common.h

@ -1,8 +1,8 @@
/**
* @file common.h
*
* Common functions for QoL features
*/
* @file common.h
*
* Common functions for QoL features
*/
#pragma once
#include <SDL.h>

8
Source/qol/itemlabels.h

@ -1,8 +1,8 @@
/**
* @file itemlabels.h
*
* Adds item labels QoL feature
*/
* @file itemlabels.h
*
* Adds item labels QoL feature
*/
#pragma once
#include "engine.h"

8
Source/qol/monhealthbar.cpp

@ -1,8 +1,8 @@
/**
* @file monhealthbar.cpp
*
* Adds monster health bar QoL feature
*/
* @file monhealthbar.cpp
*
* Adds monster health bar QoL feature
*/
#include "DiabloUI/art_draw.h"
#include "control.h"

8
Source/qol/monhealthbar.h

@ -1,8 +1,8 @@
/**
* @file monhealthbar.h
*
* Adds monster health bar QoL feature
*/
* @file monhealthbar.h
*
* Adds monster health bar QoL feature
*/
#pragma once
namespace devilution {

8
Source/qol/xpbar.cpp

@ -1,8 +1,8 @@
/**
* @file xpbar.cpp
*
* Adds XP bar QoL feature
*/
* @file xpbar.cpp
*
* Adds XP bar QoL feature
*/
#include "xpbar.h"
#include <array>

8
Source/qol/xpbar.h

@ -1,8 +1,8 @@
/**
* @file xpbar.h
*
* Adds XP bar QoL feature
*/
* @file xpbar.h
*
* Adds XP bar QoL feature
*/
#pragma once
namespace devilution {

2
Source/quests.h

@ -84,7 +84,7 @@ void InitQuests();
* @brief Deactivates quests from each quest pool at random to provide variety for single player games
* @param seed The seed used to control which quests are deactivated
* @param quests The available quest list, this function will make some of them inactive by the time it returns
*/
*/
void InitialiseQuestPools(uint32_t seed, Quest quests[]);
void CheckQuests();
bool ForceQuests();

2
Source/scrollrt.cpp

@ -14,7 +14,6 @@
#include "engine/render/cl2_render.hpp"
#include "engine/render/dun_render.hpp"
#include "engine/render/text_render.hpp"
#include "panels/charpanel.hpp"
#include "error.h"
#include "gmenu.h"
#include "help.h"
@ -25,6 +24,7 @@
#include "minitext.h"
#include "missiles.h"
#include "nthread.h"
#include "panels/charpanel.hpp"
#include "plrmsg.h"
#include "qol/itemlabels.h"
#include "qol/monhealthbar.h"

1
Source/sha.cpp

@ -6,6 +6,7 @@
#include "sha.h"
#include <cstdint>
#include <SDL.h>
#include "appfat.h"

2
Source/sound.cpp

@ -16,9 +16,9 @@
#include <SDL.h>
#include <aulib.h>
#include "engine/assets.hpp"
#include "init.h"
#include "options.h"
#include "engine/assets.hpp"
#include "utils/log.hpp"
#include "utils/math.h"
#include "utils/sdl_mutex.h"

2
Source/sound.h

@ -6,8 +6,8 @@
#pragma once
#include <cstdint>
#include <string>
#include <memory>
#include <string>
#include "miniwin/miniwin.h"

2
Source/storm/storm_net.hpp

@ -2,8 +2,8 @@
#include <cstddef>
#include <cstdint>
#include <vector>
#include <string>
#include <vector>
namespace devilution {

14
Source/storm/storm_svid.cpp

@ -14,9 +14,9 @@
#endif
#include "dx.h"
#include "engine/assets.hpp"
#include "options.h"
#include "palette.h"
#include "engine/assets.hpp"
#include "utils/display.h"
#include "utils/log.hpp"
#include "utils/sdl_compat.h"
@ -146,12 +146,12 @@ bool SVidPlayBegin(const char *filename, int flags)
SVidLoop = false;
if ((flags & 0x40000) != 0)
SVidLoop = true;
//0x8 // Non-interlaced
//0x200, 0x800 // Upscale video
//0x80000 // Center horizontally
//0x100000 // Disable video
//0x800000 // Edge detection
//0x200800 // Clear FB
// 0x8 // Non-interlaced
// 0x200, 0x800 // Upscale video
// 0x80000 // Center horizontally
// 0x100000 // Disable video
// 0x800000 // Edge detection
// 0x200800 // Clear FB
SDL_RWops *videoStream = OpenAsset(filename);
SVidHandle = Smacker_Open(videoStream);

6
Source/town.h

@ -14,14 +14,14 @@ namespace devilution {
* @brief Check if hive can be opened by dropping rune bomb on a tile
* @param position The position of the tile
* @return True if the bomb would open hive
*/
*/
bool OpensHive(Point position);
/**
* @brief Check if grave can be opened by dropping cathedral map on a tile
* @param position The position of the tile
* @return True if the map would open the grave
*/
*/
bool OpensGrave(Point position);
/**
@ -29,7 +29,7 @@ bool OpensGrave(Point position);
*/
void TownOpenHive();
/**
/**
* @brief Update the map to show the open grave
*/
void TownOpenGrave();

2
Source/towners.h

@ -5,9 +5,9 @@
*/
#pragma once
#include "utils/stdcompat/string_view.hpp"
#include <cstdint>
#include <memory>
#include "utils/stdcompat/string_view.hpp"
#include "items.h"
#include "player.h"

2
Source/utils/file_util.cpp

@ -17,8 +17,8 @@
// Suppress definitions of `min` and `max` macros by <windows.h>:
#define NOMINMAX 1
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shlwapi.h>
#include <windows.h>
#include "utils/log.hpp"
#endif

2
Source/utils/file_util.h

@ -5,8 +5,8 @@
#include <fstream>
#include <memory>
#include "utils/stdcompat/string_view.hpp"
#include "utils/stdcompat/optional.hpp"
#include "utils/stdcompat/string_view.hpp"
namespace devilution {

2
Source/utils/language.cpp

@ -5,8 +5,8 @@
#include <memory>
#include <vector>
#include "options.h"
#include "engine/assets.hpp"
#include "options.h"
#include "utils/file_util.h"
#include "utils/paths.h"
#include "utils/stdcompat/string_view.hpp"

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save