===DRAKKHEN II: DRAGON VIEW WORLD MAP GUIDE===
Version 1.3 by Khaz, 27Oct2014

0. TABLE OF CONTENTS
---------------
1. INTRODUCTION
2. POSITION / ORIENTATION
3. REGION
4. WORLD MAP
5. TILES
6. LANDSCAPE OBJECTS
7. SCENERY OBJECTS
8. RANDOM ENCOUNTERS
9. RAM ADDRESSES
10. MAJOR LANDMARK COORDINATES

===============================================================================
1. INTRODUCTION
---------------

This guide details how the World Map part of the game functions.  I obtained
this information in an attempt to create a more accurate World Map image
directly from the game's ROM.  A compressed version of this World Map is now
available here on GameFAQs!

A high-resolution, unlabelled version is also available at vgmaps.com, or the
link below:

http://www.pictureshack.us/images/79741_DragonView_World_VGMaps_2c.png

IF YOU FIND THIS LINK IS BROKEN or if anything else in this guide is lacking,
please contact me right away!

===============================================================================
2. POSITION / ORIENTATION
-------------------------
In-game your position is represented by the two-byte values at $001C14 (X) and
$001C16 (Y).  Your current direction is represented by $001909, where $00 is
South, $40 is West, $80 is North, $C0 is East.  The smallest increment to your
orientation is $02.  Manually setting your orientation to an odd number will
break the game.

When you move, the game looks up your orientation on a table in ROM at $809F84
to get a pair of delta-X and delta-Y values that define how far you move in
each direction every movement frame.  Not every increment of rotation actually
changes your direction of movement - your point of view may shift but you will
still be walking along the same line until these delta-X and -Y values change.

You move at the same speed whether you walk forwards or backwards, but your
actual real-time "movement speed" will mostly be dictated by the number of lag
frames between movement frames, which increases when more scenery is on screen.

You do not, however, move at the same speed regardless of angle.  The most you
can move along either axis in a frame is $0008 but your total velocity can be
less or greater than 8.  For example, a section of the angle lookup table at
$809F84 (with an added "Speed" column):

$1909   dY      dX      Speed
-----------------------------
C0      0000    f8ff    8
C2      0000    f8ff    8
C4      0100    f8ff    8.0622
C6      0100    f8ff    8.0622
C8      0200    f8ff    8.2462
CA      0200    f8ff    8.2462
CC      0200    f8ff    8.2462
CE      0300    f8ff    8.5440
D0      0300    f8ff    8.5440
D2      0400    f9ff    7.6157
D4      0400    f9ff    8.0622
D6      0400    f9ff    8.0622
D8      0500    f9ff    8.6023
DA      0500    f9ff    8.6023
DC      0500    faff    7.8102
DE      0500    faff    7.8102
E0      0600    faff    8.4852
E2      0600    fbff    7.8102
E4      0600    fbff    7.8102
E6      0600    faff    8.4852
E8      0700    fbff    8.6023
EA      0700    fcff    8.0622
EC      0700    fcff    8.0622
EE      0700    fcff    8.0622
F0      0800    fdff    8.5440
F2      0800    fdff    8.5440
F4      0800    feff    8.2462
F6      0800    feff    8.2462
F8      0800    feff    8.2462
FA      0800    ffff    8.0622
FC      0800    ffff    8.0622
FE      0800    0000    8
00      0800    0000    8

As if it weren't odd enough that the table lists a positive Y value when going
in the positive Y direction but a negative X value when going in the positive
X direction, there also appears to be a mistake in this section of the table:

Angle E0 is, as expected, 45 degrees between East ($C0) and South ($00).  As
your angle increases toward South the X component starts to decrease, but at
angle E6 it's suddenly 6 and 6 again - back to 45 degrees.  You face the
correct direction in-game but you can see visually how you slide sideways along
the perfect diagonal when you try to walk.

===============================================================================
3. REGION
---------
To explore the full world map you will need to manipulate your X and Y position
($001C14 and $001C16) manually.  If you attempt this you will frequently end up
stuck and the game may occasionally crash depending on how you manage your
"Region Code" ($001900).  The region code defines many things including how
objects are rendered and where you are able to move.  Generally speaking being
in the incorrect region for your coordinates is a bad thing.

Even if you set the region code manually upon teleporting yourself somewhere,
you will often find the world does not appear properly anyways.  Moving between
regions on the map normally (eg/ walking between Lake, Desert and Swamp areas)
calls a special transition event that sets up the next area.  Most region-to-
region transitions do not have this event since you can't walk directly between
them, which will leave everything looking screwed up.

As far as I can tell this is just a graphical problem, but it can be very
difficult to find your way around when everything looks like a glitched mess.
To fix it, simply enter and exit any dungeon or town and you should be fine -
though this has not been tested extensively.

Dragon View also tries very hard to keep you from reaching plot events in the
wrong order and it's very easy to render your game unfinishable by walking
into one at the wrong time or from the wrong direction.  If you save after
manipulating these addresses you do so at your own risk.

Usable region codes are as follows (others I've tested all crash the game):

00 = Hujia Region
01 = Casdra / Lake Region
02 = Swamp
03 = Desert
04 = Fire Cave
05 = Underworld
06 = Underworld II
07 = Snowfield
08 = Keire Region
09 = Mt. Badsel

One important note is that, in regions 06 and up, you can move through most
normally out-of-bounds areas.  These regions are all enclosed by a different
type of wall object than you find around Hujia and Miraj, therefore the
walls from the earlier areas are not rendered in the later region codes.

I do not know the purpose of the second Underworld region, 06.  The Underworld
normally appears as region 05.  Region 06 has the same music and general color
as 05, but a different graphic object set and you have free movement through
water and most walls in 06.

===============================================================================
4. WORLD MAP
------------
The overall World Map exists in the ROM at addresses $9792d6 - $9796d5, a 32
by 32 square of bytes.  Each byte represents a square tile of world map $0200
by $0200, making the entire map $4000 by $4000 in size.

In-game, you can walk beyond these limits if you get outside the normal
boundaries.  Sometimes you will find objects rendered out there, but these are
unfortunately not some kind of secret:

To read from this map the game takes your X and Y coordinates, rounds them
down to the nearest tile coordinates (ie/ removes the lower 9 bits), then
manipulates and adds them so that each major X division is an increment of 1
and each major Y division is an increment of $20.  This gives a raw offset
from $9792d6 that is used to read the map.  Because of this, coordinates East
of $4000 X will take tiles from a wrong location further down the map, and
coordinates south of $4000 Y will theoretically fetch tile numbers from the
next data in the ROM (which is the tile data itself).

===============================================================================
5. TILES
--------
The first thing the game does upon reading a byte from the main World Map at
$9792d6 is multiply it by two then use it as an index for a 16-bit read from
$97cf18.  $97cf18 is a table 512 bytes long where every one byte "Tile Number"
taken from the World Map corresponds to two bytes that describe the location of
that tile in ROM relative to address $9796d6.  (Note: ___6d6, not ___2d6)

There are two kinds of information stored in the main Tile Table at $9796d6:
"Landscape" objects and "Scenery" objects (my personal naming convention).
Each tile entry is organized as follows:

-The first two bytes define the size of the data.  The first byte represents
how many Landscape objects are in the tile, the second how many Scenery objects.

-Following the size bytes are the Landscape Object bytes.  Each
byte corresponds to one object as per section 6.

-The remaining data defines the Scenery objects in the tile.  Every Scenery
Object consists of a one-byte-two-byte pair, the one byte representing its
identity and the remaining two defining its location.  The single "Identity"
bytes are listed first, followed by the coordinate pairs in the same
order, and then the Scenery list repeats in a different order.  Every Scenery
Object is listed twice:  The first list is in order of West-To-East, the second
list is in order of North-To-South.

Several tiles exist in the ROM that were never actually used in the game.
They all contain a solid block of "Landscape Object Type" 0b (see next
section) covering the entire tile.  This type 0b is not used in the game.

Two of these unused tiles are unique, as they also contain a full-tile block
of one type of wall object as well as the 0b - tiles 83 and 9a.  The
remaining unused tiles are as follows:

09  30  32  35  36  3e  48  53  83  90  9a  9e  a3
a7  af  b2  b4  b5  bb  bc  c5  cf  e8  e9  ea  ec

===============================================================================
6. LANDSCAPE OBJECTS
--------------------
The Landscape Object bytes found in the Tile data in section 5 are used in much
the same way as the original world map:

-The "Object number" byte is multiplied by two

-The result is used to index a 16-bit read starting at $97DC08

$97DC08, just like $97CF18, is a table 512 bytes long where every one byte
"Object Number" taken from the tile data corresponds to a two byte index that
describes the location of that object in ROM relative to address $97D118.

Each "Landscape Object" is a relatively simple set of data.  The first byte
defines what type of object it is.

For example (not a complete list):

00 = Road 1 - Region Dependent/Variable Colour (eg/ warp star parts, emblems)
01 = Road 2 (Usually Brown / Black)
02 = Water / Invisible Ortah Road
07 = Wall for some Regions (eg/ Desert)
09 = Ice Road / Badsel Road
0A = Frozen Lake / Badsel Lake
0F = Wall for some Regions

The second byte represents the number of points around the edge of the object.
The data itself is a series of X, Y coordinates (ranging from $00 to $80) that
define the outer edge of the object.  The final point connects back to the
first one and the enclosed area is filled with whatever object type was
specified in the first byte.

As the tiles are $0200 by $0200 and coordinates can be at most $80, each
coordinate is multiplied by four to get the true location.

===============================================================================
7. SCENERY OBJECTS
------------------
As explained in section 5, Scenery objects are listed twice in the tile data.
Each listing consists of an object number and a location in X, Y coordinates
(ranging from $00 to $80 as with the Landscape Objects).

The object number defines what type of scenery item appears, in conjunction
with your "Region Code" ($001900).  The same object numbers are re-used in
different regions and simply appear as different objects with different
properties.  For example, the small stumps in the lake region that you can walk
through are the same object number as the thin dead trees in the Fire Cave
region, which you collide with.

These same "Scenery" objects are also used as invisible triggers for certain
events, such as on warp stars and emblems, the small star where you reveal
the path to Ortah, the bridge to Sektra, etc.

Another interesting note is that while map entry/exit points in an open space
exist as a single object point, ones on walls are generally constructed as
one object for the image of the opening in the wall, and three placed
directly in front of it that you hit to trigger the transition.

The following are the object numbers I know (also not a complete list):

00 = Grass in Swamp / Hujia region
01 = Small Rocks in Desert / Swamp / Hujia region (commonly around water)
03 = Hujia, Lake & Swamp Area Trees / Desert Cactus / Snowfield Nothing*
04 = Desert Skulls / Swamp Rocks / Fire Cave Glowing Bushes
05 = Tiny Hujia & Lake Rgn Stumps/Fire Cave Thin Tree/Desert Statue/Swamp Bush
06 = Fire Cave Bones / Small Sand Dunes / Hujia Bushes / Lake Area Grass
0A = Purple snowy rocks
0B = Ice Pillars / Badsel Trees
0C = Large Snowdrifts
0D = Small Badsel Rocks
0E = Small snowdrifts / Badsel Brickpiles
F9 = Lions
FB = Badsel Giant Boulders
FE = Warp Star Trigger Points

*While object type 03 appears as nothing in the Snowfield, there are four of
them in the Snowfield on the empty patch next to the chest game.  The tile they
are on isn't used anywhere else, so why the invisible trees are there is beyond
me.  This is the only instance of normally-invisible and seemingly useless
scenery I have found.

I have personally observed pieces of scenery (found outside the world map
coordinates, ie/ generated from wrong data) that appear as a coherent image
that's not in the game normally: some small plants and green tree stumps in
the Badsel region, tall green rocks in the Snowfield/Keire region, and what
appear to be glowing red skulls in the Underworld.  While these seem to be
deliberate World Map graphics, they generally do not scale with distance.

In an effort to investigate this, I hacked the ROM data to replace several
tiles with a grid of every scenery object number and walked through it in-game
in each region.  There are several objects that will cause the game to crash
either immediately upon loading the tile or while on-screen, but the majority
of the list of 256 scenery objects seem to be the same repeating set of
graphics.  Some objects also obstruct your movement strangely, such as one
rendered as a glitched tree stump in most regions that prevents you from
facing directly toward it (and also causes lots of crashing).

===============================================================================
8. RANDOM ENCOUNTERS
--------------------
While travelling around the world map normally, you will constantly be pursued
by a pair of white clouds that will periodically disappear and reappear in a
different location.  Upon contact you will enter a fight you cannot run away
from.  This can be very obnoxious when trying to test and plot various map
features.

Each cloud is defined by six key addresses in memory (that you can find in the
next section):

-Four addresses make up the two-byte X and Y coordinates of the cloud in the
same manner as your own coordinates.

-One address is a one-byte timer that continuously counts down to zero.  Upon
reaching zero, the cloud disappears and respawns in a new location.  This new
location seems to be determined by the game's standard RNG seed address
$0000a5, which is updated using the Horizontal and Vertical scanline counters
(special registers at $80213C and $80213D) every time it is needed.

-The final relevant byte is the animation timer, which seems to cycle from 00
to 03.  If you fix this address to one value the clouds will remain a static
image (which makes observing their actual movement much easier).

If you don't want to be disturbed by these encounters, freeze at least their
position and timer addresses.  If you freeze only their position they will
still reappear in new locations when they expire, often right on top of you.

These clouds are only forced to stay near you in a roundabout way; you can
freeze them in place and walk away and they'll still be there when you come
back.  Normally in game however, whenever you get too far away the cloud's
timer will jump down to 03 and immediately trigger a respawn.

===============================================================================
9. USEFUL RAM ADDRESSES
-----------------------
The following is a list of addresses I found useful or otherwise interesting
to watch during this investigation:

0000a5  Source of all(?) "random" numbers in the game

001C14  Overworld X Position (East-West) (2 Bytes)
001C16  Overworld Y Position (North-South) (2 Bytes)
001900  Overworld Region
001909  Overworld Angle     (South = $00 / North = $80) (even values only)

001A86  CurrentTileIndex    Index of current tile (from $97cf18, for $9796d6)
001A8A  CurrentTileCoords   (Tile coordinates are all 4 bytes)
001B06  NextXTileIndex      Index of Next X tile
001B0A  NextXTileCoords     (Tile to East or West depending on angle & pos'n)
001B86  NextYTileIndex      Index of Next Y tile
001B8A  NextYTileCoords     (Tile to North or South depending on angle & pos'n)
001C06  NextXYTileIndex     Index of Next XY tile
001C0A  NextXYTileCoords    (Tile to NE/NW/SE/SW to form a square with other 3)

001C12  01 When Heading East, 00 Otherwise
001C13  01 When Heading North, 00 Otherwise

00FBC9  Cloud 1 X Posn (Coarse)    (As per section 8)
00FBC2  Cloud 1 X Posn (Fine)
00FBCB  Cloud 1 Y Posn (Coarse)
00FBC4  Cloud 1 Y Posn (Fine)
00FBDA  Cloud 1 Timer
00FBCD  Cloud 1 Animation

00FBE9  Cloud 2 X Posn (Coarse)
00FBE2  Cloud 2 X Posn (Fine)
00FBEB  Cloud 2 Y Posn (Coarse)
00FBE4  Cloud 2 Y Posn (Fine)
00FBFA  Cloud 2 Timer
00FBED  Cloud 2 Animation

00038B  Warp Star Trigger - Initiates warp star exit/arrival on non-zero.

002011  Desert Cave Door Switch ($FF = Door Open, $FD = Door Closed)

(I only included the last one because it took forever to figure out.
The switch is 1 bit so the same address likely holds other switches too.)

===============================================================================
10. MAJOR LANDMARK COORDINATES
-----------------------------
Since I have the information, the following is a listing of the coordinates,
region and exit angle of every major entry/exit/warp point on the world map.
The direction you face on returning to the world map is set by the room you're
emerging from, not by the direction you were facing when you entered.

This list can be useful when editing your location manually, as you will
frequently want to find a major point to enter and exit to reset the graphics
on screen.

(C) stands for "Coarse" and (F) for "Fine", ie/ the hi and lo bytes of your
position, respectively.  Locations listed from West to East.


X(C)    X(F)    Y(C)    Y(F)    Rgn     $1909   Identity
------------------------------------------------------------------------------
01      00      2F      00      00      82      Rysis Warp Star
01      00      17      00      01      A2      Casdra Warp Star
01      2C      1E      DC      01      40      Casdra Stump (Fire Up)
02      FE      15      02      01      20      North Cave
03      05      2D      00      00      D6      Rysis
03      08      23      60      04      C0      Fire Cave
03      00      3D      04      05      00      Underworld Cave
05      00      0E      40      07      00      Fortress
05      00      0B      00      08      82      Keire Warp Star
05      28      1B      00      01      C0      Casdra
07      00      13      08      07      00      Snowfield W. Castle (Hauza Up)
07      00      0A      02      08      00      Keire Ice Cavern
09      04      26      84      00      EC      Arsenal
09      00      2E      F8      00      80      Hujia
0A      FE      1D      02      01      20      Landslide Casdra Side
0A      F8      3D      00      05      40      Giza's Palace
0B      22      1C      DE      07      A0      Landslide Snowfield Side
0B      34      13      48      07      00      Snowfield Chest Game
0B      00      11      08      07      80      Snowfield Emblem (Ice Up)
0B      08      05      00      08      C0      Keire Castle (Sword Up)
0D      00      1D      00      07      42      Snowfield Warp Star
0F      00      26      78      01      80      Galys Pass Casdra Side
0F      00      27      88      00      00      Galys Pass Hujia Side
0F      00      30      FC      00      80      Storehouse
0F      00      05      08      08      00      Keire Temple
10      88      11      04      02      D4      Wet Cavern
10      53      10      D4      07      54      Snowfield (MP UP)
11      00      09      08      07      00      Snowfield N. Castle (Ice Up)
15      00      27      00      01      42      Lake Area Warp Star
15      00      1E      00      01      00      Lake Cave (Rodister)
17      00      0D      10      02      00      Swamp West Stump (Lit Up)
18      86      2F      04      01      D4      Meadow
19      00      0D      08      02      80      Swamp Emblem (Lit Up)
19      00      29      08      01      80      Lake Area Emblem (Hauza Up)
1B      08      27      88      01      C0      Lake Area Stump (Swd Tech)
1D      10      0F      00      02      C0      Swamp SE Stump (Large Bag)
1F      00      0A      F0      02      80      Swamp NE Stump (Potion)
1F      00      1D      00      03      82      Miraj Warp Star
1F      50      34      B8      01      00      Old Well
22      EA      23      00      01      40      Fall (Lightning Ring)
22      F0      09      00      02      40      Sektra Temple
23      00      1B      08      03      00      Miraj
23      6C      2D      1A      01      56      "Clinic" near Neil (Healer)
23      00      37      08      01      00      Neil Ruins
25      74      11      40      02      6A      Swamp Wandering Healer
25      00      39      00      01      A2      Neil Ruins Warp Star
25      22      36      DE      09      A0      South Badsel Cave (HP UP)
26      58      31      B0      09      80      Badsel Fire Boots Boulder
28      78      1D      00      03      40      Quicksand Cave, Miraj Side
28      FE      3B      02      01      20      Illusion Forest
29      88      1D      00      03      C0      Quicksand Cave, Ortah Side
29      00      28      40      09      00      Badsel Area HP UP Tree
29      FC      3B      00      09      40      Mt. Badsel I
29      00      2D      08      09      80      Badsel Emblem (Armor Up)
29      00      09      00      02      02      Swamp Warp Star
2C      FC      03      00      02      40      Jade Mine
2D      BC      2F      00      09      40      Mt. Badsel II
2E      F0      19      00      03      40      NorthWest Lion (Hauza Tech)
2E      20      28      C0      09      00      Badsel Mid Boulder (HP UP)
30      F0      0B      00      02      40      Orusort
31      00      13      04      03      00      Desert Wandering Healer
32      B4      29      53      03      A0      Desert Cave
32      80      2A      2C      09      80      Badsel Chest Game
34      F8      23      00      03      40      South Lion (Mirror)
36      F2      18      F8      03      54      Ortah Temple
39      00      21      0A      03      80      Desert N. Emblem (Fire Up)
3A      F8      1F      00      03      40      East Lion (Fruit = Crystal)
3B      00      2B      08      03      80      Desert S. Emblem (Sword Up)
3D      00      0D      04      02      00      Ancient Forest
3D      00      2F      BE      09      80      Dead End Cave

Note:  These numbers were taken as close to the entrance as possible, facing
as you would upon exiting.  If you enter these exact coordinates without
specifying the exact angle too, you might end up stuck slightly inside
the object/wall.  I suggest trying to put yourself out in the open nearby.