diff --git a/GRRLIB/GRRLIB/GRRLIB_render.c b/GRRLIB/GRRLIB/GRRLIB_render.c index cbe942c..3854d61 100644 --- a/GRRLIB/GRRLIB/GRRLIB_render.c +++ b/GRRLIB/GRRLIB/GRRLIB_render.c @@ -269,10 +269,10 @@ void GRRLIB_DrawPart (const f32 xpos, const f32 ypos, const f32 partx, const f3 return; // The 0.001f/x is the frame correction formula by spiffen - const f32 s1 = (partx /tex->w) +(0.001f /tex->w); - const f32 s2 = ((partx + partw)/tex->w) -(0.001f /tex->w); - const f32 t1 = (party /tex->h) +(0.001f /tex->h); - const f32 t2 = ((party + parth)/tex->h) -(0.001f /tex->h); + const f32 s1 = (partx / tex->w) + (0.001f / tex->w); + const f32 s2 = ((partx + partw) / tex->w) - (0.001f / tex->w); + const f32 t1 = (party / tex->h) + (0.001f / tex->h); + const f32 t2 = ((party + parth) / tex->h) - (0.001f / tex->h); GX_InitTexObj(&texObj, tex->data, tex->w, tex->h, @@ -349,10 +349,10 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex, const u32 return; // The 0.001f/x is the frame correction formula by spiffen - const f32 s1 = (( (frame %tex->nbtilew) ) /(f32)tex->nbtilew) +(0.001f /tex->w); - const f32 s2 = (( (frame %tex->nbtilew) +1) /(f32)tex->nbtilew) -(0.001f /tex->w); - const f32 t1 = (((int)(frame /tex->nbtilew) ) /(f32)tex->nbtileh) +(0.001f /tex->h); - const f32 t2 = (((int)(frame /tex->nbtilew) +1) /(f32)tex->nbtileh) -(0.001f /tex->h); + const f32 s1 = (( (frame % tex->nbtilew) ) / (f32)tex->nbtilew) + (0.001f / tex->w); + const f32 s2 = (( (frame % tex->nbtilew) + 1) / (f32)tex->nbtilew) - (0.001f / tex->w); + const f32 t1 = (((int)(frame / tex->nbtilew) ) / (f32)tex->nbtileh) + (0.001f / tex->h); + const f32 t2 = (((int)(frame / tex->nbtilew) + 1) / (f32)tex->nbtileh) - (0.001f / tex->h); GX_InitTexObj(&texObj, tex->data, tex->tilew * tex->nbtilew, tex->tileh * tex->nbtileh, @@ -418,7 +418,7 @@ void GRRLIB_Render (void) { VIDEO_Flush(); // Flush video buffer to screen VIDEO_WaitVSync(); // Wait for screen to update // Interlaced screens require two frames to update - if (rmode->viTVMode &VI_NON_INTERLACE) { + if (rmode->viTVMode & VI_NON_INTERLACE) { VIDEO_WaitVSync(); } } diff --git a/examples/3D_CubedTileDemo/source/main.c b/examples/3D_CubedTileDemo/source/main.c index 15a0dbb..6cbb85e 100644 --- a/examples/3D_CubedTileDemo/source/main.c +++ b/examples/3D_CubedTileDemo/source/main.c @@ -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)) { @@ -177,7 +188,7 @@ int main() { if(((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) || ((Map1Info[9+starty][10+startx]==43521) || (Map1Info[9+starty][11+startx]==43521))) { } - else{ + else { dirx=0; diry=-4; } @@ -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); diff --git a/examples/3D_sample2/source/main.c b/examples/3D_sample2/source/main.c index f6d8ecc..6ceb8ca 100644 --- a/examples/3D_sample2/source/main.c +++ b/examples/3D_sample2/source/main.c @@ -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); diff --git a/examples/3D_sample3/source/main.c b/examples/3D_sample3/source/main.c index bc4fca5..ea98093 100644 --- a/examples/3D_sample3/source/main.c +++ b/examples/3D_sample3/source/main.c @@ -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; iefbHeight; i++) { + for(int i=0; iefbHeight; i++) { GRRLIB_DrawTile(0+sin(sinx)*60,i,tex_screen,0,1,1,0xFFFFFFFF,i); sinx+=0.02f; } diff --git a/examples/3D_sample4/source/gfx/logo.h b/examples/3D_sample4/source/gfx/logo.h index f2ad34d..375cab1 100644 --- a/examples/3D_sample4/source/gfx/logo.h +++ b/examples/3D_sample4/source/gfx/logo.h @@ -1994,4 +1994,3 @@ int logoFac[][1]={{2},{17},{18}, {981},{999},{980}, {982},{1000},{981}, {965},{983},{982}}; - diff --git a/examples/3D_sample4/source/main.c b/examples/3D_sample4/source/main.c index 343ac5b..422841b 100644 --- a/examples/3D_sample4/source/main.c +++ b/examples/3D_sample4/source/main.c @@ -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; ifbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2); diff --git a/examples/gamecube/3D_sample2/source/main.c b/examples/gamecube/3D_sample2/source/main.c index b2904b3..21a7fe5 100644 --- a/examples/gamecube/3D_sample2/source/main.c +++ b/examples/gamecube/3D_sample2/source/main.c @@ -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); diff --git a/examples/gamecube/3D_sample3/source/main.c b/examples/gamecube/3D_sample3/source/main.c index 3cbfd2a..bc279be 100644 --- a/examples/gamecube/3D_sample3/source/main.c +++ b/examples/gamecube/3D_sample3/source/main.c @@ -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; iefbHeight; i++) { + for(int i=0; iefbHeight; i++) { GRRLIB_DrawTile(0+sin(sinx)*60,i,tex_screen,0,1,1,0xFFFFFFFF,i); sinx+=0.02f; } diff --git a/examples/gamecube/3D_sample4/source/gfx/logo.h b/examples/gamecube/3D_sample4/source/gfx/logo.h index f2ad34d..375cab1 100644 --- a/examples/gamecube/3D_sample4/source/gfx/logo.h +++ b/examples/gamecube/3D_sample4/source/gfx/logo.h @@ -1994,4 +1994,3 @@ int logoFac[][1]={{2},{17},{18}, {981},{999},{980}, {982},{1000},{981}, {965},{983},{982}}; - diff --git a/examples/gamecube/3D_sample4/source/main.c b/examples/gamecube/3D_sample4/source/main.c index 41584e7..1bc05ed 100644 --- a/examples/gamecube/3D_sample4/source/main.c +++ b/examples/gamecube/3D_sample4/source/main.c @@ -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