compass.swf
The in-game compass HUD bar displayed at the top of the screen while exploring. It renders icons for nearby dungeons, lairs, quests, players, and delve rooms at horizontal positions representing their real-world compass bearing, and shows a countdown widget for Mega Dungeon boss encounters.
Document/main class: Compass (extends _kiwi.Core.UIComponent)
SWF-specific classes: 32 (2 logic classes + 2 timeline logic classes + 28 icon/asset wrappers)
Main class: Compass
Manages the compass bar layout and all icon pools. On construction it translates the 8 cardinal/intercardinal direction strings via IggyFunctions.translate, applies a mask to the directional strip, and calls useDiscoveryMode(false, 0). In configUI() it registers 12 ExternalInterface callbacks for the Iggy/Scaleform JS bridge. All icon types are managed as object pools (arrays of recycled, visibility-toggled MovieClips).
Public methods
useDiscoveryMode(isDiscovery:Boolean, maxDist:Number) : void— toggles between Adventure world (normal) and Geode/Discovery world. Swaps anchor MovieClips (topLeftAnchor/bottomRightAnchorvs.topLeftAnchor2/bottomRightAnchor2), shows/hidesadventureBG/discoveryBG, and usesGeodeDirectionvs.AdventureDirectionfor heading labels. SetsmaxPlayerDistancefor player dot alpha scaling. Also removes every heading label and every delve-track icon (directions,delveRooms,delveBoss) from the display.updateCornerstone(fraction:Number) : void— moves or creates theCornerstonediamond icon at the given 0–1 horizontal fraction; a fraction of 0 or below, or 1 or above, removes it.clearDungeons() : void— hides the pooled markers before each refresh: 22 pools, covering dungeons, lairs, flags, players and quests.delveRoomsanddelveBossare not among them; onlysetDelveRoomsanduseDiscoveryModeclear the delve track.addNewIcon(fraction:Number, type:int, level:uint) : MovieClip— core factory. Selects the correct pool array bytypeconstant, recycles a hidden instance or instantiates a new one viagetDefinitionByName, and positions it viaGetIconHorizontalFromLocation. Thelevelparam is the marker's height relative to the player (0 same level, 1 above, 2 below) and selects the directional variant class; conquest and crowd lairs ignore it and use one pool each. These three values are all the engine sends for a marker: no distance crosses the bridge.setDelveRooms,addPlayerandaddQuestalso call it internally with kinds 98/99, 100 and 101–103.addFlag(flagType:int, fraction:Number) : void— places aFlagicon;gotoAndStop(flagType+1)selects the flag colour frame.setDelveRooms(roomCount:Number, clearedMask:Number) : void— lays outroomCountDelveRoomicons, roomiat fractioni / (roomCount - 1)and stretched to(stripWidth / roomCount - 1) / 30withscaleX; the last room also gets aDelveBossicon at fraction 1. BitiofclearedMaskputs roomion its cleared frame (2); it is set when a room is cleared, not when it is reached. A one-room delve divides by zero.addQuest(fraction:Number, questType:Number) : void— addsMainQuest,GeodeQuest, orAdventureQuesticon (questType1–3 plus 100 maps toMAIN_QUEST=101,GEODE_QUEST=102,ADVENTURE_QUEST=103; 0 or less adds nothing).addPlayer(fraction:Number, squaredDistance:Number, isFriend:Boolean, isAlive:Boolean, isSelf:Boolean) : void— adds aNearbyPlayerdot. Frame is"friend"or"player"whenisAlive, otherwise"dead"; the local player (isSelf) is included and drawn at 1.25× scale. The second argument is already the squared horizontal distance in blocks, and alpha is(maxPlayerDistance² − squaredDistance) / maxPlayerDistance². The engine clears and re-sends every player each frame.setHeading(leftAngle:Number, rightAngle:Number) : void— the two ends of the camera's visible arc in radians, each in[0, 2π): the first is the angle at the strip's left anchor (fraction 0), the second at the right anchor (fraction 1). When the first is smaller (the arc crosses south) it gets2πadded. Computes which of the 8 cardinal labels fall within the arc (padded by 15 %) and placesAdventureDirection/GeodeDirectioninstances at their fractional positions. Labels are pre-translated strings fromdirectionText. Sent every frame.setLocation(x:Number, y:Number, z:Number, visible:Boolean) : void— shows/hideslocationTextwith integer-truncated coordinate values and toggleslocationBackground. It is the only position the screen receives; before the player has a position the game reports0, 0, 0.
Key fields
directionText : Array— 8 translated cardinal/intercardinal heading strings ($CompassHeading_S…$CompassHeading_SE, English "S" … "SE").topLeftAnchor / bottomRightAnchor— Adventure world pixel bounds for icon positioning.topLeftAnchor2 / bottomRightAnchor2— Discovery/Geode world pixel bounds.directionalAnchor / directionalMask— strip container and its mask clip.iconContainer : MovieClip— parent for the pooled dungeon, lair, quest and delve-room icons.NearbyPlayer,DelveBoss,FlagandCornerstoneare added to the root instead, so they draw above it.megaDungeonProgress : MegaDungeonProgress— embedded boss-wave HUD widget, placed at (273, 108), below the 544×52 stage;locationTextsits at y −5.5, above it. The game does not clip the screen to its stage, so both still draw.discoveryMode : Boolean— tracks current world mode.maxPlayerDistance : Number— player fade distance fromuseDiscoveryMode; squared inaddPlayerto compare against the squared distance the engine sends.- Per-type pool arrays:
dungeons,dungeonsUp,dungeonsDown,lairs,lairsUp,lairsDown,recipeLairs,conquestLairs,crowdLairs,outposts,megaDungeons,directions,flags,players,delveBoss,delveRooms,mainQuests,geodeQuests,adventureQuests.
Runtime dependencies & integration
ExternalInterface.addCallbackregistrations:useDiscoveryMode,updateCornerstone,clearDungeons,setHeading,setLocation,addFlag,addPlayer,addQuest,setDelveRooms,addNewIcon,megaDungeonProgress.show,megaDungeonProgress.hide. The game client's compass callback table also names aShowLocation, which this SWF never registers.- Outbound: none.
CompassandMegaDungeonProgressmake noExternalInterface.callof their own; only the shared framework does. IggyFunctions.translate— called at construction for all 8 direction strings.getDefinitionByName— used inaddNewIconto instantiate icon classes by string name when the pool is empty.- Dungeon type constants:
DUNGEON_LARGE=1,DUNGEON_LAIR=2,DUNGEON_RECIPE_LAIR=3,DUNGEON_CONQUEST_LAIR=4,DUNGEON_CROWD_LAIR=5,DUNGEON_OUTPOST_LAIR=6,DUNGEON_MEGA=7,DELVE_ROOM=98,DELVE_BOSS=99,NEARBY_PLAYER=100,MAIN_QUEST=101,GEODE_QUEST=102,ADVENTURE_QUEST=103. - translate keys used:
$CompassHeading_S,$CompassHeading_SW,$CompassHeading_W,$CompassHeading_NW,$CompassHeading_N,$CompassHeading_NE,$CompassHeading_E,$CompassHeading_SE.
Other game-specific classes
GeodeDirection (embeds symbol10)
Dual-label direction tick for Geode worlds. Has whiteText, blueText, whiteTick, blueTick children. The distance setter switches between white (near-centre, < 40px) and blue (outer) rendering, fading blue alpha as (216 - distance) / 216.
MegaDungeonProgress (embeds symbol146)
Self-contained animated HUD strip for Mega Dungeon boss waves. Shown/hidden via show(questState, remainingSeconds, waveNum, ...skullStates) / hide(); this is everything the engine sends about the encounter (no dungeon name or tier). remainingSeconds arrives as whole seconds, re-sent several times a second (-1 keeps the previous value; a value above 0 starts animateIn). waveNum above 1 shows $Quest_FiveStarWave ("Wave: {0}"). Each skull state is an index into ["inactive","active","complete","failed","hidden"]; skulls without a state get "hidden". questState 2 is complete and 3 is failed, either of which plays animateOut. Drives a CountdownTimer child (textContainer) per-frame, animates up to 5 skull icons (skull0–skull4 inside skullContainer), and plays timeline labels active → animateOut. On completion or failure shows bannerComplete+shine effects or bannerFailed. The symbol is 167 frames: start (1, empty), animateIn (11), active (31), animateOut (41–167).
timerMC (embeds symbol103)
Thin CountdownTimer subclass used as the timer display inside MegaDungeonProgress.
compass_fla/_5StarDungeonSkullMC_9 (symbol111)
4-label skull MovieClip with stops at frames 1, 16, 30, 46 (inactive, active, complete, hidden). active is the skull with green eyes, complete the skull under a red cross. There is no failed label, although MegaDungeonProgress.states names one at index 3, so a skull sent state 3 would hit a missing label. Child of MegaDungeonProgress.skullContainer.
compass_fla/_5StarDungeonSkullEyesGlowMC_10 (symbol109)
2-stop eye-glow effect clip (frames 8 and 20); nested inside the skull MC.
Icon/asset wrapper classes (28 classes)
All embed from /_assets/assets.swf and have no logic beyond super() or simple stop() frame scripts. Grouped by type:
- Dungeon icons (flat/up/down):
LargeDungeon(symbol54),LargeDungeon_Up(symbol48),LargeDungeon_Down(symbol51),Dungeon(symbol66),Dungeon_Up(symbol60),Dungeon_Down(symbol63),MegaDungeon(symbol78),MegaDungeon_Up(symbol72),MegaDungeon_Down(symbol75),Outpost(symbol42),Outpost_Up(symbol36),Outpost_Down(symbol39),RecipeLair(symbol33),RecipeLair_Up(symbol27),RecipeLair_Down(symbol30),ConquestDungeon(symbol96),CrowdLair(symbol91) - Delve icons:
DelveRoom(symbol83, 2-frame stop: a 30 px wide rectangle in the same blue at two opacities, frame 1 not cleared and frame 2 cleared),DelveBoss(symbol88) - Quest icons:
MainQuest(symbol45),AdventureQuest(symbol69),GeodeQuest(symbol57) - Other:
Cornerstone(symbol94),Flag(symbol24, multi-frame by flag type),NearbyPlayer(symbol17, frames: friend/player/dead),AdventureDirection(symbol98, hastextfield:TextField),locationBackground(symbol149)
Notable logic
- Object pool pattern: every icon type has a backing array.
addNewIconwalks the pool to find a hidden instance before creating a new one, preventing GC churn during frequent compass refreshes. - Vertical level encoding:
addNewIconparam3value 0 = same level, 1 = above the player, 2 = below; this selects between the three directional variants (e.g.LargeDungeon/LargeDungeon_Up/LargeDungeon_Down). Because it is relative height, the same marker changes variant as the player climbs or descends. - Strip fractions: every marker fraction maps 0 to the left anchor and 1 to the right anchor. Outside the visible arc the engine clamps the fraction to exactly 0.0 or 1.0, so an off-screen marker carries only "off the left" or "off the right";
updateCornerstonedrops its icon at those values. - Heading angles:
directionTextis walked from2πdownwards in steps ofπ/4, so S is 0 (2π), Eπ/2, Nπ, W3π/2. In world terms the engine's angle isatan2(x, z)with +X east and +Z south (north is −Z). - Delve room bitmask:
setDelveRoomsparam2 is a bitmask of cleared rooms; individual bits control theDelveRoomcleared state per room index, and the boss icon takes the last room's bit. In a delve,addPlayer's fraction is the player's position along this room track rather than a bearing. - Discovery mode coordinate system:
maxPlayerDistanceis supplied alongside the discovery mode flag; player dot alpha =1 - squaredDistance / maxPlayerDistance², a linear falloff in squared distance (the engine sends the distance already squared). - Test/preview mode: when
IggyFunctions.inIggyis false,configUIcallsaddNewIcon(0.25, DUNGEON_LARGE, 0)andmegaDungeonProgress.show(1, 59, 0, 1, 2)to populate visible test content.