コード例 #1
0
ファイル: Effect.cpp プロジェクト: inaenomaki/Descape
Effect_Death_Boss::Effect_Death_Boss(double *ix, double *iy) :
	Interface_Effect(ix, iy)
{
	time_by_gene = 0;
	InitMap();

}
コード例 #2
0
ファイル: wave.c プロジェクト: Distrotech/mesa-demos
int main(int argc, char **argv)
{
    GLenum type;

    glutInit(&argc, argv);

    if (Args(argc, argv) == GL_FALSE) {
	exit(1);
    }

    glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);

    type = GLUT_DEPTH;
    type |= (rgb) ? GLUT_RGB : GLUT_INDEX;
    type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
    glutInitDisplayMode(type);

    if (glutCreateWindow("Wave Demo") == GL_FALSE) {
	exit(1);
    }

    InitMap();

    Init();

    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Animate);
    glutIdleFunc(glut_post_redisplay_p);
    glutMainLoop();
	return 0;
}
コード例 #3
0
ファイル: Full.cpp プロジェクト: staylo/XCSoar
lua_State *
Lua::NewFullState()
{
  lua_State *L = NewBasicState();

  InitLog(L);
  InitPersistent(L);
  InitTimer(L);
  InitMap(L);
  InitBlackboard(L);
  InitDialogs(L);
  InitLegacy(L);
  InitAirspace(L);
  InitTask(L);
  InitSettings(L);
  InitWind(L);
  InitLogger(L);
  InitTracking(L);
  InitReplay(L);
  InitInputEvent(L);

  {
    SetPackagePath(L,
                   WideToUTF8Converter(LocalPath(_T("lua" DIR_SEPARATOR_S "?.lua")).c_str()));
  }

  return L;
}
コード例 #4
0
ファイル: Effect.cpp プロジェクト: inaenomaki/Descape
Effect_Vanish_EnemyBullet::Effect_Vanish_EnemyBullet(double *ix, double *iy) :
	Interface_Effect(ix, iy)
{
	time_by_gene = 0;
	InitMap();

}
コード例 #5
0
ファイル: Effect.cpp プロジェクト: inaenomaki/Descape
Effect_Death_Player::Effect_Death_Player(double *ix, double *iy) :
	Interface_Effect(ix, iy)
{
	time_by_gene = 0;
	draw_gra_num_map[myGraphic::get().PlayerDeathEffectAGra] = 6;
	InitMap();
}
コード例 #6
0
ファイル: font.c プロジェクト: BackupTheBerlios/dri-ex-svn
int main(int argc, char **argv)
{
    glutInit(&argc, argv);

    if (Args(argc, argv) == GL_FALSE) {
	exit(1);
    }

    glutInitWindowPosition(0, 0); glutInitWindowSize( 800, 400);

    windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
    windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
    glutInitDisplayMode(windType);

    if (glutCreateWindow("Font Test") == GL_FALSE) {
	exit(1);
    }

    InitMap();

    Init();

    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutSpecialFunc(Key2);
    glutDisplayFunc(Draw);
    glutMainLoop();
	return 0;
}
コード例 #7
0
ファイル: Effect.cpp プロジェクト: inaenomaki/Descape
Effect_Rejection_Residuum::Effect_Rejection_Residuum(double *ix, double *iy) :
	Interface_Effect(ix, iy)
{
	time_by_gene = 0;
	draw_graphic_order = 0;//tmp:*****:updateを通らずにdrawに行くところがある?のでそこでバグを起こさないよう初期化
	InitMap();
}
コード例 #8
0
ファイル: line.cpp プロジェクト: OS2World/DEV-SAMPLES-MESA3D
//int main(int argc, char **argv)
int maininit(int argc, char** argv)
{
    printf("Press Esc, 1,2, W or w\n"); fflush(stdout);

    glutInit(&argc, argv);

    if (Args(argc, argv) == GL_FALSE) {
       exit(1);
    }

    glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);

    windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
    windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
    glutInitDisplayMode(windType);

    if (glutCreateWindow("Line Test") == GL_FALSE) {
       exit(1);
    }

    InitMap();

    Init();

    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Draw);
    glutMainLoop();
       return 0;
}
コード例 #9
0
ファイル: Effect.cpp プロジェクト: inaenomaki/Descape
Effect_Pb_hit_to_E::Effect_Pb_hit_to_E(double *ix, double *iy) :
	Interface_Effect(ix, iy)
{
	time_by_gene = 0;
	InitMap();

}
コード例 #10
0
ファイル: WinRect.cpp プロジェクト: Oldes/npp-community
//////////////////
// Initialize map: set up all the next/prev pointers. This converts the
// linear array to a more convenient linked list. Called from END_WINDOW_MAP.
//
WINRECT* WINRECT::InitMap(WINRECT* pWinMap, WINRECT* parent)
{
	assert(pWinMap);

	WINRECT* pwrc = pWinMap;  // current table entry
	WINRECT* prev = NULL;	  // previous entry starts out none

	while (!pwrc->IsEndGroup()) {
		pwrc->prev=prev;
		pwrc->next=NULL;
		if (prev)
			prev->next = pwrc;
		prev = pwrc;
		if (pwrc->IsGroup()) {
			pwrc = InitMap(pwrc+1,pwrc); // recurse! Returns end-of-grp
			assert(pwrc->IsEndGroup());
		}
		pwrc++;
	}
	// safety checks
	assert(pwrc->IsEndGroup());
	assert(prev);
	assert(prev->next==NULL);
	return parent ? pwrc : NULL;
}
コード例 #11
0
ファイル: Effect.cpp プロジェクト: inaenomaki/Descape
Effect_Rejection_Player::Effect_Rejection_Player(double *ix, double *iy) :
	Interface_Effect(ix, iy)
{
	time_by_gene = 0;
	draw_graphic_order = 0;
	InitMap();
}
コード例 #12
0
ファイル: tranbase.cpp プロジェクト: vagabond1132/Code
TranBase::TranBase()
{
    pMsg8583recv = NULL;
    pTrasferData=new TRASFER_DATA;
    memset(cFlow,0,sizeof(cFlow));
    lTradeKey=0;
    InitMap();
    pCV=iconv_open("UTF-8","GBK");

}
コード例 #13
0
ファイル: BitPieceMap.cpp プロジェクト: Zhouxiaoqing/bitwave
 BitPieceMap::BitPieceMap(std::size_t piece_count)
     : RefCount(true),
       piece_map_(0),
       map_size_(0)
 {
     assert(piece_count > 0);
     map_size_ = static_cast<std::size_t>(
         ceil(static_cast<double>(piece_count) / 8));
     InitMap();
 }
コード例 #14
0
ファイル: init.c プロジェクト: fangcaihau/FTL1
int InitDram(struct ftlInfo *ftl){

	ftl->dram = (struct dramInfo *)malloc(sizeof(struct dramInfo));
	AllocAssert(ftl->dram,"ftl->dram");
	memset(ftl->dram,0,sizeof(struct dramInfo));

	ftl->dram->dram_capacity =  ftl->parameter->dram_capacity;
	InitBuffer(ftl->dram,ftl);	
	InitMap(ftl->dram,ftl);

	return XST_SUCCESS;
}
コード例 #15
0
ファイル: map.cpp プロジェクト: Jojendersie/Lightingbolt
	Map::Map(int _width, int _height)
	{
		m_width = _width;
		m_height = _height;

		m_densityMap = new float[_width*_height];
		
		m_player = new Ai::GameObject(Math::Vec2(0.0,0.0),0.3f,this);
		m_player->setShape(0,0,0);
		m_player->setMaterialIndex(0);
		//m_player->setAlive(true);
		InitMap();
	}
コード例 #16
0
void SwapOperation(INT32T count){
	INT32T newEnergy, oldEnergy;
	InitMap();
	BuildMap();
	InitLabel();
	newEnergy = ComputeEnergy();
	oldEnergy = newEnergy + 1;
	while ((oldEnergy != newEnergy) && (count-- > 0)){
		oldEnergy = newEnergy;
		AlphaBetaSwap();
		newEnergy = ComputeEnergy();
	}
}
コード例 #17
0
ファイル: action_main.cpp プロジェクト: f3yagi/mysrc
enum ActionMenu StageMain(int *stageState, char *mapName)
{
    static int bgm = - 1;
    static char name[MAX_PATH];
    
    switch (*stageState) {
    case 0:
        map = ReadMap(mapName);
#if !MAP_EDIT_MODE
        GetBgmName(name, mapName);
        bgm = LoadSound(name);
#endif        
        *stageState = 1;
        break;

    case 1:
        {
            InitMap(map);
            CreateObject(map);
            DrawMain = StageDraw;
            LoopSound(bgm);
            *stageState = 2;
        }
        break;

    case 2:
            MoveMap(map);
            MoveEnemy(map);
            MoveItem(map);
            MoveBomb(map);
            MoveEnemy(map);
            MovePlayer(map);
            if (IsPlayerDie()) {
                SoundPlay(res.sound_die);
                life--;
                if (life < 0) {
                    FreeStage(map, stageState, bgm);
                    return MENU_GAMEOVER;
                }
                *stageState = 1;
            }
            if (IsPlayerClear()) {
                FreeStage(map, stageState, bgm);
                return MENU_CLEAR;
            }
            break;
    }
    return MENU_STAGE;
}
コード例 #18
0
void TestMaxflow(){
	InitMap();
	N = 6;
	source = 0;
	sink = N - 1;
	AddEdge(source, 1, 100, 0);
	AddEdge(1, 2, 110, 0);
	AddEdge(2, sink, 20, 0);
	AddEdge(source, 3, 30, 0);
	AddEdge(3, 4, 200, 0);
	AddEdge(4, sink, 201, 0);
	AddEdge(2, 4, 11, 0);
	AddEdge(4, 2, 30, 0);
	Maxflow();
}
コード例 #19
0
ファイル: Effect.cpp プロジェクト: inaenomaki/Descape
Effect_Graze_Player::Effect_Graze_Player(double *ix, double *iy) :
	Interface_Effect(ix, iy)
{
	//tmp:**:マジックナンバー多すぎ
	time_by_gene = 0;
	InitMap();
	angle_by_player = GetRand(360) * (DX_PI / 180.0);
	angle_self = GetRand(360) * (DX_PI / 180.0);
	exrate = gamemanager::get().player_obj.graze_combo_num / 30;

	if (exrate_max <= exrate) {
		exrate = exrate_max;


	}

}
コード例 #20
0
ファイル: WorldMap.C プロジェクト: alcap-org/AlcapDAQ
//__________________________________________________________________________
WorldMap::WorldMap(const char* picName)
{
   //

   fMain = new TGMainFrame(gClient->GetRoot(), 750, 420);

   fImageMap = new TGImageMap(fMain, picName);
   fMain->AddFrame(fImageMap);
   fMain->SetWindowName(GetTitle().Data());
   fMain->SetIconName("World Map");

   TGDimension size = fMain->GetDefaultSize();
   fMain->Resize(size);
   fMain->MapSubwindows();
   InitMap();

   fImageMap->Connect("RegionClicked(Int_t)", "WorldMap", this, "PrintCode(Int_t)");
}
コード例 #21
0
ファイル: Game.c プロジェクト: cryptarch/zombies
game CreateGame() {
    game G = NULL;
    G = malloc(sizeof(Game));
    if(G) {
        G->print = CursesPrint;
        G->pc = NULL;
        G->ZombieListHead = NULL;
        G->win = NULL;
        int y, x;
        getmaxyx(stdscr, y, x );
        G->win = newwin( y, x, 0, 0 );
        G->arena = NULL;
        int status_height = 0;
        G->arena = CreateSubwindow(G->win, y-status_height, x, 0, 0 );
        G->status = NULL;
        G->status = CreateSubwindow(G->win, status_height, x, y-status_height, 0 );
        G->gameMap = CreateMap(G);
        InitMap(G->gameMap);
        return G;
    } else {
        fprintf( L, "Fatal error: failed to assign memory in CreateGame().\n" );
        exit(EXIT_FAILURE);
    }
}
コード例 #22
0
void DungeonGenerator::GenerateDungeon(Display &MainDisplay)
{
	currentRegion = -1;

	m_GroundImage = al_load_bitmap("GroundTile.jpg");

	m_Dungeon.resize(cm_DungeonWidth, std::vector<TILE>(cm_DungeonHeight, Wall));
	m_Regions.resize(cm_DungeonWidth, std::vector<int>(cm_DungeonHeight, currentRegion));
	
	AddRooms();

	for (int x = 1; x < cm_DungeonWidth; x += 2)
	{
		for (int y = 1; y < cm_DungeonHeight; y += 2)
		{
			if (Get_Tile(Vec2i(x, y)) != Wall)
			{
				continue;
			}
			
			GrowMaze(Vec2i(x,y));
		}
	}

	connectRegions();

	RemoveDeadEnds();

	//PrintCurrentMap();

	SetStartPosition();

	InitMap(MainDisplay);
	
	//MultiplyDungeon(2);
}
コード例 #23
0
ファイル: HERest.c プロジェクト: BackupTheBerlios/artbody-svn
/* SetConfParms: set conf parms relevant to HCompV  */

void SetConfParms(void)

{

   int i;

   Boolean b;

   double f;

   char buf[MAXSTRLEN];

   

   nParm = GetConfig("HEREST", TRUE, cParm, MAXGLOBS);

   if (nParm>0) {

      if (GetConfInt(cParm,nParm,"TRACE",&i)) trace = i;

      if (GetConfFlt(cParm,nParm,"VARFLOORPERCENTILE",&f)) varFloorPercent = f;

      if (GetConfBool(cParm,nParm,"SAVEBINARY",&b)) saveBinary = b;

      if (GetConfBool(cParm,nParm,"BINARYACCFORMAT",&b)) ldBinary = b;

      /* 2-model reestimation alignment model set */

      if (GetConfStr(cParm,nParm,"ALIGNMODELMMF",buf)) {

          strcpy(al_hmmMMF,buf); al_hmmUsed = TRUE;

      }

      if (GetConfStr(cParm,nParm,"ALIGNHMMLIST",buf)) {

          strcpy(al_hmmLst,buf); al_hmmUsed = TRUE;

      }

      /* allow multiple individual model files */

      if (GetConfStr(cParm,nParm,"ALIGNMODELDIR",buf)) {

          strcpy(al_hmmDir,buf); al_hmmUsed = TRUE;

      }

      if (GetConfStr(cParm,nParm,"ALIGNMODELEXT",buf)) {

          strcpy(al_hmmExt,buf); al_hmmUsed = TRUE;

      }

      if (GetConfStr(cParm,nParm,"ALIGNXFORMEXT",buf)) {

         xfInfo.alXFormExt = CopyString(&hmmStack,buf);

      }

      if (GetConfStr(cParm,nParm,"ALIGNXFORMDIR",buf)) {

         xfInfo.alXFormDir = CopyString(&hmmStack,buf);

      }

      if (GetConfStr(cParm,nParm,"INXFORMMASK",buf)) {

         xfInfo.inSpkrPat = CopyString(&hmmStack,buf);

      }

      if (GetConfStr(cParm,nParm,"PAXFORMMASK",buf)) {

         xfInfo.paSpkrPat = CopyString(&hmmStack,buf);

      }

      if (GetConfStr(cParm,nParm,"LABFILEMASK",buf)) {

         labFileMask = (char*)malloc(strlen(buf)+1); 

         strcpy(labFileMask, buf);

      }



      if (GetConfStr(cParm,nParm,"UPDATEMODE",buf)) {

         if (!strcmp (buf, "DUMP")) updateMode = UPMODE_DUMP;

         else if (!strcmp (buf, "UPDATE")) updateMode = UPMODE_UPDATE;

         else if (!strcmp (buf, "BOTH")) updateMode = UPMODE_BOTH;

         else HError(2319, "Unknown UPDATEMODE specified (must be DUMP, UPDATE or BOTH)");

      }

   }

}



void ReportUsage(void)

{

   printf("\nUSAGE: HERest [options] hmmList dataFiles...\n\n");

   printf(" Option                                       Default\n\n");

   printf(" -a      Use an input linear transform        off\n");

   printf(" -c f    Mixture pruning threshold            10.0\n");

   printf(" -d s    dir to find hmm definitions          current\n");

   printf(" -h s    set output speaker name pattern   *.%%%%%%\n");

   printf("         to s, optionally set input and parent patterns\n");

   printf(" -l N    set max files per speaker            off\n");

   printf(" -m N    set min examples needed per model    3\n");

   printf(" -o s    extension for new hmm files          as src\n");

   printf(" -p N    set parallel mode to N               off\n");

   printf(" -r      Enable Single Pass Training...       \n");

   printf("         ...using two parameterisations       off\n");

   printf(" -s s    print statistics to file s           off\n");

   printf(" -t f [i l] set pruning to f [inc limit]      inf\n");

   printf(" -u tmvwap  update t)rans m)eans v)ars w)ghts tmvw\n");

   printf("                a)daptation xform p)rior used     \n");

   printf("                s)semi-tied xform                 \n");

   printf(" -v f    set minimum variance to f            0.0\n");

   printf(" -w f    set mix weight floor to f*MINMIX     0.0\n");

   printf(" -x s    extension for hmm files              none\n");

   printf(" -z s    Save all xforms to TMF file s        TMF\n");

   PrintStdOpts("BEFGHIJKLMSTX");

   printf("\n\n");

}



void SetuFlags(void)

{

   char *s;

   

   s=GetStrArg();

   uFlags=(UPDSet) 0;        

   while (*s != '\0')

      switch (*s++) {

      case 't': uFlags = (UPDSet) (uFlags+UPTRANS); break;

      case 'm': uFlags = (UPDSet) (uFlags+UPMEANS); break;

      case 'v': uFlags = (UPDSet) (uFlags+UPVARS); break;

      case 'w': uFlags = (UPDSet) (uFlags+UPMIXES); break;

      case 's': uFlags = (UPDSet) (uFlags+UPSEMIT); break;

      case 'a': uFlags = (UPDSet) (uFlags+UPXFORM); break;

      case 'p': uFlags = (UPDSet) (uFlags+UPMAP); break;

      default: HError(2320,"SetuFlags: Unknown update flag %c",*s);

         break;

      }

}



/* ScriptWord: return next word from script */

char *ScriptWord(FILE *script, char *scriptBuf)

{

   int ch,qch,i;

   

   i=0; ch=' ';

   while (isspace(ch)) ch = fgetc(script);

   if (ch==EOF) {

      scriptBuf=NULL;

      return NULL;

   }

   if (ch=='\'' || ch=='"'){

      qch = ch;

      ch = fgetc(script);

      while (ch != qch && ch != EOF) {

         scriptBuf[i++] = ch; 

         ch = fgetc(script);

      }

      if (ch==EOF)

         HError(5051,"ScriptWord: Closing quote missing in script file");

   } else {

      do {

         scriptBuf[i++] = ch; 

         ch = fgetc(script);

      }while (!isspace(ch) && ch != EOF);

   }

   scriptBuf[i] = '\0';



   return scriptBuf;

}



void CheckUpdateSetUp()

{

  AdaptXForm *xf;
コード例 #24
0
ファイル: scene.cpp プロジェクト: AdrienTD/wkbre
void InitScene()
{
	InitMap(); //InitMeshDrawing();
	//meshvsh = LoadVertexShader("mesh.vsh");
	CreateIdentityMatrix(&mIdentity);
}
コード例 #25
0
TwoAStrategy::TwoAStrategy()
	:ControlStrategy()
{
	InitMap();
}
コード例 #26
0
ファイル: CubeGame.cpp プロジェクト: mikesimb/cubes
CCubeGame::CCubeGame() :
m_Current_Cubeitem_ColNum(0),
m_Current_Cubeitem_RowNum(0)
{
	InitMap();
}
コード例 #27
0
ファイル: HMGenS.c プロジェクト: nlphacker/OpenSpeech
int main(int argc, char *argv[])
{
   char *s;
   char *labfn;
   int numUtt;

   void Initialise(void);
   void DoGeneration(char *labfn);

   if (InitShell(argc, argv, hmgens_version, hmgens_vc_id) < SUCCESS)
      HError(2300, "HMGenS: InitShell failed");
   InitMem();
   InitMath();
   InitSigP();
   InitWave();
   InitLabel();
   InitModel();
   if (InitParm() < SUCCESS)
      HError(2300, "HMGenS: InitParm failed");
   InitUtil();
   InitFB();
   InitAdapt(&xfInfo_hmm, &xfInfo_dur);
   InitMap();
   InitGen();

   if (NumArgs() == 0)
      ReportUsage();

   CreateHeap(&genStack, "genStore", MSTAK, 1, 1.0, 80000, 400000);
   CreateHeap(&uttStack, "uttStore", MSTAK, 1, 0.5, 100, 1000);
   CreateHeap(&fbInfoStack, "FBInfoStore", MSTAK, 1, 0.5, 100, 1000);
   CreateHeap(&hmmStack, "HmmStore", MSTAK, 1, 1.0, 50000, 500000);
   CreateHeap(&dmStack, "dmStore", MSTAK, 1, 1.0, 50000, 500000);
   SetConfParms();
   CreateHMMSet(&hmset, &hmmStack, TRUE);
   CreateHMMSet(&dmset, &dmStack, TRUE);

   utt = (UttInfo *) New(&uttStack, sizeof(UttInfo));
   genInfo = (GenInfo *) New(&genStack, sizeof(GenInfo));
   fbInfo = (FBInfo *) New(&fbInfoStack, sizeof(FBInfo));

   while (NextArg() == SWITCHARG) {
      s = GetSwtArg();
      if (strlen(s) != 1)
         HError(9919, "HMGenS: Bad switch %s; must be single letter", s);
      switch (s[0]) {
      case 'a':
         xfInfo_hmm.useInXForm = TRUE;
         break;
      case 'b':
         xfInfo_dur.useInXForm = TRUE;
         break;
      case 'c':
         if (NextArg() != INTARG)
            HError(2119, "HMGenS: Parameter generation algorithm type value expected");
         type = (ParmGenType) GetChkedInt(CHOLESKY, FB, s);
         break;
      case 'd':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: HMM definition directory expected");
         hmmDir = GetStrArg();
         break;
      case 'e':
         useAlign = TRUE;
         break;
      case 'f':
         frameRate = (HTime) GetChkedFlt(0.0, 10000000.0, s);
         break;
      case 'g':
         minFrwdP = GetChkedFlt(0.0, 1000.0, s);
         break;
      case 'h':
         if (NextArg() != STRINGARG)
            HError(1, "Speaker name pattern expected");
         xfInfo_hmm.inSpkrPat = xfInfo_dur.inSpkrPat = GetStrArg();
         if (NextArg() == STRINGARG)
            xfInfo_hmm.paSpkrPat = xfInfo_dur.paSpkrPat = GetStrArg();
         if (NextArg() != SWITCHARG)
            HError(2319, "HMGenS: cannot have -h as the last option");
         break;
      case 'm':
         modelAlign = TRUE;
         break;
      case 'n':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: duration model definition directory expected");
         dmDir = GetStrArg();
         break;
      case 'p':
         outPdf = TRUE;
         break;
      case 'r':
         if (NextArg() != FLOATARG)
            HError(2119, "HMGenS: Speaking rate value (float) expected");
         speakRate = GetChkedFlt(0.0, 3.0, s);
         break;
      case 's':
         stateAlign = TRUE;
         break;
      case 't':
         pruneInit = GetChkedFlt(0.0, 1.0E20, s);
         if (NextArg() == FLOATARG || NextArg() == INTARG) {
            pruneInc = GetChkedFlt(0.0, 1.0E20, s);
            pruneLim = GetChkedFlt(0.0, 1.0E20, s);
         } else {
            pruneInc = 0.0;
            pruneLim = pruneInit;
         }
         break;
      case 'v':
         MSDthresh = GetChkedFlt(0.0, 1.0, s);
         break;
      case 'x':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: HMM file extension expected");
         hmmExt = GetStrArg();
         break;
      case 'y':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: duration model file extension expected");
         dmExt = GetStrArg();
         break;
      case 'B':
         inBinary = TRUE;
         break;
      case 'E':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: parent transform directory expected");
         xfInfo_hmm.usePaXForm = TRUE;
         xfInfo_hmm.paXFormDir = GetStrArg();
         if (NextArg() == STRINGARG)
            xfInfo_hmm.paXFormExt = GetStrArg();
         if (NextArg() != SWITCHARG)
            HError(2319, "HMGenS: cannot have -E as the last option");
         break;
      case 'G':
         if (NextArg() != STRINGARG)
            HError(2119, "HMGenS: Label File format expected");
         if ((lff = Str2Format(GetStrArg())) == ALIEN)
            HError(-2189, "HMGenS: Warning ALIEN Label file format set");
         break;
      case 'H':
         if (NextArg() != STRINGARG)
            HError(3219, "HMGenS: HMM MMF File name expected");
         AddMMF(&hmset, GetStrArg());
         break;
      case 'I':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: MLF file name expected");
         LoadMasterFile(GetStrArg());
         break;
      case 'J':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: input transform directory expected");
         AddInXFormDir(&hmset, GetStrArg());
         if (NextArg() == STRINGARG)
            xfInfo_hmm.inXFormExt = GetStrArg();
         if (NextArg() != SWITCHARG)
            HError(2319, "HMGenS: cannot have -J as the last option");
         break;
      case 'L':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: Label file directory expected");
         labDir = GetStrArg();
         break;
      case 'M':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: Output macro file directory expected");
         genDir = GetStrArg();
         break;
      case 'N':
         if (NextArg() != STRINGARG)
            HError(3219, "HMGenS: Duration MMF File name expected");
         AddMMF(&dmset, GetStrArg());
         break;
      case 'T':
         if (NextArg() != INTARG)
            HError(2119, "HMGenS: Trace value expected");
         trace = GetChkedInt(0, 0002, s);
         break;
      case 'W':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: parent duration transform directory expected");
         xfInfo_dur.usePaXForm = TRUE;
         xfInfo_dur.paXFormDir = GetStrArg();
         if (NextArg() == STRINGARG)
            xfInfo_dur.paXFormExt = GetStrArg();
         if (NextArg() != SWITCHARG)
            HError(2319, "HMGenS: cannot have -W as the last option");
         break;
      case 'X':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: Label file extension expected");
         labExt = GetStrArg();
         break;
      case 'Y':
         if (NextArg() != STRINGARG)
            HError(2319, "HMGenS: input duration transform directory expected");
         AddInXFormDir(&dmset, GetStrArg());
         if (NextArg() == STRINGARG) {
            if (xfInfo_dur.inXFormExt == NULL)
               xfInfo_dur.inXFormExt = GetStrArg();
            else
               HError(2319, "MGenS: only one input duration transform extension may be specified");
         }
         if (NextArg() != SWITCHARG)
            HError(2319, "HMGenS: cannot have -Y as the last option");
         break;
      default:
         HError(9919, "HMGenS: Unknown switch %s", s);
      }
   }
   if (NextArg() != STRINGARG)
      HError(2319, "HMGenS: file name of vocabulary list expected");

   Initialise();
   InitUttInfo(utt, FALSE);
   numUtt = 1;

   if (trace & T_TOP)
      SetTraceGen();

   /* generate parameter sequences */
   do {
      if (NextArg() != STRINGARG)
         HError(2319, "HMGenS: data file name expected");
      labfn = GetStrArg();

      /* track speakers */
      if (UpdateSpkrStats(&hmset, &xfInfo_hmm, labfn)) {
         if (!xfInfo_hmm.useInXForm)
            xfInfo_hmm.inXForm = NULL;
      }
      if (UpdateSpkrStats(&dmset, &xfInfo_dur, labfn)) {
         if (!xfInfo_dur.useInXForm)
            xfInfo_dur.inXForm = NULL;
         else
            ResetDMMPreComps(&dmset);
      }

      fbInfo->xfinfo_hmm = &xfInfo_hmm;
      fbInfo->xfinfo_dur = &xfInfo_dur;
      fbInfo->inXForm_hmm = xfInfo_hmm.inXForm;
      fbInfo->inXForm_dur = xfInfo_dur.inXForm;
      fbInfo->al_inXForm_hmm = xfInfo_hmm.al_inXForm;
      fbInfo->al_inXForm_dur = xfInfo_dur.al_inXForm;
      fbInfo->paXForm_hmm = xfInfo_hmm.paXForm;
      fbInfo->paXForm_dur = xfInfo_dur.paXForm;

      /* generate parameters */
      DoGeneration(labfn);
      numUtt++;
   } while (NumArgs() > 0);

   if (trace & T_TOP) {
      printf("Generation complete - average log prob per frame = %e (%d frames)\n", totalPr / totalT, totalT);
   }

   /* Reset stacks */
   Dispose(&fbInfoStack, fbInfo);
   Dispose(&genStack, genInfo);
   Dispose(&uttStack, utt);
   ResetHeap(&fbInfoStack);
   ResetHeap(&uttStack);
   ResetHeap(&genStack);
   ResetHeap(&dmStack);
   ResetHeap(&hmmStack);

   /* Reset modules */
   ResetGen();
   ResetAdapt(&xfInfo_hmm, &xfInfo_dur);
   ResetFB();
   ResetUtil();
   ResetParm();
   ResetModel();
   ResetLabel();
   ResetWave();
   ResetSigP();
   ResetMath();
   ResetMem();
   ResetShell();

   Exit(0);
   return (0);                  /* never reached -- make compiler happy */
}
コード例 #28
0
ThreeBStrategy::ThreeBStrategy()
	:ControlStrategy()
{
	InitMap();
}
コード例 #29
0
ファイル: game.c プロジェクト: maimaris/arduino-2
void Task_Game (void)
{
    static      char    s_cKeys;        // Keyboard command
    static      char    s_cLastKeys = 0;// Previous command
    static      bit     bButton;        // Fire button state

    static near char    x, y, yy, xx;

                char    A,          // Object at porition X
                        B;          // Object style for A. These styles are calculated
                                    // once per cycle, to increase speed of GameStep
                char    A_top,      // Object above A
                        A_bottom,   // Object under A
                        A_move,     // Object at position where A wants move to.
        
                        B_top,      
                        B_bottom, 
                        B_move;

    static near char    s_cAction;  // Action performing on moving object

    static      bit     bDirChanged;// Addition flag for fireflies and butterflies
                                    // to change direction of moving
    static      bit     bBangJewel; // This bit tells that jewel should appear after bang
    static near char    s_cSound;   // Sound type on current stage

    static near char    n,m;        // addition temp variables
    static near char    temp;
    


    //for (;;)
    {
        OS_Bsem_Set(BS_MAP_FREE);       // Free "Map" resource

        OS_Flag_Wait_11(i_cStep, 0x08); // Run every eight VGA-cadr
        OS_Flag_Set_0(i_cStep, 0x08);

        OS_Bsem_Wait(BS_MAP_FREE);      // Wait for resource "Map" became free
        
        s_cKeys = 0;
        bButton = 0;


        //------------------------------------------------------------------------------
        // All button pressed: Restart level
        //------------------------------------------------------------------------------
    
        if (BUTTON_UP && BUTTON_LEFT && BUTTON_RIGHT && BUTTON_DOWN) 
        {    
            if (m_bAlive)
            {
                m_bAlive = false;
                m_bEnd = true;
                m_Map[m_cManY][m_cManX] = OBJECT_BANG;
                str_cpy(m_strStatusBar, STR_GAME_OVER);
            }    
        }
        
        //------------------------------------------------------------------------------
        //  Fire button after dead - reborn
        //------------------------------------------------------------------------------

        if (BUTTON_FIRE && m_bEnd) 
        {
            if (BUTTON_UP && BUTTON_LEFT && BUTTON_RIGHT && BUTTON_DOWN) 
            {    
                m_cCurMap++;
                if (m_cCurMap >= NUMBER_OF_MAPS) m_cCurMap = 0;
                InitMap(m_cCurMap);
            }
            if (!BUTTON_UP && !BUTTON_LEFT && !BUTTON_RIGHT && !BUTTON_DOWN) InitMap(m_cCurMap);
            
        }



        //------------------------------------------------------------------------------
        //  When man alive, check keyoard and make the man run
        //------------------------------------------------------------------------------
        
        if (m_bAlive)
        {
            OS_Bsem_Set(BS_MUSIC_START);            // First time music can start only
                                                    // after born
            
            if (BUTTON_UP)     s_cKeys = 1;
            if (BUTTON_DOWN)   s_cKeys = 2;
            if (BUTTON_LEFT)   s_cKeys = 3;
            if (BUTTON_RIGHT)  s_cKeys = 4;
            if (BUTTON_FIRE)   bButton = 1;
            

            // Select man picture: standing, running left, running right
            temp = 0;
            switch (s_cKeys & 0xF)
            {
                case 0:     
                    temp = OBJECT_MAN | (((i_wRandom & 7) == 7)?1:0);    
                    break;
                case 1:     
                    if (s_cLastKeys != s_cKeys) temp = OBJECT_LEFT_MAN  | MOVING | DIR_UP;
                    break; 

                case 2:     
                    if (s_cLastKeys != s_cKeys) temp = OBJECT_RIGHT_MAN | MOVING | DIR_DOWN; 
                    break;

                case 3:     
                    if (s_cLastKeys != s_cKeys) temp = OBJECT_LEFT_MAN  | MOVING | DIR_LEFT; 
                    break;

                case 4:     
                    if (s_cLastKeys != s_cKeys) temp = OBJECT_RIGHT_MAN | MOVING | DIR_RIGHT;
                    break;
            }

            if (temp) SetMap(m_cManY, m_cManX, temp);

        } else {            // Man is not born yet
            m_cBornTimer--;
        }

        s_cLastKeys = s_cKeys;   


        //------------------------------------------------------------------------------
        //  Make window position correction
        //------------------------------------------------------------------------------
        
        if (m_bScrMovedX)
        {
            m_bScrMovedX = false;
            if (!s_cKeys) CorrectWindowPositionX(5);
        }

        if (m_bScrMovedY)
        {
            m_bScrMovedY = false;
            if (!s_cKeys) CorrectWindowPositionY(4);
        }

        OS_Yield();

        s_cSound = 0;

        //------------------------------------------------------------------------------
        //  Check all elements in map
        //------------------------------------------------------------------------------

        for (y = 18; y > 0; y--)
        {    
            OS_Yield();

            for (x = 38; x > 0; x--)
            {
                
                CLRWDT();
                bDirChanged = false;
                bBangJewel = false;
                
            RETRY:
                A        = GetMap(y, x);

                if (A == (OBJECT_SPACE | 0x80)) // When object SPACE have bit 7 set, 
                {                               // nither boulder nor jewel can fall here
                    SetMap(y,x, OBJECT_SPACE);  // This state of SPACE can be active 
                    continue;                   // per one game step only.
                }
                if (A == OBJECT_SPACE) continue;
                if (A == OBJECT_WALL) continue;
                if (A == OBJECT_DIRT) continue;

                B        = Object(A);

                //******************************************************************************
                if (A & MOVING)         // Check moving object
                //******************************************************************************
                {
                    xx = x;             // Calculate position to move to
                    yy = y;
                    switch (A & DIR_MASK)
                    {
                        //------------------------------------------------------------------------------
                        case DIR_UP: 
                        //------------------------------------------------------------------------------
                            yy--;
                            break;

                        //------------------------------------------------------------------------------
                        case DIR_DOWN: 
                        //------------------------------------------------------------------------------
                            yy++;
                            break;

                        //------------------------------------------------------------------------------
                        case DIR_LEFT: 
                        //------------------------------------------------------------------------------
                            xx--;
                            break;

                        //------------------------------------------------------------------------------
                        case DIR_RIGHT: 
                        //------------------------------------------------------------------------------
                            xx++;
                            break;
                    }

                    // Point where object moves to
                    A_move = GetMap(yy, xx);    
                    B_move = Object(A_move);
                        
                    //**************************************************************************
                    //  Check what the action should we do
                    //**************************************************************************
                    
                    s_cAction = ACTION_NO_ACTION;

                    switch (B)
                    {
                    //------------------------------------------------------------------------------
                    case OBJECT_MAN:        // man
                    case OBJECT_MAN_EYES:   // man
                    case OBJECT_LEFT_MAN:   // man
                    case OBJECT_RIGHT_MAN:  // man

                        //------------------------------------------------------------------------------
                        //  Check for push boulder
                        //------------------------------------------------------------------------------
                        if (B_move == OBJECT_BOULDER)
                        {
                            if (y != yy) break;
                            if (x > xx && GetMap(y,xx-1)==OBJECT_SPACE) s_cAction = ACTION_PUSH;
                            if (x < xx && GetMap(y,xx+1)==OBJECT_SPACE) s_cAction = ACTION_PUSH;
                        }


                        if (B_move == OBJECT_TIT_WALL)
                        {      
                            // Check for HOME and there is enough jewels
                            if ((A_move & 0x80) && (m_cJewels >= m_cNeededJewels)) 
                            {    
                                s_cAction = ACTION_GO_HOME; 
                            }
                            break;
                        }

                        if (B_move == OBJECT_WALL)      s_cAction = ACTION_NO_ACTION;
                        if (B_move == OBJECT_SPACE)     s_cAction = ACTION_CAN_MOVE;
                        if (B_move == OBJECT_DIRT)      s_cAction = ACTION_EAT_DIRT;
                        if (B_move == OBJECT_BANG)      s_cAction = ACTION_NO_ACTION;
                        if (B_move == OBJECT_JEWEL)     s_cAction = ACTION_EAT_JEWEL;


                        break;

                    //------------------------------------------------------------------------------
                    case OBJECT_BUTTERFLY:
                    case OBJECT_FIREFLY:

                        //------------------------------------------------------------------------------
                        // Check for man touching
                        //------------------------------------------------------------------------------
                        
                        if (m_bAlive)
                        {
                            if ((m_cManY == y && (m_cManX == (x+1) || m_cManX == (x-1))) ||
                                (m_cManX == x && (m_cManY == (y+1) || m_cManY == (y-1))))
                            {
                                // Set bang position
                                m_cBangX = m_cManX;
                                m_cBangY = m_cManY;
                                s_cAction = ACTION_BANG;
                                if (B == OBJECT_BUTTERFLY) s_cAction = ACTION_BANG_JEWEL;
                                break;
                            }
                        }

                        if (B_move == OBJECT_SPACE) 
                        {    
                            s_cAction = ACTION_CAN_MOVE;
                            break;
                        }

                        //------------------------------------------------------------------------------
                        //  When firefly and butterfly meat face to face, they just 
                        //  replaced one by one (they should be moved in opposit directions
                        //------------------------------------------------------------------------------
                        
                        if (B_move == OBJECT_FIREFLY || B_move == OBJECT_BUTTERFLY)
                        {
                            if (B != B_move) if (((A^A_move) & DIR_MASK)==0x80) 
                            {
                                s_cAction = ACTION_EXCHANGE;
                                break;
                            }
                        }

                        //------------------------------------------------------------------------------
                        // Check for falling boulder or jewel above
                        //------------------------------------------------------------------------------
                        
                        A_top = GetMap(y-1, x);
                        B_top = A_top & 0x1F;

                        if (B_top == OBJECT_BOULDER || (B_top & 0x1C)== OBJECT_JEWEL )
                        {
                            if ((A_top & MOVING)) 
                            {    
                                s_cAction = ACTION_STOP_FLY;
                                break;
                            }
                        }
                        
                        s_cAction = ACTION_DEC_DIRECTION;
                        if (B == OBJECT_BUTTERFLY) s_cAction = ACTION_INC_DIRECTION;
                        break;

                    //------------------------------------------------------------------------------
                    case OBJECT_BOULDER:
                    case OBJECT_JEWEL:

                        m_cBangX = x;
                        m_cBangY = y + 1;
                        s_cAction = ACTION_STOP_MOVE;
                        B_bottom = Object(GetMap(y+1, x));
                        if (B_bottom == OBJECT_SPACE)     s_cAction = ACTION_CAN_MOVE;
                        if (B_bottom == OBJECT_MAN)       s_cAction = ACTION_BANG;
                        if (B_bottom == OBJECT_LEFT_MAN)  s_cAction = ACTION_BANG;
                        if (B_bottom == OBJECT_RIGHT_MAN) s_cAction = ACTION_BANG;
                        if (B_bottom == OBJECT_FIREFLY)   s_cAction = ACTION_BANG;
                        if (B_bottom == OBJECT_BUTTERFLY) s_cAction = ACTION_BANG_JEWEL;
                        break;

                    }   // switch (B)
                    

                    //******************************************************************************
                    //  Now we have a variable s_cAction which contains what should we do
                    //******************************************************************************


                    switch (s_cAction)
                    {
                        //------------------------------------------------------------------------------
                        case ACTION_NO_ACTION:  
                        //------------------------------------------------------------------------------
                            break;
                
                        //------------------------------------------------------------------------------
                        case ACTION_PUSH:
                        //------------------------------------------------------------------------------

                            if (i_wRandom & 3) break;
                            if (x > xx) SetMap(y, xx-1, OBJECT_BOULDER);
                            if (x < xx) SetMap(y, xx+1, OBJECT_BOULDER);
    
                            if (s_cSound < GAME_SOUND_PUSH) s_cSound = GAME_SOUND_PUSH;
    
                            goto MOVE;
                
                
                        //------------------------------------------------------------------------------
                        case ACTION_EAT_JEWEL:
                        //------------------------------------------------------------------------------

                            m_cJewels++;
                            if (m_cJewels == m_cNeededJewels) 
                            {    
                                m_bBlink = 1;
                                if (s_cSound < GAME_SOUND_COMPLETE) s_cSound = GAME_SOUND_COMPLETE;
                            }
                            if (s_cSound < GAME_SOUND_EAT_JEWEL) s_cSound = GAME_SOUND_EAT_JEWEL;
                            goto MOVE;
                
                        //------------------------------------------------------------------------------
                        case ACTION_GO_HOME:
                        //------------------------------------------------------------------------------

                            m_bAlive = 0;
                            m_bEnd = 1;
                            str_cpy(m_strStatusBar, STR_YOU_WIN);
                            A &= ~MOVING;
                            SetMap(y, x, A);

                            m_cCurMap++;
                            if (m_cCurMap >= NUMBER_OF_MAPS) m_cCurMap = 0;

                            if (s_cSound < GAME_SOUND_HOME) s_cSound = GAME_SOUND_HOME;
                            goto MOVE;
                    
                        
                        //------------------------------------------------------------------------------
                        case ACTION_EAT_DIRT:
                        //------------------------------------------------------------------------------
                            if (s_cSound < GAME_SOUND_EAT_DIRT) s_cSound = GAME_SOUND_EAT_DIRT;
                            goto MOVE;

                        //------------------------------------------------------------------------------
                        case ACTION_CAN_MOVE:
                        //------------------------------------------------------------------------------
                MOVE:
                            SetMap(y, x, OBJECT_SPACE);
                            
                            if (x == m_cManX && y == m_cManY) 
                            {
                                if (bButton && m_cManX==x && m_cManY==y)
                                {
                                    SetMap(yy, xx, OBJECT_SPACE);
                                    xx = x;
                                    yy = y;
                                }

                                m_cManX = xx;
                                m_cManY = yy;
                                
                                CorrectWindowPositionX(2);
                                CorrectWindowPositionY(2);
                                
                                if (s_cSound < GAME_SOUND_STEP) s_cSound = GAME_SOUND_STEP;
                            }

                            if (yy < y || xx < x) A &= ~MOVING; // To prevent multiply moving
                                                                // of same object


                            if (B == OBJECT_BUTTERFLY)  A -= 0x40;
                            if (B == OBJECT_FIREFLY)    A += 0x40;
                            SetMap(yy, xx, A);
                            break;
                
                        //------------------------------------------------------------------------------
                        case ACTION_EXCHANGE:
                        //------------------------------------------------------------------------------
                            SetMap(y, x, A_move);
                            SetMap(yy, xx, A);
                            break;
                
                        //------------------------------------------------------------------------------
                        case ACTION_INC_DIRECTION:
                        //------------------------------------------------------------------------------
                            if (!bDirChanged)
                            {
                                A += 0x40;
                                SetMap(y, x, A);
                                bDirChanged = true;
                                goto RETRY;
                            }
                            break;
                        //------------------------------------------------------------------------------
                        case ACTION_DEC_DIRECTION:
                        //------------------------------------------------------------------------------
                            if (!bDirChanged)
                            {
                                A -= 0x40;
                                SetMap(y, x, A);
                                bDirChanged = true;
                                goto RETRY;
                            }
                            break;
                    
                        //------------------------------------------------------------------------------
                        case ACTION_STOP_MOVE:
                        //------------------------------------------------------------------------------
                            A &= ~MOVING;
                            SetMap(y, x, A);
                            if (B == OBJECT_JEWEL)
                            {
                                if (s_cSound < GAME_SOUND_JEWEL_FELD) s_cSound = GAME_SOUND_JEWEL_FELD;
                            } else {
                                if (s_cSound < GAME_SOUND_BOULDER_FELD)s_cSound = GAME_SOUND_BOULDER_FELD; 
                            }
                            goto RETRY;
                    
                        //------------------------------------------------------------------------------
                        case ACTION_STOP_FLY:
                        //------------------------------------------------------------------------------
                            A &= ~MOVING;
                            SetMap(y, x, A);
                            break;
                    
                    
                        //------------------------------------------------------------------------------
                        case ACTION_BANG_JEWEL:
                        //------------------------------------------------------------------------------
                            if (s_cSound < GAME_SOUND_BANG_JEWEL) s_cSound = GAME_SOUND_BANG_JEWEL;
                            bBangJewel = true;
                            
                        //------------------------------------------------------------------------------
                        case ACTION_BANG:
                        //------------------------------------------------------------------------------
                            if (!bBangJewel) 
                                if (s_cSound < GAME_SOUND_BANG) s_cSound = GAME_SOUND_BANG;

                            for (n = m_cBangX - 1; n <= m_cBangX + 1; n++) 
                            {        
                                for (m = m_cBangY-1; m <= m_cBangY+1; m++)
                                {
                                    if (GetMap(m, n) != OBJECT_TIT_WALL)
                                    {
                                        if (n == m_cManX && m == m_cManY) 
                                        { 
                                            if (!m_bAlive) continue;   
                                            m_bAlive = 0;
                                            m_bEnd = true;
                                            str_cpy(m_strStatusBar, STR_GAME_OVER);
                                        }
                                        temp =  OBJECT_BANG;
                                        if (bBangJewel) temp |= 0x80;
                                        SetMap(m, n, temp);
                                        
                                    };
                                }
                            }    
                            break;
                    };  // switch s_cAction

                //******************************************************************************
                } else {            // not MOVING object
                //******************************************************************************

                    switch (B)
                    {
                        //------------------------------------------------------------------------------
                        case OBJECT_LEFT_MAN:   // Restore moving state to objects that should move
                        case OBJECT_RIGHT_MAN:  
                             if (!m_bAlive) break;
                        case OBJECT_BUTTERFLY:  
                        case OBJECT_FIREFLY:;   

                             m_Map[y][x] |= MOVING;
                             break;

                        //------------------------------------------------------------------------------
                        case OBJECT_BOULDER:
                        case OBJECT_JEWEL:

                            B_bottom = Object(A_bottom = GetMap(y+1, x));

                            if (B_bottom == OBJECT_SPACE)   // Check for start falling down
                             {
                                 A |= MOVING;
                                 A |= DIR_DOWN;
                                 SetMap(y, x, A);
                             } else {

                                 // Check for falling from a boulder, a jewel or a wall
                                 
                                 if ((B_bottom == OBJECT_BOULDER || 
                                      B_bottom == OBJECT_WALL || 
                                      B_bottom == OBJECT_JEWEL) && !(A_bottom & MOVING))
                                 {

                                     if (GetMap(y  ,x-1) == OBJECT_SPACE && 
                                         GetMap(y+1,x-1) == OBJECT_SPACE)
                                     {
                                         temp = Object(GetMap(y-1, x-1));
                                         // Не даем камню уйти влево, если что-то
                                         // должно падать сверху
                                         if (temp == OBJECT_BOULDER) break;
                                         if (temp == OBJECT_JEWEL)   break;
                    
                                         SetMap(y, x-1, A); // Здесь не нужно ставить флаг 
                                                            // движения, т.к. эта клетка будет
                                                            // преверена следюущим же шагом (т.к.
                                                            // просматриваем справа налево)
                                                                   
                                         SetMap(y,x, OBJECT_SPACE | 0x80);  // Признак того, что 
                                                                            // пока еще нельзя 
                                                                            // ронять сюда камень 
                                         break;
                                     }

                                     if (GetMap(y  ,x+1) == OBJECT_SPACE && 
                                         GetMap(y+1,x+1) == OBJECT_SPACE) 
                                     {
                                         temp = Object(GetMap(y-1,x+1));
                                         // Не даем камню уйти влево, если что-то
                                         // должно падать сверху
                                         if (temp == OBJECT_BOULDER) break;
                                         if (temp == OBJECT_JEWEL)   break;
                    
                                         SetMap(y,x+1, A | MOVING | DIR_DOWN);
                                         SetMap(y,x, OBJECT_SPACE | 0x80);
                                         break;
                                     }
                                 }
                             }
                             break;
                            
                        //------------------------------------------------------------------------------
                        case OBJECT_HOME:
                        case OBJECT_TIT_WALL:

                            if ((A & 0x80) && (m_cNeededJewels <= m_cJewels))
                            {
                    
                            }
                            if ((A & 0x40) && !m_cBornTimer)
                            {
                                SetMap(y,x, OBJECT_BANG | 0x40);
                                if (s_cSound < GAME_SOUND_BORN) s_cSound = GAME_SOUND_BORN;
                            }
                            break;
                    }   // switch (B)

                
                    if ((A & 0x1F) == (OBJECT_BANG | 3))    // last stage of bang
                    {
                        if (A & 0x40)           // Borning
                        {
                            A = OBJECT_MAN;
                            m_cManX = x;
                            m_cManY = y;
                            m_bAlive = 1;
                        } else {
                            if (A & 0x80)   A = OBJECT_JEWEL;   // Bang with jewels
                            else            A = OBJECT_SPACE;   // Bang without jewels
                        }
                        SetMap(y, x, A);
                    }

                //******************************************************************************
                }   // MOVING
                //******************************************************************************
            }   // for x
        }   // for y

        if (s_cSound) OS_SMsg_Send_Now(smsg_GameSound, s_cSound);
        if (m_bAlive) MakeStatusBar();
    }
}
コード例 #30
0
ファイル: HVite.c プロジェクト: 2hanson/voice_dialling
int main(int argc, char *argv[])
{
   char *s;

   void Initialise(void);
   void DoRecognition(void);
   void DoAlignment(void);

   if(InitShell(argc,argv,hvite_version,hvite_vc_id)<SUCCESS)
      HError(3200,"HVite: InitShell failed");

   InitMem();   InitLabel();
   InitMath();  InitSigP();
   InitWave();  InitAudio();
   InitVQ();    InitModel();

   if(InitParm()<SUCCESS)  
      HError(3200,"HVite: InitParm failed");

   InitDict();
   InitNet();   InitRec();
   InitUtil(); 
   InitAdapt(&xfInfo); InitMap();

   if (!InfoPrinted() && NumArgs() == 0)
      ReportUsage();
   if (NumArgs() == 0) Exit(0);

   SetConfParms();
   CreateHeap(&modelHeap, "Model heap",  MSTAK, 1, 0.0, 100000, 800000 );
   CreateHMMSet(&hset,&modelHeap,TRUE); 

   while (NextArg() == SWITCHARG) {
      s = GetSwtArg();
      if (strlen(s)!=1) 
         HError(3219,"HVite: Bad switch %s; must be single letter",s);
      switch(s[0]){
      case 'a':
         loadLabels=TRUE; break;
      case 'b':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: Utterance boundary word expected");
         bndId = GetLabId(GetStrArg(),TRUE); break;
      case 'c':
         tmBeam = GetChkedFlt(0.0,1000.0,s); break;          
      case 'd':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: HMM definition directory expected");
         hmmDir = GetStrArg(); break;
      case 'e':
         saveAudioOut=TRUE; break;
      case 'f':
         states=TRUE; break;
      case 'g':
         replay=TRUE; break;
      case 'i':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: Output MLF file name expected");
         /* if(SaveToMasterfile(GetStrArg())<SUCCESS)
            HError(3214,"HCopy: Cannot write to MLF"); */
         SaveToMasterfile(GetStrArg());
         break;
      case 'k':
	 xfInfo.useInXForm = TRUE;
	 break;
      case 'j':
         if (NextArg()!=INTARG)
            HError(3219,"HVite: No. of files per online adaptation step expected");
         update = GetChkedInt(1,256,s);
         break;
      case 'l':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: Label file directory expected");
         labDir = GetStrArg(); break;
      case 'm':
         models=TRUE; break;
      case 'n':
         nToks = GetChkedInt(2,MAX_TOKS,s);
         if (NextArg()==FLOATARG || NextArg()==INTARG)
            nTrans = GetChkedInt(1,10000,s);
         else
            nTrans = 1;
         break;      
      case 'o':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: Output label format expected");
         labForm = GetStrArg(); break;
      case 'p':
         wordPen = GetChkedFlt(-1000.0,1000.0,s);  break;
      case 'q':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: Output lattice format expected");
         latForm = GetStrArg(); break;
      case 'r':
         prScale = GetChkedFlt(0.0,1000.0,s);  break;
      case 's':
         lmScale = GetChkedFlt(0.0,1000.0,s);  break;
      case 't':
         genBeam = GetChkedFlt(0,1.0E20,s); 
	 if (genBeam == 0.0)
	    genBeam = -LZERO;
         if (NextArg()==FLOATARG || NextArg()==INTARG) {
             genBeamInc = GetChkedFlt(0.0,1.0E20,s);
             genBeamLim = GetChkedFlt(0.0,1.0E20,s);
             if (genBeamLim < (genBeam + genBeamInc)) {
                genBeamLim = genBeam; genBeamInc = 0.0;
             }
          }
          else {
             genBeamInc = 0.0;
             genBeamLim = genBeam;
          }  
          break;
      case 'w':
         if (NextArg()!=STRINGARG)
            loadNetworks=TRUE;
         else {
            wdNetFn = GetStrArg();
            if (strlen(wdNetFn)==0) {
               wdNetFn=NULL;
               loadNetworks=TRUE;
            }
         }
         break;
      case 'u':
         maxActive = GetChkedInt(0,100000,s); break;      
      case 'v':
         wordBeam = GetChkedFlt(0,1.0E20,s); 
         if (wordBeam == 0.0)
            wordBeam = -LZERO;
         break;
      case 'x':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: HMM file extension expected");
         hmmExt = GetStrArg(); break;
      case 'y':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: Output label file extension expected");
         labExt = GetStrArg(); break;
      case 'z':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: Lattice output file extension expected");
         latExt = GetStrArg(); break;
      case 'F':
         if (NextArg() != STRINGARG)
            HError(3219,"HVite: Data File format expected");
         if((dfmt = Str2Format(GetStrArg())) == ALIEN)
            HError(-3289,"HVite: Warning ALIEN Input file format set");
         break;
      case 'G':
         if (NextArg() != STRINGARG)
            HError(3219,"HVite: Source Label File format expected");
         if((ifmt = Str2Format(GetStrArg())) == ALIEN)
            HError(-3289,"HVite: Warning ALIEN Input file format set");
         break;
      case 'H':
         if (NextArg() != STRINGARG)
            HError(3219,"HVite: MMF File name expected");
         AddMMF(&hset,GetStrArg()); 
         break;
      case 'I':
         if (NextArg() != STRINGARG)
            HError(3219,"HVite: MLF file name expected");
         LoadMasterFile(GetStrArg()); break;
      case 'L':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: Label/network file directory expected");
         labInDir = GetStrArg(); break;
      case 'P':
         if (NextArg() != STRINGARG)
            HError(3219,"HVite: Target Label File format expected");
         if((ofmt = Str2Format(GetStrArg())) == ALIEN)
            HError(-3289,"HVite: Warning ALIEN Label output file format set");
         break;
      case 'B':
         saveBinary = TRUE;
         break;
      case 'T':
         trace = GetChkedInt(0,511,s); break;
      case 'X':
         if (NextArg()!=STRINGARG)
            HError(3219,"HVite: Input label/network file extension expected");
         labInExt = GetStrArg(); break;
      case 'h':
	if (NextArg()!=STRINGARG)
	  HError(1,"Speaker name pattern expected");
	xfInfo.outSpkrPat = GetStrArg();
	if (NextArg()==STRINGARG) {
	  xfInfo.inSpkrPat = GetStrArg();
	  if (NextArg()==STRINGARG)
	    xfInfo.paSpkrPat = GetStrArg(); 
	}
	if (NextArg() != SWITCHARG)
	  HError(2319,"HERest: cannot have -h as the last option");	  
	break;
      case 'E':
         if (NextArg()!=STRINGARG)
            HError(2319,"HERest: parent transform directory expected");
	 xfInfo.usePaXForm = TRUE;
         xfInfo.paXFormDir = GetStrArg(); 
         if (NextArg()==STRINGARG)
	   xfInfo.paXFormExt = GetStrArg(); 
	 if (NextArg() != SWITCHARG)
	   HError(2319,"HVite: cannot have -E as the last option");	  
         break;              
      case 'J':
         if (NextArg()!=STRINGARG)
            HError(2319,"HERest: input transform directory expected");
         AddInXFormDir(&hset,GetStrArg());
         if (NextArg()==STRINGARG)
	   xfInfo.inXFormExt = GetStrArg(); 
	 if (NextArg() != SWITCHARG)
	   HError(2319,"HVite: cannot have -J as the last option");	  
         break;              
      case 'K':
         if (NextArg()!=STRINGARG)
            HError(2319,"HVite: output transform directory expected");
         xfInfo.outXFormDir = GetStrArg(); 
	 xfInfo.useOutXForm = TRUE;
         if (NextArg()==STRINGARG)
	   xfInfo.outXFormExt = GetStrArg(); 
	 if (NextArg() != SWITCHARG)
	   HError(2319,"HVite: cannot have -K as the last option");	  
         break;              
      default:
         HError(3219,"HVite: Unknown switch %s",s);
      }
   }
   
   if (NextArg()!=STRINGARG)
      HError(3219,"HVite: Dictionary file name expected");
   dictFn = GetStrArg();
   if (NextArg()!=STRINGARG)
      HError(3219,"HVite: HMM list  file name expected");
   hmmListFn = GetStrArg();

#ifndef PHNALG
   if ((states || models) && nToks>1)
      HError(3230,"HVite: Alignment using multiple tokens is not supported");
#endif
   if (NumArgs()==0 && wdNetFn==NULL)
      HError(3230,"HVite: Network must be specified for recognition from audio");
   if (loadNetworks && loadLabels)
      HError(3230,"HVite: Must choose either alignment from network or labels");
   if (nToks>1 && latExt==NULL && nTrans==1)
      HError(-3230,"HVite: Performing nbest recognition with no nbest output");
   if (nToks > 1 && latExt != NULL && nTrans > 1) 
      HError(-3230,"HVite: Performing nbest recognition with 1-best and latttices output");
   if ((update>0) && (!xfInfo.useOutXForm))
      HError(3230,"HVite: Must use -K option with incremental adaptation");


   Initialise();


   /* Process the data */
   if (wdNetFn==NULL)
      DoAlignment();
   else
      DoRecognition();

   /* Free up and we are done */

   if (trace & T_MEM) {
      printf("Memory State on Completion\n");
      PrintAllHeapStats();
   }


   DeleteVRecInfo(vri);
   ResetHeap(&netHeap);
   FreePSetInfo(psi);
   UpdateSpkrStats(&hset,&xfInfo, NULL); 
   ResetHeap(&regHeap);
   ResetHeap(&modelHeap);
   Exit(0);
   return (0);          /* never reached -- make compiler happy */
}