# HG changeset patch # User Shinji KONO # Date 1292291102 -32400 # Node ID 6754fbb63ac770cc5a8804fac2b30abb3df93e91 # Parent 1905c0be01d4ed8c224c60bfb68c07d45b16d979 64bit and sys.c removal diff -r 1905c0be01d4 -r 6754fbb63ac7 Dandy.cc --- a/Dandy.cc Mon Dec 13 15:03:39 2010 +0900 +++ b/Dandy.cc Tue Dec 14 10:45:02 2010 +0900 @@ -32,15 +32,15 @@ #include "Character_state.h" static int use_keybord = 0; -static int cdp[20] = { 16, 16, 16, 17, 18, 0 }; -static int d, i; +// static int cdp[20] = { 16, 16, 16, 17, 18, 0 }; +static int i; static int rswait = 0; static int cf = 0; static int cc = 0; static int test_mode = 0; -static char *test_object = "" ; +static const char *test_object = "" ; //static SDL_Surface *screen; // static Uint32 background; @@ -119,7 +119,6 @@ case 2: gamef= opening(gamef); break; case 3: gamef= dandy_main_loop(gamef); break; case 4: gamef= dandy_closing(gamef); break; - case 5: gamef= dandy_test(gamef); break; } return next; }; @@ -158,7 +157,7 @@ printf("game end\n"); } -static int light_sysswitch = 1; +static int light_sysswitch = 0; static int light_num = 4; static void @@ -557,7 +556,7 @@ } -static float my_scale = 1; +static float my_scale = 5; void PutSprite(int zorder, short x, short y, int number) @@ -581,7 +580,7 @@ get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix); /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/ get_matrix(object->real_matrix, object->angle, object->xyz, scale, root->real_matrix); - +#if 0 if (my_scale == 1 && m->w > 32) { float v0[] = {m->w,0,0,0}; float v1[] = {1,0,0,0}; @@ -591,6 +590,7 @@ my_scale = w / ((float) m->w); printf("scale = %g\n", my_scale); } +#endif } diff -r 1905c0be01d4 -r 6754fbb63ac7 Makefile --- a/Makefile Mon Dec 13 15:03:39 2010 +0900 +++ b/Makefile Tue Dec 14 10:45:02 2010 +0900 @@ -9,7 +9,7 @@ LIBS += -lCerium -lFifoManager TARGET = demo dandy -OBJS = Character.o Bom.o tokuten.o collision.o count2.o Character_state.o schedule3.o tama2.o syokika.o Ss.o sound.o profile.o debug.o trace.o LoadSprite.o xml.o b64_de.o tree_controll.o object.o sys.o +OBJS = Character.o Bom.o tokuten.o collision.o count2.o Character_state.o schedule3.o tama2.o syokika.o Ss.o sound.o profile.o debug.o trace.o LoadSprite.o xml.o b64_de.o tree_controll.o object.o all: $(TARGET) diff -r 1905c0be01d4 -r 6754fbb63ac7 object.c --- a/object.c Mon Dec 13 15:03:39 2010 +0900 +++ b/object.c Tue Dec 14 10:45:02 2010 +0900 @@ -24,5 +24,5 @@ next = cur->next; free(cur); } - free(obj->free_me); + free(obj); } diff -r 1905c0be01d4 -r 6754fbb63ac7 object.h --- a/object.h Mon Dec 13 15:03:39 2010 +0900 +++ b/object.h Tue Dec 14 10:45:02 2010 +0900 @@ -32,7 +32,6 @@ FVECTOR angle; // angle FMATRIX transfer; // transfer matrix char *name; // object's name - char *free_me; // pointer for free myself SURFACE *surfaces; } OBJECT; diff -r 1905c0be01d4 -r 6754fbb63ac7 sgoex.c --- a/sgoex.c Mon Dec 13 15:03:39 2010 +0900 +++ b/sgoex.c Tue Dec 14 10:45:02 2010 +0900 @@ -149,7 +149,7 @@ void PutSprite(int zorder, short x, short y, int number) { - glBindTexture(GL_TEXTURE_2D, (GLuint)sptable[number].texture); + glBindTexture(GL_TEXTURE_2D, (GLuint&)sptable[number].texture); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBegin(GL_QUADS); @@ -171,7 +171,7 @@ glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBindTexture(GL_TEXTURE_2D, (GLuint)sptable[number].texture); + glBindTexture(GL_TEXTURE_2D, (GLuint&)sptable[number].texture); glTranslatef(x + m->w/2, y + m->h/2, 0.0); glRotatef(angle, 0.0, 0.0, 1.0); glScalef(scalex, scaley, 1.0); diff -r 1905c0be01d4 -r 6754fbb63ac7 sgoex.h --- a/sgoex.h Mon Dec 13 15:03:39 2010 +0900 +++ b/sgoex.h Tue Dec 14 10:45:02 2010 +0900 @@ -83,6 +83,7 @@ int tex_w; int tex_h; int *texture; + int tex_id; // for open gl } SpriteTable; //extern GsSPRITE sprite[MAXOBJ]; diff -r 1905c0be01d4 -r 6754fbb63ac7 sound.c --- a/sound.c Mon Dec 13 15:03:39 2010 +0900 +++ b/sound.c Tue Dec 14 10:45:02 2010 +0900 @@ -15,11 +15,13 @@ int channel[8]; //_________________________________________________________ +#if 0 static char buf0[] = "pBAV"; int vh_addr[10] = { (int) buf0, (int) buf0, (int) buf0, (int) buf0, (int) buf0, (int) buf0 }; +#endif int vb_addr[10] = { 0x80140d00, 0x80142700, 0x80143d00, 0x80145100, 0x80148f00, diff -r 1905c0be01d4 -r 6754fbb63ac7 sys.c --- a/sys.c Mon Dec 13 15:03:39 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#include -#include -#include -#include -#include "object.h" -#include "sys.h" - -#define ALIGN_16BYTE 16 - -int malloc_align16(void *free, void *aligned, int size) -{ - char *index; - unsigned int *f=(unsigned int *)free,*a=(unsigned int *)aligned; - - if (free == NULL || aligned == NULL || size <= 0) return(-1); - - index = (char *)malloc(size + ALIGN_16BYTE); - if (index == NULL) - { - return(-1); - } - - *f = *a = (unsigned int)index; - if (((unsigned int)index % ALIGN_16BYTE) != 0) - { - index += ALIGN_16BYTE - ((unsigned int)index % ALIGN_16BYTE); - *a = (unsigned int)index; - } - return(0); -} - diff -r 1905c0be01d4 -r 6754fbb63ac7 sys.h --- a/sys.h Mon Dec 13 15:03:39 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -int malloc_align16(void *free, void *aligned, int size); - - diff -r 1905c0be01d4 -r 6754fbb63ac7 xml.c --- a/xml.c Mon Dec 13 15:03:39 2010 +0900 +++ b/xml.c Tue Dec 14 10:45:02 2010 +0900 @@ -4,7 +4,6 @@ #include #include #include "object.h" -#include "sys.h" #include "xml.h" #include "error.h" @@ -344,7 +343,7 @@ static OBJECT *create_object(xmlDocPtr doc) { - char *align,*head; + char *align; OBJECT *obj; SURFACE *tmp,**joint; xmlNodePtr cur; @@ -362,14 +361,13 @@ return(NULL); } - if (malloc_align16(&head,&align,sizeof(OBJECT)) < 0) + if (posix_memalign((void**)&align,16,sizeof(OBJECT)) < 0) { fprintf(stderr,"malloc failed at create_object : OBJECT\n"); return(NULL); } obj = (OBJECT *)align; - obj->free_me = head; init_object(obj); obj->surfaces = NULL;