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
|
;The minimum supported version of High Resolution Patch is 4.1.8
|
||||||
ActionPointsBar=0
|
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
|
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
|
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||||
[Input]
|
[Input]
|
||||||
|
|||||||
+29
-15
@@ -465,6 +465,10 @@ struct DotPosition {
|
|||||||
};
|
};
|
||||||
static std::vector<DotPosition> dots;
|
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 spaceLen = 2;
|
||||||
static long dotLen = 1;
|
static long dotLen = 1;
|
||||||
static long dot_xpos = 0;
|
static long dot_xpos = 0;
|
||||||
@@ -476,7 +480,7 @@ static void AddNewDot() {
|
|||||||
|
|
||||||
if (dotLen <= 0 && spaceLen) {
|
if (dotLen <= 0 && spaceLen) {
|
||||||
spaceLen--;
|
spaceLen--;
|
||||||
if (!spaceLen) dotLen = 1; // set dot length
|
if (!spaceLen) dotLen = optionLenDot; // set dot length
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dotLen--;
|
dotLen--;
|
||||||
@@ -486,18 +490,17 @@ static void AddNewDot() {
|
|||||||
dot.y = dot_ypos;
|
dot.y = dot_ypos;
|
||||||
dots.push_back(std::move(dot));
|
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;
|
long x_offset, y_offset;
|
||||||
__asm {
|
__asm {
|
||||||
pushad;
|
|
||||||
mov ebp, esp; // prolog
|
mov ebp, esp; // prolog
|
||||||
sub esp, __LOCAL_SIZE;
|
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();
|
AddNewDot();
|
||||||
}
|
}
|
||||||
x_offset = 22 - fo::var::wmWorldOffsetX;
|
x_offset = 22 - fo::var::wmWorldOffsetX;
|
||||||
@@ -516,23 +519,26 @@ static void __declspec(naked) wmInterfaceRefresh_hook() {
|
|||||||
BYTE* wmWinBuf_xy = (wmPixelY + wmPixelX) + wmWinBuf;
|
BYTE* wmWinBuf_xy = (wmPixelY + wmPixelX) + wmWinBuf;
|
||||||
|
|
||||||
// put pixel to interface window buffer
|
// 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
|
// TODO: fix dots for car travel
|
||||||
}
|
}
|
||||||
|
|
||||||
__asm {
|
__asm {
|
||||||
mov esp, ebp; // epilog
|
mov esp, ebp; // epilog
|
||||||
popad;
|
retn;
|
||||||
jmp fo::funcoffs::wmInterfaceDrawSubTileList_;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __declspec(naked) wmInterfaceRefresh_hook_stop() {
|
static void __declspec(naked) wmInterfaceRefresh_hook() {
|
||||||
if (!fo::var::target_xpos && !fo::var::target_ypos) {
|
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();
|
dots.clear();
|
||||||
dotLen = 1;
|
dotLen = optionLenDot;
|
||||||
spaceLen = 2;
|
spaceLen = optionSpaceDot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
__asm jmp fo::funcoffs::wmDrawCursorStopped_;
|
__asm jmp fo::funcoffs::wmDrawCursorStopped_;
|
||||||
}
|
}
|
||||||
@@ -600,8 +606,16 @@ static void WorldMapInterfacePatch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (GetConfigInt("Interface", "WorldTravelMarkers", 0)) {
|
if (GetConfigInt("Interface", "WorldTravelMarkers", 0)) {
|
||||||
HookCall(0x4C3BE6, wmInterfaceRefresh_hook); // when calling wmInterfaceDrawSubTileList_
|
optionLenDot = GetConfigInt("Interface", "MarkerLength", optionLenDot);
|
||||||
HookCall(0x4C3C7E, wmInterfaceRefresh_hook_stop);
|
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);
|
dots.reserve(512);
|
||||||
LoadGameHook::OnGameReset() += []() {
|
LoadGameHook::OnGameReset() += []() {
|
||||||
dots.clear();
|
dots.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user