Skip to content

Commit

Permalink
feat: ZoneMenu drawRegions, validateRegionPolygon, and getZoningLimit…
Browse files Browse the repository at this point in the history
…s utilities (#154)

Some new game code utilities for the zone editor. validateRegionPolygon
is only needed in the C++ side of the zone editor right now given the
current design but it could foreseeably end up being needed in JS.
  • Loading branch information
jason-e authored Oct 18, 2024
1 parent 3d39fd6 commit b968dd6
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions scripts/types-mom/panels.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,41 @@ interface MomHudDFJump extends AbstractHudPanel<'MomHudDFJump'> {}

interface MomHudSynchronizer extends AbstractHudPanel<'MomHudSynchronizer'> {}

declare const enum RegionRenderMode {
NONE = 0,
START = 1,
START_WITH_SAFE_HEIGHT = 2,
TRACK_SWITCH = 3,
END = 4,
MAJOR_CHECKPOINT = 5,
MINOR_CHECKPOINT = 6,
CANCEL = 7
}

declare const enum RegionPolygonProblem {
INVALID_INPUT = -1,
NONE = 0,
POINTS_TOO_CLOSE = 1,
ANGLE_TOO_SMALL = 2,
COLINEAR_POINTS = 3,
SELF_INTERSECTING = 4
}

interface ZoneEditorRegion {
region: import('common/web').Region;
renderMode: RegionRenderMode;
editing: boolean;
}

interface ZoneEditorLimits {
MAX_REGION_POINTS: number;
MAX_TRACK_SEGMENTS: number;
MAX_SEGMENT_CHECKPOINTS: number;
MAX_STAGE_TRACKS: number;
MAX_BONUS_TRACKS: number;
MAX_ZONES_ALL_TRACKS: number;
}

interface ZoneMenu extends AbstractPanel<'ZoneMenu'> {
startPointPick(multiPick: boolean): void;

Expand All @@ -137,4 +172,10 @@ interface ZoneMenu extends AbstractPanel<'ZoneMenu'> {
setCornersFromRegion(region: import('common/web').Region): void;

moveToRegion(region: import('common/web').Region): void;

drawRegions(editorRegions: ZoneEditorRegion[]): void;

validateRegionPolygon(points: import('common/web').Vector2D[], closed: boolean): RegionPolygonProblem;

getZoningLimits(): ZoneEditorLimits;
}

0 comments on commit b968dd6

Please sign in to comment.