[CHG] Cleanup

This commit is contained in:
Crayon2000 2009-12-15 21:43:57 +00:00
parent d61ac3d4d8
commit 280538ebec
2 changed files with 77 additions and 76 deletions

View file

@ -17,7 +17,7 @@ include $(DEVKITPPC)/wii_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR)) TARGET := $(notdir $(CURDIR))
BUILD := build BUILD := build
SOURCES := source source/gfx GRRLIB_addon SOURCES := source source/gfx
DATA := data DATA := data
INCLUDES := INCLUDES :=
@ -33,7 +33,7 @@ LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project # any extra libraries we wish to link with the project
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
LIBS := -lmodplay -lasnd -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm LIBS := -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing # list of directories containing libraries, this must be the top level containing

View file

@ -9,8 +9,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <asndlib.h>
#include <gcmodplay.h>
#include "gfx/tile1.h" #include "gfx/tile1.h"
#include "gfx/perso.h" #include "gfx/perso.h"
@ -129,14 +127,14 @@ signed int Map1Info[51][87] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
int main() { int main() {
int startx=0,starty=0; int startx=0, starty=0;
int x=0,y=0; int x=0, y=0;
int dirx=0,diry=0; int dirx=0, diry=0;
int cptx=0,cpty=0; int cptx=0, cpty=0;
int bgx=-32,bgy=-32; int bgx=-32, bgy=-32;
float idperso=0; float idperso=0;
int i=0; int i=0;
float sinnonameno=0, oldsinnonameno=0; float sinnonameno=0, oldsinnonameno=0;
GRRLIB_Init(); GRRLIB_Init();
GRRLIB_Settings.antialias = false; GRRLIB_Settings.antialias = false;
@ -150,57 +148,55 @@ float sinnonameno=0, oldsinnonameno=0;
GRRLIB_texImg *tex_nonameno = GRRLIB_LoadTexture(nonameno); GRRLIB_texImg *tex_nonameno = GRRLIB_LoadTexture(nonameno);
GRRLIB_InitTileSet(tex_nonameno, 32, 32, 0); GRRLIB_InitTileSet(tex_nonameno, 32, 32, 0);
while(1){ while(1) {
WPAD_ScanPads(); WPAD_ScanPads();
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break ; if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break;
if((dirx==0) && (diry==0)){ if((dirx==0) && (diry==0)) {
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT){ diry=-4; idperso=15;} 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_RIGHT) { diry=4; idperso=15;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN){ dirx=-4 ; idperso=1;} else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN) { dirx=-4 ; idperso=1;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP){ dirx=4 ; idperso=8;} else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP) { dirx=4 ; idperso=8;}
} }
if((dirx==0) && (diry==0)){ if((dirx==0) && (diry==0)) {
idperso=0; idperso=0;
} }
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))){ 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; dirx=0;
diry=-4; diry=-4;
} }
if(dirx<0){ if(dirx<0) {
if((Map1Info[7+starty][12+startx]==8) || (Map1Info[7+starty][12+startx]==2) || (Map1Info[8+starty][12+startx]==8) || (Map1Info[8+starty][12+startx]==2)){ if((Map1Info[7+starty][12+startx]==8) || (Map1Info[7+starty][12+startx]==2) || (Map1Info[8+starty][12+startx]==8) || (Map1Info[8+starty][12+startx]==2)) {
dirx=0; dirx=0;
} }
else{ else {
idperso++; idperso++;
if(idperso>7) if(idperso>7)
idperso=1; idperso=1;
} }
} }
else if(dirx>0) {
if(dirx>0){ if((Map1Info[7+starty][9+startx]==8) || (Map1Info[7+starty][9+startx]==2) || (Map1Info[8+starty][9+startx]==8) || (Map1Info[8+starty][9+startx]==2)) {
if((Map1Info[7+starty][9+startx]==8) || (Map1Info[7+starty][9+startx]==2) || (Map1Info[8+starty][9+startx]==8) || (Map1Info[8+starty][9+startx]==2)){
dirx=0; dirx=0;
} }
else{ else {
idperso++; idperso++;
if(idperso>14) if(idperso>14)
idperso=8; idperso=8;
} }
} }
if(diry<0){ if(diry<0) {
if((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)){ if((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) {
diry=0; diry=0;
} }
} }
if(diry!=0) {
if(diry!=0){
idperso++; idperso++;
if(idperso>22) if(idperso>22)
idperso=16; idperso=16;
@ -212,41 +208,42 @@ float sinnonameno=0, oldsinnonameno=0;
if((bgx>-1) ||(bgx<-63)) if((bgx>-1) ||(bgx<-63))
bgx=-32; bgx=-32;
if(cptx==32){ if(cptx==32) {
cptx=0; cptx=0;
dirx=0; dirx=0;
startx--; startx--;
} }
else if(cptx==-32) {
if(cptx==-32){
cptx=0; cptx=0;
dirx=0; dirx=0;
startx++; startx++;
} }
cpty+=diry; cpty+=diry;
if(diry>0) bgy++; if(diry>0)
if(diry<0) bgy--; bgy++;
if((bgy>-1) ||(bgy<-63)) else if(diry<0)
bgy--;
if((bgy>-1) || (bgy<-63))
bgy=-32; bgy=-32;
if(cpty==32){ if(cpty==32) {
cpty=0; cpty=0;
diry=0; diry=0;
starty--; starty--;
} }
if(cpty==-32){ else if(cpty==-32) {
cpty=0; cpty=0;
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))){ 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))) {
diry=0; diry=0;
} }
starty++; starty++;
} }
GRRLIB_DrawImg(bgx,bgy,tex_bg,0,1,1,0xFFFFFFFF); GRRLIB_DrawImg(bgx, bgy, tex_bg, 0, 1, 1, 0xFFFFFFFF);
for(y=0;y<=(16);y++){ for(y=0; y<=(16); y++) {
for(x=0;x<=(21);x++){ for(x=0; x<=(21); x++) {
if(Map1Data[y+starty][x+startx] != 0){ if(Map1Data[y+starty][x+startx] != 0) {
GRRLIB_DrawTile(x*TileMap1Width+cptx-TileMap1Width,y*TileMap1Height+cpty-TileMap1Height,tex_tile1,0,1,1,0xFFFFFFFF,Map1Data[y+starty][x+startx]-1); GRRLIB_DrawTile(x*TileMap1Width+cptx-TileMap1Width,y*TileMap1Height+cpty-TileMap1Height,tex_tile1,0,1,1,0xFFFFFFFF,Map1Data[y+starty][x+startx]-1);
} }
} }
@ -254,7 +251,7 @@ float sinnonameno=0, oldsinnonameno=0;
GRRLIB_DrawTile(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso); GRRLIB_DrawTile(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso);
oldsinnonameno=sinnonameno; oldsinnonameno=sinnonameno;
for(i=0;i<8;i++){ for(i=0; i<8; i++) {
GRRLIB_DrawTile(TileMap1Width*(6+i),(TileMap1Height*10)+sin(sinnonameno)*64,tex_nonameno,0,1,1,0xFFFFFFFF,i); GRRLIB_DrawTile(TileMap1Width*(6+i),(TileMap1Height*10)+sin(sinnonameno)*64,tex_nonameno,0,1,1,0xFFFFFFFF,i);
sinnonameno+=0.4F; sinnonameno+=0.4F;
} }
@ -262,9 +259,13 @@ float sinnonameno=0, oldsinnonameno=0;
GRRLIB_Render(); GRRLIB_Render();
} }
GRRLIB_Exit(); GRRLIB_Exit();
// Free some textures
GRRLIB_FreeTexture(tex_tile1);
GRRLIB_FreeTexture(tex_perso);
GRRLIB_FreeTexture(tex_bg);
GRRLIB_FreeTexture(tex_nonameno);
exit(0); exit(0);
} }