changeset 59:cd05eee90279

fix code.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Mon, 07 Feb 2011 03:31:18 +0900
parents e0018f39f7e1
children cfd42ee2ad28
files Character.c Character_state.c Dandy.cc TaskDandy.cc collision.c collision_task.cc main.c ppe/Atari.cc ppe/chara_state12.cc ppe/task_object.h property.h schedule3.c state_task.cc
diffstat 13 files changed, 61 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/Character.c	Sun Feb 06 17:49:33 2011 +0900
+++ b/Character.c	Mon Feb 07 03:31:18 2011 +0900
@@ -28,7 +28,7 @@
 
 const table enemystate[] = ENEMY_STATUS_TABLE;
 int filpcount = 0;
-int stage = 0;
+int stage = 1;
 BOOL tf = FALSE;
 static int pool_size;
 
@@ -134,13 +134,13 @@
     q->s = 0;
     q->f = TRUE;
 
-    
+    /*    
     if (q->tama == FALSE) {
         printf("F%d: CREATE  [NAME]%s_%d  [COORD]x= %f  y= %f  vx= %f  vy= %f\n",
 	       filpcount, dtable[number].name, q->chara_id,
 	       q->x, q->y, q->vx, q->vy);
     }
-    
+    */
 }
 
 void state_update()
--- a/Character_state.c	Sun Feb 06 17:49:33 2011 +0900
+++ b/Character_state.c	Mon Feb 07 03:31:18 2011 +0900
@@ -45,13 +45,15 @@
 CHARACTER *
 delete_chara(CHARACTER *p)
 {
+  /*
   if (p->tama == FALSE) {
       printf("F%d: DELETE  [NAME]%s_%d  [COORD]x= %f  y= %f  vx= %f  vy= %f\n",
 	     filpcount, dtable[p->charano].name, p->chara_id,
 	     p->x, p->y, p->vx, p->vy);
-      printf("               [TAMA]lv1 = %d, lv2 = %d [LASER]lv1 = %d\n",
+      printf("             [BULLET]tlv1 = %d, tlv2 = %d llv1 = %d\n",
 	     tama_lv1_end+1, tama_lv2_end+1, laser_lv1_end+1);
   }
+  */
   
   CHARACTER *parent = p;
   p->f = FALSE;
@@ -447,6 +449,8 @@
       p->y = random() % (120 - 35);
       p->vx = (random() % 4 + 1);
       p->vy = random() % 3 + 1;
+      printf("[COORD]x= %f  y= %f  vx= %f  vy= %f\n",
+	     p->x, p->y, p->vx, p->vy);
       p->state = chara_state23;
     }
   if((sf == 2))
@@ -455,6 +459,8 @@
       p->y = -30;
       p->vx = random() % 3 - 1;
       p->vy = (random() % 4 + 1);
+      printf("[COORD]x= %f  y= %f  vx= %f  vy= %f\n",
+	     p->x, p->y, p->vx, p->vy);
       p->state = chara_state23;
     }
   if(sf == 3)
@@ -463,6 +469,8 @@
       p->y = random() % (120 - 35);
       p->vx = (random() % 4 + 1) * -1;
       p->vy = random() % 3 -1;
+      printf("[COORD]x= %f  y= %f  vx= %f  vy= %f\n",
+	     p->x, p->y, p->vx, p->vy);
       p->state = chara_state23;
     }
   return p;
--- a/Dandy.cc	Sun Feb 06 17:49:33 2011 +0900
+++ b/Dandy.cc	Mon Feb 07 03:31:18 2011 +0900
@@ -47,6 +47,8 @@
 // static Uint32 background;
 // static char *pad_trace_file;
 
+extern int finish_flag;
+
 extern void schedule();
 extern void tokuten();
 extern void Pad();
@@ -330,7 +332,7 @@
 	    gamef = gamesyokika(gamef);
 	}
 
-	if (pad[0].quit != 0) {
+	if (pad[0].quit != 0||finish_flag == 1) {
 	    gamef = 4;
 	}
 	flip();
--- a/TaskDandy.cc	Sun Feb 06 17:49:33 2011 +0900
+++ b/TaskDandy.cc	Mon Feb 07 03:31:18 2011 +0900
@@ -36,7 +36,7 @@
 #include "Cheat.h"
 #include "debug_db.h"
 
-
+extern int finish_flag;
 static int use_keybord = 0;
 //static int cdp[20] = { 16, 16, 16, 17, 18, 0 };
 static int i;
@@ -331,7 +331,7 @@
 	    gamef = gamesyokika(gamef);
 	}
 
-	if (pad[0].quit != 0) {
+	if ((pad[0].quit != 0)||(finish_flag == 1)) {
 	    gamef = 4;
 	}
 	flip();
@@ -355,6 +355,18 @@
 	outofwindow();
 	// timeprof_end(timeprof_move);
 
+	//charpatern();
+	//bosguage();
+    
+	//count++;
+	//PutSprite(count, 0, 960 - 96, 10);
+	/*インフレゲージ */
+	//count++;
+	//PutSprite(count, 0, 0, 48);
+
+	obj_draw();
+	gamef = game_pause(gamef);
+
 	HTaskPtr state_next = create_next();
 
 	state_update();
@@ -371,23 +383,10 @@
 	update->spawn();
 	reflect->spawn();
 
-	//charpatern();
-	//bosguage();
-    
-	//count++;
-	//PutSprite(count, 0, 960 - 96, 10);
-	/*インフレゲージ */
-	//count++;
-	//PutSprite(count, 0, 0, 48);
-
-	obj_draw();
-	gamef = game_pause(gamef);
-
 	KeyAssign(runmode, t_buff, joy, pad);
 
 	filpcount++;
 	count = 0;
-
 	return gamef;
 }
 
@@ -425,7 +424,7 @@
 	tlv3[i].y = -1;
     }
     filpcount = 0;
-    stage = 0;
+    stage = 1;
     //for (i = 0; i < 300; i++)
     //enemy[i].f = FALSE;
     jiki.zanki = 3;
--- a/collision.c	Sun Feb 06 17:49:33 2011 +0900
+++ b/collision.c	Mon Feb 07 03:31:18 2011 +0900
@@ -237,7 +237,7 @@
     }
     /*bomber(laser lv3) */
     if (laser_lv3[0].r < 62) {
-	for (i1 = 1; i1 < 128; i1++) {
+	for (i1 = 1; i1 < 64; i1++) {
 	    if ((laser_lv3[i1].x + 128 > ex) && (ex + w > laser_lv3[i1].x)
 		&& (laser_lv3[i1].y + 128 > ey)
 		&& (laser_lv3[i1].y < ey + h)
--- a/collision_task.cc	Sun Feb 06 17:49:33 2011 +0900
+++ b/collision_task.cc	Mon Feb 07 03:31:18 2011 +0900
@@ -31,13 +31,15 @@
 
     if (p->collision_task == true) {
 	//debug
+/*
 	if (p->tama == FALSE) {
 	    printf("F%d: DELETE  [NAME]%s_%d  [COORD]x= %f  y= %f  vx= %f  vy= %f\n",
 		   filpcount, dtable[p->charano].name, p->chara_id,
 		   p->x, p->y, p->vx, p->vy);
-	    printf("             [STATE]%s [BULLET]tlv1 = %d, tlv2 = %d llv1 = %d\n",
-		   state_list[num].name, tama_lv1_end+1, tama_lv2_end+1, laser_lv1_end+1);
+	    printf("             [BULLET]tlv1 = %d, tlv2 = %d llv1 = %d\n",
+		   tama_lv1_end+1, tama_lv2_end+1, laser_lv1_end+1);
 	}
+*/
 
 	p->state_task = DELETE_CHARA;
 	p->state = delete_chara;
@@ -71,7 +73,7 @@
     property->tlv3 = tlv3[0];
     memcpy(property->laser_lv1, laser_lv1, sizeof(laser)*20);
     property->laser_lv2 = laser_lv2[0];
-    memcpy(property->laser_lv3, laser_lv3, sizeof(laser)*128);
+    memcpy(property->laser_lv3, laser_lv3, sizeof(laser)*64);
 
     return property;
 }
@@ -99,7 +101,7 @@
     tlv3[0] = property->tlv3;
     memcpy(laser_lv1, property->laser_lv1, sizeof(laser)*20);
     laser_lv2[0] = property->laser_lv2;
-    memcpy(laser_lv3, property->laser_lv3, sizeof(laser)*128);
+    memcpy(laser_lv3, property->laser_lv3, sizeof(laser)*64);
 }
 
 
--- a/main.c	Sun Feb 06 17:49:33 2011 +0900
+++ b/main.c	Mon Feb 07 03:31:18 2011 +0900
@@ -29,6 +29,8 @@
 #include "Cheat.h"
 #include "error.h"
 
+extern int finish_flag;
+
 static int runmode = 0;
 static int gamef = 0;
 static int use_keybord = 0;
@@ -212,9 +214,9 @@
 	    gamesyokika(joy);
 	}
 
-	if (pad[0].quit != 0) {
-	    gamef = 0;
-	}
+      if (pad[0].quit != 0||finish_flag == 1) {
+	gamef = 0;
+      }
 
 	//SDL_FillRect(screen, NULL, background);
 	glClear( GL_COLOR_BUFFER_BIT);		
@@ -498,6 +500,7 @@
       } else {
 	Pad(joy);
       }
+      cheat();
       break;
     case 1:
       if (use_keybord) {
--- a/ppe/Atari.cc	Sun Feb 06 17:49:33 2011 +0900
+++ b/ppe/Atari.cc	Mon Feb 07 03:31:18 2011 +0900
@@ -296,7 +296,7 @@
     }
     /*bomber(laser lv3) */
     if (laser_lv3[0].r < 62) {
-	for (i1 = 1; i1 < 128; i1++) {
+	for (i1 = 1; i1 < 64; i1++) {
 	    if ((laser_lv3[i1].x + 128 > ex) && (ex + w > laser_lv3[i1].x)
 		&& (laser_lv3[i1].y + 128 > ey)
 		&& (laser_lv3[i1].y < ey + h)
--- a/ppe/chara_state12.cc	Sun Feb 06 17:49:33 2011 +0900
+++ b/ppe/chara_state12.cc	Mon Feb 07 03:31:18 2011 +0900
@@ -22,7 +22,7 @@
 	smanager->setup_outputData();
 	
 	CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
-	int *w_count = (int*)smanager->get_output(wbuf, 3);
+	int *w_count = (int*)smanager->get_output(wbuf, 1);
 	int *w_rinky = (int*)smanager->get_output(wbuf, 4);
 	ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6);
 	sprite->flag = true;
--- a/ppe/task_object.h	Sun Feb 06 17:49:33 2011 +0900
+++ b/ppe/task_object.h	Mon Feb 07 03:31:18 2011 +0900
@@ -120,7 +120,7 @@
   tama1 tlv3;
   laser laser_lv1[20];
   laser laser_lv2;
-  laser laser_lv3[128];
+  laser laser_lv3[64];
   
 } CollisionProperty, *CollisionPropertyPtr;
 
--- a/property.h	Sun Feb 06 17:49:33 2011 +0900
+++ b/property.h	Mon Feb 07 03:31:18 2011 +0900
@@ -20,7 +20,7 @@
   tama1 tlv3;
   laser laser_lv1[20];
   laser laser_lv2;
-  laser laser_lv3[128];
+  laser laser_lv3[64];
   
 } CollisionProperty, *CollisionPropertyPtr;
 
--- a/schedule3.c	Sun Feb 06 17:49:33 2011 +0900
+++ b/schedule3.c	Mon Feb 07 03:31:18 2011 +0900
@@ -11,6 +11,9 @@
 //#include "libps.h"
 #include"debug.h"
 #include "SDL_opengl.h"
+
+int finish_flag = 0;
+
 enum {
     FRAME_RATE = 32,
 };
@@ -722,6 +725,7 @@
 	Endingscore(filpcount);
 	if (filpcount > 4000) {
 	  filpcount = 4000;
+	  finish_flag = 1;
 	}
     }
 }
--- a/state_task.cc	Sun Feb 06 17:49:33 2011 +0900
+++ b/state_task.cc	Mon Feb 07 03:31:18 2011 +0900
@@ -90,6 +90,15 @@
     m->tex_h = power_of_two(m->h);
 }
 
+void
+printState(SchedTask *s, void *chara, void *arg)
+{
+    CHARACTER *p = (CHARACTER*)chara;
+    printf("[COORD]x= %f  y= %f  vx= %f  vy= %f\n",
+	   p->x, p->y, p->vx, p->vy);
+
+    state_check(p);
+}
 
 void
 updateState(SchedTask *s, void *chara, void *arg)
@@ -101,16 +110,6 @@
 
 
 void
-PrintCoordinate(SchedTask *s, void *chara, void *arg)
-{
-    CHARACTER *p = (CHARACTER*)chara;
-    printf("x = %f, y = %f, vx = %f, vy = %f\n",p->x, p->y, p->vx, p->vy);
-
-    state_check(p);
-}
-
-
-void
 freeObject(SchedTask *s, void *chara, void *obj)
 {
     free(obj);
@@ -204,7 +203,7 @@
 
     state_task->set_outData(0, p, sizeof(CHARACTER));
 
-    state_task->set_post(PrintCoordinate, (void*)p, NULL);
+    state_task->set_post(printState, (void*)p, NULL);
     state_task->set_cpu(get_cpunum());
 
     state_next->wait_for(state_task);