Skip to content

Commit

Permalink
Fixed issue with ConditionRemove
Browse files Browse the repository at this point in the history
Removed ImGui UI
Added Lock Cursor option
  • Loading branch information
DMD authored and DMD committed Mar 6, 2017
1 parent 94e90f9 commit 048d080
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 21 deletions.
11 changes: 11 additions & 0 deletions Configurator/IniViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class IniViewModel : DependencyObject
public static readonly DependencyProperty SoftShadowsProperty = DependencyProperty.Register(
"SoftShadows", typeof (bool), typeof (IniViewModel), new PropertyMetadata(default(bool)));

public static readonly DependencyProperty WindowedLockCursorProperty = DependencyProperty.Register(
"WindowedLockCursor", typeof(bool), typeof(IniViewModel), new PropertyMetadata(default(bool)));

public static readonly DependencyProperty HpOnLevelUpProperty = DependencyProperty.Register(
"HpOnLevelUp", typeof (HpOnLevelUpType), typeof (IniViewModel),
new PropertyMetadata(default(HpOnLevelUpType)));
Expand Down Expand Up @@ -131,6 +134,12 @@ public bool SoftShadows
set { SetValue(SoftShadowsProperty, value); }
}

public bool WindowedLockCursor
{
get { return (bool)GetValue(WindowedLockCursorProperty); }
set { SetValue(WindowedLockCursorProperty, value); }
}

public HpOnLevelUpType HpOnLevelUp
{
get { return (HpOnLevelUpType) GetValue(HpOnLevelUpProperty); }
Expand Down Expand Up @@ -275,6 +284,7 @@ public void LoadFromIni(IniData iniData)
SoftShadows = tpData["softShadows"] == "true";
AntiAliasing = tpData["antialiasing"] == "true";
WindowedMode = tpData["windowed"] == "true";
WindowedLockCursor = tpData["windowedLockCursor"] == "true";

int maxLevel;
if (int.TryParse(tpData["maxLevel"], out maxLevel))
Expand Down Expand Up @@ -373,6 +383,7 @@ public void SaveToIni(IniData iniData)
tpData["windowHeight"] = RenderHeight.ToString();
tpData["antialiasing"] = AntiAliasing? "true" : "false";
tpData["softShadows"] = SoftShadows ? "true" : "false";
tpData["windowedLockCursor"] = WindowedLockCursor ? "true" : "false";
tpData["maxLevel"] = MaxLevel.ToString();
tpData["allowXpOverflow"] = AllowXpOverflow ? "true" : "false";
tpData["slowerLevelling"] = SlowerLevelling ? "true" : "false";
Expand Down
1 change: 1 addition & 0 deletions Configurator/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<CheckBox VerticalAlignment="Center" Content="Disable Automatic Updates" IsChecked="{Binding DisableAutomaticUpdates}" Margin="0,5,0,5" />
<CheckBox VerticalAlignment="Center" Content="Anti Aliasing" IsChecked="{Binding AntiAliasing}" Margin="0,5,0,5" ToolTip="You may have to disable this if you have an integrated GPU." />
<CheckBox VerticalAlignment="Center" Content="Enable Soft Shadows (GPU intensive)" IsChecked="{Binding SoftShadows}" Margin="0,5,0,5" />
<CheckBox VerticalAlignment="Center" Content="Lock Cursor to Window" IsChecked="{Binding WindowedLockCursor}" Margin="0,5,0,5" ToolTip="Locks the cursor to the window area when using windowed mode and the window is active."/>

<StackPanel Orientation="Horizontal" Margin="0,5,0,5">
<Label VerticalAlignment="Center" Content="Max Level:"/>
Expand Down
38 changes: 20 additions & 18 deletions TemplePlus/dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,29 +548,31 @@ void DispatcherSystem::DispatchConditionRemove(Dispatcher* dispatcher, CondNode*
{
for (auto subDispNode = dispatcher->subDispNodes[dispTypeConditionRemove]; subDispNode; subDispNode = subDispNode->next)
{
if (subDispNode->subDispDef->dispKey == 0)
{
DispatcherCallbackArgs dca;
dca.dispIO = nullptr;
dca.dispType = dispTypeConditionRemove;
dca.dispKey = 0;
dca.objHndCaller = dispatcher->objHnd;
dca.subDispNode = subDispNode;
subDispNode->subDispDef->dispCallback(dca.subDispNode, dca.objHndCaller, dca.dispType, dca.dispKey, dca.dispIO);
if (subDispNode->subDispDef->dispKey == 0){
if (!(subDispNode->condNode->flags & 1) && (subDispNode->condNode == cond)){
DispatcherCallbackArgs dca;
dca.dispIO = nullptr;
dca.dispType = dispTypeConditionRemove;
dca.dispKey = 0;
dca.objHndCaller = dispatcher->objHnd;
dca.subDispNode = subDispNode;
subDispNode->subDispDef->dispCallback(dca.subDispNode, dca.objHndCaller, dca.dispType, dca.dispKey, dca.dispIO);
}
}
}

for (auto subDispNode = dispatcher->subDispNodes[dispTypeConditionRemove2]; subDispNode; subDispNode = subDispNode->next)
{
if (subDispNode->subDispDef->dispKey == 0)
{
DispatcherCallbackArgs dca;
dca.dispIO = nullptr;
dca.dispType = dispTypeConditionRemove2;
dca.dispKey = 0;
dca.objHndCaller = dispatcher->objHnd;
dca.subDispNode = subDispNode;
subDispNode->subDispDef->dispCallback(dca.subDispNode, dca.objHndCaller, dca.dispType, dca.dispKey, dca.dispIO);
if (subDispNode->subDispDef->dispKey == 0){
if (!(subDispNode->condNode->flags & 1) && (subDispNode->condNode == cond)) {
DispatcherCallbackArgs dca;
dca.dispIO = nullptr;
dca.dispType = dispTypeConditionRemove2;
dca.dispKey = 0;
dca.objHndCaller = dispatcher->objHnd;
dca.subDispNode = subDispNode;
subDispNode->subDispDef->dispCallback(dca.subDispNode, dca.objHndCaller, dca.dispType, dca.dispKey, dca.dispIO);
}
}
}
cond->flags |= 1;
Expand Down
2 changes: 1 addition & 1 deletion TemplePlus/mainloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void GameLoop::RenderFrame() {
tig->GetShapeRenderer2d().DrawRectangle(0, 0, w, h, gfadeColor);
}

ImGui::ShowTestWindow();
// ImGui::ShowTestWindow();

tig->GetConsole().Render();

Expand Down
4 changes: 2 additions & 2 deletions TemplePlus/spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1940,8 +1940,8 @@ uint32_t LegacySpellSystem::spellCanCast(objHndl objHnd, uint32_t spellEnum, uin
&& spellSys.GetCastingClass(classCodesVec[i] ) == classEnum
&& spellLevelsVec[i] <= (int)spellLevel)
{
if (spellLevelsVec[i] < (int)spellLevel)
logger->info("Natural Spell Caster spellCanCast check - spell known is lower level than spellCanCast queried spell. Is this ok?? (this is vanilla code here...)");
//if (spellLevelsVec[i] < (int)spellLevel)
// logger->info("Natural Spell Caster spellCanCast check - spell known is lower level than spellCanCast queried spell. Is this ok?? (this is vanilla code here...)"); // yes
return 1;
}

Expand Down

0 comments on commit 048d080

Please sign in to comment.