mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added customization options to WorldTravelMarkers
This commit is contained in:
+8
-1
@@ -119,8 +119,15 @@ ExpandWorldMap=0
|
||||
;The minimum supported version of High Resolution Patch is 4.1.8
|
||||
ActionPointsBar=0
|
||||
|
||||
;Set to 1 to enable drawing a dotted line when moving around on the world map (similar to Fallout 1)
|
||||
;Set to 1 to enable drawing a dotted line when travelling on the world map (similar to Fallout 1)
|
||||
WorldTravelMarkers=0
|
||||
;Uncomment these lines to change the appearance of the markers
|
||||
;The color index in Fallout default palette (valid range: 1..255; default is 133)
|
||||
;MarkerColor=133
|
||||
;The lengh in pixels of the dots (valid range: 1..10)
|
||||
;MarkerLength=1
|
||||
;The spacing in pixels between the dots (valid range: 1..10)
|
||||
;MarkerSpaces=2
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Input]
|
||||
|
||||
+29
-15
@@ -465,6 +465,10 @@ struct DotPosition {
|
||||
};
|
||||
static std::vector<DotPosition> dots;
|
||||
|
||||
static long optionLenDot = 1;
|
||||
static long optionSpaceDot = 2;
|
||||
|
||||
static unsigned char colorDot = 133; // color index in palette: R = 252, G = 0, B = 0
|
||||
static long spaceLen = 2;
|
||||
static long dotLen = 1;
|
||||
static long dot_xpos = 0;
|
||||
@@ -476,7 +480,7 @@ static void AddNewDot() {
|
||||
|
||||
if (dotLen <= 0 && spaceLen) {
|
||||
spaceLen--;
|
||||
if (!spaceLen) dotLen = 1; // set dot length
|
||||
if (!spaceLen) dotLen = optionLenDot; // set dot length
|
||||
return;
|
||||
}
|
||||
dotLen--;
|
||||
@@ -486,18 +490,17 @@ static void AddNewDot() {
|
||||
dot.y = dot_ypos;
|
||||
dots.push_back(std::move(dot));
|
||||
|
||||
spaceLen = 2;
|
||||
spaceLen = optionSpaceDot;
|
||||
}
|
||||
|
||||
static void __declspec(naked) wmInterfaceRefresh_hook() {
|
||||
static void __declspec(naked) DrawingDots() {
|
||||
long x_offset, y_offset;
|
||||
__asm {
|
||||
pushad;
|
||||
mov ebp, esp; // prolog
|
||||
sub esp, __LOCAL_SIZE;
|
||||
}
|
||||
|
||||
if ((fo::var::target_xpos || fo::var::target_ypos) && (dot_xpos != fo::var::world_xpos || dot_ypos != fo::var::world_ypos)) {
|
||||
if (dot_xpos != fo::var::world_xpos || dot_ypos != fo::var::world_ypos) {
|
||||
AddNewDot();
|
||||
}
|
||||
x_offset = 22 - fo::var::wmWorldOffsetX;
|
||||
@@ -516,23 +519,26 @@ static void __declspec(naked) wmInterfaceRefresh_hook() {
|
||||
BYTE* wmWinBuf_xy = (wmPixelY + wmPixelX) + wmWinBuf;
|
||||
|
||||
// put pixel to interface window buffer
|
||||
if (wmWinBuf_xy > wmWinBuf) *wmWinBuf_xy = 133; // index color in palette: R = 252, G = 0, B = 0
|
||||
if (wmWinBuf_xy > wmWinBuf) *wmWinBuf_xy = colorDot;
|
||||
|
||||
// TODO: fix dots for car travel
|
||||
}
|
||||
|
||||
__asm {
|
||||
mov esp, ebp; // epilog
|
||||
popad;
|
||||
jmp fo::funcoffs::wmInterfaceDrawSubTileList_;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) wmInterfaceRefresh_hook_stop() {
|
||||
if (!fo::var::target_xpos && !fo::var::target_ypos) {
|
||||
static void __declspec(naked) wmInterfaceRefresh_hook() {
|
||||
if (fo::var::target_xpos != -1) {
|
||||
if (fo::var::In_WorldMap) {
|
||||
DrawingDots();
|
||||
} else if (!fo::var::target_xpos && !fo::var::target_ypos) {
|
||||
// on stop move
|
||||
dots.clear();
|
||||
dotLen = 1;
|
||||
spaceLen = 2;
|
||||
dotLen = optionLenDot;
|
||||
spaceLen = optionSpaceDot;
|
||||
}
|
||||
}
|
||||
__asm jmp fo::funcoffs::wmDrawCursorStopped_;
|
||||
}
|
||||
@@ -600,8 +606,16 @@ static void WorldMapInterfacePatch() {
|
||||
}
|
||||
|
||||
if (GetConfigInt("Interface", "WorldTravelMarkers", 0)) {
|
||||
HookCall(0x4C3BE6, wmInterfaceRefresh_hook); // when calling wmInterfaceDrawSubTileList_
|
||||
HookCall(0x4C3C7E, wmInterfaceRefresh_hook_stop);
|
||||
optionLenDot = GetConfigInt("Interface", "MarkerLength", optionLenDot);
|
||||
optionSpaceDot = GetConfigInt("Interface", "MarkerSpaces", optionSpaceDot);
|
||||
int color = GetConfigInt("Interface", "MarkerColor", colorDot);
|
||||
|
||||
if (color > 255) color = 255; else if (color < 1) color = 1;
|
||||
colorDot = color;
|
||||
if (optionLenDot > 10) optionLenDot = 10; else if (optionLenDot < 1) optionLenDot = 1;
|
||||
if (optionSpaceDot > 10) optionSpaceDot = 10; else if (optionSpaceDot < 1) optionSpaceDot = 1;
|
||||
|
||||
HookCall(0x4C3C7E, wmInterfaceRefresh_hook); // when calling wmDrawCursorStopped_
|
||||
dots.reserve(512);
|
||||
LoadGameHook::OnGameReset() += []() {
|
||||
dots.clear();
|
||||
|
||||
Reference in New Issue
Block a user