Added the description of set_iface_tag_text to notes.txt.

Fixed compilation error in BarBoxes.cpp.
Updated version number.
This commit is contained in:
NovaRain
2018-05-21 10:51:12 +08:00
parent e0c0b9ba19
commit c4903abd4c
8 changed files with 76 additions and 68 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.0.4
;v4.0.5
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
+1 -1
View File
@@ -240,7 +240,7 @@
#define set_cursor_mode(mode) sfall_func1("set_cursor_mode", mode)
#define set_dude_obj(critter) sfall_func1("set_dude_obj", critter)
#define set_flags(obj, flags) sfall_func2("set_flags", obj, flags)
#define set_iface_tag_text(tagId, text, clr) sfall_func3("set_iface_tag_text", tagId, text, clr)
#define set_iface_tag_text(tag, text, color) sfall_func3("set_iface_tag_text", tag, text, color)
#define set_ini_setting(setting, value) sfall_func2("set_ini_setting", setting, value)
#define set_map_enter_position(tile, elev, rot) sfall_func3("set_map_enter_position", tile, elev, rot)
#define set_outline(obj, color) sfall_func2("set_outline", obj, color)
@@ -476,6 +476,12 @@ Some utility/math functions are available:
> int sfall_func0("attack_is_aimed")
- returns 1 if the aimed attack mode is selected, 0 otherwise
> void sfall_func3("set_iface_tag_text", int tag, string text, int color)
- sets the text messages and colors for custom notification boxes to the interface without the need to add messages to intrface.msg and set up the font colors in ddraw.ini
- tag value is the same as used in show_iface_tag, hide_iface_tag, and is_iface_tag_active. The valid range is from 5 to 9 (custom boxes)
- The text is limited to 19 characters
- available colors: 0 - green, 1 - red, 2 - white, 3 - yellow, 4 - dark yellow, 5 - blue, 6 - purple
------------------------
------ MORE INFO -------
------------------------
+4 -5
View File
@@ -14,6 +14,7 @@
#define FO_VAR_art_vault_person_nums 0x5108A8
#define FO_VAR_bckgnd 0x5707A4
#define FO_VAR_black_palette 0x663FD0
#define FO_VAR_BlueColor 0x6A38EF
#define FO_VAR_bottom_line 0x664524
#define FO_VAR_btable 0x59E944
#define FO_VAR_btncnt 0x43EA1C
@@ -61,6 +62,7 @@
#define FO_VAR_glblmode 0x5709D0
#define FO_VAR_gmouse_current_cursor 0x518C0C
#define FO_VAR_gmovie_played_list 0x596C78
#define FO_VAR_GoodColor 0x6AB4EF
#define FO_VAR_GreenColor 0x6A3CB0
#define FO_VAR_gsound_initialized 0x518E30
#define FO_VAR_hit_location_penalty 0x510954
@@ -136,6 +138,7 @@
#define FO_VAR_pc_proto 0x51C370
#define FO_VAR_pc_trait 0x66BE40
#define FO_VAR_pc_trait2 0x66BE44
#define FO_VAR_PeanutButter 0x6A82F3
#define FO_VAR_perk_data 0x519DCC
#define FO_VAR_perkLevelDataList 0x51C120
#define FO_VAR_pip_win 0x6644C4
@@ -187,6 +190,7 @@
#define FO_VAR_trait_data 0x51DB84
#define FO_VAR_view_page 0x664520
#define FO_VAR_wd_obj 0x59E98C
#define FO_VAR_WhiteColor 0x6AB8CF
#define FO_VAR_wmAreaInfoList 0x51DDF8
#define FO_VAR_wmLastRndTime 0x51DEA0
#define FO_VAR_wmWorldOffsetX 0x51DE2C
@@ -195,8 +199,3 @@
#define FO_VAR_world_ypos 0x672E10
#define FO_VAR_WorldMapCurrArea 0x672E08
#define FO_VAR_YellowColor 0x6AB8BB
#define FO_VAR_BlueColor 0x6A38EF
#define FO_VAR_GoodColor 0x6AB4EF
#define FO_VAR_PeanutButter 0x6A82F3
#define FO_VAR_WhiteColor 0x6AB8CF
+4 -5
View File
@@ -12,6 +12,7 @@ VAR_(art_vault_guy_num, DWORD)
VAR_(art_vault_person_nums, DWORD)
VAR_(bckgnd, BYTE*)
VAR_(black_palette, DWORD)
VAR_(BlueColor, BYTE)
VAR_(bottom_line, DWORD)
VAR_(btable, DWORD)
VAR_(btncnt, DWORD)
@@ -58,6 +59,7 @@ VAR_(gIsSteal, DWORD)
VAR_(glblmode, DWORD)
VAR_(gmouse_current_cursor, long)
VARA(gmovie_played_list, BYTE, 17)
VAR_(GoodColor, BYTE)
VAR_(GreenColor, BYTE)
VAR_(gsound_initialized, DWORD)
VARA(hit_location_penalty, long, 9)
@@ -131,6 +133,7 @@ VAR_(pc_kill_counts, DWORD)
VARA(pc_name, char, 32)
VAR_(pc_proto, Proto)
VARA(pc_trait, long, 2) // 2 of them
VAR_(PeanutButter, BYTE)
VARA(perk_data, PerkInfo, PERK_count)
VAR_(perkLevelDataList, long*) // dynamic array, limited to PERK_Count
VAR_(pip_win, DWORD)
@@ -182,6 +185,7 @@ VAR_(title_font, DWORD)
VARA(trait_data, TraitInfo, TRAIT_count)
VAR_(view_page, DWORD)
VAR_(wd_obj, DWORD)
VAR_(WhiteColor, BYTE)
VAR_(wmAreaInfoList, DWORD)
VAR_(wmLastRndTime, DWORD)
VAR_(wmWorldOffsetX, DWORD)
@@ -191,11 +195,6 @@ VAR_(world_ypos, DWORD)
VAR_(WorldMapCurrArea, DWORD)
VAR_(YellowColor, BYTE)
VAR_(BlueColor, BYTE)
VAR_(GoodColor, BYTE)
VAR_(PeanutButter, BYTE)
VAR_(WhiteColor, BYTE)
#undef VAR_
#undef VARP
#undef VARA
+54 -50
View File
@@ -29,7 +29,7 @@ static const DWORD DisplayBoxesRet1 = 0x4615A8;
static const DWORD DisplayBoxesRet2 = 0x4615BE;
static const DWORD SetIndexBoxRet = 0x4612E8;
#define sSize 12
#define sSize (12)
struct sBox {
DWORD msg;
DWORD colour;
@@ -38,7 +38,7 @@ struct sBox {
static sBox boxes[10];
static DWORD boxesEnabled[5];
#define tSize 28
#define tSize (28)
struct tBox {
DWORD hasText;
DWORD color;
@@ -49,6 +49,10 @@ static tBox boxText[5];
static DWORD clrBakup[5];
static bool setCustomBoxText;
static const DWORD bboxMemAddr[] = {
0x461266, 0x4612AC, 0x461374, 0x4613E8, 0x461479, 0x46148C, 0x4616BB,
};
static void __declspec(naked) DisplayBoxesHook() {
__asm {
mov ebx, 0;
@@ -73,22 +77,22 @@ fail:
static void __declspec(naked) BarBoxesTextHack() {
__asm {
//mov ecx, [esp+0x440-0x1C];
push ecx; // ecx = BoxIndex
//mov ecx, [esp + 0x440 - 0x1C];
push ecx; // ecx = BoxIndex
sub ecx, 5;
imul ecx, tSize;
cmp boxText[ecx], 1; // .hasText
cmp boxText[ecx], 1; // .hasText
jnz end;
// get color
mov ebx, boxText[ecx+4]; // .color
mov ebx, boxText[ecx + 4]; // .color
// set text
lea eax, [boxText+ecx+8]; // .text
lea eax, [boxText + ecx + 8]; // .text
// set color
pop ecx;
imul ecx, sSize;
cmp boxes[ecx+4], 2; // .colour
cmp boxes[ecx + 4], 2; // .colour
jb skip;
mov [esp+0x440-0x20], ebx; // Color
mov [esp + 0x440 - 0x20], ebx; // Color
skip:
retn;
end:
@@ -114,6 +118,23 @@ static void ReconstructBarBoxes() {
}
}
static void ResetBoxes() {
for (int i = 0; i < 5; i++) {
boxesEnabled[i] = 0;
boxes[i + 5].colour = clrBakup[i];
}
if (!setCustomBoxText) return;
//Restore boxes
SafeWrite32(0x461343, 0x00023D05); // call getmsg_
ReconstructBarBoxes();
SafeWrite8(0x461243, 0x31);
SafeWrite32(0x461244, 0x249489D2);
setCustomBoxText = false;
}
void BarBoxes::SetText(int box, const char* text, DWORD color) {
boxes[box].colour = color;
box -= 5;
@@ -122,23 +143,23 @@ void BarBoxes::SetText(int box, const char* text, DWORD color) {
DWORD clr;
switch (color) {
case 2:
clr = fo::var::WhiteColor;
break;
case 3:
clr = fo::var::YellowColor;
break;
case 4:
clr = fo::var::PeanutButter;
break;
case 5:
clr = fo::var::BlueColor;
break;
case 6:
clr = fo::var::GoodColor;
break;
default:
clr = fo::var::GreenColor;
case 2:
clr = fo::var::WhiteColor;
break;
case 3:
clr = fo::var::YellowColor;
break;
case 4:
clr = fo::var::PeanutButter;
break;
case 5:
clr = fo::var::BlueColor;
break;
case 6:
clr = fo::var::GoodColor;
break;
default:
clr = fo::var::GreenColor;
}
boxText[box].color = clr;
@@ -159,32 +180,13 @@ void BarBoxes::SetText(int box, const char* text, DWORD color) {
for (int i = 0; i < 5; i++) {
boxesEnabled[i] = enabled[i];
}
__asm call refresh_box_bar_win_;
}
static void ResetBoxes() {
for (int i = 0; i < 5; i++) {
boxesEnabled[i] = 0;
boxes[i + 5].colour = clrBakup[i];
}
if (!setCustomBoxText) return;
//Restore boxes
SafeWrite32(0x461343, 0x23D05); // call
ReconstructBarBoxes();
SafeWrite8(0x461243, 0x31);
SafeWrite32(0x461244, 0x249489D2);
setCustomBoxText = false;
__asm call fo::funcoffs::refresh_box_bar_win_;
}
void BarBoxes::init() {
DWORD addr[] = {0x461266, 0x4612AC, 0x461374, 0x4613E8, 0x461479, 0x46148C, 0x4616BB};
for (int i = 0; i < 7; i++)
SafeWrite32(addr[i], (DWORD)boxes + 8); //.mem
SafeWrite32(0x4612FE, (DWORD)boxes + 4); //.colour
SafeWrite32(0x46133C, (DWORD)boxes); //.msg
SafeWriteBatch<DWORD>((DWORD)boxes + 8, bboxMemAddr); //.mem
SafeWrite32(0x4612FE, (DWORD)boxes + 4); //.colour
SafeWrite32(0x46133C, (DWORD)boxes); //.msg
int size = sSize * 10;
memset(boxes, 0, size);
@@ -206,8 +208,9 @@ void BarBoxes::init() {
if (boxBarColors[i] == '1') {
boxes[i + 5].colour = 1;
clrBakup[i] = 1;
} else
} else {
clrBakup[i] = 0;
}
}
}
@@ -228,4 +231,5 @@ void _stdcall RemoveBox(int i) {
if (i < 5 || i > 9) return;
boxesEnabled[i - 5] = 0;
}
}
@@ -463,7 +463,7 @@ void sf_set_iface_tag_text(OpcodeContext& ctx) {
if (boxTag > 4 && boxTag < 10) {
BarBoxes::SetText(boxTag, ctx.arg(1).asString(), ctx.arg(2).asInt());
} else {
ctx.printOpcodeError("set_iface_tag_text: value of TagId should be range from 5 to 9.");
ctx.printOpcodeError("set_iface_tag_text() - tag value must be in the range of 5 to 9.");
}
}
+3 -3
View File
@@ -24,13 +24,13 @@
#define VERSION_MAJOR 4
#define VERSION_MINOR 0
#define VERSION_BUILD 4
#define VERSION_BUILD 5
#define VERSION_REV 0
#ifdef WIN2K
#define VERSION_STRING "4.0.4 win2k"
#define VERSION_STRING "4.0.5 win2k"
#else
#define VERSION_STRING "4.0.4"
#define VERSION_STRING "4.0.5"
#endif
#define CHECK_VAL (4)