Browse Source

Remove more miniwin code

pull/4952/head
Anders Jenbo 4 years ago
parent
commit
2d21fc372e
  1. 1
      Source/DiabloUI/settingsmenu.cpp
  2. 12
      Source/capture.cpp
  3. 1
      Source/control.cpp
  4. 1
      Source/controls/game_controls.cpp
  5. 1
      Source/controls/plrctrls.cpp
  6. 1
      Source/cursor.h
  7. 1
      Source/debug.cpp
  8. 1
      Source/diablo.cpp
  9. 3
      Source/effects.cpp
  10. 1
      Source/engine.cpp
  11. 1
      Source/engine/render/dun_render.cpp
  12. 9
      Source/engine/render/scrollrt.cpp
  13. 1
      Source/engine/sound.h
  14. 3
      Source/gmenu.cpp
  15. 1
      Source/init.cpp
  16. 3
      Source/init.h
  17. 3
      Source/interfac.cpp
  18. 1
      Source/inv.cpp
  19. 2
      Source/items.cpp
  20. 2
      Source/items.h
  21. 1
      Source/levels/drlg_l2.cpp
  22. 1
      Source/levels/drlg_l3.cpp
  23. 1
      Source/levels/drlg_l4.cpp
  24. 10
      Source/lighting.cpp
  25. 1
      Source/lighting.h
  26. 1
      Source/loadsave.cpp
  27. 2
      Source/miniwin/miniwin.h
  28. 2
      Source/missiles.cpp
  29. 1
      Source/missiles.h
  30. 1
      Source/movie.cpp
  31. 1
      Source/mpq/mpq_writer.cpp
  32. 1
      Source/msg.cpp
  33. 5
      Source/multi.cpp
  34. 4
      Source/multi.h
  35. 2
      Source/nthread.cpp
  36. 2
      Source/nthread.h
  37. 1
      Source/options.h
  38. 1
      Source/panels/spell_list.cpp
  39. 1
      Source/pfile.cpp
  40. 1
      Source/player.cpp
  41. 1
      Source/qol/stash.cpp
  42. 1
      Source/spells.cpp
  43. 4
      Source/stores.cpp

1
Source/DiabloUI/settingsmenu.cpp

@ -5,6 +5,7 @@
#include "control.h"
#include "engine/render/text_render.hpp"
#include "hwcursor.hpp"
#include "miniwin/miniwin.h"
#include "options.h"
#include "utils/language.h"
#include "utils/utf8.hpp"

12
Source/capture.cpp

@ -54,7 +54,7 @@ bool CaptureHdr(int16_t width, int16_t height, std::ofstream *out)
*/
bool CapturePal(SDL_Color *palette, std::ofstream *out)
{
BYTE pcxPalette[1 + 256 * 3];
uint8_t pcxPalette[1 + 256 * 3];
pcxPalette[0] = 12;
for (int i = 0; i < 256; i++) {
@ -75,12 +75,12 @@ bool CapturePal(SDL_Color *palette, std::ofstream *out)
* @return Output buffer
*/
BYTE *CaptureEnc(BYTE *src, BYTE *dst, int width)
uint8_t *CaptureEnc(uint8_t *src, uint8_t *dst, int width)
{
int rleLength;
do {
BYTE rlePixel = *src;
uint8_t rlePixel = *src;
src++;
rleLength = 1;
@ -119,10 +119,10 @@ BYTE *CaptureEnc(BYTE *src, BYTE *dst, int width)
bool CapturePix(const Surface &buf, std::ofstream *out)
{
int width = buf.w();
std::unique_ptr<BYTE[]> pBuffer { new BYTE[2 * width] };
BYTE *pixels = buf.begin();
std::unique_ptr<uint8_t[]> pBuffer { new uint8_t[2 * width] };
uint8_t *pixels = buf.begin();
for (int height = buf.h(); height > 0; height--) {
const BYTE *pBufferEnd = CaptureEnc(pixels, pBuffer.get(), width);
const uint8_t *pBufferEnd = CaptureEnc(pixels, pBuffer.get(), width);
pixels += buf.pitch();
out->write(reinterpret_cast<const char *>(pBuffer.get()), pBufferEnd - pBuffer.get());
if (out->fail())

1
Source/control.cpp

@ -31,6 +31,7 @@
#include "levels/trigs.h"
#include "lighting.h"
#include "minitext.h"
#include "miniwin/miniwin.h"
#include "missiles.h"
#include "options.h"
#include "panels/charpanel.hpp"

1
Source/controls/game_controls.cpp

@ -4,6 +4,7 @@
#include "controls/controller.h"
#include "controls/controller_motion.h"
#include "miniwin/miniwin.h"
#ifndef USE_SDL1
#include "controls/devices/game_controller.h"
#endif

1
Source/controls/plrctrls.cpp

@ -11,6 +11,7 @@
#include "automap.h"
#include "control.h"
#include "controls/controller_motion.h"
#include "miniwin/miniwin.h"
#ifndef USE_SDL1
#include "controls/devices/game_controller.h"
#endif

1
Source/cursor.h

@ -10,7 +10,6 @@
#include "engine.h"
#include "engine/cel_sprite.hpp"
#include "miniwin/miniwin.h"
#include "utils/attributes.h"
#include "utils/stdcompat/optional.hpp"

1
Source/debug.cpp

@ -20,6 +20,7 @@
#include "inv.h"
#include "levels/setmaps.h"
#include "lighting.h"
#include "miniwin/miniwin.h"
#include "monstdat.h"
#include "monster.h"
#include "plrmsg.h"

1
Source/diablo.cpp

@ -14,6 +14,7 @@
#include "capture.h"
#include "cursor.h"
#include "dead.h"
#include "miniwin/miniwin.h"
#ifdef _DEBUG
#include "debug.h"
#endif

3
Source/effects.cpp

@ -9,6 +9,7 @@
#include "engine/sound.h"
#include "engine/sound_defs.hpp"
#include "init.h"
#include "miniwin/miniwin.h"
#include "player.h"
#include "utils/stdcompat/algorithm.hpp"
#include "utils/str_cat.hpp"
@ -1161,7 +1162,7 @@ _sfx_id RndSFX(_sfx_id psfx)
return static_cast<_sfx_id>(psfx + GenerateRnd(nRand));
}
void PrivSoundInit(BYTE bLoadMask)
void PrivSoundInit(uint8_t bLoadMask)
{
if (!gbSndInited) {
return;

1
Source/engine.cpp

@ -14,6 +14,7 @@
#include <array>
#include <cassert>
#include <cstdint>
#include <cstring>
#include "engine/render/common_impl.h"
#include "lighting.h"

1
Source/engine/render/dun_render.cpp

@ -10,6 +10,7 @@
#include <cstdint>
#include "lighting.h"
#include "miniwin/miniwin.h"
#include "options.h"
#include "utils/attributes.h"

9
Source/engine/render/scrollrt.cpp

@ -26,6 +26,7 @@
#include "inv.h"
#include "lighting.h"
#include "minitext.h"
#include "miniwin/miniwin.h"
#include "missiles.h"
#include "nthread.h"
#include "options.h"
@ -201,7 +202,7 @@ int sgdwCursXOld;
int sgdwCursYOld;
uint32_t sgdwCursWdt;
BYTE sgSaveBack[8192];
uint8_t sgSaveBack[8192];
uint32_t sgdwCursHgtOld;
/**
@ -226,7 +227,7 @@ const char *const PlayerModeNames[] = {
"quitting"
};
void BlitCursor(BYTE *dst, std::uint32_t dstPitch, BYTE *src, std::uint32_t srcPitch)
void BlitCursor(uint8_t *dst, std::uint32_t dstPitch, uint8_t *src, std::uint32_t srcPitch)
{
for (std::uint32_t i = 0; i < sgdwCursHgt; ++i, src += srcPitch, dst += dstPitch) {
memcpy(dst, src, sgdwCursWdt);
@ -1024,8 +1025,8 @@ void Zoom(const Surface &out)
const int srcHeight = (out.h() + 1) / 2;
const int doubleableHeight = out.h() / 2;
BYTE *src = out.at(srcWidth - 1, srcHeight - 1);
BYTE *dst = out.at(viewportOffsetX + viewportWidth - 1, out.h() - 1);
uint8_t *src = out.at(srcWidth - 1, srcHeight - 1);
uint8_t *dst = out.at(viewportOffsetX + viewportWidth - 1, out.h() - 1);
const bool oddViewportWidth = (viewportWidth % 2) == 1;
for (int hgt = 0; hgt < doubleableHeight; hgt++) {

1
Source/engine/sound.h

@ -10,7 +10,6 @@
#include <string>
#include "levels/gendung.h"
#include "miniwin/miniwin.h"
#ifndef NOSOUND
#include "utils/soundsample.h"

3
Source/gmenu.cpp

@ -14,6 +14,7 @@
#include "engine/load_cel.hpp"
#include "engine/render/cel_render.hpp"
#include "engine/render/text_render.hpp"
#include "miniwin/miniwin.h"
#include "options.h"
#include "stores.h"
#include "utils/language.h"
@ -31,7 +32,7 @@ OptionalOwnedCelSprite sgpLogo;
bool mouseNavigation;
TMenuItem *sgpCurrItem;
int LogoAnim_tick;
BYTE LogoAnim_frame;
uint8_t LogoAnim_frame;
void (*gmenu_current_option)();
int sgCurrentMenuIdx;

1
Source/init.cpp

@ -15,6 +15,7 @@
#include "DiabloUI/diabloui.h"
#include "engine/assets.hpp"
#include "engine/dx.h"
#include "miniwin/miniwin.h"
#include "mpq/mpq_reader.hpp"
#include "options.h"
#include "pfile.h"

3
Source/init.h

@ -5,12 +5,13 @@
*/
#pragma once
#include "miniwin/miniwin.h"
#include "mpq/mpq_reader.hpp"
#include "utils/attributes.h"
namespace devilution {
typedef void (*WNDPROC)(uint32_t, int32_t, int32_t);
extern bool gbActive;
extern std::optional<MpqArchive> hellfire_mpq;
extern WNDPROC CurrentProc;

3
Source/interfac.cpp

@ -21,6 +21,7 @@
#include "hwcursor.hpp"
#include "init.h"
#include "loadsave.h"
#include "miniwin/miniwin.h"
#include "pfile.h"
#include "plrmsg.h"
#include "utils/sdl_geometry.h"
@ -37,7 +38,7 @@ uint32_t sgdwProgress;
int progress_id;
/** The color used for the progress bar as an index into the palette. */
const BYTE BarColor[3] = { 138, 43, 254 };
const uint8_t BarColor[3] = { 138, 43, 254 };
/** The screen position of the top left corner of the progress bar. */
const int BarPos[3][2] = { { 53, 37 }, { 53, 421 }, { 53, 37 } };

1
Source/inv.cpp

@ -20,6 +20,7 @@
#include "inv_iterators.hpp"
#include "levels/town.h"
#include "minitext.h"
#include "miniwin/miniwin.h"
#include "options.h"
#include "panels/ui_panels.hpp"
#include "plrmsg.h"

2
Source/items.cpp

@ -2271,7 +2271,7 @@ bool IsItemAvailable(int i)
*sgOptions.Gameplay.testBard && IsAnyOf(i, IDI_BARDSWORD, IDI_BARDDAGGER));
}
BYTE GetOutlineColor(const Item &item, bool checkReq)
uint8_t GetOutlineColor(const Item &item, bool checkReq)
{
if (checkReq && !item._iStatFlag)
return ICOL_RED;

2
Source/items.h

@ -449,7 +449,7 @@ extern bool ShowUniqueItemInfoBox;
extern CornerStoneStruct CornerStone;
extern bool UniqueItemFlags[128];
BYTE GetOutlineColor(const Item &item, bool checkReq);
uint8_t GetOutlineColor(const Item &item, bool checkReq);
bool IsItemAvailable(int i);
bool IsUniqueAvailable(int i);
void InitItemGFX();

1
Source/levels/drlg_l2.cpp

@ -13,6 +13,7 @@
#include "engine/size.hpp"
#include "levels/gendung.h"
#include "levels/setmaps.h"
#include "miniwin/miniwin.h"
#include "player.h"
#include "quests.h"
#include "utils/stdcompat/algorithm.hpp"

1
Source/levels/drlg_l3.cpp

@ -6,6 +6,7 @@
#include "levels/gendung.h"
#include "levels/setmaps.h"
#include "lighting.h"
#include "miniwin/miniwin.h"
#include "monster.h"
#include "objdat.h"
#include "objects.h"

1
Source/levels/drlg_l4.cpp

@ -5,6 +5,7 @@
*/
#include "levels/drlg_l4.h"
#include "miniwin/miniwin.h"
#include "engine/load_file.hpp"
#include "engine/random.hpp"
#include "levels/gendung.h"

10
Source/lighting.cpp

@ -63,7 +63,7 @@ bool dovision;
uint8_t lightblock[64][16][16];
/** RadiusAdj maps from VisionCrawlTable index to lighting vision radius adjustment. */
const BYTE RadiusAdj[23] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 4, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0 };
const uint8_t RadiusAdj[23] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 4, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0 };
void RotateRadius(int *x, int *y, int *dx, int *dy, int *lx, int *ly, int *bx, int *by)
{
@ -428,7 +428,7 @@ void MakeLightTable()
}
if (leveltype == DTYPE_HELL) {
BYTE blood[16];
uint8_t blood[16];
tbl = LightTables.data();
for (int i = 0; i < lights; i++) {
int l1 = lights - i;
@ -520,7 +520,7 @@ void MakeLightTable()
lightradius[j][i] = 15;
} else {
double fs = (double)15 * i / ((double)8 * (j + 1));
lightradius[j][i] = (BYTE)(fs + 0.5);
lightradius[j][i] = static_cast<uint8_t>(fs + 0.5);
}
}
}
@ -530,10 +530,10 @@ void MakeLightTable()
double fa = (sqrt((double)(16 - j))) / 128;
fa *= fa;
for (int i = 0; i < 128; i++) {
lightradius[15 - j][i] = 15 - (BYTE)(fa * (double)((128 - i) * (128 - i)));
lightradius[15 - j][i] = 15 - static_cast<uint8_t>(fa * (double)((128 - i) * (128 - i)));
if (lightradius[15 - j][i] > 15)
lightradius[15 - j][i] = 0;
lightradius[15 - j][i] = lightradius[15 - j][i] - (BYTE)((15 - j) / 2);
lightradius[15 - j][i] = lightradius[15 - j][i] - static_cast<uint8_t>((15 - j) / 2);
if (lightradius[15 - j][i] > 15)
lightradius[15 - j][i] = 0;
}

1
Source/lighting.h

@ -13,7 +13,6 @@
#include "automap.h"
#include "engine.h"
#include "engine/point.hpp"
#include "miniwin/miniwin.h"
#include "utils/attributes.h"
#include "utils/stdcompat/invoke_result_t.hpp"
#include "utils/stdcompat/optional.hpp"

1
Source/loadsave.cpp

@ -26,6 +26,7 @@
#include "inv.h"
#include "lighting.h"
#include "menu.h"
#include "miniwin/miniwin.h"
#include "missiles.h"
#include "mpq/mpq_writer.hpp"
#include "pfile.h"

2
Source/miniwin/miniwin.h

@ -24,8 +24,6 @@ namespace devilution {
typedef uint32_t DWORD;
typedef unsigned char BYTE;
typedef void (*WNDPROC)(uint32_t, int32_t, int32_t);
struct tagMSG {
uint32_t message;
int32_t wParam;

2
Source/missiles.cpp

@ -849,7 +849,7 @@ bool MonsterTrapHit(int monsterId, int mindam, int maxdam, int dist, missile_id
return false;
int hit = GenerateRnd(100);
int hper = 90 - (BYTE)monster.armorClass - dist;
int hper = 90 - monster.armorClass - dist;
hper = clamp(hper, 5, 95);
if (monster.tryLiftGargoyle())
return true;

1
Source/missiles.h

@ -10,7 +10,6 @@
#include "engine.h"
#include "engine/point.hpp"
#include "miniwin/miniwin.h"
#include "misdat.h"
#include "monster.h"
#include "player.h"

1
Source/movie.cpp

@ -10,6 +10,7 @@
#include "engine/demomode.h"
#include "engine/sound.h"
#include "hwcursor.hpp"
#include "miniwin/miniwin.h"
#include "storm/storm_svid.h"
#include "utils/display.h"

1
Source/mpq/mpq_writer.cpp

@ -11,6 +11,7 @@
#include "appfat.h"
#include "encrypt.h"
#include "engine.h"
#include "miniwin/miniwin.h"
#include "utils/endian.hpp"
#include "utils/file_util.h"
#include "utils/language.h"

1
Source/msg.cpp

@ -24,6 +24,7 @@
#include "levels/town.h"
#include "levels/trigs.h"
#include "lighting.h"
#include "miniwin/miniwin.h"
#include "missiles.h"
#include "nthread.h"
#include "objects.h"

5
Source/multi.cpp

@ -16,6 +16,7 @@
#include "engine/random.hpp"
#include "engine/world_tile.hpp"
#include "menu.h"
#include "miniwin/miniwin.h"
#include "nthread.h"
#include "options.h"
#include "pfile.h"
@ -39,7 +40,7 @@ uint16_t sgwPackPlrOffsetTbl[MAX_PLRS];
bool sgbPlayerTurnBitTbl[MAX_PLRS];
bool sgbPlayerLeftGameTbl[MAX_PLRS];
bool gbShouldValidatePackage;
BYTE gbActivePlayers;
uint8_t gbActivePlayers;
bool gbGameDestroyed;
bool sgbSendDeltaTbl[MAX_PLRS];
GameData sgGameInitInfo;
@ -56,7 +57,7 @@ bool gbIsMultiplayer;
bool sgbTimeout;
char szPlayerName[128];
bool PublicGame;
BYTE gbDeltaSender;
uint8_t gbDeltaSender;
bool sgbNetInited;
uint32_t player_state[MAX_PLRS];
Uint32 playerInfoTimers[MAX_PLRS];

4
Source/multi.h

@ -43,14 +43,14 @@ struct GameInfo {
extern bool gbSomebodyWonGameKludge;
extern char szPlayerDescript[128];
extern uint16_t sgwPackPlrOffsetTbl[MAX_PLRS];
extern BYTE gbActivePlayers;
extern uint8_t gbActivePlayers;
extern bool gbGameDestroyed;
extern GameData sgGameInitInfo;
extern bool gbSelectProvider;
extern DVL_API_FOR_TEST bool gbIsMultiplayer;
extern char szPlayerName[128];
extern bool PublicGame;
extern BYTE gbDeltaSender;
extern uint8_t gbDeltaSender;
extern uint32_t player_state[MAX_PLRS];
void InitGameInfo();

2
Source/nthread.cpp

@ -17,7 +17,7 @@
namespace devilution {
BYTE sgbNetUpdateRate;
uint8_t sgbNetUpdateRate;
size_t gdwMsgLenTbl[MAX_PLRS];
uint32_t gdwTurnsInTransit;
uintptr_t glpMsgTbl[MAX_PLRS];

2
Source/nthread.h

@ -10,7 +10,7 @@
namespace devilution {
extern BYTE sgbNetUpdateRate;
extern uint8_t sgbNetUpdateRate;
extern size_t gdwMsgLenTbl[MAX_PLRS];
extern uint32_t gdwTurnsInTransit;
extern uintptr_t glpMsgTbl[MAX_PLRS];

1
Source/options.h

@ -7,6 +7,7 @@
#include <SDL_version.h>
#include "engine/sound_defs.hpp"
#include "miniwin/miniwin.h"
#include "pack.h"
#include "utils/enum_traits.h"
#include "utils/stdcompat/optional.hpp"

1
Source/panels/spell_list.cpp

@ -7,6 +7,7 @@
#include "engine/palette.h"
#include "engine/render/text_render.hpp"
#include "inv_iterators.hpp"
#include "miniwin/miniwin.h"
#include "options.h"
#include "panels/spell_icons.hpp"
#include "player.h"

1
Source/pfile.cpp

@ -14,6 +14,7 @@
#include "init.h"
#include "loadsave.h"
#include "menu.h"
#include "miniwin/miniwin.h"
#include "mpq/mpq_reader.hpp"
#include "pack.h"
#include "qol/stash.h"

1
Source/player.cpp

@ -12,6 +12,7 @@
#include "controls/plrctrls.h"
#include "cursor.h"
#include "dead.h"
#include "miniwin/miniwin.h"
#ifdef _DEBUG
#include "debug.h"
#endif

1
Source/qol/stash.cpp

@ -15,6 +15,7 @@
#include "engine/size.hpp"
#include "hwcursor.hpp"
#include "minitext.h"
#include "miniwin/miniwin.h"
#include "stores.h"
#include "utils/format_int.hpp"
#include "utils/language.h"

1
Source/spells.cpp

@ -7,6 +7,7 @@
#include "control.h"
#include "cursor.h"
#include "miniwin/miniwin.h"
#ifdef _DEBUG
#include "debug.h"
#endif

4
Source/stores.cpp

@ -2293,8 +2293,8 @@ void DrawSLine(const Surface &out, int sy)
width -= SidePanelSize.width;
}
BYTE *src = out.at(uiPosition.x + sx, uiPosition.y + 25);
BYTE *dst = out.at(uiPosition.x + sx, sy);
uint8_t *src = out.at(uiPosition.x + sx, uiPosition.y + 25);
uint8_t *dst = out.at(uiPosition.x + sx, sy);
for (int i = 0; i < 3; i++, src += out.pitch(), dst += out.pitch())
memcpy(dst, src, width);

Loading…
Cancel
Save