Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Исправления #35

Merged
merged 9 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Gui/Aim.fogui
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"IsVerticalScroll": false,
"IsHorizontalScroll": false,
"Expanded": true,
"Selected": false,
"Selected": true,
"Active": true,
"Name": "Aim",
"Position": "0, 0",
Expand All @@ -23,7 +23,7 @@
"IsNotHittable": false,
"CheckTransparentOnHit": false,
"GlobalScope": "",
"ClassFields": "ident TargetCritterId;\r\n\r\nstring GetChance( int loc )\r\n{\r\n Critter@ chosen = Game.GetChosen();\r\n Critter@ cr = Game.GetCritter( cast< Aim >( Screen ).TargetCritterId );\r\n if( cr is null )\r\n return \"\";\r\n Item@ item = chosen.GetItem( ItemProperty::CritterSlot, CritterItemSlot::Main );\r\n uint8 mode = item.Mode;\r\n uint8 use = _WeaponModeUse( mode );\r\n uint8 aim = _WeaponModeAim( mode );\r\n mode = _WeaponModeMake( use, loc );\r\n int hit = ClientMain::to_hit( chosen, cr, item, mode );\r\n return hit == 0 ? \"-\" : \"\" + hit;\r\n}\r\n\r\nvoid OnHitLocationSelect( uint loc )\r\n{\r\n Game.HideScreen();\r\n Critter@ chosen = Game.GetChosen();\r\n ident targetCritterId = cast< Aim >( Screen ).TargetCritterId;\r\n Item@ item = chosen.GetItem( ItemProperty::CritterSlot, CritterItemSlot::Main );\r\n uint8 use = item.Mode & 0xF;\r\n uint8 mode = use | ( loc << 4 );\r\n ChosenActions::SetChosenActions( array< any > = { Tla::ChosenUseItem, item.Id, item.ProtoId.hash, TARGET_CRITTER, targetCritterId, mode, 0 } );\r\n} ",
"ClassFields": "ident TargetCritterId;\r\n\r\nstring GetChance( int loc )\r\n{\r\n Critter@ chosen = Game.GetChosen();\r\n Critter@ cr = Game.GetCritter( cast< Aim >( Screen ).TargetCritterId );\r\n if( cr is null )\r\n return \"\";\r\n Item@ item = chosen.GetItem( ItemProperty::CritterSlot, CritterItemSlot::Main );\r\n ProtoItem proto = CritterItem::GetSlotItemProto(chosen);\r\n uint8 mode = (item == null ? chosen.HandsItemMode : item.Mode);\r\n uint8 use = _WeaponModeUse( mode );\r\n uint8 aim = _WeaponModeAim( mode );\r\n mode = _WeaponModeMake( use, loc );\r\n int hit = ClientMain::to_hit( chosen, cr, proto, mode );\r\n return (hit == 0 ? \"-\" : \"\" + hit);\r\n}\r\n\r\nvoid OnHitLocationSelect( uint loc )\r\n{\r\n Game.HideScreen();\r\n Critter@ chosen = Game.GetChosen();\r\n ident targetCritterId = cast< Aim >( Screen ).TargetCritterId;\r\n Item@ item = chosen.GetItem( ItemProperty::CritterSlot, CritterItemSlot::Main );\r\n uint8 use = (item == null ? chosen.HandsItemMode : item.Mode) & 0xF;\r\n uint8 mode = use | ( loc << 4 );\r\n ChosenActions::SetChosenActions( array< any > = { Tla::ChosenUseItem, valid(item) ? item.Id : ZERO_IDENT, 0, TARGET_CRITTER, targetCritterId, mode, 0 } );\r\n} ",
"OnInit": "",
"OnShow": "if( params !is null )\r\n TargetCritterId = params[ \"TargetCritterId\" ];",
"OnHide": null,
Expand Down Expand Up @@ -80,7 +80,7 @@
"OnHide": null,
"OnAppear": null,
"OnDisappear": null,
"OnDraw": "Critter@ cr = Game.GetCritter( cast< Aim >( Screen ).TargetCritterId );\r\nif( cr is null )\r\n{\r\n Game.HideScreen();\r\n return;\r\n}\r\nstring name = hstring(CritterAnims::GetCritterAlias(cr.ModelName).str + \"na.frm\");\r\nSetBackgroundImage( name );",
"OnDraw": "Critter@ cr = Game.GetCritter( cast< Aim >( Screen ).TargetCritterId );\r\nif( cr is null )\r\n{\r\n Game.HideScreen();\r\n return;\r\n}\r\nstring name = hstring(CritterAnims::GetCritterAlias(cr.ModelName).str.replace(\"aa.frm\",\"na.frm\"));\r\nGame.Log(\"name picture \" + name);\r\nSetBackgroundImage( name );",
"OnPostDraw": null,
"OnMove": null,
"OnMouseDown": null,
Expand Down Expand Up @@ -178,7 +178,7 @@
"NormalColor": null,
"FocusedColor": null,
"Expanded": false,
"Selected": true,
"Selected": false,
"Active": true,
"Name": "ChanceHeadName",
"Position": "40, -3",
Expand Down Expand Up @@ -308,7 +308,7 @@
"GlobalScope": null,
"ClassFields": null,
"OnInit": null,
"OnShow": "Critter@ cr = Game.GetCritter( cast< Aim >( Screen ).TargetCritterId );\r\nif( cr !is null )\r\n Text = Game.GetText( TextPackName::Combat, 1000 + cr.CrTypeAlias * 10 + HitLocations::LocationEyes - 1 );\r\n\r\n",
"OnShow": "Critter@ cr = Game.GetCritter( cast< Aim >( Screen ).TargetCritterId );\r\nif( cr !is null )\r\n{\r\n Text = Game.GetText( TextPackName::Combat, 1000 + cr.CrTypeAlias * 10 + HitLocations::LocationEyes - 1 );\r\n Game.Log(\"CrTypeAlias \" + (1000 + cr.CrTypeAlias * 10 + HitLocations::LocationEyes - 1) );\r\n}\r\n\r\n",
"OnHide": null,
"OnAppear": null,
"OnDisappear": null,
Expand Down Expand Up @@ -354,7 +354,7 @@
"DrawFromBottom": false,
"NormalColor": null,
"FocusedColor": null,
"Expanded": false,
"Expanded": true,
"Selected": false,
"Active": true,
"Name": "ChanceRightArm",
Expand Down
8 changes: 4 additions & 4 deletions Gui/Cursor.fogui
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"IsVerticalScroll": false,
"IsHorizontalScroll": false,
"Expanded": false,
"Selected": false,
"Selected": true,
"Active": true,
"Name": "Cursor",
"Position": "0, 0",
Expand All @@ -80,7 +80,7 @@
"OnHide": null,
"OnAppear": null,
"OnDisappear": null,
"OnDraw": "if( Settings.HideCursor )\r\n return;\r\n\r\nint cursor = Settings.Cursor;\r\n// Move cursor\r\nSettings.ShowMoveCursor = ( cursor == CursorType::Move );\r\n// Game scroll\r\nbool hasMouseScroll = true;\r\nif( Settings.ScrollMouseLeft && Settings.ScrollMouseUp )\r\n CursorMoveScreen[ 7 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, -1 );\r\nelse if( Settings.ScrollMouseRight && Settings.ScrollMouseUp )\r\n CursorMoveScreen[ 1 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, 1, -1 );\r\nelse if( Settings.ScrollMouseLeft && Settings.ScrollMouseDown )\r\n CursorMoveScreen[ 5 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, 1 );\r\nelse if( Settings.ScrollMouseRight && Settings.ScrollMouseDown )\r\n CursorMoveScreen[ 3 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, 1, 1 );\r\nelse if( Settings.ScrollMouseLeft )\r\n CursorMoveScreen[ 6 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, 0 );\r\nelse if( Settings.ScrollMouseRight )\r\n CursorMoveScreen[ 2 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, 1, 0 );\r\nelse if( Settings.ScrollMouseUp )\r\n CursorMoveScreen[ 0 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, 0, -1 );\r\nelse if( Settings.ScrollMouseDown )\r\n CursorMoveScreen[ 4 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, 0, 1 );\r\nelse\r\n hasMouseScroll = false;\r\nif( hasMouseScroll )\r\n return;\r\n// Attack contours\r\nContourType contour = ( cursor == CursorType::UseWeapon ? ContourType::Custom : ContourType::None );\r\nif( contour != CurCrittersCountour )\r\n{\r\n CurCrittersCountour = contour;\r\n CurMap.SetCrittersContour(CurCrittersCountour);\r\n}\r\n\r\n// Other cursors\r\nif( cursor == CursorType::UseWeapon )\r\n{\r\n CursorAttack.Draw( Settings.MouseX, Settings.MouseY, 0, 0, 0, 0 );\r\n\r\n Critter@ chosen = Game.GetChosen();\r\n if( chosen is null )\r\n return;\r\n\r\n Critter@ cr = CurMap.GetCritterAtScreenPos( Settings.MouseX, Settings.MouseY );\r\n if( cr is null || cr is chosen )\r\n return;\r\n\r\n uint attackDist = Parameters::GetActiveItemAttackDistance( chosen );\r\n if( attackDist == 0 )\r\n return;\r\n\r\n bool trace = false;\r\n Critter@[] critters = {};\r\n critters = CurMap.GetCrittersInPath( chosen.HexX, chosen.HexY, cr.HexX, cr.HexY, 0.0f, attackDist, CritterFindType::Any );\r\n for( uint i = 0; i < critters.length(); i++ )\r\n {\r\n if( critters[ i ].Id == cr.Id )\r\n {\r\n trace = true;\r\n break;\r\n }\r\n }\r\n if( !trace )\r\n return;\r\n\r\n Item@ item = chosen.GetItem( ItemProperty::CritterSlot, CritterItemSlot::Main );\r\n int hit = ClientMain::to_hit( chosen, cr, item, item.Mode );\r\n if( hit == 0 )\r\n return;\r\n \r\n Game.DrawText( hit + \"%\", Settings.MouseX + 6, Settings.MouseY + 6, 100, 100, COLOR_RED, Fonts::Default, 0 );\r\n}\r\nelse if( cursor == CursorType::UseItem )\r\n{\r\n CursorUseItem.Draw( Settings.MouseX, Settings.MouseY, 0, 0, 0, 0 );\r\n}\r\nelse if( cursor == CursorType::UseSkill )\r\n{\r\n CursorUseSkill.Draw( Settings.MouseX, Settings.MouseY, 0, 0, 0, 0 );\r\n}\r\nelse if( cursor == CursorType::Move )\r\n{\r\n uint16 hx, hy;\r\n Critter @chosen = Game.GetChosen();\r\n if (chosen is null) {\r\n return;\r\n }\r\n CurMap.SetCursorPos(chosen, Settings.MouseX, Settings.MouseY, Input::IsShiftDown(), true);\r\n \r\n if( !CurMap.GetHexAtScreenPos( Settings.MouseX, Settings.MouseY, hx, hy ) )\r\n CursorDefault.Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, -1 );\r\n}\r\nelse if( cursor == CursorType::Default )\r\n{\r\n CursorDefault.Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, -1 );\r\n}\r\nelse if( cursor == CursorType::Hand )\r\n{\r\n //Game.CustomCall( \"CurDrawHand\" );\r\n CursorHand.Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, -1 );\r\n}\r\nelse\r\n{\r\n CursorDefault.Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, -1 );\r\n}",
"OnDraw": "if( Settings.HideCursor )\r\n return;\r\n\r\nint cursor = Settings.Cursor;\r\n// Move cursor\r\nSettings.ShowMoveCursor = ( cursor == CursorType::Move );\r\n// Game scroll\r\nbool hasMouseScroll = true;\r\nif( Settings.ScrollMouseLeft && Settings.ScrollMouseUp )\r\n CursorMoveScreen[ 7 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, -1 );\r\nelse if( Settings.ScrollMouseRight && Settings.ScrollMouseUp )\r\n CursorMoveScreen[ 1 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, 1, -1 );\r\nelse if( Settings.ScrollMouseLeft && Settings.ScrollMouseDown )\r\n CursorMoveScreen[ 5 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, 1 );\r\nelse if( Settings.ScrollMouseRight && Settings.ScrollMouseDown )\r\n CursorMoveScreen[ 3 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, 1, 1 );\r\nelse if( Settings.ScrollMouseLeft )\r\n CursorMoveScreen[ 6 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, 0 );\r\nelse if( Settings.ScrollMouseRight )\r\n CursorMoveScreen[ 2 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, 1, 0 );\r\nelse if( Settings.ScrollMouseUp )\r\n CursorMoveScreen[ 0 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, 0, -1 );\r\nelse if( Settings.ScrollMouseDown )\r\n CursorMoveScreen[ 4 ].Draw( Settings.MouseX, Settings.MouseY, 0, 0, 0, 1 );\r\nelse\r\n hasMouseScroll = false;\r\nif( hasMouseScroll )\r\n return;\r\n// Attack contours\r\nContourType contour = ( cursor == CursorType::UseWeapon ? ContourType::Custom : ContourType::None );\r\nif( contour != CurCrittersCountour )\r\n{\r\n CurCrittersCountour = contour;\r\n CurMap.SetCrittersContour(CurCrittersCountour);\r\n}\r\n\r\n// Other cursors\r\nif( cursor == CursorType::UseWeapon )\r\n{\r\n CursorAttack.Draw( Settings.MouseX, Settings.MouseY, 0, 0, 0, 0 );\r\n\r\n Critter@ chosen = Game.GetChosen();\r\n if( chosen is null )\r\n return;\r\n\r\n Critter@ cr = CurMap.GetCritterAtScreenPos( Settings.MouseX, Settings.MouseY );\r\n if( cr is null || cr is chosen )\r\n return;\r\n\r\n uint attackDist = Parameters::GetActiveItemAttackDistance( chosen );\r\n if( attackDist == 0 )\r\n return;\r\n\r\n bool trace = false;\r\n Critter@[] critters = {};\r\n critters = CurMap.GetCrittersInPath( chosen.HexX, chosen.HexY, cr.HexX, cr.HexY, 0.0f, attackDist, CritterFindType::Any );\r\n for( uint i = 0; i < critters.length(); i++ )\r\n {\r\n if( critters[ i ].Id == cr.Id )\r\n {\r\n trace = true;\r\n break;\r\n }\r\n }\r\n if( !trace )\r\n return;\r\n\r\n Item@ item = chosen.GetItem( ItemProperty::CritterSlot, CritterItemSlot::Main );\r\n ProtoItem proto = CritterItem::GetSlotItemProto(chosen);\r\n int hit = ClientMain::to_hit( chosen, cr, proto, item == null ? chosen.HandsItemMode : item.Mode );\r\n if( hit == 0 )\r\n return;\r\n \r\n Game.DrawText( hit + \"%\", Settings.MouseX + 6, Settings.MouseY + 6, 100, 100, COLOR_RED, Fonts::Default, 0 );\r\n}\r\nelse if( cursor == CursorType::UseItem )\r\n{\r\n CursorUseItem.Draw( Settings.MouseX, Settings.MouseY, 0, 0, 0, 0 );\r\n}\r\nelse if( cursor == CursorType::UseSkill )\r\n{\r\n CursorUseSkill.Draw( Settings.MouseX, Settings.MouseY, 0, 0, 0, 0 );\r\n}\r\nelse if( cursor == CursorType::Move )\r\n{\r\n uint16 hx, hy;\r\n Critter @chosen = Game.GetChosen();\r\n if (chosen is null) {\r\n return;\r\n }\r\n CurMap.SetCursorPos(chosen, Settings.MouseX, Settings.MouseY, Input::IsShiftDown(), true);\r\n \r\n if( !CurMap.GetHexAtScreenPos( Settings.MouseX, Settings.MouseY, hx, hy ) )\r\n CursorDefault.Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, -1 );\r\n}\r\nelse if( cursor == CursorType::Default )\r\n{\r\n CursorDefault.Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, -1 );\r\n}\r\nelse if( cursor == CursorType::Hand )\r\n{\r\n //Game.CustomCall( \"CurDrawHand\" );\r\n CursorHand.Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, -1 );\r\n}\r\nelse\r\n{\r\n CursorDefault.Draw( Settings.MouseX, Settings.MouseY, 0, 0, -1, -1 );\r\n}",
"OnPostDraw": null,
"OnMove": null,
"OnMouseDown": null,
Expand All @@ -89,7 +89,7 @@
"OnLMousePressed": null,
"OnRMousePressed": null,
"OnMouseClick": null,
"OnLMouseClick": "Game.Message(\"Cursor click\");",
"OnLMouseClick": "",
"OnRMouseClick": null,
"OnMouseMove": null,
"OnGlobalMouseDown": null,
Expand Down Expand Up @@ -221,7 +221,7 @@
"IsVerticalScroll": false,
"IsHorizontalScroll": false,
"Expanded": false,
"Selected": true,
"Selected": false,
"Active": true,
"Name": "MenuSlot",
"Position": "0, 1",
Expand Down
Loading