changeset 48:6cfd912a602d

fix trace.*
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Thu, 20 Jan 2011 18:51:54 +0900
parents f5e112bffe26
children
files Dandy.cc Makefile.def TaskDandy.cc main.c state_task.cc trace.c
diffstat 6 files changed, 38 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/Dandy.cc	Tue Jan 18 19:35:58 2011 +0900
+++ b/Dandy.cc	Thu Jan 20 18:51:54 2011 +0900
@@ -38,10 +38,6 @@
 static int cf = 0;
 static int cc = 0;
 
-//static SDL_Surface *screen;
-// static Uint32 background;
-// static char *pad_trace_file;
-
 extern void schedule();
 extern void tokuten();
 extern void Pad();
@@ -116,7 +112,6 @@
 
 HTaskPtr 
 Dandy::application_task(HTaskPtr next, Viewer* viewer){
-    // printf("gamef = %d\n",gamef);
     switch (gamef) {
     case 0:    gamef= dandy_main_init(gamef); break;
     case 1:    gamef= gamesyokika(gamef); break;
@@ -152,13 +147,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);
@@ -330,19 +325,15 @@
 	}
 	flip();
 
-	//SDL_FillRect(screen, NULL, background);
-
 	schedule();
 	enemyfaste = count;
     
 	// timeprof_begin(timeprof_move);
-	//Move(); //enemy move
 	collision_detect();
 	outofwindow();
 	// timeprof_end(timeprof_move);
 	state_update();
 	asteroidi = 0;
-	//charpatern();
 	//bosguage();
 
 	if (jiki.bf == TRUE) {
@@ -354,10 +345,10 @@
 	Putbom();
 	tokuten();
     
-	count++;
+	//count++;
 	//PutSprite(count, 0, 960 - 96, 10);
 	/*インフレゲージ */
-	count++;
+	//count++;
 	//PutSprite(count, 0, 0, 48);
 
 	obj_draw();
@@ -431,8 +422,10 @@
 
     SoundStop();
     SoundPlay(7);
+
     gamef =  2;
     flip();
+
     return gamef;
 }
 
@@ -640,7 +633,6 @@
 //	printf("PutSpriteEx %d unknown\n",number);
 	return;
     }
-
     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;
--- a/Makefile.def	Tue Jan 18 19:35:58 2011 +0900
+++ b/Makefile.def	Thu Jan 20 18:51:54 2011 +0900
@@ -7,7 +7,7 @@
 ABIBIT = 32
 ABI = -m$(ABIBIT)
 CC      = g++
-OPT = -pg
+OPT = -g
 CFLAGS  =  -Wall $(OPT) $(ABI)
 
 
--- a/TaskDandy.cc	Tue Jan 18 19:35:58 2011 +0900
+++ b/TaskDandy.cc	Thu Jan 20 18:51:54 2011 +0900
@@ -36,14 +36,11 @@
 //static int cdp[20] = { 16, 16, 16, 17, 18, 0 };
 static int i;
 
+static int gamef = 0;
 static int rswait = 0;
 static int cf = 0;
 static int cc = 0;
 
-//static SDL_Surface *screen;
-// static Uint32 background;
-// static char *pad_trace_file;
-
 extern void schedule();
 extern void tokuten();
 extern void Pad();
@@ -84,7 +81,6 @@
 
 static    int screen_w;
 static    int screen_h;
-static int gamef;
 
 MainLoopPtr
 Dandy::init(Viewer *sgroot_, int w, int h)
@@ -118,10 +114,8 @@
     return 0;
 };
 
-
 HTaskPtr
 Dandy::application_task(HTaskPtr next, Viewer* viewer){
-//    printf("gamef = %d\n",gamef);
     switch (gamef) {
     case 0:    gamef= dandy_main_init(gamef); break;
     case 1:    gamef= gamesyokika(gamef); break;
@@ -151,13 +145,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);
@@ -174,7 +168,7 @@
 static void
 print_usage()
 {
-  printf("usage: exe_file [-h|-help|--help][-capture filename][-trace filename]\n");
+  printf("usage: ./exe_file [-h|-help|--help][-capture filename][-trace filename]\n");
 }
 
 
@@ -236,7 +230,7 @@
 	}
 	first = t_buff;
     }
-
+    
     sgroot->createFromXMLfile("xml/character.xml");
     sgroot->createFromXMLfile("xml/font.xml");
     sgroot->createFromXMLfile("xml/effect.xml");
@@ -287,6 +281,7 @@
 
     __debug("finished init_chara_list\n");
 
+    //state と TaskID の関連付け
     initStateList();
 
     return 1;
@@ -326,13 +321,11 @@
 	    gamef = gamesyokika(gamef);
 	}
 
-	if (pad[0].quit != 0) {
+	if (pad[0].quit == 1) {
 	    gamef = 4;
 	}
 	flip();
 
-	//SDL_FillRect(screen, NULL, background);
-
 	schedule();
 	enemyfaste = count;
 
@@ -347,18 +340,16 @@
 
 	asteroidi = 0;
 	// timeprof_begin(timeprof_move);
-	//Move(); //enemy move
 	outofwindow();
 	// timeprof_end(timeprof_move);
 	state_update();
 	collision_detect();
-	//charpatern();
 	//bosguage();
     
-	count++;
+	//count++;
 	//PutSprite(count, 0, 960 - 96, 10);
 	/*インフレゲージ */
-	count++;
+	//count++;
 	//PutSprite(count, 0, 0, 48);
 
 	obj_draw();
@@ -366,6 +357,9 @@
 
 	KeyAssign(runmode, t_buff, joy, pad);
 
+	filpcount++;
+	count = 0;
+
 	return gamef;
 }
 
@@ -429,8 +423,10 @@
 
     SoundStop();
     SoundPlay(7);
+
     gamef =  2;
     flip();
+
     return gamef;
 }
 
@@ -459,7 +455,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);                                          
@@ -881,7 +877,7 @@
       t_buff = CapturePad(t_buff, pad);
       break;
     case 2:
-      t_buff = TracePad(t_buff, pad);
+	t_buff = TracePad(t_buff, pad);
       break;
     }
 }
--- a/main.c	Tue Jan 18 19:35:58 2011 +0900
+++ b/main.c	Thu Jan 20 18:51:54 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/state_task.cc	Tue Jan 18 19:35:58 2011 +0900
+++ b/state_task.cc	Thu Jan 20 18:51:54 2011 +0900
@@ -663,8 +663,11 @@
 CHARACTER*
 delete_chara(CHARACTER *p)
 {
+  if (p->tama == FALSE) {
+    printf("F%d:   [%d] x=%f  y=%f  vx=%f  vy=%f  DELETE\n", filpcount, p->chara_id, p->x, p->y, p->vx, p->vy);
+  }
+
   CHARACTER *parent = p;
-  printf("x = %f, y = %f, vx = %f, vy = %f\n",p->x, p->y, p->vx, p->vy);
   p->f = FALSE;
   p->state = noaction;
   p->collision = noaction;
--- a/trace.c	Tue Jan 18 19:35:58 2011 +0900
+++ b/trace.c	Thu Jan 20 18:51:54 2011 +0900
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include "trace.h"
 
-
+static int pad_count;
 static FILE *fileptr;
 const char *filename;
 
@@ -15,6 +15,7 @@
 int
 PadfileOpen(const char* name)
 {
+    pad_count = 0;
     filename = name;
     fileptr = fopen(filename, "rb+");
     
@@ -63,11 +64,9 @@
 TraceBuffPtr
 CapturePad(TraceBuffPtr buff, SGO_PAD *pad)
 {
-    static int count;
-
-    if (count !=PAD_BUFSIZE) {
-      buff->cappad[count] = pad[0];
-      ++count;
+    if (pad_count !=PAD_BUFSIZE) {
+      buff->cappad[pad_count] = pad[0];
+      ++pad_count;
       return buff;
     } else {
       TraceBuffPtr new_buff = (TraceBuffPtr)malloc(sizeof(TraceBuff));
@@ -75,7 +74,7 @@
       buff->next = new_buff;
       new_buff->next = NULL;
 
-      count = 1;
+      pad_count = 1;
       return new_buff;
     }
 }
@@ -84,17 +83,15 @@
 TraceBuffPtr
 TracePad(TraceBuffPtr buff, SGO_PAD *pad)
 {
-    static int count;
-
-    if (count !=PAD_BUFSIZE) {
-      pad[0] = buff->cappad[count];
-      ++count;
+    if (pad_count !=PAD_BUFSIZE) {
+      pad[0] = buff->cappad[pad_count];
+      ++pad_count;
       return buff;
     } else {
       buff = buff->next;
       pad[0] = buff->cappad[0];
       
-      count = 1;
+      pad_count = 1;
       return buff;
     }
 }