Skip to content

Commit

Permalink
- add cursor position to game's getProperty
Browse files Browse the repository at this point in the history
- eval formulas in game.getProperty
- refactor GameUtils::get*Property
- update gamefiles (rework inventory stash item pick wheybags/freeablo#353 wheybags/freeablo#358)
  • Loading branch information
dgcor committed Jan 20, 2019
1 parent 1e92d9e commit 1bb84ce
Show file tree
Hide file tree
Showing 33 changed files with 558 additions and 543 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ set(SOURCE_FILES
src/TextUtils.h
src/TileSet.cpp
src/TileSet.h
src/UIObject.cpp
src/UIObject.h
src/Variable.cpp
src/Variable.h
Expand Down
1 change: 1 addition & 0 deletions DGEngine.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
<ClCompile Include="src\TexturePacks\VectorTexturePack.cpp" />
<ClCompile Include="src\TextUtils.cpp" />
<ClCompile Include="src\TileSet.cpp" />
<ClCompile Include="src\UIObject.cpp" />
<ClCompile Include="src\Utils\Utils.cpp" />
<ClCompile Include="src\Variable.cpp" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions android/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ LOCAL_SRC_FILES += TextUtils.cpp
LOCAL_SRC_FILES += TextUtils.h
LOCAL_SRC_FILES += TileSet.cpp
LOCAL_SRC_FILES += TileSet.h
LOCAL_SRC_FILES += UIObject.cpp
LOCAL_SRC_FILES += UIObject.h
LOCAL_SRC_FILES += Variable.cpp
LOCAL_SRC_FILES += Variable.h
Expand Down
41 changes: 1 addition & 40 deletions gamefilesd/res/level/actions/playerStash.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,46 +126,7 @@
"load": ["res/level/actions/inventoryText.json", "Stash102", "stash", "9,1"],
"load": ["res/level/actions/inventoryText.json", "Stash103", "stash", "9,2"],
"load": ["res/level/actions/inventoryText.json", "Stash104", "stash", "9,3"],
"load": ["res/level/actions/stashClick.json", "Stash11", "0,0"],
"load": ["res/level/actions/stashClick.json", "Stash12", "0,1"],
"load": ["res/level/actions/stashClick.json", "Stash13", "0,2"],
"load": ["res/level/actions/stashClick.json", "Stash14", "0,3"],
"load": ["res/level/actions/stashClick.json", "Stash21", "1,0"],
"load": ["res/level/actions/stashClick.json", "Stash22", "1,1"],
"load": ["res/level/actions/stashClick.json", "Stash23", "1,2"],
"load": ["res/level/actions/stashClick.json", "Stash24", "1,3"],
"load": ["res/level/actions/stashClick.json", "Stash31", "2,0"],
"load": ["res/level/actions/stashClick.json", "Stash32", "2,1"],
"load": ["res/level/actions/stashClick.json", "Stash33", "2,2"],
"load": ["res/level/actions/stashClick.json", "Stash34", "2,3"],
"load": ["res/level/actions/stashClick.json", "Stash41", "3,0"],
"load": ["res/level/actions/stashClick.json", "Stash42", "3,1"],
"load": ["res/level/actions/stashClick.json", "Stash43", "3,2"],
"load": ["res/level/actions/stashClick.json", "Stash44", "3,3"],
"load": ["res/level/actions/stashClick.json", "Stash51", "4,0"],
"load": ["res/level/actions/stashClick.json", "Stash52", "4,1"],
"load": ["res/level/actions/stashClick.json", "Stash53", "4,2"],
"load": ["res/level/actions/stashClick.json", "Stash54", "4,3"],
"load": ["res/level/actions/stashClick.json", "Stash61", "5,0"],
"load": ["res/level/actions/stashClick.json", "Stash62", "5,1"],
"load": ["res/level/actions/stashClick.json", "Stash63", "5,2"],
"load": ["res/level/actions/stashClick.json", "Stash64", "5,3"],
"load": ["res/level/actions/stashClick.json", "Stash71", "6,0"],
"load": ["res/level/actions/stashClick.json", "Stash72", "6,1"],
"load": ["res/level/actions/stashClick.json", "Stash73", "6,2"],
"load": ["res/level/actions/stashClick.json", "Stash74", "6,3"],
"load": ["res/level/actions/stashClick.json", "Stash81", "7,0"],
"load": ["res/level/actions/stashClick.json", "Stash82", "7,1"],
"load": ["res/level/actions/stashClick.json", "Stash83", "7,2"],
"load": ["res/level/actions/stashClick.json", "Stash84", "7,3"],
"load": ["res/level/actions/stashClick.json", "Stash91", "8,0"],
"load": ["res/level/actions/stashClick.json", "Stash92", "8,1"],
"load": ["res/level/actions/stashClick.json", "Stash93", "8,2"],
"load": ["res/level/actions/stashClick.json", "Stash94", "8,3"],
"load": ["res/level/actions/stashClick.json", "Stash101", "9,0"],
"load": ["res/level/actions/stashClick.json", "Stash102", "9,1"],
"load": ["res/level/actions/stashClick.json", "Stash103", "9,2"],
"load": ["res/level/actions/stashClick.json", "Stash104", "9,3"],
"load": "res/level/actions/stashClick.json",
"load": ["res/level/actions/hoverLeave.json", "Stash11"],
"load": ["res/level/actions/hoverLeave.json", "Stash12"],
"load": ["res/level/actions/hoverLeave.json", "Stash13"],
Expand Down
53 changes: 39 additions & 14 deletions gamefilesd/res/level/actions/stashClick.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
{
"action": {
"name": "action.set",
"id": "update{1}Click",
"action": [
{ "name": "item.update", "inventory": "stash", "item": [{2}] },
"updateStashItems",
{
"name": "if.equal",
"param1": "%currentLevel.currentPlayer.hasSelectedItem%",
"param2": true,
"then": "updateSelectedItem",
"else": "update{1}Text"
"action": [
{
"name": "action.set",
"id": "updateStashClick",
"action": {
"name": "loadJson",
"json": {
"replaceVars": "value",
"action": [
{ "name": "item.update", "inventory": "stash", "item": ["|stashPosX|", "|stashPosY|"] },
"updateStashItems",
{
"name": "if.equal",
"param1": "%currentLevel.currentPlayer.hasSelectedItem%",
"param2": true,
"then": "updateSelectedItem",
"else": "updateStash|$.game.var.stashPosX + 1||$.game.var.stashPosY + 1|Text"
}
]
}
}
]
}
},
{
"name": "action.set",
"id": "btnStashClick",
"action": [
{
"name": "variable.set",
"key": "stashPosX",
"value": "%$.:trunc(game.cursor.x - btnStash.position.x - (currentLevel.currentPlayer.selectedItem.inventorySize.x :nvl 1 - 1 * 14.5) / 29 * 10) * 0.1 :max 0 :min 9%"
},
{
"name": "variable.set",
"key": "stashPosY",
"value": "%$.:trunc(game.cursor.y - btnStash.position.y - (currentLevel.currentPlayer.selectedItem.inventorySize.y :nvl 1 - 1 * 14.5) / 29 * 10) * 0.1 :max 0 :min 3%"
},
"updateStashClick"
]
}
]
}
8 changes: 4 additions & 4 deletions gamefilesd/res/level/actions/stashItem.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"param2": false,
"then": [
{ "name": "variable.set", "key": "inventoryItemName", "value": "{1}" },
{ "name": "variable.set", "key": "inventoryItemPosX", "value": "%btn{1}.position.x%" },
{ "name": "variable.set", "key": "inventoryItemPosY", "value": "%btn{1}.position.y%" },
{ "name": "variable.set", "key": "inventoryItemPosX", "value": "%imgBk{1}.position.x%" },
{ "name": "variable.set", "key": "inventoryItemPosY", "value": "%imgBk{1}.position.y%" },
"drawInventoryItem"
]
},
Expand Down Expand Up @@ -58,8 +58,8 @@
"name": "if.equal",
"param1": "%currentLevel.currentPlayer.hasItem.{2}.{3}%",
"param2": true,
"then": { "name": "image.setTexture", "id": "btn{1}", "texture": "red" },
"else": { "name": "image.setTexture", "id": "btn{1}", "texture": "empty" }
"then": { "name": "image.setTexture", "id": "imgBk{1}", "texture": "red" },
"else": { "name": "image.setTexture", "id": "imgBk{1}", "texture": "empty" }
}
]
}
Expand Down
Loading

0 comments on commit 1bb84ce

Please sign in to comment.