*Changes in the Banner Class. Now loading the TPL files into memory and display from there.

This commit is contained in:
dimok321 2009-07-19 17:48:15 +00:00
parent 3d090a8bab
commit 47201c807a
25 changed files with 240 additions and 278 deletions

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: David Jelinek (djelinek@hotmail.com) \n"
"Language-Team: Last version on http://startgolf.tym.cz/czech.lang \n"
@ -493,6 +493,9 @@ msgstr "Vlevo"
msgid "Like SysMenu"
msgstr "Jako hlavní menu"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Venstre"
msgid "Like SysMenu"
msgstr "Ligesom wii-menuen"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Links"
msgid "Like SysMenu"
msgstr "Als systeemmenu"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr "Deze dol als alt dol gebruiken?"

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr ""
msgid "Like SysMenu"
msgstr ""
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Vasen"
msgid "Like SysMenu"
msgstr "Kuin wii-menu"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: Kin8\n"
"Language-Team: Badablek, Amour, ikya, OuahOuah & Kin8\n"
@ -493,6 +493,9 @@ msgstr "Gauche"
msgid "Like SysMenu"
msgstr "Menu système"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr "Charger ce DOL comme DOL alternatif ?"

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Links"
msgid "Like SysMenu"
msgstr "Wie SysMenü"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: Tusk\n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Balra"
msgid "Like SysMenu"
msgstr "Mint a Rendszermenû"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 23:50+0200\n"
"Last-Translator: Cambo \n"
"Language-Team: FoxeJoe & Cambo\n"
@ -493,6 +493,9 @@ msgstr "Sinistra"
msgid "Like SysMenu"
msgstr "Come SysMenu"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr "Vuoi caricare questo dol come dol alternativo?"

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "左"
msgid "Like SysMenu"
msgstr "Like SysMenu"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "왼쪽"
msgid "Like SysMenu"
msgstr "시스템 메뉴처럼"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Venstre"
msgid "Like SysMenu"
msgstr "Lik Systemmeny"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr "Last denne DOL som alternativ DOL?"

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Esquerda"
msgid "Like SysMenu"
msgstr "Igual ao Menu do Wii"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: Sky8000\n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Esquerda"
msgid "Like SysMenu"
msgstr "Igual ao Menu da Wii"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: Kir\n"
"Language-Team: Kir\n"
@ -493,6 +493,9 @@ msgstr "Налево"
msgid "Like SysMenu"
msgstr "как SysMenu"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "左"
msgid "Like SysMenu"
msgstr "同系统选单"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Izquierda"
msgid "Like SysMenu"
msgstr "Como Menú Sist."
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr "¿Cargar este dol como dol alternativo?"

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: Katsurou\n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Vänster"
msgid "Like SysMenu"
msgstr "Som System-menyn"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "左"
msgid "Like SysMenu"
msgstr "同系統選單"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr "載入這個dol做為替代的dol?"

View File

@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-19 12:57+0200\n"
"POT-Creation-Date: 2009-07-19 19:46+0200\n"
"PO-Revision-Date: 2009-07-18 15:18+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -493,6 +493,9 @@ msgstr "Sol"
msgid "Like SysMenu"
msgstr "Sistem Menüsü Gibi"
msgid "Load"
msgstr ""
msgid "Load this dol as alternate dol?"
msgstr ""

View File

@ -6,72 +6,109 @@
***************************************************************************/
#include "gui_banner.h"
GuiBanner::GuiBanner()
{
deg_beta=0.0;
}
GuiBanner::~GuiBanner()
{
}
GuiBanner::GuiBanner(const char *tplfilepath)
{
memory = NULL;
tplfilesize = 0;
width = 0;
height = 0;
FILE *tplfp = fopen(tplfilepath,"rb");
if(tplfp !=NULL)
{
if(tplfp !=NULL) {
unsigned short heighttemp = 0;
unsigned short widthtemp = 0;
fseek(tplfp , 0x14, SEEK_SET);
fread((void*)&heighttemp,1,2,tplfp);
fread((void*)&widthtemp,1,2,tplfp);
fseek (tplfp , 0 , SEEK_END);
tplfilesize = ftell (tplfp);
rewind (tplfp);
memory = memalign(32, tplfilesize);
if(!memory) {
fclose(tplfp);
return;
}
fread(memory, 1, tplfilesize, tplfp);
fclose(tplfp);
filepath = tplfilepath;
TPLFile tplfile;
int ret;
ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize);
if(ret < 0) {
free(memory);
memory = NULL;
return;
}
ret = TPL_GetTexture(&tplfile,0,&texObj);
if(ret < 0) {
free(memory);
memory = NULL;
return;
}
TPL_CloseTPLFile(&tplfile);
width = widthtemp;
height = heighttemp;
widescreen = 0;
filecheck = true;
}
else
{
} else {
filecheck = false;
fclose(tplfp);
}
}
GuiBanner::GuiBanner(void *mem,u32 len,u16 w, u16 h)
{
if(memory !=NULL)
GuiBanner::GuiBanner(void *mem, u32 len, int w, int h)
{
if(!mem || !len)
return;
memory = mem;
tplfilesize = len;
width = w;
height = h;
widescreen = 0;
filecheck = true;
free(mem);
TPLFile tplfile;
int ret;
ret = TPL_OpenTPLFromMemory(&tplfile, memory, tplfilesize);
if(ret < 0) {
free(memory);
memory = NULL;
return;
}
else
{
filecheck = false;
free(mem);
ret = TPL_GetTexture(&tplfile,0,&texObj);
if(ret < 0) {
free(memory);
memory = NULL;
return;
}
TPL_CloseTPLFile(&tplfile);
filecheck = true;
}
GuiBanner::~GuiBanner()
{
if(memory != NULL) {
free(memory);
memory = NULL;
}
}
//void Menu_DrawTPL(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,const char *filepath,f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow);
//void Menu_DrawTPLMem(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,const void *memory,u32 len, f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow);
void GuiBanner::Draw()
{
LOCK(this);
if(!filecheck ||!this->IsVisible())
return;
float currScale = this->GetScale();
//Menu_DrawTPL(50,70, 20, width, height, 50, filepath, 1, deg_beta, widescreen ? currScale*0.8 : currScale, currScale, 64, true);
Menu_DrawTPL(xoffset,yoffset, 50, width, height, 50, filepath, 0, deg_beta, widescreen ? currScale*0.8 : currScale, currScale, 64, true);
Menu_DrawTPLImg(this->GetLeft(), this->GetTop(), 0, width, height, &texObj, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha(), xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4);
this->UpdateEffects();
}

View File

@ -13,17 +13,23 @@
class GuiBanner : public GuiImage
{
public:
GuiBanner();
//!Constructor
//!\param tplfilepath Path of the tpl file
GuiBanner(const char *tplfilepath);
GuiBanner(void *mem,u32 len,u16 w, u16 h);
//!Constructor
//!\param mem Memory of the loaded tpl
//!\param len Filesize of the tpl
//!\param w Width of the tpl
//!\param h Height of the tpl
GuiBanner(void *mem, u32 len, int w, int h);
//!Destructor
~GuiBanner();
void Draw();
private:
f32 deg_beta;
const char *filepath;
const void *memory;
protected:
void * memory;
bool filecheck;
u32 tplfilesize;
GXTexObj texObj;
};
#endif /* _GUIBANNER_H_ */

View File

@ -27,7 +27,8 @@ extern "C"
//! Extract opening.bnr from filepath to destpath
//! Files extracted: banner.bin icon.bin and sound.bin
int extractbnrfile(char * filepath, char * destpath);
int extractbnrfile(const char * filepath, const char * destpath);
int unpackBin(const char * filename,const char * outdir);
//int unpackBanner(const char * filename,const char * outdir);
int unpackBanner(const char * gameid, const char * outdir);
//! Extract the lz77 compressed banner, icon and sound .bin

View File

@ -427,184 +427,44 @@ void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
}
void Menu_DrawTPL(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,const char *filepath,
f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow)
void Menu_DrawTPLImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, GXTexObj *texObj,
f32 degrees, f32 scaleX, f32 scaleY, u8 alpha, int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4)
{
TPLFile tplfile;
GXTexObj texObj;
TPL_OpenTPLFromFile(&tplfile,filepath);
TPL_GetTexture(&tplfile,0,&texObj); //Get
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_LoadTexObj(texObj, GX_TEXMAP0);
GX_InvalidateTexAll();
TPL_CloseTPLFile(&tplfile);
GX_SetTevOp (GX_TEVSTAGE0, GX_REPLACE);
GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);
f32 cos_beta = cos(DegToRad(deg_beta));
f32 s_offset_y = (zpos + (cos_beta * distance)) * tan(DegToRad(5));
f32 s_offset_x = (cos_beta<0?-cos_beta:cos_beta) * s_offset_y;
f32 s_offset_z = (s_offset_y<0 ? 0 : s_offset_y)*2;
Mtx m,m1,m2,m3,m4, mv;
Mtx m,m1,m2, mv;
width *=.5;
height*=.5;
guMtxIdentity (m4);
guMtxTransApply(m4,m4, 0, 0, distance);
guMtxIdentity (m1);
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
guVector axis2 = (guVector) {0 , 1, 0 };
guMtxRotAxisDeg (m2, &axis2, deg_beta);
guVector axis = (guVector) {0 , 0, 1 };
guMtxRotAxisDeg (m3, &axis, deg_alpha);
// guMtxConcat(m2,m1,m);
guMtxConcat(m3,m4,m3); // move distance then rotate z-axis
guMtxConcat(m2,m3,m2); // rotate y-axis
guMtxConcat(m1,m2,m); // scale
guMtxRotAxisDeg (m2, &axis, degrees);
guMtxConcat(m1,m2,m);
if(shadow)
guMtxTransApply(m,m, xpos+width+0.5+s_offset_x,ypos+height+0.5+s_offset_y,zpos-s_offset_z);
else
guMtxTransApply(m,m, xpos+width+0.5,ypos+height+0.5,zpos);
guMtxConcat (GXmodelView2D, m, mv);
GX_LoadPosMtxImm (mv, GX_PNMTX0);
if(shadow)
{
GX_Begin(GX_QUADS, GX_VTXFMT0,4);
GX_Position3f32(-width, -height, 0);
GX_Color4u8(0,0,0,alpha);
GX_TexCoord2f32(0, 0);
GX_Position3f32(width, -height, 0);
GX_Color4u8(0,0,0,alpha);
GX_TexCoord2f32(1, 0);
GX_Position3f32(width, height, 0);
GX_Color4u8(0,0,0,alpha);
GX_TexCoord2f32(1, 1);
GX_Position3f32(-width, height, 0);
GX_Color4u8(0,0,0,alpha);
GX_TexCoord2f32(0, 1);
}
else
{
GX_Begin(GX_QUADS, GX_VTXFMT0,4);
GX_Position3f32(-width, -height, 0);
GX_Position3f32(-width+XX1 , -height+YY1, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(0, 0);
GX_Position3f32(width, -height, 0);
GX_Position3f32(width+XX2, -height+YY2, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(1, 0);
GX_Position3f32(width, height, 0);
GX_Position3f32(width+XX3, height+YY3, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(1, 1);
GX_Position3f32(-width, height, 0);
GX_Position3f32(-width+XX4, height+YY4, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(0, 1);
}
GX_End();
GX_LoadPosMtxImm (GXmodelView2D, GX_PNMTX0);
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
}
void Menu_DrawTPLMem(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,const void *memory,u32 len,
f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow)
{
TPLFile tplfile;
GXTexObj texObj;
TPL_OpenTPLFromMemory(&tplfile, memory,len);
TPL_GetTexture(&tplfile,0,&texObj); //Get
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_InvalidateTexAll();
TPL_CloseTPLFile(&tplfile);
GX_SetTevOp (GX_TEVSTAGE0, GX_REPLACE);
GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);
f32 cos_beta = cos(DegToRad(deg_beta));
f32 s_offset_y = (zpos + (cos_beta * distance)) * tan(DegToRad(5));
f32 s_offset_x = (cos_beta<0?-cos_beta:cos_beta) * s_offset_y;
f32 s_offset_z = (s_offset_y<0 ? 0 : s_offset_y)*2;
Mtx m,m1,m2,m3,m4, mv;
width *=.5;
height*=.5;
guMtxIdentity (m4);
guMtxTransApply(m4,m4, 0, 0, distance);
guMtxIdentity (m1);
guMtxScaleApply(m1,m1,scaleX,scaleY,1.0);
guVector axis2 = (guVector) {0 , 1, 0 };
guMtxRotAxisDeg (m2, &axis2, deg_beta);
guVector axis = (guVector) {0 , 0, 1 };
guMtxRotAxisDeg (m3, &axis, deg_alpha);
// guMtxConcat(m2,m1,m);
guMtxConcat(m3,m4,m3); // move distance then rotate z-axis
guMtxConcat(m2,m3,m2); // rotate y-axis
guMtxConcat(m1,m2,m); // scale
if(shadow)
guMtxTransApply(m,m, xpos+width+0.5+s_offset_x,ypos+height+0.5+s_offset_y,zpos-s_offset_z);
else
guMtxTransApply(m,m, xpos+width+0.5,ypos+height+0.5,zpos);
guMtxConcat (GXmodelView2D, m, mv);
GX_LoadPosMtxImm (mv, GX_PNMTX0);
if(shadow)
{
GX_Begin(GX_QUADS, GX_VTXFMT0,4);
GX_Position3f32(-width, -height, 0);
GX_Color4u8(0,0,0,alpha);
GX_TexCoord2f32(0, 0);
GX_Position3f32(width, -height, 0);
GX_Color4u8(0,0,0,alpha);
GX_TexCoord2f32(1, 0);
GX_Position3f32(width, height, 0);
GX_Color4u8(0,0,0,alpha);
GX_TexCoord2f32(1, 1);
GX_Position3f32(-width, height, 0);
GX_Color4u8(0,0,0,alpha);
GX_TexCoord2f32(0, 1);
}
else
{
GX_Begin(GX_QUADS, GX_VTXFMT0,4);
GX_Position3f32(-width, -height, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(0, 0);
GX_Position3f32(width, -height, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(1, 0);
GX_Position3f32(width, height, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(1, 1);
GX_Position3f32(-width, height, 0);
GX_Color4u8(0xFF,0xFF,0xFF,alpha);
GX_TexCoord2f32(0, 1);
}
GX_End();
GX_LoadPosMtxImm (GXmodelView2D, GX_PNMTX0);

View File

@ -17,10 +17,8 @@ void ResetVideo_Menu();
void Menu_Render();
void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[],
f32 degrees, f32 scaleX, f32 scaleY, u8 alphaF ,int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4);
void Menu_DrawTPL(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,
const char *filepath,f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow);
void Menu_DrawTPLMem(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,
const void *memory,u32 len, f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow);
void Menu_DrawTPLImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, GXTexObj *texObj,
f32 degrees, f32 scaleX, f32 scaleY, u8 alpha, int XX1, int YY1,int XX2, int YY2,int XX3, int YY3,int XX4, int YY4);
void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled);
extern int screenheight;