view schedule.cc @ 8:7c60ef3fca5b

test
author tkaito
date Wed, 07 Jul 2010 03:11:52 +0900
parents c015109a6041
children dea6d34c8e91
line wrap: on
line source

#include "dandy.h"

static const int FRAME_RATE = 32;

void Putenemy(int charano, int x, int y, int sx, int sy, int move, int coll, 
	      SceneGraphPtr node, void *sgroot_);

void
schedule(SceneGraphPtr node, void *sgroot_, int w, int h) 
{
  SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
  Pad *pad = sgroot->getController();
  if(back_property.flag == 0){
    if(pad->start.isPush()) {
      back_property.flag = 1;
      //node->children->remove();
      sgroot->setSceneData(node);
    }
  }

  if(back_property.flag == 1) {
  switch (node->frame) {
  case 1:
    break;    
  case FRAME_RATE * 10:
    Putenemy(1, w/2, 0, 2, 4, MOVE_00, MOVE_00, node, sgroot);
    break;
  case FRAME_RATE * 20:
    Putenemy(1, w/3, 0, 0, 8, MOVE_00, MOVE_00, node, sgroot);
    Putenemy(1, w/2, 0, 0, 8, MOVE_00, MOVE_00, node, sgroot);
    break;
    /*
  case FRAME_RATE * 4:
    Putenemy(1, 120, -128, 0, 4, chara_state0);
    break;
  case FRAME_RATE * 5:
    Putenemy(1, 224, -128, 1, 1, chara_state0);
    Putenemy(1, 184, -128, 1, 1, chara_state0);
    break;
  case FRAME_RATE * 6:
    Putenemy(1, 120, -128, 1, 2, chara_state0);
    break;
  case FRAME_RATE * 7:
    Putenemy(1, 56, -128, 0, 1, chara_state0);
    Putenemy(1, 184, -128, 0, 1, chara_state0);
    break;
  case FRAME_RATE * 8:
    Putenemy(2, 120, -128, 0, 1, chara_state0);
    break;
    
  case FRAME_RATE * 12:
    Putenemy(1, 1280 - 128 - 120, -128, 0, 1, chara_state4);
    break;
  case FRAME_RATE * 13:
    Putenemy(1, 1280 - 128 - 120, -128, 0, 1, chara_state4);
    break;
  case FRAME_RATE * 14:
    Putenemy(1, 1280 - 128 - 120, -128, 0, 1, chara_state4);
    break;
  case FRAME_RATE * 15:
    Putenemy(2, 1280 - 128 - 120, -128, -1, 1, chara_state4);
    break;
  case FRAME_RATE * 16:
    Putenemy(2, 1280 - 128 - 120, -128, 0, 1, chara_state4);
    break;
  case FRAME_RATE * 17:
    Putenemy(2, 1280 - 128 - 120, -128, 0, 1, chara_state4);
    break;
  case FRAME_RATE * 18:
    Putenemy(1, 1280 - 128 - 120, -32, 0, 1, chara_state4);
    Putenemy(1, 1280 - 128, -128, -2, 1, chara_state4);
    Putenemy(1, 800, -88, -1, 1, chara_state4);
    break;
    
  case FRAME_RATE * 24:
    Putenemy(1, 256, -128, 0, 1, chara_state4);
    Putenemy(1, 1280 - 256 - 128, -128, 0, 1, chara_state4);
    break;
  case FRAME_RATE * 25:
    Putenemy(2, 512, -128, 0, 1, chara_state4);
    Putenemy(2, 1280 - 128, -128, 0, 1, chara_state4);
    break;
  case FRAME_RATE * 26:
    Putenemy(1, 384, -128, 0, 1, chara_state4);
    Putenemy(1, 1280 - 256, -128, 0, 2, chara_state4);
    Putenemy(1, 512, -128, 0, 3, chara_state4);
    Putenemy(1, 1280 - 256, -128, 0, 2, chara_state4);
    break;
  case FRAME_RATE * 27:
    Putenemy(2, 512, -128, 0, 3, chara_state2);
    Putenemy(2, 256 - 128, -128, 0, 2, chara_state2);
    Putenemy(2, 768, -128, 0, 4, chara_state2);
    Putenemy(2, 128, -128, 0, 3, chara_state2);
    break;
  case FRAME_RATE * 28:
    Putenemy(1, 256, -128, 0, 1, chara_state4);
    Putenemy(1, 1280 - 256 - 128, -128, 0, 1, chara_state4);
    break;
  case FRAME_RATE * 29:
    Putenemy(2, 256, -128, 0, 1, chara_state4);
    Putenemy(2, 1280 - 256 - 128, -128, 0, 1, chara_state4);
    break;
  case FRAME_RATE * 30:
    Putenemy(1, 256, -128, 0, 1, chara_state4);
    Putenemy(1, 1280 - 256 - 128, -128, 0, 1, chara_state4);
    break;
    
  case FRAME_RATE * 33:
    Putenemy(1, 256, 1088, 0, -1, chara_state5);
    Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state5);//5/22/pm5:300
    break;
  case FRAME_RATE * 34:
    Putenemy(2, 256, 1088, 0, -1, chara_state5);
    Putenemy(2, 1280 - 256 - 128, 1088, 0, -1, chara_state5);
    break;
  case FRAME_RATE * 35:
    Putenemy(1, 256, 1088, 0, -1, chara_state5);
    Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state5);
    break;
  case FRAME_RATE * 36:
    Putenemy(2, 256, 1088, 0, -1, chara_state5);
    Putenemy(2, 1280 - 256 - 128, 1088, 0, -1, chara_state5);
    break;
  case FRAME_RATE * 37:
    Putenemy(1, 256, 1088, 0, -1, chara_state5);
    Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state5);
    break;
  case FRAME_RATE * 38:
    Putenemy(2, 256, 1088, 0, -1, chara_state5);
    Putenemy(2, 1280 - 256 - 128, 1088, 0, -1, chara_state5);
    break;
  case FRAME_RATE * 39:
    Putenemy(1, 256, 1088, 0, -1, chara_state5);
    Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state5);
    break;
    
  case FRAME_RATE * 50:
    Putenemy(40, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state3);
    break;
  case FRAME_RATE * 46:
    Putenemy(40, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state3);
    break;
  case FRAME_RATE * 54:
    Putenemy(40, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state3);
    break;
    
  case FRAME_RATE * 60:
    Putenemy(1, 256, 1088, 0, -1, chara_state6);
    Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state6);
    break;
  case FRAME_RATE * 61:
    Putenemy(1, 256, 1088, 0, -1, chara_state6);
    Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state6);
    break;
  case FRAME_RATE * 62:
    Putenemy(1, 256, 1088, 0, -1, chara_state6);
    Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state6);
    break;
  case FRAME_RATE * 63:
    Putenemy(1, 256, 1088, 0, -1, chara_state6);
    Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state6);
    break;
  case FRAME_RATE * 64:
    Putenemy(1, 256, 1088, 0, -1, chara_state6);
    Putenemy(1, 1280 - 256 - 128, 1088, 0, -1, chara_state6);
    break;
  case FRAME_RATE * 65:
    Putenemy(40, 256, 1088, 0, -1, chara_state6);
    Putenemy(40, 1280 - 256 - 128, 1088, 0, -1, chara_state6);
    break;
    
  case FRAME_RATE * 80:
    Putenemy(42, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 66:
    Putenemy(41, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 84:
    Putenemy(42, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 70:
    Putenemy(41, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 88:
    Putenemy(42, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 74:
    Putenemy(41, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 92:
    Putenemy(42, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 78:
    Putenemy(41, rand() % (1280 - 256) + 128, -128, 0, 1, chara_state7);
    break;
    
  case FRAME_RATE * 100:
    Putenemy(41, 256, -128, 0, 1, chara_state7);
    Putenemy(41, 1280 - 256 - 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 81:
    Putenemy(42, 256, -128, 0, 1, chara_state7);
    Putenemy(42, 1280 - 256 - 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 104:
    Putenemy(41, 256, -128, 0, 1, chara_state7);
    Putenemy(41, 1280 - 256 - 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 83:
    Putenemy(42, 256, -128, 0, 1, chara_state7);
    Putenemy(42, 1280 - 256 - 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 108:
    Putenemy(41, 256, -128, 0, 1, chara_state7);
    Putenemy(41, 1280 - 256 - 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 85:
    Putenemy(42, 256, -128, 0, 1, chara_state7);
    Putenemy(42, 1280 - 256 - 128, -128, 0, 1, chara_state7);
    break;
  case FRAME_RATE * 112:
    Putenemy(41, 256, -128, 0, 1, chara_state7);
    Putenemy(41, 1280 - 256 - 128, -128, 0, 1, chara_state7);
    break;
    
  case FRAME_RATE * 130:
    SoundStop();
    SoundPlay(4);
    for(p = active_chara_list;p!=NULL;p=p->next)
      {
	p->f = FALSE;
	p->state = delete_chara;
	p->collision = noaction;
      }
    Putenemy(4, 520, -128, 0, 1, chara_state8);	// 1面ボスをPutenemy
  }
    */
  }
  }
}

ObjProperty enemy[300];
ObjPropertyPtr e;

void
create_enemy(SchedTask *s, void *enemy_, void *b)
{
  ObjPropertyPtr e = (ObjPropertyPtr)enemy_; 
  SceneGraphPtr back1, enemy1;
  back1 = (SceneGraphPtr)e->parent;
  enemy1 = (SceneGraphPtr)e->root;
  
  enemy1->xyz[0] = e->x;
  enemy1->xyz[1] = e->y;

  back1->addChild(enemy1);
  
}

void
Putenemy(int charano, int x, int y, int sx, int sy, int move, int coll, 
	      SceneGraphPtr node, void *sgroot_)
{
  SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
  SceneGraphPtr obj = (SceneGraphPtr)charactor[charano].root;

  int ii = 0;
  e = &enemy[0];
  while ((e->flag) == 1) {
    ii++;
    if (ii == 100)
      return;
    e++;
  }
  e->x = x;
  e->y = y;
  e->vx = sx;
  e->vy = sy;
  e->root = obj;
  e->parent = node;
  e->flag = 1;
  e->vital = charactor[charano].vital;
  //e->move = move;
  e->score = charactor[charano].score;
  //e->dt1 = e->dt2 = 0;
  //e->tama = tf;
  
  obj->xyz[0] = x;
  obj->xyz[1] = y;
  obj->stack_xyz[0] = sx;
  obj->stack_xyz[1] = sy;

  int size = sizeof(ObjPropertyPtr)*16;
  //obj->set_move_collision(move, coll);
  sgroot->set_game_task(move, e, size, create_enemy);
  
  //node->addChild(obj);
  //node->setSceneData();
}