Removed KeepWeaponSelectMode from ddraw.ini (always enabled)

Minor edits to code and documents.
This commit is contained in:
NovaRain
2020-09-16 10:53:39 +08:00
parent a9cde5757f
commit 2eb1c64bc3
5 changed files with 24 additions and 28 deletions
-3
View File
@@ -704,9 +704,6 @@ WorldMapFontPatch=0
;Requires changing the color of subtitles in death.pal palette to white color (index 220) to display the text correctly
DeathScreenFontPatch=0
;Set to 1 to keep the selected attack mode when moving the weapon between active item slots
KeepWeaponSelectMode=1
;Set to 1 to display full item description for weapon/ammo in the barter screen
FullItemDescInBarter=0
+2 -1
View File
@@ -4,7 +4,8 @@
As well as the new functions, sfall also adds global scripts. These run independent of any loaded maps, but do not have an attached object. (i.e. using self_obj without using set_self first will crash the script.) To use a global script, the script must have a name which begins with 'gl' and contains a procedure called 'start', 'map_enter_p_proc', 'map_exit_p_proc', or 'map_update_p_proc'. The start procedure will be executed once when the player loads a saved game or starts a new game. The map_*_p_proc procedures will be executed once when a map is being entered/left/updated. If you wish the script to be executed repeatedly, call set_global_script_repeat on the first run of the start procedure using the number of frames between each run as the argument. (0 disables the script, 1 runs it every frame, 2 runs it every other frame etc.)
Global scripts have multiple modes, which can be set using the set_global_script_type function. In the default mode (i.e. mode 0) their execution is linked to the local map game loop, so the script will not run in dialogs or on the world map. In mode 1 their execution is linked to the player input, and so they will run whenever the mouse cursor is visible on screen, including the world map, character dialogs etc. In mode 2, execution is linked to the world map loop, so the script will only be executed on the world map and not on the local map or in any dialog windows. Mode 3 is a combination of modes 0 and 2, so scripts will be executed on both local maps and the world map, but not in dialog windows. Using mode 1 requires the input wrapper to be enabled. Use available_global_script_types to check what is available.
Global scripts have multiple modes, which can be set using the set_global_script_type function. In the default mode (i.e. mode 0) their execution is linked to the local map game loop, so the script will not run in dialogs or on the world map. In mode 1 their execution is linked to the player input, and so they will run whenever the mouse cursor is visible on screen, including the world map, character dialogs etc. In mode 2, execution is linked to the world map loop, so the script will only be executed on the world map and not on the local map or in any dialog windows. Mode 3 is a combination of modes 0 and 2, so scripts will be executed on both local maps and the world map, but not in dialog windows.
[Using mode 1 requires the input wrapper to be enabled. Use available_global_script_types to check what is available.] - Obsolete.
+1 -1
View File
@@ -274,7 +274,7 @@ public:
if (DeviceType != kDeviceType_KEYBOARD) {
return RealDevice->GetDeviceData(a, buf, count, d);
}
if (!buf && !d && *count == INFINITE) { // flush
if (*count == INFINITE && !buf && !d) { // flush
while (!bufferedPresses.empty()) bufferedPresses.pop();
return RealDevice->GetDeviceData(a, buf, count, d);
}
+1 -1
View File
@@ -202,7 +202,7 @@ const float* Graphics::rcpresGet() {
static void GetDisplayMode(D3DDISPLAYMODE &ddm) {
ZeroMemory(&ddm, sizeof(ddm));
d3d9->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &ddm);
dlog_f("Display mode format id: %d\n", DL_INIT, ddm.Format);
dlog_f("Display mode format ID: %d\n", DL_INIT, ddm.Format);
}
static void ResetDevice(bool createNew) {
+20 -22
View File
@@ -217,39 +217,37 @@ static void __declspec(naked) display_stats_hook() {
}
}
static void __fastcall SwapHandSlots(fo::GameObject* item, DWORD* toSlot) {
if (fo::GetItemType(item) != fo::item_type_weapon && *toSlot
&& fo::GetItemType((fo::GameObject*)*toSlot) != fo::item_type_weapon) {
static void __fastcall SwapHandSlots(fo::GameObject* item, fo::GameObject* &toSlot) {
if (toSlot && fo::GetItemType(item) != fo::item_type_weapon && fo::GetItemType(toSlot) != fo::item_type_weapon) {
return;
}
fo::ItemButtonItem* leftSlot = &fo::var::itemButtonItems[0];
fo::ItemButtonItem* rightSlot = &fo::var::itemButtonItems[1];
DWORD* leftSlot = (DWORD*)FO_VAR_itemButtonItems;
DWORD* rightSlot = leftSlot + 6;
if (*toSlot == 0) { //copy to slot
DWORD* slot;
if (toSlot == nullptr) { // copy to slot
fo::ItemButtonItem* slot;
fo::ItemButtonItem item[1];
if ((int)toSlot == FO_VAR_i_lhand) {
memcpy(item, rightSlot, 0x14);
if ((int)&toSlot == FO_VAR_i_lhand) {
std::memcpy(item, rightSlot, 0x14);
item[0].primaryAttack = fo::AttackType::ATKTYPE_LWEAPON_PRIMARY;
item[0].secondaryAttack = fo::AttackType::ATKTYPE_LWEAPON_SECONDARY;
slot = leftSlot; // Rslot > Lslot
} else {
memcpy(item, leftSlot, 0x14);
std::memcpy(item, leftSlot, 0x14);
item[0].primaryAttack = fo::AttackType::ATKTYPE_RWEAPON_PRIMARY;
item[0].secondaryAttack = fo::AttackType::ATKTYPE_RWEAPON_SECONDARY;
slot = rightSlot; // Lslot > Rslot;
}
memcpy(slot, item, 0x14);
} else { // swap slot
auto swapBuf = fo::var::itemButtonItems;
swapBuf[0].primaryAttack = fo::AttackType::ATKTYPE_RWEAPON_PRIMARY;
swapBuf[0].secondaryAttack = fo::AttackType::ATKTYPE_RWEAPON_SECONDARY;
swapBuf[1].primaryAttack = fo::AttackType::ATKTYPE_LWEAPON_PRIMARY;
swapBuf[1].secondaryAttack = fo::AttackType::ATKTYPE_LWEAPON_SECONDARY;
std::memcpy(slot, item, 0x14);
} else { // swap slots
auto hands = fo::var::itemButtonItems;
hands[0].primaryAttack = fo::AttackType::ATKTYPE_RWEAPON_PRIMARY;
hands[0].secondaryAttack = fo::AttackType::ATKTYPE_RWEAPON_SECONDARY;
hands[1].primaryAttack = fo::AttackType::ATKTYPE_LWEAPON_PRIMARY;
hands[1].secondaryAttack = fo::AttackType::ATKTYPE_LWEAPON_SECONDARY;
memcpy(leftSlot, &swapBuf[1], 0x14); // buf Rslot > Lslot
memcpy(rightSlot, &swapBuf[0], 0x14); // buf Lslot > Rslot
std::memcpy(leftSlot, &hands[1], 0x14); // Rslot > Lslot
std::memcpy(rightSlot, &hands[0], 0x14); // Lslot > Rslot
}
}
@@ -641,11 +639,11 @@ static void DisplaySecondWeaponRangePatch() {
}
static void KeepWeaponSelectModePatch() {
if (GetConfigInt("Misc", "KeepWeaponSelectMode", 1)) {
//if (GetConfigInt("Misc", "KeepWeaponSelectMode", 1)) {
dlog("Applying keep weapon select mode patch.", DL_INIT);
MakeCall(0x4714EC, switch_hand_hack, 1);
dlogr(" Done", DL_INIT);
}
//}
}
static void PartyMemberSkillPatch() {