If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Development:The Legend of Zelda: Ocarina of Time/Compass Display

From The Cutting Room Floor
Jump to navigation Jump to search

This is a sub-page of Development:The Legend of Zelda: Ocarina of Time.

SOMETIMES I SEE A TEXT BOX AND I JUST CAN'T HELP MYSSDFGFFDHFGDJGGFSHGDFH
This page sucks.
If you could make it suck less, that would be awesome.
Specifically: There's a straight-up unformatted copy and paste of a Discord discussion here!

Compass Display

Hmmm...
To do:
Add more info from the patent and about what functionality remains, incorporate the notes below, and get this working in-game.
Field Dungeon
OoT compass 0.png OoT compass 1.png
the home field of the player struct looks interesting
they might've wanted to change the direction the compass points to during gameplay
the code at the bottom implies it would just point "north" when you're outside of a dungeon
(although if you removed the #if 0s the code at the bottom would still never run)

I feel like there might just be a missing } before the "yes field" conditional.
Or well, a misplaced } rather

in a dungeon it would appear white and outdoors it would appear blueish

so if you look at the code
compass_modelT is used when the room type is ROOM_TYPE_FIELD gets colored by IREG 75 to 78, which are 100,100,255,255 (RGBA) by default
for other room types (although the code is slightly broken) it uses tetra_model with IREG 85 to 88 which are 255,255,255,255 by default
so the compass "4" gets colored blueish and the tetra model is just white
shown outside and inside of dungeons respectively (assuming that's what room type field means)
not sure if that clears it up

I wonder if this compass was meant to point you to treasures in a dungeon; that is, be literally the compass item you get in every dungeon.
Or at least help you find them.
notwa08/21/2020
oh it uses different models for dungeons and non-dungeons too
"tetra" vs "compass"
and i think it would appear semi-transparent at your feet and point with a fixed length

compas_model is literally a single triangle
it uses G_TRI1 once and returns

no because the draw function just takes link's coordinates
the sx sy sz sr stuff is for computing the angle

iirc the home position is used for collision as well
since trying to change only your world coordinate to teleport somewhere will typically result in you just slamming into a wall since it presumably draws a line between the two points during collision checking

#define ENVIRONMENT_INFO_GROUND         (1)     /* On Ground */  having this bit on is another requirement for getting the compass to display.

Assuming you can only have one ENVIRONMENT_INFO enabled at a time, then these states don't let you see the compass: 

> #define ENVIRONMENT_INFO_LANDING        (1<<1)  /* Moment of Landing */
> #define ENVIRONMENT_INFO_GROUND_LEAVE   (1<<2)  /* Moment of Leaving Ground */
> #define ENVIRONMENT_INFO_WALL           (1<<3)  /* Collide w/ Wall */
> #define ENVIRONMENT_INFO_ROOF           (1<<4)  /* Collide w/ Ceiling */
> #define ENVIRONMENT_INFO_WATER          (1<<5)  /* In Water */
> #define ENVIRONMENT_INFO_WATER_DIVE     (1<<6)  /* Moment of Hitting Water */
> #define ENVIRONMENT_INFO_GROUND_HIT     (1<<7)  /* Collide w/ Floor */
> #define ENVIRONMENT_INFO_SANDWICH       (1<<8)  /* Between Ceiling & Floor */
> #define ENVIRONMENT_INFO_FRONT_WALL     (1<<9)  /* (Player Exclusive) */

https://www.madori-seisaku.com/houi-kigou/
https://www.google.com/search?tbm=isch&q=%E5%8C%97%E7%9F%A2%E5%8D%B0%20%E5%9C%B0%E5%9B%B3&tbs=imgo:1
https://gist.github.com/ShimmerFairy/d2b5984e5b06e2902113ed75b5803c8e
https://cdn.discordapp.com/attachments/737559416014110740/746333107786874941/20140401003646.png

https://bin.cloudmodding.com/ewuxusedam.c
https://bin.cloudmodding.com/uxawexenum.c


(Source: jrra, notwa, GlitterBerri)

Quest System Patent

While it seems that the developers didn't end up implementing all of its features in the game, the full intended functionality of this scrapped system is actually outlined in an old patent that Nintendo applied for on 1997/11/20, during the middle of development.

OoT-Compass Patent Fig 13.png

According to the patent, the user would have the ability to place a marker from the menu screen.

OoT-Compass Patent Fig 08.png

The game would be able to simultaneously track a target, a marker set by the player, and the cardinal directions of north and south.

To paraphrase the patent, the target could include an article, such as an essential item (e.g., a treasure, weapon, etc.) that the player would be required to obtain; as well as a destination, such as a destination for an article to be delivered, a goal point, an exit, etc., to which where the player has to proceed.

The "marker" could refer to a sign which is to be put at a point, e.g., an entrance, etc., which the player has passed at least once. The player could use the marker to help them easily find their way back.

OoT-Compass Patent Fig 21.png

This system could be used in conjunction with the minimap to help a player used to 2D games to find their way around the 3D environments of the game.

(While the map in this illustration appears to be Room 1 of Fstdan, the mini-map seems to depict an early version of the first floor of Dodongo's Cavern.)

z_actor.c

Hmmm...
To do:
What does this code do? Once its function is described, maybe it's better to remove the source code from the page.

Searching for "compass", "コンパス", and "mark_model" in the file z_actor.c reveals some disabled code for a compass display.

/*-----------------------------------------------------------------------
 *
 *	Actor Data Class Construct
 *
 *----------------------------------------------------------------------*/

[Omitted]

#if 0    
    /*
     * Compass Data (For Debugging)
     */
    IREG(75) = 100;
    IREG(76) = 100;
    IREG(77) = 255;
    IREG(78) = 255;
    IREG(79) =  70;

    IREG(80) = -25;

    IREG(85) = 255;
    IREG(86) = 255;
    IREG(87) = 255;
    IREG(88) = 255;
    IREG(89) = 40;

    IREG(90) = 0;
    IREG(91) = -40;
#endif
}
#if 0
/*-----------------------------------------------------------------------
 *
 *	Compass Display
 *
 *----------------------------------------------------------------------*/
#define G_CC_PRIM_LIGHT 	PRIMITIVE, 0, SHADE, 0, PRIMITIVE, 0, SHADE, 0

extern Gfx compas_model[];
extern Gfx compass_modelT[];
extern Gfx tetra_model[];

static void compas_draw(
    Game_play 	  *game_play,
    xyz_t	  *center,
    float	  scale,
    float     	  offset_r,
    float     	  offset_h,
    short     	  rx,
    short     	  ry,
    unsigned char r,
    unsigned char g,
    unsigned char b,
    unsigned char a,
    Gfx		  *shape
)
{
    OPEN_DISP(game_play->g.graph);
    
    gDPSetPrimColor(NEXT_DISP, 0, 1,
		    r,
		    g,
		    b,
		    a);
    Matrix_translate(center->x,
		     center->y + offset_h,
		     center->z,
		     SET_MTX);
    Matrix_rotateY(((float)ry * ((2.0f * F_PI)/65536.0f)), MULT_MTX);
    Matrix_rotateX(((float)rx * ((2.0f * F_PI)/65536.0f)), MULT_MTX);
    Matrix_translate(0.0f,
		     0.0f,
		     offset_r,
		     MULT_MTX);
    Matrix_scale(scale, scale, scale, MULT_MTX);
    gSPMatrix(NEXT_DISP, Matrix_to_Mtx_new(game_play->g.graph), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
    gSPDisplayList(NEXT_DISP, shape);
    
    CLOSE_DISP(game_play->g.graph);
}
#endif
/*-----------------------------------------------------------------------
 *
 *	Actor Display (actor.h not access "Game_play" !!)
 *
 *----------------------------------------------------------------------*/

[Omitted]

#if 0    
    /*
     * Compass Display
     */
    if ( game_play->room_info.now.type != ROOM_TYPE_FIELD &&	/* Display Fixed Compass (N)? */
	 bitcheck(player_actor->actor.environment_info, ENVIRONMENT_INFO_GROUND) &&
	 !bitcheck(player_actor->action, P_ACTION_DONT_COMPAS) ) {	/* Compass Display OK? */
	
	polygon_prim(game_play->g.graph);
	gDPSetCombineMode(NEXT_DISP, G_CC_SHADE_PRIM, G_CC_SHADE_PRIM);
	gDPSetRenderMode(NEXT_DISP, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
	
	sx = player_actor->actor.home.position.x - player_actor->actor.world.position.x;
	sy = player_actor->actor.home.position.y - player_actor->actor.world.position.y;
	sz = player_actor->actor.home.position.z - player_actor->actor.world.position.z;
	sr = sqrtf((sx * sx) + (sz * sz));

	compas_draw(game_play,					/* Target Compass */
		    &player_actor->actor.world.position,
		    (float)IREG(89)/100.0f,
		    (float)IREG(91),
		    0.0f,
		    atans_table(sr, -sy), atans_table(sz, sx),
		    (unsigned char)IREG(85),
		    (unsigned char)IREG(86),
		    (unsigned char)IREG(87),
		    (unsigned char)IREG(88),
		    tetra_model);

#if 0	
	if ( game_play->room_info.now.type = ROOM_TYPE_FIELD ) {	/* Display Fixed Compass (N)? */

	    compas_draw(game_play,					/*  Fixed Compass (N) */
			&player_actor->actor.world.position,
			(float)IREG(79)/100.0f,
			(float)IREG(80),
			0.0f,
			0, 0,
			(unsigned char)IREG(75),
			(unsigned char)IREG(76),
			(unsigned char)IREG(77),
			(unsigned char)IREG(78),
			compass_modelT);
	}
#endif
    }
#endif

z_player.h

Hmmm...
To do:
What does this code do? Once its function is described, maybe it's better to remove the source code from the page.
#define	P_ACTION_DONT_COMPAS		(P_ACTION_ANCHOR_FIGHT | P_ACTION_POWER_KIRU | P_ACTION_FALL | P_ACTION_JUMP_CLIMB | \
					 P_ACTION_SUBJECT) 	

zelda_marker

Hmmm...
To do:
Is this the same as the gameplay_keep mark_model?

The leak contains an object called zelda_marker which isn't present in the final game.

gameplay_keep

Models and textures for the compass display can still be found in the final game's gameplay_keep:

Filename Identification
compas_model A single, textureless triangle.
compas_v Vertices for compas_model.
compass_v Vertices for compass_modelT.
compass_modelT A single triangle that uses the texture c_north_txt. When the player was outside of a dungeon, it would have pointed north using the "4" texture in c_north_txt. When the player was inside a dungeon, it would point towards a "home" position, which still exists in the actor struct. In this case, the "home" position would be where Link was a frame earlier.
mark_v Vertices for mark_model.
mark_model
mark_env_txt
tetra_v Vertices for tetra_model.
tetra_model Four triangles with no texture.
c_north_txt The texture used by compass_modelT.

z_eff_ss_dead.h

Hmmm...
To do:
What does this code do? Once its function is described, maybe it's better to remove the source code from the page. Given that the top of the file says "Generic Soft Sprite Effect for Defeat by Enemy", does that mean the compass would have shattered when you were killed?

The leak contains a header file for an effect file that appears to have been removed from the final game. Ocarina of Time contains ovl_Effect_Ss_Dead_Db, ovl_Effect_Ss_Dead_Dd, ovl_Effect_Ss_Dead_Ds, and ovl_Effect_Ss_Dead_Sound, but not ovl_Effect_Ss_Dead or ovl_Effect_Ss_Dead_Dk.

The header file contains commented-out code for a compass shatter effect.

#if 0
    /* Move to z_eff_ss_dead_dk.h */
/*----------------------------------------------------------------------------
 *
 * Generic Compass Shape Shatter Data Set 1
 *
 *---------------------------------------------------------------------------*/
extern void Effect_SS_Dk_ct0(
    Game *game,
    xyz_t *ppos,
    xyz_t *pvec,
    xyz_t *pacc,
    short sc,
    short sc_deff,
    int      frame);
/*----------------------------------------------------------------------------
 *
 * Generic Compass Shape Shatter Data Set 2
 *
 *---------------------------------------------------------------------------*/
extern void Effect_SS_Dk_ct1(
    Game *game,
    xyz_t *ppos,
    short sc,
    short sc_deff,
    float size,
    int      count,
    int      frame);
#endif