changeset 46:fce767bb5e25

keep up with scale_matrix(not work)
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Tue, 18 Jan 2011 02:20:10 +0900
parents e01948ce859a
children 21ac9f57a6d4
files Dandy.cc Makefile Makefile.def TaskDandy.cc main.c spe/Makefile
diffstat 6 files changed, 42 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/Dandy.cc	Sat Jan 15 19:13:03 2011 +0900
+++ b/Dandy.cc	Tue Jan 18 02:20:10 2011 +0900
@@ -31,8 +31,7 @@
 #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 i;
 
 static int rswait = 0;
 static int cf = 0;
@@ -51,9 +50,9 @@
 static void KeyAssign(int runmode, TraceBuffPtr buff, SDL_Joystick *joy, SGO_PAD *pad);
 
 static int runmode = 0;
+static char *pad_trace_file;
 static TraceBuffPtr t_buff;
 static TraceBuffPtr first;
-static char *pad_trace_file;
 
 /**
  * runmode:
@@ -152,13 +151,13 @@
     printf("game end\n");
 }
 
-static int light_sysswitch = 1;
+static int light_sysswitch = 0;
 static int light_num = 4;
 
 static void 
 _LightSysSwitch(Viewer *sgroot) {
   if (light_sysswitch == 1) {
-    sgroot->OffLightSysSwitch();
+    sgroot->OnLightSysSwitch();
     for (int i = 0; i < light_num; i++) {
         SceneGraphPtr light = sgroot->getLight(i);
         sgroot->OnLightSwitch(i);
@@ -309,9 +308,9 @@
     root->xyz[2] = 30.0f;
 
     /*親の回転、座標から、子の回転、座標を算出*/
-    get_matrix(root->matrix, root->angle, root->xyz, root->scale, camera->matrix);
+    get_matrix(root->matrix, root->angle, root->xyz, camera->matrix);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(root->real_matrix, root->angle, root->xyz, root->scale, camera->real_matrix);
+    get_matrix(root->real_matrix, root->angle, root->xyz, camera->real_matrix);
 
     sgroot->setSceneData(root);
 }
@@ -458,7 +457,7 @@
     PutSprite(count, 640, 640, 192);
     //PutSpriteEx(count, 8192, 8192, 0);
 
-    if (pad[0].st > 1) {
+    if ((pad[0].st > 1)||(runmode == 2)) {
 	jiki.bf = TRUE;
 	
 	//CdPlay(1,&cdp[0],0);                                          
@@ -616,17 +615,18 @@
     }
 
     SceneGraphPtr object = sgroot->createSceneGraph(name);
-    object->xyz[0] = x - object->c_xyz[0]*my_scale;
-    object->xyz[1] = y - object->c_xyz[1]*my_scale;
+    object->xyz[0] = x;
+    object->xyz[1] = y;
     object->xyz[2] = 0;
     root->addChild(object);
 
     float scale[] = {my_scale,my_scale,1};
     /*親の回転、座標から、子の回転、座標を算出*/
-    get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix);
+    get_matrix(object->matrix, object->angle, object->xyz, root->matrix);
+    scale_matrix(object->matrix, scale, object->c_xyz);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(object->real_matrix, object->angle, object->xyz, scale, root->real_matrix);
-
+    get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix);
+    scale_matrix(object->real_matrix, scale, object->c_xyz);
 }
 
 void
@@ -640,8 +640,8 @@
     }
 
     SceneGraphPtr object = sgroot->createSceneGraph(name);
-    object->xyz[0] = x  - object->c_xyz[0]*my_scale - m->w*my_scale;
-    object->xyz[1] = y  - object->c_xyz[0]*my_scale - m->w*my_scale;
+    object->xyz[0] = x - m->w*my_scale;
+    object->xyz[1] = y - m->h*my_scale;
     object->xyz[2] = 0;
     object->c_xyz[0] = m->mx;
     object->c_xyz[1] = m->my;
@@ -650,9 +650,11 @@
 
     float scale[] = {5*scalex,5*scaley,1};
     /*親の回転、座標から、子の回転、座標を算出*/
-    get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix);
+    get_matrix(object->matrix, object->angle, object->xyz, root->matrix);
+    scale_matrix(object->matrix, scale, object->c_xyz);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(object->real_matrix, object->angle, object->xyz, scale, root->real_matrix);
+    get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix);
+    scale_matrix(object->real_matrix, scale, object->c_xyz);
 }
 
 
--- a/Makefile	Sat Jan 15 19:13:03 2011 +0900
+++ b/Makefile	Tue Jan 18 02:20:10 2011 +0900
@@ -17,4 +17,4 @@
 
 clean:
 	@$(MAKE) -f Makefile.mac clean
-	@$(MAKE) -f Makefile.ps3 clean
\ No newline at end of file
+	@$(MAKE) -f Makefile.ps3 clean
--- a/Makefile.def	Sat Jan 15 19:13:03 2011 +0900
+++ b/Makefile.def	Tue Jan 18 02:20:10 2011 +0900
@@ -7,7 +7,7 @@
 ABIBIT = 32
 ABI = -m$(ABIBIT)
 CC      = g++
-OPT = -pg
+OPT = -g
 CFLAGS  =  -Wall $(OPT) $(ABI)
 
 
--- a/TaskDandy.cc	Sat Jan 15 19:13:03 2011 +0900
+++ b/TaskDandy.cc	Tue Jan 18 02:20:10 2011 +0900
@@ -33,8 +33,7 @@
 #include "state_task.h"
 
 static int use_keybord = 0;
-static int cdp[20] = { 16, 16, 16, 17, 18, 0 };
-static int d, i;
+static int i;
 
 static int rswait = 0;
 static int cf = 0;
@@ -151,13 +150,13 @@
     printf("game end\n");
 }
 
-static int light_sysswitch = 1;
+static int light_sysswitch = 0;
 static int light_num = 4;
 
 static void 
 _LightSysSwitch(Viewer *sgroot) {
   if (light_sysswitch == 1) {
-    sgroot->OffLightSysSwitch();
+    sgroot->OnLightSysSwitch();
     for (int i = 0; i < light_num; i++) {
         SceneGraphPtr light = sgroot->getLight(i);
         sgroot->OnLightSwitch(i);
@@ -310,9 +309,11 @@
     root->xyz[2] = 30.0f;
 
     /*親の回転、座標から、子の回転、座標を算出*/
-    get_matrix(root->matrix, root->angle, root->xyz, root->scale, camera->matrix);
+    get_matrix(root->matrix, root->angle, root->xyz, camera->matrix);
+    scale_matrix(root->matrix, root->scale, root->c_xyz);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(root->real_matrix, root->angle, root->xyz, root->scale, camera->real_matrix);
+    get_matrix(root->real_matrix, root->angle, root->xyz, camera->real_matrix);
+    scale_matrix(root->real_matrix, root->scale, root->c_xyz);
 
     sgroot->setSceneData(root);
 }
@@ -456,7 +457,7 @@
     PutSprite(count, 640, 640, 192);
     //PutSpriteEx(count, 8192, 8192, 0);
 
-    if (pad[0].st > 1) {
+    if ((pad[0].st > 1)||(runmode == 2)) {
 	jiki.bf = TRUE;
 	
 	//CdPlay(1,&cdp[0],0);                                          
@@ -617,11 +618,11 @@
     root->addChild(object);
     
     float scale[] = {my_scale,my_scale,1};
-    /*親の回転、座標から、子の回転、座標を算出*/
-    get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix);
+    get_matrix(object->matrix, object->angle, object->xyz, root->matrix);
+    scale_matrix(object->matrix, scale, object->c_xyz);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(object->real_matrix, object->angle, object->xyz, scale, root->real_matrix);
-
+    get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix);
+    scale_matrix(object->real_matrix, object->scale, object->c_xyz);
 }
 
 void
@@ -643,10 +644,11 @@
     root->addChild(object);
 
     float scale[] = {5*scalex,5*scaley,1};
-    /*親の回転、座標から、子の回転、座標を算出*/
-    get_matrix(object->matrix, object->angle, object->xyz, scale, root->matrix);
+    get_matrix(object->matrix, object->angle, object->xyz, root->matrix);
+    scale_matrix(object->matrix, scale, object->c_xyz);
     /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
-    get_matrix(object->real_matrix, object->angle, object->xyz, scale, root->real_matrix);
+    get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix);
+    scale_matrix(object->real_matrix, object->scale, object->c_xyz);    
 }
 
 struct SGO_PAD pad[2];
--- a/main.c	Sat Jan 15 19:13:03 2011 +0900
+++ b/main.c	Tue Jan 18 02:20:10 2011 +0900
@@ -365,7 +365,7 @@
 	PutSprite(count, 640, 640, 192);
 	//PutSpriteEx(count, 8192, 8192, 0);
 
-	if (pad[0].st > 1) {
+	if ((pad[0].st > 1)||(runmode == 2)) {
 	    jiki.bf = TRUE;
 	    
 	    //CdPlay(1,&cdp[0],0);                                          
--- a/spe/Makefile	Sat Jan 15 19:13:03 2011 +0900
+++ b/spe/Makefile	Tue Jan 18 02:20:10 2011 +0900
@@ -14,13 +14,13 @@
 .SUFFIXES: .cc .o
 
 .cc.o:
-        $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
 
 all: $(TARGET)
 
 $(TARGET): $(OBJS)
-        $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
+	$(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
 
 clean:
-        rm -f $(TARGET) $(OBJS)
-        rm -f *~ \#*
\ No newline at end of file
+	rm -f $(TARGET) $(OBJS)
+	rm -f *~ \#*
\ No newline at end of file