drawmark.c 4.03 KB
/********************************************************************************
						   NINTENDO64 Disk Drive IPL4

							  mark drawing module

							   February 26, 1997
 ********************************************************************************/

#include <ultra64.h>
#include "ipl4.h"
#include "static.h"
#include "graphics.h"

#define	MARK_RED		219,16,28
#define	MARK_BLUE		82,75,152

#define	gDPSetMaterial(g,c,a)		gDPSetEnvColor(g,c,a)


static int mesgTimming = 0;

/********************************************************************************/
/*																				*/
/*	Display "NINTENDO64".														*/
/*																				*/
/********************************************************************************/
extern void
DisplayNintendoLogo(int alpha)
{
    gDPPipeSync			(graphicp++);
    gDPSetTexturePersp	(graphicp++,G_TP_NONE);

	gSPTexture			(graphicp++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON);
	gDPSetCombineMode	(graphicp++, G_CC_ENVMODULATEIA, G_CC_ENVMODULATEIA);
	gDPSetRenderMode	(graphicp++, G_RM_XLU_SURF, G_RM_XLU_SURF2);


	gDPLoadTextureBlock_4b(graphicp++, TexNintendo64a, G_IM_FMT_I, 112, 28, 0,
			G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,	G_TX_NOLOD, G_TX_NOLOD
	);
	gDPSetMaterial(graphicp++, MARK_BLUE, alpha);
    gSPTextureRectangle(graphicp++, 36*4, 32*4, 140*4, 60*4, G_TX_RENDERTILE, 0, 0, 1024, 1024);


	gDPLoadTextureBlock_4b(graphicp++, TexNintendo64b, G_IM_FMT_I, 112, 28, 0,
			G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,	G_TX_NOLOD, G_TX_NOLOD
	);
    gSPTextureRectangle(graphicp++, 140*4, 32*4, 244*4, 60*4, G_TX_RENDERTILE, 0, 0, 1024, 1024);


	gDPLoadTextureBlock_4b(graphicp++, TexNintendo64d, G_IM_FMT_I, 16, 8, 0,
			G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,	G_TX_NOLOD, G_TX_NOLOD
	);
    gSPTextureRectangle(graphicp++, 244*4, 52*4, 260*4, 60*4, G_TX_RENDERTILE, 0, 0, 1024, 1024);



    gDPLoadTextureBlock_4b(graphicp++, TexNintendo64c, G_IM_FMT_I, 48, 22, 0,
			G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD
	);
	gDPSetMaterial(graphicp++, MARK_RED, alpha);
    gSPTextureRectangle(graphicp++, 244*4, 25*4, 292*4, 47*4, G_TX_RENDERTILE, 0, 0, 1024, 1024);


	gDPPipeSync			(graphicp++);
    gDPSetTexturePersp	(graphicp++, G_TP_PERSP);
	gSPTexture			(graphicp++, 0xffff, 0xffff, 0, 0, G_OFF);
}
/********************************************************************************/
/*																				*/
/*	Draw "Please insert disk".													*/
/*																				*/
/********************************************************************************/

#define	DISPLAY_WIDTH		160

static void
DrawInsertDisk(int posx, int posy, int alpha)
{
    gDPPipeSync			(graphicp++);
   	gDPSetTexturePersp	(graphicp++,G_TP_NONE);

	gSPTexture			(graphicp++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON);
	gDPSetCombineMode	(graphicp++, G_CC_ENVMODULATEIA, G_CC_ENVMODULATEIA);
	gDPSetRenderMode	(graphicp++, G_RM_XLU_SURF, G_RM_XLU_SURF2);

	gDPLoadTextureBlock_4b(graphicp++, TexInsertMessage, G_IM_FMT_I, DISPLAY_WIDTH, 16, 0,
			G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,	G_TX_NOLOD, G_TX_NOLOD
	);
	gDPSetEnvColor(graphicp++, 49,157,71, alpha);
	gSPTextureRectangle(graphicp++, posx*4, posy*4, (posx+DISPLAY_WIDTH)*4, (posy+16)*4, G_TX_RENDERTILE, 0, 0, 1024, 1024);

	gDPPipeSync			(graphicp++);
   	gDPSetTexturePersp	(graphicp++, G_TP_PERSP);
	gSPTexture			(graphicp++, 0xffff, 0xffff, 0, 0, G_OFF);
}
/********************************************************************************/
/*																				*/
/*	Display "Insert disk".														*/
/*																				*/
/********************************************************************************/

#define	DISPLAY_POSH		80

extern void
DisplayInsertDisk(int active)
{
	int alpha = 255;

	if (active && diskStatus == DISK_STAT_NODISK) {
		if		(mesgTimming < 6 )  alpha = mesgTimming * 48;
		else if (mesgTimming < 36)  alpha = 255;
		else if (mesgTimming < 42)  alpha = (41-mesgTimming) * 48;
		else						alpha = 0;

		DrawInsertDisk(DISPLAY_POSH, 190, alpha);
		if (++mesgTimming >= 50)  mesgTimming = 0;
	} else {
		mesgTimming = 0;
	}
}