Refactoring

This commit is contained in:
Crayon2000 2024-04-02 01:40:42 -04:00
parent 159ba73f5c
commit 28f105044b
15 changed files with 93 additions and 55 deletions

View file

@ -136,7 +136,6 @@ int main() {
int cptx=0, cpty=0;
int bgx=-32, bgy=-32;
float idperso=0;
int i;
float sinnonameno=0;
float camZ=1400.0f;
float a=0;
@ -165,10 +164,22 @@ int main() {
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_MINUS) camZ-=20.0f;
if((dirx==0) && (diry==0)) {
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) { diry=-4; idperso=15;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_RIGHT) { diry=4; idperso=15;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN) { dirx=-4; idperso=1;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP) { dirx=4; idperso=8;}
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) {
diry=-4;
idperso=15;
}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_RIGHT) {
diry=4;
idperso=15;
}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN) {
dirx=-4;
idperso=1;
}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP) {
dirx=4;
idperso=8;
}
}
if((dirx==0) && (diry==0)) {
@ -267,7 +278,7 @@ int main() {
GRRLIB_DrawTile(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso);
const float oldsinnonameno=sinnonameno;
for(i=0; i<8; i++) {
for(int i=0; i<8; i++) {
GRRLIB_DrawTile(TileMap1Width*(6+i),(TileMap1Height*10)+sin(sinnonameno)*64,tex_nonameno,0,1,1,0xFFFFFFFF,i);
sinnonameno+=0.4F;
}
@ -278,7 +289,7 @@ int main() {
GRRLIB_Camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0);
GRRLIB_3dMode(0.1,3000,45,1,0);
GRRLIB_SetTexture(tex_screen,0);
GRRLIB_SetTexture(tex_screen, FALSE);
GRRLIB_ObjectView(0,0,0, a,a*2,a*3,1,1,1);
GX_Begin(GX_QUADS, GX_VTXFMT0, 16);
GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2);

View file

@ -39,7 +39,7 @@ int main() {
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) cubeZ--;
GRRLIB_3dMode(0.1,1000,45,1,0);
GRRLIB_SetTexture(tex_girl,0);
GRRLIB_SetTexture(tex_girl, FALSE);
GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3,1,1,1);
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
GX_Position3f32(-1.0f,1.0f,1.0f);

View file

@ -18,7 +18,6 @@
int main() {
float a=0;
int cubeZ=5;
int i;
float sinx=0;
GRRLIB_Init();
@ -46,7 +45,7 @@ int main() {
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) cubeZ--;
GRRLIB_3dMode(0.1,1000,45,1,0);
GRRLIB_SetTexture(tex_girl,0);
GRRLIB_SetTexture(tex_girl, FALSE);
GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3,1,1,1);
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
GX_Position3f32(-1.0f,1.0f,1.0f);
@ -133,7 +132,7 @@ int main() {
// Switch To 2D Mode to display text
GRRLIB_2dMode();
const float oldsinx=sinx;
for(i=0; i<rmode->efbHeight; i++) {
for(int i=0; i<rmode->efbHeight; i++) {
GRRLIB_DrawTile(0+sin(sinx)*60,i,tex_screen,0,1,1,0xFFFFFFFF,i);
sinx+=0.02f;
}

View file

@ -1994,4 +1994,3 @@ int logoFac[][1]={{2},{17},{18},
{981},{999},{980},
{982},{1000},{981},
{965},{983},{982}};

View file

@ -13,9 +13,7 @@
#include "gfx/logo.h"
int main() {
int i;
float a=0;
u32 col;
GRRLIB_Init();
WPAD_Init();
@ -35,7 +33,8 @@ int main() {
GRRLIB_3dMode(0.1,1000,45,0,0);
GRRLIB_ObjectView(0,0,-30, a,a*2,a*3,1,1,1);
GX_Begin(GX_TRIANGLES, GX_VTXFMT0, logoNbFace * 3);
for(i=0; i<logoNbFace*3; i+=3) {
for(int i=0; i<logoNbFace*3; i+=3) {
u32 col;
if(i<=(246*3*2))
col=0xFFFFFFFF;
else

View file

@ -134,7 +134,6 @@ int main() {
int cptx=0, cpty=0;
int bgx=-32, bgy=-32;
float idperso=0;
int i;
float sinnonameno=0;
GRRLIB_Init();
@ -154,10 +153,22 @@ int main() {
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break;
if((dirx==0) && (diry==0)) {
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) { diry=-4; idperso=15;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_RIGHT) { diry=4; idperso=15;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN) { dirx=-4; idperso=1;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP) { dirx=4; idperso=8;}
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) {
diry=-4;
idperso=15;
}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_RIGHT) {
diry=4;
idperso=15;
}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN) {
dirx=-4;
idperso=1;
}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP) {
dirx=4;
idperso=8;
}
}
if((dirx==0) && (diry==0)) {
@ -254,7 +265,7 @@ int main() {
GRRLIB_DrawTile(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso);
const float oldsinnonameno=sinnonameno;
for(i=0; i<8; i++) {
for(int i=0; i<8; i++) {
GRRLIB_DrawTile(TileMap1Width*(6+i),(TileMap1Height*10)+sin(sinnonameno)*64,tex_nonameno,0,1,1,0xFFFFFFFF,i);
sinnonameno+=0.4F;
}

View file

@ -136,7 +136,6 @@ int main() {
int cptx=0, cpty=0;
int bgx=-32, bgy=-32;
float idperso=0;
int i;
float sinnonameno=0;
float camZ=1400.0f;
float a=0;
@ -165,10 +164,22 @@ int main() {
if (PAD_ButtonsHeld(0) & PAD_BUTTON_Y) camZ-=20.0f;
if((dirx==0) && (diry==0)) {
if (PAD_ButtonsHeld(0) & PAD_BUTTON_DOWN) { diry=-4; idperso=15;}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_UP) { diry=4; idperso=15;}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_RIGHT) { dirx=-4; idperso=1;}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_LEFT) { dirx=4; idperso=8;}
if (PAD_ButtonsHeld(0) & PAD_BUTTON_DOWN) {
diry=-4;
idperso=15;
}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_UP) {
diry=4;
idperso=15;
}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_RIGHT) {
dirx=-4;
idperso=1;
}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_LEFT) {
dirx=4;
idperso=8;
}
}
if((dirx==0) && (diry==0)) {
@ -267,7 +278,7 @@ int main() {
GRRLIB_DrawTile(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso);
const float oldsinnonameno=sinnonameno;
for(i=0; i<8; i++) {
for(int i=0; i<8; i++) {
GRRLIB_DrawTile(TileMap1Width*(6+i),(TileMap1Height*10)+sin(sinnonameno)*64,tex_nonameno,0,1,1,0xFFFFFFFF,i);
sinnonameno+=0.4F;
}
@ -278,7 +289,7 @@ int main() {
GRRLIB_Camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0);
GRRLIB_3dMode(0.1,3000,45,1,0);
GRRLIB_SetTexture(tex_screen,0);
GRRLIB_SetTexture(tex_screen, FALSE);
GRRLIB_ObjectView(0,0,0, a,a*2,a*3,1,1,1);
GX_Begin(GX_QUADS, GX_VTXFMT0, 16);
GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2);

View file

@ -39,7 +39,7 @@ int main() {
if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) cubeZ--;
GRRLIB_3dMode(0.1,1000,45,1,0);
GRRLIB_SetTexture(tex_girl,0);
GRRLIB_SetTexture(tex_girl, FALSE);
GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3,1,1,1);
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
GX_Position3f32(-1.0f,1.0f,1.0f);

View file

@ -18,7 +18,6 @@
int main() {
float a=0;
int cubeZ=5;
int i;
float sinx=0;
GRRLIB_Init();
@ -46,7 +45,7 @@ int main() {
if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) cubeZ--;
GRRLIB_3dMode(0.1,1000,45,1,0);
GRRLIB_SetTexture(tex_girl,0);
GRRLIB_SetTexture(tex_girl, FALSE);
GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3,1,1,1);
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
GX_Position3f32(-1.0f,1.0f,1.0f);
@ -133,7 +132,7 @@ int main() {
// Switch To 2D Mode to display text
GRRLIB_2dMode();
const float oldsinx=sinx;
for(i=0; i<rmode->efbHeight; i++) {
for(int i=0; i<rmode->efbHeight; i++) {
GRRLIB_DrawTile(0+sin(sinx)*60,i,tex_screen,0,1,1,0xFFFFFFFF,i);
sinx+=0.02f;
}

View file

@ -1994,4 +1994,3 @@ int logoFac[][1]={{2},{17},{18},
{981},{999},{980},
{982},{1000},{981},
{965},{983},{982}};

View file

@ -13,9 +13,7 @@
#include "gfx/logo.h"
int main() {
int i;
float a=0;
u32 col;
GRRLIB_Init();
PAD_Init();
@ -35,7 +33,8 @@ int main() {
GRRLIB_3dMode(0.1,1000,45,0,0);
GRRLIB_ObjectView(0,0,-30, a,a*2,a*3,1,1,1);
GX_Begin(GX_TRIANGLES, GX_VTXFMT0, logoNbFace * 3);
for(i=0; i<logoNbFace*3; i+=3) {
for(int i=0; i<logoNbFace*3; i+=3) {
u32 col;
if(i<=(246*3*2))
col=0xFFFFFFFF;
else

View file

@ -134,7 +134,6 @@ int main() {
int cptx=0, cpty=0;
int bgx=-32, bgy=-32;
float idperso=0;
int i;
float sinnonameno=0;
GRRLIB_Init();
@ -154,10 +153,22 @@ int main() {
if (PAD_ButtonsDown(0) & PAD_BUTTON_START) break;
if((dirx==0) && (diry==0)) {
if (PAD_ButtonsHeld(0) & PAD_BUTTON_DOWN) { diry=-4; idperso=15;}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_UP) { diry=4; idperso=15;}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_RIGHT) { dirx=-4; idperso=1;}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_LEFT) { dirx=4; idperso=8;}
if (PAD_ButtonsHeld(0) & PAD_BUTTON_DOWN) {
diry=-4;
idperso=15;
}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_UP) {
diry=4;
idperso=15;
}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_RIGHT) {
dirx=-4;
idperso=1;
}
else if (PAD_ButtonsHeld(0) & PAD_BUTTON_LEFT) {
dirx=4;
idperso=8;
}
}
if((dirx==0) && (diry==0)) {
@ -254,7 +265,7 @@ int main() {
GRRLIB_DrawTile(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso);
const float oldsinnonameno=sinnonameno;
for(i=0; i<8; i++) {
for(int i=0; i<8; i++) {
GRRLIB_DrawTile(TileMap1Width*(6+i),(TileMap1Height*10)+sin(sinnonameno)*64,tex_nonameno,0,1,1,0xFFFFFFFF,i);
sinnonameno+=0.4F;
}

View file

@ -76,7 +76,7 @@ int main() {
cubeZ+=0.02f;
GRRLIB_ObjectView((float)(((R + r-ff)*cos(t-f) - d*cos(((R + r-f)/r)*t)))/20.0f,(float)(((R + r-ff)*sin(t) - d*sin(((R + r)/r)*t)-f))/20.0f,sin(cubeZ)*10, a,a*2,a*3,1,1,1);
GRRLIB_SetTexture(tex_girl, 0);
GRRLIB_SetTexture(tex_girl, FALSE);
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
GX_Position3f32(-1.0f,1.0f,1.0f);
GX_Color1u32(0xFFFFFFFF);

View file

@ -76,7 +76,7 @@ int main() {
cubeZ+=0.02f;
GRRLIB_ObjectView((float)(((R + r-ff)*cos(t-f) - d*cos(((R + r-f)/r)*t)))/20.0f,(float)(((R + r-ff)*sin(t) - d*sin(((R + r)/r)*t)-f))/20.0f,sin(cubeZ)*10, a,a*2,a*3,1,1,1);
GRRLIB_SetTexture(tex_girl, 0);
GRRLIB_SetTexture(tex_girl, FALSE);
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
GX_Position3f32(-1.0f,1.0f,1.0f);
GX_Color1u32(0xFFFFFFFF);