diff --git a/MPClient/DebugEditor.Designer.cs b/MPClient/DebugEditor.Designer.cs index c9ce1dae4..73b61bc9e 100644 --- a/MPClient/DebugEditor.Designer.cs +++ b/MPClient/DebugEditor.Designer.cs @@ -23,7 +23,6 @@ protected override void Dispose(bool disposing) { /// the contents of this method with the code editor. /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.Column0 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); diff --git a/MPClient/DebugEditor.cs b/MPClient/DebugEditor.cs index a90511135..14ea6f9f3 100644 --- a/MPClient/DebugEditor.cs +++ b/MPClient/DebugEditor.cs @@ -231,6 +231,9 @@ private void bEdit_Click(object sender, EventArgs e) { BinaryReader br = new BinaryReader(new MemoryStream(buf)); for (int j = 0; j < strings.Length; j++) { switch (types[j]) { + case DataType.None: + br.BaseStream.Position += 4; + break; case DataType.Int: strings[j] = br.ReadInt32().ToString(); break; @@ -250,6 +253,9 @@ private void bEdit_Click(object sender, EventArgs e) { BinaryWriter bw = new BinaryWriter(ms); for (int j = 0; j < strings.Length; j++) { switch (types[j]) { + case DataType.None: + bw.BaseStream.Position += 4; + break; case DataType.Int: bw.Write(int.Parse(strings[j])); break; diff --git a/sfall/Arrays.cpp b/sfall/Arrays.cpp index f6d637d0e..919d2acff 100644 --- a/sfall/Arrays.cpp +++ b/sfall/Arrays.cpp @@ -338,6 +338,9 @@ void DESetArray(int id, const DWORD* types, const char* data) { for (size_t i = 0; i < arrays[id].val.size(); i++) { sArrayElement& arVal = arrays[id].val[i]; switch (arVal.type) { + case DATATYPE_NONE: + pos += 4; + break; case DATATYPE_INT: arVal.intVal = *(long*)(data + pos); pos += 4; diff --git a/sfall/Bugs.cpp b/sfall/Bugs.cpp index b9d80156e..3db7cc1c0 100644 --- a/sfall/Bugs.cpp +++ b/sfall/Bugs.cpp @@ -2536,12 +2536,12 @@ void BugsInit() HookCall(0x499212, PrintAutoMapList); // PrintAMList_ HookCall(0x499013, PrintAutoMapList); // PrintAMelevList_ + // Fix "out of bounds" bug when printing the automap list + HookCall(0x499240, PrintAMList_hook); + // Fix for a duplicate obj_dude script being created when loading a saved game HookCall(0x48D63E, obj_load_dude_hook0); HookCall(0x48D666, obj_load_dude_hook1); BlockCall(0x48D675); BlockCall(0x48D69D); - - // Fix "out of bounds" bug when printing the automap list - HookCall(0x499240, PrintAMList_hook); } diff --git a/sfall/Perks.cpp b/sfall/Perks.cpp index db53c05f2..14b68240e 100644 --- a/sfall/Perks.cpp +++ b/sfall/Perks.cpp @@ -85,7 +85,7 @@ std::vector fakeTraits; std::vector fakePerks; std::vector fakeSelectablePerks; -static std::list RemoveTraitID; +static long RemoveTraitID = -1; static std::list RemovePerkID; static std::list RemoveSelectableID; @@ -566,7 +566,7 @@ static void _stdcall AddFakePerk(DWORD perkID) { } } if (!matched) { - RemoveTraitID.push_back(fakeTraits.size()); + if (RemoveTraitID == -1) RemoveTraitID = fakeTraits.size(); fakeTraits.push_back(fakeSelectablePerks[perkID]); } } @@ -1134,16 +1134,14 @@ void _stdcall ClearSelectablePerks() { } void PerksEnterCharScreen() { - RemoveTraitID.clear(); + RemoveTraitID = -1; RemovePerkID.clear(); RemoveSelectableID.clear(); } void PerksCancelCharScreen() { - if (RemoveTraitID.size() > 1) RemoveTraitID.sort(); - while (!RemoveTraitID.empty()) { - fakeTraits.erase(fakeTraits.begin() + RemoveTraitID.back()); - RemoveTraitID.pop_back(); + if (RemoveTraitID != -1) { + fakeTraits.erase(fakeTraits.begin() + RemoveTraitID, fakeTraits.end()); } if (RemovePerkID.size() > 1) RemovePerkID.sort(); // sorting to correctly remove from the end while (!RemovePerkID.empty()) { diff --git a/sfall/input.h b/sfall/input.h index 8f4e9e653..e84fae2db 100644 --- a/sfall/input.h +++ b/sfall/input.h @@ -30,6 +30,8 @@ void _stdcall TapKey(DWORD key); void GetMouse(int* x, int* y); +void _stdcall ForceGraphicsRefresh(DWORD); + #define DIK_ESCAPE 0x01 #define DIK_1 0x02 #define DIK_2 0x03 @@ -176,5 +178,3 @@ void GetMouse(int* x, int* y); * Alternate names for keys originally not used on US keyboards. */ #define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */ - -void _stdcall ForceGraphicsRefresh(DWORD);