diff --git a/source/cfg.h b/source/cfg.h index e79e55b1..0ed69a65 100644 --- a/source/cfg.h +++ b/source/cfg.h @@ -266,6 +266,7 @@ enum { yes, sysmenu, wtf, + disk3d, }; enum { us, diff --git a/source/images/dialogue_box_startgame.png b/source/images/dialogue_box_startgame.png index cd491ffe..f98eb8e2 100644 Binary files a/source/images/dialogue_box_startgame.png and b/source/images/dialogue_box_startgame.png differ diff --git a/source/images/wdialogue_box_startgame.png b/source/images/wdialogue_box_startgame.png index 72bc9a4d..053c5fec 100644 Binary files a/source/images/wdialogue_box_startgame.png and b/source/images/wdialogue_box_startgame.png differ diff --git a/source/libwiigui/gui.h b/source/libwiigui/gui.h index 48a2fe5c..dae34f19 100644 --- a/source/libwiigui/gui.h +++ b/source/libwiigui/gui.h @@ -560,11 +560,13 @@ class GuiImage : public GuiElement //!Sets the image rotation angle for drawing //!\param a Angle (in degrees) void SetAngle(float a); + //!Gets the image rotation angle for drawing + float GetAngle(); //!Sets the number of times to draw the image horizontally //!\param t Number of times to draw the image void SetTile(int t); - // not NULL set horizontal scale to 0.75 //added - void SetWidescreen(short w); + // true set horizontal scale to 0.8 //added + void SetWidescreen(bool w); //!Constantly called to draw the image void Draw(); //!Gets the image data @@ -595,6 +597,7 @@ class GuiImage : public GuiElement //!Does not alter the image data //!\param s Alpha amount to draw over the image void SetStripe(int s); + s32 z; protected: int imgType; //!< Type of image data (IMAGE_TEXTURE, IMAGE_COLOR, IMAGE_DATA) u8 * image; //!< Poiner to image data. May be shared with GuiImageData data @@ -654,7 +657,7 @@ class GuiText : public GuiElement //!Get the Horizontal Size of Text int GetTextWidth(); // not NULL set horizontal scale to 0.75 //added - void SetWidescreen(short w); + void SetWidescreen(bool w); //!Constantly called to draw the text void Draw(); protected: @@ -684,7 +687,7 @@ class GuiTooltip : public GuiElement //!Sets the text of the GuiTooltip element //!\param t Text void SetText(const char * t); - void SetWidescreen(short w); // timely a dummy + void SetWidescreen(bool w); // timely a dummy //!Constantly called to draw the GuiButton void Draw(); diff --git a/source/libwiigui/gui_diskcover.cpp b/source/libwiigui/gui_diskcover.cpp new file mode 100644 index 00000000..b803bc54 --- /dev/null +++ b/source/libwiigui/gui_diskcover.cpp @@ -0,0 +1,78 @@ +#include "gui_diskcover.h" + + +GuiDiskCover::GuiDiskCover() +{ + deg_beta=0.0; + eff_step=0; +// spin_angle = 0; + spin_speedup = 1.0; + spin_up = false; +} +GuiDiskCover::GuiDiskCover(GuiImageData *Disk) : GuiImage(Disk) +{ + deg_beta=0.0; + eff_step=0; +// spin_angle = 0; + spin_speedup = 1.0; + spin_up = false; +} +GuiDiskCover::~GuiDiskCover() +{ +} + +void GuiDiskCover::SetBeta(f32 beta) +{ + deg_beta=beta; +} +void GuiDiskCover::SetBetaRotateEffect(f32 beta, u16 step) +{ + eff_beta = beta/(f32)step; + eff_step = step; +} +bool GuiDiskCover::GetBetaRotateEffect() +{ + return eff_step != 0; +} + +void GuiDiskCover::SetSpin(bool Up) +{ + spin_up = Up; +} + +void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,u8 data[], + f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow); +void Menu_DrawDiskCoverShadow(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,u8 data[], + f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow); + +void GuiDiskCover::Draw() +{ + LOCK(this); + if(!image || !this->IsVisible()) + return; + float currScale = this->GetScale(); +// Menu_DrawDiskCoverShadow(this->GetLeft(), this->GetTop(), 190, width, height, 40, image, imageangle, deg_beta, widescreen ? currScale*0.8 : currScale, currScale, this->GetAlpha(), true); + Menu_DrawDiskCover(this->GetLeft(), this->GetTop(), 50, width, height, 55, image, imageangle, deg_beta, widescreen ? currScale*0.8 : currScale, currScale, 128, true); + Menu_DrawDiskCover(this->GetLeft(), this->GetTop(), 50, width, height, 55, image, imageangle, deg_beta, widescreen ? currScale*0.8 : currScale, currScale, this->GetAlpha(), false); + + if(eff_step) + { + deg_beta += eff_beta; + eff_step--; + } + GuiImage::imageangle += spin_speedup; + while(GuiImage::imageangle >= 360.0) GuiImage::imageangle -= 360.0; + + if(spin_up) + { + if (spin_speedup < 11) // speed up + spin_speedup += 0.20; + } + else + { + if (spin_speedup > 1) + spin_speedup -=0.05; //slow down + } + + this->UpdateEffects(); +} diff --git a/source/libwiigui/gui_diskcover.h b/source/libwiigui/gui_diskcover.h new file mode 100644 index 00000000..74d5a788 --- /dev/null +++ b/source/libwiigui/gui_diskcover.h @@ -0,0 +1,42 @@ +#ifndef _GUIDISCCOVER_H_ +#define _GUIDISCCOVER_H_ + +#include "gui.h" + + +class GuiDiskCover : public GuiImage +{ +public: + GuiDiskCover(); + GuiDiskCover(GuiImageData * img); + ~GuiDiskCover(); + void SetBeta(f32 beta); + void SetBetaRotateEffect(f32 beta, u16 Step); + bool GetBetaRotateEffect(); + + void SetSpin(bool Up); + void Draw(); +private: + f32 deg_beta; + f32 eff_beta; + u16 eff_step; + +// f32 spin_angle; + f32 spin_speedup; + bool spin_up; +}; + + + + + + + + + + + + + + +#endif /* _GUIDISCCOVER_H_ */ diff --git a/source/libwiigui/gui_element.cpp b/source/libwiigui/gui_element.cpp index 4a6d1ca8..8cc70a38 100644 --- a/source/libwiigui/gui_element.cpp +++ b/source/libwiigui/gui_element.cpp @@ -405,6 +405,7 @@ void GuiElement::SetRumble(bool r) int GuiElement::GetEffect() { + LOCK(this); return effects; } diff --git a/source/libwiigui/gui_image.cpp b/source/libwiigui/gui_image.cpp index 68b5c181..3271e27a 100644 --- a/source/libwiigui/gui_image.cpp +++ b/source/libwiigui/gui_image.cpp @@ -117,6 +117,10 @@ void GuiImage::SetAngle(float a) LOCK(this); imageangle = a; } +float GuiImage::GetAngle() +{ + return imageangle; +} void GuiImage::SetTile(int t) { @@ -124,7 +128,7 @@ void GuiImage::SetTile(int t) tile = t; } -void GuiImage::SetWidescreen(short w) +void GuiImage::SetWidescreen(bool w) { LOCK(this); widescreen = w; @@ -233,7 +237,7 @@ void GuiImage::Draw() if(tile > 0) { for(int i=0; iGetTop(), width, height, image, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha()); + Menu_DrawImg(currLeft+width*i, this->GetTop(), 0, width, height, image, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha()); } else { @@ -241,7 +245,7 @@ void GuiImage::Draw() if(scale != 1) currLeft = currLeft - width/2 + (width*scale)/2; - Menu_DrawImg(currLeft, this->GetTop(), width, height, image, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha()); + Menu_DrawImg(currLeft, this->GetTop(), 0, width, height, image, imageangle, widescreen ? currScale*0.80 : currScale, currScale, this->GetAlpha()); } if(stripe > 0) diff --git a/source/libwiigui/gui_text.cpp b/source/libwiigui/gui_text.cpp index e7213f0b..02b82985 100644 --- a/source/libwiigui/gui_text.cpp +++ b/source/libwiigui/gui_text.cpp @@ -11,6 +11,7 @@ #include "gui.h" static int currentSize = 0; +static int currentWidescreen = 0; static int presetSize = 0; static int presetMaxWidth = 0; static int presetAlignmentHor = 0; @@ -165,15 +166,21 @@ int GuiText::GetTextWidth() LOCK(this); int newSize = size*this->GetScale(); - if(newSize != currentSize) + if(newSize != currentSize || currentWidescreen != widescreen) { //fontSystem->changeSize(newSize); - (font ? font : fontSystem)->changeSize(newSize, widescreen ? (newSize*3)>>2 : 0); + (font ? font : fontSystem)->changeSize(newSize, widescreen ? newSize*0.8 : 0); currentSize = newSize; + currentWidescreen = widescreen; } return (font ? font : fontSystem)->getWidth(text); } +void GuiText::SetWidescreen(bool w) +{ + LOCK(this); + widescreen = w; +} /** * Draw the text on screen */ @@ -191,11 +198,12 @@ void GuiText::Draw() int newSize = size*this->GetScale(); - if(newSize != currentSize) + if(newSize != currentSize || currentWidescreen != widescreen) { //fontSystem->changeSize(newSize); - (font ? font : fontSystem)->changeSize(newSize, widescreen ? (newSize*3)>>2 : 0); + (font ? font : fontSystem)->changeSize(newSize, widescreen ? newSize*0.8 : 0); currentSize = newSize; + currentWidescreen = widescreen; } int voffset = 0; diff --git a/source/libwiigui/gui_tooltip.cpp b/source/libwiigui/gui_tooltip.cpp index 20bc310d..c504bd77 100644 --- a/source/libwiigui/gui_tooltip.cpp +++ b/source/libwiigui/gui_tooltip.cpp @@ -72,7 +72,7 @@ void GuiTooltip::SetText(const char * t) width = leftImage.GetWidth() + tile_cnt * tileImage.GetWidth() + rightImage.GetWidth(); } -void GuiTooltip::SetWidescreen(short){} +void GuiTooltip::SetWidescreen(bool){} /* * Draw the Tooltip on screen */ diff --git a/source/menu.cpp b/source/menu.cpp index 04095a7a..9a5ad11a 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -37,6 +37,7 @@ #include "language.h" #include "libwiigui/gui_customoptionbrowser.h" #include "libwiigui/gui_gamebrowser.h" +#include "libwiigui/gui_diskcover.h" #include "mp3s.h" #include "fatmounter.h" @@ -57,9 +58,9 @@ static GuiImageData * background = NULL; static char prozent[10] = " "; static char timet[50] = " "; static char sizeshow[20] = " "; -static GuiText prTxt(prozent, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); -static GuiText timeTxt(prozent, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); -static GuiText sizeTxt(sizeshow, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); +static GuiText prTxt(prozent, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); +static GuiText timeTxt(prozent, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); +static GuiText sizeTxt(sizeshow, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); static GuiText *GameIDTxt = NULL; static GuiText *GameRegionTxt = NULL; static GuiSound * bgMusic = NULL; @@ -201,9 +202,9 @@ static void WindowCredits(void * ptr) GuiImage starImg(&star); starImg.SetWidescreen(CFG.widescreen); //added starImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP); - starImg.SetPosition(500,335); + starImg.SetPosition(505,350); - int numEntries = 24; + int numEntries = 25; GuiText * txt[numEntries]; txt[i] = new GuiText(LANGUAGE.Credits, 26, (GXColor){255, 255, 255, 255}); @@ -246,6 +247,10 @@ static void WindowCredits(void * ptr) txt[i] = new GuiText("giantpune"); txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(320,y); i++; + y+=22; + txt[i] = new GuiText("ardi"); + txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); txt[i]->SetPosition(320,y); + i++; y+=24; txt[i] = new GuiText("Design:"); @@ -347,7 +352,7 @@ static void WindowCredits(void * ptr) { #ifdef HW_RVL if(userInput[i].wpad.ir.valid) - Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, + Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, 200.0, 96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, CFG.widescreen? 0.8 : 1, 1, 255); if(Settings.rumble == RumbleOn){ DoRumble(i); @@ -435,6 +440,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, GuiText btn1Txt(btn1Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes){ + btn1Txt.SetWidescreen(CFG.widescreen); btn1Img.SetWidescreen(CFG.widescreen);}/////////// GuiButton btn1(btnOutline.GetWidth(), btnOutline.GetHeight()); btn1.SetLabel(&btn1Txt); @@ -448,6 +454,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, GuiText btn2Txt(btn2Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes){ + btn2Txt.SetWidescreen(CFG.widescreen); btn2Img.SetWidescreen(CFG.widescreen);}/////////// GuiButton btn2(btnOutline.GetWidth(), btnOutline.GetHeight()); btn2.SetLabel(&btn2Txt); @@ -462,6 +469,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, GuiText btn3Txt(btn3Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage btn3Img(&btnOutline); if (Settings.wsprompt == yes){ + btn3Txt.SetWidescreen(CFG.widescreen); btn3Img.SetWidescreen(CFG.widescreen);}/////////// GuiButton btn3(btnOutline.GetWidth(), btnOutline.GetHeight()); btn3.SetLabel(&btn3Txt); @@ -476,6 +484,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, GuiText btn4Txt(btn4Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage btn4Img(&btnOutline); if (Settings.wsprompt == yes){ + btn4Txt.SetWidescreen(CFG.widescreen); btn4Img.SetWidescreen(CFG.widescreen);}/////////// GuiButton btn4(btnOutline.GetWidth(), btnOutline.GetHeight()); btn4.SetLabel(&btn4Txt); @@ -489,10 +498,10 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust buttons for widescreen msgTxt.SetMaxWidth(330); - btn1Txt.SetFontSize(20); - btn2Txt.SetFontSize(20); - btn3Txt.SetFontSize(20); - btn4Txt.SetFontSize(20); +// btn1Txt.SetFontSize(20); +// btn2Txt.SetFontSize(20); +// btn3Txt.SetFontSize(20); +// btn4Txt.SetFontSize(20); if(btn2Label && !btn3Label && !btn4Label) { @@ -754,15 +763,16 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, titleTxt.SetPosition(-180,40); titleTxt.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50); - GuiText btn1Txt(" Close", 28, (GXColor){0, 0, 0, 255}); + GuiText closeTxt(" Close", 28, (GXColor){0, 0, 0, 255}); GuiImage closeImg(&close); if (Settings.wsprompt == yes){ + closeTxt.SetWidescreen(CFG.widescreen); closeImg.SetWidescreen(CFG.widescreen);}/////////// GuiButton closeBtn(close.GetWidth(), close.GetHeight()); closeBtn.SetImage(&closeImg); closeBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); closeBtn.SetPosition(205,42); - closeBtn.SetLabel(&btn1Txt); + closeBtn.SetLabel(&closeTxt); closeBtn.SetRumble(false); closeBtn.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50); @@ -777,9 +787,10 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, btn1.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50); btn1.SetPosition(0, 0); - GuiText btn2Txt(btn1Label, 38, (GXColor){0, 0, 0, 255}); + GuiText btn2Txt(btn1Label, 34, (GXColor){0, 0, 0, 255}); GuiImage btn2Img(&button); if (Settings.wsprompt == yes){ + btn2Txt.SetWidescreen(CFG.widescreen); btn2Img.SetWidescreen(CFG.widescreen);}/////////// GuiButton btn2(button.GetWidth(), button.GetHeight()); btn2.SetLabel(&btn2Txt); @@ -793,9 +804,10 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, btn2.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50); btn2.SetRumble(false); - GuiText btn3Txt(btn2Label, 38, (GXColor){0, 0, 0, 255}); + GuiText btn3Txt(btn2Label, 34, (GXColor){0, 0, 0, 255}); GuiImage btn3Img(&button); if (Settings.wsprompt == yes){ + btn3Txt.SetWidescreen(CFG.widescreen); btn3Img.SetWidescreen(CFG.widescreen);}/////////// GuiButton btn3(button.GetWidth(), button.GetHeight()); btn3.SetLabel(&btn3Txt); @@ -822,8 +834,8 @@ WindowExitPrompt(const char *title, const char *msg, const char *btn1Label, btn4.SetPosition(0,0); btn4.SetEffect(EFFECT_SLIDE_BOTTOM | EFFECT_SLIDE_IN, 50); - btn2Txt.SetFontSize(22); - btn3Txt.SetFontSize(22); +// btn2Txt.SetFontSize(22); +// btn3Txt.SetFontSize(22); GuiImage wiimoteImg(&wiimote); if (Settings.wsprompt == yes){wiimoteImg.SetWidescreen(CFG.widescreen);} @@ -1019,10 +1031,12 @@ int GameWindowPrompt() GuiTooltip nameBtnTT(LANGUAGE.RenameGameonWBFS); if (Settings.wsprompt == yes) nameBtnTT.SetWidescreen(CFG.widescreen); - GuiText msgTxt("", 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{50, 50, 50, 255}); + GuiText nameTxt("", 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{50, 50, 50, 255}); + if (Settings.wsprompt == yes) + nameTxt.SetWidescreen(CFG.widescreen); GuiButton nameBtn(120,50); - nameBtn.SetLabel(&msgTxt); - nameBtn.SetLabelOver(&msgTxt); + nameBtn.SetLabel(&nameTxt); +// nameBtn.SetLabelOver(&nameTxt); nameBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); nameBtn.SetPosition(0,-122); nameBtn.SetSoundOver(&btnSoundOver); @@ -1038,10 +1052,17 @@ int GameWindowPrompt() sizeTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); sizeTxt.SetPosition(-60,70); - GuiImage diskImg; +// GuiImage diskImg; + GuiDiskCover diskImg; diskImg.SetWidescreen(CFG.widescreen); diskImg.SetAlignment(ALIGN_LEFT, ALIGN_TOP); diskImg.SetAngle(angle); + GuiDiskCover diskImg2; + diskImg2.SetWidescreen(CFG.widescreen); + diskImg2.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); + diskImg2.SetPosition(0, -20); + diskImg2.SetAngle(angle); + diskImg2.SetBeta(180); GuiButton btn1(160, 160); btn1.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); @@ -1057,6 +1078,7 @@ int GameWindowPrompt() GuiText btn2Txt(LANGUAGE.Back, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes){ + btn2Txt.SetWidescreen(CFG.widescreen); btn2Img.SetWidescreen(CFG.widescreen);}/////////// GuiButton btn2(btnOutline.GetWidth(), btnOutline.GetHeight()); //check if unlocked @@ -1082,6 +1104,7 @@ int GameWindowPrompt() GuiText btn3Txt(LANGUAGE.settings, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage btn3Img(&btnOutline); if (Settings.wsprompt == yes){ + btn3Txt.SetWidescreen(CFG.widescreen); btn3Img.SetWidescreen(CFG.widescreen);} GuiButton btn3(btnOutline.GetWidth(), btnOutline.GetHeight()); btn3.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM); @@ -1118,7 +1141,7 @@ int GameWindowPrompt() promptWindow.Append(&dialogBoxImg); promptWindow.Append(&nameBtn); promptWindow.Append(&sizeTxt); - promptWindow.Append(&btn1); +// promptWindow.Append(&btn1); // move down at last apended promptWindow.Append(&btn2); promptWindow.Append(&btnLeft); promptWindow.Append(&btnRight); @@ -1129,8 +1152,12 @@ int GameWindowPrompt() promptWindow.Append(&btn3); } - short changed = 3; + promptWindow.Append(&diskImg2); + promptWindow.Append(&btn1); + + short changed = -1; GuiImageData * diskCover = NULL; + GuiImageData * diskCover2 = NULL; promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50); @@ -1139,11 +1166,20 @@ int GameWindowPrompt() if (changed == 1){ promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 50); } - if (changed == 2){ + else if (changed == 2){ promptWindow.SetEffect(EFFECT_SLIDE_RIGHT | EFFECT_SLIDE_IN, 50); } + else if (changed == 3 || changed == 4) + { + if(diskCover2) + delete diskCover2; + diskCover2 = NULL; + if(diskCover) + diskCover2 = diskCover; + diskCover = NULL; + } - changed = 0; +// changed = 0; //load disc image based or what game is seleted struct discHdr * header = &gameList[gameSelected]; WBFS_GameSize(header->id, &size); @@ -1163,72 +1199,93 @@ int GameWindowPrompt() strncat(gameName, "...", 3); } - snprintf(imgPath,sizeof(imgPath),"%s%s.png", CFG.disc_path, IDFull); //changed to current id if (diskCover) delete diskCover; + snprintf(imgPath,sizeof(imgPath),"%s%s.png", CFG.disc_path, IDFull); //changed to current full id diskCover = new GuiImageData(imgPath,0); if (!diskCover->GetImage()) { delete diskCover; - snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.disc_path, ID); //changed to current full id + snprintf(imgPath, sizeof(imgPath), "%s%s.png", CFG.disc_path, ID); //changed to current id diskCover = new GuiImageData(imgPath, 0); if (!diskCover->GetImage()) { delete diskCover; + snprintf(imgPath, sizeof(imgPath), "%snodisc.png", CFG.disc_path); //changed to nodisc.png diskCover = new GuiImageData(imgPath,nodisc_png); } } diskImg.SetImage(diskCover); + + + if (changed == 3){ + diskImg.SetBeta(180); + diskImg.SetBetaRotateEffect(-90, 15); + diskImg2.SetImage(diskCover2); + diskImg2.SetAngle(diskImg.GetAngle()); + diskImg2.SetBeta(0); + diskImg2.SetBetaRotateEffect(-90, 15); + sizeTxt.SetEffect(EFFECT_FADE, -17); + nameTxt.SetEffect(EFFECT_FADE, -17); + ResumeGui(); + while(nameTxt.GetEffect() > 0 || diskImg.GetBetaRotateEffect()) usleep(50); + HaltGui(); + diskImg.SetBetaRotateEffect(-90, 15); + diskImg2.SetBetaRotateEffect(-90, 15); + sizeTxt.SetEffect(EFFECT_FADE, 17); + nameTxt.SetEffect(EFFECT_FADE, 17); + } + else if (changed == 4){ + diskImg.SetBeta(180); + diskImg.SetBetaRotateEffect(90, 15); + diskImg2.SetImage(diskCover2); + diskImg2.SetAngle(diskImg.GetAngle()); + diskImg2.SetBeta(0); + diskImg2.SetBetaRotateEffect(90, 15); + sizeTxt.SetEffect(EFFECT_FADE, -17); + nameTxt.SetEffect(EFFECT_FADE, -17); + ResumeGui(); + while(nameTxt.GetEffect() > 0 || diskImg.GetBetaRotateEffect()) usleep(50); + HaltGui(); + diskImg.SetBetaRotateEffect(90, 15); + diskImg2.SetBetaRotateEffect(90, 15); + sizeTxt.SetEffect(EFFECT_FADE, 17); + nameTxt.SetEffect(EFFECT_FADE, 17); + } + sizeTxt.SetText(sizeText); - msgTxt.SetText(gameName); + nameTxt.SetText(gameName); char* pch; pch=strrchr((gameName),'_'); - if (pch!=NULL){msgTxt.SetPosition(0, 16);} - else {msgTxt.SetPosition(0, 1);} + if (pch!=NULL){nameTxt.SetPosition(0, 16);} + else {nameTxt.SetPosition(0, 1);} - - HaltGui(); - mainWindow->SetState(STATE_DISABLED); - mainWindow->Append(&promptWindow); - mainWindow->ChangeFocus(&promptWindow); + if(changed != 3 && changed != 4) // changed==3 or changed==4 --> only Resume the GUI + { + HaltGui(); + mainWindow->SetState(STATE_DISABLED); + mainWindow->Append(&promptWindow); + mainWindow->ChangeFocus(&promptWindow); + } ResumeGui(); - float speedup = 1; //speedup increases while disc is selected - + changed = 0; while(choice == -1) { - VIDEO_WaitVSync(); - //angle++; - angle = int(angle+speedup) % 360; - //disc speedup and slowdown - if (btn1.GetState() == STATE_SELECTED) { //if mouse over - if (speedup < 11) // speed up - { - speedup = (speedup+0.20); - } - } - else //if not mouse over - { - if (speedup > 1) {speedup = (speedup-0.05);} //slow down - } - if (speedup < 1) - { - speedup = 1; - } - diskImg.SetAngle(angle); - + diskImg.SetSpin(btn1.GetState() == STATE_SELECTED); + diskImg2.SetSpin(btn1.GetState() == STATE_SELECTED); if(shutdown == 1) //for power button { wiilight(0); Sys_Shutdown(); } - if(reset == 1) + if(reset == 1) //for reset button Sys_Reboot(); if(btn1.GetState() == STATE_CLICKED) { //boot @@ -1324,16 +1381,38 @@ int GameWindowPrompt() btnLeft.ResetState(); break; } + + else if((btnRight.GetState() == STATE_CLICKED) && (Settings.xflip == disk3d)){//next game +// diskImg.SetBetaRotateEffect(45, 90); + changed = 3; + btnClick.Play(); + gameSelected = (gameSelected + 1) % gameCnt; + btnRight.ResetState(); + break; + } + + else if((btnLeft.GetState() == STATE_CLICKED) && (Settings.xflip == disk3d)){//previous game +// diskImg.SetBetaRotateEffect(-45, 90); +// promptWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 1/*50*/); + changed = 4; + btnClick.Play(); + gameSelected = (gameSelected - 1 + gameCnt) % gameCnt; + btnLeft.ResetState(); + break; + } } while(promptWindow.GetEffect() > 0) usleep(50); HaltGui(); - mainWindow->Remove(&promptWindow); - - ResumeGui(); + if(changed != 3 && changed != 4) // changed==3 or changed==4 --> only Halt the GUI + { + mainWindow->Remove(&promptWindow); + ResumeGui(); + } } delete diskCover; + delete diskCover2; return choice; } @@ -1378,6 +1457,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char * GuiText btn1Txt(btn1Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes){ + btn1Txt.SetWidescreen(CFG.widescreen); btn1Img.SetWidescreen(CFG.widescreen);}/////////// GuiButton btn1(btnOutline.GetWidth(), btnOutline.GetHeight()); @@ -1404,6 +1484,7 @@ DiscWait(const char *title, const char *msg, const char *btn1Label, const char * GuiText btn2Txt(btn2Label, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage btn2Img(&btnOutline); if (Settings.wsprompt == yes){ + btn2Txt.SetWidescreen(CFG.widescreen); btn2Img.SetWidescreen(CFG.widescreen);}/////////// GuiButton btn2(btnOutline.GetWidth(), btnOutline.GetHeight()); btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); @@ -1588,6 +1669,7 @@ int NetworkInitPromp(int choice2) GuiText btn1Txt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes){ + btn1Txt.SetWidescreen(CFG.widescreen); btn1Img.SetWidescreen(CFG.widescreen);}/////////// GuiButton btn1(btnOutline.GetWidth(), btnOutline.GetHeight()); btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); @@ -1938,6 +2020,7 @@ ProgressDownloadWindow(int choice2) GuiText btn1Txt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage btn1Img(&btnOutline); if (Settings.wsprompt == yes){ + btn1Txt.SetWidescreen(CFG.widescreen); btn1Img.SetWidescreen(CFG.widescreen);} GuiButton btn1(btnOutline.GetWidth(), btnOutline.GetHeight()); btn1.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM); @@ -2095,7 +2178,7 @@ UpdateGUI (void *arg) for(int i=3; i >= 0; i--) // so that player 1's cursor appears on top! { if(userInput[i].wpad.ir.valid) - Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, + Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, 200.0, 96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, CFG.widescreen? 0.8 : 1, 1, 255); if(Settings.rumble == RumbleOn) { @@ -2263,6 +2346,7 @@ static int OnScreenKeyboard(char * var, u32 maxlen, int min) GuiText okBtnTxt(LANGUAGE.ok, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage okBtnImg(&btnOutline); if (Settings.wsprompt == yes){ + okBtnTxt.SetWidescreen(CFG.widescreen); okBtnImg.SetWidescreen(CFG.widescreen);}/////////// GuiButton okBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); @@ -2279,6 +2363,7 @@ static int OnScreenKeyboard(char * var, u32 maxlen, int min) GuiText cancelBtnTxt(LANGUAGE.Cancel, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); //{0, 0, 0, 255}); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes){ + cancelBtnTxt.SetWidescreen(CFG.widescreen); cancelBtnImg.SetWidescreen(CFG.widescreen);}/////////// GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); cancelBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); @@ -3716,6 +3801,7 @@ static int MenuSettings() backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes){ + backBtnTxt.SetWidescreen(CFG.widescreen); backBtnImg.SetWidescreen(CFG.widescreen);} GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); @@ -4021,7 +4107,7 @@ static int MenuSettings() { if ( Settings.cios > 1 ) Settings.cios = 0; - if ( Settings.xflip > 3 ) + if ( Settings.xflip > 4 ) Settings.xflip = 0; if ( Settings.qboot > 1 ) Settings.qboot = 0; @@ -4043,6 +4129,7 @@ static int MenuSettings() else if (Settings.xflip == yes) sprintf (options2.value[2],"%s/%s",LANGUAGE.Left,LANGUAGE.Prev); else if (Settings.xflip == sysmenu) sprintf (options2.value[2],"%s", LANGUAGE.LikeSysMenu); else if (Settings.xflip == wtf) sprintf (options2.value[2],"%s/%s",LANGUAGE.Right,LANGUAGE.Prev); + else if (Settings.xflip == disk3d) sprintf (options2.value[2],"DiskFlip"); if (Settings.qboot == no) sprintf (options2.value[3],"%s",LANGUAGE.No); else if (Settings.qboot == yes) sprintf (options2.value[3],"%s",LANGUAGE.Yes); @@ -4646,6 +4733,7 @@ int GameSettings(struct discHdr * header) saveBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage saveBtnImg(&btnOutline); if (Settings.wsprompt == yes){ + saveBtnTxt.SetWidescreen(CFG.widescreen); saveBtnImg.SetWidescreen(CFG.widescreen);} GuiButton saveBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); saveBtn.SetScale(0.9); @@ -4661,6 +4749,7 @@ int GameSettings(struct discHdr * header) cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes){ + cancelBtnTxt.SetWidescreen(CFG.widescreen); cancelBtnImg.SetWidescreen(CFG.widescreen);} GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); cancelBtn.SetScale(0.9); @@ -4677,6 +4766,7 @@ int GameSettings(struct discHdr * header) deleteBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage deleteBtnImg(&btnOutline); if (Settings.wsprompt == yes){ + deleteBtnTxt.SetWidescreen(CFG.widescreen); deleteBtnImg.SetWidescreen(CFG.widescreen);} GuiButton deleteBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); deleteBtn.SetScale(0.9); @@ -5071,6 +5161,7 @@ int MenuOGG() backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage backBtnImg(&btnOutline); if (Settings.wsprompt == yes){ + backBtnTxt.SetWidescreen(CFG.widescreen); backBtnImg.SetWidescreen(CFG.widescreen);}////// GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); @@ -5372,6 +5463,7 @@ int MenuMp3() cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30); GuiImage cancelBtnImg(&btnOutline); if (Settings.wsprompt == yes){ + cancelBtnTxt.SetWidescreen(CFG.widescreen); cancelBtnImg.SetWidescreen(CFG.widescreen);} GuiButton cancelBtn(btnOutline.GetWidth(), btnOutline.GetHeight()); cancelBtn.SetScale(0.9); diff --git a/source/video.cpp b/source/video.cpp index 506a8972..0d7d7fd0 100644 --- a/source/video.cpp +++ b/source/video.cpp @@ -141,7 +141,7 @@ ResetVideo_Menu() GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); guMtxIdentity(GXmodelView2D); - guMtxTransApply (GXmodelView2D, GXmodelView2D, 0.0F, 0.0F, -50.0F); + guMtxTransApply (GXmodelView2D, GXmodelView2D, 0.0F, 0.0F, -200.0F); GX_LoadPosMtxImm(GXmodelView2D,GX_PNMTX0); guOrtho(p,0,479,0,639,0,300); @@ -240,7 +240,7 @@ void Menu_Render() * * Draws the specified image on screen using GX ***************************************************************************/ -void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], +void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alpha) { if(data == NULL) @@ -265,7 +265,7 @@ void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], // guMtxConcat(m2,m1,m); guMtxConcat(m1,m2,m); - guMtxTransApply(m,m, xpos+width+0.5,ypos+height+0.5,0); + guMtxTransApply(m,m, xpos+width+0.5,ypos+height+0.5,zpos); guMtxConcat (GXmodelView2D, m, mv); GX_LoadPosMtxImm (mv, GX_PNMTX0); @@ -325,3 +325,97 @@ void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 f } GX_End(); } + +void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16 distance,u8 data[], + f32 deg_alpha, f32 deg_beta, f32 scaleX, f32 scaleY, u8 alpha, bool shadow) +{ + if(data == NULL) + return; + + GXTexObj texObj; + + GX_InitTexObj(&texObj, data, width,height, GX_TF_RGBA8,GX_CLAMP, GX_CLAMP,GX_FALSE); + GX_LoadTexObj(&texObj, GX_TEXMAP0); + GX_InvalidateTexAll(); + + GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE); + 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); + Vector axis2 = (Vector) {0 , 1, 0 }; + guMtxRotAxisDeg (m2, &axis2, deg_beta); + Vector axis = (Vector) {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(0x60,0x60,0x60,alpha); + GX_TexCoord2f32(0, 0); + + GX_Position3f32(width, -height, 0); + GX_Color4u8(0x60,0x60,0x60,alpha); + GX_TexCoord2f32(1, 0); + + GX_Position3f32(width, height, 0); + GX_Color4u8(0x60,0x60,0x60,alpha); + GX_TexCoord2f32(1, 1); + + GX_Position3f32(-width, height, 0); + GX_Color4u8(0x60,0x60,0x60,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); + + GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR); + GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); +} diff --git a/source/video.h b/source/video.h index cad707b0..57b18c07 100644 --- a/source/video.h +++ b/source/video.h @@ -15,7 +15,7 @@ void InitVideo (); void StopGX(); void ResetVideo_Menu(); void Menu_Render(); -void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alphaF ); +void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alphaF ); void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled); extern int screenheight;