changeset 117:9e4100c5d7ec

keybord input
author Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
date Thu, 16 Jun 2011 14:42:55 +0900
parents ed702e49cc6c
children b6dc70f6aa7e
files Magoroku.cc controler.cc game.cc play_id schedule.cc
diffstat 5 files changed, 179 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Magoroku.cc	Thu Jun 16 04:05:33 2011 +0900
+++ b/Magoroku.cc	Thu Jun 16 14:42:55 2011 +0900
@@ -56,6 +56,10 @@
 //static int game_pause(int);
 //static char *pad_trace_file;
 
+
+
+
+
 /**
  * runmode:
  * 0 - normal game                                                         
--- a/controler.cc	Thu Jun 16 04:05:33 2011 +0900
+++ b/controler.cc	Thu Jun 16 14:42:55 2011 +0900
@@ -14,7 +14,7 @@
 #include "sjoy.h" // ps2関連ファイルから
 
 
-
+//キー入力変数
 struct SGO_PAD pad;
 
 /*
@@ -117,6 +117,8 @@
     SDL_PumpEvents();
     Uint8 *keys = SDL_GetKeyState(NULL);
 
+    printf("key--\n");
+
     if (keys[SDLK_UP]) {
         pad.up += (pad.up < 2) ? 1 : 0;
     } else {
--- a/game.cc	Thu Jun 16 04:05:33 2011 +0900
+++ b/game.cc	Thu Jun 16 14:42:55 2011 +0900
@@ -13,20 +13,26 @@
 #include "schedule.h"
 
 
+extern bool padCheck(SDL_Joystick *joy);
+extern bool keybord(void);
+
+
+
 /* linda.c */
 #ifdef LINDA
 //extern int linda_init();
 #else
-#define linda_init 1
+#define linda_init() 1
 #endif
 
+
 void game_main()
 {
   Game game;
   bool flg = true;
-#ifdef LINDA
-  game->play_id = linda_init();
-#endif
+  //#ifdef LINDA
+  game.play_id = linda_init();
+  //#endif
   
   while (1) {
     /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/play_id	Thu Jun 16 14:42:55 2011 +0900
@@ -0,0 +1,149 @@
+./camera.cc:  //int type = game->camera_type;
+./camera.cc:  if(pad.left>0  && game->jiki->speed !=0){
+./camera.cc:    if(game->jiki->speed !=0){
+./camera.cc:  else if(pad.right>0 && game->jiki->speed !=0){
+./camera.cc:    if(game->jiki->speed !=0){
+./car.cc:      game->rap++;
+./compile:  //int type = game->camera_type;
+./compile:  if(pad.left>0  && game->jiki->speed !=0){
+./compile:    if(game->jiki->speed !=0){
+./compile:    else if(pad.right>0 && game->jiki->speed !=0){
+./compile:  if(game->jiki->speed !=0){
+./game.cc:  game->play_id = linda_init();
+./game.cc~:  game->play_id = linda_init();
+./linda.cc:  int id = game->play_id;
+./linda.cc:  send_packet(id, mode, game->car_id, game->course_id, NULL);
+./linda.cc:  int id = game->play_id;
+./linda.cc:  int id = game->play_id;
+./linda.cc:  int id = game->play_id;
+./linda.cc:  int id = game->play_id;
+./linda.cc:  int id = game->play_id;
+./linda.cc:  if (course_id != game->course_id) {
+./linda.cc:    course_id = game->course_id;
+./linda.cc:    game->course_id = course_id;
+./linda.cc:  int id = game->play_id;
+./linda.cc:  int id = game->play_id;
+./linda.cc:  int id = game->play_id;
+./linda.cc:  int id = game->play_id;
+./linda.cc:  CarPtr mycar = game->jiki;
+./linda.cc:    if (game->state == GAME_WAIT) {
+./linda.cc:      if (game->play_id == 1)
+./linda.cc:    if (game->play_id == 1) {
+./linda.cc:	if (game->state == GAME_FINISH) {
+./linda.cc:	  common_state = game->state;
+./linda.cc:	  game->state = common_state;
+./linda.cc:	common_state = game->state;
+./linda.cc:	game->state = common_state;
+./linda.cc:      if (game->state == GAME_GOAL) {
+./linda.cc:	  common_state = game->state;
+./linda.cc:	  game->state = common_state;
+./linda.cc:	game->state = common_state;
+./linda.cc:    if (game->state == GAME_WAIT) {
+./linda.cc:    game->state = common_state;
+./linda.cc:    psx_free(psx_reply(psx_in(game->play_id)));
+./linda.cc:    linda_seq[my_id]=psx_in(game->play_id);
+./linda.cc:    psx_out(game->play_id, (char*)&jiki, sizeof(CarInfo));
+./linda.cc:  send_packet(game->play_id, MODE_WAIT, 1, 1, NULL);
+Binary file ./magoroku matches
+./schedule.cc:  printf("game->car_id = %d\n",game->car_id);
+./schedule.cc:  //printf("game->jiki->speed = %f\n",game->jiki->speed);
+./schedule.cc:  game->jiki = car_init(game->car_id);
+./schedule.cc:  carNode_append(game->jiki);
+./schedule.cc:  field_init(game->course_id);
+./schedule.cc:  game->car_id      = 1;
+./schedule.cc:  game->course_id   = 1;
+./schedule.cc:  game->camera_type = 0;
+./schedule.cc:  game->rap         = 1;
+./schedule.cc:  game->jiki        = NULL;
+./schedule.cc:  game->play_id     = 1;
+./schedule.cc:  if (game->play_id == 1) {
+./schedule.cc:  if (game->play_id==1){
+./schedule.cc:  if (game->play_id == 1) {
+./schedule.cc:  } else if (game->play_id == 2) {
+./schedule.cc:  gSprite_PutSpriteEx(SP_SEL_CAR+game->car_id, 190, 200, 1.5, 1.5, 0.0);
+./schedule.cc:    game->car_id =
+./schedule.cc:      (game->car_id > MAXCAR-1) ? 1 : game->car_id + 1;
+./schedule.cc:    game->car_id =
+./schedule.cc:      (game->car_id < 2) ? MAXCAR : game->car_id - 1;
+./schedule.cc:  if (game->play_id == 1)
+./schedule.cc:  gSprite_PutSpriteEx(SP_SEL_COURSE+game->course_id, 190, 200, 1.7, 1.8, 0.0);
+./schedule.cc:  if (game->play_id == 1) {
+./schedule.cc:      game->course_id =
+./schedule.cc:	(game->course_id > MAXFIELD-1) ? 1 : game->course_id + 1;
+./schedule.cc:      game->course_id =
+./schedule.cc:	(game->course_id < 2) ? MAXFIELD : game->course_id - 1;
+./schedule.cc:  gSprite_PutSprite(27+game->play_id,265,10);
+./schedule.cc:  gSprite_PutSpriteEx(SP_SEL_CAR+game->car_id, 50, 120, 1.5, 1.5 , 0.0);
+./schedule.cc:  gSprite_PutSpriteEx(SP_SEL_COURSE+game->course_id, 340, 120, 1.7, 1.8 , 0.0);
+./schedule.cc:  if (!game->jiki){
+./schedule.cc:  car_id_update(game, game->jiki);
+./schedule.cc:  field_update(game->jiki);
+./schedule.cc:  camera_update(game,game->jiki->body->transfer);
+./schedule.cc:  gFont_SetStringInt(game->rap, 50, 100);
+./schedule.cc:  //  gSprite_DefSprite(23, 1, 1,(int)(106.0*(game->jiki->speed/game->jiki->speed_max)), 34);
+./schedule.cc:  gSprite_DefSprite(23, "name", (float)(106.0*(game->jiki->speed/game->jiki->speed_max)), 34.0, 100);
+./schedule.cc:  if (game->rap > MAXRAP) {
+./schedule.cc:  gFont_SetStringInt((int)(100.0*game->jiki->speed), 380, 350);
+./schedule.cc:  if ((pad.right > 0) && ((game->jiki->speed != 0) || (pad.circle > 0))) {
+./schedule.cc:    car_swerve(game->jiki, 1);
+./schedule.cc:  if ((pad.left > 0) && ((game->jiki->speed != 0) || (pad.circle > 0))) {
+./schedule.cc:    car_swerve(game->jiki, -1);
+./schedule.cc:    car_accelerate(game->jiki, 1);
+./schedule.cc:    car_accelerate(game->jiki, -1);
+./schedule.cc:    game->camera_type = !game->camera_type;
+./schedule.cc:  field_update(game->jiki);
+./schedule.cc:  if (game->play_id == 1) {
+./schedule.cc:  car_update(game, game->jiki);
+./schedule.cc:  field_update(game->jiki);
+./schedule.cc:  camera_update(game,game->jiki->body->transfer);
+./schedule.cc~:  printf("game->car_id = %d\n",game->car_id);
+./schedule.cc~:  //printf("game->jiki->speed = %f\n",game->jiki->speed);
+./schedule.cc~:  game->jiki = car_init(game->car_id);
+./schedule.cc~:  carNode_append(game->jiki);
+./schedule.cc~:  field_init(game->course_id);
+./schedule.cc~:  game->car_id      = 1;
+./schedule.cc~:  game->course_id   = 1;
+./schedule.cc~:  game->camera_type = 0;
+./schedule.cc~:  game->rap         = 1;
+./schedule.cc~:  game->jiki        = NULL;
+./schedule.cc~:  if (game->play_id == 1) {
+./schedule.cc~:  if (game->play_id==1){
+./schedule.cc~:  if (game->play_id == 1) {
+./schedule.cc~:  } else if (game->play_id == 2) {
+./schedule.cc~:  gSprite_PutSpriteEx(SP_SEL_CAR+game->car_id, 190, 200, 1.5, 1.5, 0.0);
+./schedule.cc~:    game->car_id =
+./schedule.cc~:      (game->car_id > MAXCAR-1) ? 1 : game->car_id + 1;
+./schedule.cc~:    game->car_id =
+./schedule.cc~:      (game->car_id < 2) ? MAXCAR : game->car_id - 1;
+./schedule.cc~:  if (game->play_id == 1)
+./schedule.cc~:  gSprite_PutSpriteEx(SP_SEL_COURSE+game->course_id, 190, 200, 1.7, 1.8, 0.0);
+./schedule.cc~:  if (game->play_id == 1) {
+./schedule.cc~:      game->course_id =
+./schedule.cc~:	(game->course_id > MAXFIELD-1) ? 1 : game->course_id + 1;
+./schedule.cc~:      game->course_id =
+./schedule.cc~:	(game->course_id < 2) ? MAXFIELD : game->course_id - 1;
+./schedule.cc~:  gSprite_PutSprite(27+game->play_id,265,10);
+./schedule.cc~:  gSprite_PutSpriteEx(SP_SEL_CAR+game->car_id, 50, 120, 1.5, 1.5 , 0.0);
+./schedule.cc~:  gSprite_PutSpriteEx(SP_SEL_COURSE+game->course_id, 340, 120, 1.7, 1.8 , 0.0);
+./schedule.cc~:  if (!game->jiki){
+./schedule.cc~:  car_id_update(game, game->jiki);
+./schedule.cc~:  field_update(game->jiki);
+./schedule.cc~:  camera_update(game,game->jiki->body->transfer);
+./schedule.cc~:  gFont_SetStringInt(game->rap, 50, 100);
+./schedule.cc~:  //  gSprite_DefSprite(23, 1, 1,(int)(106.0*(game->jiki->speed/game->jiki->speed_max)), 34);
+./schedule.cc~:  gSprite_DefSprite(23, "name", (float)(106.0*(game->jiki->speed/game->jiki->speed_max)), 34.0, 100);
+./schedule.cc~:  if (game->rap > MAXRAP) {
+./schedule.cc~:  gFont_SetStringInt((int)(100.0*game->jiki->speed), 380, 350);
+./schedule.cc~:  if ((pad.right > 0) && ((game->jiki->speed != 0) || (pad.circle > 0))) {
+./schedule.cc~:    car_swerve(game->jiki, 1);
+./schedule.cc~:  if ((pad.left > 0) && ((game->jiki->speed != 0) || (pad.circle > 0))) {
+./schedule.cc~:    car_swerve(game->jiki, -1);
+./schedule.cc~:    car_accelerate(game->jiki, 1);
+./schedule.cc~:    car_accelerate(game->jiki, -1);
+./schedule.cc~:    game->camera_type = !game->camera_type;
+./schedule.cc~:  field_update(game->jiki);
+./schedule.cc~:  if (game->play_id == 1) {
+./schedule.cc~:  car_update(game, game->jiki);
+./schedule.cc~:  field_update(game->jiki);
+./schedule.cc~:  camera_update(game,game->jiki->body->transfer);
+Binary file ./schedule.o matches
--- a/schedule.cc	Thu Jun 16 04:05:33 2011 +0900
+++ b/schedule.cc	Thu Jun 16 14:42:55 2011 +0900
@@ -130,7 +130,7 @@
   game->camera_type = 0;
   game->rap         = 1;
   game->jiki        = NULL;
-
+  
   ranking = 0;
 
   wait_init();
@@ -201,16 +201,24 @@
   printf("sche_game_opening\n");
   
   static int blink_count = 0;
+
+  //ここを現在通らないらしい。
   if (game->play_id==1){
     if (blink_count < 35) {
       gFont_SetString("PUSH START !!", 170, 380);
     }
     blink_count = (blink_count > 70) ? 0 : blink_count + 1;
 
-    //    if (pad.st != 1) { goto OPENING; }
-    if (1) { goto OPENING; }
+    printf("pad.st = %d\n",pad.st);
+    if (pad.st != 1) { goto OPENING; }
+    //if (1) { goto OPENING; }
   }
-    
+
+  /*処理をいったんifの外へ。これを見る限り、キー入力自体はokぽい
+  printf("pad.st = %d\n",pad.st);
+  if (pad.st != 1) { goto OPENING; }
+  */
+
   set_schedule_assumption(sche_game_select_car);
 
  OPENING:
@@ -491,7 +499,7 @@
 sche_game_main_finish2(Game *game)
 {
   gFont_SetString("GAME OVER ...", 200, 200);
-
+  
   if (pad.st == 1) {
     set_schedule_assumption(sche_game_opening);
   }