changeset 23:cd5768022d2b

64bit trying..
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 13 Dec 2010 15:03:29 +0900
parents 095e9575cc0a
children 1905c0be01d4
files Dandy.cc Makefile Makefile.def
diffstat 3 files changed, 39 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Dandy.cc	Thu Dec 09 22:33:20 2010 +0900
+++ b/Dandy.cc	Mon Dec 13 15:03:29 2010 +0900
@@ -31,13 +31,16 @@
 #include "Character.h"
 #include "Character_state.h"
 
-int use_keybord = 0;
-int cdp[20] = { 16, 16, 16, 17, 18, 0 };
-int d, i;
+static int use_keybord = 0;
+static int cdp[20] = { 16, 16, 16, 17, 18, 0 };
+static int d, i;
 
-int rswait = 0;
-int cf = 0;
-int cc = 0;
+static int rswait = 0;
+static int cf = 0;
+static int cc = 0;
+
+static int test_mode = 0;
+static char *test_object  = "" ;
 
 //static SDL_Surface *screen;
 // static Uint32 background;
@@ -116,6 +119,7 @@
     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;
 }; 
@@ -131,6 +135,16 @@
 int
 TMmain(TaskManager *manager,int argc, char *argv[])
 {
+    for(int i = 1; i<argc ; i++) {
+	if (strcmp(argv[i],"-t")) {
+	    test_mode=1;
+	    if (i+1<argc && argv[i+1]) {
+		i++;
+		test_object=argv[i];
+	    }
+	}
+    }
+
     task_init();
     task_initialize();
     manager->set_TMend(TMend);
@@ -543,6 +557,8 @@
 
 }
 
+static float my_scale = 1;
+
 void
 PutSprite(int zorder, short x, short y, int number)
 {
@@ -556,14 +572,27 @@
     object->xyz[0] = x;
     object->xyz[1] = y;
     object->xyz[2] = 0;
+    object->c_xyz[0] = m->mx;
+    object->c_xyz[1] = m->my;
     root->addChild(object);
 
-    float scale[] = {5,5,1};
+    float scale[] = {my_scale,my_scale,1};
     /*親の回転、座標から、子の回転、座標を算出*/
     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 (my_scale == 1 && m->w > 32) {
+float v0[] = {m->w,0,0,0};
+float v1[] = {1,0,0,0};
+float w;
+applyMatrix(v1, object->matrix, v0);
+w = sqrtf( v1[0]*v1[0] + v1[1]*v1[1] + v1[2]*v1[2] );
+my_scale =  w / ((float) m->w);
+printf("scale = %g\n", my_scale);
+}
+
+
 }
 
 void
@@ -584,7 +613,7 @@
     object->angle[3] = angle;
     root->addChild(object);
 
-    float scale[] = {5*scalex,5*scaley,1};
+    float scale[] = {my_scale*scalex,my_scale*scaley,1};
     /*親の回転、座標から、子の回転、座標を算出*/
     get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
--- a/Makefile	Thu Dec 09 22:33:20 2010 +0900
+++ b/Makefile	Mon Dec 13 15:03:29 2010 +0900
@@ -2,7 +2,7 @@
 include ./Makefile.def
 
 srcdir  = .
-ABI = -m32
+ABI = -m$(ABIBIT)
 
 CFLAGS  += -g $(ABI) -O2 -Wall `sdl-config --cflags` `xml2-config --cflags` $(INCLUDE)
 LIBS	+=  `sdl-config --libs`,-framework,OpenGL -lSDL_mixer -lSDL_image `xml2-config --libs`
--- a/Makefile.def	Thu Dec 09 22:33:20 2010 +0900
+++ b/Makefile.def	Mon Dec 13 15:03:29 2010 +0900
@@ -8,7 +8,7 @@
 OPT = -g #-O9
 CFLAGS  =  -Wall $(OPT) 
 
-ABIBIT = 32
+ABIBIT = 64
 
 INCLUDE = -I. -I.. -I${CERIUM}/include/TaskManager -I$(CERIUM)/Renderer/Engine -I$(CERIUM)/include/Cerium
 LIBS = -L${CERIUM}/TaskManager -L$(CERIUM)/Renderer/Engine