Skip to content

Commit

Permalink
Fix: Menu was creating one too many items
Browse files Browse the repository at this point in the history
Number of Heroes was still 30 (not 31). Because of this, not enough item creation actions were skipped
  • Loading branch information
OrangeUtan committed Mar 25, 2020
1 parent f3d2f47 commit de97d57
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions overwatch.ostw
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
Contants, macros etc related purely to the game.
**/


define NUM_HEROES: 31; // Number of current Heroes in the game
define OFFSET_EYES_FROM_RETICLE: Vector(0,0.150,0); // The offset of the eyes position from the reticle. Winston has double the offset
14 changes: 7 additions & 7 deletions radial_menu.ostw
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "math.ostw";
import "overwatch.ostw";

playervar define menuItems;
playervar define menuCenter; // The center of the menu relative to the player
Expand All @@ -11,7 +12,6 @@ playervar define tmp; // Temporary variable. Don't rely on its content!!!

define menuDistanceFromPlayer: 2; // z-distance of the menu to the players eyes
define menuItemIconScale: 2.5; // Scale of the menu items
define menuCenterOffset: Vector(0,-0.150,0);
define menuAnimationTime: 0.15; // The time in which the menu is animated open/closed
define selectionRadius: 0.5; // Radius around menu items where they can be selected
define maxMenuScale: 0.2 + CountOf(menuItems) * 0.03;
Expand All @@ -29,7 +29,7 @@ Event.OngoingPlayer
HorizontalAngleTowards(
EventPlayer(),
WorldVectorOf(
LocalVectorOf(EyePosition() + menuCenter - menuCenterOffset),
LocalVectorOf(EyePosition() + OFFSET_EYES_FROM_RETICLE + menuCenter),
EventPlayer()
),
),
Expand All @@ -45,7 +45,7 @@ if(IsButtonHeld(EventPlayer(), Button.Interact))
if(menuIsClosed)
{
menuVisibleTo = EventPlayer()
menuCenter = menuCenterOffset + menuDistanceFromPlayer * DirectionFromAngles(HorizontalFacingAngleOf(EventPlayer()), clamp(VerticalFacingAngleOf(EventPlayer()), -40, 40))
menuCenter = -OFFSET_EYES_FROM_RETICLE + menuDistanceFromPlayer * DirectionFromAngles(HorizontalFacingAngleOf(EventPlayer()), clamp(VerticalFacingAngleOf(EventPlayer()), -40, 40))
ChaseVariableOverTime(menuScale, maxMenuScale, menuAnimationTime, TimeChaseReevaluation.DestinationAndDuration)
}

Expand All @@ -66,7 +66,7 @@ if(AbsoluteValue(angleFromMenuCenter) > (30 * (menuScale + 0.5)))
{
ChaseVariableOverTime(
menuCenter,
menuCenterOffset + menuDistanceFromPlayer * DirectionFromAngles(
-OFFSET_EYES_FROM_RETICLE + menuDistanceFromPlayer * DirectionFromAngles(
HorizontalFacingAngleOf(EventPlayer()) + sign(angleFromMenuCenter)*28,
clamp(VerticalFacingAngleOf(EventPlayer()), -40, 40)
),
Expand All @@ -88,8 +88,8 @@ if(!IsButtonHeld(EventPlayer(), Button.Interact))
if(menuIsOpen)
{

if(HeroOf() == Hero.Winston) tmp = -2*menuCenterOffset
else tmp = -menuCenterOffset
if(HeroOf() == Hero.Winston) tmp = 2*OFFSET_EYES_FROM_RETICLE
else tmp = OFFSET_EYES_FROM_RETICLE

tmp = getIndexOfSelectedMenuItem(tmp)

Expand Down Expand Up @@ -140,7 +140,7 @@ void updateMenuGUI() {
tmp = LastTextID() + 1

// Create InWorldText
Skip(30 - CountOf(menuItems))
Skip(NUM_HEROES - CountOf(menuItems))
createMenuItem(30)
createMenuItem(29)
createMenuItem(28)
Expand Down

0 comments on commit de97d57

Please sign in to comment.