[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))
BUILD := build
SOURCES := source source/gfx GRRLIB_addon
SOURCES := source source/gfx
DATA := data
INCLUDES :=
@ -33,7 +33,7 @@ LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# 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

View file

@ -1,16 +1,14 @@
/*===========================================
NoNameNo TileDemo
A sample code to show how to use tile/tileset
The map have been drawn with the mega mighty
TileStudio (http://tilestudio.sourceforge.net/)
Special Greetings to TLB for some GFx ;=)
NoNameNo TileDemo
A sample code to show how to use tile/tileset
The map have been drawn with the mega mighty
TileStudio (http://tilestudio.sourceforge.net/)
Special Greetings to TLB for some GFx ;=)
============================================*/
#include <grrlib.h>
#include <stdlib.h>
#include <wiiuse/wpad.h>
#include <asndlib.h>
#include <gcmodplay.h>
#include "gfx/tile1.h"
#include "gfx/perso.h"
@ -129,79 +127,77 @@ 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}};
int main() {
int startx=0,starty=0;
int x=0,y=0;
int dirx=0,diry=0;
int cptx=0,cpty=0;
int bgx=-32,bgy=-32;
float idperso=0;
int i=0;
float sinnonameno=0, oldsinnonameno=0;
int startx=0, starty=0;
int x=0, y=0;
int dirx=0, diry=0;
int cptx=0, cpty=0;
int bgx=-32, bgy=-32;
float idperso=0;
int i=0;
float sinnonameno=0, oldsinnonameno=0;
GRRLIB_Init();
GRRLIB_Settings.antialias = false;
WPAD_Init();
GRRLIB_ClipDrawing(0,0,640,480);
GRRLIB_texImg *tex_tile1 = GRRLIB_LoadTexture(tile1);
GRRLIB_InitTileSet(tex_tile1, TileMap1Width, TileMap1Height, 0);
GRRLIB_InitTileSet(tex_tile1, TileMap1Width, TileMap1Height, 0);
GRRLIB_texImg *tex_perso = GRRLIB_LoadTexture(perso);
GRRLIB_InitTileSet(tex_perso, 64, 64, 0);
GRRLIB_InitTileSet(tex_perso, 64, 64, 0);
GRRLIB_texImg *tex_bg = GRRLIB_LoadTexture(bg);
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();
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break ;
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((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((dirx==0) && (diry==0)){
idperso=0;
if((dirx==0) && (diry==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))){
}
else{
dirx=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))) {
}
else {
dirx=0;
diry=-4;
}
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)){
dirx=0;
}
else{
idperso++;
if(idperso>7)
idperso=1;
}
}
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)){
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)) {
dirx=0;
}
else{
idperso++;
if(idperso>14)
idperso=8;
else {
idperso++;
if(idperso>7)
idperso=1;
}
}
else 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)) {
dirx=0;
}
else {
idperso++;
if(idperso>14)
idperso=8;
}
}
if(diry<0){
if((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)){
if(diry<0) {
if((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) {
diry=0;
}
}
if(diry!=0){
idperso++;
if(diry!=0) {
idperso++;
if(idperso>22)
idperso=16;
}
@ -212,49 +208,50 @@ float sinnonameno=0, oldsinnonameno=0;
if((bgx>-1) ||(bgx<-63))
bgx=-32;
if(cptx==32){
if(cptx==32) {
cptx=0;
dirx=0;
startx--;
}
if(cptx==-32){
else if(cptx==-32) {
cptx=0;
dirx=0;
startx++;
}
cpty+=diry;
if(diry>0) bgy++;
if(diry<0) bgy--;
if((bgy>-1) ||(bgy<-63))
if(diry>0)
bgy++;
else if(diry<0)
bgy--;
if((bgy>-1) || (bgy<-63))
bgy=-32;
if(cpty==32){
if(cpty==32) {
cpty=0;
diry=0;
starty--;
}
if(cpty==-32){
else if(cpty==-32) {
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;
}
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(x=0;x<=(21);x++){
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);
}
for(y=0; y<=(16); y++) {
for(x=0; x<=(21); x++) {
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(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso);
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);
sinnonameno+=0.4F;
}
@ -262,9 +259,13 @@ float sinnonameno=0, oldsinnonameno=0;
GRRLIB_Render();
}
GRRLIB_Exit();
exit(0);
GRRLIB_Exit();
// Free some textures
GRRLIB_FreeTexture(tex_tile1);
GRRLIB_FreeTexture(tex_perso);
GRRLIB_FreeTexture(tex_bg);
GRRLIB_FreeTexture(tex_nonameno);
exit(0);
}