Skip to content

Commit

Permalink
v0.3 release
Browse files Browse the repository at this point in the history
* add various configurations in D2RMH.ini, check comments there
* fix Gidbinn guide line
  • Loading branch information
Soar Qin committed Oct 27, 2021
1 parent efe40a1 commit 7eda515
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 78 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Diablo II Resurrected map revealing tool.

# What's New
## v0.3
* add various configurations in D2RMH.ini, check comments there
* fix Gidbinn guide line

## v0.2
* add display for Unique Chest, Well, neighbour map path
* fix display of correct taltomb entrance
Expand All @@ -20,8 +24,20 @@ Diablo II Resurrected map revealing tool.
2. Run D2RMH.exe, enjoy!

# How to build
## Quick instruction
* Just use [cmake](https://www.cmake.org/) to build, Visual Studio 2019 and MinGW GCC 32bit 9.0+(better using MSYS2) are supported
* For Visual Studio 2019: add `-A Win32` to cmake commandline to ensure builds a 32-bit exe
## Detailed instruction
### MinGW GCC 32bit
* Install MSYS2(https://www.msys2.org), type `pacman -Syu --noconfirm && pacman -S --noconfirm --needed make cmake git mingw-w64-i686-toolchain` in MSYS2 command line to install required components
* Clone D2RMH source by type `git clone https://github.com/soarqin/D2RMH`
* type `cd D2RMH && mkdir -p build && cd build && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSE_STATIC_CRT=ON ..`
* then `make` to get the compiled binary in `bin` foler
### Microsoft Visual Studio 2019
* Install Visual Studio 2019 Community Edition(or Pro/Ent if you have)
* Unpack downloaded source code file, or you can use git to Clone D2RMH source by type: `git clone https://github.com/soarqin/D2RMH`. Note: Using git requires [Git for windows](https://git-scm.com/download/win) installed
* type `md build && cd build && cmake -G "Visual Studio 16 2019" -A Win32 -DUSE_STATIC_CRT=ON ..`
* open generated `D2RMH.sln` and build, you can get the compiled binary in `bin` folder

# Credits
* Core functions modified from [d2mapapi](https://github.com/jcageman/d2mapapi).
Expand Down
21 changes: 21 additions & 0 deletions bin/D2RMH.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
[main]
; path to your Diablo II LOD v1.13c
d2_path = .
; font settings
font_file_path = C:\Windows\Fonts\Arial.ttf
font_size = 12
; can be: enUS,deDE,esES,frFR,itIT,koKR,plPL,esMX,jpJP,ptBR,ruRU,zhTW,zhCN
language = enUS

[ui]
; 0-show map layer when in-game map is off
; 1-show map layer when in-game map is on
; 2-show map layer always
show = 0
; 0-draw a short line with dot ahead to target (d2hackmap style)
; 1-draw a full line to target
full_line = 0
; 0-top left
; 1-top right
; 2-center
position = 1
; map scaling, can be 1.0-4.0, cut when larger than game window
scale = 1.0
; 0-static map
; 1-keep player in map center
map_centered = 0
2 changes: 1 addition & 1 deletion bin/D2RMH_data.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2298,7 +2298,7 @@ well[12]=井
43=62
88=89
89=91
78=+251
78=+252
114=+460
117=118
115=117
Expand Down
2 changes: 1 addition & 1 deletion bin/gendata.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ guide[71][+152] =1
guide[72][+152] =1
;Act3:
guide[Spider Forest][Spider Cavern] =1
guide[Flayer Jungle][+251] =1
guide[Flayer Jungle][+252] =1
;guide[Flayer Jungle][Flayer Dungeon Level 1] =1 Flayer Dungeon is nearby Gidbinn, no need to tip it
guide[Flayer Dungeon Level 1][Flayer Dungeon Level 2] =1
guide[Flayer Dungeon Level 2][Flayer Dungeon Level 3] =1
Expand Down
1 change: 0 additions & 1 deletion d2mapapi/offset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ bool defineOffsets() {
for (auto *ptr: ptrToLoad) {
auto *p = (DWORD*)ptr;
*p = getDllOffset(*p);
fflush(stdout);
if (!*p) { return false; }
}
return true;
Expand Down
8 changes: 8 additions & 0 deletions src/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Cfg *cfg = &sCfg;

#define LOADVAL(n, m) else if (!strcmp(name, #n)) { sCfg.m = value; }
#define LOADVALN(n, m) else if (!strcmp(name, #n)) { sCfg.m = strtoul(value, nullptr, 0); }
#define LOADVALF(n, m) else if (!strcmp(name, #n)) { sCfg.m = strtof(value, nullptr); }

void loadCfg(const std::string &filename) {
ini_parse(filename.c_str(), [](void* user, const char* section,
Expand All @@ -28,6 +29,13 @@ void loadCfg(const std::string &filename) {
LOADVAL(font_file_path, fontFilePath)
LOADVALN(font_size, fontSize)
LOADVAL(language, language)
LOADVALN(show, show)
LOADVALN(full_line, fullLine)
LOADVALN(position, position)
LOADVALF(scale, scale)
LOADVALN(map_centered, mapCentered)
return 1;
}, nullptr);
if (sCfg.scale < 1.f) { sCfg.scale = 1.f; }
else if (sCfg.scale > 4.f) { sCfg.scale = 4.f; }
}
14 changes: 10 additions & 4 deletions src/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@
#include <string>

struct Cfg {
std::string d2Path;
std::string fontFilePath;
float fontSize;
std::string language;
std::string d2Path = ".";
std::string fontFilePath = R"(C:\Windows\Fonts\Arial.ttf)";
float fontSize = 12;
std::string language = "enUS";

int show = 0;
int fullLine = 0;
int position = 1;
float scale = 1;
int mapCentered = 0;
};

extern void loadCfg(const std::string &filename = "D2RMH.ini");
Expand Down
Loading

0 comments on commit 7eda515

Please sign in to comment.