changeset 25:6754fbb63ac7

64bit and sys.c removal
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 14 Dec 2010 10:45:02 +0900
parents 1905c0be01d4
children 6a8cb917e0ad
files Dandy.cc Makefile object.c object.h sgoex.c sgoex.h sound.c sys.c sys.h xml.c
diffstat 10 files changed, 16 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- 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
 
 
 }
--- 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)
 
--- 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);
 }
--- 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;
 
--- 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);
--- 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];
--- 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,
--- 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libxml/parser.h>
-#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);
-}
-
--- 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);
-
-
--- 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 <unistd.h>
 #include <libxml/parser.h>
 #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;