diff --git a/artifacts/scripting/sfall function notes.txt b/artifacts/scripting/sfall function notes.txt index 445f34a2..620f8078 100644 --- a/artifacts/scripting/sfall function notes.txt +++ b/artifacts/scripting/sfall function notes.txt @@ -26,7 +26,7 @@ The graphics functions are only available if the user is using graphics mode 4 o load_shader takes a path relative to the data\shaders\ directory as an argument and returns a shader ID. That ID should be passed as the first argument to all other shader functions, and is valid until free_shader is called on the ID, the player loads a saved game or the player quits to the main menu. -get_shader_version gives you the highest shader version supported by the players graphics cards. Possible return values are 11, 12, 13, 14, 20, 21 and 30. +get_shader_version gives you the highest shader version supported by the player's graphics cards. Possible return values are 11, 12, 13, 14, 20, 21 and 30. set_shader_mode tells sfall when to use a shader. The parameter is a set of 32 flags which specify the screens on which the shader will be disabled, unless bit 32 is set, in which case the shader will only be active on those screens. Remember that screens are displayed on top of each other; if the player opens the character menu which in combat, the game still considers the player to be in combat. See sfall.h for a list of defines. @@ -373,7 +373,7 @@ Some utility/math functions are available: - executes map_update_p_proc for all objects on map and global/hook scripts as well > void sfall_func2("set_ini_setting", string setting, int/string value) -- writes an integer or a string value to an ini file in the Fallout directory. If the ini file doesn't exist, it will be created +- writes an integer or a string value to an ini file in the Fallout directory. If the ini file does not exist, it will be created - The setting argument works in the same way as in get_ini_setting; seperate the file name, section and key with a '|' character; e.g. 'set_ini_setting("myini.ini|mysec|var1", 42)' - The file name is limited to 63 chars, including the extension - The section name is limited to 32 characters diff --git a/sfall/BarBoxes.cpp b/sfall/BarBoxes.cpp index 2b91dda6..4d5c8e4f 100644 --- a/sfall/BarBoxes.cpp +++ b/sfall/BarBoxes.cpp @@ -21,8 +21,8 @@ #include "BarBoxes.h" #include "FalloutEngine.h" -static const DWORD DisplayBoxesRet1=0x4615A8; -static const DWORD DisplayBoxesRet2=0x4615BE; +static const DWORD DisplayBoxesRet1 = 0x4615A8; +static const DWORD DisplayBoxesRet2 = 0x4615BE; struct sBox { DWORD msg; DWORD colour; @@ -35,15 +35,15 @@ static void __declspec(naked) DisplayBoxesHook() { __asm { mov ebx, 0; start: - mov eax, boxesEnabled[ebx*4]; + mov eax, boxesEnabled[ebx * 4]; test eax, eax; jz next; - lea eax, [ebx+5]; + lea eax, [ebx + 5]; call add_bar_box_; add esi, eax; next: inc ebx; - cmp ebx, 4; + cmp ebx, 5; jne start; cmp esi, 1; jle fail; @@ -65,11 +65,13 @@ void BarBoxesInit() { SafeWrite32(0x46148C, (DWORD)boxes + 8); SafeWrite32(0x4616BB, (DWORD)boxes + 8); - memset(boxes, 0, 12*10); - memset(boxesEnabled, 0, 5*4); - memcpy(boxes, (void*)0x518FE8, 12*5); - - for(int i=5;i<10;i++) boxes[i].msg=0x69 + i - 5; + memset(boxes, 0, 12 * 10); + memset(boxesEnabled, 0, 5 * 4); + memcpy(boxes, (void*)0x518FE8, 12 * 5); + + for (int i = 5; i < 10; i++) { + boxes[i].msg = 0x69 + i - 5; + } SafeWrite8(0x46127C, 10); SafeWrite8(0x46140B, 10); @@ -78,22 +80,26 @@ void BarBoxesInit() { MakeJump(0x4615A3, DisplayBoxesHook); char buf[6]; GetPrivateProfileString("Misc", "BoxBarColours", "", buf, 6, ini); - if(strlen(buf)==5) { - for(int i=0;i<5;i++) { - if(buf[i]=='1') boxes[i+5].colour=1; + if (strlen(buf) == 5) { + for (int i = 0; i < 5; i++) { + if (buf[i] == '1') { + boxes[i + 5].colour = 1; + } } } } -int _stdcall GetBox(int i) { - if(i<5||i>9) return 0; - return boxesEnabled[i-5]; +int _stdcall GetBox(int i) { + if (i < 5 || i > 9) return 0; + return boxesEnabled[i - 5]; } -void _stdcall AddBox(int i) { - if(i<5||i>9) return; - boxesEnabled[i-5]=1; + +void _stdcall AddBox(int i) { + if (i < 5 || i > 9) return; + boxesEnabled[i - 5] = 1; +} + +void _stdcall RemoveBox(int i) { + if (i < 5 || i > 9) return; + boxesEnabled[i - 5] = 0; } -void _stdcall RemoveBox(int i) { - if(i<5||i>9) return; - boxesEnabled[i-5]=0; -} \ No newline at end of file